function smarty_function_show_sort($params, $smarty)
{
    global $url_path;
    if (isset($_REQUEST[$params['sort']])) {
        $p = $_REQUEST[$params['sort']];
    } elseif ($s = $smarty->getTemplateVars($params['sort'])) {
        $p = $s;
    }
    if (isset($params['sort']) and isset($params['var']) and isset($p)) {
        $prop = substr($p, 0, strrpos($p, '_'));
        $order = substr($p, strrpos($p, '_') + 1);
        if (strtolower($prop) == strtolower(trim($params['var']))) {
            $smarty->loadPlugin('smarty_function_icon');
            $icon_params = array('alt' => tra('Invert Sort'), 'style' => 'vertical-align:middle');
            switch ($order) {
                case 'asc':
                case 'nasc':
                    $icon_params['_id'] = 'resultset_up';
                    return smarty_function_icon($icon_params, $smarty);
                    break;
                case 'desc':
                case 'ndesc':
                    $icon_params['_id'] = 'resultset_down';
                    return smarty_function_icon($icon_params, $smarty);
                    break;
            }
        }
    }
}
Пример #2
0
/**
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     modifier
 * Name:     iconify
 * Purpose:  Returns a filetype icon if the filetype is known and there's an icon in img/icons/mime. Returns a default file type icon in any other case
 * -------------------------------------------------------------
 */
function smarty_modifier_iconify($string, $filetype = null)
{
    global $smarty;
    $smarty->loadPlugin('smarty_function_icon');
    $icon = '';
    $ext = strtolower(substr($string, strrpos($string, '.') + 1));
    if (file_exists("img/icons/mime/{$ext}.png")) {
        $icon = $ext;
    } elseif (file_exists('img/icons/mime/' . substr($ext, 0, 3) . '.png')) {
        $icon = substr($ext, 0, 3);
    } else {
        include_once 'lib/mime/mimetypes.php';
        global $mimetypes;
        $mimes = array_keys($mimetypes, $filetype);
        foreach ($mimes as $m) {
            if (file_exists("img/icons/mime/{$m}.png")) {
                $icon = $m;
            }
        }
        if (empty($icon)) {
            $icon = 'default';
        }
    }
    return smarty_function_icon(array('_id' => 'img/icons/mime/' . $icon . '.png', 'alt' => $filetype === null ? $icon : $filetype, 'class' => ''), $smarty);
}
Пример #3
0
function smarty_block_title($params, $content, &$smarty, $repeat)
{
    global $prefs;
    global $smarty;
    global $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || $content == '') {
        return;
    }
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['url'])) {
        $params['url'] = $_SERVER['REQUEST_URI'];
    }
    $html = '<h1>';
    $html .= '<a class="pagetitle" href="' . $params['url'] . '">' . $content . "</a>\n";
    if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
        $html .= '<a href="' . $prefs['helpurl'] . $params['help'] . '" target="tikihelp" class="tikihelp" title="' . tra('Help page:') . ' ' . $content . '">' . smarty_function_icon(array('_id' => 'help'), $smarty) . "</a>\n";
    }
    if ($prefs['feature_view_tpl'] == 'y' && ($tiki_p_edit_templates || $tiki_p_edit_templates)) {
        $html .= '<a href="tiki-edit_templates.php?template=' . $smarty->_tpl_vars['mid'] . '" target="tikihelp" class="tikihelp" title="' . tra('View tpl:') . ' ' . $content . '">' . smarty_function_icon(array('_id' => 'shape_square_edit', 'alt' => tra('Edit Template')), $smarty) . "</a>\n";
    }
    if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
        $html .= '<a href="tiki-admin.php?page=' . $params['admpage'] . '">' . smarty_function_icon(array('_id' => 'wrench', 'alt' => tra('Admin Feature')), $smarty) . "</a>\n";
    }
    $html .= '</h1>';
    return $html;
}
function smarty_modifier_iconify($string, $filetype = null)
{
    global $smarty;
    $ext = strtolower(substr($string, strrpos($string, '.') + 1));
    $icon = file_exists("pics/icons/mime/{$ext}.png") ? $ext : 'default';
    return smarty_function_icon(array('_id' => 'pics/icons/mime/' . $icon . '.png', 'alt' => $filetype === null ? $icon : $filetype, 'class' => ''), $smarty);
}
Пример #5
0
function wikiplugin_article($data, $params)
{
    global $user, $tiki_p_admin_cms;
    $userlib = TikiLib::lib('user');
    $tikilib = TikiLib::lib('tiki');
    $statslib = TikiLib::lib('stats');
    $artlib = TikiLib::lib('art');
    $smarty = TikiLib::lib('smarty');
    extract($params, EXTR_SKIP);
    if (empty($Id)) {
        $Id = $artlib->get_most_recent_article_id();
    }
    if (!isset($Field)) {
        $Field = 'heading';
    }
    if ($tiki_p_admin_cms == 'y' || $tikilib->user_has_perm_on_object($user, $Id, 'article', 'tiki_p_edit_article') || isset($article_data) && $article_data["author"] == $user && $article_data["creator_edit"] == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $add = "&nbsp;<a href='tiki-edit_article.php?articleId={$Id}' class='editplugin'>" . smarty_function_icon(['name' => 'edit'], $smarty) . '</a>';
    } else {
        $add = "";
    }
    $article_data = $artlib->get_article($Id);
    if (isset($article_data[$Field])) {
        return $tikilib->parse_data($article_data[$Field]) . $add;
    }
}
Пример #6
0
/**
 * Function to load jQuery code to insert an iconset icon into an element
 * Useful for when there's no other way to make 3rd party code consistent with the Tiki iconsets
 *
 * type     - determines the js string that will be returned
 * iconname - set the icon to override the default
 * return   - return the js code rather than add to the header
 * @param $params
 * @param $smarty
 * @return string
 * @throws Exception
 */
function smarty_function_js_insert_icon($params, $smarty)
{
    if (!empty($params['type'])) {
        //set icon
        $iconmap = ['jscalendar' => 'calendar'];
        $iconname = !empty($params['iconname']) ? $params['iconname'] : $iconmap[$params['type']];
        $smarty->loadPlugin('smarty_function_icon');
        $icon = smarty_function_icon(['name' => $iconname], $smarty);
        //set js
        switch ($params['type']) {
            case 'jscalendar':
                $js = "\$('div.jscal > button.ui-datepicker-trigger').empty().append('{$icon}').addClass('btn btn-sm btn-link').css({'padding' : '0px', 'font-size': '16px'});";
                break;
        }
        //load js
        if (!empty($js)) {
            if (isset($params['return']) && $params['return'] === 'y') {
                return $js;
            } else {
                $headerlib = TikiLib::lib('header');
                $headerlib->add_jq_onready($js);
            }
        }
    }
}
Пример #7
0
function smarty_block_title($params, $content, $template, &$repeat)
{
    global $prefs, $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || empty($content)) {
        return;
    }
    $template->loadPlugin('smarty_function_icon');
    $template->loadPlugin('smarty_modifier_sefurl');
    $template->loadPlugin('smarty_modifier_escape');
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['actions'])) {
        $params['actions'] = '';
    }
    // Set the variable for the HTML title tag
    $template->smarty->assign('headtitle', $content);
    $class = '';
    $current = current_object();
    if (!isset($params['url'])) {
        $params['url'] = smarty_modifier_sefurl($current['object'], $current['type']);
    }
    $metadata = '';
    $coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object']);
    if ($coordinates) {
        $class = ' geolocated primary';
        $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\"";
        if (isset($coordinates['zoom'])) {
            $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\"";
        }
    }
    $html = '<h1 class="pagetitle">';
    $html .= '<a class="' . $class . '"' . $metadata . ' href="' . $params['url'] . '">' . smarty_modifier_escape($content) . "</a>\n";
    if ($template->getTemplateVars('print_page') != 'y') {
        if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
            $html .= '<a href="';
            $html .= $prefs['helpurl'] . rawurlencode($params['help']) . '" class="tips btn btn-link" title="' . smarty_modifier_escape($content) . '|' . tra('Help page') . '" target="tikihelp">' . smarty_function_icon(array('name' => 'help'), $template) . "</a>\n";
        }
        if ($prefs['feature_edit_templates'] == 'y' && $tiki_p_edit_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=';
            $html .= $tpl . '" class="tips btn btn-link" title="' . tra('View or edit tpl') . '|' . htmlspecialchars($content) . '">' . smarty_function_icon(array('name' => 'edit'), $template) . "</a>\n";
        } elseif ($prefs['feature_view_tpl'] == 'y' && $tiki_p_view_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=';
            $html .= $tpl . '" class="tips btn btn-link" title="' . tra('View tpl') . '|' . htmlspecialchars($content) . '">' . smarty_function_icon(array('name' => 'view'), $template) . "</a>\n";
        }
        if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
            $html .= '<a class="tips btn btn-link" href="tiki-admin.php?page=';
            $html .= $params['admpage'] . '" title="' . htmlspecialchars($content) . '|' . tra('Settings') . '">' . smarty_function_icon(array('name' => 'settings'), $template) . "</a>\n";
        }
        if ($params['actions'] != '') {
            $html .= $params['actions'];
        }
    }
    $html .= '</h1>';
    return $html;
}
Пример #8
0
function smarty_block_title($params, $content, $template, &$repeat)
{
    global $prefs, $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || empty($content)) {
        return;
    }
    $template->loadPlugin('smarty_function_icon');
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['url'])) {
        $template->loadPlugin('smarty_function_query');
        $params['url'] = htmlspecialchars(smarty_function_query(array('_type' => 'absolute_path'), $template));
        $params['url'] = str_replace('&amp;amp;', '&', $params['url']);
    }
    // Set the variable for the HTML title tag
    $template->smarty->assign('headtitle', $content);
    $class = 'pagetitle';
    $current = current_object();
    $metadata = '';
    $coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object']);
    if ($coordinates) {
        $class = ' geolocated primary';
        $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\"";
        if (isset($coordinates['zoom'])) {
            $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\"";
        }
    }
    $html = '<h1>';
    $html .= '<a class="' . $class . '"' . $metadata . ' href="' . $params['url'] . '">' . htmlspecialchars($content) . "</a>\n";
    if ($template->getTemplateVars('print_page') != 'y') {
        if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
            $html .= '<a href="' . $prefs['helpurl'] . rawurlencode($params['help']) . '" class="titletips" title="' . tra('Help page:') . ' ' . htmlspecialchars($content) . '" target="tikihelp">' . smarty_function_icon(array('_id' => 'help'), $template) . "</a>\n";
        }
        if ($prefs['feature_edit_templates'] == 'y' && $tiki_p_edit_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View or edit tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square_edit', 'alt' => tra('Edit Template')), $template) . "</a>\n";
        } elseif ($prefs['feature_view_tpl'] == 'y' && $tiki_p_view_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square', 'alt' => tra('View Template')), $template) . "</a>\n";
        }
        if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
            $html .= '<a class="titletips" href="tiki-admin.php?page=' . $params['admpage'] . '" title="' . tra('Admin page:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'wrench', 'alt' => tra('Admin Feature')), $template) . "</a>\n";
        }
    }
    $html .= '</h1>';
    return $html;
}
Пример #9
0
 function __construct(&$parser)
 {
     global $smarty, $prefs;
     $this->parser =& $parser;
     if ($prefs['popupLinks'] == 'y') {
         $this->attr .= 'target="_blank" ';
     }
     if ($prefs['feature_wiki_ext_icon'] == 'y') {
         $this->attr .= 'class="wiki external" ';
         include_once 'lib/smarty_tiki/function.icon.php';
         $this->icon = smarty_function_icon(array('_id' => 'external_link', 'alt' => tra('(external link)'), '_class' => 'externallink', '_extension' => 'gif', '_defaultdir' => 'img/icons', 'width' => 15, 'height' => 14), $smarty);
     } else {
         $this->attr .= 'class="wiki" ';
     }
 }
