New: Enhance box management
This commit is contained in:
parent
1ddcd5ffb0
commit
d59848e18e
@ -52,55 +52,85 @@ if ($action == 'addconst')
|
|||||||
|
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid";
|
$error=0;
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes";
|
|
||||||
$sql.= " WHERE fk_user = 0";
|
|
||||||
$sql.= " AND box_id = ".$_POST["boxid"];
|
|
||||||
$sql.= " AND position = ".$_POST["pos"];
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$db->begin();
|
||||||
dol_syslog("boxes.php::search if box active sql=".$sql);
|
|
||||||
if ($resql)
|
// Initialize distinctfkuser with all already existing values of fk_user (user that use a personalized view of boxes for pos)
|
||||||
|
$distinctfkuser=array();
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$sql = "SELECT fk_user";
|
||||||
if ($num == 0)
|
$sql.= " FROM ".MAIN_DB_PREFIX."user_param";
|
||||||
|
$sql.= " WHERE param = 'MAIN_BOXES_".$db->escape(GETPOST("pos","alpha"))."' AND value = '1'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
dol_syslog("boxes.php search fk_user to activate box for sql=".$sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$num = $db->num_rows($resql);
|
||||||
|
$i=0;
|
||||||
// Si la boite n'est pas deja active, insert with box_order=''
|
while ($i < $num)
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
{
|
||||||
$sql.= "box_id";
|
$obj=$db->fetch_object($resql);
|
||||||
$sql.= ", position";
|
$distinctfkuser[$obj->fk_user]=$obj->fk_user;
|
||||||
$sql.= ", box_order";
|
$i++;
|
||||||
$sql.= ", fk_user";
|
}
|
||||||
$sql.= ") values (";
|
|
||||||
$sql.= $_POST["boxid"];
|
|
||||||
$sql.= ", ".$_POST["pos"];
|
|
||||||
$sql.= ", ''";
|
|
||||||
$sql.= ", 0";
|
|
||||||
$sql.= ")";
|
|
||||||
|
|
||||||
dol_syslog("boxes.php activate box sql=".$sql);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
|
|
||||||
// Remove all personalized setup when a box is activated or disabled (to be sure user see new box)
|
|
||||||
// TODO Disable this when adding combo will be available on home page for each user.
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param WHERE param LIKE 'MAIN_BOXES_%'";
|
|
||||||
dol_syslog("boxes.php delete user_param sql=".$sql);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes WHERE fk_user != 0";
|
|
||||||
dol_syslog("boxes.php delete user_param sql=".$sql);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
|
|
||||||
$db->commit();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errmesg=$db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($distinctfkuser as $fk_user)
|
||||||
|
{
|
||||||
|
if (! $error && $fk_user != 0) // We will add fk_user = 0 later.
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
||||||
|
$sql.= "box_id, position, box_order, fk_user";
|
||||||
|
$sql.= ") values (";
|
||||||
|
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', ".$fk_user;
|
||||||
|
$sql.= ")";
|
||||||
|
|
||||||
|
dol_syslog("boxes.php activate box sql=".$sql);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
$errmesg=$db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If value 0 was not included, we add it.
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
||||||
|
$sql.= "box_id, position, box_order, fk_user";
|
||||||
|
$sql.= ") values (";
|
||||||
|
$sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", 'A01', 0";
|
||||||
|
$sql.= ")";
|
||||||
|
|
||||||
|
dol_syslog("boxes.php activate box sql=".$sql);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
$errmesg=$db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
Header("Location: boxes.php");
|
Header("Location: boxes.php");
|
||||||
|
$db->commit();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +206,8 @@ print_fiche_titre($langs->trans("Boxes"),'','setup');
|
|||||||
|
|
||||||
print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
|
print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
|
||||||
|
|
||||||
|
dol_htmloutput_errors($errmesg);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Recherche des boites actives par defaut pour chaque position possible
|
* Recherche des boites actives par defaut pour chaque position possible
|
||||||
@ -212,7 +244,7 @@ if ($resql)
|
|||||||
// This occurs just after an insert.
|
// This occurs just after an insert.
|
||||||
if ($decalage)
|
if ($decalage)
|
||||||
{
|
{
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order=".$decalage." WHERE rowid=".$obj->rowid;
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes set box_order='".$decalage."' WHERE rowid=".$obj->rowid;
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,13 +268,13 @@ if ($resql)
|
|||||||
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "A0".$record['box_order'];
|
$box_order = "A0".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = ".$record['box_order'];
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "B0".$record['box_order'];
|
$box_order = "B0".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = ".$record['box_order'];
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,13 +283,13 @@ if ($resql)
|
|||||||
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "A".$record['box_order'];
|
$box_order = "A".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = ".$record['box_order'];
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1)))
|
||||||
{
|
{
|
||||||
$box_order = "B".$record['box_order'];
|
$box_order = "B".$record['box_order'];
|
||||||
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = ".$record['box_order'];
|
$sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE box_order = '".$record['box_order']."'";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
111
htdocs/boxes.php
111
htdocs/boxes.php
@ -27,49 +27,41 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a HTML Tab with boxes of a particular area including personalized choices of user
|
* Show a HTML Tab with boxes of a particular area including personalized choices of user
|
||||||
*
|
*
|
||||||
* @param User $user Object User
|
* @param User $user Object User
|
||||||
* @param String $areacode Code of area for pages (0=value for Home page)
|
* @param String $areacode Code of area for pages (0=value for Home page)
|
||||||
* @return int <0 if KO, Nb of boxes shown of OK (0 to n)
|
* @return int <0 if KO, Nb of boxes shown of OK (0 to n)
|
||||||
*/
|
*/
|
||||||
function printBoxesArea($user,$areacode)
|
function printBoxesArea($user,$areacode)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
|
|
||||||
$infobox=new InfoBox($db);
|
$infobox=new InfoBox($db);
|
||||||
$boxarray=$infobox->listboxes('activated',$areacode,$user);
|
$boxactivated=$infobox->listboxes('activated',$areacode,$user);
|
||||||
|
$arrayboxactivatedid=array();
|
||||||
|
foreach($boxactivated as $box) $arrayboxactivatedid[$box->id]=$box->id;
|
||||||
|
|
||||||
$selectboxlist='';
|
$selectboxlist='';
|
||||||
/*
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, file, note, tms";
|
$emptyuser=new User($db);
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def";
|
$boxavailable=$infobox->listboxes('available',$areacode,$emptyuser,$arrayboxactivatedid);
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
$var=true;
|
|
||||||
|
|
||||||
if ($resql)
|
$arrayboxtoactivatelabel=array();
|
||||||
|
foreach($boxavailable as $box)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$arrayboxtoactivatelabel[$box->id]=$box->boxlabel;
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
// Boucle sur toutes les boites
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}*/
|
$form=new Form($db);
|
||||||
|
// TODO enable
|
||||||
|
//$selectboxlist=$form->selectarray('boxcombo', $arrayboxtoactivatelabel);
|
||||||
|
}
|
||||||
|
|
||||||
if (count($boxarray))
|
print load_fiche_titre($langs->trans("OtherInformationsBoxes"),$selectboxlist,'','','otherboxes');
|
||||||
|
|
||||||
|
if (count($boxactivated))
|
||||||
{
|
{
|
||||||
print load_fiche_titre($langs->trans("OtherInformationsBoxes"),$selectboxlist,'','','otherboxes');
|
|
||||||
|
|
||||||
print '<table width="100%" class="notopnoleftnoright">';
|
print '<table width="100%" class="notopnoleftnoright">';
|
||||||
print '<tr><td class="notopnoleftnoright">'."\n";
|
print '<tr><td class="notopnoleftnoright">'."\n";
|
||||||
|
|
||||||
@ -83,13 +75,13 @@ function printBoxesArea($user,$areacode)
|
|||||||
if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
|
if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
|
||||||
|
|
||||||
$ii=0;
|
$ii=0;
|
||||||
foreach ($boxarray as $key => $box)
|
foreach ($boxactivated as $key => $box)
|
||||||
{
|
{
|
||||||
if (preg_match('/^A/i',$box->box_order)) // column A
|
if (preg_match('/^A/i',$box->box_order)) // column A
|
||||||
{
|
{
|
||||||
$ii++;
|
$ii++;
|
||||||
//print 'box_id '.$boxarray[$ii]->box_id.' ';
|
//print 'box_id '.$boxactivated[$ii]->box_id.' ';
|
||||||
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
|
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
|
||||||
// Affichage boite key
|
// Affichage boite key
|
||||||
$box->loadBox($box_max_lines);
|
$box->loadBox($box_max_lines);
|
||||||
$box->showBox();
|
$box->showBox();
|
||||||
@ -111,13 +103,13 @@ function printBoxesArea($user,$areacode)
|
|||||||
print '<div id="right" class="connectedSortable">'."\n";
|
print '<div id="right" class="connectedSortable">'."\n";
|
||||||
|
|
||||||
$ii=0;
|
$ii=0;
|
||||||
foreach ($boxarray as $key => $box)
|
foreach ($boxactivated as $key => $box)
|
||||||
{
|
{
|
||||||
if (preg_match('/^B/i',$box->box_order)) // colonne B
|
if (preg_match('/^B/i',$box->box_order)) // colonne B
|
||||||
{
|
{
|
||||||
$ii++;
|
$ii++;
|
||||||
//print 'box_id '.$boxarray[$ii]->box_id.' ';
|
//print 'box_id '.$boxactivated[$ii]->box_id.' ';
|
||||||
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
|
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
|
||||||
// Affichage boite key
|
// Affichage boite key
|
||||||
$box->loadBox($box_max_lines);
|
$box->loadBox($box_max_lines);
|
||||||
$box->showBox();
|
$box->showBox();
|
||||||
@ -143,6 +135,7 @@ function printBoxesArea($user,$areacode)
|
|||||||
{
|
{
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<script type="text/javascript" language="javascript">';
|
print '<script type="text/javascript" language="javascript">';
|
||||||
|
// For moving
|
||||||
print 'jQuery(function() {
|
print 'jQuery(function() {
|
||||||
jQuery("#left, #right").sortable({
|
jQuery("#left, #right").sortable({
|
||||||
/* placeholder: \'ui-state-highlight\', */
|
/* placeholder: \'ui-state-highlight\', */
|
||||||
@ -152,25 +145,32 @@ function printBoxesArea($user,$areacode)
|
|||||||
containment: \'.fiche\',
|
containment: \'.fiche\',
|
||||||
connectWith: \'.connectedSortable\',
|
connectWith: \'.connectedSortable\',
|
||||||
stop: function(event, ui) {
|
stop: function(event, ui) {
|
||||||
updateOrder();
|
updateOrder(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
';
|
'."\n";
|
||||||
print "\n";
|
print 'function updateOrder() {
|
||||||
print 'function updateOrder(){'."\n";
|
var left_list = cleanSerialize(jQuery("#left").sortable("serialize" ));
|
||||||
print 'var left_list = cleanSerialize(jQuery("#left").sortable("serialize" ));'."\n";
|
var right_list = cleanSerialize(jQuery("#right").sortable("serialize" ));
|
||||||
print 'var right_list = cleanSerialize(jQuery("#right").sortable("serialize" ));'."\n";
|
var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
|
||||||
print 'var boxorder = \'A:\' + left_list + \'-B:\' + right_list;'."\n";
|
var userid = \''.$user->id.'\';
|
||||||
//print 'alert(\'boxorder=\' + boxorder);';
|
jQuery.get(\''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&userid=\'+'.$user->id.');
|
||||||
print 'var userid = \''.$user->id.'\';'."\n";
|
}'."\n";
|
||||||
print 'jQuery.get(\'core/ajax/box.php?boxorder=\'+boxorder+\'&userid=\'+'.$user->id.');'."\n";
|
// For closing
|
||||||
print '}'."\n";
|
print 'jQuery(document).ready(function() {
|
||||||
|
jQuery(".boxclose").click(function() {
|
||||||
|
var self = this; // because JQuery can modify this
|
||||||
|
var boxid=self.id.substring(8);
|
||||||
|
jQuery(\'#boxto_\'+boxid).remove();
|
||||||
|
updateOrder();
|
||||||
|
});
|
||||||
|
});'."\n";
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count($boxarray);
|
return count($boxactivated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ class InfoBox
|
|||||||
* @param string $mode 'available' or 'activated'
|
* @param string $mode 'available' or 'activated'
|
||||||
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
|
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
|
||||||
* @param User $user Objet user to filter (used only if $zone >= 0)
|
* @param User $user Objet user to filter (used only if $zone >= 0)
|
||||||
* @param array $excludelist Array of box.box_id = boxes_def.rowid to exclude
|
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
|
||||||
* @return array Array of boxes
|
* @return array Array of boxes
|
||||||
*/
|
*/
|
||||||
function listBoxes($mode,$zone,$user,$excludelist=array())
|
function listBoxes($mode,$zone,$user,$excludelist=array())
|
||||||
@ -259,6 +259,7 @@ class InfoBox
|
|||||||
|
|
||||||
// box properties
|
// box properties
|
||||||
$box->rowid=$obj->rowid;
|
$box->rowid=$obj->rowid;
|
||||||
|
$box->id=$obj->box_id;
|
||||||
$box->position=$obj->position;
|
$box->position=$obj->position;
|
||||||
$box->box_order=$obj->box_order;
|
$box->box_order=$obj->box_order;
|
||||||
$box->fk_user=$obj->fk_user;
|
$box->fk_user=$obj->fk_user;
|
||||||
@ -302,14 +303,13 @@ class InfoBox
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save order of boxes for area and user
|
* Save order of boxes for area and user
|
||||||
*
|
*
|
||||||
* @param string $zone Name of area (0 for Homepage, ...)
|
* @param string $zone Name of area (0 for Homepage, ...)
|
||||||
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
|
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
|
||||||
* @param int $userid Id of user
|
* @param int $userid Id of user
|
||||||
* @return int <0 if KO, >= 0 if OK
|
* @return int <0 if KO, >= 0 if OK
|
||||||
*/
|
*/
|
||||||
function saveboxorder($zone,$boxorder,$userid=0)
|
function saveboxorder($zone,$boxorder,$userid=0)
|
||||||
{
|
{
|
||||||
@ -319,7 +319,7 @@ class InfoBox
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::saveboxorder zone=".$zone." user=".$userid);
|
dol_syslog(get_class($this)."::saveboxorder zone=".$zone." userid=".$userid);
|
||||||
|
|
||||||
if (! $userid || $userid == 0) return 0;
|
if (! $userid || $userid == 0) return 0;
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ class InfoBox
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Sauve parametre indiquant que le user a une
|
// Sauve parametre indiquant que le user a une config dediee
|
||||||
$confuserzone='MAIN_BOXES_'.$zone;
|
$confuserzone='MAIN_BOXES_'.$zone;
|
||||||
$tab[$confuserzone]=1;
|
$tab[$confuserzone]=1;
|
||||||
if (dol_set_user_param($this->db, $conf, $user, $tab) < 0)
|
if (dol_set_user_param($this->db, $conf, $user, $tab) < 0)
|
||||||
@ -338,6 +338,7 @@ class InfoBox
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete all lines
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||||
$sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def";
|
$sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def";
|
||||||
$sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid";
|
$sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid";
|
||||||
@ -355,7 +356,7 @@ class InfoBox
|
|||||||
$part=explode(':',$collist);
|
$part=explode(':',$collist);
|
||||||
$colonne=$part[0];
|
$colonne=$part[0];
|
||||||
$list=$part[1];
|
$list=$part[1];
|
||||||
dol_syslog('InfoBox::saveboxorder column='.$colonne.' list='.$list);
|
dol_syslog(get_class($this)."::saveboxorder column=".$colonne.' list='.$list);
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
$listarray=explode(',',$list);
|
$listarray=explode(',',$list);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/ajax/box.php
|
* \file htdocs/core/ajax/box.php
|
||||||
* \brief File to return Ajax response on Box move
|
* \brief File to return Ajax response on Box move or close
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||||
@ -45,14 +45,14 @@ top_httphead();
|
|||||||
|
|
||||||
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||||
|
|
||||||
// Registering the location of boxes
|
// Registering the location of boxes after a move
|
||||||
if((isset($_GET['boxorder']) && !empty($_GET['boxorder'])) && (isset($_GET['userid']) && !empty($_GET['userid'])))
|
if (GETPOST('boxorder') && GETPOST('userid'))
|
||||||
{
|
{
|
||||||
// boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B"
|
// boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B"
|
||||||
dol_syslog("AjaxBox boxorder=".$_GET['boxorder']." userid=".$_GET['userid'], LOG_DEBUG);
|
dol_syslog("AjaxBox boxorder=".GETPOST('boxorder')." userid=".GETPOST('userid'), LOG_DEBUG);
|
||||||
|
|
||||||
$infobox=new InfoBox($db);
|
$infobox=new InfoBox($db);
|
||||||
$result=$infobox->saveboxorder("0",$_GET['boxorder'],$_GET['userid']);
|
$result=$infobox->saveboxorder("0",GETPOST('boxorder'),GETPOST('userid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class box_actions extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastActions");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastActions");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class box_bookmarks extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxMyLastBookmarks");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxMyLastBookmarks");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class box_clients extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastCustomers");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastCustomers");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class box_commandes extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastCustomerOrders");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastCustomerOrders");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class box_comptes extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans('BoxCurrentAccounts');
|
$this->boxlabel=$langs->transnoentitiesnoconv('BoxCurrentAccounts');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class box_contacts extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastContacts");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastContacts");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class box_contracts extends ModeleBoxes
|
|||||||
|
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastContracts");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastContracts");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class box_external_rss extends ModeleBoxes
|
|||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
$this->param=$param;
|
$this->param=$param;
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastRssInfos");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastRssInfos");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class box_factures extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastCustomerBills");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastCustomerBills");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class box_factures_fourn extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastSupplierBills");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastSupplierBills");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class box_factures_fourn_imp extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxOldestUnpaidSupplierBills");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxOldestUnpaidSupplierBills");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class box_factures_imp extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxOldestUnpaidCustomerBills");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxOldestUnpaidCustomerBills");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class box_fournisseurs extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastSuppliers");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastSuppliers");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class box_members extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastMembers");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastMembers");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class box_osc_clients extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxNbOfCustomers");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxNbOfCustomers");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class box_produits extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastProducts");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProducts");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class box_propales extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastProposals");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProposals");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class box_prospect extends ModeleBoxes
|
|||||||
$this->db=$DB;
|
$this->db=$DB;
|
||||||
$this->param=$param;
|
$this->param=$param;
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastProspects");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProspects");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class box_services_contracts extends ModeleBoxes
|
|||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxLastProductsInContract");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProductsInContract");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class box_services_expired extends ModeleBoxes
|
|||||||
|
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
|
||||||
$this->boxlabel=$langs->trans("BoxOldestExpiredServices");
|
$this->boxlabel=$langs->transnoentitiesnoconv("BoxOldestExpiredServices");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -148,9 +148,10 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
|
|||||||
}
|
}
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print '</td><td class="nocellnopadd" width="14">';
|
print '</td><td class="nocellnopadd" width="30" nowrap="nowrap">';
|
||||||
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
|
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
|
||||||
print img_picto($langs->trans("MoveBox",$this->box_id),'uparrow','class="boxhandle" style="cursor:move;"');
|
print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle" style="cursor:move;"');
|
||||||
|
print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -226,17 +227,6 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complete line to max
|
|
||||||
/*
|
|
||||||
while ($i < $this->max)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
print '<tr '.$bcx[$var].'><td colspan="'.$nbcol.'"> </td></tr>';
|
|
||||||
$i++;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//print "</table>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($head['text']) || ! empty($head['sublink']) || $nblines)
|
if (! empty($head['text']) || ! empty($head['sublink']) || $nblines)
|
||||||
|
|||||||
@ -613,7 +613,7 @@ abstract class DolibarrModules
|
|||||||
$lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid");
|
$lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid");
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user)";
|
||||||
$sql.= " VALUES (".$lastid.", 0, 0, 0)";
|
$sql.= " VALUES (".$lastid.", 0, '0', 0)";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert_boxes sql=".$sql);
|
dol_syslog(get_class($this)."::insert_boxes sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
BIN
htdocs/theme/auguria/img/close.png
Normal file
BIN
htdocs/theme/auguria/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 343 B |
BIN
htdocs/theme/bureau2crea/img/close.png
Normal file
BIN
htdocs/theme/bureau2crea/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 343 B |
BIN
htdocs/theme/cameleo/img/close.png
Normal file
BIN
htdocs/theme/cameleo/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 343 B |
BIN
htdocs/theme/eldy/img/close.png
Normal file
BIN
htdocs/theme/eldy/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 343 B |
BIN
htdocs/theme/phones/smartphone/theme/default/img/close.png
Normal file
BIN
htdocs/theme/phones/smartphone/theme/default/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 343 B |
Loading…
Reference in New Issue
Block a user