X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FMobileProfile%2FMobileProfilePlugin.php;h=21eaa124e71178ae8d8e3669bb6dfe695c123837;hb=e36c9523383769313b11a67aa3859cb09b20ec52;hp=90ec8129dac1a7112983550826ae85fcea6fb488;hpb=5087a24c487891f4c5bc9fe2ff65be12fa74b930;p=quix0rs-gnu-social.git diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 90ec8129da..21eaa124e7 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -179,7 +179,7 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowStatusNetStyles($action) { - if (!$action->serveMobile) { + if (!$this->serveMobile) { return true; } @@ -214,15 +214,119 @@ class MobileProfilePlugin extends WAP20Plugin } $action->elementStart('div', array('id' => 'header')); - $action->showLogo(); - $action->showPrimaryNav(); - $action->showSiteNotice(); + $this->_showLogo($action); + $this->_showPrimaryNav($action); if (common_logged_in()) { $action->showNoticeForm(); - } else { - $action->showAnonymousMessage(); } $action->elementEnd('div'); + + return false; + } + + + function _showLogo($action) + { + $action->elementStart('address', 'vcard'); + $action->elementStart('a', array('class' => 'url home bookmark', + 'href' => common_local_url('public'))); + if (common_config('site', 'mobilelogo') || + file_exists(theme_file('logo.png')) || + file_exists(theme_file('mobilelogo.gif'))) { + + $action->element('img', array('class' => 'photo', + 'src' => (common_config('site', 'mobilelogo')) ? common_config('site', 'mobilelogo') : + ((file_exists(theme_file('mobilelogo.gif'))) ? (theme_path('mobilelogo.gif')): theme_path('logo.png')), + 'alt' => common_config('site', 'name'))); + } + $action->element('span', array('class' => 'fn org'), common_config('site', 'name')); + $action->elementEnd('a'); + $action->elementEnd('address'); + } + + + function _showPrimaryNav($action) { + $user = common_current_user(); + $connect = ''; + if (common_config('xmpp', 'enabled')) { + $connect = 'imsettings'; + } else if (common_config('sms', 'enabled')) { + $connect = 'smssettings'; + } else if (common_config('twitter', 'enabled')) { + $connect = 'twittersettings'; + } + + $action->elementStart('ul', array('id' => 'site_nav_global_primary')); + if ($user) { + $action->menuItem(common_local_url('all', array('nickname' => $user->nickname)), + _('Home')); + $action->menuItem(common_local_url('profilesettings'), + _('Account')); + if ($connect) { + $action->menuItem(common_local_url($connect), + _('Connect')); + } + if (common_config('invite', 'enabled')) { + $action->menuItem(common_local_url('invite'), + _('Invite')); + } + $action->menuItem(common_local_url('logout'), + _('Logout')); + } + else { + if (!common_config('site', 'closed')) { + $action->menuItem(common_local_url('register'), + _('Register')); + } + $action->menuItem(common_local_url('login'), + _('Login')); + } + $action->menuItem(common_local_url('doc', array('title' => 'help')), + _('Help')); + if ($user || !common_config('site', 'private')) { + $action->menuItem(common_local_url('peoplesearch'), + _('Search')); + } + $action->elementEnd('ul'); + } + + + function onStartShowNoticeFormData($form) + { + if (!$this->serveMobile) { + return true; + } + + $form->out->element('textarea', array('id' => 'notice_data-text', + 'cols' => 35, + 'rows' => 4, + 'name' => 'status_textarea'), + ($form->content) ? $form->content : ''); + + $contentLimit = Notice::maxContent(); + + $form->out->element('script', array('type' => 'text/javascript'), + 'maxLength = ' . $contentLimit . ';'); + + if ($contentLimit > 0) { + $form->out->element('div', array('id' => 'notice_text-count'), + $contentLimit); + } + + if (common_config('attachments', 'uploads')) { + $form->out->element('label', array('for' => 'notice_data-attach'),_('Attach')); + $form->out->element('input', array('id' => 'notice_data-attach', + 'type' => 'file', + 'name' => 'attach', + 'title' => _('Attach a file'))); + $form->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); + } + if ($form->action) { + $form->out->hidden('notice_return-to', $form->action, 'returnto'); + } + $form->out->hidden('notice_in-reply-to', $form->inreplyto, 'inreplyto'); + + return false; }