diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-03-09 19:15:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 19:15:47 +0100 |
commit | 9c5daad19c850d852f2e78ca571ad199362c0ffe (patch) | |
tree | 856bdcfe728cba86331a9d7c35d41d558d0fe00a | |
parent | 1e38df6606a1faf86f5f6b2e94b61dec250db622 (diff) | |
parent | e6cd773f5a8bd757c9362524cfeb3f7cb7fa81c9 (diff) | |
download | Shaarli-9c5daad19c850d852f2e78ca571ad199362c0ffe.tar.gz Shaarli-9c5daad19c850d852f2e78ca571ad199362c0ffe.tar.zst Shaarli-9c5daad19c850d852f2e78ca571ad199362c0ffe.zip |
Merge pull request #792 from ArthurHoaro/feature/private-filter-visual
Display private only filter as search criteria
-rw-r--r-- | application/config/ConfigPlugin.php | 17 | ||||
-rw-r--r-- | application/config/exception/PluginConfigOrderException.php | 17 | ||||
-rw-r--r-- | composer.json | 3 | ||||
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | tests/config/ConfigPluginTest.php | 6 | ||||
-rw-r--r-- | tpl/default/css/shaarli.css | 4 | ||||
-rw-r--r-- | tpl/default/linklist.html | 8 |
7 files changed, 36 insertions, 21 deletions
diff --git a/application/config/ConfigPlugin.php b/application/config/ConfigPlugin.php index 61a594d3..b3d9752b 100644 --- a/application/config/ConfigPlugin.php +++ b/application/config/ConfigPlugin.php | |||
@@ -1,5 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Config; | 2 | |
3 | use Shaarli\Config\Exception\PluginConfigOrderException; | ||
3 | 4 | ||
4 | /** | 5 | /** |
5 | * Plugin configuration helper functions. | 6 | * Plugin configuration helper functions. |
@@ -110,17 +111,3 @@ function load_plugin_parameter_values($plugins, $conf) | |||
110 | 111 | ||
111 | return $out; | 112 | return $out; |
112 | } | 113 | } |
113 | |||
114 | /** | ||
115 | * Exception used if an error occur while saving plugin configuration. | ||
116 | */ | ||
117 | class PluginConfigOrderException extends \Exception | ||
118 | { | ||
119 | /** | ||
120 | * Construct exception. | ||
121 | */ | ||
122 | public function __construct() | ||
123 | { | ||
124 | $this->message = 'An error occurred while trying to save plugins loading order.'; | ||
125 | } | ||
126 | } | ||
diff --git a/application/config/exception/PluginConfigOrderException.php b/application/config/exception/PluginConfigOrderException.php new file mode 100644 index 00000000..f9d68750 --- /dev/null +++ b/application/config/exception/PluginConfigOrderException.php | |||
@@ -0,0 +1,17 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Shaarli\Config\Exception; | ||
4 | |||
5 | /** | ||
6 | * Exception used if an error occur while saving plugin configuration. | ||
7 | */ | ||
8 | class PluginConfigOrderException extends \Exception | ||
9 | { | ||
10 | /** | ||
11 | * Construct exception. | ||
12 | */ | ||
13 | public function __construct() | ||
14 | { | ||
15 | $this->message = 'An error occurred while trying to save plugins loading order.'; | ||
16 | } | ||
17 | } | ||
diff --git a/composer.json b/composer.json index 70b87bb9..57851e53 100644 --- a/composer.json +++ b/composer.json | |||
@@ -29,7 +29,8 @@ | |||
29 | "Shaarli\\Api\\": "application/api/", | 29 | "Shaarli\\Api\\": "application/api/", |
30 | "Shaarli\\Api\\Controllers\\": "application/api/controllers", | 30 | "Shaarli\\Api\\Controllers\\": "application/api/controllers", |
31 | "Shaarli\\Api\\Exceptions\\": "application/api/exceptions", | 31 | "Shaarli\\Api\\Exceptions\\": "application/api/exceptions", |
32 | "Shaarli\\Config\\": "application/config/" | 32 | "Shaarli\\Config\\": "application/config/", |
33 | "Shaarli\\Config\\Exception\\": "application/config/exception" | ||
33 | } | 34 | } |
34 | } | 35 | } |
35 | } | 36 | } |
@@ -62,6 +62,7 @@ require_once __DIR__ . '/vendor/autoload.php'; | |||
62 | require_once 'application/ApplicationUtils.php'; | 62 | require_once 'application/ApplicationUtils.php'; |
63 | require_once 'application/Cache.php'; | 63 | require_once 'application/Cache.php'; |
64 | require_once 'application/CachedPage.php'; | 64 | require_once 'application/CachedPage.php'; |
65 | require_once 'application/config/ConfigPlugin.php'; | ||
65 | require_once 'application/FeedBuilder.php'; | 66 | require_once 'application/FeedBuilder.php'; |
66 | require_once 'application/FileUtils.php'; | 67 | require_once 'application/FileUtils.php'; |
67 | require_once 'application/HttpUtils.php'; | 68 | require_once 'application/HttpUtils.php'; |
@@ -1681,6 +1682,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1681 | 'result_count' => count($linksToDisplay), | 1682 | 'result_count' => count($linksToDisplay), |
1682 | 'search_term' => $searchterm, | 1683 | 'search_term' => $searchterm, |
1683 | 'search_tags' => $searchtags, | 1684 | 'search_tags' => $searchtags, |
1685 | 'visibility' => ! empty($_SESSION['privateonly']) ? 'private' : '', | ||
1684 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. | 1686 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. |
1685 | 'links' => $linkDisp, | 1687 | 'links' => $linkDisp, |
1686 | 'tags' => $LINKSDB->allTags(), | 1688 | 'tags' => $LINKSDB->allTags(), |
diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php index 22ab927b..deb02c9e 100644 --- a/tests/config/ConfigPluginTest.php +++ b/tests/config/ConfigPluginTest.php | |||
@@ -1,9 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Config; | 2 | namespace Shaarli\Config; |
3 | 3 | ||
4 | /** | 4 | use Shaarli\Config\Exception\PluginConfigOrderException; |
5 | * Config' tests | ||
6 | */ | ||
7 | 5 | ||
8 | require_once 'application/config/ConfigPlugin.php'; | 6 | require_once 'application/config/ConfigPlugin.php'; |
9 | 7 | ||
@@ -41,7 +39,7 @@ class ConfigPluginTest extends \PHPUnit_Framework_TestCase | |||
41 | /** | 39 | /** |
42 | * Test save_plugin_config with invalid data. | 40 | * Test save_plugin_config with invalid data. |
43 | * | 41 | * |
44 | * @expectedException Shaarli\Config\PluginConfigOrderException | 42 | * @expectedException Shaarli\Config\Exception\PluginConfigOrderException |
45 | */ | 43 | */ |
46 | public function testSavePluginConfigInvalid() | 44 | public function testSavePluginConfigInvalid() |
47 | { | 45 | { |
diff --git a/tpl/default/css/shaarli.css b/tpl/default/css/shaarli.css index b937c596..d33e9066 100644 --- a/tpl/default/css/shaarli.css +++ b/tpl/default/css/shaarli.css | |||
@@ -985,6 +985,10 @@ div.awesomplete > ul { | |||
985 | margin: 0 0 0 5px; | 985 | margin: 0 0 0 5px; |
986 | } | 986 | } |
987 | 987 | ||
988 | .search-result .label-private { | ||
989 | border: 1px solid white; | ||
990 | } | ||
991 | |||
988 | /** | 992 | /** |
989 | * TOOLS | 993 | * TOOLS |
990 | */ | 994 | */ |
diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index 9bc3ba1a..94370203 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html | |||
@@ -89,7 +89,7 @@ | |||
89 | <div id="searchcriteria">{'Nothing found.'|t}</div> | 89 | <div id="searchcriteria">{'Nothing found.'|t}</div> |
90 | </div> | 90 | </div> |
91 | </div> | 91 | </div> |
92 | {elseif="!empty($search_term) or !empty($search_tags)"} | 92 | {elseif="!empty($search_term) or !empty($search_tags) or !empty($visibility)"} |
93 | <div class="pure-g pure-alert pure-alert-success search-result"> | 93 | <div class="pure-g pure-alert pure-alert-success search-result"> |
94 | <div class="pure-u-2-24"></div> | 94 | <div class="pure-u-2-24"></div> |
95 | <div class="pure-u-20-24"> | 95 | <div class="pure-u-20-24"> |
@@ -106,6 +106,12 @@ | |||
106 | </span> | 106 | </span> |
107 | {/loop} | 107 | {/loop} |
108 | {/if} | 108 | {/if} |
109 | {if="!empty($visibility)"} | ||
110 | {'with status'|t} | ||
111 | <span class="label label-private"> | ||
112 | {$visibility|t} | ||
113 | </span> | ||
114 | {/if} | ||
109 | </div> | 115 | </div> |
110 | </div> | 116 | </div> |
111 | {/if} | 117 | {/if} |