From dce9a70ff59658249abeb58af46144eea16c721b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 3 Feb 2017 12:12:05 +0100 Subject: check for app-icons in app_list() instead of app_render() --- Zotlabs/Lib/Apps.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 595cf33ee..c8345e351 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -339,12 +339,9 @@ class Apps { } $install_action = (($installed) ? t('Update') : t('Install')); - $icon = ((strpos($papp['photo'],'icon:') === 0) ? substr($papp['photo'],5) : ''); - return replace_macros(get_markup_template('app.tpl'),array( '$app' => $papp, - '$icon' => $icon, '$hosturl' => $hosturl, '$purchase' => (($papp['page'] && (! $installed)) ? t('Purchase') : ''), '$install' => (($hosturl && $mode == 'view') ? $install_action : ''), @@ -512,8 +509,11 @@ class Apps { intval(TERM_OBJ_APP), intval($r[$x]['id']) ); + + $r[$x]['app_icon'] = ((strpos($r[$x]['app_photo'],'icon:') === 0) ? substr($r[$x]['app_photo'],5) : ''); } } + return($r); } @@ -719,6 +719,9 @@ class Apps { if($app['app_photo']) $ret['photo'] = $app['app_photo']; + if($app['app_icon']) + $ret['icon'] = $app['app_icon']; + if($app['app_version']) $ret['version'] = $app['app_version']; -- cgit v1.2.3 From cf4cdffcc1812f0a09a7990741c0e0351bc4b836 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Feb 2017 10:49:42 +0100 Subject: parse icons in get_system_apps() --- Zotlabs/Lib/Apps.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index c8345e351..455287fb8 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -26,6 +26,7 @@ class Apps { foreach($files as $f) { $x = self::parse_app_description($f,$translate); if($x) { + $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -39,6 +40,7 @@ class Apps { $x = self::parse_app_description($f,$translate); if($x) { $x['plugin'] = $plugin; + $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -501,6 +503,7 @@ class Apps { $r = q("select * from app where app_channel = %d $sql_extra order by app_name asc", intval($uid) ); + if($r) { for($x = 0; $x < count($r); $x ++) { if(! $r[$x]['app_system']) -- cgit v1.2.3 From 59baf34170d38f5aa9303d9001c9c0d23a0604ea Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Feb 2017 14:37:33 +0100 Subject: make sure we do not remove other categories on app un-feature --- Zotlabs/Lib/Apps.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 455287fb8..7c07f2974 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -450,13 +450,13 @@ class Apps { intval($uid) ); - $x = q("select * from term where otype = %d and oid = %d limit 1", + $x = q("select * from term where otype = %d and oid = %d and term = 'nav_featured_app' limit 1", intval(TERM_OBJ_APP), intval($r[0]['id']) ); if($x) { - q("delete from term where otype = %d and oid = %d", + q("delete from term where otype = %d and oid = %d and term = 'nav_featured_app'", intval(TERM_OBJ_APP), intval($x[0]['oid']) ); -- cgit v1.2.3 From 70edcabca1e9341b857c469760c88e5c9d318c53 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 6 Feb 2017 20:10:10 +0100 Subject: move icon stuff back to app_render() and send navapps through app_render() --- Zotlabs/Lib/Apps.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Lib/Apps.php') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 7c07f2974..e40c7ef0e 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -26,7 +26,6 @@ class Apps { foreach($files as $f) { $x = self::parse_app_description($f,$translate); if($x) { - $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -40,7 +39,6 @@ class Apps { $x = self::parse_app_description($f,$translate); if($x) { $x['plugin'] = $plugin; - $x['icon'] = ((strpos($x['photo'],'icon:') === 0) ? substr($x['photo'],5) : ''); $ret[] = $x; } } @@ -341,9 +339,11 @@ class Apps { } $install_action = (($installed) ? t('Update') : t('Install')); + $icon = ((strpos($papp['photo'],'icon:') === 0) ? substr($papp['photo'],5) : ''); return replace_macros(get_markup_template('app.tpl'),array( '$app' => $papp, + '$icon' => $icon, '$hosturl' => $hosturl, '$purchase' => (($papp['page'] && (! $installed)) ? t('Purchase') : ''), '$install' => (($hosturl && $mode == 'view') ? $install_action : ''), @@ -351,7 +351,8 @@ class Apps { '$delete' => ((local_channel() && $installed && $mode == 'edit') ? t('Delete') : ''), '$undelete' => ((local_channel() && $installed && $mode == 'edit') ? t('Undelete') : ''), '$deleted' => $papp['deleted'], - '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true) + '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), + '$navapps' => ((local_channel() && $installed && $mode == 'nav') ? true : false) )); } @@ -512,8 +513,6 @@ class Apps { intval(TERM_OBJ_APP), intval($r[$x]['id']) ); - - $r[$x]['app_icon'] = ((strpos($r[$x]['app_photo'],'icon:') === 0) ? substr($r[$x]['app_photo'],5) : ''); } } -- cgit v1.2.3