aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/Apps.php37
-rw-r--r--Zotlabs/Module/Bookmarks.php7
-rw-r--r--app/bookmarks.apd3
-rw-r--r--view/tpl/app.tpl2
-rw-r--r--view/tpl/app_install.tpl12
5 files changed, 54 insertions, 7 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 30c108cc1..d7d225e9a 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -575,6 +575,30 @@ class Apps {
));
}
+
+ /**
+ * @brief Render a simple app install button with app name and description.
+ *
+ * @param string $app app name
+ * @return string
+ */
+ static public function app_render_install($app) {
+
+ $papp = self::get_papp($app);
+
+ if (!$papp) {
+ return EMPTY_STR;
+ }
+
+ $papp_encoded = self::papp_encode($papp);
+
+ return replace_macros(get_markup_template('app_install.tpl'), [
+ '$papp' => $papp,
+ '$papp_encoded' => $papp_encoded,
+ '$install' => t('Install')
+ ]);
+ }
+
static public function app_install($uid,$app) {
if(! is_array($app)) {
@@ -1357,4 +1381,17 @@ class Apps {
return chunk_split(base64_encode(json_encode($papp)),72,"\n");
}
+ static public function get_papp($app) {
+
+ $r = q("select * from app where app_id = '%s' and app_channel = 0 limit 1",
+ dbesc(hash('whirlpool', $app))
+ );
+
+ if ($r) {
+ $papp = self::app_encode($r[0]);
+ return $papp;
+ }
+
+ return false;
+ }
}
diff --git a/Zotlabs/Module/Bookmarks.php b/Zotlabs/Module/Bookmarks.php
index 000e2893f..ea34754da 100644
--- a/Zotlabs/Module/Bookmarks.php
+++ b/Zotlabs/Module/Bookmarks.php
@@ -74,10 +74,7 @@ class Bookmarks extends \Zotlabs\Web\Controller {
if(! Apps::system_app_installed(local_channel(), 'Bookmarks')) {
//Do not display any associated widgets at this point
App::$pdl = '';
-
- $o = '<b>' . t('Bookmarks App') . ' (' . t('Not Installed') . '):</b><br>';
- $o .= t('Bookmark links from posts and manage them');
- return $o;
+ return Apps::app_render_install('Bookmarks');
}
require_once('include/menu.php');
@@ -89,7 +86,7 @@ class Bookmarks extends \Zotlabs\Web\Controller {
$o .= '<div class="generic-content-wrapper-styled">';
- $o .= '<h3>' . t('My Bookmarks') . '</h3>';
+ $o .= '<h3>' . t('Bookmarks') . '</h3>';
$x = menu_list(local_channel(),'',MENU_BOOKMARK);
diff --git a/app/bookmarks.apd b/app/bookmarks.apd
index fc1b68d50..a12650498 100644
--- a/app/bookmarks.apd
+++ b/app/bookmarks.apd
@@ -1,6 +1,7 @@
-version: 2
+version: 3
url: $baseurl/bookmarks
requires: local_channel
name: Bookmarks
photo: icon:bookmark
categories: Productivity
+desc: This app enables you to bookmark links from posts or comments and provides a simple management interface
diff --git a/view/tpl/app.tpl b/view/tpl/app.tpl
index 5809a3edb..69af0436b 100644
--- a/view/tpl/app.tpl
+++ b/view/tpl/app.tpl
@@ -12,7 +12,7 @@
<div class="app-tools">
<form action="{{$hosturl}}appman" method="post">
<input type="hidden" name="papp" value="{{$app.papp}}" />
- {{if $action_label}}<button type="submit" name="install" value="{{$action_label}}" class="btn btn-outline-{{if $installed}}secondary{{else}}success{{/if}} btn-sm" title="{{$action_label}}" ><i class="fa fa-fw {{if $installed}}fa-refresh{{else}}fa-arrow-circle-o-down{{/if}}" ></i> {{$action_label}}</button>{{/if}}
+ {{if $action_label}}<button type="submit" name="install" value="{{$action_label}}" class="btn btn-{{if $installed}}outline-secondary{{else}}success{{/if}} btn-sm" title="{{$action_label}}" ><i class="fa fa-fw {{if $installed}}fa-refresh{{else}}fa-arrow-circle-o-down{{/if}}" ></i> {{$action_label}}</button>{{/if}}
{{if $edit}}<input type="hidden" name="appid" value="{{$app.guid}}" /><button type="submit" name="edit" value="{{$edit}}" class="btn btn-outline-secondary btn-sm" title="{{$edit}}" ><i class="fa fa-fw fa-pencil" ></i></button>{{/if}}
{{if $delete}}<button type="submit" name="delete" value="{{if $deleted}}{{$undelete}}{{else}}{{$delete}}{{/if}}" class="btn btn-outline-secondary btn-sm" title="{{if $deleted}}{{$undelete}}{{else}}{{$delete}}{{/if}}" ><i class="fa fa-fw fa-trash-o drop-icons"></i></button>{{/if}}
{{if $settings_url}}<a href="{{$settings_url}}/?f=&rpath={{$rpath}}" class="btn btn-outline-secondary btn-sm"><i class="fa fa-fw fa-cog"></i></a>{{/if}}
diff --git a/view/tpl/app_install.tpl b/view/tpl/app_install.tpl
new file mode 100644
index 000000000..fa2a02eb5
--- /dev/null
+++ b/view/tpl/app_install.tpl
@@ -0,0 +1,12 @@
+<div>
+ <h2>{{$papp.name}}</h2>
+</div>
+<div class="mb-3">
+ {{$papp.desc}}
+</div>
+<form action="appman" method="post">
+ <input type="hidden" name="papp" value="{{$papp_encoded}}" />
+ <button type="submit" name="install" value="install" class="btn btn-success">
+ <i class="fa fa-fw fa-arrow-circle-o-down"></i> {{$install}}
+ </button>
+</form>