1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-27 11:22:17 -05:00

utilisation de jquery pour traitement ajax

mise en page de la grille, type Masonry (méthode full css). cf ici : http://designshack.net/articles/css/masonry/
réorganisation des fichiers avec un fichier dédié pour le traitement des actions (process.php)
utilisation de pictos à la place des codes héxas
This commit is contained in:
nicosomb 2013-04-09 15:05:49 +02:00
parent 1ff2333600
commit e46efced1b
10 changed files with 96 additions and 0 deletions

BIN
img/archive-off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
img/archive-on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

BIN
img/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

BIN
img/fav-off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

BIN
img/fav-on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

16
inc/config.php Normal file
View File

@ -0,0 +1,16 @@
<?php
/**
* poche, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
define ('DB_PATH', 'sqlite:./db/poche.sqlite');
include 'db.php';
include 'functions.php';
require_once 'Readability.php';
require_once 'Encoding.php';
?>

21
inc/db.php Normal file
View File

@ -0,0 +1,21 @@
<?php
/**
* poche, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
class db {
var $handle;
function __construct($path) {
$this->handle = new PDO($path);
$this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
public function getHandle() {
return $this->handle;
}
}

5
js/jquery-1.9.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

16
js/poche.js Normal file
View File

@ -0,0 +1,16 @@
function toggle_favorite(element,id) {
$(element).toggleClass('fav-off');
$.ajax ({
url: "process.php?action=toggle_fav",
data:{id:id}
});
}
function toggle_archive(id) {
$('#entry-'+id).toggle();
$.ajax ({
url: "process.php?action=toggle_archive",
data:{id:id}
});
}

38
process.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/**
* poche, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
include dirname(__FILE__).'/inc/config.php';
$db = new db(DB_PATH);
$action = (isset ($_GET['action'])) ? htmlspecialchars($_GET['action']) : '';
$id = (isset ($_GET['id'])) ? htmlspecialchars($_GET['id']) : '';
switch ($action)
{
case 'toggle_fav' :
$sql_action = "UPDATE entries SET is_fav=~is_fav WHERE id=?";
$params_action = array($id);
break;
case 'toggle_archive' :
$sql_action = "UPDATE entries SET is_read=~is_read WHERE id=?";
$params_action = array($id);
break;
default:
break;
}
# action query
if (isset($sql_action))
{
$query = $db->getHandle()->prepare($sql_action);
$query->execute($params_action);
}
?>