[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 06/09: WIDGET : ergonomy, show a number on th
From: |
dwm |
Subject: |
[Noalyss-commit] [noalyss] 06/09: WIDGET : ergonomy, show a number on the widget the dialog box to manage them appears |
Date: |
Mon, 19 Aug 2024 15:03:10 -0400 (EDT) |
sparkyx pushed a commit to branch unstable
in repository noalyss.
commit 0d4c6d23d0f37c0f5cae36bc7e2bdf636353ca67
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Mon Aug 19 18:38:48 2024 +0200
WIDGET : ergonomy, show a number on the widget
the dialog box to manage them appears
---
html/css/style-classic7.css | 13 ++++++++++
html/js/noalyss_script.js | 42 ++++++++++++++++++++++++++-----
include/widget/agenda/install.php | 2 +-
include/widget/ajax.php | 4 +--
include/widget/bookmark/install.php | 2 +-
include/widget/event/event-display.php | 2 +-
include/widget/invoice/invoice.php | 5 +++-
include/widget/last_operation/install.php | 2 +-
include/widget/todo_list/todo_list.php | 2 +-
include/widget/widget-development.md | 2 ++
include/widget/widget.php | 14 ++++++-----
11 files changed, 70 insertions(+), 20 deletions(-)
diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css
index 940c1606c..b93171e37 100644
--- a/html/css/style-classic7.css
+++ b/html/css/style-classic7.css
@@ -3562,4 +3562,17 @@ span.widget-name {
padding: 5px;
border-style: groove;
margin: 2px;
+ }
+/**
+ * show the number in the widget
+ */
+ .box_ident {
+ border-radius: 10px;
+ background: beige;
+ color: navy;
+ font-size: 3.4rem;
+ padding: 20px;
+ margin-left: 10px;
+ margin-top: 10px;
+ position:absolute;
}
\ No newline at end of file
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 2b2ec4dcb..836b0e182 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -4378,6 +4378,7 @@ Widget.prototype.display = function
(box,user_widget_id,widget_code) {
*/
Widget.prototype.manage = function () {
try {
+ this.show_ident();
var box = 'widget_box_id';
var queryString = {
gDossier: this.dossier_id,
@@ -4399,10 +4400,9 @@ Widget.prototype.manage = function () {
var y = calcy(200);
style = style + ' ;top : ' + y + 'px';
- add_div({id: box, cssclass: 'inner_box', html: loading(),
style: style})
+ add_div({id: box, cssclass: 'inner_box', html: loading(),
style: style,drag:true})
$(box).update(req.responseText);
-
}
}
);
@@ -4462,12 +4462,14 @@ Widget.prototype.save = function () {
{
alert_box(e.message);
}
+ this.remove_ident();
}
/**
* refresh the DASHBOARD (dashboard_div_id)
*/
Widget.prototype.refresh = function () {
try {
+ var here = this;
var dgbox='dashboard_div_id'
var queryString = {
op : 'widget',
@@ -4553,7 +4555,6 @@ Widget.prototype.add=function (widget_code) {
here=this;
var param = {};
if ($(widget_code+"_param")) {
- console.debug(`found a FORM`)
param=$(widget_code+"_param").serialize()
}
query = {
@@ -4578,8 +4579,7 @@ Widget.prototype.add=function (widget_code) {
$('contain_widget').appendChild(new_element);
new_element.replace(req.responseText)
removeDiv('widget_box_select_id')
- here.create_sortable()
- here.refresh()
+ here.create_sortable()
}
}
@@ -4589,4 +4589,34 @@ Widget.prototype.add=function (widget_code) {
alert_box(e.message);
}
-}
\ No newline at end of file
+}
+/**
+ * Show the number in the widget to improve the ergonomy
+ */
+Widget.prototype.show_ident = function ()
+{
+ var aBox = document.getElementsByClassName('widget-box') ;
+ var nb=aBox .length
+ var idx=1;
+ for (var e=0;e <nb; e++) {
+ if (aBox[e].visible)
+ {
+ var spanx=new Element('span');
+ spanx.addClassName("box_ident");
+ aBox[e].insertBefore(spanx,aBox[e].firstChild);
+ spanx.update(idx);
+ idx++
+ }
+ }
+}
+/**
+ * Hide the number of the widget
+ */
+Widget.prototype.remove_ident = function ()
+{
+ while (true) {
+ var elt=document.getElementsByClassName("box_ident");
+ if ( elt.length == 0) break;
+ elt[0].remove()
+ }
+}
diff --git a/include/widget/agenda/install.php
b/include/widget/agenda/install.php
index 1c92bc1f5..81a664552 100644
--- a/include/widget/agenda/install.php
+++ b/include/widget/agenda/install.php
@@ -25,4 +25,4 @@ global $cn;
$cn->exec_sql("
INSERT INTO widget_dashboard (wd_code,wd_description,wd_parameter,wd_name)
VALUES
-('agenda','Présentation d''un calendrier avec les dates de rappel des
événements',0,'Agenda')");
+('agenda','Présentation d''un calendrier avec les dates de rappel des
événements',0,'Calendrier')");
diff --git a/include/widget/ajax.php b/include/widget/ajax.php
index b6f095490..883778a51 100644
--- a/include/widget/ajax.php
+++ b/include/widget/ajax.php
@@ -77,7 +77,7 @@ if ( $action == 'widget.manage') {
echo '<ul class="aligned-block">';
- echo '<li>'.\HtmlInput::button_close('widget_box_id','button').'</li>';
+ echo
'<li>'.\HtmlInput::button_action(_('Fermer'),'widget.remove_ident();removeDiv('."'widget_box_id'".')').'</li>';
echo '<li>'.\HtmlInput::button_action(_('Sauver'),'widget.save()').'</li>';
echo
'<li>'.\HtmlInput::button_action(_('Ajouter'),'widget.input()').'</li>';
@@ -138,6 +138,6 @@ if ($action == 'widget.insert') {
$user_widget_id = $cn->get_value("insert into
user_widget(use_login,dashboard_widget_id,uw_parameter,uw_order)
values ($1,$2,$3,1000) returning
uw_id",[$g_user->getLogin(),$widget_id,$param]);
$widget=\Noalyss\Widget\Widget::build_user_widget($user_widget_id,
$widget_code);
- $widget->input();
+ $widget->input(false);
return;
}
\ No newline at end of file
diff --git a/include/widget/bookmark/install.php
b/include/widget/bookmark/install.php
index 463eb4cc5..05bc0254d 100644
--- a/include/widget/bookmark/install.php
+++ b/include/widget/bookmark/install.php
@@ -28,6 +28,6 @@ $cn->exec_sql("insert into widget_dashboard
(wd_code,wd_description,wd_parameter
'bookmark'
,'Raccourcis vers vos menus préférés'
,0
- ,'Raccourcis'
+ ,'Favoris'
)
);
diff --git a/include/widget/event/event-display.php
b/include/widget/event/event-display.php
index 27c7130da..e3e991188 100644
--- a/include/widget/event/event-display.php
+++ b/include/widget/event/event-display.php
@@ -21,7 +21,7 @@
* \file
* \brief display events for 10 days
*/
-echo h2('Actions','class="title"');
+echo h2(_("A faire"),'class="title"');
if ( empty ($array)) {
echo _("Aucun événement en retard ou prévu");
return;
diff --git a/include/widget/invoice/invoice.php
b/include/widget/invoice/invoice.php
index 0289821f3..116615308 100644
--- a/include/widget/invoice/invoice.php
+++ b/include/widget/invoice/invoice.php
@@ -22,7 +22,10 @@
* \brief display the next invoice to to be paid or late for customer or
supplier
*/
namespace Noalyss\Widget;
-
+/*!
+ * \class
+ * \brief display the next invoice to to be paid or late for customer or
supplier
+ */
class Invoice extends Widget
{
function input_parameter()
diff --git a/include/widget/last_operation/install.php
b/include/widget/last_operation/install.php
index bb64a0a98..9a9b7329a 100644
--- a/include/widget/last_operation/install.php
+++ b/include/widget/last_operation/install.php
@@ -25,6 +25,6 @@ global $cn;
$cn->exec_sql("
INSERT INTO widget_dashboard (wd_code,wd_description,wd_parameter,wd_name)
VALUES
- ('last_operation','Affichage des dernières opérations comptables
saisies',0,'Comptabilité');
+ ('last_operation','Affichage des dernières opérations comptables
saisies',0,'Dernières opérations');
");
diff --git a/include/widget/todo_list/todo_list.php
b/include/widget/todo_list/todo_list.php
index e572c0f22..2434a013b 100644
--- a/include/widget/todo_list/todo_list.php
+++ b/include/widget/todo_list/todo_list.php
@@ -39,7 +39,7 @@ class Todo_List extends Widget
function display()
{
global $cn;
- echo '<div class="box" id="todo_list">';
+ echo '<div class="box widget-box" id="todo_list" >';
echo \HtmlInput::title_box(_('Pense-Bête'), "todo_listg_div", 'zoom',
"zoom_todo()", 'n');
echo \Dossier::hidden();
$todo = new \Todo_List($cn);
diff --git a/include/widget/widget-development.md
b/include/widget/widget-development.md
index aba462ce8..08a095d54 100644
--- a/include/widget/widget-development.md
+++ b/include/widget/widget-development.md
@@ -88,6 +88,8 @@ Exemple pour mini_report
Toujours commencer par un DIV (id=code_widget+uw_id), Widget::open_div et
Widget::close_div
+Ce DIV doit avoir comme classe **box** et **widget-box** , le **widget-box**
permet de numéroter les boites.
+
Exemple :
$this->open_div();
diff --git a/include/widget/widget.php b/include/widget/widget.php
index 3ccb38c34..c70da92d4 100644
--- a/include/widget/widget.php
+++ b/include/widget/widget.php
@@ -71,9 +71,10 @@ abstract class Widget
* of the widget if it exists
* @return mixed
*/
- function input()
+ function input($flnumber=true)
{
-
+ static $nb=0;
+ $nb++;
//read description from database
$row=$this->db->get_row("
select
@@ -86,8 +87,9 @@ abstract class Widget
where
wd_code=$1",
[$this->widget_code]);
-
- echo "<li id=\"elt_{$this->user_widget_id}\"> <span
class='widget-name'>{$row['wd_name']}</span>{$row['wd_description']}";
+ $strNumber="";
+ if ( $flnumber) $strNumber="[ $nb ]";
+ echo "<li id=\"elt_{$this->user_widget_id}\"> $strNumber <span
class='widget-name'>{$row['wd_name']}</span>{$row['wd_description']}";
if ( $this->user_widget_id > 0) {
if ( $row['wd_parameter'] == 1) {
@@ -153,7 +155,7 @@ where use_login=$1 order by uw.uw_order
* @return void
*/
function open_div() {
- printf( '<div id="%s_%s"
class="box">',$this->widget_code,$this->user_widget_id);
+ printf( '<div id="%s_%s" class="box
widget-box">',$this->widget_code,$this->user_widget_id);
}
function close_div() {
echo '</div>';
@@ -259,7 +261,7 @@ EOF;
echo '<ul id="widget_add" class="list-unstyled">';
foreach ($aWidget as $item) {
$widget=Widget::build_user_widget(-1,$item['wd_code']);
- $widget?->input();
+ $widget?->input(false);
}
echo '</ul>';
- [Noalyss-commit] [noalyss] branch unstable updated (bed2fd54a -> ffa6cb848), dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 04/09: Documentation, dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 02/09: Widget : add install.php for each, dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 03/09: Widget : javascript variable uniq, dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 08/09: PHPUnit : update test, dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 09/09: Cosmetic : loading of widget, dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 06/09: WIDGET : ergonomy, show a number on the widget the dialog box to manage them appears,
dwm <=
- [Noalyss-commit] [noalyss] 01/09: widget : Creation of widget for the DASHBOARD Contains widget Agenda, Todo List, Report , ..., dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 05/09: Cosmetic and Documentation, dwm, 2024/08/19
- [Noalyss-commit] [noalyss] 07/09: WIDGET : db upgrade 199, dwm, 2024/08/19