aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-05 14:17:02 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-12-05 14:17:02 +0100
commit9fc60317eecba785b66011f04b9a5150296f2df6 (patch)
tree992516f332a1fde1dc0c25da670c3df0fadef07b /app
parenta2da70fd119cc43438f8dd88de54a7d19fafbe1a (diff)
First draft for listing and manipulate extensions
See https://github.com/FreshRSS/FreshRSS/issues/252
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/extensionController.php43
-rw-r--r--app/layout/aside_configure.phtml4
-rw-r--r--app/layout/header.phtml1
-rw-r--r--app/views/extension/index.phtml35
4 files changed, 83 insertions, 0 deletions
diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php
new file mode 100644
index 000000000..504be56d3
--- /dev/null
+++ b/app/Controllers/extensionController.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * The controller to manage extensions.
+ */
+class FreshRSS_extension_Controller extends Minz_ActionController {
+ /**
+ * This action is called before every other action in that class. It is
+ * the common boiler plate for every action. It is triggered by the
+ * underlying framework.
+ */
+ public function firstAction() {
+ if (!FreshRSS_Auth::hasAccess()) {
+ Minz_Error::error(403);
+ }
+ }
+
+ /**
+ * This action lists all the extensions available to the current user.
+ */
+ public function indexAction() {
+ Minz_View::prependTitle(_t('admin.extensions.title') . ' ยท ');
+ $this->view->extension_list = Minz_ExtensionManager::list_extensions();
+ }
+
+ public function configureAction() {
+ if (Minz_Request::param('ajax')) {
+ $this->view->_useLayout(false);
+ }
+ }
+
+ public function enableAction() {
+
+ }
+
+ public function disableAction() {
+
+ }
+
+ public function removeAction() {
+
+ }
+}
diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml
index 53c52d3e3..f7f3617c4 100644
--- a/app/layout/aside_configure.phtml
+++ b/app/layout/aside_configure.phtml
@@ -22,6 +22,10 @@
Minz_Request::actionName() === 'profile'? ' active' : ''; ?>">
<a href="<?php echo _url('user', 'profile'); ?>"><?php echo _t('gen.menu.user_profile'); ?></a>
</li>
+ <li class="item<?php echo Minz_Request::controllerName() === 'extension' &&
+ Minz_Request::actionName() === 'index'? ' active' : ''; ?>">
+ <a href="<?php echo _url('extension', 'index'); ?>"><?php echo _t('gen.menu.extensions'); ?></a>
+ </li>
<?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
<li class="nav-header"><?php echo _t('gen.menu.admin'); ?></li>
<li class="item<?php echo Minz_Request::controllerName() === 'user' &&
diff --git a/app/layout/header.phtml b/app/layout/header.phtml
index c73d9cdbb..0ff367d0b 100644
--- a/app/layout/header.phtml
+++ b/app/layout/header.phtml
@@ -63,6 +63,7 @@ if (Minz_Configuration::canLogIn()) {
<li class="item"><a href="<?php echo _url('configure', 'shortcut'); ?>"><?php echo _t('shortcuts'); ?></a></li>
<li class="item"><a href="<?php echo _url('configure', 'queries'); ?>"><?php echo _t('queries'); ?></a></li>
<li class="item"><a href="<?php echo _url('user', 'profile'); ?>"><?php echo _t('gen.menu.user_profile'); ?></a></li>
+ <li class="item"><a href="<?php echo _url('extension', 'index'); ?>"><?php echo _t('gen.menu.extensions'); ?></a></li>
<?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
<li class="separator"></li>
<li class="dropdown-header"><?php echo _t('gen.menu.admin'); ?></li>
diff --git a/app/views/extension/index.phtml b/app/views/extension/index.phtml
new file mode 100644
index 000000000..c6b7c84a1
--- /dev/null
+++ b/app/views/extension/index.phtml
@@ -0,0 +1,35 @@
+<?php $this->partial('aside_configure'); ?>
+
+<div class="post">
+ <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.back_to_rss_feeds'); ?></a>
+
+ <h1><?php echo _t('admin.extensions.title'); ?></h1>
+
+ <?php if (!empty($this->extension_list)) { ?>
+ <form id="form-extension" method="post" style="display: none"></form>
+ <?php foreach ($this->extension_list as $ext) { ?>
+ <ul class="horizontal-list">
+ <li class="item">
+ <?php $name_encoded = urlencode($ext->getName()); ?>
+ <div class="stick">
+ <a class="btn open-slider" href="<?php echo _url('extension', 'configure', 'e', $name_encoded); ?>"><?php echo _i('configure'); ?> <?php echo _t('admin.extensions.manage'); ?></a>
+ <?php if ($ext->is_enabled()) { ?>
+ <button class="btn" form="form-extension" formaction="<?php echo _url('extension', 'disable', 'e', $name_encoded); ?>"><?php echo _t('admin.extensions.disable'); ?></button>
+ <?php } else { ?>
+ <button class="btn" form="form-extension" formaction="<?php echo _url('extension', 'enable', 'e', $name_encoded); ?>"><?php echo _t('admin.extensions.enable'); ?></button>
+ <?php } ?>
+ <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
+ <button class="btn btn-attention confirm" form="form-extension" formaction="<?php echo _url('extension', 'remove', 'e', $name_encoded); ?>"><?php echo _t('admin.extensions.remove'); ?></button>
+ <?php } ?>
+ </div>
+ </li>
+ <li class="item"><?php echo $ext->getName(); ?></li>
+ </ul>
+ <?php } ?>
+ <?php } else { ?>
+ <p class="alert alert-warn"><?php echo _t('admin.extensions.empty_list'); ?></p>
+ <?php } ?>
+</div>
+
+<a href="#" id="close-slider"></a>
+<div id="slider"></div>