WIDGET : ergonomy, show a number on the widget
the dialog box to manage them appears
This commit is contained in:
parent
b9dc257e69
commit
0d4c6d23d0
11 changed files with 70 additions and 20 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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')");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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'
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
||||
");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue