diff --git a/ajax/update.php b/ajax/update.php new file mode 100644 index 0000000..0c7a240 --- /dev/null +++ b/ajax/update.php @@ -0,0 +1,16 @@ +$valeur){ + if($indice == 'id') + $module .= $valeur; + else + $options[$indice] = $valeur; +} +include '../class/AccueilModules.php'; +echo AccueilModules::updateModule($module, $options); diff --git a/ajax/update_position_config.php b/ajax/update_position_config.php index 4c1ef6d..fb6710f 100644 --- a/ajax/update_position_config.php +++ b/ajax/update_position_config.php @@ -1,15 +1,7 @@ item[1]->y = $y; - $xmla->item[1]->x = $x; - $target = 1; - echo $id; -}*/ + include '../class/AccueilModules.php'; echo AccueilModules::updateModule($id, array('x'=>$x, 'y'=>$y)); /* $target = -1; $i = 0; @@ -22,6 +14,5 @@ $xmla->item[$target]->y = $y; $xmla->item[$target]->x = $x; -$xmla->asXML('../db/config.xml'); - -echo $target; ?> +$xmla->asXML('../db/config.xml'); +echo $target; */ ?> diff --git a/blogs.php b/blogs.php index 694c236..861972f 100644 --- a/blogs.php +++ b/blogs.php @@ -1,6 +1,6 @@ true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10); +$opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10, CURLOPT_CONNECTTIMEOUT => 10); $blogs = new Blogs_last_post(); foreach($blogs->getLinks() as $link) { diff --git a/class/Blogs.php b/class/Blogs.php index 652606d..5bf5fe7 100644 --- a/class/Blogs.php +++ b/class/Blogs.php @@ -11,7 +11,8 @@ class blogs extends Module { public function __construct($params){ $this->setParams($params); require('blogs_last_post.php'); - echo ''; + echo ' +
'; echo ''; echo '
@@ -39,7 +40,46 @@ class blogs extends Module { $blogs = new blogs($params); } - public static function updateConfig($updated){ - + public function setX($x){ + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='blogs']"); + $path[0]->x = $x; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; } + + public function setY($y){ + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='blogs']"); + $path[0]->y = $y; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + + public function setVisibility($visibility){ + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='blogs']"); + $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)){ + call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat); + } + } + } + + } \ No newline at end of file diff --git a/class/ClockAdvanced.php b/class/ClockAdvanced.php index ba93b5f..3e6ce58 100644 --- a/class/ClockAdvanced.php +++ b/class/ClockAdvanced.php @@ -19,9 +19,13 @@ class clockAdvanced extends Module { $options = ''; foreach (self::$paramsList as $paramName){ if(isset($this->params[$paramName])) - $options .= $paramName.' : '.$this->params[$paramName].','; + $options .= $paramName.' : "'.$this->params[$paramName].'",'; } echo ''; @@ -34,6 +38,93 @@ class clockAdvanced extends Module { public static function start($params){ $clockAdvanced = new clockAdvanced($params); } + + public function setX($x){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + + $path = $xmla->xpath("//item[@id='clockAdvanced']"); + $path[0]->x = $x; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + + public function setY($y){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='clockAdvanced']"); + $path[0]->y = $y; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + 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='clockAdvanced']"); + $path[0]->visibility = $visibility; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public function setFontFamily($fontFamily){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='clockAdvanced']"); + $path[0]->fontFamily = $fontFamily; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public function setFontSize($fontSize){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='clockAdvanced']"); + $path[0]->fontSize = $fontSize; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public function setColor($color){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='clockAdvanced']"); + $path[0]->color = $color; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public function setFormat($format){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='clockAdvanced']"); + $path[0]->format = $format; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public static function updateConfig($updated){ + foreach ($updated as $what=>$withWhat){ + if(in_array($what, self::$paramsList)){ + call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat); + } + } } } \ No newline at end of file diff --git a/class/Module.php b/class/Module.php index ad05a7a..616900c 100644 --- a/class/Module.php +++ b/class/Module.php @@ -21,6 +21,12 @@ abstract class Module abstract static function start($params); - abstract static function updateConfig($updated); + public static function updateConfig($updated){ + foreach ($updated as $what=>$withWhat){ + if(in_array($what, self::$paramsList)){ + call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat); + } + } + } } \ No newline at end of file diff --git a/class/Notes.php b/class/Notes.php index dac54e3..cf8c987 100644 --- a/class/Notes.php +++ b/class/Notes.php @@ -24,6 +24,10 @@ class notes extends Module { } public static function updateConfig($updated){ - return; + foreach ($updated as $what=>$withWhat){ + if(in_array($what, self::$paramsList)){ + call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat); + } + } } } \ No newline at end of file diff --git a/class/Todo.php b/class/Todo.php index f0cc985..9b4eb82 100644 --- a/class/Todo.php +++ b/class/Todo.php @@ -20,7 +20,7 @@ class todo extends Module { $this->setToken($xmla->token); $this->setProjectName($xmla->name); $this->setProjectId($xmla->id); - echo '
'; + echo '
'; if($this->token == null || $this->project_id == null) echo 'Impossible de trouver votre configuration. Cliquez ici pour la mettre en place.
'; else{ @@ -30,7 +30,7 @@ class todo extends Module { } echo ''; }else{ echo 'baaaaad persistance...'; @@ -66,7 +66,47 @@ class todo extends Module { $todo = new todo($params); } + public function setX($x){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='todo']"); + $path[0]->x = $x; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + + public function setY($y){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='todo']"); + $path[0]->y = $y; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + 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='todo']"); + $path[0]->visibility = $visibility; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + public static function updateConfig($updated){ - return; + foreach ($updated as $what=>$withWhat){ + if(in_array($what, self::$paramsList)){ + call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat); + } + } } } \ No newline at end of file diff --git a/class/Weather.php b/class/Weather.php index f494776..54fceac 100644 --- a/class/Weather.php +++ b/class/Weather.php @@ -33,21 +33,6 @@ class weather extends Module { public static function start($params){ $weather = new weather($params); } - - public static function updateConfig($updated){ - foreach ($updated as $what=>$withWhat){ - if(in_array($what, self::$params)){ - switch($what){ - case 'city': - self::setCity($withWhat); - break; - default: - break; - } - } - - } - } /** * @@ -66,4 +51,48 @@ class weather extends Module { echo "ok"; } + + public function setX($x){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='weather']"); + $path[0]->x = $x; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + echo "ok"; + } + + public function setY($y){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE); + + $path = $xmla->xpath("//item[@id='weather']"); + $path[0]->y = $y; + + $xmla->asXML('../'.AccueilModules::CONFIG_FILE); + + 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='weather']"); + $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)){ + call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat); + } + } + } } \ No newline at end of file diff --git a/css/main.css b/css/main.css index 228c7e3..a5f77a5 100644 --- a/css/main.css +++ b/css/main.css @@ -217,7 +217,7 @@ #recherche{margin-top:70px;} #config {width:300px;} - #config-menu, #blog-links-manager, #city-menu {float:right; margin:12px 10px 0 0;} + #config-menu, #blog-links-manager, #city-menu , #jclockAdvanced-menu{float:right; margin:12px 10px 0 0;} /* Green button class: */ a.green-button,a.green-button:visited, span.green-button{ @@ -241,7 +241,7 @@ a.green-button:hover, span.green-button:hover{ } .jclock {position:absolute; top:10px; right:10px;z-index:500; width:200px;background:#fff url(../images/interface/clock.png) top left no-repeat; padding:5px 0 0 5px; width:59px; height:21px;} - .jclockAdvanced{position:absolute; top:10px; right:80px; padding:5px 0 0 5px;} + .jclockAdvanced{position:absolute; top:10px; right:80px; padding:5px 0 0 5px; width:500px;} #blogs {/*position:absolute; bottom:10px; left: 100px;*/padding:5px;width:350px;-webkit-border-radius: 5px; -moz-border-radius: 5px;border: 1px solid rgba(0,0,0,0.3); diff --git a/css/todo.css b/css/todo.css index ea2df8d..10df132 100644 --- a/css/todo.css +++ b/css/todo.css @@ -1,12 +1,12 @@ -#todoList {padding:5px;width:350px;-webkit-border-radius: 5px; +#todo {padding:5px;width:350px;-webkit-border-radius: 5px; -moz-border-radius: 5px;border: 1px solid rgba(0,0,0,0.3); -webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15); overflow:hidden;} -#todoList ul{list-style:none;} -#todoList ul li{white-space : nowrap; padding-left:16px;} -#todoList ul li div.puce{width: 16px; height: 16px; background:url(../images/interface/ui-icons_888888_256x240.png) -32px -48px no-repeat; display:inline-block;} +#todo ul{list-style:none;} +#todo ul li{white-space : nowrap; padding-left:16px;} +#todo ul li div.puce{width: 16px; height: 16px; background:url(../images/interface/ui-icons_888888_256x240.png) -32px -48px no-repeat; display:inline-block;} diff --git a/db/config.xml b/db/config.xml index 5e3e91b..ffe9c0f 100644 --- a/db/config.xml +++ b/db/config.xml @@ -34,9 +34,9 @@ true 80 10 - 'Times New Roman, serial' - '20px' - '%A %d %B %Y - %H:%M:%S' - '#000' + Times New Roman, serial + 20px + %A %d %B %Y - %H:%M:%S + #000 diff --git a/images/interface/clock_edit.png b/images/interface/clock_edit.png new file mode 100644 index 0000000..7d35718 Binary files /dev/null and b/images/interface/clock_edit.png differ diff --git a/images/interface/error.png b/images/interface/error.png new file mode 100644 index 0000000..628cf2d Binary files /dev/null and b/images/interface/error.png differ diff --git a/js/getUncompletedTasks.php b/js/getUncompletedTasks.php index fb2c016..16c8cf4 100644 --- a/js/getUncompletedTasks.php +++ b/js/getUncompletedTasks.php @@ -11,7 +11,7 @@ function cbfunc2(o){ $('#uncompletedList').append('
  • '+o.content+' - '+o.date_string+'
  • '); } -$(document).ready(function(){ $('#todoList').resizable(); $('#todoList').draggable(); $('#todoList').append('
    '); +$(document).ready(function(){ $('#todo').resizable(); $('#todo').draggable(); $('#todo').append('
    '); var token = ""; var project_id = ""; var script = document.createElement('script'); @@ -52,5 +52,5 @@ $(document).ready(function(){ $('#todoList').resizable(); $('#todoList').dragg document.getElementsByTagName('head')[0].appendChild(script); $('#'+arrayId[1]).remove(); }); - + /* A helper function for converting a set of elements to draggables: */ make_draggable($('#todo')); var zIndex = 0; function make_draggable(elements) { /* Elements is a jquery object: */ elements.draggable({ containment:'parent', start:function(e,ui){ ui.helper.css('z-index',++zIndex); }, stop:function(e,ui){ /* Sending the z-index and positon of the note to update_position.php via AJAX GET: */ $.get('ajax/update_position_config.php',{ x : ui.position.left, y : ui.position.top, id : ui.helper.attr('id') }); } }); } }); \ No newline at end of file diff --git a/js/jquery.blogs.js b/js/jquery.blogs.js index 3d22e8d..9852517 100644 --- a/js/jquery.blogs.js +++ b/js/jquery.blogs.js @@ -22,14 +22,20 @@ function make_draggable(elements) } //affichage des blogs -$('body').append('
    '); $("#blogs").html(" Loading Blogs..."); var tmp; /* A helper function for converting a set of elements to draggables: */ make_draggable($('#blogs')); -$.get("blogs.php", function(data){ - $("#blogs").html(data); -}); +$.ajax( + {url : "blogs.php", + timeout : 36000, + error: function(data){ + $("#blogs").html(' Délai dépassé !'); + }, + success:function(data){ + $("#blogs").html(data); + } + }); }); diff --git a/js/jquery.jclockAdvanced.js b/js/jquery.jclockAdvanced.js index 09586b6..49cbea1 100644 --- a/js/jquery.jclockAdvanced.js +++ b/js/jquery.jclockAdvanced.js @@ -209,4 +209,29 @@ }; })(jQuery); - +$(document).ready(function(){ +$('body').append('
    '); + $('#menu-bar').prepend($('#jclockAdvanced-menu')); + $('#jca').append('

    Options





    Enregistrer'); + $('#jclockAdvanced-menu').fancybox({ + 'zoomSpeedIn' : 600, + 'zoomSpeedOut' : 500, + 'easingIn' : 'easeOutBack', + 'easingOut' : 'easeInBack', + 'hideOnContentClick': false, + 'padding' : 15 + }); + $('#jca-submit').live('click', function(){ + var fontFamily = $('#fontFamily').val(); + var fontSize = $('#fontSize').val(); + var format = $('#format').val(); + var color = $('#color').val(); + if(fontFamily != '' && fontSize != '' && format != '' && color != ''){ + $.get('ajax/update.php', {id:'clockAdvanced', fontFamily: fontFamily, fontSize:fontSize, format:format, color:color}, function(msg){ + location.reload(); + }); + }else{ + $('#jca').append('Fields can\'t be empty.'); + } + }); +}); \ No newline at end of file diff --git a/js/jquery.weather.js b/js/jquery.weather.js index aeb9103..8206a29 100644 --- a/js/jquery.weather.js +++ b/js/jquery.weather.js @@ -13,12 +13,8 @@ $(document).ready(function(){ $('#city-submit').live('click', function(){ var ville = $('#cityChoice').val(); if(ville != '' || ville != null){ - $.get('ajax/update-city.php', {city: ville}, function(msg){ - if(msg=='ok'){ + $.get('ajax/update.php', {id:'weather', city: ville}, function(msg){ location.reload(); - }else{ - $('#city').append('An error occured while changing city.'); - } }); }else{ $('#city').append('City can\'t be empty.'); @@ -41,11 +37,12 @@ function make_draggable(elements) stop:function(e,ui){ /* Sending the z-index and positon of the note to update_position.php via AJAX GET: */ - $.get('ajax/update_position_config.php',{ + $.get('ajax/update.php',{ x : ui.position.left, y : ui.position.top, id : ui.helper.attr('id') }); } - });} + }); +} });