work from the calendar panel.
Obviously the CSS needs some work, UI suggestions welcome.
-function addTag()
+function addTag(resource, type, endpoint)
{
- if (!$('addtag').value.blank()) {
+ if (!$('newtags-input_' + resource).value.blank()) {
var params = new Object();
- params.requestType="TagActions/action=add/gallery=" + tagActions.gallery + "/tags=" + $('addtag').value;
- new Ajax.Updater({success:'tags'},
- tagActions.url,
+ params.imple="TagActions/action=add/resource=" + resource + "/type=" + type + "/tags=" + $('newtags-input_' + resource).value;
+ new Ajax.Updater({success:'tags_' + resource},
+ endpoint,
{
method: 'post',
parameters: params,
- onComplete: function() {$('addtag').value = "";}
+ onComplete: function() {$('newtags-input_' + resource).value = "";}
}
);
}
parameters: params
}
);
+
return true;
}
$action = $this->_params['action'];
$content_id = $this->_params['resource'];
$content_type = $this->_params['type'];
- $tag_id = $this->_params['tagId'];
+ $tag_id = !empty($this->_params['tagId']) ? $this->_params['tagId'] : null;
$endpoint = Horde::url('imple.php', true);
if ($action == 'add') {
- $js = "Event.observe('" . $dom_id . "', 'click', function(event) {addTag(); Event.stop(event)});";
+ $js = "Event.observe('" . $dom_id . "_" . $content_id . "', 'click', function(event) {addTag('" . $content_id . "', '" . $content_type . "', '" . $endpoint . "'); Event.stop(event)});";
} elseif ($action == 'delete') {
$js = "Event.observe('" . $dom_id . "', 'click', function(event) {removeTag('" . $content_id . "', '" . $content_type . "', " . $tag_id . ", '" . $endpoint . "'); Event.stop(event)});";
}
if ($perm) {
/* Get the resource owner */
+ $tagger = new Kronolith_Tagger();
switch ($request) {
case 'add':
- //@TODO
+ $tagger->tag($args['resource'], $tags, $args['type']);
break;
case 'remove':
- $tagger = new Kronolith_Tagger();
$tagger->untag($args['resource'], (int)$tags, $args['type']);
break;
}
<?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" />
+ <input type="text" name="newtags-input_<?php echo $id?>" id="newtags-input_<?php echo $id?>" size="10" /><input type="button" class="button" value="add" name="newtags-button_<?php echo $id?>" id="newtags-button_<?php echo $id?>" />
<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' => $id));
+ Kronolith_Imple::factory('TagActions', array('triggerId' => 'newtags-button',
+ 'resource' => $id,
+ 'type' => 'calendar',
+ 'action' => 'add'));
?>
</div>
</div>