On peut maintenant trier les liens !

This commit is contained in:
Chouchen 2010-09-21 14:00:04 +00:00
parent b8aa797d20
commit 2394218c17
12 changed files with 276 additions and 55 deletions

View File

@ -0,0 +1,36 @@
<?
$label = $_POST['label'];
$order = $_POST['order'];
$itemMoved = $_POST['itemMoved'];
$orderArray = explode(',', $order);
$itemIndex = 0;
foreach($orderArray as $index=>$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');

View File

@ -5,54 +5,27 @@ class links {
'visibility'
);
const LINKS_FILE = 'db/links.xml';
public $params = array();
public function __construct($params){
$this->setParams($params);
echo '<div class="appscontainer">
<span class="label">Google Apps</span>
<ul class="iconlist">
<li class="item"><a href="http://mail.google.com" onclick="spawnLink(this);return false;"><img src="images/links/gmail_128.png" /><br>Gmail</a></li>
<li class="item"><a href="http://mail.live.com" onclick="spawnLink(this);return false;"><img src="images/links/mail-msn.png" /><br>Hotmail</a></li>
<li class="item"><a href="http://mail1.voila.fr/webmail/fr_FR/login.html" onclick="spawnLink(this);return false;"><img src="images/links/voila.png" /><br>Voila.fr mail</a></li>
<li class="item"><a href="http://calendar.google.com" onclick="spawnLink(this);return false;"><img src="images/links/calendar_128.png" /><br>Google&nbsp;Calendar</a></li>
<li class="item"><a href="http://reader.google.com" onclick="spawnLink(this);return false;"><img src="images/links/reader_128.png" /><br>Google Reader</a></li>
<li class="item"><a href="http://docs.google.com" onclick="return spawnLink(this);"><img src="images/links/docs_128.png" /><br>Google Docs</a></li>
</ul>
<hr>
<span class="label">Media</span>
<ul class="iconlist">
<li class="item"><a href="http://youtube.com" onclick="spawnLink(this);return false;"><img src="images/links/youtube_128.png" /><br>YouTube</a></li>
<li class="item"><a href="http://picasaweb.com" onclick="spawnLink(this);return false;"><img src="images/links/picasaweb_128.png" /><br>PicasaWeb</a></li>
<li class="item"><a href="http://www.netvibes.com" onclick="spawnLink(this);return false;"><img src="images/links/netvibes.png" /><br>Netvibes</a></li>
<li class="item"><a href="http://www.deviantart.com" onclick="spawnLink(this);return false;"><img src="images/links/deviantART128.png" /><br>DeviantArt</a></li>
<li class="item"><a href="https://www.labanquepostale.fr/index.html" onclick="spawnLink(this);return false;"><img src="images/links/banquepostale.png" /><br>Banque 1</a></li>
<li class="item"><a href="http://www.societegenerale.fr/" onclick="spawnLink(this);return false;"><img src="images/links/societegenerale.png" /><br>Banque 2</a></li>
</ul>
<hr>
<span class="label">Desk Accessories</span>
<ul class="iconlist">
<li class="item"><a href="javascript: openContactList()" ><img src="images/links/contacts.png" /><br>Contacts</a></li>
<li class="item"><a href="javascript: openCalculator();"><img src="images/links/calculator.png" width="16" height="16" /><br>Calculator</a></li>
<li class="item"><a href="javascript: openTodo();"><img src="images/links/tasks.png" width="16" height="16" /><br>To-do list</a></li>
<li class="item"><a href="javascript: openCalendar();"><img src="images/links/calendar_128.png" width="16" height="16" /><br>Calendar Panel</a></li>
<li class="item"><a href="javascript: openNotepad();"><img src="images/links/notepad.png" width="16" height="16" /><br>NotePad</a></li>
</ul>
<hr>
<span class="label">Entertainment</span>
<ul class="iconlist">
<li class="item"><a href="http://facebook.com" onclick="spawnLink(this);return false;"><img src="images/links/facebook.png" /><br>Facebook</a></li>
<li class="item"><a href="http://twitter.com" onclick="spawnLink(this);return false;"><img src="images/links/twitter.png" />Twitter</a></li>
<li class="item"><a href="http://fr.vente-privee.com/" onclick="spawnLink(this);return false;"><img src="images/links/vp128.png" />Ventes Privées</a></li>
<li class="item"><a href="http://www.google.fr/movies" onclick="spawnLink(this);return false;"><img src="images/links/Gmovie.png" />Horaires Ciné</a></li>
</ul>
<hr>
</div>';
echo '<script type="text/javascript" src="js/jquery.links.js"></script>
<div class="appscontainer">';
if($links_xml = simplexml_load_file(self::LINKS_FILE)){
$links = $links_xml->label;
foreach($links as $label){
echo '<span class="label">'.$label['id'].'</span>
<ul class="iconlist" id="'.$label['id'].'">';
foreach($label->link as $link){
echo '<li class="item" id="'.$link->title.'"><a href="'.$link->url.'" onclick="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
}
echo '</ul>
<hr>';
}
}
echo '</div>';
}
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);
}
}
}
}

