From 73e97a31bed9b11ddcc34c3cf994aa2b87795f04 Mon Sep 17 00:00:00 2001 From: Chouchen Date: Wed, 22 Sep 2010 14:02:40 +0000 Subject: [PATCH] =?UTF-8?q?Automatisation=20de=20l'ajax=20"visibility"=20A?= =?UTF-8?q?jout=20de=20la=20m=C3=A9thode=20setVisibility=20=C3=A0=203=20Mo?= =?UTF-8?q?d=C3=A8les=20Bug=20Chrome=20sur=20les=20liens=20=C3=A9limin?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ajax/post-config.php | 34 +++++++--------------------------- class/AccueilModules.php | 8 ++++---- class/Links.php | 14 +++++++++++++- class/Notes.php | 12 ++++++++++++ class/Ouifm.php | 12 ++++++++++++ class/Rssblogs.php | 6 +++--- db/links.xml | 32 ++++++++++++++++---------------- js/jquery.links.js | 20 ++++++++++++++++++-- js/main.js | 6 ++++++ 9 files changed, 91 insertions(+), 53 deletions(-) diff --git a/ajax/post-config.php b/ajax/post-config.php index 105c98a..1022d43 100644 --- a/ajax/post-config.php +++ b/ajax/post-config.php @@ -1,29 +1,9 @@ -item; -$config_xml[0]->visibility = $clock; -$config_xml[1]->visibility = $weather; -$config_xml[2]->visibility = $notes; -$config_xml[3]->visibility = $search; -$config_xml[4]->visibility = $links; -$config_xml[5]->visibility = $blogs; -$config_xml[6]->visibility = $todo; -$config_xml[7]->visibility = $clockAdvanced; -$config_xml[8]->visibility = $rssblogs; -$config_xml[9]->visibility = $news; -$xmla->asXML('../db/config.xml'); - + $valeur){ + AccueilModules::updateModule($module, array('visibility'=>$valeur)); +} echo "1"; ?> diff --git a/class/AccueilModules.php b/class/AccueilModules.php index c74ee72..b3f1f01 100644 --- a/class/AccueilModules.php +++ b/class/AccueilModules.php @@ -65,14 +65,14 @@ class AccueilModules { $(\'#config-submit\').live(\'click\',function(e){ $(this).replaceWith(\'\'); var data3 = {'; + $temp = ''; foreach($this->modules as $module=>$moduleConf){ - echo '\''.$module.'\' : $(\'input[type=radio][name='.$module.'_group]:checked\').attr(\'value\'),'; + $temp .= '\''.$module.'\' : $(\'input[type=radio][name='.$module.'_group]:checked\').attr(\'value\'),'; } + echo substr($temp, 0, -1); echo '}; $.post(\'ajax/post-config.php\',data3,function(msg3){ - if(msg3=="1"){ - location.reload(); - } + location.reload(); }); e.preventDefault(); }); diff --git a/class/Links.php b/class/Links.php index 97a68f5..e4dab5c 100644 --- a/class/Links.php +++ b/class/Links.php @@ -19,7 +19,7 @@ class links { echo ''.$label['id'].'
'; @@ -50,6 +50,18 @@ class links { echo "ok"; } + public function setVisibility($visibility){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='links']"); + $path[0]->visibility = $visibility; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public static function updateConfig($updated){ foreach ($updated as $what=>$withWhat){ if(in_array($what, self::$paramsList)){ diff --git a/class/Notes.php b/class/Notes.php index cf8c987..2fbc07a 100644 --- a/class/Notes.php +++ b/class/Notes.php @@ -23,6 +23,18 @@ class notes extends Module { $notes = new notes($params); } + public function setVisibility($visibility){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='notes']"); + $path[0]->visibility = $visibility; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public static function updateConfig($updated){ foreach ($updated as $what=>$withWhat){ if(in_array($what, self::$paramsList)){ diff --git a/class/Ouifm.php b/class/Ouifm.php index a98d322..42dfd9a 100644 --- a/class/Ouifm.php +++ b/class/Ouifm.php @@ -23,6 +23,18 @@ class ouifm extends Module { $ouifm = new ouifm($params); } + public function setVisibility($visibility){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='ouifm']"); + $path[0]->visibility = $visibility; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public static function updateConfig($updated){ foreach ($updated as $what=>$withWhat){ if(in_array($what, self::$paramsList)){ diff --git a/class/Rssblogs.php b/class/Rssblogs.php index 227b321..22c7b37 100644 --- a/class/Rssblogs.php +++ b/class/Rssblogs.php @@ -42,7 +42,7 @@ class rssblogs extends Module { // Saving the position and z-index of the note: $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); - $path = $xmla->xpath("//item[@id='weather']"); + $path = $xmla->xpath("//item[@id='rssblogs']"); $path[0]->x = $x; $xmla->asXML('../'.AccueilModules::CONFIG_FILE); @@ -54,7 +54,7 @@ class rssblogs extends Module { // Saving the position and z-index of the note: $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); - $path = $xmla->xpath("//item[@id='weather']"); + $path = $xmla->xpath("//item[@id='rssblogs']"); $path[0]->y = $y; $xmla->asXML('../'.AccueilModules::CONFIG_FILE); @@ -66,7 +66,7 @@ class rssblogs extends Module { // Saving the position and z-index of the note: $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); - $path = $xmla->xpath("//item[@id='weather']"); + $path = $xmla->xpath("//item[@id='rssblogs']"); $path[0]->visibility = $visibility; $xmla->asXML('../'.AccueilModules::CONFIG_FILE); diff --git a/db/links.xml b/db/links.xml index 0f09ee5..41366f2 100644 --- a/db/links.xml +++ b/db/links.xml @@ -2,37 +2,37 @@