Пример #10
0
 function button($wiki_edit_icons_toggle)
 {
     global $smarty;
     if ($wiki_edit_icons_toggle == 'y' && !isset($_COOKIE['wiki_plugin_edit_view'])) {
         $iconDisplayStyle = ' style="display:none;"';
     } else {
         $iconDisplayStyle = '';
     }
     $button = '<div class="icon_edit_section"' . $iconDisplayStyle . '><a href="tiki-editpage.php?';
     if (!empty($_REQUEST['page'])) {
         $button .= 'page=' . urlencode($_REQUEST['page']) . '&amp;';
     }
     $this->count++;
     include_once 'lib/smarty_tiki/function.icon.php';
     $button .= 'hdr=' . $this->count . '">' . smarty_function_icon(array('_id' => 'page_edit_section', 'alt' => tra('Edit Section')), $smarty) . '</a></div>';
     return $button;
 }
Пример #11
0
function smarty_modifier_avatarize($user, $float = '', $default = '', $show_tag = 'y')
{
    if (!$user) {
        return '';
    }
    $avatar = TikiLib::lib('tiki')->get_user_avatar($user, $float);
    if (!$avatar && $default) {
        $smarty = TikiLib::lib('smarty');
        $smarty->loadPlugin('smarty_function_icon');
        $name = TikiLib::lib('user')->clean_user($user);
        $avatar = smarty_function_icon(['_id' => $default, 'title' => $name], $smarty);
    }
    if ($avatar != '' && $show_tag == 'y') {
        $avatar = TikiLib::lib('user')->build_userinfo_tag($user, $avatar);
    }
    return $avatar;
}
Пример #12
0
 function render($name, $value, array $entry)
 {
     if ($name === 'tracker_status') {
         switch ($value) {
             case 'o':
                 $status = 'open';
                 break;
             case 'p':
                 $status = 'pending';
                 break;
             default:
             case 'c':
                 $status = 'closed';
                 break;
         }
         $smarty = TikiLib::lib('smarty');
         $smarty->loadPlugin('smarty_function_icon');
         return smarty_function_icon(['name' => 'status-' . $status, 'iclass' => 'tips', 'ititle' => ':' . ucfirst($status)], $smarty);
     } elseif (substr($name, 0, 14) !== 'tracker_field_') {
         return $value;
     }
     $tracker = Tracker_Definition::get($entry['tracker_id']);
     if (!is_object($tracker)) {
         return $value;
     }
     $field = $tracker->getField(substr($name, 14));
     // TextArea fields need the raw wiki syntax here for it to get wiki parsed if necessary
     if ($field['type'] === 'a' && isset($entry[$name . '_raw'])) {
         $value = $entry[$name . '_raw'];
     }
     $field['value'] = $value;
     $this->cancache = !in_array($field['type'], array('STARS', 's'));
     // don't cache ratings fields
     if ($this->editable) {
         // Caching breaks inline editing
         $this->cancache = false;
     }
     $item = array();
     if ($entry['object_type'] == 'trackeritem') {
         $item['itemId'] = $entry['object_id'];
     }
     $trklib = TikiLib::lib('trk');
     $rendered = $trklib->field_render_value(array('item' => $item, 'field' => $field, 'process' => 'y', 'search_render' => 'y', 'list_mode' => $this->list_mode, 'editable' => $this->editable, 'editgroup' => $this->group));
     return '~np~' . $rendered . '~/np~';
 }
Пример #13
0
 function renderInnerOutput($context = array())
 {
     $att_id = $this->getValue();
     if (empty($att_id)) {
         return '';
     }
     if ($context['list_mode'] === 'csv') {
         global $base_url;
         return $base_url . 'tiki-download_item_attachment.php?attId=' . $att_id;
         // should something to do with export_attachment() happen here?
     }
     $attachment = TikiLib::lib('trk')->get_item_attachment($att_id);
     $smarty = TikiLib::lib('smarty');
     $smarty->loadPlugin('smarty_block_self_link');
     $smarty->loadPlugin('smarty_function_icon');
     $link = smarty_block_self_link(array('_script' => 'tiki-download_item_attachment.php', 'attId' => $att_id), smarty_function_icon(array('_id' => 'disk', 'alt' => tra('Download')), $smarty) . ' ' . $attachment['filename'], $smarty);
     return $link;
 }
