Automatisation de l'ajax "visibility"
Ajout de la méthode setVisibility à 3 Modèles Bug Chrome sur les liens éliminé
This commit is contained in:
parent
81bf7cb785
commit
73e97a31be
@ -1,29 +1,9 @@
|
|||||||
<?// Escaping the input data:
|
<?
|
||||||
//TODO automatisation ! Je veux plus de "$config_xml[x]"
|
$options = array();
|
||||||
$clock = $_POST['clock'];
|
$module ='';
|
||||||
$weather = $_POST['weather'];
|
include '../class/AccueilModules.php';
|
||||||
$notes = $_POST['notes'];
|
foreach($_POST as $module => $valeur){
|
||||||
$search = $_POST['search'];
|
AccueilModules::updateModule($module, array('visibility'=>$valeur));
|
||||||
$links = $_POST['links'];
|
}
|
||||||
$blogs = $_POST['blogs'];
|
|
||||||
$todo = $_POST['todo'];
|
|
||||||
$clockAdvanced = $_POST['clockAdvanced'];
|
|
||||||
$rssblogs = $_POST['rssblogs'];
|
|
||||||
$news = $_POST['news'];
|
|
||||||
|
|
||||||
$xmla = simplexml_load_file('../db/config.xml');
|
|
||||||
$config_xml = $xmla->item;
|
|
||||||
$config_xml[0]->visibility = $clock;
|
|
||||||
$config_xml[1]->visibility = $weather;
|
|
||||||
$config_xml[2]->visibility = $notes;
|
|
||||||
$config_xml[3]->visibility = $search;
|
|
||||||
$config_xml[4]->visibility = $links;
|
|
||||||
$config_xml[5]->visibility = $blogs;
|
|
||||||
$config_xml[6]->visibility = $todo;
|
|
||||||
$config_xml[7]->visibility = $clockAdvanced;
|
|
||||||
$config_xml[8]->visibility = $rssblogs;
|
|
||||||
$config_xml[9]->visibility = $news;
|
|
||||||
$xmla->asXML('../db/config.xml');
|
|
||||||
|
|
||||||
echo "1";
|
echo "1";
|
||||||
?>
|
?>
|
||||||
|
@ -65,14 +65,14 @@ class AccueilModules {
|
|||||||
$(\'#config-submit\').live(\'click\',function(e){
|
$(\'#config-submit\').live(\'click\',function(e){
|
||||||
$(this).replaceWith(\'<img src="images/interface/ajax_load.gif" style="margin:30px auto;display:block" />\');
|
$(this).replaceWith(\'<img src="images/interface/ajax_load.gif" style="margin:30px auto;display:block" />\');
|
||||||
var data3 = {';
|
var data3 = {';
|
||||||
|
$temp = '';
|
||||||
foreach($this->modules as $module=>$moduleConf){
|
foreach($this->modules as $module=>$moduleConf){
|
||||||
echo '\''.$module.'\' : $(\'input[type=radio][name='.$module.'_group]:checked\').attr(\'value\'),';
|
$temp .= '\''.$module.'\' : $(\'input[type=radio][name='.$module.'_group]:checked\').attr(\'value\'),';
|
||||||
}
|
}
|
||||||
|
echo substr($temp, 0, -1);
|
||||||
echo '};
|
echo '};
|
||||||
$.post(\'ajax/post-config.php\',data3,function(msg3){
|
$.post(\'ajax/post-config.php\',data3,function(msg3){
|
||||||
if(msg3=="1"){
|
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@ class links {
|
|||||||
echo '<span class="label">'.$label['id'].'</span>
|
echo '<span class="label">'.$label['id'].'</span>
|
||||||
<ul class="iconlist" id="'.$label['id'].'">';
|
<ul class="iconlist" id="'.$label['id'].'">';
|
||||||
foreach($label->link as $link){
|
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 '<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>
|
echo '</ul>
|
||||||
<hr>';
|
<hr>';
|
||||||
@ -50,6 +50,18 @@ class links {
|
|||||||
echo "ok";
|
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='links']");
|
||||||
|
$path[0]->visibility = $visibility;
|
||||||
|
|
||||||
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
|
echo "ok";
|
||||||
|
}
|
||||||
|
|
||||||
public static function updateConfig($updated){
|
public static function updateConfig($updated){
|
||||||
foreach ($updated as $what=>$withWhat){
|
foreach ($updated as $what=>$withWhat){
|
||||||
if(in_array($what, self::$paramsList)){
|
if(in_array($what, self::$paramsList)){
|
||||||
|
@ -23,6 +23,18 @@ class notes extends Module {
|
|||||||
$notes = new notes($params);
|
$notes = new notes($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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='notes']");
|
||||||
|
$path[0]->visibility = $visibility;
|
||||||
|
|
||||||
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
|
echo "ok";
|
||||||
|
}
|
||||||
|
|
||||||
public static function updateConfig($updated){
|
public static function updateConfig($updated){
|
||||||
foreach ($updated as $what=>$withWhat){
|
foreach ($updated as $what=>$withWhat){
|
||||||
if(in_array($what, self::$paramsList)){
|
if(in_array($what, self::$paramsList)){
|
||||||
|
@ -23,6 +23,18 @@ class ouifm extends Module {
|
|||||||
$ouifm = new ouifm($params);
|
$ouifm = new ouifm($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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='ouifm']");
|
||||||
|
$path[0]->visibility = $visibility;
|
||||||
|
|
||||||
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
|
echo "ok";
|
||||||
|
}
|
||||||
|
|
||||||
public static function updateConfig($updated){
|
public static function updateConfig($updated){
|
||||||
foreach ($updated as $what=>$withWhat){
|
foreach ($updated as $what=>$withWhat){
|
||||||
if(in_array($what, self::$paramsList)){
|
if(in_array($what, self::$paramsList)){
|
||||||
|
@ -42,7 +42,7 @@ class rssblogs extends Module {
|
|||||||
// Saving the position and z-index of the note:
|
// Saving the position and z-index of the note:
|
||||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
$path = $xmla->xpath("//item[@id='weather']");
|
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||||
$path[0]->x = $x;
|
$path[0]->x = $x;
|
||||||
|
|
||||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||||
@ -54,7 +54,7 @@ class rssblogs extends Module {
|
|||||||
// Saving the position and z-index of the note:
|
// Saving the position and z-index of the note:
|
||||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
$path = $xmla->xpath("//item[@id='weather']");
|
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||||
$path[0]->y = $y;
|
$path[0]->y = $y;
|
||||||
|
|
||||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||||
@ -66,7 +66,7 @@ class rssblogs extends Module {
|
|||||||
// Saving the position and z-index of the note:
|
// Saving the position and z-index of the note:
|
||||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
$path = $xmla->xpath("//item[@id='weather']");
|
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||||
$path[0]->visibility = $visibility;
|
$path[0]->visibility = $visibility;
|
||||||
|
|
||||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
32
db/links.xml
32
db/links.xml
@ -2,37 +2,37 @@
|
|||||||
<label id="Google Apps">
|
<label id="Google Apps">
|
||||||
<link>
|
<link>
|
||||||
<url>http://mail.google.com</url>
|
<url>http://mail.google.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>gmail_128.png</img>
|
<img>gmail_128.png</img>
|
||||||
<title>Gmail</title>
|
<title>Gmail</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://mail.live.com</url>
|
<url>http://mail.live.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>mail-msn.png</img>
|
<img>mail-msn.png</img>
|
||||||
<title>Hotmail</title>
|
<title>Hotmail</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://mail1.voila.fr/webmail/fr_FR/login.html</url>
|
<url>http://mail1.voila.fr/webmail/fr_FR/login.html</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>voila.png</img>
|
<img>voila.png</img>
|
||||||
<title>Voila.fr mail</title>
|
<title>Voila.fr mail</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://calendar.google.com</url>
|
<url>http://calendar.google.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>calendar_128.png</img>
|
<img>calendar_128.png</img>
|
||||||
<title>GoogleCalendar</title>
|
<title>GoogleCalendar</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://reader.google.com</url>
|
<url>http://reader.google.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>reader_128.png</img>
|
<img>reader_128.png</img>
|
||||||
<title>Google Reader</title>
|
<title>Google Reader</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://docs.google.com</url>
|
<url>http://docs.google.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>docs_128.png</img>
|
<img>docs_128.png</img>
|
||||||
<title>Google Docs</title>
|
<title>Google Docs</title>
|
||||||
</link>
|
</link>
|
||||||
@ -40,37 +40,37 @@
|
|||||||
<label id="Media">
|
<label id="Media">
|
||||||
<link>
|
<link>
|
||||||
<url>http://youtube.com</url>
|
<url>http://youtube.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>youtube_128.png</img>
|
<img>youtube_128.png</img>
|
||||||
<title>YouTube</title>
|
<title>YouTube</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://picasaweb.com</url>
|
<url>http://picasaweb.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>picasaweb_128.png</img>
|
<img>picasaweb_128.png</img>
|
||||||
<title>PicasaWeb</title>
|
<title>PicasaWeb</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://www.netvibes.com</url>
|
<url>http://www.netvibes.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>netvibes.png</img>
|
<img>netvibes.png</img>
|
||||||
<title>Netvibes</title>
|
<title>Netvibes</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://www.deviantart.com</url>
|
<url>http://www.deviantart.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>deviantART128.png</img>
|
<img>deviantART128.png</img>
|
||||||
<title>DeviantArt</title>
|
<title>DeviantArt</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>https://www.labanquepostale.fr/index.html</url>
|
<url>https://www.labanquepostale.fr/index.html</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>banquepostale.png</img>
|
<img>banquepostale.png</img>
|
||||||
<title>Banque 1</title>
|
<title>Banque 1</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://www.societegenerale.fr/</url>
|
<url>http://www.societegenerale.fr/</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>societegenerale.png</img>
|
<img>societegenerale.png</img>
|
||||||
<title>Banque 2</title>
|
<title>Banque 2</title>
|
||||||
</link>
|
</link>
|
||||||
@ -110,25 +110,25 @@
|
|||||||
<label id="Entertainment">
|
<label id="Entertainment">
|
||||||
<link>
|
<link>
|
||||||
<url>http://facebook.com</url>
|
<url>http://facebook.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>facebook.png</img>
|
<img>facebook.png</img>
|
||||||
<title>Facebook</title>
|
<title>Facebook</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://twitter.com</url>
|
<url>http://twitter.com</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>twitter.png</img>
|
<img>twitter.png</img>
|
||||||
<title>Twitter</title>
|
<title>Twitter</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://fr.vente-privee.com/</url>
|
<url>http://fr.vente-privee.com/</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>vp128.png</img>
|
<img>vp128.png</img>
|
||||||
<title>Ventes Privées</title>
|
<title>Ventes Privées</title>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<url>http://www.google.fr/movies</url>
|
<url>http://www.google.fr/movies</url>
|
||||||
<onclick>spawnLink(this);return false;</onclick>
|
<onclick>popup</onclick>
|
||||||
<img>Gmovie.png</img>
|
<img>Gmovie.png</img>
|
||||||
<title>Horaires Ciné</title>
|
<title>Horaires Ciné</title>
|
||||||
</link>
|
</link>
|
||||||
|
@ -25,16 +25,32 @@ $(document).ready(function(){
|
|||||||
// Mouvement des liens avec enregistrement
|
// Mouvement des liens avec enregistrement
|
||||||
$(".iconlist").sortable(
|
$(".iconlist").sortable(
|
||||||
{
|
{
|
||||||
|
//distance: 45,
|
||||||
connectWith: '.iconlist',
|
connectWith: '.iconlist',
|
||||||
update: function(event,ui){
|
update: function(event,ui){
|
||||||
var linkOrder = $(this).sortable('toArray').toString();
|
var linkOrder = $(this).sortable('toArray').toString();
|
||||||
var label = $(ui.item).parent()[0].id;
|
var label = $(ui.item).parent()[0].id;
|
||||||
var itemMoved = $(ui.item)[0].id;
|
var itemMoved = $(ui.item)[0].id;
|
||||||
$.post("ajax/update-links-order.php", {order: linkOrder, label : label, itemMoved: itemMoved});
|
$.post("ajax/update-links-order.php", {order: linkOrder, label : label, itemMoved: itemMoved});
|
||||||
|
},
|
||||||
|
start: function(e) {
|
||||||
|
// have to remvoe click handler off item so drop doesn't click
|
||||||
|
$("a.popup").unbind("click");
|
||||||
|
},
|
||||||
|
stop: function(e) {
|
||||||
|
//$("a.popup").bind("click", function(e){ itemClickHandler(e, $(this)); });
|
||||||
|
//$("a.popup").click(itemClickHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).disableSelection().mouseout(function(){
|
||||||
|
// reattach the item click handler
|
||||||
|
$('a.popup').unbind("click").bind("click", function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var url = $(this).attr('href');
|
||||||
|
spawnURL(url);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
).disableSelection();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
@ -56,7 +56,13 @@ function make_draggable(elements)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
$('a.popup').bind("click", function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var url = $(this).attr('href');
|
||||||
|
spawnURL(url);
|
||||||
|
});
|
||||||
$('body').prepend('<div id="menu-bar"></div>');
|
$('body').prepend('<div id="menu-bar"></div>');
|
||||||
$('#menu-bar').prepend($('#config-menu'));
|
$('#menu-bar').prepend($('#config-menu'));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user