Ajout de la reserve de liens et du passage reserve -> liste

This commit is contained in:
Chouchen 2010-09-23 10:59:56 +00:00
parent 73e97a31be
commit cc14c740d3
7 changed files with 233 additions and 178 deletions

12
ajax/loadReserve.php Normal file
View File

@ -0,0 +1,12 @@
<?
include '../class/Links.php';
if($links_xml = simplexml_load_file('../'.links::LINKS_FILE)){
$links = $links_xml->reserve;
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 '</ul> ';
}
}

19
ajax/reserveToList.php Normal file
View File

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

View File

@ -12,6 +12,7 @@ class links {
public function __construct($params){
$this->setParams($params);
echo '<script type="text/javascript" src="js/jquery.links.js"></script>
<link rel="stylesheet" href="css/links.css" type="text/css" />
<div class="appscontainer">';
if($links_xml = simplexml_load_file(self::LINKS_FILE)){
$links = $links_xml->label;
@ -27,7 +28,8 @@ class links {
}else{
echo 'Can\'t find '.self::LINKS_FILE;
}
echo '</div>';
echo '</div><div id="reserve"></div>';
}
private function setParams($params){

161
css/links.css Normal file
View File

@ -0,0 +1,161 @@
#reserve{display:none;background:#000;}
.divider {
display:block;
font-size:1px;
border-width:0px;
border-style:solid;
border-top-width:1px;
margin:9px 0px 4px -2px;
border-color:#BFBFBF;
}
ul.iconlist li, ul#reserveiconlist li{
/*display:inline-block;*/
float:left;
margin:0 10px 10px 0;
text-align:center;
font-weight:bold;
color:#2D406D;
}
ul.iconlist li a, ul#reserveiconlist li a {
display:block;
padding:6px;
margin:0px;
text-align:center;
font-weight:bold;
/*background-color:rgba(235,239,249,0.0);*/
background-color:#FFFFFF;
cursor:pointer;
-webkit-border-radius: 10px;
width:96px;
/*height:86px;*/
height:66px;
-webkit-transition: background-color 0.3s ease-out ;
}
ul.iconlist li a:hover, ul#reserveiconlist li a:hover {
background-color:#ebeff9;
-webkit-transition: background-color 0s ease-out ;
}
ul.iconlist li.disabled a:hover {
background-color:white;
opacity:0.5;
}
ul.iconlist li.disabled a {
background-color:white;
opacity:0.5;
cursor:default;
}
ul.iconlist li a img, ul#reserveiconlist li a img{
x-webkit-transition: -webkit-transform 0.3s ease-out ;
}
ul.iconlist li a:hover img, ul#reserveiconlist li a:hover{
x-webkit-transform: scale(1.1);
x-webkit-transition: -webkit-transform 0.0s ease-out ;
}
ul.iconlist, ul#reserveiconlist {
padding:5px;
list-style:none;
}
ul.iconlist img, ul#reserveiconlist img{
width:64px;
height:64px;
margin-bottom:1px;
}
div.sidemenu{
xbackground:rgba(255,255,255,0.8);
x-webkit-border-radius: 5px;
xborder: 1px solid rgba(0,0,0,0.3);
x-webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
width:150px;
margin-left: 0px;
height:90%;
display:none;
float:left;
border-right:1px solid red;
}
div.appscontainer {
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;
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);
}
hr {
clear:left;
border:none;
height:0px;
border-bottom:1px solid #eee;
}
.label {
display:none;
float:Right;
padding-top:6px;
padding-right:6px;
color:#fff;
}
.fakelocation {
background:white;
height:38px;
background:-webkit-gradient(linear, left top, left bottom, from(#fff), to(#ebeff9));
border-bottom:1px solid #eee;
padding:0;
display:none;
}
a.getmore {
display:block;
text-align:right;
padding:10px;
}
div.url {
font-weight:normal;
opacity:0;
position:absolute;
text-align:center;
}
ul.iconlist li:hover div.url, ul#reserveiconlist li:hover div.url{
opacity:.5;
}
li.selected {
background-color:#D6DEF7 !important;
}
li.vseparator {
width:1px;
height:86px;
background-color:red;
}

View File

@ -33,165 +33,7 @@
vertical-align:top;
}
.divider {
display:block;
font-size:1px;
border-width:0px;
border-style:solid;
border-top-width:1px;
margin:9px 0px 4px -2px;
border-color:#BFBFBF;
}
ul.iconlist li{
/*display:inline-block;*/
float:left;
margin:0 10px 10px 0;
text-align:center;
font-weight:bold;
color:#2D406D;
}
ul.iconlist li a {
display:block;
padding:6px;
margin:0px;
text-align:center;
font-weight:bold;
/*background-color:rgba(235,239,249,0.0);*/
background-color:#FFFFFF;
cursor:pointer;
-webkit-border-radius: 10px;
width:96px;
/*height:86px;*/
height:66px;
-webkit-transition: background-color 0.3s ease-out ;
}
ul.iconlist li a:hover {
background-color:#ebeff9;
-webkit-transition: background-color 0s ease-out ;
}
ul.iconlist li.disabled a:hover {
background-color:white;
opacity:0.5;
}
ul.iconlist li.disabled a {
background-color:white;
opacity:0.5;
cursor:default;
}
ul.iconlist li a img{
x-webkit-transition: -webkit-transform 0.3s ease-out ;
}
ul.iconlist li a:hover img{
x-webkit-transform: scale(1.1);
x-webkit-transition: -webkit-transform 0.0s ease-out ;
}
ul.iconlist {
padding:5px;
list-style:none;
}
ul.iconlist img{
width:64px;
height:64px;
margin-bottom:1px;
}
div.sidemenu{
xbackground:rgba(255,255,255,0.8);
x-webkit-border-radius: 5px;
xborder: 1px solid rgba(0,0,0,0.3);
x-webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
width:150px;
margin-left: 0px;
height:90%;
display:none;
float:left;
border-right:1px solid red;
}
div.appscontainer {
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;
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);
}
hr {
clear:left;
border:none;
height:0px;
border-bottom:1px solid #eee;
}
.label {
display:none;
float:Right;
padding-top:6px;
padding-right:6px;
color:#fff;
}
.fakelocation {
background:white;
height:38px;
background:-webkit-gradient(linear, left top, left bottom, from(#fff), to(#ebeff9));
border-bottom:1px solid #eee;
padding:0;
display:none;
}
a.getmore {
display:block;
text-align:right;
padding:10px;
}
div.url {
font-weight:normal;
opacity:0;
position:absolute;
text-align:center;
}
ul.iconlist li:hover div.url {
opacity:.5;
}
li.selected {
background-color:#D6DEF7 !important;
}
li.vseparator {
width:1px;
height:86px;
background-color:red;
}
.searchfield, #q {
padding:2px 2px 2px 5px;

View File

@ -133,4 +133,12 @@
<title>Horaires Ciné</title>
</link>
</label>
<reserve>
<link>
<url>http://fr.mail.yahoo.com/</url>
<onclick>popup</onclick>
<img>mail-yahoo.png</img>
<title>Yahoo Mail</title>
</link>
</reserve>
</links>

View File

@ -1,27 +1,38 @@
$(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>');
$('body').append('<img src="images/interface/link_edit.png" id="links-menu" />');
$('#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();
// Apparition de la reserve de liens
$('#links-menu').live('click', function(){
$('#reserve').show();
$.get('ajax/loadReserve.php', function(html){
$.fancybox(
html,
{
'autoDimensions' : false,
'width' : 400,
'height' : 'auto',
'showNavArrows' : false,
'transitionIn' : 'elastic'
}
);
});
}else{
$('#links').append('<span class="error">links can\'t be empty.</span>');
}
});
// Passage Reserve => Liste
$('#reserveiconlist .item').live('click', function(e){
e.preventDefault();
$.post("ajax/reserveToList.php", {reserve: $(this).attr('id')});
$('#Entertainment').append($(this).parent().html());
$.fancybox.close();
});
//Passage Liste => Reserve
// ??
// Mouvement des liens avec enregistrement
$(".iconlist").sortable(
{