function renderEntityTags($entity_id) { global $taglist, $target_given_tags; echo '<table border=0 width="100%"><tr>'; if (count($taglist) > getConfigVar('TAGS_QUICKLIST_THRESHOLD')) { $minilist = getTagChart(getConfigVar('TAGS_QUICKLIST_SIZE'), etypeByPageno(), $target_given_tags); // It could happen, that none of existing tags have been used in the current realm. if (count($minilist)) { $js_code = "tag_cb.setTagShortList ({"; $is_first = TRUE; foreach ($minilist as $tag) { if (!$is_first) { $js_code .= ","; } $is_first = FALSE; $js_code .= "\n\t{$tag['id']} : 1"; } $js_code .= "\n});\n\$(document).ready(tag_cb.compactTreeMode);"; addJS('js/tag-cb.js'); addJS($js_code, TRUE); } } // do not do anything about empty tree, trigger function ought to work this out echo '<td class=pcright>'; renderEntityTagsPortlet('Tag tree', getTagTree(), $target_given_tags, etypeByPageno()); echo '</td>'; echo '</tr></table>'; }
function renderTagTreeEditor() { addJS(<<<END function tageditor_showselectbox(e) { \t\$(this).load('index.php', {module: 'ajax', ac: 'get-tag-select', tagid: this.id}); \t\$(this).unbind('mousedown', tageditor_showselectbox); } \$(document).ready(function () { \t\$('select.taglist-popup').bind('mousedown', tageditor_showselectbox); }); END , TRUE); function printNewItemTR($options) { global $taglist; printOpFormIntro('createTag'); echo '<tr>'; echo '<td align=left style="padding-left: 16px;">' . getImageHREF('create', 'Create tag', TRUE) . '</td>'; echo '<td><input type=text size=48 name=tag_name></td>'; echo '<td class=tdleft>' . getSelect(array('yes' => 'yes', 'no' => 'no'), array('name' => 'is_assignable'), 'yes') . '</td>'; echo '<td>' . getSelect($options, array('name' => 'parent_id')) . '</td>'; echo '<td>' . getImageHREF('create', 'Create tag', TRUE, 120) . '</td>'; echo '</tr></form>'; } global $taglist; $options = array(0 => '-- NONE --'); foreach ($taglist as $taginfo) { $options[$taginfo['id']] = htmlspecialchars($taginfo['tag']); } $otags = getOrphanedTags(); if (count($otags)) { startPortlet('fallen leaves'); echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n"; echo '<tr class=trerror><th>tag name</th><th>parent tag</th><th> </th></tr>'; foreach ($otags as $taginfo) { printOpFormIntro('updateTag', array('tag_id' => $taginfo['id'], 'tag_name' => $taginfo['tag'])); echo "<input type=hidden name=is_assignable value={$taginfo['is_assignable']}>"; echo '<tr>'; echo '<td>' . $taginfo['tag'] . '</td>'; echo '<td>' . getSelect($options, array('name' => 'parent_id'), $taglist[$taginfo['id']]['parent_id']) . '</td>'; echo '<td>' . getImageHREF('save', 'Save changes', TRUE) . '</td>'; echo '</tr></form>'; } echo '</table>'; finishPortlet(); } startPortlet('tag tree'); echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n"; echo '<tr><th> </th><th>tag name</th><th>assignable</th><th>parent tag</th><th> </th></tr>'; if (getConfigVar('ADDNEW_AT_TOP') == 'yes') { printNewItemTR($options); } foreach (getTagTree() as $taginfo) { renderTagRowForEditor($taginfo); } if (getConfigVar('ADDNEW_AT_TOP') != 'yes') { printNewItemTR($options); } echo '</table>'; finishPortlet(); }