Permalink
Browse files

# [#30454] Tags: Adding Tags via Batch function replaces all previous

tags. Thanks David and Elin. (Fix #936)
  • Loading branch information...
1 parent 4d50339 commit 5fca044699f0d3f2055c005abaa67293474e2b8c @elinw elinw committed with infograf768 Apr 4, 2013
Showing with 97 additions and 75 deletions.
  1. +1 −1 administrator/components/com_categories/controllers/categories.php
  2. +2 −2 administrator/components/com_categories/controllers/category.php
  3. +1 −1 administrator/components/com_categories/models/category.php
  4. +2 −2 administrator/components/com_contact/controllers/contact.php
  5. +1 −1 administrator/components/com_contact/controllers/contacts.php
  6. +1 −1 administrator/components/com_contact/models/contact.php
  7. +2 −2 administrator/components/com_content/controllers/article.php
  8. +1 −1 administrator/components/com_content/controllers/articles.php
  9. +1 −1 administrator/components/com_content/models/article.php
  10. +2 −2 administrator/components/com_newsfeeds/controllers/newsfeed.php
  11. +1 −1 administrator/components/com_newsfeeds/controllers/newsfeeds.php
  12. +1 −1 administrator/components/com_newsfeeds/models/newsfeed.php
  13. +0 −5 administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default_batch.php
  14. +1 −1 administrator/components/com_tags/tables/tag.php
  15. +2 −2 administrator/components/com_users/controllers/user.php
  16. +1 −1 administrator/components/com_users/models/user.php
  17. +2 −2 administrator/components/com_weblinks/controllers/weblink.php
  18. +1 −1 administrator/components/com_weblinks/controllers/weblinks.php
  19. +1 −1 administrator/components/com_weblinks/models/weblink.php
  20. +1 −1 components/com_contact/models/category.php
  21. +1 −1 components/com_contact/models/contact.php
  22. +1 −1 components/com_contact/views/category/view.html.php
  23. +1 −1 components/com_contact/views/contact/view.html.php
  24. +2 −2 components/com_content/controllers/article.php
  25. +1 −1 components/com_content/models/articles.php
  26. +1 −1 components/com_content/models/form.php
  27. +1 −1 components/com_content/views/article/view.html.php
  28. +1 −1 components/com_content/views/category/view.html.php
  29. +1 −1 components/com_content/views/form/view.html.php
  30. +1 −1 components/com_newsfeeds/views/category/view.html.php
  31. +1 −1 components/com_newsfeeds/views/newsfeed/view.html.php
  32. +1 −1 components/com_tags/controllers/tags.php
  33. +1 −1 components/com_tags/models/tag.php
  34. +1 −1 components/com_users/controllers/profile.php
  35. +1 −1 components/com_users/models/profile.php
  36. +1 −1 components/com_users/views/profile/view.html.php
  37. +2 −2 components/com_weblinks/controllers/weblink.php
  38. +1 −1 components/com_weblinks/models/category.php
  39. +1 −1 components/com_weblinks/models/form.php
  40. +1 −1 components/com_weblinks/views/category/view.html.php
  41. +3 −0 installation/CHANGELOG
  42. +2 −2 libraries/cms/form/field/tag.php
  43. +32 −11 libraries/cms/{tags → helper}/tags.php
  44. +0 −1 libraries/cms/tags/index.html
  45. +8 −4 libraries/legacy/model/admin.php
  46. +1 −1 modules/mod_tags_similar/helper.php
  47. +4 −4 tests/unit/suites/libraries/{tags/JTagsTest.php → helper/JHelperTagsTest.php}
@@ -139,7 +139,7 @@ protected function postDeleteHook(JModelLegacy $model, $ids = null)
$extension = $this->input->get('extension');
$item = $model->getItem();
- $tags = new JTags;
+ $tags = new JHelperTags;
$tags->deleteTagData($ids, $extension . '.category');
}
@@ -201,7 +201,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if (empty($validData['tags']) && !empty($item->tags))
{
- $oldTags = new JTags;
+ $oldTags = new JHelperTags;
$oldTags->unTagItem($id, $item->extension . '.category');
return;
}
@@ -211,7 +211,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if ($tags[0] != '')
{
$isNew = $item->id == 0 ? 1 : 0;
- $tagsHelper = new JTags;
+ $tagsHelper = new JHelperTags;
$tagsHelper->tagItem($id, $item->extension . '.category', $isNew, $item, $tags, null);
}
@@ -182,7 +182,7 @@ public function getItem($pk = null)
if (!empty($result->id))
{
$db = JFactory::getDbo();
- $result->tags = new JTags;
+ $result->tags = new JHelperTags;
$result->tags->getTagIds($result->id, $result->extension . '.category');
}
}
@@ -134,7 +134,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if (empty($validData['tags']) && !empty($item->tags))
{
- $oldTags = new JTags;
+ $oldTags = new JHelperTags;
$oldTags->unTagItem($id, 'com_contact.contact');
}
@@ -143,7 +143,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if ($tags[0] != '')
{
$isNew = $item->id == 0 ? 1 : 0;
- $tagsHelper = new JTags;
+ $tagsHelper = new JHelperTags;
$tagsHelper->tagItem($id, 'com_contact.contact', $isNew, $item, $tags, null);
}
}
@@ -147,7 +147,7 @@ protected function postDeleteHook(JModelLegacy $model, $ids = null)
$item = $model->getItem();
- $tags = new JTags;
+ $tags = new JHelperTags;
$tags->deleteTagData($ids, 'com_contact.contact');
}
@@ -427,7 +427,7 @@ public function getItem($pk = null)
// Load item tags
if (!empty($item->id))
{
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_contact.contact');
}
@@ -185,7 +185,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if (empty($validData['tags']) && !empty($item->tags))
{
- $oldTags = new JTags;
+ $oldTags = new JHelperTags;
$oldTags->unTagItem($id, 'com_content.article');
return;
}
@@ -196,7 +196,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if ($tags[0] != '')
{
$isNew = $item->id == 0 ? 1 : 0;
- $tagsHelper = new JTags;
+ $tagsHelper = new JHelperTags;
$tagsHelper->tagItem($id, 'com_content.article', $isNew, $item, $tags, null);
}
return;
@@ -152,7 +152,7 @@ protected function postDeleteHook(JModelLegacy $model, $ids = null)
$item = $model->getItem();
- $tags = new JTags;
+ $tags = new JHelperTags;
$tags->deleteTagData($ids, 'com_content.article');
}
@@ -291,7 +291,7 @@ public function getItem($pk = null)
if (!empty($item->id))
{
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_content.article');
}
}
@@ -142,7 +142,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if (empty($validData['tags']) && !empty($item->tags))
{
- $oldTags = new JTags;
+ $oldTags = new JHelperTags;
$oldTags->unTagItem($item->id, 'com_newsfeeds.newsfeed');
return;
@@ -154,7 +154,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if ($tags[0] != '')
{
$isNew = ($item->id == 0) ? 1 : 0;
- $tagsHelper = new JTags;
+ $tagsHelper = new JHelperTags;
$tagsHelper->tagItem($item->id, 'com_newsfeeds.newsfeed', $isNew, $item, $tags, null);
}
@@ -66,7 +66,7 @@ protected function postDeleteHook(JModelLegacy $model, $ids = null)
$item = $model->getItem();
- $tags = new JTags;
+ $tags = new JHelperTags;
$tags->deleteTagData($ids, 'com_newsfeeds.newsfeed');
}
@@ -422,7 +422,7 @@ public function getItem($pk = null)
}
if (!empty($item->id))
{
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_newsfeeds.newsfeed');
}
@@ -40,11 +40,6 @@
</div>
</div>
<?php endif; ?>
- <div class="control-group">
- <div class="controls">
- <?php echo JHtml::_('batch.tag');?>
- </div>
- </div>
</div>
<div class="modal-footer">
<button class="btn" type="button" onclick="document.id('batch-category-id').value='';document.id('batch-access').value='';document.id('batch-language-id').value='';document.id('batch-tag-id)').value=''" data-dismiss="modal">
@@ -195,7 +195,7 @@ public function store($updateNulls = false)
public function delete($pk = null, $children = false)
{
return parent::delete($pk, $children);
- $helper = new JTags;
+ $helper = new JHelperTags;
$helper->tagDeleteInstances($pk);
}
}
@@ -122,7 +122,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if (empty($validData['tags']) && !empty($item->tags))
{
- $oldTags = new JTags;
+ $oldTags = new JHelperTags;
$oldTags->unTagItem($id, 'com_newsfeeds.newsfeed');
return;
}
@@ -131,7 +131,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if ($tags[0] != '')
{
- $tagsHelper = new JTags;
+ $tagsHelper = new JHelperTags;
$tagsHelper->tagItem($id, 'com_users.user', $isNew, $item, $tags, null);
}
return;
@@ -49,7 +49,7 @@ public function getItem($pk = null)
{
$result = parent::getItem($pk);
- $result->tags = new JTags;
+ $result->tags = new JHelperTags;
$result->tags->getTagIds($result->id, 'com_users.user');
// Get the dispatcher and load the users plugins.
@@ -140,7 +140,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if (empty($validData['tags']) && !empty($item->tags))
{
- $oldTags = new JTags;
+ $oldTags = new JHelperTags;
$oldTags->unTagItem($id, 'com_weblinks.weblink');
return;
}
@@ -150,7 +150,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
// Store the tag data if the weblink data was saved.
if ($tags[0] != '')
{
- $tagsHelper = new JTags;
+ $tagsHelper = new JHelperTags;
$tagsHelper->tagItem($id, 'com_weblinks.weblink', $isNew, $item, $tags, null);
}
@@ -67,7 +67,7 @@ protected function postDeleteHook(JModelLegacy $model, $ids = null)
$item = $model->getItem();
- $tags = new JTags;
+ $tags = new JHelperTags;
$tags->deleteTagData($ids, 'com_weblinks.weblink');
}
@@ -190,7 +190,7 @@ public function getItem($pk = null)
if (!empty($item->id))
{
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_weblinks.weblink');
}
}
@@ -316,7 +316,7 @@ public function getCategory()
$this->_parent = false;
}
}
- $this->tags = new JTags;
+ $this->tags = new JHelperTags;
$this->tags->getItemTags('com_contact.category', $this->_item->get('id'));
return $this->_item;
@@ -189,7 +189,7 @@ public function &getItem($pk = null)
$registry->loadString($data->metadata);
$data->metadata = $registry;
- $data->tags = new JTags;
+ $data->tags = new JHelperTags;
$data->tags->getItemTags('com_contact.contact', $data->id);
// Compute access permissions.
@@ -127,7 +127,7 @@ public function display($tpl = null)
$this->setLayout($active->query['layout']);
}
- $category->tags = new JTags;
+ $category->tags = new JHelperTags;
$category->tags->getItemTags('com_contact.category', $category->id);
$this->_prepareDocument();
@@ -161,7 +161,7 @@ public function display($tpl = null)
$this->user = &$user;
$this->contacts = &$contacts;
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getItemTags('com_contact.contact', $this->item->id);
// Override the layout only if this is not the active menu item
@@ -292,7 +292,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if (empty($validData['tags']) && !empty($item->tags))
{
- $oldTags = new JTags;
+ $oldTags = new JHelperTags;
$oldTags->unTagItem($id, 'com_content.article');
return;
}
@@ -303,7 +303,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if ($tags[0] != '')
{
$isNew = $item->id == 0 ? 1 : 0;
- $tagsHelper = new JTags;
+ $tagsHelper = new JHelperTags;
$tagsHelper->tagItem($id, 'com_content.article', $isNew, $item, $tags, null);
}
return;
@@ -637,7 +637,7 @@ public function getItems()
}
// Get the tags
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getItemTags('com_content.article', $item->id);
}
@@ -129,7 +129,7 @@ public function getItem($itemId = null)
}
if ($itemId)
{
- $value->tags = new JTags;
+ $value->tags = new JHelperTags;
$value->tags->getTagIds($value->id, 'com_content.article');
}
@@ -136,7 +136,7 @@ public function display($tpl = null)
else {
$item->text = $item->introtext;
}
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getItemTags('com_content.article', $this->item->id);
// Process the content plugins.
@@ -202,7 +202,7 @@ public function display($tpl = null)
$model = $this->getModel();
$model->hit();
- $this->category->tags = new JTags;
+ $this->category->tags = new JHelperTags;
$this->category->tags->getItemTags('com_content.category', $this->category->id);
$this->_prepareDocument();
@@ -52,7 +52,7 @@ public function display($tpl = null)
return false;
}
- $this->item->tags = new JTags;
+ $this->item->tags = new JHelperTags;
if (!empty($this->item->id))
{
$this->item->tags->getItemTags('com_content.article.', $this->item->id);
@@ -115,7 +115,7 @@ public function display($tpl = null)
$this->setLayout($active->query['layout']);
}
- $this->category->tags = new JTags;
+ $this->category->tags = new JHelperTags;
$this->category->tags->getItemTags('com_newsfeeds.category', $this->category->id);
$this->_prepareDocument();
@@ -197,7 +197,7 @@ public function display($tpl = null)
}
$this->print = $print;
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getItemTags('com_newsfeeds.newsfeed', $item->id);
$this->_prepareDocument();
@@ -38,7 +38,7 @@ public function searchAjax()
'parent_id' => $app->input->get('parent_id', null)
);
- if ($results = JTags::searchTags($filters))
+ if ($results = JHelperTags::searchTags($filters))
{
// Output a JSON object
echo json_encode($results);
@@ -105,7 +105,7 @@ protected function getListQuery()
$language = JComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all');
}
- $listQuery = New JTags;
+ $listQuery = New JHelperTags;
$query = $listQuery->getTagItemsQuery($tagId, $typesr, $includeChildren, $orderByOption, $orderDir, $matchAll, $language, $stateFilter);
return $query;
@@ -192,7 +192,7 @@ protected function postSaveHook(JModelLegacy $model, $validData = array())
if ($tags)
{
- $item->tags = new JTags;
+ $item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_users.user');
}
@@ -278,7 +278,7 @@ public function save($data)
return false;
}
- $user->tags = new JTags;
+ $user->tags = new JHelperTags;
$user->tags->getTagIds($user->id, 'com_users.user');
return $user->id;
@@ -54,7 +54,7 @@ public function display($tpl = null)
return false;
}
- $this->data->tags = new JTags;
+ $this->data->tags = new JHelperTags;
$this->data->tags->getItemTags('com_users.user.', $this->data->id);
// Check for layout override
Oops, something went wrong.

0 comments on commit 5fca044

Please sign in to comment.