From 2394218c175fba1f71d3dc9241a3656156da3a78 Mon Sep 17 00:00:00 2001 From: Chouchen Date: Tue, 21 Sep 2010 14:00:04 +0000 Subject: [PATCH] On peut maintenant trier les liens ! --- ajax/update-links-order.php | 36 +++++++++ class/Links.php | 79 +++++++++---------- class/Search.php | 2 +- css/main.css | 27 +++++-- css/search.css | 4 +- db/links.xml | 136 +++++++++++++++++++++++++++++++++ images/interface/link_edit.png | Bin 0 -> 703 bytes js/getUncompletedTasks.php | 2 +- js/jquery.blogs.js | 1 + js/jquery.jclock.js | 1 + js/jquery.links.js | 40 ++++++++++ js/jquery.weather.js | 3 +- 12 files changed, 276 insertions(+), 55 deletions(-) create mode 100644 ajax/update-links-order.php create mode 100644 db/links.xml create mode 100644 images/interface/link_edit.png create mode 100644 js/jquery.links.js diff --git a/ajax/update-links-order.php b/ajax/update-links-order.php new file mode 100644 index 0000000..d7c3e4e --- /dev/null +++ b/ajax/update-links-order.php @@ -0,0 +1,36 @@ +$value){ + if($value == $itemMoved) + $itemIndex = (int)$index; +} + +$itemAfter = ''; +if(isset($orderArray[$itemIndex+1])) + $itemAfter = $orderArray[$itemIndex+1]; + +$doc = new DOMDocument; +$doc->load('../db/links.xml'); + +$xpath = new DOMXpath($doc); + +// Buffering and deleting moved element +foreach($xpath->query('label/link[title = "'.$itemMoved.'"]') as $node) { + $buffer = $node; + $node->parentNode->removeChild($node); +} + +if($itemAfter != ''){ + $searchLabel = $xpath->query('label[@id="'.$label.'"]/link[title = "'.$itemAfter.'"]')->item(0); + $searchLabel->parentNode->insertBefore($buffer, $searchLabel); +}else{ + $searchLabel = $xpath->query('label[@id="'.$label.'"]'); + $searchLabel->item(0)->appendChild($buffer); +} +$doc->save('../db/links.xml'); \ No newline at end of file diff --git a/class/Links.php b/class/Links.php index b2eb07a..c6c54f3 100644 --- a/class/Links.php +++ b/class/Links.php @@ -5,54 +5,27 @@ class links { 'visibility' ); + const LINKS_FILE = 'db/links.xml'; + public $params = array(); public function __construct($params){ $this->setParams($params); - echo '
- Google Apps - -
- - Media - -
- - Desk Accessories - -
- - Entertainment - -
- -
'; + echo ' +
'; + if($links_xml = simplexml_load_file(self::LINKS_FILE)){ + $links = $links_xml->label; + foreach($links as $label){ + echo ''.$label['id'].' + +
'; + } + } + echo '
'; } private function setParams($params){ @@ -63,7 +36,23 @@ class links { $links = new links($params); } - public static function updateConfig($updated){ + public function setLink($link){ + // Saving the position and z-index of the note: + $xmla = simplexml_load_file('../'.self::LINKS_FILE); + + $path = $xmla->xpath("//item[@id='weather']"); + $path[0]->x = $x; + + $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/Search.php b/class/Search.php index 5090ca5..5b7bcf3 100644 --- a/class/Search.php +++ b/class/Search.php @@ -12,7 +12,7 @@ class search extends Module {
- +
  • Web
  • diff --git a/css/main.css b/css/main.css index a5f77a5..19f68c4 100644 --- a/css/main.css +++ b/css/main.css @@ -12,7 +12,7 @@ color: #6B6B6B; background:-webkit-gradient(linear, left top, left bottom, from(#fff), to(#ebeff9)); } - + a img {border:none;} li a { text-decoration: none; } @@ -44,7 +44,9 @@ } ul.iconlist li{ - display:inline-block; + /*display:inline-block;*/ + float:left; + margin:0 10px 10px 0; text-align:center; font-weight:bold; color:#2D406D; @@ -101,6 +103,7 @@ ul.iconlist { padding:5px; + list-style:none; } ul.iconlist img{ @@ -123,12 +126,13 @@ } div.appscontainer { - width:750px; + width:730px; margin:20px auto; padding:0px; /*background:red;*/ -webkit-border-radius: 5px; -moz-border-radius: 5px; + border-radius: 5px; xmargin-left:160px; background:rgba(255,255,255,0.8); overflow:auto; @@ -139,12 +143,14 @@ } hr { + clear:left; border:none; height:0px; border-bottom:1px solid #eee; } .label { + display:none; float:Right; padding-top:6px; padding-right:6px; @@ -206,18 +212,29 @@ font-size:14px; background:-webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee)); margin:0 0 -1px 0; + border:1px solid #888888; -webkit-border-bottom-right-radius:3px; -webkit-border-top-right-radius:3px; -moz-border-bottom-right-radius:3px; -moz-border-top-right-radius:3px; - border:1px solid #ccc; + /*border:1px solid #ccc;*/ height:32px; + -moz-border-radius:10px; + -webkit-border-radius:10px; + border-radius:10px; + -moz-box-shadow: 2px 2px 3px #888; + -webkit-box-shadow: 2px 2px 3px #888; + box-shadow: 2px 2px 3px #888; + /* For IE 8 */ + -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#888888')"; + /* For IE 5.5 - 7 */ + filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#888888'); } #menu-bar{height:40px;background: -moz-linear-gradient(top, #ECD9D9 0%, #fff 100%);background: -webkit-gradient(linear, left top, left bottom, from(#ECD9D9), to(#fff)); position:relative; top:0; left:0; border-bottom:1px solid #ECD9D9;} #recherche{margin-top:70px;} #config {width:300px;} - #config-menu, #blog-links-manager, #city-menu , #jclockAdvanced-menu{float:right; margin:12px 10px 0 0;} + #config-menu, #blog-links-manager, #city-menu , #jclockAdvanced-menu, #links-menu{float:right; margin:12px 10px 0 0;} /* Green button class: */ a.green-button,a.green-button:visited, span.green-button{ diff --git a/css/search.css b/css/search.css index d8bcbab..77ceee5 100644 --- a/css/search.css +++ b/css/search.css @@ -98,13 +98,13 @@ span.arrow{ /* The submit button */ #submitButton{ - background:url('../images/interface/buttons.png') no-repeat; + /*background:url('../images/interface/buttons.png') no-repeat; width:83px; height:36px; text-indent:-9999px; overflow:hidden; text-transform:uppercase; - border:none; + border:none;*/ cursor:pointer; } diff --git a/db/links.xml b/db/links.xml new file mode 100644 index 0000000..0f09ee5 --- /dev/null +++ b/db/links.xml @@ -0,0 +1,136 @@ + + + + + + \ No newline at end of file diff --git a/images/interface/link_edit.png b/images/interface/link_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..5b3aed090f229d5d864ef7ea02ed1f3d161cf5b0 GIT binary patch literal 703 zcmV;w0zmzVP)p74t45QQ4l*wv8+v6+o86(g*3M%S_5fp9@M!XJD7zzCD0++nw0<1$_~** zQs@V3kR!#AEgGBVrfuf78Z(%>=H@rs#?$wWE?sQUtrs46dEOr$UY?f*fc7t-{U-~m ztE=~RcXwac>-8C@(+Q16GbfYDDoN}o^903FHL8c|{bK=>$=u!4)YNY>nUG4QkVqup z_xqvMYQLz}>OedmU#GZWFbLP+Rm7eOF#TMQ@keY-*h<@J<>loU6bi+1G#bqa1Ojhk zW8S z`FuW%jg27?2*B-jL)lqDWTH0WI?f;+(O@edL_Q%ydh`mWo`?`0Y+D*N^XRl=WHdK7PZ^EItjpy} zdpsUE91h6ka@Y()WFjhT5h1M22tmxZVr8-yGmhG&kH&Ll+ef6+>AOhTWgHGCDHe-Y zdwO~Z5{0{Rrgiay^7n8%h`G!7@kxzoYu#$ZP;t7b54?Q`E>6Bt6t?mK5J?f%=i9JM zDw(#`=VJp^M~WKhVb@_%)Z2@R*Z1&kqy=lqR;0&o;IozWJ!Y&b`KuFMx9fqGS;QV( z!f@|FyuaT7zwXpR*id-;a3jFMu%@C#&gw_4uqA~^s6002ovPDHLkV1m3RKd%4) literal 0 HcmV?d00001 diff --git a/js/getUncompletedTasks.php b/js/getUncompletedTasks.php index 16c8cf4..b46ced1 100644 --- a/js/getUncompletedTasks.php +++ b/js/getUncompletedTasks.php @@ -52,5 +52,5 @@ $(document).ready(function(){ $('#todo').resizable(); $('#todo').draggable(); 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') }); } }); } + /* 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({ snap:true, 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 9852517..6423cbd 100644 --- a/js/jquery.blogs.js +++ b/js/jquery.blogs.js @@ -7,6 +7,7 @@ function make_draggable(elements) { /* Elements is a jquery object: */ elements.draggable({ + snap:true, containment:'parent', start:function(e,ui){ ui.helper.css('z-index',++zIndex); }, stop:function(e,ui){ diff --git a/js/jquery.jclock.js b/js/jquery.jclock.js index 6336034..d0465e2 100644 --- a/js/jquery.jclock.js +++ b/js/jquery.jclock.js @@ -222,6 +222,7 @@ function make_draggable(elements) { /* Elements is a jquery object: */ elements.draggable({ + snap:true, containment:'parent', start:function(e,ui){ ui.helper.css('z-index',++zIndex); }, stop:function(e,ui){ diff --git a/js/jquery.links.js b/js/jquery.links.js new file mode 100644 index 0000000..da66279 --- /dev/null +++ b/js/jquery.links.js @@ -0,0 +1,40 @@ +$(document).ready(function(){ + // Réglage des options + $('body').append('
    '); + $('#menu-bar').prepend($('#links-menu')); + $('#links').append('

    Quel lien à ajouter?


    Enregistrer'); + $('#links-menu').fancybox({ + 'zoomSpeedIn' : 600, + 'zoomSpeedOut' : 500, + 'easingIn' : 'easeOutBack', + 'easingOut' : 'easeInBack', + 'hideOnContentClick': false, + 'padding' : 15 + }); + $('#links-submit').live('click', function(){ + var link = $('#linkChoice').val(); + if(link != '' || link != null){ + $.get('ajax/update.php', {id:'links', link: link}, function(msg){ + location.reload(); + }); + }else{ + $('#links').append('links can\'t be empty.'); + } + }); + + // Mouvement des liens avec enregistrement + $(".iconlist").sortable( + { + connectWith: '.iconlist', + update: function(event,ui){ + var linkOrder = $(this).sortable('toArray').toString(); + var label = $(ui.item).parent()[0].id; + var itemMoved = $(ui.item)[0].id; + $.post("ajax/update-links-order.php", {order: linkOrder, label : label, itemMoved: itemMoved}); + + } + } + ).disableSelection(); + + +}); \ No newline at end of file diff --git a/js/jquery.weather.js b/js/jquery.weather.js index 8206a29..6a9d6bf 100644 --- a/js/jquery.weather.js +++ b/js/jquery.weather.js @@ -1,7 +1,7 @@ $(document).ready(function(){ $('body').append('
    '); $('#menu-bar').prepend($('#city-menu')); - $('#city').append('

    Quelle ville pour la météo ?


    Enregistrer'); + $('#city').append('

    Quelle ville pour la meteo ?


    Enregistrer'); $('#city-menu').fancybox({ 'zoomSpeedIn' : 600, 'zoomSpeedOut' : 500, @@ -32,6 +32,7 @@ function make_draggable(elements) { /* Elements is a jquery object: */ elements.draggable({ + snap:true, containment:'parent', start:function(e,ui){ ui.helper.css('z-index',++zIndex); }, stop:function(e,ui){