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 @@
-// Escaping the input data:
-//TODO automatisation ! Je veux plus de "$config_xml[x]"
-$clock = $_POST['clock'];
-$weather = $_POST['weather'];
-$notes = $_POST['notes'];
-$search = $_POST['search'];
-$links = $_POST['links'];
-$blogs = $_POST['blogs'];
-$todo = $_POST['todo'];
-$clockAdvanced = $_POST['clockAdvanced'];
-$rssblogs = $_POST['rssblogs'];
-$news = $_POST['news'];
-
-$xmla = simplexml_load_file('../db/config.xml');
-$config_xml = $xmla->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');
-
+
+$options = array();
+$module ='';
+include '../class/AccueilModules.php';
+foreach($_POST as $module => $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 @@