Пример #14
0
function smarty_block_add_help($params, $content, $smarty, &$repeat)
{
    global $prefs;
    global $help_sections;
    if (!isset($content)) {
        return;
    }
    if ($prefs['javascript_enabled'] != 'y') {
        return $content;
    }
    if (isset($params['title'])) {
        $section['title'] = $params['title'];
    }
    if (isset($params['id'])) {
        $section['id'] = $params['id'];
    } else {
        $section['id'] = $params['id'] = 'help_section_' . count($help_sections);
    }
    $section['content'] = $content;
    $help_sections[$params['id']] = $section;
    if (!isset($params['show']) or $params['show'] == 'y') {
        $smarty->loadPlugin('smarty_block_self_link');
        $smarty->loadPlugin('smarty_function_icon');
        $self_link_params['_alt'] = tra('Click for Help');
        $self_link_params['_ajax'] = 'n';
        $self_link_params['_anchor'] = $section['id'];
        $self_link_params['_title'] = $section['title'];
        $self_link_params['_class'] = 'help';
        $self_link_params['_onclick'] = '$.openEditHelp(' . (count($help_sections) - 1) . ');return false;';
        $link = '';
        if (empty($params['icononly']) || $params['icononly'] === 'n') {
            $link = $section['title'] . '&nbsp;';
        }
        $link .= smarty_function_icon(array('_id' => 'help'), $smarty);
        return smarty_block_self_link($self_link_params, $link, $smarty);
    } else {
        return;
    }
}
Пример #15
0
function help_doclink($params)
{
    global $prefs;
    extract($params);
    // Param = zone
    $ret = '';
    if (empty($url) && empty($desc) && empty($crumb)) {
        return;
    }
    if (!empty($crumb)) {
        $url = $crumb->helpUrl;
        $desc = $crumb->helpDescription;
    }
    if ($prefs['feature_help'] == 'y' and $url) {
        if (!isset($desc)) {
            $smarty = TikiLib::lib('smarty');
            $smarty->loadPlugin('smarty_function_icon');
            $desc = tra('Help link');
            $ret = '<a title="' . $url . '|' . htmlentities($desc, ENT_COMPAT, 'UTF-8') . '" href="' . $prefs['helpurl'] . $url . '" target="tikihelp" class="tikihelp btn btn-link">' . smarty_function_icon(array('name' => 'help'), $smarty) . '</a>';
        }
    }
    return $ret;
}
Пример #16
0
function smarty_function_show_sort($params, $smarty)
{
    global $url_path;
    if (isset($_REQUEST[$params['sort']])) {
        $p = $_REQUEST[$params['sort']];
    } elseif ($s = $smarty->getTemplateVars($params['sort'])) {
        $p = $s;
    }
    if (isset($params['sort']) and isset($params['var']) and isset($p)) {
        $prop = substr($p, 0, strrpos($p, '_'));
        $order = substr($p, strrpos($p, '_') + 1);
        if (strtolower($prop) == strtolower(trim($params['var']))) {
            $smarty->loadPlugin('smarty_function_icon');
            switch ($order) {
                case 'asc':
                case 'nasc':
                    return ' ' . smarty_function_icon(['name' => 'sort-up'], $smarty);
                case 'desc':
                case 'ndesc':
                    return ' ' . smarty_function_icon(['name' => 'sort-down'], $smarty);
            }
        }
    }
}
Пример #17
0
function wikiplugin_sign($data, $params, $offset)
{
    if (empty($params['datetime'])) {
        return false;
    }
    $user = isset($params['user']) ? $params['user'] : '';
    $time = strtotime($params['datetime']);
    if ($time === false) {
        return false;
    }
    $smarty = TikiLib::lib('smarty');
    $smarty->assign('sign', array('user' => $user, 'datetime' => $params['datetime'], 'time' => $time));
    $tip = $smarty->fetch('wiki-plugins/wikiplugin_sign.tpl');
    $smarty->loadPlugin('smarty_function_icon');
    $icon = smarty_function_icon(array('name' => 'pencil', 'title' => '', 'iclass' => 'wp-sign-icon'), $smarty);
    TikiLib::lib('header')->add_jq_onready('
	$(".wp-sign-icon").mouseenter(function () {
		$(this).next(".wp-sign").fadeIn("fast");
	}).mouseleave(function () {
		var $this = $(this);
		setTimeout(function () {$this.next(".wp-sign").fadeOut();}, 1000);
	});');
    return $icon . $tip;
}
Пример #18
0
 private function addCheckboxColumn($schema, $matching, $permName, $categId, $categName)
 {
     $smarty = TikiLib::lib('smarty');
     $smarty->loadPlugin('smarty_function_icon');
     $schema->addNew($permName, 'icon-' . $categId)->setLabel($categName)->addQuerySource('itemId', 'object_id')->addQuerySource('categories', 'categories')->setPlainReplacement('check-' . $categId)->setRenderTransform(function ($value, $extra) use($smarty, $matching, $categId) {
         $categories = $matching($extra);
         return in_array($categId, $categories) ? smarty_function_icon(['name' => 'success'], $smarty) : '';
     });
     $schema->addNew($permName, 'check-' . $categId)->setLabel($categName)->addIncompatibility($permName, 'id')->addIncompatibility($permName, 'name')->addIncompatibility($permName, 'multi-id')->addIncompatibility($permName, 'multi-name')->addQuerySource('itemId', 'object_id')->addQuerySource('categories', 'categories')->setRenderTransform(function ($value, $extra) use($matching, $categId) {
         $categories = $matching($extra);
         return in_array($categId, $categories) ? 'X' : '';
     })->setParseIntoTransform(function (&$info, $value) use($permName, $categId) {
         if (isset($info['fields'][$permName]) && !isset($info['fields'][$permName]['incremental'])) {
             // Looks like an other field took this over
             // Do nothing
             return;
         }
         // Queue updates to be handled by handleSave as we do not know
         // which item we are operating on at this stage
         if (!isset($info['fields'][$permName])) {
             $info['fields'][$permName]['incremental'] = ['+' => [], '-' => []];
         }
         $value = trim($value);
         if ($value == 'X' || $value == 'x') {
             $info['fields'][$permName]['incremental']['+'][] = $categId;
         } else {
             $info['fields'][$permName]['incremental']['-'][] = $categId;
         }
     });
 }
Пример #19
0
function wikiplugin_draw($data, $params)
{
    global $tiki_p_edit, $tiki_p_admin, $tiki_p_upload_files, $prefs, $user, $page;
    $headerlib = TikiLib::lib('header');
    $tikilib = TikiLib::lib('tiki');
    $smarty = TikiLib::lib('smarty');
    $filegallib = TikiLib::lib('filegal');
    $globalperms = Perms::get();
    extract(array_merge($params, array()), EXTR_SKIP);
    static $drawIndex = 0;
    ++$drawIndex;
    if (!isset($id)) {
        //check permissions
        if ($tiki_p_upload_files != 'y') {
            return;
        }
        $label = tra('Draw New SVG Image');
        $page = htmlentities($page);
        $content = htmlentities($data);
        $formId = "form{$drawIndex}";
        $gals = $filegallib->list_file_galleries(0, -1, 'name_desc', $user);
        $galHtml = "";
        if (!function_exists('wp_draw_cmp')) {
            function wp_draw_cmp($a, $b)
            {
                return strcmp(strtolower($a["name"]), strtolower($b["name"]));
            }
        }
        usort($gals['data'], 'wp_draw_cmp');
        foreach ($gals['data'] as $gal) {
            if ($gal['name'] != "Wiki Attachments" && $gal['name'] != "Users File Galleries") {
                $galHtml .= "<option value='" . $gal['id'] . "'>" . $gal['name'] . "</option>";
            }
        }
        $in = tr(" in ");
        $headerlib->add_jq_onready(<<<JQ
\t\t\t\$('#newDraw{$drawIndex}').submit(function() {
\t\t\t\tvar form = \$(this);
\t\t\t\tvar fields = form.serializeArray();
\t\t\t\t\$.wikiTrackingDraw = {
\t\t\t\t\tfileId: 0,
\t\t\t\t\tpage: '{$page}',
\t\t\t\t\tindex: '{$drawIndex}',
\t\t\t\t\tlabel: '{$label}',
\t\t\t\t\ttype: 'draw',
\t\t\t\t\tcontent: '',
\t\t\t\t\tparams: {
\t\t\t\t\t\twidth: '',
\t\t\t\t\t\theight: '',
\t\t\t\t\t\tid: 0 //this will be updated
\t\t\t\t\t}
\t\t\t\t};
\t\t\t\t\$.each(fields, function(i, field){
\t\t\t\t\tform.data(field.name.toLowerCase(), field.value);
\t\t\t\t});

\t\t\t\treturn form.ajaxEditDraw();
\t\t\t});
JQ
);
        return <<<EOF
\t\t~np~
\t\t<form id="newDraw{$drawIndex}" method="get" action="tiki-edit_draw.php">
\t\t\t<p>
\t\t\t\t<input type="submit" class="btn btn-default btn-sm" name="label" value="{$label}" class="newSvgButton" />{$in}
\t\t\t\t<select name="galleryId">
\t\t\t\t\t{$galHtml}
\t\t\t\t</select>
\t\t\t\t<input type="hidden" name="index" value="{$drawIndex}"/>
\t\t\t\t<input type="hidden" name="page" value="{$page}"/>
\t\t\t\t<input type="hidden" name="archive" value="{$archive}"/>
\t\t\t</p>
\t\t</form>
\t\t~/np~
EOF;
    }
    $fileInfo = $filegallib->get_file_info($id);
    //this sets the image to latest in a group of archives
    if (!isset($archive) || $archive != 'y') {
        if (!empty($fileInfo['archiveId']) && $fileInfo['archiveId'] > 0) {
            $id = $fileInfo['archiveId'];
            $fileInfo = $filegallib->get_file_info($id);
        }
    }
    if (!isset($fileInfo['created'])) {
        return tra("File not found.");
    } else {
        $globalperms = Perms::get(array('type' => 'file gallery', 'object' => $fileInfo['galleryId']));
        if ($globalperms->view_file_gallery != 'y') {
            return "";
        }
        $label = tra('Edit SVG Image');
        $ret = '<div type="image/svg+xml" class="svgImage pluginImg table-responsive' . $fileInfo['fileId'] . '" style="' . (isset($height) ? "height: {$height};" : "") . (isset($width) ? "width: {$width};" : "") . '">' . $fileInfo['data'] . '</div>';
        if ($globalperms->upload_files == 'y') {
            $smarty->loadPlugin('smarty_function_icon');
            $editicon = smarty_function_icon(['name' => 'edit'], $smarty);
            $ret .= "<a href='tiki-edit_draw.php?fileId={$id}&page={$page}&index={$drawIndex}&label={$label}" . (isset($width) ? "&width={$width}" : "") . (isset($height) ? "&height={$height}" : "") . "' onclick='return \$(this).ajaxEditDraw();'  title='Edit: " . $fileInfo['filename'] . "' data-fileid='" . $fileInfo['fileId'] . "' data-galleryid='" . $fileInfo['galleryId'] . "'>" . $editicon . "</a>";
        }
        return '~np~' . $ret . '~/np~';
    }
}
Пример #20
0
function smarty_function_object_link_default($smarty, $object, $title = null, $type = 'wiki page', $url = null, $params = array())
{
    global $base_url;
    $smarty->loadPlugin('smarty_modifier_sefurl');
    $smarty->loadPlugin('smarty_modifier_escape');
    $smarty->loadPlugin('smarty_modifier_addongroupname');
    if (empty($title)) {
        $title = TikiLib::lib('object')->get_title($type, $object);
    }
    if (empty($title) && !empty($params['backuptitle'])) {
        $title = $params['backuptitle'];
    }
    if (empty($title) && $type == 'freetag') {
        // Blank freetag should not be returned with "No title specified"
        return '';
    }
    // get add on object title if needed
    $title = smarty_modifier_addongroupname($title);
    $text = $title;
    $titleAttribute = '';
    if ($type == 'wiki page') {
        $titleAttribute .= ' title="' . smarty_modifier_escape($title) . '"';
        $text = TikiLib::lib('wiki')->get_without_namespace($title);
    }
    $escapedText = smarty_modifier_escape($text ? $text : tra('No title specified'));
    if ($url) {
        $escapedHref = smarty_modifier_escape(TikiLib::tikiUrlOpt($url));
    } else {
        $escapedHref = smarty_modifier_escape(smarty_modifier_sefurl($object, $type));
    }
    $classList = array();
    if ($type == "blog post") {
        $classList[] = "link";
    } elseif ($type == "freetag") {
        $classList[] = 'freetag';
    }
    $metadata = TikiLib::lib('object')->get_metadata($type, $object, $classList);
    if (!empty($params['class'])) {
        $classList[] = $params['class'];
    }
    $class = ' class="' . implode(' ', $classList) . '"';
    if (strpos($escapedHref, '://') === false) {
        //$html = '<a href="' . $base_url . $escapedHref . '"' . $class . $titleAttribute . $metadata . '>' . $escapedText . '</a>';
        // When the link is created for a tiki page, then we do NOT want the baseurl included,
        // because it might be we are using a reverse proxy or a an ssl offloader, or we access from a public fqdn that is not
        // configured for teh ip adress we run our webserver.
        // Eaxmple: Fqdn = tiki.mydomain.com -> port forwarding/nat to: 192.168.1.110.
        // In this case links should NOT be generated as absolut urls pointing to  192.168.1.110 which would be the part of the baseUrl.
        $html = '<a href="' . $escapedHref . '"' . $class . $titleAttribute . $metadata . '>' . $escapedText . '</a>';
    } else {
        $html = '<a rel="external" href="' . $escapedHref . '"' . $class . $titleAttribute . $metadata . '>' . $escapedText . '</a>';
    }
    $attributelib = TikiLib::lib('attribute');
    $attributes = $attributelib->get_attributes($type, $object);
    global $prefs;
    if (isset($attributes['tiki.content.source']) && $prefs['fgal_source_show_refresh'] == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $smarty->loadPlugin('smarty_function_service');
        $html .= '<a class="file-refresh" href="' . smarty_function_service(array('controller' => 'file', 'action' => 'refresh', 'fileId' => intval($object)), $smarty) . '">' . smarty_function_icon(array('_id' => 'arrow_refresh'), $smarty) . '</a>';
        TikiLib::lib('header')->add_js('
			$(".file-refresh").removeClass("file-refresh").click(function () {
			$.getJSON($(this).attr("href"));
			$(this).remove();
			return false;
		});');
    }
    return $html;
}
Пример #21
0
function wikiplugin_annotation($data, $params)
{
    global $page, $tiki_p_edit;
    $headerlib = TikiLib::lib('header');
    $defaults = array();
    $plugininfo = wikiplugin_annotation_info();
    foreach ($plugininfo['params'] as $key => $param) {
        $defaults["{$key}"] = $param['default'];
    }
    $params = array_merge($defaults, $params);
    $annotations = array();
    foreach (explode("\n", $data) as $line) {
        $line = trim($line);
        if (empty($line)) {
            continue;
        }
        if (preg_match("/^\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*,\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)(.*)\\[(.*)\\]\$/", $line, $parts)) {
            $parts = array_map('trim', $parts);
            list($full, $x1, $y1, $x2, $y2, $label, $target) = $parts;
            $annotations[] = array('x1' => $x1, 'y1' => $y1, 'x2' => $x2, 'y2' => $y2, 'value' => $label, 'target' => $target);
        }
    }
    $annotations = json_encode($annotations);
    $headerlib->add_jsfile('lib/jquery_tiki/wikiplugin-annotation.js');
    static $uid = 0;
    $uid++;
    $cid = 'container-annotation-' . $uid;
    $labelSave = tra('Save changes to annotations');
    $message = tra('Image annotations changed.');
    if ($tiki_p_edit == 'y') {
        $editableStr = tra('Editable');
        $form = <<<FORM
<form method="post" action="tiki-wikiplugin_edit.php" class="form save-annotations">
\t<div style="display:none">
\t\t<input type="hidden" name="page" value="{$page}"/>
\t\t<input type="hidden" name="type" value="annotation"/>
\t\t<input type="hidden" name="index" value="{$uid}"/>
\t\t<input type="hidden" name="message" value="{$message}"/>
\t\t<textarea id="{$cid}-content" name="content"></textarea>
\t</div>
\t<div class="form-group">
\t\t<input type="submit" class="btn btn-default btn-sm" value="{$labelSave}"/>
\t\t<label>
\t\t\t<input type="checkbox" id="{$cid}-editable">
\t\t\t{$editableStr}
\t\t</label>
\t</div>
</form>
FORM;
    } else {
        $form = '';
    }
    // inititalise the annotations
    $showlink = $params['showlink'] === 'y' ? 'true' : 'false';
    $headerlib->add_jq_onready('$("#' . $cid . '").imageAnnotation(' . $annotations . ', ' . $showlink . ');');
    $smarty = TikiLib::lib('smarty');
    $smarty->loadPlugin('smarty_function_icon');
    $close = smarty_function_icon(['name' => 'close'], $smarty);
    $delete = smarty_function_icon(['name' => 'trash'], $smarty);
    $labelStr = tra('Label');
    $linkStr = tra('Link');
    $saveStr = tra('Save');
    $closeStr = tra('Close');
    $removeStr = tra('Remove');
    if ($tiki_p_edit == 'y') {
        $editor_form = <<<EDITORFORM
\t\t<div class="editor panel">
\t\t\t<div class="panel-body">
\t\t\t\t<form method="post" action="#" class="form-horizontal">
\t\t\t\t\t<div class="form-group">
\t\t\t\t\t\t<label style="width:100%">
\t\t\t\t\t\t\t<span class="col-sm-3">{$labelStr}</span>
\t\t\t\t\t\t\t<span class="col-sm-9"><textarea name="label" class="form-control"></textarea></span>
\t\t\t\t\t\t</label>
\t\t\t\t\t</div>
\t\t\t\t\t<div class="form-group">
\t\t\t\t\t\t<label style="width:100%">
\t\t\t\t\t\t\t<span class="col-sm-3">{$linkStr}</span>
\t\t\t\t\t\t\t<span class="col-sm-9"><input type="text" name="link" class="form-control"></span>
\t\t\t\t\t\t</label>
\t\t\t\t\t</div>
\t\t\t\t\t<div class="form-group">
\t\t\t\t\t\t<div class="col-sm-9 col-sm-offset-3">
\t\t\t\t\t\t\t<input type="submit" class="btn btn-default btn-sm" value="{$saveStr}">
\t\t\t\t\t\t\t<div class="pull-right">
\t\t\t\t\t\t\t\t<a class="btn btn-default btn-sm minimize" href="#" title="{$closeStr}">{$close}</a>
\t\t\t\t\t\t\t\t<a class="btn btn-default btn-sm delete" href="#" title="{$removeStr}">{$delete}</a>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</form>
\t\t\t</div>
\t\t</div>
EDITORFORM;
    } else {
        $editor_form = '';
    }
    if ($params['showlist'] === 'y') {
        $list_div = '<div class="list-box"><div>';
    } else {
        $list_div = '';
    }
    return <<<ANNOTATION
<div class="wp-annotation {$params['class']}">
\t<div id="{$cid}" style="background:url({$params['src']}); width:{$params['width']}px; height:{$params['height']}px;">
{$editor_form}
\t</div>
\t{$list_div}
\t{$form}
</div>
ANNOTATION;
}
Пример #22
0
 /**
  * @param $score
  * @return string
  */
 function get_star($score)
 {
     global $prefs;
     $star = '';
     $star_colors = array(0 => 'grey', 100 => 'blue', 500 => 'green', 1000 => 'yellow', 2500 => 'orange', 5000 => 'red', 10000 => 'purple');
     foreach ($star_colors as $boundary => $color) {
         if ($score >= $boundary) {
             $star = 'star_' . $color . '.gif';
         }
     }
     if (!empty($star)) {
         $alt = sprintf(tra("%d points"), $score);
         if ($prefs['theme_iconset'] === 'legacy') {
             $star = "<img src='img/icons/{$star}' height='11' width='11' alt='{$alt}' />&nbsp;";
         } else {
             $smarty = TikiLib::lib('smarty');
             $smarty->loadPlugin('smarty_function_icon');
             $star = smarty_function_icon(['name' => 'star', 'istyle' => 'color:' . $color, 'iclass' => 'tips', 'ititle' => ':' . $alt], $smarty) . "&nbsp;";
         }
     }
     return $star;
 }
Пример #23
0
function wikiplugin_icon($data, $params)
{
    $smarty = TikiLib::lib('smarty');
    $smarty->loadPlugin('smarty_function_icon');
    return smarty_function_icon($params, $smarty);
}
Пример #24
0
function smarty_function_treetable($params, $smarty)
{
    global $headerlib, $tree_table_id, $prefs;
    extract($params);
    $_emptyDataMessage = empty($_emptyDataMessage) ? tra('No rows found') : $_emptyDataMessage;
    if (empty($_data)) {
        return $_emptyDataMessage;
    }
    $_checkbox = empty($_checkbox) ? '' : $_checkbox;
    $_checkboxTitles = empty($_checkboxTitles) ? '' : $_checkboxTitles;
    $_openall = isset($_openall) ? $_openall : 'n';
    $_showSelected = isset($_showSelected) ? $_showSelected : 'n';
    $_selectAllHiddenToo = isset($_selectAllHiddenToo) ? $_selectAllHiddenToo : 'n';
    if (is_string($_checkbox) && strpos($_checkbox, ',') !== false) {
        $_checkbox = preg_split('/,/', trim($_checkbox));
    }
    if (!empty($_checkboxColumnIndex)) {
        if (is_string($_checkboxColumnIndex) && strpos($_checkboxColumnIndex, ',') !== false) {
            $_checkboxColumnIndex = preg_split('/,/', trim($_checkboxColumnIndex));
        }
        if (count($_checkbox) != count($_checkboxColumnIndex)) {
            return 'Number of items in _checkboxColumnIndex doesn not match items in _checkbox';
        }
    }
    if (!empty($_checkboxTitles)) {
        if (is_string($_checkboxTitles)) {
            if (strpos($_checkboxTitles, ',') !== false) {
                $_checkboxTitles = preg_split('/,/', trim($_checkboxTitles));
            } else {
                $_checkboxTitles = array(trim($_checkboxTitles));
            }
        }
        if (count($_checkbox) != count($_checkboxTitles)) {
            return 'Number of items in _checkboxTitles doesn not match items in _checkbox';
        }
    }
    $_checkboxColumnIndex = empty($_checkboxColumnIndex) ? 0 : $_checkboxColumnIndex;
    $_valueColumnIndex = empty($_valueColumnIndex) ? 0 : $_valueColumnIndex;
    if (!empty($_checkbox) && !is_array($_checkbox)) {
        $_checkbox = array($_checkbox);
        $_checkboxColumnIndex = array($_checkboxColumnIndex);
    }
    $_columnsContainHtml = isset($_columnsContainHtml) ? $_columnsContainHtml : 'n';
    $html = '';
    $nl = "\n";
    // some defaults
    $_listFilter = empty($_listFilter) ? 'y' : $_listFilter;
    $_filterMinRows = empty($_filterMinRows) ? 12 : $_filterMinRows;
    $_collapseMaxSections = empty($_collapseMaxSections) ? 4 : $_collapseMaxSections;
    $_rowClasses = !isset($_rowClasses) ? array('odd', 'even') : (is_array($_rowClasses) ? $_rowClasses : array($_rowClasses));
    if (!empty($_rowClasses)) {
        $oddEvenCounter = 0;
    } else {
        $oddEvenCounter = -1;
    }
    // auto-increment val for unique id's etc
    if (empty($id)) {
        if (!isset($tree_table_id)) {
            $tree_table_id = 1;
        } else {
            $tree_table_id++;
        }
        $id = 'treetable_' . $tree_table_id;
    }
    // TODO - check this? add key/val pairs?
    if (empty($_columns)) {
        $keys = array_keys($_data[0]);
        $_columns = array();
        foreach ($keys as $key) {
            if (!is_numeric($key)) {
                $_columns[$key] = htmlspecialchars($key);
            }
        }
    } else {
        if (is_string($_columns)) {
            $ar = preg_split('/,/', $_columns);
            $_columns = array();
            foreach ($ar as $str) {
                $ar2 = preg_split('/=/', trim($str));
                $_columns[trim($ar2[0], ' "')] = trim($ar2[1], ' "');
            }
            unset($ar, $ar2);
        }
    }
    $_sortColumn = empty($_sortColumn) ? '' : $_sortColumn;
    $_groupColumn = empty($_groupColumn) ? '' : $_groupColumn;
    if ($_sortColumn) {
        sort2d($_data, $_sortColumn);
    } elseif ($_groupColumn) {
        sort2d($_data, $_groupColumn, false);
        $_sortColumn = $_groupColumn;
    }
    $class = empty($class) ? 'treetable' : $class;
    // treetable
    /*
    	if ($prefs['feature_jquery_tablesorter'] == 'y' && strpos($class, 'sortable') === false) {
    		 //$class .= ' sortable';
    	}
    */
    if ($_listFilter == 'y' && count($_data) > $_filterMinRows) {
        $smarty->loadPlugin('smarty_function_listfilter');
        $html .= smarty_function_listfilter(array('id' => $id . '_filter', 'selectors' => "#{$id} tbody tr", 'parentSelector' => "#{$id} .collapsed, #{$id} .expanded", 'exclude' => ".subHeader"), $smarty);
    }
    if ($_openall == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $html .= '&nbsp;<label id="' . $id . '_openall">' . smarty_function_icon(array('_id' => 'folder', 'title' => tra('Toggle sections')), $smarty) . ' ' . tra('Toggle sections') . '</label>';
        $headerlib->add_jq_onready('
$("#' . $id . '_openall").click( function () {
	$this = $(this).modal(" ");
	var img = $("img:first", this)[0];
	if (img.src.indexOf("ofolder.png") > -1) {

		$(".expanded .indenter", "#' . $id . '").eachAsync({
			delay: 20,
			bulk: 0,
			loop: function () {
				$(this).click();
			},
			end: function ()  {
				$this.modal();
			}
		});
		img.src = img.src.replace("ofolder", "folder");
	} else {
		$(".collapsed .indenter", "#' . $id . '").eachAsync({
			delay: 20,
			bulk: 0,
			loop: function () {
				$(this).click();
			},
			end: function ()  {
				$this.modal();
			}
		});
		img.src = img.src.replace("folder", "ofolder");
	}
	return false;
});');
    }
    if ($_showSelected == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $html .= ' <input type="checkbox" id="' . $id . '_showSelected" title="' . tra('Show only selected') . '" />';
        $html .= ' <label for="' . $id . '_showSelected">' . tra('Show only selected') . '</label>';
        $headerlib->add_jq_onready('
$("#' . $id . '_showSelected").click( function () {
	if (!$(this).prop("checked")) {
		$("#treetable_1 tr td.checkBoxCell input:checkbox").parent().parent().show()
	} else {
		$("#treetable_1 tr td.checkBoxCell input:checkbox").parent().parent().hide()
		$("#treetable_1 tr td.checkBoxCell input:checked").parent().parent().show()
	}
});');
    }
    // start writing the table
    $html .= $nl . '<table id="' . $id . '" class="' . $class . '">' . $nl;
    // write the table header
    $html .= '<thead><tr>';
    if (!empty($_checkbox)) {
        $smarty->loadPlugin('smarty_function_select_all');
        for ($i = 0, $icount_checkbox = count($_checkbox); $i < $icount_checkbox; $i++) {
            $html .= '<th class="checkBoxHeader">';
            $html .= smarty_function_select_all(array('checkbox_names' => array($_checkbox[$i] . '[]'), 'label' => empty($_checkboxTitles) ? '' : htmlspecialchars($_checkboxTitles[$i]), 'hidden_too' => $_selectAllHiddenToo), $smarty);
            $html .= '</th>';
        }
    }
    foreach ($_columns as $column => $columnName) {
        $html .= '<th>';
        $html .= htmlspecialchars($columnName);
        $html .= '</th>';
    }
    $html .= '</tr></thead>' . $nl;
    $html .= '<tbody>' . $nl;
    $treeSectionsAdded = array();
    $rowCounter = 1;
    // for each row
    foreach ($_data as &$row) {
        // set up tree hierarchy
        if ($_sortColumn) {
            $treeType = htmlspecialchars(trim($row[$_sortColumn]));
            $childRowClass = '';
            if (!empty($_sortColumnDelimiter)) {
                // nested
                $parts = array_reverse(explode($_sortColumnDelimiter, $treeType));
                for ($i = 0, $icount_parts = count($parts); $i < $icount_parts; $i++) {
                    $part = preg_replace('/\\s+/', '_', $parts[$i]);
                    if (in_array($part, $treeSectionsAdded) && $i > 0) {
                        $treeParentId = preg_replace('/\\s+/', '_', $parts[$i]);
                        $tt_parent_id = $id . '_' . $treeParentId;
                        break;
                    } else {
                        $tt_parent_id = '';
                    }
                }
                $treeTypeId = preg_replace('/\\s+/', '_', $parts[0]);
                $tt_id = $id . '_' . $treeTypeId;
                $treeSectionsAdded[] = $treeTypeId;
            } else {
                $treeTypeId = preg_replace('/\\s+/', '_', $treeType);
                $tt_parent_id = $id . '_' . $treeTypeId;
                $tt_id = 'child_of_' . $id . '_' . $treeTypeId . '_' . $oddEvenCounter;
                if (!empty($treeType) && !in_array($treeTypeId, $treeSectionsAdded)) {
                    $html .= '<tr data-tt-id="' . $tt_parent_id . '"><td colspan="' . (count($_columns) + count($_checkbox)) . '">';
                    $html .= $treeType . '</td></tr>' . $nl;
                    // Courtesy message to help category perms configurators
                    if ($treeType == 'category') {
                        $html .= '<tr class="' . $childRowClass . '" data-tt-parent-id="' . $tt_parent_id . '" data-tt-id="cat_subHeader_' . $rowCounter . '">' . '<td colspan="' . (count($_columns) + count($_checkbox)) . '">';
                        $html .= '<em>' . tra('You might want to also set the tiki_p_modify_object_categories permission under the tiki section') . '</em></td></tr>' . $nl;
                    }
                    $treeSectionsAdded[] = $treeTypeId;
                    // write a sub-header
                    $html .= '<tr data-tt-id="subHeader_' . $rowCounter . '" data-tt-parent-id="' . $tt_parent_id . '" class="subHeader' . $childRowClass . '">';
                    if (!empty($_checkbox)) {
                        for ($i = 0, $icount_checkbox = count($_checkbox); $i < $icount_checkbox; $i++) {
                            $html .= '<td class="checkBoxHeader">';
                            $html .= empty($_checkboxTitles) ? '' : htmlspecialchars($_checkboxTitles[$i]);
                            $html .= '</td>';
                        }
                    }
                    foreach ($_columns as $column => $columnName) {
                        $html .= '<td>';
                        $html .= htmlspecialchars($columnName);
                        $html .= '</td>';
                    }
                    $html .= '</tr>' . $nl;
                }
            }
        } else {
            $childRowClass = '';
            $tt_parent_id = '';
            $tt_id = '';
        }
        // work out row class (odd/even etc)
        if ($oddEvenCounter > -1) {
            $rowClass = $_rowClasses[$oddEvenCounter % 2] . $childRowClass;
            $oddEvenCounter++;
        } else {
            $rowClass = $childRowClass;
        }
        $html .= '<tr data-tt-id="' . $tt_id . '"' . (!empty($tt_parent_id) ? ' data-tt-parent-id="' . $tt_parent_id . '"' : '') . ' class="' . $rowClass . '">';
        // add the checkbox
        if (!empty($_checkbox)) {
            for ($i = 0, $icount_checkbox = count($_checkbox); $i < $icount_checkbox; $i++) {
                // get checkbox's "value"
                $cbxVal = htmlspecialchars($row[$_checkboxColumnIndex[$i]]);
                $rowVal = htmlspecialchars($row[$_valueColumnIndex]);
                $cbxTit = empty($_checkboxTitles) ? $cbxVal : htmlspecialchars($_checkboxTitles[$i]);
                $html .= '<td class="checkBoxCell" style="white-space: nowrap;">';
                $html .= '<input type="checkbox" name="' . htmlspecialchars($_checkbox[$i]) . '[]" value="' . $rowVal . '"' . ($cbxVal == 'y' ? ' checked="checked"' : '') . ' title="' . $cbxTit . '" />';
                if ($cbxVal == 'y') {
                    $html .= '<input type="hidden" name="old_' . htmlspecialchars($_checkbox[$i]) . '[]" value="' . $rowVal . '" />';
                }
                $html .= '</td>';
            }
        }
        foreach ($_columns as $column => $columnName) {
            $html .= '<td>';
            if ($_columnsContainHtml != 'y') {
                $html .= htmlspecialchars($row[$column]);
            } else {
                $html .= $row[$column];
            }
            $html .= '</td>' . $nl;
        }
        $html .= '</tr>' . $nl;
        $rowCounter++;
    }
    $html .= '</tbody></table>' . $nl;
    // add jq code to initial treetable
    $expanable = empty($_sortColumnDelimiter) ? 'true' : 'false';
    // when nested, clickableNodeNames is really annoying
    if (count($treeSectionsAdded) < $_collapseMaxSections) {
        $headerlib->add_jq_onready('$("#' . $id . '").treetable({clickableNodeNames:' . $expanable . ',initialState: "expanded", expandable:true});');
    } else {
        $headerlib->add_jq_onready('$("#' . $id . '").treetable({clickableNodeNames:' . $expanable . ',initialState: "collapsed", expandable:true});');
    }
    // TODO refilter when .parent is opened - seems to prevent the click propagating
    //		$headerlib->add_jq_onready('$("tr.parent").click(function(event) {
    //if ($("#'.$id.'_filter").val()) {
    //	$("#'.$id.'_filter").trigger("keyup");
    //	if (event.isPropagationStopped() || event.isImmediatePropagationStopped()) {
    //		$(this).trigger("click");
    //	}
    //}
    //		});');
    return $html;
}
Пример #25
0
function smarty_function_object_link_default($smarty, $object, $title = null, $type = 'wiki page', $url = null)
{
    global $base_url;
    $smarty->loadPlugin('smarty_modifier_sefurl');
    $smarty->loadPlugin('smarty_modifier_escape');
    if (empty($title)) {
        $title = TikiLib::lib('object')->get_title($type, $object);
    }
    if (empty($title) && $type == 'freetag') {
        // Blank freetag should not be returned with "No title specified"
        return '';
    }
    $text = $title;
    $titleAttribute = '';
    if ($type == 'wiki page') {
        $titleAttribute .= ' title="' . smarty_modifier_escape($title) . '"';
        $text = TikiLib::lib('wiki')->get_without_namespace($title);
    }
    $escapedText = smarty_modifier_escape($text ? $text : tra('No title specified'));
    if ($url) {
        $escapedHref = smarty_modifier_escape($url);
    } else {
        $escapedHref = smarty_modifier_escape(smarty_modifier_sefurl($object, $type));
    }
    $classList = array();
    if ($type == "blog post") {
        $classList[] = "link";
    } elseif ($type == "freetag") {
        $classList[] = 'freetag';
    }
    $metadata = TikiLib::lib('object')->get_metadata($type, $object, $classList);
    $class = ' class="' . implode(' ', $classList) . '"';
    $html = '<a href="' . $base_url . $escapedHref . '"' . $class . $titleAttribute . $metadata . '>' . $escapedText . '</a>';
    $attributelib = TikiLib::lib('attribute');
    $attributes = $attributelib->get_attributes($type, $object);
    global $prefs;
    if (isset($attributes['tiki.content.source']) && $prefs['fgal_source_show_refresh'] == 'y') {
        $smarty->loadPlugin('smarty_function_icon');
        $smarty->loadPlugin('smarty_function_service');
        $html .= '<a class="file-refresh" href="' . smarty_function_service(array('controller' => 'file', 'action' => 'refresh', 'fileId' => intval($object)), $smarty) . '">' . smarty_function_icon(array('_id' => 'arrow_refresh'), $smarty) . '</a>';
        TikiLib::lib('header')->add_js('
			$(".file-refresh").removeClass("file-refresh").click(function () {
			$.getJSON($(this).attr("href"));
			$(this).remove();
			return false;
		});');
    }
    return $html;
}
Пример #26
0
function smarty_block_pagination_links($params, $url, $smarty, &$repeat)
{
    global $prefs;
    if ($repeat) {
        return;
    }
    if (isset($params['resultset'])) {
        $resultSet = $params['resultset'];
        $params['cant'] = count($resultSet);
        $params['offset'] = $resultSet->getOffset();
        $params['step'] = $resultSet->getMaxRecords();
        $params['estimate'] = $resultSet->getEstimate();
    }
    $html = '';
    $default_type = 'absolute_path';
    // Check main params and return no pagination links if there is a mistake
    if (!isset($params['cant']) || $params['cant'] <= 0) {
        return '';
    }
    if (isset($params['step']) && $params['step'] == -1) {
        return '';
    }
    // display all
    if (!isset($params['offset'])) {
        $params['offset'] = 0;
    }
    if (!isset($params['offset_arg'])) {
        $params['offset_arg'] = 'offset';
    }
    if (!isset($params['zero_based_offset'])) {
        $params['zero_based_offset'] = 'y';
    }
    if (!isset($params['show_numbers'])) {
        $params['show_numbers'] = 'y';
    }
    if (!isset($params['_onclick'])) {
        $params['_onclick'] = '';
    }
    if ($params['zero_based_offset'] != 'y') {
        //$params['offset']--;
        $zero_based_min = 1;
        $zero_based_maxminus = 0;
    } else {
        $zero_based_min = 0;
        $zero_based_maxminus = 1;
    }
    $params['_ajax'] = isset($params['_ajax']) ? $params['_ajax'] : 'y';
    if (isset($params['reloff']) && ($params['reloff'] + $params['offset'] >= $params['cant'] || $params['reloff'] + $params['offset'] < $zero_based_min)) {
        return '';
    }
    if (!isset($params['reloff']) && ($params['offset'] >= $params['cant'] + $zero_based_min || $params['offset'] < $zero_based_min)) {
        return '';
    }
    // Include smarty functions used below
    $smarty->loadPlugin('smarty_block_ajax_href');
    $smarty->loadPlugin('smarty_function_query');
    $smarty->loadPlugin('smarty_function_icon');
    // Make sure every params are initialized
    if (!isset($params['itemname'])) {
        $params['itemname'] = 'Page';
    }
    if (!isset($params['noimg'])) {
        $params['noimg'] = $prefs['pagination_icons'] == 'n' ? 'y' : 'n';
    }
    if (!isset($params['usedots'])) {
        $params['usedots'] = 'y';
    }
    if (!isset($params['class'])) {
        $params['class'] = 'mini';
    }
    if (!isset($params['htmlelement'])) {
        $params['htmlelement'] = 'tiki-center';
    }
    if (!isset($params['template'])) {
        $params['template'] = basename($_SERVER['PHP_SELF'], '.php') . '.tpl';
        if ($params['template'] == 'tiki-index.tpl') {
            $params['template'] = 'tiki-show_page.tpl';
        }
    }
    if (!file_exists('templates/' . $params['template']) || $params['template'] == 'noauto') {
        $params['htmlelement'] = '';
        $params['template'] = '';
    }
    if (!isset($params['step']) || $params['step'] <= 0) {
        $params['step'] = 1;
        $nb_pages = $params['cant'];
    } else {
        $nb_pages = ceil($params['cant'] / $params['step']);
    }
    if ($nb_pages == 0 || $nb_pages == 1 && $prefs['pagination_hide_if_one_page'] == 'y') {
        return '';
    }
    if (empty($url) || preg_match('/^\\s*$/', $url)) {
        $query_filter = array('_type' => $default_type);
        if (isset($params['_keepall'])) {
            $query_filter['_keepall'] = $params['_keepall'];
        }
        $url = smarty_function_query($query_filter, $smarty);
    }
    // remove empty url arguments (done by default)
    if (!isset($params['clean']) || $params['clean'] == 'y') {
        $url = preg_replace('/(?<=\\?|&amp;)[^=]+=(?=&amp;|$)/U', '', $url);
    }
    // remove old arguments that will be replaced and add new ones
    $url = preg_replace('/(?<=&amp;|&|\\?)(move|reloff|' . $params['offset_arg'] . ')=[^&]*/', '', trim($url));
    // remove &amp; that are redundant or at the end of url
    $url = preg_replace('/(?:(\\?|&amp;)(&amp;)+|(\\?|&amp;))$/', '\\1', $url);
    $url_args_pos = strpos($url, '?');
    if ($url_args_pos === false) {
        $url .= '?';
    } elseif ($url_args_pos < strlen($url) - 1) {
        $url .= '&amp;';
    }
    if (isset($params['reloff'])) {
        $prev_offset = 'reloff=' . ($params['reloff'] - $params['step']) . '&amp;' . $params['offset_arg'] . '=' . $params['offset'];
        $next_offset = 'reloff=' . ($params['reloff'] + $params['step']) . '&amp;' . $params['offset_arg'] . '=' . $params['offset'];
        $prev_fast_offset = 'reloff=' . ($params['reloff'] - $params['step'] * ceil($nb_pages / 10)) . '&amp;' . $params['offset_arg'] . '=' . $params['offset'];
        $next_fast_offset = 'reloff=' . ($params['reloff'] + $params['step'] * ceil($nb_pages / 10)) . '&amp;' . $params['offset_arg'] . '=' . $params['offset'];
        $real_offset = $params['offset'] + $params['reloff'];
    } else {
        $prev_offset_val = max($zero_based_min, $params['offset'] - $params['step']);
        $prev_offset = $params['offset_arg'] . '=' . $prev_offset_val;
        $next_offset_val = min($params['cant'] - $zero_based_maxminus, $params['offset'] + $params['step']);
        $next_offset = $params['offset_arg'] . '=' . $next_offset_val;
        $prev_fast_offset_val = max($zero_based_min, $params['offset'] - $params['step'] * ceil($nb_pages / 10));
        $prev_fast_offset = $params['offset_arg'] . '=' . $prev_fast_offset_val;
        $next_fast_offset_val = min($params['cant'] - $zero_based_maxminus, $params['offset'] + $params['step'] * ceil($nb_pages / 10));
        $next_fast_offset = $params['offset_arg'] . '=' . $next_fast_offset_val;
        $real_offset = $params['offset'];
    }
    if (!isset($params['next'])) {
        $params['next'] = $real_offset < ($nb_pages - $zero_based_maxminus) * $params['step'] ? 'y' : 'n';
    }
    if (!isset($params['prev'])) {
        $params['prev'] = $real_offset > $zero_based_min ? 'y' : 'n';
    }
    // Max. number of links when using direct pagination
    $max_middle_links = max(0, $prefs['direct_pagination_max_middle_links']);
    $max_ending_links = $prefs['pagination_firstlast'] != 'n' ? max(0, $prefs['direct_pagination_max_ending_links']) : 0;
    $max_links = (1 + $max_ending_links + $max_middle_links) * 2 + 1;
    // Handle next/prev images
    if ($params['noimg'] == 'n') {
        $tmp = array('first' => tr("First %0", $params['itemname']), 'last' => tr("Last %0", $params['itemname']), 'next' => tr("Next %0", $params['itemname']), 'previous' => tr("Prev %0", $params['itemname']), 'next_fast' => tra('Fast Next'), 'previous_fast' => tra('Fast Prev'));
        $images = array();
        foreach ($tmp as $ik => $iv) {
            $images[$ik] = smarty_function_icon(array('_id' => 'resultset_' . $ik, 'alt' => $iv, 'style' => 'vertical-align:middle;'), $smarty);
        }
        unset($tmp);
    }
    if ($params['cant'] > 0) {
        $make_prevnext_link = function ($url, $content, $params, $class = 'prevnext', $linkoffset) {
            $smarty = TikiLib::lib('smarty');
            $link = '<a class="' . $class . '" ';
            $url = TikiLib::tikiUrlOpt($url);
            if ($params['_ajax'] == 'y') {
                // setting javascript offset variable if requested
                if (!empty($params['offset_jsvar'])) {
                    $params['_onclick'] = $params['offset_jsvar'] . "={$linkoffset};" . $params['_onclick'];
                }
                $link .= smarty_block_ajax_href(array('template' => $params['template'], 'htmlelement' => $params['htmlelement'], '_ajax' => $params['_ajax'], '_onclick' => $params['_onclick']), $url, $smarty, false);
            } else {
                $link .= " href=\"{$url}\" ";
            }
            $link .= '>' . $content . '</a>';
            return $link;
        };
        if (($prefs['direct_pagination'] == 'y' || $prefs['nextprev_pagination'] === 'y') && $nb_pages > 1) {
            $html .= '<ul class="pagination">';
            if ($prefs['nextprev_pagination'] != 'n' || $params['show_numbers'] !== 'y') {
                if ($params['offset'] == 0) {
                    $html .= '<li class="disabled"><span>&laquo;</span></li>';
                } else {
                    $html .= '<li>' . $make_prevnext_link($url . $prev_offset, '&laquo;', $params, 'prevnext prev', $prev_offset_val) . '</li>';
                }
            }
            if ($params['show_numbers'] == 'y') {
                $last_dots = false;
                $page_num = floor($real_offset / $params['step']);
                foreach (range(0, $nb_pages - 1) as $k) {
                    if ($k + $zero_based_min == $page_num) {
                        $html .= '<li class="active"><span>' . ($k + 1) . ' <span class="sr-only">(' . tr('current') . ')</span></span></li>';
                        $last_dots = false;
                    } elseif ($params['usedots'] != 'y' || $params['usedots'] == 'y' && ($nb_pages <= $max_links || $k <= $max_ending_links && $prefs['pagination_firstlast'] != 'n' || $k >= $nb_pages - $max_ending_links - 1 && $prefs['pagination_firstlast'] != 'n' || abs($page_num - $k) <= $max_middle_links || $prefs['pagination_fastmove_links'] == 'y' && abs($page_num - $k) == ceil($nb_pages / 10))) {
                        if (isset($params['reloff'])) {
                            $url_k = $params['offset_arg'] . '=' . $params['offset'] . '&amp;reloff=' . ($params['step'] * $k - $params['offset']);
                        } else {
                            $url_k_val = $params['step'] * ($k + $zero_based_min);
                            $url_k = $params['offset_arg'] . '=' . $url_k_val;
                        }
                        $html .= '<li>' . $make_prevnext_link($url . $url_k, $k + 1, $params, 'prevnext', $url_k_val) . '</li>';
                        $last_dots = false;
                    } elseif (!$last_dots) {
                        $html .= '<li class="disabled"><span>&hellip;</span>';
                        $last_dots = true;
                    }
                }
            }
            if ($prefs['nextprev_pagination'] != 'n' || $params['show_numbers'] !== 'y') {
                if ($params['offset'] + $params['step'] >= $params['cant']) {
                    $html .= '<li class="disabled"><span>&raquo;</span></li>';
                } else {
                    $html .= '<li>' . $make_prevnext_link($url . $next_offset, '&raquo;', $params, 'prevnext next', $next_offset_val) . '</li>';
                }
            }
            $html .= '</ul>';
        }
        if (isset($params['estimate']) && $params['estimate'] > $params['cant']) {
            $html .= '<div class="alert alert-info">' . tr('More results may be available. Refine criteria to access the estimated %0 results.', $params['estimate']) . '</div>';
        }
    }
    return $html;
}
Пример #27
0
/**
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     modifier
 * Name:     iconify
 * Purpose:  Returns a filetype icon or file type
 * -------------------------------------------------------------
 *
 * @param $string               File name with extension
 * @param null $filetype        File type
 * @param null $fileId          File id when using file galleries
 * @param int $size             Icon size
 * @param string $return        icon or filtype
 * @return null|string
 * @throws Exception
 * @throws SmartyException
 */
function smarty_modifier_iconify($string, $filetype = null, $fileId = null, $size = 1, $return = 'icon')
{
    $smarty = TikiLib::lib('smarty');
    global $prefs;
    $smarty->loadPlugin('smarty_function_icon');
    $icon = '';
    $ext = strtolower(substr($string, strrpos($string, '.') + 1));
    if ($fileId && substr($filetype, 0, 6) == 'image/') {
        // Special handling for file gallery images,
        // display thumbnail
        $smarty->loadPlugin('smarty_modifier_sefurl');
        $smarty->loadPlugin('smarty_modifier_escape');
        $icon = smarty_modifier_sefurl($fileId, 'thumbnail');
        $icon = smarty_modifier_escape($icon);
        return "<img src=\"{$icon}\" width=\"16\"/>";
    } else {
        include_once 'lib/mime/mimetypes.php';
        global $mimetypes;
        $mimes = array_keys($mimetypes, $filetype);
        if ($prefs['theme_iconset'] === 'legacy') {
            if (file_exists("img/icons/mime/{$ext}.png")) {
                $icon = $ext;
            } elseif (file_exists('img/icons/mime/' . substr($ext, 0, 3) . '.png')) {
                $icon = substr($ext, 0, 3);
            } else {
                foreach ($mimes as $m) {
                    if (file_exists("img/icons/mime/{$m}.png")) {
                        $icon = $m;
                    }
                }
                if (empty($icon)) {
                    $icon = 'default';
                }
            }
            if ($return === 'filetype') {
                return $m;
            } elseif ($return === 'icon') {
                return smarty_function_icon(array('_id' => 'img/icons/mime/' . $icon . '.png', 'alt' => $filetype === null ? $icon : $filetype, 'class' => '', 'size' => $size), $smarty);
            }
            //iconsets introduced with Tiki14
        } else {
            if (!empty($filetype)) {
                $type = $filetype;
            } elseif (!empty($mimetypes[$ext])) {
                $type = $mimetypes[$ext];
            } else {
                $type = 'file';
            }
            switch ($type) {
                case $type === 'application/msword' || strpos($type, 'application/vnd.openxmlformats-officedocument.wordprocessingml') === 0:
                    $iconname = 'word';
                    break;
                case $type === 'application/pdf':
                    $iconname = 'pdf';
                    break;
                case $type === 'application/vnd.ms-excel' || strpos($type, 'application/vnd.openxmlformats-officedocument.spreadsheetml') === 0:
                    $iconname = 'excel';
                    break;
                case $type === 'application/vnd.ms-powerpoint' || strpos($type, 'application/vnd.openxmlformats-officedocument.presentationml') === 0:
                    $iconname = 'powerpoint';
                    break;
                case strpos($type, 'audio/') === 0:
                    $iconname = 'audio';
                    break;
                case strpos($type, 'image/') === 0:
                    $iconname = 'image';
                    break;
                case strpos($type, 'text/') === 0:
                    $iconname = 'textfile';
                    break;
                case strpos($type, 'video/') === 0:
                    $iconname = 'video_file';
                    break;
                case strpos($type, 'application/') === 0:
                    $iconname = 'code_file';
                    break;
                default:
                    $iconname = 'file';
                    break;
            }
            if ($return === 'filetype') {
                return $type;
            } else {
                return smarty_function_icon(['name' => $iconname, 'size' => $size], $smarty);
            }
        }
    }
}
Пример #28
0
 function getTreeHTML($galleryIdentifier = NULL)
 {
     global $prefs, $smarty;
     require_once 'lib/tree/BrowseTreeMaker.php';
     $galleryIdentifier = is_null($galleryIdentifier) ? $prefs['fgal_root_id'] : $galleryIdentifier;
     $subGalleries = $this->getSubGalleries($galleryIdentifier);
     $smarty->loadPlugin('smarty_function_icon');
     $icon = '&nbsp;' . smarty_function_icon(array('_id' => 'folder'), $smarty) . '&nbsp;';
     $smarty->loadPlugin('smarty_block_self_link');
     $linkParameters = array('_script' => 'tiki-list_file_gallery.php', '_class' => 'fgalname');
     if (!empty($_REQUEST['filegals_manager'])) {
         $linkParameters['filegals_manager'] = $_REQUEST['filegals_manager'];
     }
     $nodes = array();
     foreach ($subGalleries['data'] as $subGallery) {
         $linkParameters['galleryId'] = $subGallery['id'];
         $nodes[] = array('id' => $subGallery['id'], 'parent' => $subGallery['parentId'], 'data' => smarty_block_self_link($linkParameters, $icon . htmlspecialchars($subGallery['name']), $smarty));
     }
     $browseTreeMaker = new BrowseTreeMaker('Galleries');
     return $browseTreeMaker->make_tree($this->getGallerySpecialRoot($galleryIdentifier), $nodes);
 }
Пример #29
0
 function getTabularSchema()
 {
     $schema = new Tracker\Tabular\Schema($this->getTrackerDefinition());
     $permName = $this->getConfiguration('permName');
     $name = $this->getConfiguration('name');
     $smarty = TikiLib::lib('smarty');
     $smarty->loadPlugin('smarty_function_icon');
     $schema->addNew($permName, 'y/n')->setLabel($name)->setRenderTransform(function ($value) {
         return $value;
     })->setParseIntoTransform(function (&$info, $value) use($permName) {
         $info['fields'][$permName] = $value;
     });
     $schema->addNew($permName, 'X')->setLabel($name)->addIncompatibility($permName, 'y/n')->setRenderTransform(function ($value) {
         return 'y' === $value ? 'X' : '';
     })->setParseIntoTransform(function (&$info, $value) use($permName) {
         $value = trim($value);
         $info['fields'][$permName] = empty($value) ? 'n' : 'y';
     });
     $schema->addNew($permName, 'icon')->setLabel($name)->setPlainReplacement('X')->setRenderTransform(function ($value) use($smarty) {
         return 'y' === $value ? smarty_function_icon(['name' => 'success'], $smarty) : '';
     });
     return $schema;
 }
$treeNodes = array();
$smarty->loadPlugin('smarty_function_icon');
foreach ($categories as $category) {
	$perms = Perms::get(array('type' => 'category', 'object' => $category['categId']));
	if ($perms->admin_categories == 'y') {
		$data = '<a href="tiki-admin_categories.php?parentId=' . $category['parentId'] . '&amp;categId=' . $category['categId'] . '" title="' . tra('Edit') . '">' . smarty_function_icon(array('_id'=>'page_edit'), $smarty) . '</a>';
		$data .= '<a href="tiki-admin_categories.php?parentId=' . $category['parentId'] . '&amp;removeCat=' . $category['categId'] . '" title="' . tra('Delete') . '">' . smarty_function_icon(array('_id'=>'cross'), $smarty) . '</a>';

		if ($userlib->object_has_one_permission($category['categId'], 'category')) {
			$title = tra('Edit permissions for this category');
			$icon = 'key_active';
		} else {
			$title = tra('Assign Permissions');
			$icon = 'key';
		}
		$data .= '<a href="tiki-objectpermissions.php?objectType=category&amp;objectId=' . $category['categId'] . '&amp;objectName=' . urlencode($category['name']) . '&amp;permType=category">' . smarty_function_icon(array('_id'=>$icon, 'alt'=>$title), $smarty) . '</a>';
	
		$data .= '<a class="catname" href="tiki-admin_categories.php?parentId=' . $category["categId"] . '">' . htmlspecialchars($category['name']) .'</a> ';
		$treeNodes[] = array(
			'id' => $category['categId'],
			'parent' => $category['parentId'],
			'data' => $data 
		);
	}
}
include_once ('lib/tree/BrowseTreeMaker.php');
$treeMaker = new BrowseTreeMaker('categ');
$smarty->assign('tree', $treeMaker->make_tree(0, $treeNodes));

// ---------------------------------------------------
if (!isset($_REQUEST["sort_mode"])) {