X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Faction.php;h=fce59ba8a008f54583f400e7721ee4cbbc8d1c61;hb=4cdb3e64ccd98953dc4477aa2ca9f0bcab7fcec6;hp=54bea7c931d487d44491f81a35483d1f01351522;hpb=903053caec99da4443fa10f045f83239634b1a58;p=quix0rs-gnu-social.git diff --git a/lib/action.php b/lib/action.php index 54bea7c931..fce59ba8a0 100644 --- a/lib/action.php +++ b/lib/action.php @@ -267,9 +267,16 @@ class Action extends HTMLOutputter // lawsuit function primaryCssLink($mainTheme=null, $media=null) { + $theme = new Theme($mainTheme); + + // Some themes may have external stylesheets, such as using the + // Google Font APIs to load webfonts. + foreach ($theme->getExternals() as $url) { + $this->cssLink($url, $mainTheme, $media); + } + // If the currently-selected theme has dependencies on other themes, // we'll need to load their display.css files as well in order. - $theme = new Theme($mainTheme); $baseThemes = $theme->getDeps(); foreach ($baseThemes as $baseTheme) { $this->cssLink('css/display.css', $baseTheme, $media); @@ -286,16 +293,30 @@ class Action extends HTMLOutputter // lawsuit { if (Event::handle('StartShowScripts', array($this))) { if (Event::handle('StartShowJQueryScripts', array($this))) { - $this->script('jquery.min.js'); - $this->script('jquery.form.min.js'); - $this->script('jquery.cookie.min.js'); - $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.min.js').'"); }'); - $this->script('jquery.joverlay.min.js'); + if (common_config('site', 'minify')) { + $this->script('jquery.min.js'); + $this->script('jquery.form.min.js'); + $this->script('jquery.cookie.min.js'); + $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.min.js').'"); }'); + $this->script('jquery.joverlay.min.js'); + } else { + $this->script('jquery.js'); + $this->script('jquery.form.js'); + $this->script('jquery.cookie.js'); + $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.js').'"); }'); + $this->script('jquery.joverlay.js'); + } Event::handle('EndShowJQueryScripts', array($this)); } if (Event::handle('StartShowStatusNetScripts', array($this)) && Event::handle('StartShowLaconicaScripts', array($this))) { - $this->script('util.min.js'); + if (common_config('site', 'minify')) { + $this->script('util.min.js'); + } else { + $this->script('util.js'); + $this->script('xbImportNode.js'); + $this->script('geometa.js'); + } $this->showScriptMessages(); // Frame-busting code to avoid clickjacking attacks. $this->inlineScript('if (window.top !== window.self) { window.top.location.href = window.self.location.href; }'); @@ -324,6 +345,12 @@ class Action extends HTMLOutputter // lawsuit // TRANS: Localized tooltip for '...' expansion button on overlong remote messages. $messages['showmore_tooltip'] = _m('TOOLTIP', 'Show more'); + // TRANS: Inline reply form submit button: submits a reply comment. + $messages['reply_submit'] = _m('BUTTON', 'Reply'); + + // TRANS: Placeholder text for inline reply form. Clicking in this box will turn it into a mini notice form. + $messages['reply_placeholder'] = _m('Write a reply...'); + $messages = array_merge($messages, $this->getScriptMessages()); Event::handle('EndScriptMessages', array($this, &$messages)); @@ -464,14 +491,7 @@ class Action extends HTMLOutputter // lawsuit Event::handle('EndShowSiteNotice', array($this)); } - if (common_logged_in()) { - if (Event::handle('StartShowNoticeForm', array($this))) { - $this->showNoticeForm(); - Event::handle('EndShowNoticeForm', array($this)); - } - } else { - $this->showAnonymousMessage(); - } + $this->elementEnd('div'); } @@ -543,8 +563,10 @@ class Action extends HTMLOutputter // lawsuit */ function showPrimaryNav() { + $this->elementStart('div', array('id' => 'site_nav_global_primary')); $pn = new PrimaryNav($this); $pn->show(); + $this->elementEnd('div'); } /** @@ -573,8 +595,68 @@ class Action extends HTMLOutputter // lawsuit */ function showNoticeForm() { - $notice_form = new NoticeForm($this); - $notice_form->show(); + $tabs = array('status' => _('Status')); + + $this->elementStart('div', 'input_forms'); + + if (Event::handle('StartShowEntryForms', array(&$tabs))) { + + $this->elementStart('ul', array('class' => 'nav', + 'id' => 'input_form_nav')); + + foreach ($tabs as $tag => $title) { + + $attrs = array('id' => 'input_form_nav_'.$tag, + 'class' => 'input_form_nav_tab'); + + if ($tag == 'status') { + // We're actually showing the placeholder form, + // but we special-case the 'Status' tab as if + // it were a small version of it. + $attrs['class'] .= ' current'; + } + $this->elementStart('li', $attrs); + + $this->element('a', + array('href' => 'javascript:SN.U.switchInputFormTab("'.$tag.'")'), + $title); + $this->elementEnd('li'); + } + + $this->elementEnd('ul'); + + $attrs = array('class' => 'input_form current', + 'id' => 'input_form_placeholder'); + $this->elementStart('div', $attrs); + $form = new NoticePlaceholderForm($this); + $form->show(); + $this->elementEnd('div'); + + foreach ($tabs as $tag => $title) { + + $attrs = array('class' => 'input_form', + 'id' => 'input_form_'.$tag); + + $this->elementStart('div', $attrs); + + $form = null; + + if (Event::handle('StartMakeEntryForm', array($tag, $this, &$form))) { + if ($tag == 'status') { + $form = new NoticeForm($this); + } + Event::handle('EndMakeEntryForm', array($tag, $this, $form)); + } + + if (!empty($form)) { + $form->show(); + } + + $this->elementEnd('div'); + } + } + + $this->elementEnd('div'); } /** @@ -599,6 +681,9 @@ class Action extends HTMLOutputter // lawsuit function showCore() { $this->elementStart('div', array('id' => 'core')); + $this->elementStart('div', array('id' => 'aside_primary_wrapper')); + $this->elementStart('div', array('id' => 'content_wrapper')); + $this->elementStart('div', array('id' => 'site_nav_local_views_wrapper')); if (Event::handle('StartShowLocalNavBlock', array($this))) { $this->showLocalNavBlock(); Event::handle('EndShowLocalNavBlock', array($this)); @@ -612,6 +697,9 @@ class Action extends HTMLOutputter // lawsuit Event::handle('EndShowAside', array($this)); } $this->elementEnd('div'); + $this->elementEnd('div'); + $this->elementEnd('div'); + $this->elementEnd('div'); } /** @@ -637,7 +725,43 @@ class Action extends HTMLOutputter // lawsuit */ function showLocalNav() { - // does nothing by default + $nav = new DefaultLocalNav($this); + $nav->show(); + } + + /** + * Show menu for an object (group, profile) + * + * This block will only show if a subclass has overridden + * the showObjectNav() method. + * + * @return nothing + */ + function showObjectNavBlock() + { + $rmethod = new ReflectionMethod($this, 'showObjectNav'); + $dclass = $rmethod->getDeclaringClass()->getName(); + + if ($dclass != 'Action') { + // Need to have this ID for CSS; I'm too lazy to add it to + // all menus + $this->elementStart('div', array('id' => 'site_nav_object', + 'class' => 'section')); + $this->showObjectNav(); + $this->elementEnd('div'); + } + } + + /** + * Show object navigation. + * + * If there are things to do with this object, show it here. + * + * @return nothing + */ + function showObjectNav() + { + /* Nothing here. */ } /** @@ -648,6 +772,12 @@ class Action extends HTMLOutputter // lawsuit function showContentBlock() { $this->elementStart('div', array('id' => 'content')); + if (common_logged_in()) { + if (Event::handle('StartShowNoticeForm', array($this))) { + $this->showNoticeForm(); + Event::handle('EndShowNoticeForm', array($this)); + } + } if (Event::handle('StartShowPageTitle', array($this))) { $this->showPageTitle(); Event::handle('EndShowPageTitle', array($this)); @@ -729,6 +859,10 @@ class Action extends HTMLOutputter // lawsuit { $this->elementStart('div', array('id' => 'aside_primary', 'class' => 'aside')); + if (Event::handle('StartShowObjectNavBlock', array($this))) { + $this->showObjectNavBlock(); + Event::handle('EndShowObjectNavBlock', array($this)); + } if (Event::handle('StartShowSections', array($this))) { $this->showSections(); Event::handle('EndShowSections', array($this));