feed untranslated appnames to nav_set_selected() and query for the active app directly to get app details

This commit is contained in:
Mario Vavti 2017-10-09 21:22:57 +02:00
parent 5698462588
commit cc1ffff7cd
23 changed files with 39 additions and 37 deletions

View file

@ -8,7 +8,7 @@ class Bookmarks extends \Zotlabs\Web\Controller {
if(! local_channel())
return;
nav_set_selected(t('View Bookmarks'));
nav_set_selected('View Bookmarks');
$item_id = intval($_REQUEST['item']);
$burl = trim($_REQUEST['burl']);

View file

@ -824,7 +824,7 @@ class Cdav extends \Zotlabs\Web\Controller {
}
if(argv(1) === 'calendar') {
nav_set_selected(t('CalDAV'));
nav_set_selected('CalDAV');
$caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);
$calendars = $caldavBackend->getCalendarsForUser($principalUri);
}
@ -1025,7 +1025,7 @@ class Cdav extends \Zotlabs\Web\Controller {
if(argv(1) === 'addressbook') {
nav_set_selected(t('CardDAV'));
nav_set_selected('CardDAV');
$carddavBackend = new \Sabre\CardDAV\Backend\PDO($pdo);
$addressbooks = $carddavBackend->getAddressBooksForUser($principalUri);
}

View file

@ -94,7 +94,7 @@ class Channel extends \Zotlabs\Web\Controller {
}
else {
if(\App::$profile['profile_uid'] == local_channel()) {
nav_set_selected(t('Channel Home'));
nav_set_selected('Channel Home');
}
}

View file

@ -91,7 +91,7 @@ class Chat extends \Zotlabs\Web\Controller {
if(local_channel()) {
$channel = \App::get_channel();
nav_set_selected(t('My Chatrooms'));
nav_set_selected('My Chatrooms');
}
$ob = \App::get_observer();

View file

@ -30,7 +30,7 @@ class Connections extends \Zotlabs\Web\Controller {
return login();
}
nav_set_selected(t('Connections'));
nav_set_selected('Connections');
$blocked = false;
$hidden = false;

View file

@ -77,7 +77,7 @@ class Directory extends \Zotlabs\Web\Controller {
$pubforums = get_directory_setting($observer, 'pubforums');
$o = '';
nav_set_selected(t('Directory'));
nav_set_selected('Directory');
if(x($_POST,'search'))
$search = notags(trim($_POST['search']));

View file

@ -272,7 +272,7 @@ class Events extends \Zotlabs\Web\Controller {
return;
}
nav_set_selected(t('Events'));
nav_set_selected('Events');
if((argc() > 2) && (argv(1) === 'ignore') && intval(argv(2))) {
$r = q("update event set dismissed = 1 where id = %d and uid = %d",

View file

@ -15,7 +15,7 @@ require_once('include/help.php');
class Help extends \Zotlabs\Web\Controller {
function get() {
nav_set_selected(t('Help'));
nav_set_selected('Help');
if($_REQUEST['search']) {
$o .= '<div id="help-content" class="generic-content-wrapper">';

View file

@ -95,7 +95,7 @@ class Invite extends \Zotlabs\Web\Controller {
return;
}
nav_set_selected(t('Invite'));
nav_set_selected('Invite');
$tpl = get_markup_template('invite.tpl');
$invonly = false;

View file

@ -5,7 +5,7 @@ namespace Zotlabs\Module;
class Lang extends \Zotlabs\Web\Controller {
function get() {
nav_set_selected(t('Language'));
nav_set_selected('Language');
return lang_selector();
}

View file

@ -140,7 +140,7 @@ class Mail extends \Zotlabs\Web\Controller {
function get() {
$o = '';
nav_set_selected(t('Mail'));
nav_set_selected('Mail');
if(! local_channel()) {
notice( t('Permission denied.') . EOL);

View file

@ -117,7 +117,7 @@ class Mood extends \Zotlabs\Web\Controller {
return;
}
nav_set_selected(t('Mood'));
nav_set_selected('Mood');
$parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0');

View file

@ -154,7 +154,7 @@ class Network extends \Zotlabs\Web\Controller {
));
}
nav_set_selected(t('Activity'));
nav_set_selected('Grid');
$channel_acl = array(
'allow_cid' => $channel['channel_allow_cid'],

View file

@ -555,7 +555,7 @@ class Photos extends \Zotlabs\Web\Controller {
$sql_extra = permissions_sql($owner_uid,get_observer_hash(),'photo');
$sql_attach = permissions_sql($owner_uid,get_observer_hash(),'attach');
nav_set_selected(t('Photos'));
nav_set_selected('Photos');
$o = "";

View file

@ -150,7 +150,7 @@ class Poke extends \Zotlabs\Web\Controller {
return;
}
nav_set_selected(t('Poke'));
nav_set_selected('Poke');
$name = '';
$id = '';

View file

@ -8,7 +8,7 @@ class Probe extends \Zotlabs\Web\Controller {
function get() {
nav_set_selected(t('Remote Diagnostics'));
nav_set_selected('Remote Diagnostics');
$o .= '<h3>Probe Diagnostic</h3>';

View file

@ -61,7 +61,7 @@ class Rpost extends \Zotlabs\Web\Controller {
return login();
}
nav_set_selected(t('Post'));
nav_set_selected('Post');
// If we have saved rpost session variables, but nothing in the current $_REQUEST, recover the saved variables

View file

@ -22,7 +22,7 @@ class Search extends \Zotlabs\Web\Controller {
if($load)
$_SESSION['loadtime'] = datetime_convert();
nav_set_selected(t('Search'));
nav_set_selected('Search');
require_once("include/bbcode.php");
require_once('include/security.php');

View file

@ -29,7 +29,7 @@ class Suggest extends \Zotlabs\Web\Controller {
return;
}
nav_set_selected(t('Suggest Channels'));
nav_set_selected('Suggest Channels');
$_SESSION['return_url'] = z_root() . '/' . \App::$cmd;

View file

@ -35,7 +35,7 @@ class Webpages extends \Zotlabs\Web\Controller {
return;
}
nav_set_selected(t('Webpages'));
nav_set_selected('Webpages');
$which = argv(1);

View file

@ -69,11 +69,6 @@ class Wiki extends \Zotlabs\Web\Controller {
goaway('/' . argv(0));
}
nav_set_selected([
'name' => t('Wiki'),
'url' =>'/wiki/' . $nick
]);
$observer_hash = get_observer_hash();
// Determine if the observer is the channel owner so the ACL dialog can be populated
@ -81,6 +76,8 @@ class Wiki extends \Zotlabs\Web\Controller {
$wiki_owner = true;
nav_set_selected('Wiki');
// Obtain the default permission settings of the channel
$owner_acl = array(
'allow_cid' => $owner['channel_allow_cid'],

View file

@ -244,7 +244,7 @@ class Browser extends DAV\Browser\Plugin {
$a = false;
nav_set_selected(t('Files'));
nav_set_selected('Files');
\App::$page['content'] = $html;
load_pdl();

View file

@ -233,6 +233,15 @@ EOT;
// turned off until somebody discovers this and figures out a good location for it.
$powered_by = '';
$active_app = q("SELECT app_url FROM app WHERE app_channel = %d AND app_name = '%s' LIMIT 1",
intval($channel['channel_id']),
dbesc(\App::$nav_sel['raw_name'])
);
if($active_app) {
$url = $active_app[0]['app_url'];
}
//app bin
if($is_owner) {
if(get_pconfig(local_channel(), 'system','initial_import_system_apps') === false) {
@ -297,7 +306,7 @@ EOT;
'$userinfo' => $x['usermenu'],
'$localuser' => local_channel(),
'$is_owner' => $is_owner,
'$sel' => App::$nav_sel,
'$sel' => App::$nav_sel,
'$powered_by' => $powered_by,
'$help' => t('@name, #tag, ?doc, content'),
'$pleasewait' => t('Please wait...'),
@ -309,8 +318,7 @@ EOT;
'$addapps' => t('Add Apps'),
'$orderapps' => t('Arrange Apps'),
'$sysapps_toggle' => t('Toggle System Apps'),
'$loc' => $myident,
'$url' => ((App::$nav_sel['url']) ? App::$nav_sel['url'] : App::$cmd)
'$url' => $url
));
if(x($_SESSION, 'reload_avatar') && $observer) {
@ -333,13 +341,10 @@ EOT;
*
*/
function nav_set_selected($item){
if(is_array($item)) {
App::$nav_sel['name'] = $item['name'];
App::$nav_sel['url'] = $item['url'];
}
else {
App::$nav_sel['name'] = $item;
}
App::$nav_sel['raw_name'] = $item;
$item = ['name' => $item];
Zlib\Apps::translate_system_apps($item);
App::$nav_sel['name'] = $item['name'];
}