protected function show() { global $kgBase; $kgBase->setHeadTitle('Home'); $kgBase->setLayout('header', array('titleText' => 'Welcome', 'captionHtml' => 'Some text here')); $kgBase->addOut('<div class="container">'); $kgBase->addOut(kfAlertHtml('info', '<strong>Welcome!</strong> Hello there.')); $kgBase->addOut('Hello world'); // kfCacheKey( 'example', .. ) // Close container $kgBase->addOut('</div>'); }
protected function show() { global $kgBase; $kgBase->setHeadTitle('Home'); $kgBase->setLayout('header', array('titleText' => 'Wiki Tour', 'captionHtml' => 'Manage a tour that passes by all Wikimedia wikis.')); $kgBase->addOut('<div class="container">'); $kgBase->addOut(kfAlertHtml('info', '<strong>Welcome!</strong> Hello there.')); // TODO: Fetch filter from wiki page config $filter = array('private' => false); $wikis = $this->getWikis($filter); $table = '<table class="table table-striped table-hover" x-data-toggle="table"><thead><tr>' . '<th>Wiki</th>' . '<th data-sortable=1>Identifier</th>' . '<th data-sortable=1>Project</th>'; $labels = array(); foreach (self::$labels as $label) { if (!(isset($filter[$label]) && $filter[$label] === false)) { $labels[] = $label; $table .= Html::element('th', array('data-sortable' => true), ucfirst($label)); } } $table .= '<th data-sortable=1>Status</th>'; $table .= '</tr></thead><tbody>'; $stati = array(false, 'done', 'progress'); foreach ($wikis as $dbname => $wiki) { // TODO: Fetch status from wiki page $status = $stati[array_rand($stati)]; $table .= '<tr>' . Html::rawElement('td', array(), Html::element('a', array('href' => $wiki['url']), $wiki['servername'])) . Html::element('td', array(), $dbname) . Html::element('td', array(), $wiki['project']); foreach ($labels as $label) { $table .= Html::element('td', array(), $wiki[$label] ? ucfirst($label) : ''); } $table .= Html::rawElement('td', array('class' => $this->getStatusClass($status)), $this->getStatusField($status) . ' ' . htmlspecialchars($this->getStatusLabel($status))); $table .= '</tr>'; } $table .= '</tbody></table>'; $kgBase->addOut($table); // Close container $kgBase->addOut('</div>'); }
public function flushMainOutput($mode = KR_OUTPUT_BROWSER_HTML5) { global $kgConf, $kgReq; switch ($mode) { case KR_OUTPUT_BROWSER_HTML5: // Stylesheets $resourcesHead = ''; if (is_array($this->styles)) { foreach ($this->styles as $style) { $resourcesHead .= '<link rel="stylesheet" href="' . htmlspecialchars($style) . '"/>' . "\n"; } } if (is_array($this->scriptsHead)) { foreach ($this->scriptsHead as $script) { $resourcesHead .= '<script src="' . htmlspecialchars($script) . '"></script>' . "\n"; } } $this->addHeadOut($resourcesHead); // window.KRINKLE $this->addHeadOut('<script>' . 'document.documentElement.className = document.documentElement.className.replace(/\\bnojs\\b/,\'js\');' . 'window.KRINKLE = ' . json_encode(array('baseTool' => array('basePath' => $this->remoteBasePath, 'req' => array('wasPosted' => $kgReq->wasPosted())))) . ';</script>'); $documentClassses = array('client-nojs'); $contentLanguageCode = !is_null($kgConf->I18N) ? $kgConf->I18N->getLang() : 'en-US'; $contentLanguageDir = !is_null($kgConf->I18N) ? $kgConf->I18N->getDir() : 'ltr'; // Scripts $resourcesBody = ''; if (is_array($this->scripts)) { foreach ($this->scripts as $script) { $resourcesBody .= '<script defer src="' . htmlspecialchars($script) . '"></script>' . "\n"; } } if ($this->requireJS) { $documentClassses[] = 'client-requirejs'; $resourcesBody .= '<div class="requirejs-msg">' . kfAlertHtml('warning', 'This tool requires JavaScript and/or modern browser features that are not supported by your browser.') . '</div>'; } $this->addOut($resourcesBody); $innerHTML = "<head>\n" . '<meta charset="utf-8">' . "\n<title>" . $this->headTitle . "</title>\n" . trim($this->mainOutput['head']) . "\n</head>\n" . "<body>\n" . $this->getPageTop() . $this->getPageHeader() . trim($this->mainOutput['body']) . $this->getPageFooter() . "\n</body>"; header('Content-Type: text/html; charset=utf-8'); echo '<!DOCTYPE html>' . Html::openElement('html', array('dir' => $contentLanguageDir, 'lang' => $contentLanguageCode, 'class' => $documentClassses)) . $innerHTML . '</html>'; break; default: echo $this->mainOutput['body']; } return true; }
*/ if (!$snapshotInfo) { $pageHtml .= kfAlertHtml('danger', $I18N->msg('err-snapshotindex')); /** * Output (show update log) * ------------------------------------------------- */ } elseif ($kgReq->getVal('action') === 'updatelog') { $kgBaseTool->setHeadTitle($I18N->msg('title-updatelog')); $kgBaseTool->setLayout('header', array('titleText' => $I18N->msg('title-updatelog'))); $pageHtml .= Html::element('p', array('class' => 'lead'), $I18N->msg('updatelog-intro')); if (!$kgTool->getUpdateLogFilePath()) { // Error: No update log $pageHtml .= kfAlertHtml('danger', $I18N->msg('err-noupdatelog')); } else { $notice = $kgTool->isUpdateLogActive() ? kfAlertHtml('warning', $I18N->msg('updatelog-active')) : ''; $pageHtml .= $notice . Html::element('pre', array(), $kgTool->getUpdateLogContent()) . $notice; } /** * Output (get snapshot) * ------------------------------------------------- */ } elseif ($kgReq->wasPosted() && $kgReq->getVal('action') === 'getSnapshot') { $title = $I18N->msg('title-downloadpage'); $kgBaseTool->setHeadTitle($title); $kgBaseTool->setLayout('header', array('titleText' => $title)); $repoName = $kgReq->getVal('repo'); $branchName = $kgReq->getVal('branch'); $isAjax = $kgReq->getBool('ajax'); $downloadUrl = null; if (!isset($repoInfos[$repoName]) || !isset($snapshotInfo[$repoName])) {