tra('Application Frame'), 'description' => tra('Create a frame in which to assemble custom applications'), 'prefs' => ['wikiplugin_appframe'], 'format' => 'html', 'documentation' => 'PluginAppFrame', 'iconname' => 'merge', 'filter' => 'wikicontent', 'introduced' => 9, 'body' => tr('Application layout'), 'params' => [ 'min' => [ 'required' => false, 'name' => tr('Minimum height'), 'description' => tr('Prevent the frame from becoming any shorter than the specified size.'), 'default' => 300, 'filter' => 'int', 'since' => '9.0', ], 'max' => [ 'required' => false, 'name' => tr('Maximum height'), 'description' => tr('Prevent the frame from becoming any higher than the specified size.'), 'default' => -1, 'filter' => 'int', 'since' => '10.0', ], 'hideleft' => [ 'requred' => false, 'name' => tr('Hide left column'), 'description' => tr('Hide the left column when the application frame is in use to provide more space to the application.'), 'default' => 'n', 'since' => '9.0', 'options' => [ ['value' => 'n', 'text' => tr('No')], ['value' => 'y', 'text' => tr('Yes')], ], ], 'hideright' => [ 'requred' => false, 'name' => tr('Hide right column'), 'description' => tr('Hide the right column when the application frame is in use to provide more space to the application.'), 'default' => 'n', 'since' => '9.0', 'options' => [ ['value' => 'n', 'text' => tr('No')], ['value' => 'y', 'text' => tr('Yes')], ], ], 'fullpage' => [ 'required' => false, 'name' => tr('Full page'), 'description' => tr('Completely fill the content area of the page.'), 'default' => 'n', 'since' => '9.0', 'options' => [ ['value' => 'n', 'text' => tr('No')], ['value' => 'y', 'text' => tr('Yes')], ], ], 'absolute' => [ 'required' => false, 'name' => tr('Absolute Position'), 'description' => tr('Use all available space for the application frame (by means of CSS absolute positioning).'), 'default' => 'n', 'since' => '9.0', 'options' => [ ['value' => 'n', 'text' => tr('No')], ['value' => 'y', 'text' => tr('Yes')], ], ], 'top' => [ 'required' => false, 'name' => tr('Top'), 'description' => tr('When using absolute mode, leave some space for the header at the top.'), 'default' => 0, 'filter' => 'int', 'since' => '9.0', ], 'fullscreen' => [ 'required' => false, 'name' => tr('Full screen'), 'description' => tr('Fill the complete page.'), 'default' => 'n', 'since' => '10.0', 'options' => [ ['value' => 'n', 'text' => tr('No')], ['value' => 'y', 'text' => tr('Yes')], ], ], ], ]; } function wikiplugin_appframe($data, $params) { $minHeight = isset($params['min']) ? (int) $params['min'] : 300; $maxHeight = isset($params['max']) ? (int) $params['max'] : -1; $fullPage = 0; if (isset($params['fullpage']) && $params['fullpage'] == 'y') { $fullPage = 1; } $fullscreen = 0; if (isset($params['fullscreen']) && $params['fullscreen'] == 'y') { $fullscreen = 1; } $absolute = (int)(isset($params['absolute']) ? $params['absolute'] == 'y' : false); $top = isset($params['top']) ? $params['top'] : 0; $headerlib = TikiLib::lib('header'); if (isset($params['hideleft']) && $params['hideleft'] == 'y') { $headerlib->add_js('$("body").addClass("hide_zone_left");'); } if (isset($params['hideright']) && $params['hideright'] == 'y') { $headerlib->add_js('$("body").addClass("hide_zone_right");'); } $headerlib->add_js( << max)) { target = max; } appframe.height(target); } $('#appframe .tab').each(function () { $(this).data('available-height', $('#appframe').height() - $(this).position().top).addClass('height-size'); }); $('#appframe .anchor-container') .css('z-index', 1000) .css('position', 'absolute') .css('top', 150) .css('right', 0) ; }); $('#appframe .tab').parent().each(function () { var tabs = $(this).children('.tab').wrapAll('
'); var list = $('
TAB; } function wikiplugin_appframe_column($data, $params, $start) { $width = $params->width->int() . '%'; return <<$data COLUMN; } function wikiplugin_appframe_page($data, $params, $start) { $tikilib = TikiLib::lib('tiki'); $info = $tikilib->get_page_info($params->name->pagename()); if (! $info) { return null; } $perms = Perms::get('wiki page', $info['pageName']); if (! $perms->view) { return null; } $keys = []; $replacements = []; foreach ($params as $key => $value) { $keys[] = "{{{$key}}}"; $replacements[] = $value; } $info['data'] = str_replace($keys, $replacements, $info['data']); return "~/np~{$info['data']}~np~"; } function wikiplugin_appframe_module($data, $params, $start) { $modlib = TikiLib::lib('mod'); $moduleName = $params->name->word(); $label = $params->label->text(); if (! $label) { $info = $modlib->get_module_info($moduleName); if (! $info) { return null; } $label = $info['name']; } $data = $modlib->execute_module( [ 'name' => $moduleName, 'params' => array_merge($params->none(), ['nobox' => 'y', 'notitle' => 'y']), ] ); if (! $data) { return null; } $class = null; if ($params->accordion->int()) { $class = ' class="accordion"'; } return <<{$label} $data MODULE; } function wikiplugin_appframe_cond($data, $params, $start) { if (isset($params['notempty']) && $params->notempty->text()) { return $data; } if (isset($params['empty']) && ! $params->{'empty'}->text()) { return $data; } return ' '; } function wikiplugin_appframe_overlay($data, $params, $start) { $position = []; foreach (['top', 'bottom', 'left', 'right'] as $pos) { if (isset($params[$pos])) { $value = $params->$pos->int(); $position[] = "$pos: {$value}px;"; } } $position = implode(' ', $position); return << $data OVERLAY; } function wikiplugin_appframe_hidden($data, $params, $start) { return << $data OVERLAY; } function wikiplugin_appframe_template($data, $params, $start) { $smarty = TikiLib::lib('smarty'); $file = $params->file->url(); try { $data = array_map( function ($value) { return preg_replace('/\{\{\w+\}\}/', '', $value); }, $params->text() ); $smarty->assign('input', $data); return $smarty->fetch($file); } catch (SmartyException $e) { return tr('Template file not found: %0', $file); } } function wikiplugin_appframe_mapcontrol($data, $params, $start) { global $prefs; $ol2 = $prefs['geo_openlayers_version'] === 'ol2'; static $counter = 0; $function = null; $control = null; $label = null; $mode = null; switch ($name = $params->type->word()) { case 'pan_zoom': $label = tr('Pan/Zoom'); $mode = tr('Default'); break; case 'mode_enable': $mode = $params->mode->text(); $label = $mode; if (! $mode) { return false; } break; case 'select_feature': $control = $ol2 ? 'new OpenLayers.Control.SelectFeature(vlayer)' : ''; $label = tr('Select'); break; case 'modify_feature': $control = $ol2 ? 'new OpenLayers.Control.ModifyFeature(vlayer, { mode: OpenLayers.Control.ModifyFeature.DRAG | OpenLayers.Control.ModifyFeature.RESHAPE, standalone: true, virtualStyle: drawStyle, vertexRenderIntent: "vertex" }), new OpenLayers.Control.SelectFeature(vlayer)' : ''; $label = tr('Select/Modify'); break; case 'draw_polygon': $control = $ol2 ? 'new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Polygon, {handlerOptions:{style:drawStyle}})' : ''; $label = tr('Draw Polygon'); break; case 'draw_path': $control = $ol2 ? 'new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path, {handlerOptions:{style:drawStyle}})' : ''; $label = tr('Draw Path'); break; case 'reset_zoom': $function = 'container.resetPosition();'; $label = tr('Reset Zoom'); break; default: return false; } if (! $icon = $params->icon->url()) { $icon = 'mapcontrol_' . $name; } if ($specifiedLabel = $params->label->text()) { $label = $specifiedLabel; } $smarty = TikiLib::lib('smarty'); $smarty->assign( 'mapcontrol', [ 'id' => 'mapcontrol-' . ++$counter, 'control' => $control, 'icon' => $icon, 'label' => $label, 'mode' => $mode, 'function' => $function, 'navigation' => $params->navigation->int(), 'class' => $params->class->text() ? $params->class->text() : 'icon', ] ); return $smarty->fetch('wiki-plugins/wikiplugin_appframe_mapcontrol.tpl'); }