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 = intval(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(<<<JS hideCol('col2','left', 'col1'); JS ); } if (isset($params['hideright']) && $params['hideright'] == 'y') { $headerlib->add_js(<<<JS hideCol('col3','right', 'col1'); JS ); } $headerlib->add_js(<<<JS \$(window).resize(function () { \tvar viewportHeight = \$(window).height(), appframe = \$('#appframe'), footerSize, centerHeader, surplus, target; \tif ({$absolute}) { \t\t\$('#appframe') \t\t\t.css('position', 'absolute') \t\t\t.css('top', {$top}) \t\t\t.css('left', 0) \t\t\t.css('bottom', 0) \t\t\t.css('right', 0) \t\t\t; \t} else { \t\tappframe.height(0); \t\tcenterHeader = \$('#appframe').position().top - \$('#tiki-center').position().top; \t\tsurplus = \$('#show-errors-button').height(); \t\tfooterSize = \$('#footer').height() + \$('#tiki-center').height() - centerHeader + surplus; \t\ttarget = viewportHeight - appframe.position().top - footerSize; \t\tvar min = {$minHeight}; \t\tif (target < min) { \t\t\ttarget = min; \t\t} \t\tvar max = {$maxHeight}; \t\tif ((max != -1) && (target > max)) { \t\t\ttarget = max; \t\t} \t\tappframe.height(target); \t} \t\$('#appframe .tab').each(function () { \t\t\$(this).data('available-height', \$('#appframe').height() - \$(this).position().top).addClass('height-size'); \t}); \t\$('#appframe .anchor-container') \t\t.css('z-index', 100000) \t\t.css('position', 'absolute') \t\t.css('top', 150) \t\t.css('right', 0) \t\t; }); \$('#appframe .tab').parent().each(function () { \tvar tabs = \$(this).children('.tab').wrapAll('<div class="tabs" style="height: 100%;"/>'); \tvar list = \$('<ul/>'); \ttabs.parent().prepend(list); \ttabs.each(function () { \t\tvar link = \$('<a/>').attr('href', '#' + \$(this).attr('id')).text(\$(this).data('label')); \t\tlist.append(\$('<li/>').append(link)); \t}); \ttabs.parent().tabs(); }); \$('#appframe .accordion').parent().each(function () { \t\$('.accordion', this).wrapAll('<div/>').parent().accordion({ \t\theightStyle: "content" \t}); }); \$('#appframe .anchor').wrapAll('<div/>').parent() \t.addClass('anchor-container') \t; \$('#appframe .anchor').each(function () { \tvar anchor = this; \t\$('.anchor-head, .anchor-content', anchor) \t\t.css('text-align', 'right') \t\t; \t\$('.anchor-toggle', anchor).click(function () { \t\t\$('.anchor-head .label', anchor).toggle('fast'); \t\t\$('.anchor-content', anchor).toggle('fast'); \t\treturn false; \t}); \tif (location.hash == "#" + \$("img", anchor).attr("alt")) { \t\tsetTimeout( function() { \$('.anchor-toggle', anchor).click(); }, 2000); \t} }); if ({$fullPage}) { \t\$('#role_main').append(\$('#appframe')); \t\$('#role_main').children().not(\$('#appframe')).remove(); } if ({$fullscreen}) { \t\$('.header_outer').hide(); \t\$('#topbar_modules').hide(); \t\$('#footer').hide(); \t\$('#error_report').hide(); \t\$('.share').hide(); \t\$('.tellafriend').hide(); } \$(window).resize(); JS ); $matches = WikiParser_PluginMatcher::match($data); foreach ($matches as $plugin) { if ($output = wikiplugin_appframe_execute($plugin)) { $plugin->replaceWith($output); } } $data = $matches->getText(); return <<<HTML <div id="appframe">{$data}</div> HTML; }
function wikiplugin_appframe($data, $params) { $minHeight = isset($params['min']) ? (int) $params['min'] : 300; $fullPage = 0; if (isset($params['fullpage']) && $params['fullpage'] == 'y') { $fullPage = 1; } $absolute = intval(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( <<<JS hideCol('col2','left', 'col1'); JS ); } if (isset($params['hideright']) && $params['hideright'] == 'y') { $headerlib->add_js( <<<JS hideCol('col3','right', 'col1'); JS ); } $headerlib->add_js( <<<JS $(window).resize(function () { var viewportHeight = $(window).height(), appframe = $('#appframe'), footerSize, centerHeader, surplus, target; if ($absolute) { $('#appframe') .css('position', 'absolute') .css('top', $top) .css('left', 0) .css('bottom', 0) .css('right', 0) ; } else { appframe.height(0); centerHeader = $('#appframe').position().top - $('#tiki-center').position().top; surplus = $('#show-errors-button').height(); footerSize = $('#footer').height() + $('#tiki-center').height() - centerHeader + surplus; target = viewportHeight - appframe.position().top - footerSize; var min = $minHeight; if (target < min) { target = min; } 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', 100000) .css('position', 'absolute') .css('top', 150) .css('right', 0) ; }); $('#appframe .tab').parent().each(function () { var tabs = $(this).children('.tab').wrapAll('<div class="tabs" style="height: 100%;"/>'); var list = $('<ul/>'); tabs.parent().prepend(list); tabs.each(function () { var link = $('<a/>').attr('href', '#' + $(this).attr('id')).text($(this).data('label')); list.append($('<li/>').append(link)); }); tabs.parent().tabs(); }); $('#appframe .accordion').parent().each(function () { $('.accordion', this).wrapAll('<div/>').parent().accordion({ autoHeight: false }); }); $('#appframe .anchor').wrapAll('<div/>').parent() .addClass('anchor-container') ; $('#appframe .anchor').each(function () { var anchor = this; $('.anchor-head, .anchor-content', anchor) .css('text-align', 'right') ; $('.anchor-toggle', anchor).click(function () { $('.anchor-head .label', anchor).toggle('fast'); $('.anchor-content', anchor).toggle('fast'); return false; }); }); if ($fullPage) { $('#role_main').append($('#appframe')); $('#role_main').children().not($('#appframe')).remove(); } $(window).resize(); JS ); $matches = WikiParser_PluginMatcher::match($data); foreach ($matches as $plugin) { if ($output = wikiplugin_appframe_execute($plugin)) { $plugin->replaceWith($output); } } $data = $matches->getText(); return <<<HTML <div id="appframe">$data</div> HTML; }