Ajout du passage liste -> reserve

This commit is contained in:
Chouchen 2010-09-23 13:02:42 +00:00
parent cc14c740d3
commit b5943a0668
6 changed files with 35 additions and 5 deletions

18
ajax/listToReserve.php Normal file
View File

@ -0,0 +1,18 @@
<?
$reserve = $_POST['reserve'];
$doc = new DOMDocument;
$doc->load('../db/links.xml');
$xpath = new DOMXpath($doc);
// Buffering and deleting moved element
foreach($xpath->query('label/link[title = "'.$reserve.'"]') as $node) {
$buffer = $node;
$node->parentNode->removeChild($node);
}
$searchLabel = $xpath->query('reserve');
$searchLabel->item(0)->appendChild($buffer);
$doc->save('../db/links.xml');

View File

@ -5,7 +5,7 @@ if($links_xml = simplexml_load_file('../'.links::LINKS_FILE)){
foreach($links as $label){
echo '<ul id="reserveiconlist">';
foreach($label->link as $link){
echo '<li class="item" id="'.$link->title.'"><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
echo '<li class="item" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
}
echo '</ul> ';
}

View File

@ -20,7 +20,7 @@ class links {
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.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
echo '<li class="item" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
}
echo '</ul>
<hr>';
@ -28,7 +28,7 @@ class links {
}else{
echo 'Can\'t find '.self::LINKS_FILE;
}
echo '</div><div id="reserve"></div>';
echo '</div>';
}

View File

@ -1,4 +1,5 @@
#reserve{display:none;background:#000;}
.deleteLink{display:none; position:absolute; top:-5px; right:-5px;width:16px !important; height:16px !important;}
.divider {
display:block;
@ -12,6 +13,7 @@
ul.iconlist li, ul#reserveiconlist li{
/*display:inline-block;*/
position:relative;
float:left;
margin:0 10px 10px 0;
text-align:center;

BIN
images/links/meebo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -5,7 +5,7 @@ $(document).ready(function(){
// Apparition de la reserve de liens
$('#links-menu').live('click', function(){
$('#reserve').show();
//$('#reserve').show();
$.get('ajax/loadReserve.php', function(html){
$.fancybox(
html,
@ -24,13 +24,23 @@ $(document).ready(function(){
$('#reserveiconlist .item').live('click', function(e){
e.preventDefault();
$.post("ajax/reserveToList.php", {reserve: $(this).attr('id')});
$('#Entertainment').append($(this).parent().html());
$('.iconlist').last().append($(this).parent().html());
$.fancybox.close();
});
//Passage Liste => Reserve
$('.item').mouseover(function(){
$(this).children('.deleteLink').show();
});
$('.item').mouseout(function(){
$(this).children('.deleteLink').hide();
});
$('.deleteLink').click(function(){
$.post("ajax/listToReserve.php", {reserve: $(this).parent().attr('id')});
$(this).parent().fadeOut();
});
// ??
// Mouvement des liens avec enregistrement