View File

@ -12,7 +12,7 @@ class search extends Module {
<form id="searchForm" method="post">
<fieldset>
<input id="s" type="text" />
<input type="submit" value="Submit" id="submitButton" />
<input type="submit" value="Submit" id="submitButton" class="searchbutton" />
<ul class="icons">
<li class="web" title="Web Search" data-searchType="web">Web</li>

View File

@ -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{

View File

@ -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;
}

136
db/links.xml Normal file
View File

@ -0,0 +1,136 @@
<links>
<label id="Google Apps">
<link>
<url>http://mail.google.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>gmail_128.png</img>
<title>Gmail</title>
</link>
<link>
<url>http://mail.live.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>mail-msn.png</img>
<title>Hotmail</title>
</link>
<link>
<url>http://mail1.voila.fr/webmail/fr_FR/login.html</url>
<onclick>spawnLink(this);return false;</onclick>
<img>voila.png</img>
<title>Voila.fr mail</title>
</link>
<link>
<url>http://calendar.google.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>calendar_128.png</img>
<title>GoogleCalendar</title>
</link>
<link>
<url>http://reader.google.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>reader_128.png</img>
<title>Google Reader</title>
</link>
<link>
<url>http://docs.google.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>docs_128.png</img>
<title>Google Docs</title>
</link>
</label>
<label id="Media">
<link>
<url>http://youtube.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>youtube_128.png</img>
<title>YouTube</title>
</link>
<link>
<url>http://picasaweb.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>picasaweb_128.png</img>
<title>PicasaWeb</title>
</link>
<link>
<url>http://www.netvibes.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>netvibes.png</img>
<title>Netvibes</title>
</link>
<link>
<url>http://www.deviantart.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>deviantART128.png</img>
<title>DeviantArt</title>
</link>
<link>
<url>https://www.labanquepostale.fr/index.html</url>
<onclick>spawnLink(this);return false;</onclick>
<img>banquepostale.png</img>
<title>Banque 1</title>
</link>
<link>
<url>http://www.societegenerale.fr/</url>
<onclick>spawnLink(this);return false;</onclick>
<img>societegenerale.png</img>
<title>Banque 2</title>
</link>
</label>
<label id="Desk Accessories">
<link>
<url>javascript: openContactList()</url>
<onclick></onclick>
<img>contacts.png</img>
<title>Contacts</title>
</link>
<link>
<url>javascript: openCalculator();</url>
<onclick></onclick>
<img>calculator.png</img>
<title>Calculator</title>
</link>
<link>
<url>javascript: openTodo();</url>
<onclick></onclick>
<img>tasks.png</img>
<title>To-do list</title>
</link>
<link>
<url>javascript: openCalendar();</url>
<onclick></onclick>
<img>calendar_128.png</img>
<title>Calendar Panel</title>
</link>
<link>
<url>javascript: openNotepad();</url>
<onclick></onclick>
<img>notepad.png</img>
<title>NotePad</title>
</link>
</label>
<label id="Entertainment">
<link>
<url>http://facebook.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>facebook.png</img>
<title>Facebook</title>
</link>
<link>
<url>http://twitter.com</url>
<onclick>spawnLink(this);return false;</onclick>
<img>twitter.png</img>
<title>Twitter</title>
</link>
<link>
<url>http://fr.vente-privee.com/</url>
<onclick>spawnLink(this);return false;</onclick>
<img>vp128.png</img>
<title>Ventes Privées</title>
</link>
<link>
<url>http://www.google.fr/movies</url>
<onclick>spawnLink(this);return false;</onclick>
<img>Gmovie.png</img>
<title>Horaires Ciné</title>
</link>
</label>
</links>

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

View File

@ -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') }); } }); }
});

View File

@ -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){

View File

@ -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){

40
js/jquery.links.js Normal file
View File

@ -0,0 +1,40 @@
$(document).ready(function(){
// Réglage des options
$('body').append('<a href="#links" id="links-menu"><img src="images/interface/link_edit.png" /></a><div style="display:none;"><div id="links"></div></div>');
$('#menu-bar').prepend($('#links-menu'));
$('#links').append('<h3>Quel lien &agrave; ajouter?</h3><br/><input type="text" id="linkChoice" name="linkChoice"/><span id="links-submit" class="green-button">Enregistrer</span>');
$('#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('<span class="error">links can\'t be empty.</span>');
}
});
// 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();
});

View File

@ -1,7 +1,7 @@
$(document).ready(function(){
$('body').append('<a href="#city" id="city-menu"><img src="images/interface/weather.png" /></a><div style="display:none;"><div id="city"></div></div>');
$('#menu-bar').prepend($('#city-menu'));
$('#city').append('<h3>Quelle ville pour la météo ?</h3><br/><input type="text" id="cityChoice" name="cityChoice"/><span id="city-submit" class="green-button">Enregistrer</span>');
$('#city').append('<h3>Quelle ville pour la meteo ?</h3><br/><input type="text" id="cityChoice" name="cityChoice"/><span id="city-submit" class="green-button">Enregistrer</span>');
$('#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){