return true;
}
-// Since onsubmit is never called when submitting programatically we
-// can use this function to add tags when we press enter on the tag form.
-function submitcheck()
+function toggleNewTags(domid)
{
- return !addTag();
+ $('tag-show-' + domid).toggle();
+ $('tag-hide-' + domid).toggle();
+ $('newtags-' + domid).toggle();
}
\ No newline at end of file
{
$tags = $tagger->getTags($id, 'calendar');
$js = '';
+ $html = '';
if ($type == 'calendar') {
$cal = $GLOBALS['kronolith_shares']->getShare($id);
$hasEdit = $event->hasPermission(PERMS_EDIT, Auth::getAuth());
}
- $html = count($tags) ? '<h5>' . _("Tags") . '</h5>': '';
- $html .= '<ul>';
foreach ($tags as $tag_id => $tag) {
$html .= '<li>' . $tag . ($hasEdit ? '<a href="#" onclick="removeTag(\'' . $id . '\', \'' . $type . '\',' . $tag_id . ', \'' . Horde::url('imple.php', true) . '\'); Event.stop(event)" id="remove' . md5($id . $tag_id) . '">' . Horde::img('delete-small.png', _("Remove Tag"), '', $GLOBALS['registry']->getImageDir('horde')) . '</a>' : '') . '</li>';
}
- return $html . '</ul><div class="clear"> </div>';
+ return $html;
}
}
<ul id="mycalendars">
<?php foreach ($my_calendars as $id => $cal): ?>
<li><label><input type="checkbox" class="checkbox" name="display_cal[]" value="<?php echo htmlspecialchars($id) ?>"<?php echo (in_array($id, $display_calendars) ? ' checked="checked"' : '') . ' /> ' . htmlspecialchars($cal->get('name')) ?></label> <?php echo $info_img ?>
- <div class="panel-tags" id="tags-<?php echo $id?>">
+ <div class="panel-tags">
<?php $tags = $tagger->getTags($id, 'calendar'); ?>
- <h5><?php echo (count($tags) ? _("Tags") : '');?></h5>
- <ul style="margin-left: 10px;">
- <?php foreach ($tags as $tag_id => $tag): ?>
- <li><?php echo $tag . ($cal->hasPermission(Auth::getAuth(), PERMS_EDIT) ? '<a href="#" id="remove' . md5($id . $tag_id) . '">' . Horde::img('delete-small.png', _("Remove Tag"), '', $registry->getImageDir('horde')) . '</a>' : '') . '</li>'?>
- <?php
- Kronolith_Imple::factory('TagActions', array('triggerId' => 'remove' . md5($id . $tag_id),
- 'action' => 'delete',
- 'resource' => $id,
- 'type' => 'calendar',
- 'tagId' => $tag_id));
- ?>
- <?php endforeach;?>
- </ul>
- <div class="clear"> </div>
+ <span style="cursor:pointer;" id="tag-show-<?php echo $id?>" onclick="toggleNewTags('<?php echo $id?>');" title="<?php echo _("Add new tags")?>">+</span><span id="tag-hide-<?php echo $id?>" style="display:none;cursor:pointer;" onclick="toggleNewTags('<?php echo $id?>');">-</span>
+ <h5 style="display: inline;"><?php echo _("Tags")?></h5>
+ <div id="newtags-<?php echo $id?>" style="display:none;">
+ <ul id="tags-<?php echo $id?>">
+ <?php foreach ($tags as $tag_id => $tag): ?>
+ <li class="panel-tags"><?php echo $tag . ($cal->hasPermission(Auth::getAuth(), PERMS_EDIT) ? '<a href="#" id="remove' . md5($id . $tag_id) . '">' . Horde::img('delete-small.png', _("Remove Tag"), '', $registry->getImageDir('horde')) . '</a>' : '') . '</li>'?>
+ <?php
+ Kronolith_Imple::factory('TagActions', array('triggerId' => 'remove' . md5($id . $tag_id),
+ 'action' => 'delete',
+ 'resource' => $id,
+ 'type' => 'calendar',
+ 'tagId' => $tag_id));
+ ?>
+ <?php endforeach;?>
+ </ul>
+ <div class="clear"> </div>
+ <input type="text" name="newtags-input-<?php echo $id?>" id="newtags-input-<?php echo $id?>" size="10" /><input type="button" class="button" value="add" id="test" />
+ <div id="newtags-input-<?php echo $id?>_results" class="autocomplete"></div>
+ <span id="newtags-input-<?php echo $id?>_loading_img" style="display:none;"><?php echo Horde::img('loading.gif', _("Loading...")) ?></span>
+ <?php
+ Kronolith_Imple::factory('TagAutoCompleter', array('triggerId' => 'newtags-input-' . $id));
+ ?>
+ </div>
</div>
</li>
<?php endforeach; ?>