function addTag()
{
if (!$('addtag').value.blank()) {
- var params = new Object();
- params.action = 'add';
- params[Ansel.ajax.tagActions.input] = $('addtag').value;
- new Ajax.Request(Ansel.ajax.tagActions.url,
+ var params = {};
+ params.params = "tags=" + encodeURIComponent($('addtag').value);
+ new Ajax.Request(Ansel.ajax.tagActions.url + "/action=add/post=params",
{
method: 'post',
parameters: params,
function removeTag(tagid)
{
- var params = new Object();
- params.action = 'remove';
- params[Ansel.ajax.tagActions.input] = tagid;
- new Ajax.Request(Ansel.ajax.tagActions.url,
+ var params = {};
+ params.params = "tags=" + tagid;
+ new Ajax.Request(Ansel.ajax.tagActions.url + "/action=remove/post=params",
{
method: 'post',
parameters: params,
// Include the js
Horde::addScriptFile('tagactions.js');
- $url = $this->_getUrl('TagActions', 'ansel', array('input' => 'tags',
- 'gallery' => $this->_params['gallery'],
+ $url = $this->_getUrl('TagActions', 'ansel', array('gallery' => $this->_params['gallery'],
'image' => (isset($this->_params['image']) ? $this->_params['image'] : 0)));
$params = array('url' => $url,
'gallery' => $this->_params['gallery'],
'input' => 'tags');
$js = array();
$js[] = "Ansel.ajax['tagActions'] = " . Horde_Serialize::serialize($params, Horde_Serialize::JSON) . ";";
- // TODO: Attach the Add & Delete actions too
$js[] = "Event.observe(Ansel.ajax.tagActions.bindTo.add, 'click', function(event) {addTag(); Event.stop(event)});";
Horde::addInlineScript($js, 'dom');
{
include_once dirname(__FILE__) . '/../../base.php';
- /* Require a POST for the action parameter and the tags parameter */
- $action = Horde_Util::getPost('action');
- if (empty($action) || empty($args['input'])) {
+ $action = $args['action'];
+ $tags = $post['tags'];
+ if (empty($action) || empty($tags)) {
return array('response' => '0');
}
$gallery = $args['gallery'];
$image = isset($args['image']) ? $args['image'] : null;
-
if ($image) {
$id = $image;
$type = 'image';
$id = $gallery;
$type = 'gallery';
}
- $tags = Horde_Util::getPost($args['input']);
+
if (!is_numeric($id)) {
return array('response' => 0,
'message' => sprintf(_("Invalid input %s"), htmlspecialchars($id)));