Author: rhari
Date: Thu May 3 14:33:43 2007
New Revision: 405
URL: http://svn.gna.org/viewcvs/phplinker?rev=405&view=rev
Log:
#132
fonctions show et hide categories
Modified:
trunk/smarty/default/templates/admin/category.tpl
trunk/www/js/drag-drop-folder-tree.js
trunk/www/lib/category.php
Modified: trunk/smarty/default/templates/admin/category.tpl
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/smarty/default/templates/admin/category.tpl?rev=405&r1=404&r2=405&view=diff
==============================================================================
--- trunk/smarty/default/templates/admin/category.tpl (original)
+++ trunk/smarty/default/templates/admin/category.tpl Thu May 3 14:33:43 2007
@@ -166,6 +166,17 @@
alert(x.getElementsByTagName("h3")[0].childNodes[0].nodeValue);
}
+function moreModifsExists (j)
+{
+ var tmpNode = document.getElementById("root");
+ var tmpelts = tmpNode.getElementsByTagName("LI");
+ for (i=j;i<tmpelts.length;i++)
+ if (tmpelts[i].getAttribute('Modified') == 'true')
+ return true;
+
+ return false;
+}
+
function saveCateg (){
if (deleteIds != ""){
@@ -183,6 +194,7 @@
texte =
x.getElementsByTagName("A")[0].childNodes[0].nodeValue;
tag = elts[no].getAttribute('id_ad_tag');
id_parent = elts[no].parentNode.parentNode.id;
+ visibility = elts[no].getAttribute('visible');
if (id_parent == 'root')
id_parent = 0;
else
@@ -190,12 +202,12 @@
id = id.substring(6);
// alert("ID : " + id + "\nNom : " + texte + "\nTag : " +
tag + "\nParent : " + id_parent);
- tmpIndice = no + 1;
- if (tmpIndice == elts.length)
+
+ if (moreModifsExists (no+1))
+ last = 'false';
+ else
last = 'true';
- else
- last = 'false';
- xajax_linker_upd_category(id, id_parent, tag, texte, -1,
last);
+ xajax_linker_upd_category(id, id_parent, tag, texte,
visibility, last);
}
}
Modified: trunk/www/js/drag-drop-folder-tree.js
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/js/drag-drop-folder-tree.js?rev=405&r1=404&r2=405&view=diff
==============================================================================
--- trunk/www/js/drag-drop-folder-tree.js (original)
+++ trunk/www/js/drag-drop-folder-tree.js Thu May 3 14:33:43 2007
@@ -953,6 +953,22 @@
obj.previousSibling.select();
}
,
+ showItem : function(obj1,obj2)
+ {
+ currentItemToEdit = obj2.parentNode;
+ currentItemToEdit.setAttribute('visible', '1');
+ currentItemToEdit.setAttribute('Modified', 'true');
+ currentItemToEdit.setAttribute('Show', 'true');
+ }
+ ,
+ hideItem : function(obj1,obj2)
+ {
+ currentItemToEdit = obj2.parentNode;
+ currentItemToEdit.setAttribute('visible', '0');
+ currentItemToEdit.setAttribute('Modified', 'true');
+ currentItemToEdit.setAttribute('Hide', 'true');
+ }
+ ,
renameItem : function(obj1,obj2)
{
currentItemToEdit = obj2.parentNode; // Reference to
the <li> tag.
Modified: trunk/www/lib/category.php
URL:
http://svn.gna.org/viewcvs/phplinker/trunk/www/lib/category.php?rev=405&r1=404&r2=405&view=diff
==============================================================================
--- trunk/www/lib/category.php (original)
+++ trunk/www/lib/category.php Thu May 3 14:33:43 2007
@@ -156,25 +156,27 @@
$objResponse = new xajaxResponse();
// if (!linker_category_exist($id_parent, $name)){
- $visibilite = ($visible != -1)?"visible = '".$visible."',":"";
- $visibilite2 = ($visible != -1)?", set visibility as ".$visible:"";
- $qry = "UPDATE category SET
+ if ($visible == '0')
+ linker_set_category_invisible ($id, true, $name);
+ $visibilite = ($visible != -1)?"visible = '".$visible."',":"";
+ $visibilite2 = ($visible != -1)?", set visibility as ".$visible:"";
+ $qry = "UPDATE category SET
id_parent = ".$id_parent.",
id_ad_tag = ".$id_ad_tag.",
".$visibilite."
name = '".utf8_decode($name)."'
WHERE id = ".$id;
- $qry = sql_query('die',__FILE__,__LINE__,__FUNCTION__,$qry);
-
- linker_log("[".$_SESSION['login'] ."]Update category $id set id_parent as
$id_parent, set id_ad_tag as $id_ad_tag, set name as $name $visibilite2");
-
-// }
- if ($last === 'true')
- $objResponse->addAlert("Modifications enregistrées");
-// $ens = array(2437,2402,2403);
-// if (in_array($id, $ens)){
-// $objResponse->addAlert("vita");
-// }
+ $qry = sql_query('die',__FILE__,__LINE__,__FUNCTION__,$qry);
+
+ linker_log("[".$_SESSION['login'] ."]Update category $id set id_parent as
$id_parent, set id_ad_tag as $id_ad_tag, set name as $name $visibilite2");
+
+ // }
+ if ($last === 'true')
+ $objResponse->addAlert("Modifications enregistrées");
+ // $ens = array(2437,2402,2403);
+ // if (in_array($id, $ens)){
+ // $objResponse->addAlert("vita");
+ // }
return $objResponse->getXML();
}
@@ -319,19 +321,21 @@
}
}
-function linker_set_category_invisible ($id_categ, $recursive = false) {
+function linker_set_category_invisible ($id_categ, $recursive = false, $name =
"") {
if(linker_check_unsigned_int($id_categ) ){
if ($recursive){
- $qry1 = "SELECT id FROM category WHERE id_parent = ".$id_categ;
+ $qry1 = "SELECT id,name FROM category WHERE id_parent = ".$id_categ;
$qry1 = sql_query('die',__FILE__,__LINE__,__FUNCTION__, $qry1);
while ($data = mysql_fetch_array($qry1)){
linker_set_category_invisible ($data['id'], $recursive);
$qry2 = "UPDATE category SET visible = '0' WHERE id = ".$data['id'];
sql_query('die',__FILE__,__LINE__,__FUNCTION__, $qry2);
+ linker_log("[".$_SESSION['login'] ."]Update category set
".$data['name']." not visible");
}
}
$qry3 = "UPDATE category SET visible = '0' WHERE id = ".$id_categ;
sql_query('die',__FILE__,__LINE__,__FUNCTION__, $qry3);
+ linker_log("[".$_SESSION['login'] ."]Update category set ".$name." not
visible");
}
}
_______________________________________________
PHPLinker-commits mailing list
[email protected]
https://mail.gna.org/listinfo/phplinker-commits