function smarty_function_favorite($params, $smarty)
{
    global $prefs, $user;
    // Disabled, do nothing
    if (empty($user) || $prefs['user_favorites'] != 'y') {
        return;
    }
    $smarty->loadPlugin('smarty_function_button');
    $smarty->loadPlugin('smarty_function_service');
    return smarty_function_button(array('_keepall' => 'y', '_class' => 'favorite-toggle', 'href' => smarty_function_service(array('controller' => 'favorite', 'action' => 'toggle', 'type' => $params['type'], 'object' => $params['object']), $smarty), '_text' => tr('Favorite')), $smarty);
}
示例#2
0
function smarty_function_formAction(array $params, Smarty_Internal_Template $template)
{
    $html = '<div class="formAction clearfix">';
    if (!isset($params['theme'])) {
        $params['theme'] = 'highlight';
    }
    $html .= smarty_function_button($params, $template);
    if (isset($params['alternatives'])) {
        $html .= '<div class="formAction-alternatives">';
        $html .= (string) $params['alternatives'];
        $html .= '</div>';
    }
    $html .= '</div>';
    return $html;
}
示例#3
0
function wikiplugin_toc($data, $params)
{
    $defaults = array('order' => 'asc', 'showdesc' => false, 'shownum' => false, 'type' => 'plain', 'structId' => '', 'maxdepth' => 0, 'numberPrefix' => '', 'pagename' => '');
    $params = array_merge($defaults, $params);
    extract($params, EXTR_SKIP);
    global $page_ref_id;
    $structlib = TikiLib::lib('struct');
    global $prefs;
    if ($prefs['feature_jquery_ui'] === 'y' && $type === 'admin') {
        TikiLib::lib('header')->add_jsfile('lib/structures/tiki-edit_structure.js')->add_jsfile('vendor/jquery/plugins/nestedsortable/jquery.ui.nestedSortable.js');
        $smarty = TikiLib::lib('smarty');
        $smarty->loadPlugin('smarty_function_button');
        $button = smarty_function_button(array('_text' => tra('Save'), '_style' => 'display:none;', '_class' => 'save_structure', '_ajax' => 'n', '_auto_args' => 'save_structure,page_ref_id'), $smarty);
    } else {
        $button = '';
    }
    if (empty($structId)) {
        $pageName_ref_id = null;
        if (!empty($pagename)) {
            $pageName_ref_id = $structlib->get_struct_ref_id($pagename);
        } else {
            if (!empty($page_ref_id)) {
                $pageName_ref_id = $page_ref_id;
            }
        }
        if (!empty($pageName_ref_id)) {
            // we have a structure
            $page_info = $structlib->s_get_page_info($pageName_ref_id);
            $structure_info = $structlib->s_get_structure_info($pageName_ref_id);
            if (isset($page_info)) {
                $html = $structlib->get_toc($pageName_ref_id, $order, $showdesc, $shownum, $numberPrefix, $type, '', $maxdepth, $structure_info['pageName']);
                return "~np~{$button} {$html} {$button}~/np~";
            }
        }
        return '';
    } else {
        $structure_info = $structlib->s_get_structure_info($structId);
        $html = $structlib->get_toc($structId, $order, $showdesc, $shownum, $numberPrefix, $type, '', $maxdepth, $structure_info['pageName']);
        return "~np~{$button} {$html} {$button}~/np~";
    }
}
<td width="170" align="right">Доступно материалов: <b><?php 
    echo $this->_tpl_vars['indexall'];
    ?>
</b></td>
<?php 
    if ($this->_tpl_vars['indexdate']) {
        ?>
<td width="210" align="right">Дата обновления: <b><?php 
        echo is_array($_tmp = $this->_tpl_vars['indexdate']) ? $this->_run_mod_handler('date_format', true, $_tmp, "%d.%m.%Y %T") : smarty_modifier_date_format($_tmp, "%d.%m.%Y %T");
        ?>
</b></td>
<?php 
    }
    ?>
<td width="125" align="right"><?php 
    echo smarty_function_button(array('caption' => "Проиндексировать", 'onclick' => "getindexform()"), $this);
    ?>
</td>
</tr>
</table>

<?php 
    if ($this->_tpl_vars['tags']) {
        ?>
<div class="box">
<?php 
        unset($this->_sections['i']);
        $this->_sections['i']['name'] = 'i';
        $this->_sections['i']['loop'] = is_array($_loop = $this->_tpl_vars['tags']) ? count($_loop) : max(0, (int) $_loop);
        unset($_loop);
        $this->_sections['i']['show'] = true;
Sortable.create(\'fieldsbox\',{tag:\'table\',onUpdate: setfieldssort});
</script>';
        ?>

<?php 
    } else {
        ?>
<div class="box">Нет дополнительных полей.</div>
<?php 
    }
    ?>
<table class="actiongrid">
<tr>
<td align="right">
<?php 
    echo smarty_function_button(array('caption' => "Добавить", 'onclick' => "getaddfieldform()"), $this);
    ?>

</td>
</tr>
</table>
<?php 
} else {
    ?>
<div class="box">Не найдены разделы использующие категории.</div>
<?php 
}
?>

