From 44b95cb81deae35f58e0058910afde2f2ffb9a60 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 13 Dec 2014 22:56:30 +0100 Subject: [PATCH 1/2] added reload function --- inc/poche/Poche.class.php | 11 ++++++++++- inc/poche/config.inc.default.php | 1 + themes/baggy/css/main.css | 3 +++ themes/baggy/view.twig | 1 + themes/default/css/style-default.css | 3 +++ themes/default/img/default/reload.png | Bin 0 -> 343 bytes themes/default/view.twig | 1 + 7 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 themes/default/img/default/reload.png diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 27d6f4a65..f5262a8e8 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -303,6 +303,15 @@ class Poche $this->messages->add('s', _('The tag has been successfully deleted')); Tools::redirect(); break; + case 'reload_article' : + Tools::logm('reload article'); + $id = $_GET['id']; + $entry = $this->store->retrieveOneById($id, $this->user->getId()); + Tools::logm('reload url ' . $entry['url']); + $url = new Url(base64_encode($entry['url'])); + $this->action('add', $url); + break; + default: break; } @@ -812,4 +821,4 @@ class Poche } -} \ No newline at end of file +} diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index 3eaee3a3e..0d249c64a 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php @@ -56,6 +56,7 @@ @define ('SHOW_PRINTLINK', '1'); // display or not percent of read in article view. Affects only default theme. @define ('SHOW_READPERCENT', '1'); +@define ('RELOAD_ARTICLE', TRUE); @define ('ABS_PATH', 'assets/'); @define ('DEFAULT_THEME', 'baggy'); diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index 1df829101..96b681bf0 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -736,6 +736,9 @@ a.add-to-wallabag-link-after:after { .icon-print:before { content: "\e80d"; } +.icon-reload:before { +/* TODO */ +} /* .icon-image class, for image-based icons diff --git a/themes/baggy/view.twig b/themes/baggy/view.twig index 9225d11b7..41766bf2e 100755 --- a/themes/baggy/view.twig +++ b/themes/baggy/view.twig @@ -20,6 +20,7 @@ {% if constant('CARROT') == 1 %}
  • Carrot
  • {% endif %} {% if constant('SHOW_PRINTLINK') == 1 %}
  • {% trans "Print" %}
  • {% endif %}
  • EPUB
  • + {% if constant('RELOAD_ARTICLE') == 1 %}
  • {% trans "Reload article" %}
  • {% endif %}
  • {% trans "Does this article appear wrong?" %}
  • diff --git a/themes/default/css/style-default.css b/themes/default/css/style-default.css index 4406d48f4..666c4a28c 100755 --- a/themes/default/css/style-default.css +++ b/themes/default/css/style-default.css @@ -67,3 +67,6 @@ a.bad-display span { a.print span { background-image: url('../img/default/print.png'); } +a.reload span { + background-image: url('../img/default/reload.png'); +} diff --git a/themes/default/img/default/reload.png b/themes/default/img/default/reload.png new file mode 100644 index 0000000000000000000000000000000000000000..4c0528e73aebb8ec66077c785488479d4c0f341e GIT binary patch literal 343 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_Gz7y~NYkmHi$Muc*9a!ZOuoK%pm|E{-7*eey!1`eQM|SIM z?zKnfYnb;=?N4>+Xl)V;6mVo!v}D z0@>;1BA;#?RVYlg>KfYR0#GOR6qg$t{O>DbGIjpGokOvPgfCSUT%KAoEVqPMwW2 zxpw ivP558(#)t#fBRFy(T7^h&q)CN%i!ti=d#Wzp$P!AXot}N literal 0 HcmV?d00001 diff --git a/themes/default/view.twig b/themes/default/view.twig index 181e12843..e14a165c3 100755 --- a/themes/default/view.twig +++ b/themes/default/view.twig @@ -19,6 +19,7 @@ {% if constant('CARROT') == 1 %}
  • {% trans "carrot" %}
  • {% endif %} {% if constant('SHOW_PRINTLINK') == 1 %}
  • {% trans "Print" %}
  • {% endif %}
  • EPUB
  • + {% if constant('RELOAD_ARTICLE') == 1 %}
  • {% trans "Reload article" %}
  • {% endif %}}
  • {% trans "Does this article appear wrong?" %}
  • {% if constant('SHOW_READPERCENT') == 1 %}
  • 0%
  • {% endif %} From 89637c2a1dcc114b17a8f7eef493b51315e1a6ac Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 1 Feb 2015 12:22:14 +0100 Subject: [PATCH 2/2] added reload icon and fixed a bug where random could redirect to deleted articles --- inc/poche/Poche.class.php | 7 +++++-- themes/baggy/css/main.css | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index fb74ab9a0..f99281458 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -349,8 +349,11 @@ class Poche /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */ case 'random': - $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); - $id = rand(1,$count); + $id = 0; + while ($this->store->retrieveOneById($id,$this->user->getId()) == null) { + $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); + $id = rand(1,$count); + } Tools::logm('get a random article'); Tools::redirect('?view=view&id=' . $id); //$this->displayView('view', $id); diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index 9356deda9..90d546fcd 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -737,7 +737,10 @@ a.add-to-wallabag-link-after:after { content: "\e80d"; } .icon-random:before { - content: "\e915"; + content: "\e915"; +} +.icon-reload:before { + content: "\ea2e"; }