aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-09-19 15:00:06 +0200
committerMario Vavti <mario@mariovavti.com>2018-09-19 15:00:06 +0200
commit34fec995f711b03bc19580ee9e57c22712cf51df (patch)
tree0d28e4d30aad2de5a9db6e4b9713986849d6fe14
parentec7cbe272af07d184f8ecd5d2285bb8f31d2d9a4 (diff)
downloadvolse-hubzilla-34fec995f711b03bc19580ee9e57c22712cf51df.tar.gz
volse-hubzilla-34fec995f711b03bc19580ee9e57c22712cf51df.tar.bz2
volse-hubzilla-34fec995f711b03bc19580ee9e57c22712cf51df.zip
allow a second url in apd files for settings, hide pin and star buttons in edit mode and use strpos() instead of strstr() in some places
-rw-r--r--Zotlabs/Lib/Apps.php30
-rw-r--r--app/grid.apd4
-rw-r--r--view/tpl/app.tpl1
3 files changed, 22 insertions, 13 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index aa7e2282d..905a20ee0 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -388,9 +388,7 @@ class Apps {
// This will catch somebody clicking on a system "available" app that hasn't had the path macros replaced
// and they are allowed to see the app
-
-
- if(strstr($papp['url'],'$baseurl') || strstr($papp['url'],'$nick') || strstr($papp['photo'],'$baseurl') || strstr($pap['photo'],'$nick')) {
+ if(strpos($papp['url'],'$baseurl') || strpos($papp['url'],'$nick') || strpos($papp['photo'],'$baseurl') || strpos($papp['photo'],'$nick')) {
$view_channel = local_channel();
if(! $view_channel) {
$sys = get_sys_channel();
@@ -399,7 +397,13 @@ class Apps {
self::app_macros($view_channel,$papp);
}
- if(! strstr($papp['url'],'://'))
+ if(strpos($papp['url'], ',')) {
+ $urls = explode(',', $papp['url']);
+ $papp['url'] = trim($urls[0]);
+ $papp['settings_url'] = trim($urls[1]);
+ }
+
+ if(! strpos($papp['url'],'://'))
$papp['url'] = z_root() . ((strpos($papp['url'],'/') === 0) ? '' : '/') . $papp['url'];
@@ -468,7 +472,9 @@ class Apps {
$hosturl = '';
if(local_channel()) {
- $installed = self::app_installed(local_channel(),$papp);
+ if(self::app_installed(local_channel(),$papp) && !$papp['deleted'])
+ $installed = true;
+
$hosturl = z_root() . '/';
}
elseif(remote_channel()) {
@@ -495,6 +501,7 @@ class Apps {
if($mode === 'install') {
$papp['embed'] = true;
}
+
return replace_macros(get_markup_template('app.tpl'),array(
'$app' => $papp,
'$icon' => $icon,
@@ -503,11 +510,12 @@ class Apps {
'$installed' => $installed,
'$action_label' => (($hosturl && in_array($mode, ['view','install'])) ? $install_action : ''),
'$edit' => ((local_channel() && $installed && $mode == 'edit') ? t('Edit') : ''),
- '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''),
- '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''),
+ '$delete' => ((local_channel() && $mode == 'edit') ? t('Delete') : ''),
+ '$undelete' => ((local_channel() && $mode == 'edit') ? t('Undelete') : ''),
+ '$settings_url' => ((local_channel() && $installed && $mode == 'list') ? $papp['settings_url'] : ''),
'$deleted' => $papp['deleted'],
- '$feature' => (($papp['embed']) ? false : true),
- '$pin' => (($papp['embed']) ? false : true),
+ '$feature' => (($papp['embed'] || $mode == 'edit') ? false : true),
+ '$pin' => (($papp['embed'] || $mode == 'edit') ? false : true),
'$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true),
'$pinned' => ((strpos($papp['categories'], 'nav_pinned_app') === false) ? false : true),
'$navapps' => (($mode == 'nav') ? true : false),
@@ -912,7 +920,7 @@ class Apps {
$arr['author'] = $sys['channel_hash'];
}
- if($arr['photo'] && (strpos($arr['photo'],'icon:') === false) && (! strstr($arr['photo'],z_root()))) {
+ if($arr['photo'] && (strpos($arr['photo'],'icon:') === false) && (! strpos($arr['photo'],z_root()))) {
$x = import_xchan_photo(str_replace('$baseurl',z_root(),$arr['photo']),get_observer_hash(),true);
$arr['photo'] = $x[1];
}
@@ -998,7 +1006,7 @@ class Apps {
if((! $darray['app_url']) || (! $darray['app_id']))
return $ret;
- if($arr['photo'] && (strpos($arr['photo'],'icon:') === false) && (! strstr($arr['photo'],z_root()))) {
+ if($arr['photo'] && (strpos($arr['photo'],'icon:') === false) && (! strpos($arr['photo'],z_root()))) {
$x = import_xchan_photo(str_replace('$baseurl',z_root(),$arr['photo']),get_observer_hash(),true);
$arr['photo'] = $x[1];
}
diff --git a/app/grid.apd b/app/grid.apd
index c826974a4..026b3c349 100644
--- a/app/grid.apd
+++ b/app/grid.apd
@@ -1,5 +1,5 @@
-version: 1
-url: $baseurl/network
+version: 1.1
+url: $baseurl/network, $baseurl/settings/network
requires: local_channel
name: Grid
photo: icon:th
diff --git a/view/tpl/app.tpl b/view/tpl/app.tpl
index 3245a86e0..042f48704 100644
--- a/view/tpl/app.tpl
+++ b/view/tpl/app.tpl
@@ -20,6 +20,7 @@
{{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 $feature}}<button type="submit" name="feature" value="nav_featured_app" class="btn btn-outline-secondary btn-sm" title="{{if $featured}}{{$remove}}{{else}}{{$add}}{{/if}}"><i class="fa fa-fw fa-star{{if $featured}} text-warning{{/if}}"></i></button>{{/if}}
{{if $pin}}<button type="submit" name="pin" value="nav_pinned_app" class="btn btn-outline-secondary btn-sm" title="{{if $pinned}}{{$remove_nav}}{{else}}{{$add_nav}}{{/if}}"><i class="fa fa-fw fa-thumb-tack{{if $pinned}} text-success{{/if}}"></i></button>{{/if}}
+ {{if $settings_url}}<a href="{{$settings_url}}" class="btn btn-outline-secondary btn-sm"><i class="fa fa-fw fa-cog"></i></a>{{/if}}
</form>
</div>
{{/if}}