<?php 
$_smarty_tpl_vars = $this->_tpl_vars;
示例#6
0
function wikiplugin_sheet($data, $params)
{
    global $dbTiki, $tiki_p_edit_sheet, $tiki_p_edit, $tiki_p_admin_sheet, $tiki_p_admin, $prefs, $user, $sheetlib, $page, $tikilib, $smarty;
    extract($params, EXTR_SKIP);
    $style = isset($height) ? "height: {$height} !important;" : '';
    $style .= isset($width) ? "width: {$width};" : '';
    //	$urlHeight = (isset($height)) ? "&height=$height" : '';
    //	$urlHeight .= (isset($width)) ? "&width=$width" : '';
    $urlHeight = isset($height) ? "&height=100" : '';
    // not setting any height or width in the sheet params created for me the literal '...&height=100%&...' or '...&width=100%&...' in the url with a 400 error (bad request). Hardcoding to 100 (instead of 100%) to avoid this error until a better fix is found
    $urlHeight .= isset($width) ? "&width=100" : '';
    // not setting any height or width in the sheet params created for me the literal '...&height=100%&...' or '...&width=100%&...' in the url with a 400 error (bad request). Hardcoding to 100 (instead of 100%) to avoid this error until a better fix is found
    $editable = isset($editable) && $editable == 'n' ? false : true;
    $subsheets = isset($subsheets) && $subsheets == 'n' ? false : true;
    $class = isset($class) ? " {$class}" : '';
    $sheetlib = TikiLib::lib("sheet");
    static $index = 0;
    ++$index;
    if (empty($id) && empty($url)) {
        if ($tiki_p_edit_sheet != 'y' || $tiki_p_edit != 'y') {
            return "<b>missing id parameter for plugin</b><br />";
        } else {
            if (isset($_POST['create_sheet'], $_POST['index']) && $index == $_POST['index']) {
                // Create a new sheet and rewrite page
                $sheetId = $sheetlib->replace_sheet(null, tra('New sheet in page: ') . $page, '', $user);
                $page = htmlentities($page);
                $content = htmlentities($data);
                $formId = "form{$index}";
                return <<<EOF
\t\t\t\t~np~
\t\t\t\t<form id="{$formId}" method="post" action="tiki-wikiplugin_edit.php">
\t\t\t\t<div>
\t\t\t\t\t<input type="hidden" name="page" value="{$page}"/>
\t\t\t\t\t<input type="hidden" name="content" value="{$data}"/>
\t\t\t\t\t<input type="hidden" name="index" value="{$index}"/>
\t\t\t\t\t<input type="hidden" name="type" value="sheet"/>
\t\t\t\t\t<input type="hidden" name="params[id]" value="{$sheetId}"/>
\t\t\t\t</div>
\t\t\t\t</form>
\t\t\t\t<script type="text/javascript">
\t\t\t\tdocument.getElementById('{$formId}').submit();
\t\t\t\t</script>
\t\t\t\t~/np~
EOF;
            } else {
                $label = tra('Create New Sheet');
                return <<<EOF
~np~
<form method="post" action="">
\t<p>
\t\t<input type="submit" name="create_sheet" value="{$label}"/>
\t\t<input type="hidden" name="index" value="{$index}"/>
\t</p>
</form>
~/np~
EOF;
            }
        }
    }
    $sheet = new TikiSheet();
    if (empty($url)) {
        $info;
        if (!empty($id)) {
            $info = $sheetlib->get_sheet_info($id);
        }
        if (empty($info)) {
            return tra("Error loading spreadsheet");
        }
        $objectperms = Perms::get('sheet', $id);
        if (!$objectperms->view_sheet && !($user && $info['author'] == $user)) {
            return tra('Permission denied');
        }
        // Build required objects
        $db = new TikiSheetDatabaseHandler($id);
        //$out = new TikiSheetOutputHandler($data);
        // Fetch sheet from database
        $sheet->import($db);
    } else {
        if (!isset($simple)) {
            $simple = 'y';
        }
    }
    $calcOff = '';
    if (!empty($range)) {
        $sheet->setRange($range);
        $calcOff = ',calcOff: true';
    }
    // Grab sheet output
    if (isset($url)) {
        $file = file_get_contents($url);
        $pathInfo = pathinfo($url);
        if ($pathInfo['extension'] == 'csv') {
            $handler = new TikiSheetCSVHandler($url);
            $grid = new TikiSheet();
            $grid->import($handler);
            $ret = $grid->getTableHtml(true, null, false);
        } else {
            $ret = file_get_contents($url);
        }
    } else {
        $ret = $sheet->getTableHtml($subsheets);
    }
    if (strpos($ret, '<table ') === false) {
        return '~np~' . $ret . '~/np~';
        // return a single cell raw
    }
    if (!isset($simple) || $simple != 'y') {
        global $headerlib;
        $sheetlib->setup_jquery_sheet();
        $headerlib->add_jq_onready('$("div.tiki_sheet").each(function() {
				$(this).sheet($.extend($.sheet.tikiOptions,{
				editable:false' . $calcOff . '}));
			});');
    }
    $ret = '<div id="tiki_sheet' . $sheet->instance . '" class="tiki_sheet' . $class . '" style="overflow:hidden;' . $style . '">' . $ret . '</div>';
    if ($editable && ($objectperms->edit_sheet || $objectperms->admin_sheet || $tiki_p_admin == 'y')) {
        $smarty->loadPlugin('smarty_function_button');
        //If you've given the sheet a url, you can't edit it, disable if not possible
        if (!isset($url)) {
            $button_params = array('_text' => tra("Edit Sheet"), '_script' => "tiki-view_sheets.php?sheetId={$id}&parse=edit{$urlHeight}&page={$page}");
        }
        $ret .= smarty_function_button($button_params, $smarty);
    }
    return '~np~' . $ret . '~/np~';
}
示例#7
0
function smarty_block_tabset($params, $content, $smarty, &$repeat)
{
    global $prefs, $smarty_tabset_name, $smarty_tabset, $smarty_tabset_i_tab, $cookietab, $tabset_index;
    $headerlib = TikiLib::lib('header');
    if ($smarty->getTemplateVars('print_page') == 'y' || $prefs['layout_tabs_optional'] === 'n') {
        $params['toggle'] = 'n';
    }
    if ($repeat) {
        // opening
        if (!is_array($smarty_tabset)) {
            $smarty_tabset = array();
        }
        $tabset_index = count($smarty_tabset) + 1;
        $smarty_tabset_name = getTabsetName($params, $tabset_index);
        $smarty_tabset[$tabset_index] = array('name' => $smarty_tabset_name, 'tabs' => array());
        if (!isset($smarty_tabset_i_tab)) {
            $smarty_tabset_i_tab = 1;
        }
        if (!isset($cookietab) || $tabset_index > 1) {
            $cookietab = getCookie($smarty_tabset_name, 'tabs', 1);
        }
        // work out cookie value if there
        if (isset($_REQUEST['cookietab']) && $tabset_index) {
            // overrides cookie if added to request as in tiki-admin.php?page=look&cookietab=6
            $cookietab = empty($_REQUEST['cookietab']) ? 1 : $_REQUEST['cookietab'];
            setCookieSection($smarty_tabset_name, $cookietab, 'tabs');
            // too late to set it here as output has started
        }
        // If the tabset specifies the tab, override any kind of memory but only if not doing "no tabs" mode
        if (isset($params['cookietab']) && $cookietab !== 'n') {
            $cookietab = $params['cookietab'];
        }
        $smarty_tabset_i_tab = 1;
        return;
    } else {
        $content = trim($content);
        if (empty($content)) {
            return '';
        }
        if (!empty($params['skipsingle']) && count($smarty_tabset[$tabset_index]['tabs']) == 1) {
            return $content;
        }
        $ret = '';
        $notabs = '';
        //closing
        if ($prefs['feature_tabs'] == 'y') {
            if (empty($params['toggle']) || $params['toggle'] != 'n') {
                $smarty->loadPlugin('smarty_function_button');
                if ($cookietab == 'n') {
                    $button_params['_text'] = tra('Tab View');
                } else {
                    $button_params['_text'] = tra('No Tabs');
                }
                $button_params['_size'] = 'mini';
                $button_params['_auto_args'] = '*';
                $button_params['_onclick'] = "setCookie('{$smarty_tabset_name}','" . ($cookietab == 'n' ? 1 : 'n') . "', 'tabs') ;";
                $button_params['_class'] = 'btn-xs';
                $notabs = smarty_function_button($button_params, $smarty);
                $notabs = "<div class='pull-right'>{$notabs}</div>";
                $content_class = '';
            } else {
                $content_class = ' full_width';
                // no no-tabs button
            }
        } else {
            return $content;
        }
        if ($cookietab == 'n') {
            return $ret . $notabs . $content;
        }
        $smarty_tabset_name = getTabsetName($params, $tabset_index);
        $ret .= '<div class="clearfix tabs" data-name="' . $smarty_tabset_name . '">' . $notabs;
        $count = 1;
        $ret .= '<ul class="nav nav-tabs">';
        foreach ($smarty_tabset[$tabset_index]['tabs'] as $value) {
            $ret .= '<li class="' . $value['active'] . '"><a href="#' . $value['id'] . '" data-toggle="tab">' . $value['label'] . '</a></li>';
            ++$count;
        }
        $ret .= '</ul>';
        $ret .= "</div>";
        $tabset_index--;
        return $ret . '<div class="tab-content">' . $content . '</div>';
    }
}
function wikiplugin_toc( $data, $params )
{
	$defaults = array(
		'order' => 'asc',
		'showdesc' => false,
		'shownum' => false,
		'type' => 'plain',
		'structId' => '',
		'maxdepth' => 0,
		'numberPrefix' => '',
		'pagename' => '',
	);

	$params = array_merge($defaults, $params);
	extract($params, EXTR_SKIP);

	global $structlib, $page_ref_id;
	include_once ("lib/structures/structlib.php");

	global $prefs;
	if ($prefs['feature_jquery_ui'] === 'y' && $type === 'admin') {
		TikiLib::lib('header')
				->add_jsfile('lib/structures/tiki-edit_structure.js')
				->add_jsfile('lib/jquery/jquery.mjs.nestedSortable.js');

		$smarty = TikiLib::lib('smarty');
		$smarty->loadPlugin('smarty_function_button');
		$button = smarty_function_button(array(
			'_text'		=> tra('Save'),
			'_style'	=> 'display:none;',
			'_class'	=> 'save_structure',
			'_ajax'		=> 'n',
			'_auto_args'=> 'save_structure,page_ref_id',
		), $smarty);
	} else {
		$button = '';
	}

	if (empty($structId)) {
		if (!empty($page_ref_id)) {	//And we are currently viewing a structure
			$pageName_ref_id = null;
			if (!empty($pagename)) {
				$pageName_ref_id = $structlib->get_struct_ref_id($pagename);
			} else {
				$pageName_ref_id = $page_ref_id;
			}
			$page_info = $structlib->s_get_page_info($pageName_ref_id);
			$structure_info = $structlib->s_get_structure_info($pageName_ref_id);
			if (isset($page_info)) {
				$html = $structlib->get_toc($pageName_ref_id, $order, $showdesc, $shownum, $numberPrefix, $type, '', $maxdepth, $structure_info['pageName']);
				return "~np~$button $html $button~/np~";
			}
		}
			//Dont display the {toc} string for non structure pages
		return '';
	} else {
		$structure_info = $structlib->s_get_structure_info($structId);
		$html = $structlib->get_toc($structId, $order, $showdesc, $shownum, $numberPrefix, $type, '', $maxdepth, $structure_info['pageName']);

		return "~np~$button $html $button~/np~";
	}
}
示例#9
0
function wikiplugin_vimeo($data, $params)
{
    global $prefs;
    static $instance = 0;
    $instance++;
    if (isset($params['url'])) {
        $params['vimeo'] = $params['url'];
        unset($params['url']);
        return wikiplugin_flash($data, $params);
    } elseif (isset($params['fileId'])) {
        $fileIds = preg_split('/\\D+/', $params['fileId'], -1, PREG_SPLIT_NO_EMPTY);
        unset($params['fileId']);
        $out = '';
        foreach ($fileIds as $fileId) {
            $attributelib = TikiLib::lib('attribute');
            $attributes = $attributelib->get_attributes('file', $fileId);
            if (!empty($attributes['tiki.content.url'])) {
                $params['vimeo'] = $attributes['tiki.content.url'];
                $out .= wikiplugin_flash($data, $params);
            } else {
                TikiLib::lib('errorreport')->report(tr('Vimeo video not found for file #%0', $fileId));
            }
        }
        return $out;
    } else {
        global $page;
        $smarty = TikiLib::lib('smarty');
        if ($prefs['vimeo_upload'] !== 'y') {
            $smarty->loadPlugin('smarty_block_remarksbox');
            $repeat = false;
            return smarty_block_remarksbox(array('type' => 'error', 'title' => tra('Feature required')), tra('Feature "vimeo_upload" is required to be able to add videos here.'), $smarty, $repeat);
        }
        // old perms access to get "special" gallery perms to handle user gals etc
        $perms = TikiLib::lib('tiki')->get_perm_object(!empty($params['galleryId']) ? $params['galleryId'] : $prefs['vimeo_default_gallery'], 'file gallery', TikiLib::lib('filegal')->get_file_gallery_info($prefs['vimeo_default_gallery']), false);
        if ($perms['tiki_p_upload_files'] !== 'y') {
            return '';
            //$permMessage = tra('You do not have permsission to add files here.');
        } else {
            if (!empty($params['fromFieldId'])) {
                $fieldInfo = TikiLib::lib('trk')->get_tracker_field($params['fromFieldId']);
                if (empty($params['fromItemId'])) {
                    $item = Tracker_Item::newItem($fieldInfo['trackerId']);
                } else {
                    $item = Tracker_Item::fromId($params['fromItemId']);
                }
                if (!$item->canModify()) {
                    return '';
                    //$permMessage = tra('You do not have permsission modify this tracker item.');
                }
            } else {
                if ($page) {
                    $pagePerms = Perms::get(array('type' => 'wiki page', 'object' => $page))->edit;
                    if (!$pagePerms) {
                        return '';
                        //$permMessage = tra('You do not have permsission modify this page.');
                    }
                }
            }
        }
        // set up for an upload
        $smarty->loadPlugin('smarty_function_button');
        $smarty->loadPlugin('smarty_function_service');
        $html = smarty_function_button(array('_keepall' => 'y', '_class' => 'vimeo dialog', 'href' => smarty_function_service(array('controller' => 'vimeo', 'action' => 'upload'), $smarty), '_text' => tra('Upload Video')), $smarty);
        $js = '
$(".vimeo.dialog").click(function () {
	var link = this;
	$(this).serviceDialog({
		title: tr("Upload Video"),
		data: {
			controller: "vimeo",
			action: "upload"' . (!empty($params['galleryId']) ? ',galleryId:' . $params['galleryId'] : '') . (!empty($params['fromFieldId']) ? ',fieldId:' . $params['fromFieldId'] : '') . (!empty($params['fromItemId']) ? ',itemId:' . $params['fromItemId'] : '') . '
		},
		load: function(data) {
			var $dialog = $(".vimeo_upload").parents(".ui-dialog-content");		// odd its the content, not the outer div
			$(".vimeo_upload").on("vimeo_uploaded", function(event, data) {';
        if (!empty($page) && empty($params['fromFieldId'])) {
            $js .= '
				var params = {
					page: ' . json_encode($page) . ',
					content: "",
					index: ' . $instance . ',
					type: "vimeo",
					params: {
						url: data.url
					}
				};
				$.post("tiki-wikiplugin_edit.php", params, function() {
					$("input[type=file]", $dialog).val("");		// webkit reloads the dialog as it destroys it for some reason
					$dialog.dialog("destroy").remove();
					$.get($.service("wiki", "get_page", {page:' . json_encode($page) . '}), function (data) {
						if (data) {
							$("#page-data").html(data);
						}
					});
				});';
        } else {
            $js .= '
				$dialog.dialog("destroy").remove();
				handleVimeoFile(link, data);
';
        }
        $js .= '	});
		}
	});
	return false;
});';
        TikiLib::lib('header')->add_jq_onready($js);
        return $html;
    }
}
示例#10
0
function wikiplugin_tour($data, $params)
{
    $defaults = array();
    $plugininfo = wikiplugin_tour_info();
    foreach ($plugininfo['params'] as $key => $param) {
        $defaults["{$key}"] = $param['default'];
    }
    $params = array_merge($defaults, $params);
    $cookie_id = 'tour' . md5($params['tour_id']);
    if (getCookie($cookie_id, 'tours') == 'y') {
        $dontStart = true;
    } else {
        $dontStart = false;
        if ($params['show_once'] === 'y') {
            setCookieSection($cookie_id, 'y', 'tours');
        }
    }
    static $id = 0;
    $unique = 'wptour_' . ++$id;
    static $wp_tour = array('steps' => array());
    if (!isset($wp_tour['start'])) {
        $wp_tour['start'] = $params['start'];
    }
    $headerlib = TikiLib::lib('header');
    $headerlib->add_jsfile('vendor/sorich87/bootstrap-tour/build/js/bootstrap-tour.js')->add_cssfile('vendor/sorich87/bootstrap-tour/build/css/bootstrap-tour.css');
    // non changing init js in ransk 11 and 13 (the tour definition goes in 12)
    $headerlib->add_jq_onready('var tour;
', 11);
    if ($wp_tour['start'] === 'y' && !$dontStart) {
        $headerlib->add_jq_onready('
if (tour) {
	// Start the tour
	tour.restart();
} else {
	console.log("Warning: Tour not initialized, the last step needs to have parameter next set to -1");
}
', 13);
    }
    unset($params['start']);
    unset($params['tour_id']);
    $html = '';
    $params['orphan'] = $params['orphan'] === 'y';
    $params['backdrop'] = $params['backdrop'] === 'y';
    if (empty($params['element']) && !$params['orphan']) {
        $params['element'] = "#{$unique}";
        $html = '<span id="' . $unique . '"></span>';
        if (!empty($params['show_restart_button'])) {
            $smarty = TikiLib::lib('smarty');
            $smarty->loadPlugin('smarty_function_button');
            $html .= smarty_function_button(['_text' => tra($params['show_restart_button']), '_id' => $unique . '_restart', 'href' => '#'], $smarty);
            $headerlib->add_jq_onready('$("#' . $unique . '_restart").click(function() {
	tour.goTo(0);
	tour.restart();
	return false;
});', 13);
        }
    }
    $params['content'] = TikiLib::lib('parser')->parse_data($data);
    $wp_tour['steps'][] = array_filter($params);
    if ($params['next'] == -1 || $params['path']) {
        $js = '// Instance the tour
tour = new Tour(' . json_encode($wp_tour) . ');
';
        $headerlib->add_jq_onready($js, 12);
    }
    return $html;
}
<?php

/* Smarty version 2.6.26, created on 2015-10-22 16:40:05
   compiled from categoriestree.tpl */
require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
smarty_core_load_plugins(array('plugins' => array(array('function', 'object', 'categoriestree.tpl', 2, false), array('function', 'button', 'categoriestree.tpl', 9, false))), $this);
if ($this->_tpl_vars['treebox']->object->items) {
    echo smarty_function_object(array('obj' => $this->_tpl_vars['treebox']), $this);
    ?>

<?php 
} else {
    ?>
<div class="box">Нет категорий</div>
<?php 
}
?>
<table class="actiongrid">
<tr>
<td align="right">
<?php 
echo smarty_function_button(array('caption' => "Добавить", 'onclick' => "getaddcatform(-1,-1,-1)"), $this);
?>

</td>
</tr>
</table>
<script type="text/javascript">tc_sortable();</script>
示例#12
0
function smarty_block_tabset($params, $content, $smarty, &$repeat)
{
    global $prefs, $smarty_tabset_name, $smarty_tabset, $smarty_tabset_i_tab, $cookietab, $headerlib, $tabset_index;
    if ($smarty->getTemplateVars('print_page') == 'y' || $prefs['layout_tabs_optional'] === 'n') {
        $params['toggle'] = 'n';
    }
    if ($repeat) {
        // opening
        if (!is_array($smarty_tabset)) {
            $smarty_tabset = array();
        }
        $tabset_index = count($smarty_tabset) + 1;
        if (isset($params['name']) and !empty($params['name'])) {
            $smarty_tabset_name = $params['name'];
            // names have to be unique
        } else {
            $short_name = str_replace(array('tiki-', '.php'), '', basename($_SERVER['SCRIPT_NAME']));
            $smarty_tabset_name = 't_' . $short_name . $tabset_index;
        }
        $smarty_tabset_name = TikiLib::remove_non_word_characters_and_accents($smarty_tabset_name);
        $smarty_tabset[$tabset_index] = array('name' => $smarty_tabset_name, 'tabs' => array());
        if (!isset($smarty_tabset_i_tab)) {
            $smarty_tabset_i_tab = 1;
        }
        if (!isset($cookietab) || $tabset_index > 1) {
            $cookietab = getCookie($smarty_tabset_name, 'tabs', 1);
        }
        // work out cookie value if there
        if (isset($_REQUEST['cookietab']) && $tabset_index === 1) {
            // overrides cookie if added to request as in tiki-admin.php?page=look&cookietab=6
            $cookietab = empty($_REQUEST['cookietab']) ? 1 : $_REQUEST['cookietab'];
            setCookieSection($smarty_tabset_name, $cookietab, 'tabs');
            // too late to set it here as output has started
        }
        // If the tabset specifies the tab, override any kind of memory but only if not doing "no tabs" mode
        if (isset($params['cookietab']) && $cookietab !== 'n') {
            $cookietab = $params['cookietab'];
        }
        $smarty_tabset_i_tab = 1;
        return;
    } else {
        $content = trim($content);
        if (empty($content)) {
            return '';
        }
        $ret = '';
        $notabs = '';
        //closing
        if ($prefs['feature_tabs'] == 'y') {
            if (empty($params['toggle']) || $params['toggle'] != 'n') {
                $smarty->loadPlugin('smarty_function_button');
                if ($cookietab == 'n') {
                    $button_params['_text'] = tra('Tab View');
                } else {
                    $button_params['_text'] = tra('No Tabs');
                }
                $button_params['_auto_args'] = '*';
                $button_params['_onclick'] = "setCookie('{$smarty_tabset_name}','" . ($cookietab == 'n' ? 1 : 'n') . "', 'tabs') ;";
                $notabs = smarty_function_button($button_params, $smarty);
                $notabs = "<div class='tabstoggle floatright'>{$notabs}</div>";
                $content_class = '';
            } else {
                $content_class = ' full_width';
                // no no-tabs button
            }
        } else {
            return $content;
        }
        if ($cookietab == 'n') {
            return $ret . $notabs . $content;
        }
        $ret .= '<div class="clearfix tabs" data-name="' . $smarty_tabset_name . '">' . $notabs;
        $count = 1;
        if ($prefs['mobile_feature'] === 'y' && $prefs['mobile_mode'] === 'y') {
            $ret .= '<div class="container' . $content_class . '" data-role="navbar"><ul>';
            foreach ($smarty_tabset[$tabset_index]['tabs'] as $value) {
                $ret .= '<li>' . '<a href="#" class="tabmark tab' . $count . ' ' . ($count == $cookietab ? 'ui-btn-active' : '') . '"' . ' onclick="tikitabs(' . $count . ',this); return false;">' . $value . '</a></li>';
                ++$count;
            }
            $ret .= '</ul></div>';
        } else {
            // notmal non-mobile rendering
            $ret .= '<div class="container' . $content_class . '">';
            foreach ($smarty_tabset[$tabset_index]['tabs'] as $value) {
                $ret .= '<span class="tabmark tab' . $count . ' ' . ($count == $cookietab ? 'tabactive' : '') . '">' . '<a href="#content' . $count . '"' . ' onclick="tikitabs(' . $count . ',this); return false;">' . $value . '</a></span>';
                ++$count;
            }
            $ret .= '</div>';
        }
        $ret .= "</div>{$content}";
        // add some jq to initialize the tab, needed when page is cached
        if ($tabset_index === 1) {
            // override cookie with query cookietab
            $headerlib->add_jq_onready('
var ctab = location.search.match(/cookietab=(\\d+)/);
if (ctab) {
	setCookie("' . $smarty_tabset_name . '", ctab[1],"tabs");
}');
        }
        if ($cookietab != getCookie($smarty_tabset_name, 'tabs', 1)) {
            // has been changed by code but now too late to reset
            $headerlib->add_jq_onready('setCookie("' . $smarty_tabset_name . '",' . $cookietab . ',"tabs");');
        } else {
            $headerlib->add_jq_onready('tikitabs(getCookie("' . $smarty_tabset_name . '","tabs",1), $("div[data-name=' . $smarty_tabset_name . '] .tabmark:first"));');
        }
        $div_id = $smarty_tabset_name;
        // work arounds for nested plugins
        $tabset_index--;
        array_pop($smarty_tabset);
        if ($tabset_index > 0) {
            $smarty_tabset_name = $smarty_tabset[$tabset_index]['name'];
            $cookietab = getCookie($smarty_tabset_name, 'tabs', 1);
        }
        return '<div class="tabset" id="' . $div_id . '">' . $ret . '</div>';
    }
}
    echo smarty_function_hidden(array('name' => 'item', 'value' => $this->_tpl_vars['system']['item']), $this);
    ?>

<?php 
    echo smarty_function_hidden(array('name' => 'tab', 'value' => 'pages'), $this);
    ?>

</form>
</td>
<td align="right" width="80%">
<?php 
    echo smarty_function_button(array('caption' => "Новый подраздел", 'onclick' => "getadddirform()"), $this);
    ?>

<?php 
    echo smarty_function_button(array('caption' => "Новая страница", 'onclick' => "getaddpageform()"), $this);
    ?>

</td>
</tr>
</table>
</div>
<script type="text/javascript">
indir(<?php 
    echo $this->_tpl_vars['curdir'];
    ?>
);
</script>
<?php 
    $_block_content = ob_get_contents();
    ob_end_clean();
</div>
<div id="images_editbox" class="box" style="display:none">
<table class="invisiblegrid" width="100%">
<tr>
<td>Заменить:</td>
<td width="80%">Описание:</td>
</tr>
<tr>
<td><div id="images_filebox2"></div></td>
<td width="80%"><input type="text" id="images_caption2" name="images_caption2" style="width:100%"></td>
</tr>
</table>
<div align="right" style="margin-top:10px">
<input type="hidden" id="images_id" name="images_id" value="0">
<?php 
echo smarty_function_button(array('caption' => "Сохранить", 'onclick' => "images_save()"), $this);
?>

<?php 
echo smarty_function_button(array('caption' => "Отмена", 'onclick' => "images_cancel()"), $this);
?>

</div>
</div>
<div id="images_messagebox" class="box" style="display:none" align="center"></div>
<?php 
if ($this->_tpl_vars['mainframe']) {
    ?>
<script type="text/javascript">images_refresh();</script>
<?php 
}
<?php

/* Smarty version 2.6.26, created on 2015-12-13 17:33:16
   compiled from fileadmin.tpl */
require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
smarty_core_load_plugins(array('plugins' => array(array('function', 'button', 'fileadmin.tpl', 5, false))), $this);
?>
<div id="fa_gridbox"></div>
<table class="actiongrid">
<tr>
<td align="right">
<?php 
echo smarty_function_button(array('caption' => "Создать каталог", 'onclick' => "createfolder()"), $this);
?>

<?php 
echo smarty_function_button(array('caption' => "Создать файл", 'onclick' => "createfile()"), $this);
?>

<?php 
echo smarty_function_button(array('caption' => "Загрузить файл", 'onclick' => "uploadform()"), $this);
?>

</td>
</tr>
</table>
<script type="text/javascript">fagopage(0)</script>
示例#16
0
function wikiplugin_kaltura($data, $params)
{
    global $prefs, $tiki_p_upload_videos, $user, $page;
    static $instance = 0;
    $instance++;
    $defaults = array();
    $plugininfo = wikiplugin_kaltura_info();
    foreach ($plugininfo['params'] as $key => $param) {
        if (isset($param['default'])) {
            $defaults[$key] = $param['default'];
        }
    }
    if (empty($params['id'])) {
        if ($tiki_p_upload_videos === 'y') {
            $smarty = TikiLib::lib('smarty');
            $smarty->loadPlugin('smarty_function_button');
            $json_page = json_encode($page);
            $json_instance = json_encode($instance);
            $json_title = json_encode(tr('Upload Media'));
            TikiLib::lib('header')->add_jq_onready(<<<REG
\$("#kaltura_upload_btn{$instance} a").on("click", function() {
\t\$(this).serviceDialog({
\t\ttitle: {$json_title},
\t\twidth: 710,
\t\theight: 450,
\t\thideButtons: true,
\t\tsuccess: function (data) {
\t\t\tif (data.entries) {
\t\t\t\t\$.post('tiki-wikiplugin_edit.php', {
\t\t\t\t\tcontent: '',
\t\t\t\t\ttype: 'kaltura',
\t\t\t\t\tpage: {$json_page},
\t\t\t\t\tindex: {$json_instance},
\t\t\t\t\tparams: {
\t\t\t\t\t\tid: data.entries[0]
\t\t\t\t\t}
\t\t\t\t}, function () {
\t\t\t\t\tdocument.location.reload();
\t\t\t\t});
\t\t\t}
\t\t}
\t});
\treturn false;
});
REG
);
            $html = smarty_function_button(array('_text' => !empty($params['add_button_label']) ? tra($params['add_button_label']) : $defaults['add_button_label'], '_id' => 'kaltura_upload_btn' . $instance, 'href' => TikiLib::lib('service')->getUrl(array('controller' => 'kaltura', 'action' => 'upload'))), $smarty);
        } else {
            if (!empty($user)) {
                $html = '<span class="error">' . tra('Media id or permission to upload video is required') . '</span>';
            } else {
                $html = '<span class="error">' . tra('Log in to upload video') . '</span>';
            }
        }
        return $html;
    } else {
        $id = $params['id'];
    }
    if (empty($params['player_id'])) {
        $params['player_id'] = $prefs['kaltura_kdpUIConf'];
    }
    if (empty($params['width']) || empty($params['height'])) {
        $kalturaadminlib = TikiLib::lib('kalturaadmin');
        $player = $kalturaadminlib->getPlayersUiConf($params['player_id']);
        if (!empty($player)) {
            if (empty($params['width'])) {
                $params['width'] = $player['width'];
            }
            if (empty($params['height'])) {
                $params['height'] = $player['height'];
            }
        } else {
            return '<span class="error">' . tra('Player not found') . '</span>';
        }
    }
    $kalturalib = TikiLib::lib('kalturauser');
    $params = array_merge($defaults, $params);
    $params['session'] = $kalturalib->getSessionKey();
    $params['media_url'] = $kalturalib->getMediaUrl($params['id'], $params['player_id']);
    $smarty = TikiLib::lib('smarty');
    $smarty->assign('kaltura', $params);
    $style = '';
    if (!empty($params['align'])) {
        $style .= "text-align:{$params['align']};";
    }
    if (!empty($params['float'])) {
        $style .= "float:{$params['float']};";
    }
    if ($params['type'] === 'html5') {
        $embedIframeJs = '/embedIframeJs';
        // TODO add as params?
        $leadWithHTML5 = 'true';
        $autoPlay = 'false';
        TikiLib::lib('header')->add_jsfile("{$prefs['kaltura_kServiceUrl']}/p/{$prefs['kaltura_partnerId']}/sp/{$prefs['kaltura_partnerId']}00{$embedIframeJs}/uiconf_id/{$params['player_id']}/partner_id/{$prefs['kaltura_partnerId']}")->add_jq_onready("\nmw.setConfig('Kaltura.LeadWithHTML5', {$leadWithHTML5});\n\nkWidget.embed({\n\ttargetId: 'kaltura_player{$instance}',\n\twid: '_{$prefs['kaltura_partnerId']}',\n\tuiconf_id: '{$params['player_id']}',\n\tentry_id: '{$params['id']}',\n\tflashvars: { // flashvars allows you to set runtime uiVar configuration overrides.\n\t\t//autoPlay: {$autoPlay}\n\t},\n\tparams: { // params allows you to set flash embed params such as wmode, allowFullScreen etc\n\t\twmode: 'transparent'\n\t},\n\treadyCallback: function (playerId) {\n\t\t\$ = \$jq;\t// restore our jQuery after Kaltura has finished with it\n\t\tconsole.log('Player:' + playerId + ' is ready ');\n\t}\n});");
        return "<div id='kaltura_player{$instance}' style='width:{$params['width']}px;height:{$params['height']}px;{$style}'></div>";
    } elseif ($params['type'] === 'kdp') {
        $code = $smarty->fetch('wiki-plugins/wikiplugin_kaltura.tpl');
        if (!empty($style)) {
            $code = "<div style='{$style}'>{$code}</div>";
        }
        return $code;
    } else {
        TikiLib::lib('erroreport')->report(tra('Kaltura player: unsupported type.'));
        return '';
    }
}
<?php 
echo smarty_function_hidden(array('name' => 'item', 'value' => $this->_tpl_vars['system']['item']), $this);
?>

<?php 
echo smarty_function_hidden(array('name' => 'obj_action', 'value' => 'ct_edit'), $this);
?>

<?php 
echo smarty_function_hidden(array('name' => 'authcode', 'value' => $this->_tpl_vars['system']['authcode']), $this);
?>

<div align="right" style="margin-top:10px">
<p style="float:left"><label><input type="checkbox" name="active"<?php 
if ($this->_tpl_vars['form']['active'] == 'Y') {
    ?>
 checked<?php 
}
?>
>&nbsp;Активно</label></p>
<?php 
echo smarty_function_submit(array('caption' => "Сохранить"), $this);
?>

<?php 
echo smarty_function_button(array('caption' => "Отмена", 'onclick' => "Windows.closeAll()"), $this);
?>

</div>
</form>
示例#18
0
 /**
  * @param string $needle
  * @param array  $params
  */
 private function _assertContains($needle, array $params)
 {
     $this->assertContains($needle, smarty_function_button($params, $this->_template));
 }