Ajout du module de news
This commit is contained in:
parent
2394218c17
commit
8ece766934
@ -7,6 +7,9 @@ $search = $_POST['search'];
|
||||
$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;
|
||||
@ -17,6 +20,9 @@ $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";
|
||||
|
@ -24,6 +24,8 @@ class links {
|
||||
echo '</ul>
|
||||
<hr>';
|
||||
}
|
||||
}else{
|
||||
echo 'Can\'t find '.self::LINKS_FILE;
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
60
class/News.php
Normal file
60
class/News.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
class news {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
|
||||
<div id="news"></div>
|
||||
<script type="text/javascript">
|
||||
google.load("elements", "1", {packages : ["newsshow"]});
|
||||
function onLoad() {
|
||||
var options = {
|
||||
"format" : "300x250",
|
||||
"language" : "fr",
|
||||
"linkTarget" : "_blank"
|
||||
}
|
||||
// Load it using all of the defaults.
|
||||
var content = document.getElementById(\'news\');
|
||||
var newsShow = new google.elements.NewsShow(content, options);
|
||||
make_draggable($(\'#news\'));
|
||||
}
|
||||
|
||||
|
||||
google.setOnLoadCallback(onLoad);
|
||||
</script>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$news = new news($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='news']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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({
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')
});
}
});
}
|
||||
/* A helper function for converting a set of elements to draggables: */
make_draggable($('#todo'));
|
||||
});
|
@ -1,27 +1,7 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
var zIndex = 0;
|
||||
$('#menu-bar').prepend($('#blog-links-manager'));
|
||||
|
||||
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')
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//affichage des blogs
|
||||
$("#blogs").html("<img src=\"images/interface/ajax_load.gif\"/> Loading Blogs...");
|
||||
var tmp;
|
||||
|
@ -216,23 +216,4 @@ $(document).ready(function(){
|
||||
/* A helper function for converting a set of elements to draggables: */
|
||||
make_draggable($('.jclock'));
|
||||
|
||||
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('update_position_config.php',{
|
||||
x : ui.position.left,
|
||||
y : ui.position.top,
|
||||
id : ui.helper.attr('id')
|
||||
});
|
||||
}
|
||||
});}
|
||||
});
|
||||
|
@ -26,24 +26,5 @@ $(document).ready(function(){
|
||||
/* A helper function for converting a set of elements to draggables: */
|
||||
make_draggable($('#weather'));
|
||||
|
||||
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.php',{
|
||||
x : ui.position.left,
|
||||
y : ui.position.top,
|
||||
id : ui.helper.attr('id')
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
42
js/main.js
42
js/main.js
@ -35,6 +35,27 @@
|
||||
{
|
||||
window.open("calculator.html", "Calc", "menubar=0,resizable=0,width=320,height=360")
|
||||
}
|
||||
|
||||
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.php',{
|
||||
x : ui.position.left,
|
||||
y : ui.position.top,
|
||||
id : ui.helper.attr('id')
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$('body').prepend('<div id="menu-bar"></div>');
|
||||
$('#menu-bar').prepend($('#config-menu'));
|
||||
@ -57,26 +78,5 @@ $(document).ready(function(){
|
||||
'hideOnContentClick': false,
|
||||
'padding' : 15
|
||||
});
|
||||
/*$('#config-submit').live('click',function(e){
|
||||
$(this).replaceWith('<img src="images/interface/ajax_load.gif" style="margin:30px auto;display:block" />');
|
||||
var data3 = {
|
||||
'clock' : $('input[type=radio][name=clock_group]:checked').attr('value'),
|
||||
'weather' : $('input[type=radio][name=weather_group]:checked').attr('value'),
|
||||
'notes' : $('input[type=radio][name=notes_group]:checked').attr('value'),
|
||||
'search' : $('input[type=radio][name=search_group]:checked').attr('value'),
|
||||
'links' : $('input[type=radio][name=links_group]:checked').attr('value'),
|
||||
'blogs' : $('input[type=radio][name=blogs_group]:checked').attr('value'),
|
||||
'todo' : $('input[type=radio][name=todo_group]:checked').attr('value')
|
||||
};
|
||||
|
||||
$.post('ajax/post-config.php',data3,function(msg3){
|
||||
if(msg3=="1"){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
e.preventDefault();
|
||||
});*/
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user