Merge branch 'aledeg-user-queries' into dev

This commit is contained in:
Marien Fressinaud committed 2014-06-14 09:05:46 +02:00
commit 5a98cc7532
16 files changed
+332 -31

No files matched your search

+76
View File
@@ -299,4 +299,80 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
$this->view->size_total = $entryDAO->size(true);
}
}
public function queriesAction () {
if (Minz_Request::isPost ()) {
$queries = Minz_Request::param('queries', array());
foreach ($queries as $key => $query) {
if (!$query['name']) {
$query['name'] = Minz_Translate::t('query_number', $key + 1);
}
}
$this->view->conf->_queries($queries);
$this->view->conf->save();
$notif = array (
'type' => 'good',
'content' => Minz_Translate::t ('configuration_updated')
);
Minz_Session::_param ('notification', $notif);
Minz_Request::forward (array ('c' => 'configure', 'a' => 'queries'), true);
} else {
$this->view->query_get = array();
foreach ($this->view->conf->queries as $key => $query) {
if (!isset($query['get'])) {
continue;
}
switch ($query['get'][0]) {
case 'c':
$dao = new FreshRSS_CategoryDAO();
$category = $dao->searchById(substr($query['get'], 2));
$this->view->query_get[$key] = array(
'type' => 'category',
'name' => $category->name(),
);
break;
case 'f':
$dao = new FreshRSS_FeedDAO();
$feed = $dao->searchById(substr($query['get'], 2));
$this->view->query_get[$key] = array(
'type' => 'feed',
'name' => $feed->name(),
);
break;
case 's':
$this->view->query_get[$key] = array(
'type' => 'favorite',
'name' => 'favorite',
);
break;
case 'a':
$this->view->query_get[$key] = array(
'type' => 'all',
'name' => 'all',
);
break;
}
}
}
Minz_View::prependTitle (Minz_Translate::t ('queries') . ' · ');
}
public function addQueryAction () {
$queries = $this->view->conf->queries;
$query = Minz_Request::params();
$query['name'] = Minz_Translate::t('query_number', count($queries) + 1);
unset($query['output']);
unset($query['token']);
$queries[] = $query;
$this->view->conf->_queries($queries);
$this->view->conf->save();
// Minz_Request::forward(array('params' => $query), true);
Minz_Request::forward(array('c' => 'configure', 'a' => 'queries'), true);
}
}
-3
View File
@@ -82,9 +82,6 @@ class FreshRSS_index_Controller extends Minz_ActionController {
$this->view->state = $state = Minz_Request::param ('state', $this->view->conf->default_view);
$state_param = Minz_Request::param ('state', null);
$filter = Minz_Request::param ('search', '');
if (!empty($filter)) {
$state = FreshRSS_Entry::STATE_ALL; //Search always in read and unread articles
}
$this->view->order = $order = Minz_Request::param ('order', $this->view->conf->sort_order);
$nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page);
$first = Minz_Request::param ('next', '');
+13
View File
@@ -53,6 +53,7 @@ class FreshRSS_Configuration {
'bottomline_date' => true,
'bottomline_link' => true,
'sharing' => array(),
'queries' => array(),
);
private $available_languages = array(
@@ -219,6 +220,18 @@ class FreshRSS_Configuration {
$this->data['sharing'][] = $value;
}
}
public function _queries ($values) {
$this->data['queries'] = array();
foreach ($values as $value) {
$value = array_filter($value);
$params = $value;
unset($params['name']);
unset($params['url']);
$value['url'] = Minz_Url::display(array('params' => $params));
$this->data['queries'][] = $value;
}
}
public function _theme($value) {
$this->data['theme'] = $value;
}
+1
View File
@@ -70,6 +70,7 @@ class FreshRSS_Themes extends Minz_Model {
'add' => '✚',
'all' => '☰',
'bookmark' => '★',
'bookmark-add' => '✚',
'category' => '☷',
'category-white' => '☷',
'close' => '❌',
+29
View File
@@ -15,6 +15,35 @@ return array (
'feed' => 'Feed',
'feeds' => 'Feeds',
'shortcuts' => 'Shortcuts',
'queries' => 'User queries',
'query_search' => 'Search for "%s"',
'query_order_asc' => 'Display oldest articles first',
'query_order_desc' => 'Display newest articles first',
'query_get_category' => 'Display "%s" category',
'query_get_feed' => 'Display "%s" feed',
'query_get_all' => 'Display all articles',
'query_get_favorite' => 'Display favorite articles',
'query_state_0' => 'Display all articles',
'query_state_1' => 'Display read articles',
'query_state_2' => 'Display unread articles',
'query_state_3' => 'Display all articles',
'query_state_4' => 'Display favorite articles',
'query_state_5' => 'Display read favorite articles',
'query_state_6' => 'Display unread favorite articles',
'query_state_7' => 'Display favorite articles',
'query_state_8' => 'Display not favorite articles',
'query_state_9' => 'Display read not favorite articles',
'query_state_10' => 'Display unread not favorite articles',
'query_state_11' => 'Display not favorite articles',
'query_state_12' => 'Display all articles',
'query_state_13' => 'Display read articles',
'query_state_14' => 'Display unread articles',
'query_state_15' => 'Display all articles',
'query_number' => 'Query n°%d',
'add_query' => 'Add a query',
'no_query' => 'You have not create user query yet.',
'query_filter' => 'Filter applied:',
'no_query_filter' => 'No filter',
'about' => 'About',
'stats' => 'Statistics',
+29
View File
@@ -15,6 +15,35 @@ return array (
'feed' => 'Flux',
'feeds' => 'Flux',
'shortcuts' => 'Raccourcis',
'queries' => 'Filtres utilisateurs',
'query_search' => 'Recherche de "%s"',
'query_order_asc' => 'Afficher les articles les plus anciens en premier',
'query_order_desc' => 'Afficher les articles les plus récents en premier',
'query_get_category' => 'Afficher la catégorie "%s"',
'query_get_feed' => 'Afficher le flux "%s"',
'query_get_all' => 'Afficher tous les articles',
'query_get_favorite' => 'Afficher les articles favoris',
'query_state_0' => 'Afficher tous les articles',
'query_state_1' => 'Afficher les articles lus',
'query_state_2' => 'Afficher les articles non lus',
'query_state_3' => 'Afficher tous les articles',
'query_state_4' => 'Afficher les articles favoris',
'query_state_5' => 'Afficher les articles lus et favoris',
'query_state_6' => 'Afficher les articles non lus et favoris',
'query_state_7' => 'Afficher les articles favoris',
'query_state_8' => 'Afficher les articles non favoris',
'query_state_9' => 'Afficher les articles lus et non favoris',
'query_state_10' => 'Afficher les articles non lus et non favoris',
'query_state_11' => 'Afficher les articles non favoris',
'query_state_12' => 'Afficher tous les articles',
'query_state_13' => 'Afficher les articles lus',
'query_state_14' => 'Afficher les articles non lus',
'query_state_15' => 'Afficher tous les articles',
'query_number' => 'Filtre n°%d',
'add_query' => 'Créer un filtre',
'no_query' => 'Vous n’avez pas encore créé de filtre.',
'query_filter' => 'Filtres appliqués :',
'no_query_filter' => 'Aucun filtre appliqué',
'about' => 'À propos',
'stats' => 'Statistiques',
+3
View File
@@ -15,6 +15,9 @@
<li class="item<?php echo Minz_Request::actionName () == 'shortcut' ? ' active' : ''; ?>">
<a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Minz_Translate::t ('shortcuts'); ?></a>
</li>
<li class="item<?php echo Minz_Request::actionName () == 'queries' ? ' active' : ''; ?>">
<a href="<?php echo _url ('configure', 'queries'); ?>"><?php echo Minz_Translate::t ('queries'); ?></a>
</li>
<li class="separator"></li>
<li class="item<?php echo Minz_Request::actionName () == 'users' ? ' active' : ''; ?>">
<a href="<?php echo _url ('configure', 'users'); ?>"><?php echo Minz_Translate::t ('users'); ?></a>
+1
View File
@@ -72,6 +72,7 @@ if (Minz_Configuration::canLogIn()) {
<li class="item"><a href="<?php echo _url ('configure', 'archiving'); ?>"><?php echo Minz_Translate::t ('archiving_configuration'); ?></a></li>
<li class="item"><a href="<?php echo _url ('configure', 'sharing'); ?>"><?php echo Minz_Translate::t ('sharing'); ?></a></li>
<li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Minz_Translate::t ('shortcuts'); ?></a></li>
<li class="item"><a href="<?php echo _url ('configure', 'queries'); ?>"><?php echo Minz_Translate::t ('queries'); ?></a></li>
<li class="separator"></li>
<li class="item"><a href="<?php echo _url ('configure', 'users'); ?>"><?php echo Minz_Translate::t ('users'); ?></a></li>
<li class="separator"></li>
+44 -11
View File
@@ -7,18 +7,20 @@
<?php } ?>
<?php if ($this->loginOk) { ?>
<?php $url_state = $this->url;
if ($this->state & FreshRSS_Entry::STATE_READ) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;
$checked = 'false';
$class = '';
}
?>
<div class="stick">
<?php
$url_state = $this->url;
if ($this->state & FreshRSS_Entry::STATE_READ) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-read"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
@@ -26,6 +28,7 @@
title="<?php echo Minz_Translate::t ('show_read'); ?>">
<?php echo FreshRSS_Themes::icon('read'); ?>
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_NOT_READ) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_READ;
@@ -44,6 +47,7 @@
title="<?php echo Minz_Translate::t ('show_not_reads'); ?>">
<?php echo FreshRSS_Themes::icon('unread'); ?>
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_FAVORITE) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_FAVORITE;
@@ -62,6 +66,7 @@
title="<?php echo Minz_Translate::t ('show_favorite'); ?>">
<?php echo FreshRSS_Themes::icon('starred'); ?>
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_FAVORITE;
@@ -80,6 +85,34 @@
title="<?php echo Minz_Translate::t ('show_not_favorite'); ?>">
<?php echo FreshRSS_Themes::icon('non-starred'); ?>
</a>
<div class="dropdown">
<div id="dropdown-query" class="dropdown-target"></div>
<a class="dropdown-toggle btn" href="#dropdown-query"><?php echo FreshRSS_Themes::icon('bookmark-add'); ?></a>
<ul class="dropdown-menu">
<li class="dropdown-close"><a href="#close">❌</a></li>
<li class="dropdown-header"><?php echo Minz_Translate::t('queries'); ?> <a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo FreshRSS_Themes::icon('configure'); ?></a></li>
<?php foreach ($this->conf->queries as $query) { ?>
<li class="item">
<a href="<?php echo $query['url']; ?>"><?php echo $query['name']; ?></a>
</li>
<?php } ?>
<?php if (count($this->conf->queries) > 0) { ?>
<li class="separator no-mobile"></li>
<?php } ?>
<?php
$url_query = $this->url;
$url_query['c'] = 'configure';
$url_query['a'] = 'addQuery';
?>
<li class="item no-mobile"><a href="<?php echo Minz_Url::display($url_query); ?>"><?php echo Minz_Translate::t('add_query'); ?></a></li>
</ul>
</div>
</div>
<?php
$get = false;
+90
View File
@@ -0,0 +1,90 @@
<?php $this->partial('aside_configure'); ?>
<div class="post">
<a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a>
<form method="post" action="<?php echo _url('configure', 'queries'); ?>">
<legend><?php echo Minz_Translate::t('queries'); ?></legend>
<?php foreach ($this->conf->queries as $key => $query) { ?>
<div class="form-group" id="query-group-<?php echo $key; ?>">
<label class="group-name" for="queries_<?php echo $key; ?>_name">
<?php echo Minz_Translate::t('query_number', $key + 1); ?>
</label>
<div class="group-controls">
<input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][search]" value="<?php echo isset($query['search']) ? $query['search'] : ""; ?>"/>
<input type="hidden" id="queries_<?php echo $key; ?>_state" name="queries[<?php echo $key; ?>][state]" value="<?php echo isset($query['state']) ? $query['state'] : ""; ?>"/>
<input type="hidden" id="queries_<?php echo $key; ?>_order" name="queries[<?php echo $key; ?>][order]" value="<?php echo isset($query['order']) ? $query['order'] : ""; ?>"/>
<input type="hidden" id="queries_<?php echo $key; ?>_get" name="queries[<?php echo $key; ?>][get]" value="<?php echo isset($query['get']) ? $query['get'] : ""; ?>"/>
<div class="stick">
<input class="extend"
type="text"
id="queries_<?php echo $key; ?>_name"
name="queries[<?php echo $key; ?>][name]"
value="<?php echo $query['name']; ?>"
/>
<a class="btn" href="<?php echo $query['url']; ?>">
<?php echo FreshRSS_Themes::icon('link'); ?>
</a>
<a class="btn btn-attention remove" href="#" data-remove="query-group-<?php echo $key; ?>">
<?php echo FreshRSS_Themes::icon('close'); ?>
</a>
</div>
<?php
$exist = (isset($query['search']) ? 1 : 0)
+ (isset($query['state']) ? 1 : 0)
+ (isset($query['order']) ? 1 : 0)
+ (isset($query['get']) ? 1 : 0);
// If the only filter is "all" articles, we consider there is no filter
$exist = ($exist === 1 && isset($query['get']) && $query['get'] === 'a') ? 0 : $exist;
?>
<?php if ($exist === 0) { ?>
<div class="alert alert-warn">
<div class="alert-head"><?php echo Minz_Translate::t('no_query_filter'); ?></div>
</div>
<?php } else { ?>
<div class="alert alert-success">
<div class="alert-head"><?php echo Minz_Translate::t('query_filter'); ?></div>
<ul>
<?php if (isset($query['search'])) { $exist = true; ?>
<li class="item"><?php echo Minz_Translate::t('query_search', $query['search']); ?></li>
<?php } ?>
<?php if (isset($query['state'])) { $exist = true; ?>
<li class="item"><?php echo Minz_Translate::t('query_state_' . $query['state']); ?></li>
<?php } ?>
<?php if (isset($query['order'])) { $exist = true; ?>
<li class="item"><?php echo Minz_Translate::t('query_order_' . strtolower($query['order'])); ?></li>
<?php } ?>
<?php if (isset($query['get'])) { $exist = true; ?>
<li class="item"><?php echo Minz_Translate::t('query_get_' . $this->query_get[$key]['type'], $this->query_get[$key]['name']); ?></li>
<?php } ?>
</ul>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
<?php if (count($this->conf->queries) > 0) { ?>
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
<button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
</div>
</div>
<?php } else { ?>
<p class="alert alert-warn"><span class="alert-head"><?php echo Minz_Translate::t ('damn'); ?></span> <?php echo Minz_Translate::t('no_query'); ?></p>
<?php } ?>
</form>
</div>
+7 -7
View File
@@ -4,35 +4,35 @@
<a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
<form method="post" action="<?php echo _url ('configure', 'sharing'); ?>"
data-simple='<div class="form-group"><label class="group-name">##label##</label><div class="group-controls"><a href="#" class="share remove btn btn-attention"><?php echo FreshRSS_Themes::icon('close'); ?></a>
data-simple='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls"><a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo FreshRSS_Themes::icon('close'); ?></a>
<input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" /></div></div>'
data-advanced='<div class="form-group"><label class="group-name">##label##</label><div class="group-controls">
data-advanced='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls">
<input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" />
<div class="stick">
<input type="text" id="share_##key##_name" name="share[##key##][name]" class="extend" value="" placeholder="<?php echo Minz_Translate::t ('share_name'); ?>" size="64" />
<input type="url" id="share_##key##_url" name="share[##key##][url]" class="extend" value="" placeholder="<?php echo Minz_Translate::t ('share_url'); ?>" size="64" />
<a href="#" class="share remove btn btn-attention"><?php echo FreshRSS_Themes::icon('close'); ?></a></div>
<a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo FreshRSS_Themes::icon('close'); ?></a></div>
<a target="_blank" class="btn" title="<?php echo Minz_Translate::t('more_information'); ?>" href="##help##"><?php echo FreshRSS_Themes::icon('help'); ?></a>
</div></div>'>
<legend><?php echo Minz_Translate::t ('sharing'); ?></legend>
<?php foreach ($this->conf->sharing as $key => $sharing): ?>
<?php $share = $this->conf->shares[$sharing['type']]; ?>
<div class="form-group">
<div class="form-group" id="group-share-<?php echo $key; ?>">
<label class="group-name">
<?php echo Minz_Translate::t ($sharing['type']); ?>
</label>
<div class="group-controls">
<input type='hidden' id='share_<?php echo $key;?>_type' name="share[<?php echo $key;?>][type]" value='<?php echo $sharing['type']?>' />
<?php if ($share['form'] === 'advanced'){ ?>
<?php if ($share['form'] === 'advanced') { ?>
<div class="stick">
<input type="text" id="share_<?php echo $key;?>_name" name="share[<?php echo $key;?>][name]" class="extend" value="<?php echo $sharing['name']?>" placeholder="<?php echo Minz_Translate::t ('share_name'); ?>" size="64" />
<input type="url" id="share_<?php echo $key;?>_url" name="share[<?php echo $key;?>][url]" class="extend" value="<?php echo $sharing['url']?>" placeholder="<?php echo Minz_Translate::t ('share_url'); ?>" size="64" />
<a href='#' class='share remove btn btn-attention'><?php echo FreshRSS_Themes::icon('close'); ?></a>
<a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo FreshRSS_Themes::icon('close'); ?></a>
</div>
<a target="_blank" class="btn" title="<?php echo Minz_Translate::t('more_information'); ?>" href="<?php echo $share['help']?>"><?php echo FreshRSS_Themes::icon('help'); ?></a>
<?php } else { ?>
<a href='#' class='share remove btn btn-attention'><?php echo FreshRSS_Themes::icon('close'); ?></a>
<a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo FreshRSS_Themes::icon('close'); ?></a>
<?php } ?>
</div>
</div>
+3 -2
View File
@@ -28,6 +28,9 @@ class Minz_Request {
return self::$params;
}
static function htmlspecialchars_utf8 ($p) {
if (is_array($p)) {
return array_map('self::htmlspecialchars_utf8', $p);
}
return htmlspecialchars($p, ENT_COMPAT, 'UTF-8');
}
public static function param ($key, $default = false, $specialchars = false) {
@@ -35,8 +38,6 @@ class Minz_Request {
$p = self::$params[$key];
if(is_object($p) || $specialchars) {
return $p;
} elseif(is_array($p)) {
return array_map('self::htmlspecialchars_utf8', $p);
} else {
return self::htmlspecialchars_utf8($p);
}
+14 -5
View File
@@ -975,11 +975,6 @@ function init_print_action() {
function init_share_observers() {
shares = $('.form-group:not(".form-actions")').length;
$('.post').on('click', '.share.remove', function(e) {
e.preventDefault();
$(this).parents('.form-group').remove();
});
$('.share.add').on('click', function(e) {
var opt = $(this).siblings('select').find(':selected');
var row = $(this).parents('form').data(opt.data('form'));
@@ -994,6 +989,19 @@ function init_share_observers() {
});
}
function init_remove_observers() {
$('.post').on('click', 'a.remove', function(e) {
var remove_what = $(this).attr('data-remove');
if (remove_what !== undefined) {
var remove_obj = $('#' + remove_what);
remove_obj.remove();
}
return false;
});
}
function init_feed_observers() {
$('select[id="category"]').on('change', function() {
var detail = $('#new_category_name').parent();
@@ -1054,6 +1062,7 @@ function init_all() {
window.setInterval(refreshUnreads, 120000);
} else {
init_share_observers();
init_remove_observers();
init_feed_observers();
init_password_observers();
}
+5 -1
View File
@@ -362,6 +362,10 @@ a.btn {
padding: 0 25px;
line-height: 2.5em;
}
.dropdown-menu > .item > span {
padding: 0 25px;
line-height: 2em;
}
.dropdown-menu > .item:hover {
background: #0062BE;
color: #fff;
@@ -400,7 +404,7 @@ a.btn {
font-size: 0.9em;
}
.alert-head {
font-size: 1.2em;
font-size: 1.15em;
}
.alert > a {
color: inherit;
+11 -2
View File
@@ -180,7 +180,8 @@ a.btn {
.dropdown-menu > .item {
display: block;
}
.dropdown-menu > .item > a {
.dropdown-menu > .item > a,
.dropdown-menu > .item > span {
display: block;
}
.dropdown-menu > .item[aria-checked="true"] > a:before {
@@ -220,10 +221,16 @@ a.btn {
display: block;
width: 90%;
}
.group-controls .alert {
width: 100%
}
.alert-head {
margin: 0;
font-weight: bold;
}
.alert ul {
margin: 5px 20px;
}
/*=== Icons */
.icon {
@@ -587,7 +594,9 @@ a.btn {
.aside .btn-important,
.aside .feeds .dropdown,
.flux_header .item.website span,
.item.date, .day .date {
.item.date, .day .date,
.dropdown-menu > .no-mobile,
.no-mobile {
display: none;
}
.nav-login {
+6
View File
@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">
<g transform="translate(-141.0002,-807)" fill="#bebebe">
<path d="m143,807,0,13,4-4,4,4,0-4,0-1-2,0,0-4,2,0,0-4z"/>
<path d="m152,810,0,2-2,0,0,2,2,0,0,2,2,0,0-2,2,0,0-2-2,0,0-2-2,0z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 261 B