Author Topic: Question : About TAG's and where they are exactly..  (Read 2037 times)

setekh

  • Newbie
  • *
  • Posts: 35
    • View Profile
Question : About TAG's and where they are exactly..
« on: January 26, 2009, 04:12:16 am »
I have made another app. to delete and modify tags, but i just can not find in which file the tag panel is, the one that is under the workspaces. In 1.2 you can rename the selected tag, i want to add a delete function, but just can not find where that is, i saw that there is a procedure for deleting a tag that is added to specific object, but when you delete all objects the tag is still there, it would be nice if you can delete the tag itself, i just delete the tag from the table, but when i think now it may have implications later to the tagged objects .. hmmm..
anyway the idea is to add a delete tag button near to the sort tag button or even add a whole tag management tab, i just need some help in finding where those things are.. I can add a new tab in the project workspace and write into it, but just can not find the damn tag thing, and it would be much easier just to add delete tag button...Can you please give me some pointers, after all i will do that for all OG users...

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Question : About TAG's and where they are exactly..
« Reply #1 on: January 26, 2009, 07:48:40 am »
Of course, no problem.

The file to edit is 'public/assets/javascript/og/TagPanel.js'. On line 17 you'll see 'tbar:' and an array of javascript objects. You just need to add another object to that list to add the delete icon. You could copy the object for renaming tags and change the details accordingly. You can set the button's icon to ico-delete to have a red X icon.

Cheers.

setekh

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Question : About TAG's and where they are exactly..
« Reply #2 on: January 29, 2009, 04:03:56 am »
thanks, one more very stupid question : is there ready made function for deleting tags and what objects we must pass to it.. I did not have a lot of time to browse  the code yet , but i saw hat there is a delete_tag that wants the tag name and object_id and so on... is there another way for deleting tags, or i just have to make my own function, as i am going for the quick and nasty way of directly deleting the tag with that name in the table :)

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Question : About TAG's and where they are exactly..
« Reply #3 on: January 29, 2009, 09:58:53 am »
There isn't, but you can add this code (I'll add it for 1.3):

On TagController:
Code: [Select]
function delete_tag_by_name() {
if (!logged_user()->isAdministrator()) {
flash_error(lang("no access permissions"));
return;
}
ajx_current("empty");
$tag = array_var($_GET, 'tag');
if (is_null($tag)) {
flash_error(lang("error must enter tag"));
return;
}
Tags::deleteTagByName($tag);
$this->redirectTo("tag", "list_tags");
}

On Tags:
Code: [Select]
function deleteTagByName($tagname) {
self::delete(array('`tag` = ?', $tagname));
}