<?php if (empty($modulesUpdate)) { return ""; } $listModulesUpdatable = array(); $listMessenger = array(); foreach ($modulesUpdate as $module) { $desc = explode("\n", $module->description); $desc = trim(array_shift($desc)); $label = $desc ? '<acronym title="' . $desc . '">' . $module->title . '</acronym>' : $module->title; $label = '<span class="module">' . $label . '</span>'; $attributes = array('href' => './admin/module/viewer/index/' . $module->id); $link = UI_HTML_Tag::create('a', $module->title, $attributes); $versions = '<span class="muted" style="float: right">' . $module->versionInstalled . ' ⇒ ' . $module->versionAvailable . '</span>'; $listMessenger[] = $link; $listModulesUpdatable[$module->title] = UI_HTML_Tag::create('li', $link . ' ' . $versions); } ksort($listModulesUpdatable); if ($listMessenger) { $view->env->getMessenger()->noteNotice('Aktualisierung verfügbar für: ' . join(", ", $listMessenger)); } $panel = ' <fieldset style="position: relative"> <legend class="info">Module aktualisierbar <span class="small">(' . count($listModulesUpdatable) . ')</span></legend> <div style="max-height: 160px; overflow: auto"> <ul>' . join($listModulesUpdatable) . '</ul> </div> </fieldset>'; $env->clock->profiler->tick('Template: index/index - updates'); return $panel;
case 'integer': case 'int': case 'float': $value = '<span style="font-family: monospace; font-size: 1.2em;">' . $value . '</span>'; break; default: $value = strlen(trim($value)) ? htmlentities($value) : '∅'; } $list[$item->key] = '<dt>' . $item->key . '</dt><dd>' . $value . '</dd>'; } natcasesort($list); if ($list) { $url = './admin/module/editor/index/' . $module->id; $button = UI_HTML_Elements::LinkButton($url, '', 'button tiny edit'); $button = UI_HTML_Tag::create('div', $button, array('style' => "position: absolute; right: 3px; top: 1px;")); $list = UI_HTML_Tag::create('dl', $list, array('class' => 'index-config')); $url = './admin/module/viewer/index/' . $module->id; $link = UI_HTML_Tag::create('a', $module->title, array('href' => $url, 'class' => 'module')); $heading = UI_HTML_Tag::create('h4', $link, array('class' => 'index-config-module')); $listModules[] = $heading . $list; } } $panel = ' <fieldset> <legend class="info">Konfiguration</legend> <div style="max-height: 320px; overflow: auto;"> ' . join($listModules) . ' </div> </fieldset>'; $env->clock->profiler->tick('Template: index/index - config'); return empty($listModules) ? "" : $panel;
protected function render($iconClasses, $darkMode = FALSe) { $list = array(); foreach ($iconClasses as $item) { $icon = UI_HTML_Tag::create('i', '', array('class' => 'fa fa-2x fa-' . $item . ($darkMode ? ' fa-inverse' : ''), 'title' => $item)); $list[] = UI_HTML_Tag::create('li', $icon, array('class' => 'icon-container', 'id' => 'icon-' . $item)); } $list = UI_HTML_Tag::create('ul', $list, array('id' => 'icon-matrix', 'class' => 'unstyled')); $style = ' body.dark { background-color: rgba(0,0,0,1); color: rgba(255,255,255,0.75); } #icon-matrix .icon-container { float: left; width: 48px; height: 48px; vertical-align: middle; text-align: center; margin: 3px; } .fa-2x { line-height: 2em; } .fa-4x { line-height: 1em; } '; $script = ' $(document).ready(function(){ $(".icon-container").bind("mouseenter", function(){ $(this).children("i").addClass("fa-4x"); }).bind("mouseleave", function(){ $(this).children("i").removeClass("fa-4x"); }).bind("click", function(){ var query = $(this).children("i").prop("title"); $(this).trigger("mouseleave"); $("#search").val(query).trigger("keyup"); }); $("#search").bind("keyup", function(){ var query = $(this).val(); $(".icon-container i").each(function(){ var matching = $(this).prop("title").match(query); matching ? $(this).parent().show() : $(this).parent().hide(); }); }).focus(); });'; $body = ' <div class="container"> <h2>Font Awesome <span class="muted">Index</span></h2> <div class="row-fluid"> <div class="span12"> <input type="search" id="search" placeholder="search"></input> </div> </div> <div class="row-fluid"> <div class="span12"> ' . $list . ' </div> </div> </div>'; $page = new UI_HTML_PageFrame(); $page->addStylesheet('/lib/cmStyles/bootstrap.min.css'); $page->addStylesheet('font-awesome.min.css'); $page->addJavaScript('/lib/cmScripts/jquery/1.10.2.min.js'); $page->addJavaScript('/lib/cmScripts/bootstrap.min.js'); $page->addHead(UI_HTML_Tag::create('style', $style)); $page->addHead(UI_HTML_Tag::create('script', $script)); $page->addBody($body); print $page->build(array('class' => $darkMode ? 'dark' : 'bright')); }
public function index( $arg1 = NULL, $arg2 = NULL, $arg3 = NULL, $arg4 = NULL, $arg5 = NULL ){ if( $this->env->getRequest()->has( 'resetInstanceId' ) ){ $this->env->getSession()->remove( 'instanceId' ); $this->restart( NULL ); } $logicInstance = Logic_Instance::getInstance( $this->env ); $modelInstance = new Model_Instance( $this->env ); $instances = $modelInstance->getAll(); foreach( $instances as $instanceId => $instance ){ $instance->modules = $logicInstance->listModules( $instanceId ); } $instanceId = $this->env->getSession()->get( 'instanceId' ); $this->addData( 'instances', $instances ); $this->addData( 'instanceId', $instanceId ); if( $instanceId ){ $remote = $this->env->getRemote(); $logicModule = Logic_Module::getInstance( $this->env ); $this->env->clock->profiler->tick( 'Index::index: init' ); $listModulesMissing = array(); $listModulesPossible = array(); $listModulesUpdate = array(); $modulesInstalled = array(); $modulesAll = $logicModule->model->getAll(); $this->env->clock->profiler->tick( 'Index::index: get all' ); if( $remote instanceof CMF_Hydrogen_Environment_Remote ){ $modulesInstalled = $remote->getModules()->getAll(); $this->env->clock->profiler->tick( 'Index::index: get installed' ); foreach( $modulesInstalled as $module ){ foreach( $module->relations->needs as $need ) if( !array_key_exists( $need, $modulesInstalled ) ) $listModulesMissing[] = $need; foreach( $module->relations->supports as $support ) if( !array_key_exists( $support, $modulesInstalled ) ) $listModulesPossible[] = $support; } $this->env->clock->profiler->tick( 'Index::index: get more' ); foreach( $modulesInstalled as $module ) if( $module->versionInstalled && $module->versionAvailable ) if( version_compare( $module->versionAvailable, $module->versionInstalled ) > 0 ) $listModulesUpdate[] = $module; foreach( $listModulesMissing as $module ){ $url = './admin/module/installer/index/'.$module; $link = UI_HTML_Tag::create( 'a', $module, array( 'href' => $url ) ); $span = UI_HTML_Tag::create( 'span', $link, array( 'class' => 'icon module module-status-4' ) ); $this->env->getMessenger()->noteFailure( 'Modul '.$span.' ist nicht vollständig installiert.' ); } $this->addData( 'remote', $remote ); $this->addData( 'remoteConfig', $remote->getConfig() ); } $this->addData( 'instance', $modelInstance->get( $instanceId ) ); $this->addData( 'modulesAll', $modulesAll ); $this->addData( 'modulesInstalled', $modulesInstalled ); $this->addData( 'modulesMissing', $listModulesMissing ); $this->addData( 'modulesPossible', $listModulesPossible ); $this->addData( 'modulesUpdate', $listModulesUpdate ); } $this->env->clock->profiler->tick( 'Index::index: done' ); }
$nrUpdates += $count; $badge = '<span class="badge badge-update" title="' . $count . ' Update(s)">' . $count . '</span>'; } else { $badge = ''; } } $url = './admin/instance/select/' . $id; $attributes = array('href' => $url, 'class' => 'instance', 'data-instance-id' => $id); $link = UI_HTML_Tag::create('a', $entry->title, $attributes) . $badge; $attributes = array('class' => join(' ', $class), 'data-url' => $entry->protocol . $entry->host . $entry->path); $item = UI_HTML_Tag::create('li', $link, $attributes); $list[$entry->title] = $item; } ksort($list); $list = UI_HTML_Tag::create('ul', $list, array('class' => 'instances')); $badgeNrUpdates = $nrUpdates ? UI_HTML_Tag::create('span', $nrUpdates, array('class' => 'badge badge-update')) : ''; $panel = ' <style> .badge{ display: inline-block; float: right; min-width: 6px; height: 18px; padding: 0 6px; margin: 0; margin-left: 0.5em; background-color: #777; border-radius: 9px; line-height: 1.6em; text-align: center; font-size: 0.9em;
$name .= ' <span class="small">v' . $remoteConfig->get('app.version') . '</span>'; } if (strlen($remoteConfig->get('app.revision'))) { $name .= ' <span class="small">rev' . $remoteConfig->get('app.version') . '</span>'; } if ($instance->host === "localhost") { $instance->host = $env->host; if ($env->port && $env->port != 80) { $instance->host .= ":" . $env->port; } } //$instance->host = $instance->host === "localhost" ? $env->host : $instance->host; $instanceUrl = $instance->protocol . $instance->host . $instance->path; $instanceBase = $remoteConfig->get('app.base.url') ? $remoteConfig->get('app.base.url') : ""; $linkInstanceUrl = UI_HTML_Tag::create('a', $instanceUrl, array('href' => $instanceUrl)); $linkInstanceBase = $instanceBase ? UI_HTML_Tag::create('a', $instanceBase, array('href' => $instanceBase)) : "<em>autodetect</em>"; $panel = ' <fieldset style="position: relative"> <legend class="info">Application Instance Information</legend> <div style="position: absolute; right: 8px; top: 16px;"> ' . UI_HTML_Elements::LinkButton('./admin/instance/edit/' . $instanceId, '', 'button tiny edit') . ' </div> <dl> <dt>Application Name</dt> <dd>' . $name . '</cite></dd> <dt>Application Instance URL <small class="muted"><em>(defined by Hydra Instance)</em></small></dt> <dd>' . $linkInstanceUrl . '</dd> <dt>Application Base URL <small class="muted"><em>(defined by application configuration)</em></small></dt> <dd>' . $linkInstanceBase . '</dd> <dt>Path to Application Instance</dt> <dd><a href="file://' . $remote->path . '" target="_blank">' . $remote->path . '</a></dd>