Version avec modules séparés !

This commit is contained in:
Chouchen 2010-09-27 10:48:53 +00:00
parent 2861556131
commit 734e6f4829
81 changed files with 324 additions and 264 deletions

View File

@ -19,7 +19,7 @@ class AccueilModules {
$this->getModules();
$this->buildConfigMenu();
}else{
echo 'baaaaad persistance...';
echo 'Impossible de trouver le fichier de configuration.';
}
}
@ -29,12 +29,12 @@ class AccueilModules {
*/
function getModules(){
foreach($this->modules as $module=>$moduleConf){
if(file_exists('class/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){
if(file_exists('modules/'.$module.'/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){
$params = array();
foreach($moduleConf as $confParam){
$params[$confParam->getName()] = "$confParam";
}
require ucfirst($module).'.php';
require 'modules/'.$module.'/'.ucfirst($module).'.php';
call_user_func(array($module, "start"), $params);
}
}
@ -88,7 +88,7 @@ class AccueilModules {
* @return "ok" String si c'est bon, ou le message d'erreur
*/
public static function updateModule($module, $things2change){
require ucfirst($module).'.php';
require '../modules/'.$module.'/'.ucfirst($module).'.php';
return call_user_func(array($module, "updateConfig"), $things2change);
}
}

View File

@ -1,33 +0,0 @@
<?php
class clock extends Module {
protected static $paramsList = array(
'visibility',
'x',
'y'
);
public $params = array();
public function __construct($params){
$this->setParams($params);
echo '<script type="text/javascript" src="js/jquery.jclock.js"></script>';
echo '<div class="jclock" id="clock" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
}
private function setParams($params){
$this->params = $params;
}
public static function start($params){
$clock = new clock($params);
}
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

@ -8,6 +8,15 @@ abstract class Module
*/
protected static $paramsList = array();
// Nom du module (aka le nom de la classe en minuscule)
protected $moduleName;
// Libellé du module (aka le nom affiché)
protected $moduleTitle;
// Le chemin vers le module
protected $pathToModule;
/**
* Liste des paramètres et leurs valeurs de l'object
*

View File

@ -1,39 +0,0 @@
<?php
class search extends Module {
protected static $paramsList = array(
'visibility'
);
public $params = array();
public function __construct($params){
echo '<link rel="stylesheet" type="text/css" href="css/search.css">
<script type="text/javascript" src="js/jquery.search.js"></script>
<form id="searchForm" method="post">
<fieldset>
<input id="s" type="text" />
<input type="submit" value="Submit" id="submitButton" class="searchbutton" />
<ul class="icons">
<li class="web" title="Web Search" data-searchType="web">Web</li>
<li class="images" title="Image Search" data-searchType="images">Images</li>
<li class="news" title="News Search" data-searchType="news">News</li>
<li class="videos" title="Video Search" data-searchType="video">Videos</li>
</ul>
</fieldset>
</form>';
}
private function setParams($params){
$this->params = $params;
}
public static function start($params){
$search = new search($params);
}
public static function updateConfig($updated){
}
}

View File

@ -1,12 +0,0 @@
<?
$xmla = simplexml_load_file('todoist.xml');
if($xmla->token== '' || $xmla->token == null)
header('Location: index.php');
if($xmla->id != '' || $xmla->id != null):
$token = $xmla->token;
$id = $xmla->id;?>
<script type="text/javascript" src="js/getUncompletedTasks.php?token=<?=$token?>&id=<?=$id?>"></script>
<? else:
header('Location: getProjectsList.php');
endif;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1,23 +0,0 @@
$(document).ready(function(){
$('#menu-bar').append($('#myAdress'));
$('#map').css({'visibility':'hidden'});
$('#gmapLink').fancybox({
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'onClosed': function(){$('#map').css({'visibility':'hidden'});},
'onStart': function(){$('#map').css({'visibility':'visible'});}
});
$('#myAdressField').keydown(function(e){
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) {
var adress = $(this).val();
geocodeMarker(adress,adress,adress,'','http://maps.gstatic.com/intl/fr_ALL/mapfiles/markers/marker_sprite.png');
geocodeCenter(adress);
$('#gmapLink').trigger('click');
}
});
});

View File

@ -1,75 +0,0 @@
/**
* jQuery.ajax mid - CROSS DOMAIN AJAX
* ---
* @author James Padolsey (http://james.padolsey.com)
* @version 0.11
* @updated 12-JAN-10
* ---
* Note: Read the README!
* ---
* @info http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
*/
jQuery.ajax = (function(_ajax){
var protocol = location.protocol,
hostname = location.hostname,
exRegex = RegExp(protocol + '//' + hostname),
YQL = 'http' + (/^https/.test(protocol)?'s':'') + '://query.yahooapis.com/v1/public/yql?callback=?',
query = 'select * from html where url="{URL}" and xpath="*"';
function isExternal(url) {
return !exRegex.test(url) && /:\/\//.test(url);
}
return function(o) {
var url = o.url;
if ( /get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url) ) {
// Manipulate options so that JSONP-x request is made to YQL
o.url = YQL;
o.dataType = 'json';
o.data = {
q: query.replace(
'{URL}',
url + (o.data ?
(/\?/.test(url) ? '&' : '?') + jQuery.param(o.data)
: '')
),
format: 'xml'
};
// Since it's a JSONP request
// complete === success
if (!o.success && o.complete) {
o.success = o.complete;
delete o.complete;
}
o.success = (function(_success){
return function(data) {
if (_success) {
// Fake XHR callback.
_success.call(this, {
responseText: data.results[0]
// YQL screws with <script>s
// Get rid of them
.replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')
}, 'success');
}
};
})(o.success);
}
return _ajax.apply(this, arguments);
};
})(jQuery.ajax);

View File

@ -9,10 +9,13 @@ class blogs extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
require('blogs_last_post.php');
echo '<script type="text/javascript" src="js/jquery.blogs.js"></script>
<div id="blogs" style="top:'.$params['y'].'; left :'.$params['x'].';"></div>';
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
require($this->pathToModule.'includes/blogs_last_post.php');
echo '<div id="blogs" style="top:'.$params['y'].'; left :'.$params['x'].';"></div>';
echo '<a href="#blogLinksManager" id="blog-links-manager"><img src="images/interface/blogs_edit.png" /></a>';
echo '<div style="display:none;">
<div id="blogLinksManager">
@ -24,7 +27,7 @@ class blogs extends Module {
echo '<li>'.$link['url'].' <img src="images/interface/delete.png" id="link-'.$link['name'].'"/></li>';
echo '</ul>
<h4>Insert Site feed</h4>
<form action="addSite.php" method="POST">
<form action="modules/blogs/includes/addSite.php" method="POST">
<input type="text" id="newLink" name="newLink" value="url" />
<input type="submit" id="link-submit" class="green-button" value="Ajouter"></input>
</form>

View File

View File

@ -30,7 +30,7 @@ function getResult()
}
public function getLinks(){
if($linksXML = simplexml_load_file('db/blog_links.xml')){
if($linksXML = simplexml_load_file('../db/blog_links.xml')){
foreach($linksXML->link as $individualLink){
$this->link[] = array('name'=>$individualLink->name, 'url'=>$individualLink->url, 'number'=>$individualLink->number);
}

View File

@ -10,7 +10,7 @@ var tmp;
make_draggable($('#blogs'));
$.ajax(
{url : "blogs.php",
{url : "modules/blogs/includes/blogs.php",
timeout : 36000,
error: function(data){
$("#blogs").html('<img src="images/interface/error.png"/> Délai dépassé !');

48
modules/clock/Clock.php Normal file
View File

@ -0,0 +1,48 @@
<?php
class clock extends Module {
protected static $paramsList = array(
'visibility',
'x',
'y'
);
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
echo '<div class="jclock" id="clock" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
}
private function setParams($params){
$this->params = $params;
}
public static function start($params){
$clock = new clock($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='clock']");
$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);
}
}
}
}

View File

View File

@ -13,8 +13,11 @@ class clockAdvanced extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<script type="text/javascript" src="js/jquery.jclockAdvanced.js"></script>';
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
$options = '';
foreach (self::$paramsList as $paramName){

View File

@ -9,27 +9,14 @@ class gmap extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<script type="text/javascript" src="js/gmap.js"></script>
<link type="text/css" rel="stylesheet" href="css/gmap.css" />
echo '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=fr"></script>
<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />
<div id="myAdress"><label for="myAdressField"><img src="images/interface/map.png" /> Adresse pour Google Maps :</label><input type="text" name="myAdressField" id="myAdressField" /></div><a href="#map" id="gmapLink"></a><div id="map">';
include 'GoogleMapAPIv3.class.php';
$gmap = new GoogleMapAPI();
$gmap->setDivId('mymap'); //crée une div avec l'id donnée
//$gmap->setDirectionDivId('route');
$gmap->setCenter('Paris France'); // Adresse du centre par défaut
$gmap->setEnableWindowZoom(true); // Permet de zoomer (trop important !)
$gmap->setEnableAutomaticCenterZoom(false); // FALSE ! ou sinon le setCenter ne sert à rien !
//$gmap->setDisplayDirectionFields(false);
$gmap->setSize('400px','400px'); // La taille... duh !
$gmap->setZoom(11); // Le zoom (+ il est haut, plus le zoom est proche)
$gmap->setLang('fr'); // La langue par défaut
$gmap->setDefaultHideMarker(false); // Cache les markers ?
$gmap->generate(); // Génère le JS
echo $gmap->getGoogleMap();
echo '</div>';
<div id="myAdress"><label for="myAdressField"><img src="images/interface/map.png" /> Adresse pour Google Maps :</label><input type="text" name="myAdressField" id="myAdressField" /></div><a href="#map" id="gmapLink"></a><div id="map"><div id="mymap" style="width:400px;height:400px"></div></div>';
}
private function setParams($params){

89
modules/gmap/js/gmap.js Normal file
View File

@ -0,0 +1,89 @@
$(document).ready(function(){
var geocoder = new google.maps.Geocoder();
var map;
var gmarkers = [];
var infowindow;
var directions = new google.maps.DirectionsRenderer();
var directionsService = new google.maps.DirectionsService();
var current_lat = 0;
var current_lng = 0;
function getCurrentLat() {
return current_lat;
}
function getCurrentLng() {
return current_lng;
}
function addMarker(latlng,title,content,category,icon) {
var marker = new google.maps.Marker({
map: map,
title : title,
icon: new google.maps.MarkerImage(icon, new google.maps.Size(57,34)),
position: latlng
});
var html = '<div style="float:left;text-align:left;width:250;">'+content+'</div>'
google.maps.event.addListener(marker, "click", function() {
if (infowindow) infowindow.close();
infowindow = new google.maps.InfoWindow({content: html});
infowindow.open(map,marker);
map.setCenter(new google.maps.LatLng(latlng.lat(),latlng.lng()),3);
});
marker.mycategory = category;
gmarkers.push(marker);
}
function geocodeMarker(address,title,content,category,icon) {
if (geocoder) {
geocoder.geocode( { "address" : address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latlng = results[0].geometry.location;
addMarker(results[0].geometry.location,title,content,category,icon)
}
});
}
}
function geocodeCenter(address) {
if (geocoder) {
geocoder.geocode( { "address": address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
function initialize() {
var myLatlng = new google.maps.LatLng(48.8792,2.34778);
var myOptions = {
zoom: 11,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("mymap"), myOptions);
geocodeCenter("Paris France");
google.maps.event.addListener(map,"click",function(event) { if (event) { current_lat=event.latLng.lat();current_lng=event.latLng.lng(); }}) ;
directions.setMap(map);
directions.setPanel(document.getElementById("route"))
}
initialize();
$('#menu-bar').append($('#myAdress'));
$('#map').css({'visibility':'hidden'});
$('#gmapLink').fancybox({
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'onClosed': function(){$('#map').css({'visibility':'hidden'});},
'onStart': function(){$('#map').css({'visibility':'visible'});}
});
$('#myAdressField').keydown(function(e){
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) {
e.preventDefault();
var adress = $(this).val();
geocodeMarker(adress,adress,adress,'','http://maps.gstatic.com/intl/fr_ALL/mapfiles/markers/marker_sprite.png');
geocodeCenter(adress);
$('#gmapLink').trigger('click');
}
});
});

View File

@ -1,6 +1,10 @@
<?php
class links {
class links extends Module{
protected $moduleName;
protected $moduleTitle;
protected $pathToModule;
protected static $paramsList = array(
'visibility'
);
@ -10,12 +14,14 @@ class links {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<script type="text/javascript" src="js/jquery.links.js"></script>
<link rel="stylesheet" href="css/links.css" type="text/css" />
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />
<div style="display:none;"><div id="links-add-fancy"></div></div>
<div class="appscontainer">';
if($links_xml = simplexml_load_file(self::LINKS_FILE)){
if($links_xml = simplexml_load_file($this->pathToModule.self::LINKS_FILE)){
$links = $links_xml->label;
foreach($links as $label){
//<span class="label">'.$label['id'].'</span>
@ -27,7 +33,7 @@ class links {
<hr>';
}
}else{
echo 'Can\'t find '.self::LINKS_FILE;
echo 'Can\'t find '.$this->pathToModule.self::LINKS_FILE;
}
echo '</div>';

View File

@ -1,6 +1,5 @@
<?
include '../class/Links.php';
if($links_xml = simplexml_load_file('../'.links::LINKS_FILE)){
if($links_xml = simplexml_load_file("../db/links.xml")){
$links = $links_xml->reserve;
foreach($links as $label){
echo '<ul id="reserveiconlist">';

View File

@ -15,7 +15,7 @@ $(document).ready(function(){
// Apparition de la reserve de liens
$('#links-menu').live('click', function(){
$.get('ajax/loadReserve.php', function(html){
$.get('modules/links/ajax/loadReserve.php', function(html){
$.fancybox(
html,
{
@ -32,7 +32,7 @@ $(document).ready(function(){
// Passage Reserve => Liste
$('#reserveiconlist .iconitem').live('click', function(e){
e.preventDefault();
$.post("ajax/reserveToList.php", {reserve: $(this).attr('id')});
$.post("modules/links/ajax/reserveToList.php", {reserve: $(this).attr('id')});
$('.iconlist').last().append('<li class="iconitem" id="'+$(this).attr('id')+'">'+$(this).html()+'</li>');
$.fancybox.close();
});
@ -47,7 +47,7 @@ $(document).ready(function(){
});
$('.deleteLink').click(function(){
$.post("ajax/listToReserve.php", {reserve: $(this).parent().attr('id')});
$.post("modules/links/ajax/listToReserve.php", {reserve: $(this).parent().attr('id')});
$(this).parent().fadeOut();
});
@ -59,7 +59,7 @@ $(document).ready(function(){
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});
$.post("modules/links/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

View File

@ -8,10 +8,12 @@ class mappy extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
echo '<script src="http://axe.mappy.com/1v1/init/get.aspx?version=2.01&solution=ajax&auth=HbTTpMfC4//GWuldL2IsF+HJA4xVuTBsIQi0wcC7xRz+e17hobrJ+1947aq34rdjYAPy6nBYBQF8o56Qzdun9w=="></script>
<script type="text/javascript" src="js/mappy.js"></script>
<link type="text/css" rel="stylesheet" href="css/mappy.css" />
<div id="mymap"></div>
<div id="myAdress"><input type="text" name="myAdressField" id="myAdressField" /></div>';
}

View File

@ -1,6 +1,10 @@
<?php
class notes extends Module {
protected $moduleName;
protected $moduleTitle;
protected $pathToModule;
protected static $paramsList = array(
'visibility'
);
@ -8,11 +12,13 @@ class notes extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<script type="text/javascript" src="js/jquery.notes.js"></script>
<link rel="stylesheet" type="text/css" href="css/note.css">
<a id="addButton" class="green-button" href="add_note.html">Add a note</a>';
include 'notes_extract.php';
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">
<a id="addButton" class="green-button" href="'.$this->pathToModule.'includes/add_note.html">Add a note</a>';
include $this->pathToModule.'includes/notes_extract.php';
}
private function setParams($params){

View File

@ -112,7 +112,7 @@ h3.popupTitle{
}
#note-submit{ margin:20px auto; }
.delete {display:none; height:16px; width:16px; background:url(../images/interface/delete.png) top left no-repeat; position:absolute; top:5px; right:5px; z-index:9999;}
.delete {display:none; height:16px; width:16px; background:url(../../../images/interface/delete.png) top left no-repeat; position:absolute; top:5px; right:5px; z-index:9999;}
.delete:hover{cursor:pointer !important;}

View File

@ -1,5 +1,5 @@
<?php $nb = 0;
$notes = simplexml_load_file('db/notes.xml');
$notes = simplexml_load_file('modules/notes/db/notes.xml');
foreach($notes as $test){$nb++;}
for($i=0; $i<$nb; $i++){?>
<div class="note <?echo $notes->note[$i]->color;?>" style="position:absolute; left:<? echo $notes->note[$i]->left;?>; top:<? echo $notes->note[$i]->top;?>;z-index:<? echo $notes->note[$i]->zindex;?>;"><div class="delete" id="r-<?echo $notes->note[$i]['id'];?>"></div><? echo $notes->note[$i]->text;?><br/><span class="data"><?echo $notes->note[$i]['id'];?></span></div>

View File

@ -14,7 +14,7 @@ $(document).ready(function(){
var data2 = {'id' : $(this).attr("id")};
$(this).replaceWith('<img src="images/interface/ajax_load.gif" style="display:block" />');
/* Sending an AJAX POST request: */
$.post('ajax/delete-notes.php',data2,function(msg2){
$.post('modules/notes/ajax/delete-notes.php',data2,function(msg2){
if(parseInt(msg2))
{
msg2--;
@ -88,7 +88,7 @@ $(document).ready(function(){
};
/* Sending an AJAX POST request: */
$.post('ajax/post-notes.php',data,function(msg){
$.post('modules/notes/ajax/post-notes.php',data,function(msg){
if(parseInt(msg))
{
@ -119,7 +119,7 @@ function make_draggable(elements)
stop:function(e,ui){
/* Sending the z-index and positon of the note to update_position.php via AJAX GET: */
$.get('ajax/update_position.php',{
$.get('modules/notes/ajax/update_position.php',{
x : ui.position.left,
y : ui.position.top,
z : zIndex,

View File

@ -10,8 +10,11 @@ class ouifm extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<script type="text/javascript" src="js/jquery.ouifm.js"></script>';
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
echo '<div id="ouifm" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
}

View File

View File

@ -10,8 +10,11 @@ class rssblogs extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<link rel="stylesheet" type="text/css" href="css/rssblogs.css"><div id="rssblogs">';
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
require('class/lastRSS.php');
$rss = new lastRSS;
// options lastRSS
@ -19,7 +22,7 @@ class rssblogs extends Module {
$rss->cache_time = 3600; // fréquence de mise à jour du cache (en secondes)
$rss->date_format = 'd/m/y'; // format de la date (voir fonction date() pour syntaxe)
$rss->CDATA = 'content'; // on retire les tags CDATA en conservant leur contenu
if($linksXML = simplexml_load_file('db/rss.xml')){
if($linksXML = simplexml_load_file($this->pathToModule.'db/rss.xml')){
foreach($linksXML->link as $individualLink){
if ($rs = $rss->get($individualLink->url))
echo '<span class="date">'.$rs['items'][0]['pubDate'].'</span> <a href="'.$rs['items'][0]['link'].'">'.$rs['items'][0]['title'].'</a><br />';

View File

62
modules/search/Search.php Normal file
View File

@ -0,0 +1,62 @@
<?php
class search extends Module {
protected $moduleName;
protected $moduleTitle;
protected $pathToModule;
protected static $paramsList = array(
'visibility'
);
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/search.css">
<script type="text/javascript" src="'.$this->pathToModule.'js/jquery.search.js"></script>
<form id="searchForm" method="post">
<fieldset>
<input id="s" type="text" />
<input type="submit" value="Submit" id="submitButton" class="searchbutton" />
<ul class="icons">
<li class="web" title="Web Search" data-searchType="web">Web</li>
<li class="images" title="Image Search" data-searchType="images">Images</li>
<li class="news" title="News Search" data-searchType="news">News</li>
<li class="videos" title="Video Search" data-searchType="video">Videos</li>
</ul>
</fieldset>
</form>';
}
private function setParams($params){
$this->params = $params;
}
public static function start($params){
$search = new search($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='search']");
$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);
}
}
}
}

View File

@ -21,7 +21,7 @@ fieldset{
border:none;
color:#888888;
/*background:url("../images/interface/searchBox.png") no-repeat;*/
background:url('../images/interface/zoom.png') 10px center no-repeat;
background:url('../../../images/interface/zoom.png') 10px center no-repeat;
border:1px solid #888888;
float:left;
font-family:Arial,Helvetica,sans-serif;
@ -58,7 +58,7 @@ fieldset{
}
.icons li{
background:url("../images/interface/icons.png") no-repeat;
background:url("../../../images/interface/icons.png") no-repeat;
float:left;
height:19px;
text-indent:-999px;
@ -91,7 +91,7 @@ span.arrow{
height:6px;
margin:21px 0 0 5px;
position:absolute;
background:url('../images/interface/arrow.png') no-repeat;
background:url('../../../images/interface/arrow.png') no-repeat;
left:0;
}
@ -154,7 +154,7 @@ span.arrow{
#more{
width:83px;
height:24px;
background:url('../images/interface/more.png') no-repeat;
background:url('../../../images/interface/more.png') no-repeat;
cursor:pointer;
margin:40px auto;
}

View File

@ -1,6 +1,7 @@
<?php
class todo extends Module {
protected static $paramsList = array(
'visibility',
'x',
@ -8,29 +9,32 @@ class todo extends Module {
);
public $params = array();
private $persistance = 'db/todoist.xml';
const TODO_FILE = 'db/todoist.xml';
private $token;
private $project_name;
private $project_id;
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
echo '<link rel="stylesheet" type="text/css" href="css/todo.css">';
if($xmla = simplexml_load_file($this->persistance)){
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
if($xmla = simplexml_load_file($this->pathToModule.self::TODO_FILE)){
$this->setToken($xmla->token);
$this->setProjectName($xmla->name);
$this->setProjectId($xmla->id);
echo '<div id="todo" style="top:'.$params['y'].'; left :'.$params['x'].';">';
if($this->token == null || $this->project_id == null)
echo 'Impossible de trouver votre configuration. <a href="install-todoist.php">Cliquez ici</a> pour la mettre en place.</div>';
echo 'Impossible de trouver votre configuration. <a href="'.$this->pathToModule.'includes/install-todoist.php">Cliquez ici</a> pour la mettre en place.</div>';
else{
$token = $xmla->token;
$id = $xmla->id;
echo '</div><script type="text/javascript" src="js/getUncompletedTasks.php?token='.$token.'&id='.$id.'"></script>';
echo '</div><script type="text/javascript" src="'.$this->pathToModule.'js/getUncompletedTasks.php?token='.$token.'&id='.$id.'"></script>';
}
echo '<script>
$(document).ready(function(){
$(\'#todo\').resizable();
$(\'#todo\').resizable();
});</script>';
}else{
echo 'baaaaad persistance...';

View File

@ -6,12 +6,12 @@
#todo ul{list-style:none;}
#todo ul li{white-space : nowrap; padding-left:16px;}
#todo ul li div.puce{width: 16px; height: 16px; background:url(../images/interface/ui-icons_888888_256x240.png) -32px -48px no-repeat; display:inline-block;}
#todo ul li div.puce{width: 16px; height: 16px; background:url(../../../images/interface/ui-icons_888888_256x240.png) -32px -48px no-repeat; display:inline-block;}
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; background-position: -80px -224px;background-image: url(../images/interface/ui-icons_888888_256x240.png);}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; background-position: -80px -224px;background-image: url(../../../images/interface/ui-icons_888888_256x240.png);}
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }

View File

@ -1,5 +1,5 @@
<?
$xmla = simplexml_load_file('db/todoist.xml');
$xmla = simplexml_load_file('../db/todoist.xml');
if($xmla->token== '' || $xmla->token == null)
header('Location: install-todoist.php');
if($xmla->name == '' || $xmla->name == null):?>
@ -7,7 +7,7 @@ if($xmla->name == '' || $xmla->name == null):?>
<head> <style> .selectableProject{text-decoration:underline; color:blue; cursor:pointer;} </style>
<title>Todoist : getProjects</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/getProjectsList.php?token=<?=$xmla->token?>"></script>
<script type="text/javascript" src="../js/getProjectsList.php?token=<?=$xmla->token?>"></script>
</head>
<body>

View File

@ -0,0 +1,12 @@
<?
$xmla = simplexml_load_file('../db/todoist.xml');
if($xmla->token== '' || $xmla->token == null)
header('Location: ./');
if($xmla->id != '' || $xmla->id != null):
$token = $xmla->token;
$id = $xmla->id;?>
<script type="text/javascript" src="../js/getUncompletedTasks.php?token=<?=$token?>&id=<?=$id?>"></script>
<? else:
header('Location: getProjectsList.php');
endif;

View File

@ -1,11 +1,11 @@
<?
$xmla = simplexml_load_file('db/todoist.xml');
$xmla = simplexml_load_file('../db/todoist.xml');
if($xmla->token == '' || $xmla->token == null):?>
<html>
<head>
<title>Todoist : Login</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="../js/index.js"></script>
</head>
<body>

View File

@ -2,5 +2,5 @@
$token = $_GET['token'];
?>
function cbfunc(o){ $('body').append('<div id="results"><h2>Select your project</h2></div>'); $('#results').append('<ul id="uncompletedList"><ul>'); for(var i in o) { $('#uncompletedList').append('<li id="'+o[i].id+'" class="selectableProject">'+o[i].name+'</li>'); } }
$(document).ready(function(){ var token = "<?=$token?>"; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://todoist.com/API/getProjects?token='+token+'&format=json&callback=cbfunc'; document.getElementsByTagName('head')[0].appendChild(script); $('.selectableProject').live('click', function(){ var name = $(this).text(); var id = $(this).attr('id'); $.post('ajax/saveTodoist.php', {name: name, id: id}, function(msg){ $('body').append('<a href="index.php">Etape suivante</a>'); if(msg=="ok"){ location.reload(); }else{ alert(msg); } }); });
$(document).ready(function(){ var token = "<?=$token?>"; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://todoist.com/API/getProjects?token='+token+'&format=json&callback=cbfunc'; document.getElementsByTagName('head')[0].appendChild(script); $('.selectableProject').live('click', function(){ var name = $(this).text(); var id = $(this).attr('id'); $.post('../ajax/saveTodoist.php', {name: name, id: id}, function(msg){ $('body').append('<a href="index.php">Etape suivante</a>'); if(msg=="ok"){ location.reload(); }else{ alert(msg); } }); });
});

View File

@ -3,7 +3,7 @@ function cbfunc(o){
if(token == undefined){
$('#error').html('Identification erronnée');
}else{
$.post('ajax/saveTodoist.php', {token: token}, function(data){ $('body').append('<a href="getProjectsList.php">Etape suivante</a>'); if(data=="ok"){
$.post('../ajax/saveTodoist.php', {token: token}, function(data){ $('body').append('<a href="getProjectsList.php">Etape suivante</a>'); if(data=="ok"){
location.reload(); }else{ alert(data); }
});
}

0
modules/todo/js/todo.js Normal file
View File

View File

@ -1,7 +1,11 @@
<?php
class weather extends Module {
//TODO rajouter les params en détail
protected $moduleName;
protected $moduleTitle;
protected $pathToModule;
protected static $paramsList = array(
'visibility',
'city',
@ -12,11 +16,13 @@ class weather extends Module {
public $params = array();
public function __construct($params){
$this->moduleName = get_class();
$this->pathToModule = 'modules/'.$this->moduleName.'/';
$this->setParams($params);
$ville = $params['city'];
include 'GoogleMeteo.php';
echo '<script type="text/javascript" src="js/jquery.weather.js"></script>
<link rel="stylesheet" type="text/css" href="css/weather.css">';
include $this->pathToModule.'includes/GoogleMeteo.php';
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
echo '<div id="weather" style="left:'.$params['x'].'; top:'.$params['y'].';">
'.$city.'<br/>
<div class="weatherpic"></div>

View File

@ -18,19 +18,19 @@
}
if(strpos(strtolower($present_weather),"soleil") !== false) {?>
<link rel="stylesheet" type="text/css" href="css/soleil.css">
<link rel="stylesheet" type="text/css" href="modules/weather/css/soleil.css">
<?}
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
<link rel="stylesheet" type="text/css" href="css/nuage.css">
<link rel="stylesheet" type="text/css" href="modules/weather/css/nuage.css">
<?}
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
<link rel="stylesheet" type="text/css" href="css/peunuage.css">
<link rel="stylesheet" type="text/css" href="modules/weather/css/peunuage.css">
<?}
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
<link rel="stylesheet" type="text/css" href="css/pluie.css">
<link rel="stylesheet" type="text/css" href="modules/weather/css/pluie.css">
<?}
if(strpos(strtolower($present_weather),"neige") !== false) {?>
<link rel="stylesheet" type="text/css" href="css/neige.css">
<link rel="stylesheet" type="text/css" href="modules/weather/css/neige.css">
<?}
}else{ $present_weather = 'Ville non trouvé : '.$city; }
}else