Version Notes
Mcc_Demo
Download this release
Release Info
Developer | Magento Core Team |
Extension | EE18 |
Version | 0.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.1.0 to 0.0.3
- app/code/community/Magentostudy/Tag/Block/Add.php +124 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/News/Edit/Tab/AssignedTags.php +180 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/NewsTag.php +67 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit.php +98 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Form.php +56 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Tab/RelatedNews.php +189 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Tab/TagInfo.php +163 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Tabs.php +49 -0
- app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Grid.php +148 -0
- app/code/community/Magentostudy/Tag/Block/Cloud.php +72 -0
- app/code/community/Magentostudy/Tag/Block/Item.php +79 -0
- app/code/community/Magentostudy/Tag/Block/News/Item.php +55 -0
- app/code/community/Magentostudy/Tag/Block/News/List.php +88 -0
- app/code/community/Magentostudy/Tag/Helper/Data.php +82 -0
- app/code/community/Magentostudy/Tag/Model/Item.php +135 -0
- app/code/community/Magentostudy/Tag/Model/Resource/Item.php +174 -0
- app/code/community/Magentostudy/Tag/Model/Resource/Item/Collection.php +72 -0
- app/code/community/Magentostudy/Tag/Model/Resource/News/Item/Collection.php +52 -0
- app/code/community/Magentostudy/Tag/controllers/Adminhtml/NewstagController.php +459 -0
- app/code/community/Magentostudy/Tag/controllers/IndexController.php +99 -0
- app/code/community/Magentostudy/Tag/etc/adminhtml.xml +65 -0
- app/code/community/Magentostudy/Tag/etc/config.xml +104 -0
- app/code/community/Magentostudy/Tag/etc/system.xml +47 -0
- app/code/community/Magentostudy/Tag/sql/magentostudy_tag_setup/mysql4-install-1.0.0.0.php +57 -0
- package.xml +9 -9
app/code/community/Magentostudy/Tag/Block/Add.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Add description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Add extends Mage_Core_Block_Template
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* News collection
|
39 |
+
*
|
40 |
+
* @var Magentostudy_Tag_Model_Resource_Item_Collection
|
41 |
+
*/
|
42 |
+
protected $_tagsCollection;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Current tag instance
|
46 |
+
*
|
47 |
+
* @var Magentostudy_Tag_Model_Item
|
48 |
+
*/
|
49 |
+
protected $_tag;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Current news item instance
|
53 |
+
*
|
54 |
+
* @var Magentostudy_News_Model_Item
|
55 |
+
*/
|
56 |
+
protected $_item;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Return current news tag instance
|
60 |
+
*
|
61 |
+
* @return Magentostudy_Tag_Model_Item
|
62 |
+
*/
|
63 |
+
public function getTag()
|
64 |
+
{
|
65 |
+
if (is_null($this->_tag)) {
|
66 |
+
$this->_tag = Mage::registry('current_tag');
|
67 |
+
if (!$this->_tag || !$this->_tag->getId()) {
|
68 |
+
Mage::throwException(Mage::helper('magentostudy_tag')->__('Invalid news tag instance'));
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
return $this->_tag;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Return current news item instance
|
77 |
+
*
|
78 |
+
* @return Magentostudy_News_Model_Item
|
79 |
+
*/
|
80 |
+
public function getNewsItem()
|
81 |
+
{
|
82 |
+
if (is_null($this->_item)) {
|
83 |
+
$this->_item = Mage::registry('current_news_item');
|
84 |
+
if (!$this->_item || !$this->_item->getId()) {
|
85 |
+
Mage::throwException(Mage::helper('magentostudy_news')->__('Invalid news item instance'));
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
return $this->_item;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Retrieve news collection
|
94 |
+
*
|
95 |
+
* @return Magentostudy_News_Model_Resource_Item_Collection
|
96 |
+
*/
|
97 |
+
public function getCollection()
|
98 |
+
{
|
99 |
+
if (is_null($this->_tagsCollection)) {
|
100 |
+
$newsItem = $this->getNewsItem();
|
101 |
+
$this->_tagsCollection = Mage::getResourceModel('magentostudy_tag/item_collection');
|
102 |
+
$this->_tagsCollection->addWeightForNewsItem($newsItem)
|
103 |
+
->addFilter("is_approved", 1)
|
104 |
+
->setOrder('weight', Varien_Data_Collection::SORT_ORDER_DESC);
|
105 |
+
}
|
106 |
+
|
107 |
+
return $this->_tagsCollection;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Return URL to add given tag to current news item (tag already exists).
|
112 |
+
*
|
113 |
+
* @param Magentostudy_Tag_Model_Item $tag
|
114 |
+
* @return string
|
115 |
+
*/
|
116 |
+
public function getAddItemUrl(Magentostudy_Tag_Model_Item $tag)
|
117 |
+
{
|
118 |
+
return $this->getUrl('newstag/index/add', array(
|
119 |
+
'id' => $this->getNewsItem()->getId(),
|
120 |
+
'tag' => $tag->getTitle(),
|
121 |
+
)
|
122 |
+
);
|
123 |
+
}
|
124 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/News/Edit/Tab/AssignedTags.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Adminhtml_News_Edit_Tab_AssignedTags description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_News_Edit_Tab_AssignedTags
|
36 |
+
extends Magentostudy_Tag_Block_Adminhtml_Tag_Grid
|
37 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Class constructor
|
41 |
+
*
|
42 |
+
* @return Magentostudy_Tag_Block_Adminhtml_News_Edit_Tab_AssignedTags
|
43 |
+
*/
|
44 |
+
public function __construct()
|
45 |
+
{
|
46 |
+
parent::__construct();
|
47 |
+
|
48 |
+
$this->setId('assignedtags_section');
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Return current news item instance
|
53 |
+
*
|
54 |
+
* @return Magentostudy_News_Model_Item
|
55 |
+
*/
|
56 |
+
public function getNewsItem()
|
57 |
+
{
|
58 |
+
if (!Mage::registry('news_item')) {
|
59 |
+
Mage::throwException(Mage::helper('magentostudy_tag')->__('News Tag Item was not found in registry'));
|
60 |
+
}
|
61 |
+
|
62 |
+
return Mage::registry('news_item');
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Prepare collection for Grid
|
67 |
+
*
|
68 |
+
* @return Magentostudy_Tag_Block_Adminhtml_News_Edit_Tab_AssignedTags
|
69 |
+
*/
|
70 |
+
protected function _prepareCollection()
|
71 |
+
{
|
72 |
+
if ($this->getCollection() == null) {
|
73 |
+
/** @var $collection Magentostudy_Tag_Model_Resource_Item_Collection */
|
74 |
+
$collection = Mage::getModel('magentostudy_tag/item')->getResourceCollection();
|
75 |
+
$collection = $collection->addWeightForNewsItem($this->getNewsItem());
|
76 |
+
|
77 |
+
$this->setCollection($collection);
|
78 |
+
Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
|
79 |
+
}
|
80 |
+
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Add mass actions.
|
86 |
+
*
|
87 |
+
* @return Magentostudy_Tag_Block_Adminhtml_News_Edit_Tab_AssignedTags
|
88 |
+
*/
|
89 |
+
protected function _prepareMassaction()
|
90 |
+
{
|
91 |
+
$this->setMassactionIdField('tag_id');
|
92 |
+
$this->getMassactionBlock()->setFormFieldName('tag_id');
|
93 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
94 |
+
'label' => Mage::helper('magentostudy_tag')->__('Untag'),
|
95 |
+
'url' => $this->getUrl('*/newstag/massUntag', array('id' => $this->getNewsItem()->getId())),
|
96 |
+
'confirm' => Mage::helper('magentostudy_tag')
|
97 |
+
->__('Are you sure you would like to remove all selected tags form current news item?')
|
98 |
+
));
|
99 |
+
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Return row URL for js event handlers
|
105 |
+
*
|
106 |
+
* @param Magentostudy_Tag_Model_Item $row
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function getRowUrl($row)
|
110 |
+
{
|
111 |
+
return $this->getUrl('*/newstag/edit', array('id' => $row->getId()));
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Grid url getter
|
116 |
+
*
|
117 |
+
* @return string current grid url
|
118 |
+
*/
|
119 |
+
public function getGridUrl()
|
120 |
+
{
|
121 |
+
return $this->getUrl('*/newstag/gridAssignedTags', array(
|
122 |
+
'_current' => true, 'id' => $this->getNewsItem()->getId()
|
123 |
+
));
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Prepare label for tab
|
128 |
+
*
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public function getTabLabel()
|
132 |
+
{
|
133 |
+
return Mage::helper('magentostudy_tag')->__('Assigned Tags');
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Prepare title for tab
|
138 |
+
*
|
139 |
+
* @return string
|
140 |
+
*/
|
141 |
+
public function getTabTitle()
|
142 |
+
{
|
143 |
+
return Mage::helper('magentostudy_tag')->__('Assigned Tags');
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Returns status flag about this tab can be shown or not
|
148 |
+
*
|
149 |
+
* @return boolean
|
150 |
+
*/
|
151 |
+
public function canShowTab()
|
152 |
+
{
|
153 |
+
if ($this->getNewsItem()->getId()) {
|
154 |
+
return true;
|
155 |
+
} else {
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Returns status flag about this tab hidden or not
|
162 |
+
*
|
163 |
+
* @return boolean
|
164 |
+
*/
|
165 |
+
public function isHidden()
|
166 |
+
{
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Check permission for passed action
|
172 |
+
*
|
173 |
+
* @param string $action
|
174 |
+
* @return bool
|
175 |
+
*/
|
176 |
+
protected function _isAllowedAction($action)
|
177 |
+
{
|
178 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage/' . $action);
|
179 |
+
}
|
180 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/NewsTag.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Adminhtml_NewsTag description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_NewsTag extends Mage_Adminhtml_Block_Widget_Grid_Container
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Block constructor
|
39 |
+
*
|
40 |
+
* @return Magentostudy_Tag_Block_Adminhtml_NewsTag
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
$this->_blockGroup = 'magentostudy_tag';
|
45 |
+
$this->_controller = 'adminhtml_tag';
|
46 |
+
$this->_headerText = Mage::helper('magentostudy_tag')->__('Manage News Tags');
|
47 |
+
|
48 |
+
parent::__construct();
|
49 |
+
|
50 |
+
if ($this->_isAllowedAction('save')) {
|
51 |
+
$this->_updateButton('add', 'label', Mage::helper('magentostudy_tag')->__('Add New News Tag'));
|
52 |
+
} else {
|
53 |
+
$this->_removeButton('add');
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Check permission for passed action
|
59 |
+
*
|
60 |
+
* @param string $action
|
61 |
+
* @return bool
|
62 |
+
*/
|
63 |
+
protected function _isAllowedAction($action)
|
64 |
+
{
|
65 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage/' . $action);
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Adminhtml_Tag_Edit description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_Tag_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Initialize edit form container
|
39 |
+
*
|
40 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Edit
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
$this->_objectId = 'id';
|
45 |
+
$this->_blockGroup = 'magentostudy_tag';
|
46 |
+
$this->_controller = 'adminhtml_tag';
|
47 |
+
|
48 |
+
parent::__construct();
|
49 |
+
|
50 |
+
if ($this->_isAllowedAction('save')) {
|
51 |
+
$this->_addButton('saveandcontinue', array(
|
52 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
53 |
+
'onclick' => 'saveAndContinueEdit()',
|
54 |
+
'class' => 'save',
|
55 |
+
), -100);
|
56 |
+
} else {
|
57 |
+
$this->_removeButton('save');
|
58 |
+
}
|
59 |
+
|
60 |
+
if ($this->_isAllowedAction('delete')) {
|
61 |
+
$this->_updateButton('delete', 'label', Mage::helper('magentostudy_tag')->__('Delete Tag'));
|
62 |
+
} else {
|
63 |
+
$this->_removeButton('delete');
|
64 |
+
}
|
65 |
+
|
66 |
+
$this->_formScripts[] = "
|
67 |
+
function saveAndContinueEdit(){
|
68 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
69 |
+
}
|
70 |
+
";
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Retrieve text for header element depending on loaded page
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
public function getHeaderText()
|
79 |
+
{
|
80 |
+
if (Mage::registry('tag_item')->getId()) {
|
81 |
+
return Mage::helper('magentostudy_tag')->__("Edit News Tag '%s'",
|
82 |
+
$this->escapeHtml(Mage::registry('tag_item')->getTitle()));
|
83 |
+
} else {
|
84 |
+
return Mage::helper('magentostudy_tag')->__('New News Tag');
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Check permission for passed action
|
90 |
+
*
|
91 |
+
* @param string $action
|
92 |
+
* @return bool
|
93 |
+
*/
|
94 |
+
protected function _isAllowedAction($action)
|
95 |
+
{
|
96 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage/' . $action);
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Form.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Form description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Prepare FORM action
|
39 |
+
*
|
40 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Form
|
41 |
+
*/
|
42 |
+
protected function _prepareForm()
|
43 |
+
{
|
44 |
+
$form = new Varien_Data_Form(array(
|
45 |
+
'id' => 'edit_form',
|
46 |
+
'action' => $this->getUrl('*/*/save'),
|
47 |
+
'method' => 'post',
|
48 |
+
'enctype' => 'multipart/form-data'
|
49 |
+
));
|
50 |
+
|
51 |
+
$form->setUseContainer(true);
|
52 |
+
$this->setForm($form);
|
53 |
+
|
54 |
+
return parent::_prepareForm();
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Tab/RelatedNews.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_RelatedNews description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_RelatedNews
|
36 |
+
extends Magentostudy_News_Block_Adminhtml_News_Grid
|
37 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Class constructor
|
41 |
+
*
|
42 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_RelatedNews
|
43 |
+
*/
|
44 |
+
public function __construct()
|
45 |
+
{
|
46 |
+
parent::__construct();
|
47 |
+
|
48 |
+
$this->setId('relatednews_section');
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Return current news item instance
|
53 |
+
*
|
54 |
+
* @return Magentostudy_Tag_Model_Item
|
55 |
+
*/
|
56 |
+
public function getTag()
|
57 |
+
{
|
58 |
+
if (!Mage::registry('tag_item')) {
|
59 |
+
Mage::throwException(Mage::helper('magentostudy_tag')->__('News Tag Item was not found in registry'));
|
60 |
+
}
|
61 |
+
|
62 |
+
return Mage::registry('tag_item');
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Prepare collection for Grid
|
67 |
+
*
|
68 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_RelatedNews_Grid
|
69 |
+
*/
|
70 |
+
protected function _prepareCollection()
|
71 |
+
{
|
72 |
+
if ($this->getCollection() == null) {
|
73 |
+
/** @var $collection Magentostudy_Tag_Model_Resource_News_Item_Collection */
|
74 |
+
$collection = Mage::getResourceModel('magentostudy_tag/news_item_collection');
|
75 |
+
$collection->filterByTag($this->getTag());
|
76 |
+
|
77 |
+
$this->setCollection($collection);
|
78 |
+
}
|
79 |
+
|
80 |
+
return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Prepare grid columns
|
85 |
+
*
|
86 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_RelatedNews
|
87 |
+
*/
|
88 |
+
protected function _prepareColumns()
|
89 |
+
{
|
90 |
+
parent::_prepareColumns();
|
91 |
+
|
92 |
+
unset($this->_columns['action']);
|
93 |
+
unset($this->_columns['author']);
|
94 |
+
unset($this->_columns['time_created']);
|
95 |
+
|
96 |
+
$this->addColumn('weight', array(
|
97 |
+
'header' => Mage::helper('magentostudy_tag')->__('Weight'),
|
98 |
+
'index' => 'weight',
|
99 |
+
'width' => '50px'
|
100 |
+
)
|
101 |
+
);
|
102 |
+
|
103 |
+
return $this;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Add mass actions.
|
108 |
+
*
|
109 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_RelatedNews
|
110 |
+
*/
|
111 |
+
protected function _prepareMassaction()
|
112 |
+
{
|
113 |
+
$this->setMassactionIdField('item_id');
|
114 |
+
$this->getMassactionBlock()->setFormFieldName('item_id');
|
115 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
116 |
+
'label' => Mage::helper('magentostudy_tag')->__('Remove tag'),
|
117 |
+
'url' => $this->getUrl('*/newstag/massRemoveTag', array('id' => $this->getTag()->getId())),
|
118 |
+
'confirm' => Mage::helper('magentostudy_tag')
|
119 |
+
->__('Are you sure you would like to remove current tag from selected news items?')
|
120 |
+
));
|
121 |
+
|
122 |
+
return $this;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Return row URL for js event handlers
|
127 |
+
*
|
128 |
+
* @param Magentostudy_Tag_Model_Item $row
|
129 |
+
* @return string
|
130 |
+
*/
|
131 |
+
public function getRowUrl($row)
|
132 |
+
{
|
133 |
+
return $this->getUrl('*/news/edit', array('id' => $row->getId()));
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Grid url getter
|
138 |
+
*
|
139 |
+
* @return string current grid url
|
140 |
+
*/
|
141 |
+
public function getGridUrl()
|
142 |
+
{
|
143 |
+
return $this->getUrl('*/newstag/gridRelatedNews', array('_current' => true, 'id' => $this->getTag()->getId()));
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Prepare label for tab
|
148 |
+
*
|
149 |
+
* @return string
|
150 |
+
*/
|
151 |
+
public function getTabLabel()
|
152 |
+
{
|
153 |
+
return Mage::helper('magentostudy_tag')->__('Related News');
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Prepare title for tab
|
158 |
+
*
|
159 |
+
* @return string
|
160 |
+
*/
|
161 |
+
public function getTabTitle()
|
162 |
+
{
|
163 |
+
return Mage::helper('magentostudy_tag')->__('Related News');
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Returns status flag about this tab can be shown or not
|
168 |
+
*
|
169 |
+
* @return boolean
|
170 |
+
*/
|
171 |
+
public function canShowTab()
|
172 |
+
{
|
173 |
+
if ($this->getTag()->getId()) {
|
174 |
+
return true;
|
175 |
+
} else {
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Returns status flag about this tab hidden or not
|
182 |
+
*
|
183 |
+
* @return boolean
|
184 |
+
*/
|
185 |
+
public function isHidden()
|
186 |
+
{
|
187 |
+
return false;
|
188 |
+
}
|
189 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Tab/TagInfo.php
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_TagInfo description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tab_TagInfo
|
36 |
+
extends Mage_Adminhtml_Block_Widget_Form
|
37 |
+
implements Mage_Adminhtml_Block_Widget_Tab_Interface
|
38 |
+
{
|
39 |
+
/**
|
40 |
+
* Return current news item instance
|
41 |
+
*
|
42 |
+
* @return Magentostudy_Tag_Model_Item
|
43 |
+
*/
|
44 |
+
public function getTag()
|
45 |
+
{
|
46 |
+
if (!Mage::registry('tag_item')) {
|
47 |
+
Mage::throwException(Mage::helper('magentostudy_tag')->__('News Tag Item was not found in registry'));
|
48 |
+
}
|
49 |
+
|
50 |
+
return Mage::registry('tag_item');
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Prepare form elements for tab
|
55 |
+
*
|
56 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
57 |
+
*/
|
58 |
+
protected function _prepareForm()
|
59 |
+
{
|
60 |
+
$model = $this->getTag();
|
61 |
+
|
62 |
+
if ($model->isObjectNew()) {
|
63 |
+
$model->setIsApproved(Magentostudy_Tag_Helper_Data::STATUS_APPROVED);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Checking if user have permissions to save information
|
68 |
+
*/
|
69 |
+
if ($this->_isAllowedAction('save')) {
|
70 |
+
$isElementDisabled = false;
|
71 |
+
} else {
|
72 |
+
$isElementDisabled = true;
|
73 |
+
}
|
74 |
+
|
75 |
+
$form = new Varien_Data_Form();
|
76 |
+
|
77 |
+
$form->setHtmlIdPrefix('tag_');
|
78 |
+
|
79 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
80 |
+
'legend' => Mage::helper('magentostudy_tag')->__('News Tag Info')
|
81 |
+
));
|
82 |
+
|
83 |
+
if ($model->getId()) {
|
84 |
+
$fieldset->addField('tag_id', 'hidden', array(
|
85 |
+
'name' => 'id',
|
86 |
+
));
|
87 |
+
}
|
88 |
+
|
89 |
+
$fieldset->addField('title', 'text', array(
|
90 |
+
'name' => 'tag[title]',
|
91 |
+
'label' => Mage::helper('magentostudy_tag')->__('Tag'),
|
92 |
+
'title' => Mage::helper('magentostudy_tag')->__('Tag'),
|
93 |
+
'required' => true,
|
94 |
+
'disabled' => $isElementDisabled
|
95 |
+
));
|
96 |
+
|
97 |
+
$fieldset->addField('is_approved', 'select', array(
|
98 |
+
'name' => 'tag[is_approved]',
|
99 |
+
'label' => Mage::helper('magentostudy_tag')->__('Is Approved'),
|
100 |
+
'title' => Mage::helper('magentostudy_tag')->__('Is Approved'),
|
101 |
+
'required' => true,
|
102 |
+
'value' => $model->getIsApproved(),
|
103 |
+
'options' => $model->getAvailableStatuses(),
|
104 |
+
'disabled' => $isElementDisabled
|
105 |
+
));
|
106 |
+
|
107 |
+
$form->setValues($model->getData());
|
108 |
+
$this->setForm($form);
|
109 |
+
|
110 |
+
return parent::_prepareForm();
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Prepare label for tab
|
115 |
+
*
|
116 |
+
* @return string
|
117 |
+
*/
|
118 |
+
public function getTabLabel()
|
119 |
+
{
|
120 |
+
return Mage::helper('magentostudy_tag')->__('Tag Info');
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Prepare title for tab
|
125 |
+
*
|
126 |
+
* @return string
|
127 |
+
*/
|
128 |
+
public function getTabTitle()
|
129 |
+
{
|
130 |
+
return Mage::helper('magentostudy_tag')->__('Tag Info');
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Return status flag about this tab can be shown or not
|
135 |
+
*
|
136 |
+
* @return true
|
137 |
+
*/
|
138 |
+
public function canShowTab()
|
139 |
+
{
|
140 |
+
return true;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Return status flag about this tab hidden or not
|
145 |
+
*
|
146 |
+
* @return boolean
|
147 |
+
*/
|
148 |
+
public function isHidden()
|
149 |
+
{
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Check permission for passed action
|
155 |
+
*
|
156 |
+
* @param string $action
|
157 |
+
* @return boolean
|
158 |
+
*/
|
159 |
+
protected function _isAllowedAction($action)
|
160 |
+
{
|
161 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage/' . $action);
|
162 |
+
}
|
163 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Edit/Tabs.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tabs description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Initialize tabs and define tabs block settings
|
39 |
+
*
|
40 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Edit_Tabs
|
41 |
+
*/
|
42 |
+
public function __construct()
|
43 |
+
{
|
44 |
+
parent::__construct();
|
45 |
+
$this->setId('page_tabs');
|
46 |
+
$this->setDestElementId('edit_form');
|
47 |
+
$this->setTitle(Mage::helper('magentostudy_tag')->__('News Tag Info'));
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Adminhtml/Tag/Grid.php
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostud_Tag_Block_Adminhtml_Tag_Grid description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Adminhtml_Tag_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Init Grid default properties
|
39 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Grid
|
40 |
+
*/
|
41 |
+
public function __construct()
|
42 |
+
{
|
43 |
+
parent::__construct();
|
44 |
+
$this->setId('tag_list_grid');
|
45 |
+
$this->setDefaultSort('time_created');
|
46 |
+
$this->setDefaultDir('DESC');
|
47 |
+
$this->setSaveParametersInSession(true);
|
48 |
+
$this->setUseAjax(true);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Prepare colletion for Grid
|
53 |
+
*
|
54 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Grid
|
55 |
+
*/
|
56 |
+
protected function _prepareCollection()
|
57 |
+
{
|
58 |
+
/** @var $coection Magentostudy_Tag_Model_Resource_Item_Collection */
|
59 |
+
$collection = Mage::getModel('magentostudy_tag/item')->getResourceCollection();
|
60 |
+
$collection->addWeightFromCloud();
|
61 |
+
|
62 |
+
$this->setCollection($collection);
|
63 |
+
return parent::_prepareCollection();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Prepare Grid columns
|
68 |
+
*
|
69 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Grid
|
70 |
+
*/
|
71 |
+
protected function _prepareColumns()
|
72 |
+
{
|
73 |
+
$this->addColumn('tag_id', array(
|
74 |
+
'header' => Mage::helper('magentostudy_tag')->__('ID'),
|
75 |
+
'width' => '50px',
|
76 |
+
'index' => 'tag_id',
|
77 |
+
));
|
78 |
+
|
79 |
+
$this->addColumn('tag_text', array(
|
80 |
+
'header' => Mage::helper('magentostudy_tag')->__('Tag Text'),
|
81 |
+
'index' => 'title',
|
82 |
+
));
|
83 |
+
|
84 |
+
$this->addColumn('weight', array(
|
85 |
+
'header' => Mage::helper('magentostudy_tag')->__('Weight (clicks count)'),
|
86 |
+
'index' => 'weight',
|
87 |
+
'width' => '200px',
|
88 |
+
'name' => 'weight'
|
89 |
+
));
|
90 |
+
|
91 |
+
$this->addColumn('is_approved', array(
|
92 |
+
'header' => Mage::helper('magentostudy_tag')->__('Status'),
|
93 |
+
'index' => 'is_approved',
|
94 |
+
'width' => '200px',
|
95 |
+
'name' => 'is_approved',
|
96 |
+
'type' => 'options',
|
97 |
+
'options' => Mage::getSingleton('magentostudy_tag/item')->getAvailableStatuses()
|
98 |
+
));
|
99 |
+
|
100 |
+
return parent::_prepareColumns();
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Return row URL for js event handlers
|
105 |
+
*
|
106 |
+
* @param Magentostudy_Tag_Model_Item $row
|
107 |
+
* @return string
|
108 |
+
*/
|
109 |
+
public function getRowUrl($row)
|
110 |
+
{
|
111 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Grid url getter
|
116 |
+
*
|
117 |
+
* @return string current grid url
|
118 |
+
*/
|
119 |
+
public function getGridUrl()
|
120 |
+
{
|
121 |
+
return $this->getUrl('*/*/grid', array('_current' => true));
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Add mass actions.
|
126 |
+
*
|
127 |
+
* @return Magentostudy_Tag_Block_Adminhtml_Tag_Grid
|
128 |
+
*/
|
129 |
+
protected function _prepareMassaction()
|
130 |
+
{
|
131 |
+
$this->setMassactionIdField('tag_id');
|
132 |
+
$this->getMassactionBlock()->setFormFieldName('tag_id');
|
133 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
134 |
+
'label' => Mage::helper('magentostudy_tag')->__('Delete'),
|
135 |
+
'url' => $this->getUrl('*/newstag/massDelete', array('' => '')),
|
136 |
+
'confirm' => Mage::helper('magentostudy_tag')
|
137 |
+
->__('Are you sure you would like to delete all selected tags?')
|
138 |
+
))
|
139 |
+
->addItem('approve', array(
|
140 |
+
'label' => Mage::helper('magentostudy_tag')->__('Approve'),
|
141 |
+
'url' => $this->getUrl('*/newstag/massApprove', array('' => '')),
|
142 |
+
'confirm' => Mage::helper('magentostudy_tag')
|
143 |
+
->__('Are you sure you would like to approve all selected tags?')
|
144 |
+
));
|
145 |
+
|
146 |
+
return $this;
|
147 |
+
}
|
148 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Cloud.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Cloud description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Cloud extends Mage_Core_Block_Template
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* News collection
|
39 |
+
*
|
40 |
+
* @var Magentostudy_Tag_Model_Resource_Item_Collection
|
41 |
+
*/
|
42 |
+
protected $_tagsCollection;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Retrieve news collection
|
46 |
+
*
|
47 |
+
* @return Magentostudy_News_Model_Resource_Item_Collection
|
48 |
+
*/
|
49 |
+
public function getCollection()
|
50 |
+
{
|
51 |
+
if (is_null($this->_tagsCollection)) {
|
52 |
+
$this->_tagsCollection = Mage::getResourceModel('magentostudy_tag/item_collection');
|
53 |
+
$this->_tagsCollection->addWeightFromCloud()
|
54 |
+
->addFilter("is_approved", 1)
|
55 |
+
->addFieldToFilter('weight', array('gt' => 0))
|
56 |
+
->setOrder('weight', Varien_Data_Collection::SORT_ORDER_DESC);
|
57 |
+
}
|
58 |
+
|
59 |
+
return $this->_tagsCollection;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Return URL to item's view page
|
64 |
+
*
|
65 |
+
* @param Magentostudy_Tag_Model_Item $tag
|
66 |
+
* @return string
|
67 |
+
*/
|
68 |
+
public function getItemUrl(Magentostudy_Tag_Model_Item $tag)
|
69 |
+
{
|
70 |
+
return $this->getUrl('magentostudy_news/index', array('tag' => $tag->getTitle()));
|
71 |
+
}
|
72 |
+
}
|
app/code/community/Magentostudy/Tag/Block/Item.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_Item description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_Item extends Magentostudy_News_Block_List
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Current tag instance
|
39 |
+
*
|
40 |
+
* @var Magentostudy_Tag_Model_Item
|
41 |
+
*/
|
42 |
+
protected $_tag;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Return current news item instance
|
46 |
+
*
|
47 |
+
* @return Magentostudy_Tag_Model_Item
|
48 |
+
*/
|
49 |
+
public function getTag()
|
50 |
+
{
|
51 |
+
if (is_null($this->_tag)) {
|
52 |
+
$this->_tag = Mage::registry('current_tag');
|
53 |
+
if (!$this->_tag || !$this->_tag->getId()) {
|
54 |
+
Mage::throwException(Mage::helper('magentostudy_tag')->__('Invalid news tag instance'));
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
return $this->_tag;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieve news collection
|
63 |
+
*
|
64 |
+
* @return Magentostudy_News_Model_Resource_Item_Collection
|
65 |
+
*/
|
66 |
+
public function getCollection()
|
67 |
+
{
|
68 |
+
if (is_null($this->_newsCollection)) {
|
69 |
+
$this->_newsCollection = Mage::getResourceModel('news/item_collection');
|
70 |
+
$this->_newsCollection->join('magentostudy_tag/relation', 'news_item_id = item_id')
|
71 |
+
->addFilter("news_tag_id", $this->getTag()->getId())
|
72 |
+
->setPageSize(Mage::helper('magentostudy_news')->getNewsPerPage())
|
73 |
+
->setCurPage($this->getCurrentPage())
|
74 |
+
->setOrder('time_created', Varien_Data_Collection::SORT_ORDER_DESC);
|
75 |
+
}
|
76 |
+
|
77 |
+
return $this->_newsCollection;
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Magentostudy/Tag/Block/News/Item.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package News
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* News Item block
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_News_Item extends Magentostudy_News_Block_Item
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Return URL to the news list page
|
39 |
+
*
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function getBackUrl()
|
43 |
+
{
|
44 |
+
$tagTitle = $this->getRequest()->getParam('tag', '');
|
45 |
+
|
46 |
+
if ($tagTitle) {
|
47 |
+
return $this->getUrl('*/', array('_query' => array(
|
48 |
+
'p' => $this->getPage(),
|
49 |
+
'tag' => $tagTitle
|
50 |
+
)));
|
51 |
+
} else {
|
52 |
+
return parent::getBackUrl();
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Magentostudy/Tag/Block/News/List.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package News
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Block_News_List description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Block_News_List extends Magentostudy_News_Block_List
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Retrieve news collection
|
39 |
+
*
|
40 |
+
* @return Magentostudy_News_Model_Resource_Item_Collection
|
41 |
+
*/
|
42 |
+
public function getCollection()
|
43 |
+
{
|
44 |
+
if (is_null($this->_newsCollection)) {
|
45 |
+
/** @var Magentostudy_Tag_Model_Resource_News_Item_Collection $this->_newsCollection */
|
46 |
+
$this->_newsCollection = Mage::getResourceModel('magentostudy_tag/news_item_collection');
|
47 |
+
|
48 |
+
$tagTitle = $this->getRequest()->getParam('tag', '');
|
49 |
+
|
50 |
+
if ($tagTitle !== '') {
|
51 |
+
/** @var $tag Magentostudy_Tag_Model_Item */
|
52 |
+
$tag = Mage::getModel('magentostudy_tag/item');
|
53 |
+
$tag = $tag->load($tagTitle, 'title');
|
54 |
+
|
55 |
+
if ($tag->getId()) {
|
56 |
+
$this->_newsCollection
|
57 |
+
->filterByTag($tag);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
$this->_newsCollection->setPageSize(Mage::helper('magentostudy_news')->getNewsPerPage())
|
62 |
+
->setCurPage($this->getCurrentPage())
|
63 |
+
->setOrder('time_published', Varien_Data_Collection::SORT_ORDER_DESC);
|
64 |
+
}
|
65 |
+
|
66 |
+
return $this->_newsCollection;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Return URL to item's view page
|
71 |
+
*
|
72 |
+
* @param Magentostudy_News_Model_Item $newsItem
|
73 |
+
* @return string
|
74 |
+
*/
|
75 |
+
public function getItemUrl($newsItem)
|
76 |
+
{
|
77 |
+
$tagTitle = $this->getRequest()->getParam('tag', '');
|
78 |
+
|
79 |
+
if ($tagTitle) {
|
80 |
+
return $this->getUrl('magentostudy_news/index/view', array(
|
81 |
+
'id' => $newsItem->getId(),
|
82 |
+
'tag' => $tagTitle,
|
83 |
+
));
|
84 |
+
} else {
|
85 |
+
return parent::getItemUrl($newsItem);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
app/code/community/Magentostudy/Tag/Helper/Data.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Helper_Data description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Helper_Data extends Mage_Core_Helper_Data
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* News tag's statuses
|
39 |
+
*/
|
40 |
+
const STATUS_PENDING = 0;
|
41 |
+
const STATUS_APPROVED = 1;
|
42 |
+
|
43 |
+
const XML_PATH_ENABLED = 'newstag/view/enabled';
|
44 |
+
const XML_PATH_MODERATION_ENABLED = 'newstag/view/moderation_enabled';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Checks whether news tags can be displayed in the frontend
|
48 |
+
*
|
49 |
+
* @param int|string|Mage_Core_Model_Store $store
|
50 |
+
* @return boolean
|
51 |
+
*/
|
52 |
+
public function isEnabled($store = null)
|
53 |
+
{
|
54 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $store);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Checks whether news tags moderation is enabled
|
59 |
+
*
|
60 |
+
* @param int|string|Mage_Core_Model_Store $store
|
61 |
+
* @return boolean
|
62 |
+
*/
|
63 |
+
public function isModerationEnabled($store = null)
|
64 |
+
{
|
65 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_MODERATION_ENABLED, $store);
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Prepare page's statuses.
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
public function getAvailableStatuses()
|
74 |
+
{
|
75 |
+
$statuses = new Varien_Object(array(
|
76 |
+
self::STATUS_PENDING => Mage::helper('magentostudy_tag')->__('Pending'),
|
77 |
+
self::STATUS_APPROVED => Mage::helper('magentostudy_tag')->__('Approved'),
|
78 |
+
));
|
79 |
+
|
80 |
+
return $statuses->getData();
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Magentostudy/Tag/Model/Item.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Model_Item description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*
|
35 |
+
* @method string getTitle()
|
36 |
+
* @method int getCount()
|
37 |
+
* @method int getIsApproved()
|
38 |
+
* @method string getTimePublished()
|
39 |
+
* @method string getTimeCreated()
|
40 |
+
*
|
41 |
+
* @method Magentostudy_Tag_Model_Item setTitle(string $value)
|
42 |
+
* @method Magentostudy_Tag_Model_Item setCount(int $value)
|
43 |
+
* @method Magentostudy_Tag_Model_Item setIsApproved(int $value)
|
44 |
+
* @method Magentostudy_Tag_Model_Item setTimeCreated(string $value)
|
45 |
+
*/
|
46 |
+
class Magentostudy_Tag_Model_Item extends Mage_Core_Model_Abstract
|
47 |
+
{
|
48 |
+
/**
|
49 |
+
* Define resource model
|
50 |
+
*
|
51 |
+
* @return void
|
52 |
+
*/
|
53 |
+
protected function _construct()
|
54 |
+
{
|
55 |
+
$this->_init('magentostudy_tag/item');
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Set up created at date for new news items
|
60 |
+
*
|
61 |
+
* @return Magentostudy_Tag_Model_Item
|
62 |
+
*/
|
63 |
+
protected function _beforeSave()
|
64 |
+
{
|
65 |
+
parent::_beforeSave();
|
66 |
+
|
67 |
+
if ($this->isObjectNew()) {
|
68 |
+
$this->setData('time_created', $this->_getResource()->formatDate(time()));
|
69 |
+
}
|
70 |
+
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Tag given news item with existent or new tag
|
76 |
+
*
|
77 |
+
* @param Magentostudy_News_Model_Item $newsItem
|
78 |
+
* @param null|string $tag
|
79 |
+
* @return Magentostudy_Tag_Model_Item
|
80 |
+
*/
|
81 |
+
public function tagNewsItem(Magentostudy_News_Model_Item $newsItem, $tag = null)
|
82 |
+
{
|
83 |
+
if ($this->getId()) {
|
84 |
+
$this->save();
|
85 |
+
} else {
|
86 |
+
$this->setTitle($tag);
|
87 |
+
|
88 |
+
// if premoderation is disabled - set new tag as approved
|
89 |
+
if (Mage::helper('magentostudy_tag')->isModerationEnabled()) {
|
90 |
+
$this->setIsApproved(Magentostudy_Tag_Helper_Data::STATUS_PENDING);
|
91 |
+
} else {
|
92 |
+
$this->setIsApproved(Magentostudy_Tag_Helper_Data::STATUS_APPROVED);
|
93 |
+
}
|
94 |
+
|
95 |
+
$this->save();
|
96 |
+
}
|
97 |
+
|
98 |
+
/** @var Magentostudy_Tag_Model_Resource_Item $resourceModel */
|
99 |
+
$resourceModel = $this->getResource();
|
100 |
+
$resourceModel->updateNewsItemWeight($this, $newsItem);
|
101 |
+
$resourceModel->updateCloudWeight($this);
|
102 |
+
|
103 |
+
return $this;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Untag given news item
|
108 |
+
*
|
109 |
+
* @param Magentostudy_News_Model_Item $newsItem
|
110 |
+
* @param array $tagIds
|
111 |
+
* @return Magentostudy_Tag_Model_Item
|
112 |
+
*/
|
113 |
+
public function untagNewsItem(Magentostudy_News_Model_Item $newsItem, array $tagIds)
|
114 |
+
{
|
115 |
+
$this->getResource()
|
116 |
+
->untagNewsItem($newsItem, $tagIds);
|
117 |
+
|
118 |
+
return $this;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Remove given tag from given news items
|
123 |
+
*
|
124 |
+
* @param Magentostudy_Tag_Model_Item $tag
|
125 |
+
* @param array $newsItemsIds
|
126 |
+
* @return Magentostudy_Tag_Model_Item
|
127 |
+
*/
|
128 |
+
public function removeTag(Magentostudy_Tag_Model_Item $tag, array $newsItemsIds)
|
129 |
+
{
|
130 |
+
$this->getResource()
|
131 |
+
->removeTag($tag, $newsItemsIds);
|
132 |
+
|
133 |
+
return $this;
|
134 |
+
}
|
135 |
+
}
|
app/code/community/Magentostudy/Tag/Model/Resource/Item.php
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Model_Resource_Item description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Model_Resource_Item extends Mage_Core_Model_Mysql4_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Initialize connection and define main table and primary key
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
protected function _construct()
|
43 |
+
{
|
44 |
+
$this->_init('magentostudy_tag/item', 'tag_id');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Update news tag - news item relation weight
|
49 |
+
*
|
50 |
+
* @param Magentostudy_Tag_Model_Item $tag
|
51 |
+
* @param Magentostudy_News_Model_Item $newsItem
|
52 |
+
* @return Magentostudy_Tag_Model_Resource_Item
|
53 |
+
*/
|
54 |
+
public function updateNewsItemWeight(Magentostudy_Tag_Model_Item $tag, Magentostudy_News_Model_Item $newsItem)
|
55 |
+
{
|
56 |
+
$db = $this->_getWriteAdapter();
|
57 |
+
|
58 |
+
$data = array(
|
59 |
+
'news_tag_id' => $tag->getId(),
|
60 |
+
'news_item_id' => $newsItem->getId(),
|
61 |
+
'weight' => 1,
|
62 |
+
);
|
63 |
+
|
64 |
+
$onDuplicateKeyUpdates = array(
|
65 |
+
'weight' => new Zend_Db_Expr("weight + 1")
|
66 |
+
);
|
67 |
+
|
68 |
+
$db->insertOnDuplicate($this->getTable('magentostudy_tag/relation'), $data, $onDuplicateKeyUpdates);
|
69 |
+
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Update news tag cloud weight
|
75 |
+
*
|
76 |
+
* @param Magentostudy_Tag_Model_Item $tag
|
77 |
+
* @return Magentostudy_Tag_Model_Resource_Item
|
78 |
+
*/
|
79 |
+
public function updateCloudWeight(Magentostudy_Tag_Model_Item $tag)
|
80 |
+
{
|
81 |
+
$db = $this->_getWriteAdapter();
|
82 |
+
|
83 |
+
$data = array(
|
84 |
+
'news_tag_id' => $tag->getId(),
|
85 |
+
'weight' => 1,
|
86 |
+
);
|
87 |
+
|
88 |
+
$onDuplicateKeyUpdates = array(
|
89 |
+
'weight' => new Zend_Db_Expr("weight + 1")
|
90 |
+
);
|
91 |
+
|
92 |
+
$db->insertOnDuplicate($this->getTable('magentostudy_tag/cloud'), $data, $onDuplicateKeyUpdates);
|
93 |
+
|
94 |
+
return $this;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Recalculate news tag cloud weight
|
99 |
+
*
|
100 |
+
* @param int $tagId
|
101 |
+
* @return Magentostudy_Tag_Model_Resource_Item
|
102 |
+
*/
|
103 |
+
public function recalculateTagCloudWeight($tagId)
|
104 |
+
{
|
105 |
+
$readAdapter = $this->_getReadAdapter();
|
106 |
+
$cloudWeight = 0;
|
107 |
+
|
108 |
+
$query = $readAdapter->select()
|
109 |
+
->from($this->getTable('magentostudy_tag/relation'), array(
|
110 |
+
'cloud_weight' => new Zend_Db_Expr('SUM(weight)')
|
111 |
+
))->where('news_tag_id = ?', $tagId);
|
112 |
+
|
113 |
+
$result = $readAdapter->fetchAssoc($query);
|
114 |
+
|
115 |
+
if (count($result) > 0) {
|
116 |
+
$row = current($result);
|
117 |
+
$cloudWeight = $row['cloud_weight'] ? $row['cloud_weight'] : $cloudWeight;
|
118 |
+
}
|
119 |
+
|
120 |
+
$this->_getWriteAdapter()
|
121 |
+
->update($this->getTable('magentostudy_tag/cloud'),
|
122 |
+
array('weight' => $cloudWeight),
|
123 |
+
array('news_tag_id = ?' => $tagId)
|
124 |
+
);
|
125 |
+
|
126 |
+
return $this;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Untag given news item with given tags
|
131 |
+
*
|
132 |
+
* @param Magentostudy_News_Model_Item $newsItem
|
133 |
+
* @param array $tagIds
|
134 |
+
* @return Magentostudy_Tag_Model_Resource_Item
|
135 |
+
*/
|
136 |
+
public function untagNewsItem(Magentostudy_News_Model_Item $newsItem, array $tagIds)
|
137 |
+
{
|
138 |
+
$writeAdapter = $this->_getWriteAdapter();
|
139 |
+
$writeAdapter->delete($this->getTable('magentostudy_tag/relation'),
|
140 |
+
array(
|
141 |
+
'news_item_id = ?' => $newsItem->getId(),
|
142 |
+
$writeAdapter->quoteInto('`news_tag_id` IN (?)', $tagIds)
|
143 |
+
)
|
144 |
+
);
|
145 |
+
|
146 |
+
foreach ($tagIds as $tagId) {
|
147 |
+
$this->recalculateTagCloudWeight($tagId);
|
148 |
+
}
|
149 |
+
|
150 |
+
return $this;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Remove given tag from given news items
|
155 |
+
*
|
156 |
+
* @param Magentostudy_Tag_Model_Item $tag
|
157 |
+
* @param array $newsItemsIds
|
158 |
+
* @return Magentostudy_Tag_Model_Resource_Item
|
159 |
+
*/
|
160 |
+
public function removeTag(Magentostudy_Tag_Model_Item $tag, array $newsItemsIds)
|
161 |
+
{
|
162 |
+
$writeAdapter = $this->_getWriteAdapter();
|
163 |
+
$writeAdapter->delete($this->getTable('magentostudy_tag/relation'),
|
164 |
+
array(
|
165 |
+
'news_tag_id = ?' => $tag->getId(),
|
166 |
+
$writeAdapter->quoteInto('`news_item_id` IN (?)', $newsItemsIds)
|
167 |
+
)
|
168 |
+
);
|
169 |
+
|
170 |
+
$this->recalculateTagCloudWeight($tag->getId());
|
171 |
+
|
172 |
+
return $this;
|
173 |
+
}
|
174 |
+
}
|
app/code/community/Magentostudy/Tag/Model/Resource/Item/Collection.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Model_Resource_Item_Collection description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Model_Resource_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Define collection model
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
protected function _construct()
|
43 |
+
{
|
44 |
+
$this->_init('magentostudy_tag/item');
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Add weight column from cloud table
|
49 |
+
*
|
50 |
+
* @return Magentostudy_Tag_Model_Resource_Item_Collection
|
51 |
+
*/
|
52 |
+
public function addWeightFromCloud()
|
53 |
+
{
|
54 |
+
$this->join('magentostudy_tag/cloud', 'tag_id = news_tag_id', 'weight');
|
55 |
+
|
56 |
+
return $this;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Add weight column from relation table for given news item
|
61 |
+
*
|
62 |
+
* @param Magentostudy_News_Model_Item $newsItem
|
63 |
+
* @return Magentostudy_Tag_Model_Resource_Item_Collection
|
64 |
+
*/
|
65 |
+
public function addWeightForNewsItem(Magentostudy_News_Model_Item $newsItem)
|
66 |
+
{
|
67 |
+
$this->join('magentostudy_tag/relation', 'news_tag_id = tag_id')
|
68 |
+
->addFilter('news_item_id', $newsItem->getId());
|
69 |
+
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
}
|
app/code/community/Magentostudy/Tag/Model/Resource/News/Item/Collection.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package News
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* News collection for news tags purposes.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Model_Resource_News_Item_Collection extends Magentostudy_News_Model_Resource_Item_Collection
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Filter news list by tag
|
39 |
+
*
|
40 |
+
* @param Magentostudy_Tag_Model_Item $tag
|
41 |
+
* @return Magentostudy_Tag_Model_Resource_News_Item_Collection
|
42 |
+
*/
|
43 |
+
public function filterByTag(Magentostudy_Tag_Model_Item $tag)
|
44 |
+
{
|
45 |
+
if ($tag->getId()) {
|
46 |
+
$this->join('magentostudy_tag/relation', 'news_item_id = item_id')
|
47 |
+
->addFilter("news_tag_id", $tag->getId());
|
48 |
+
}
|
49 |
+
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Magentostudy/Tag/controllers/Adminhtml/NewstagController.php
ADDED
@@ -0,0 +1,459 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_Adminhtml_NewstagController description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_Adminhtml_NewstagController extends Mage_Adminhtml_Controller_Action
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Init actions
|
39 |
+
*
|
40 |
+
* @return Magentostudy_Newstagtag_Adminhtml_TagController
|
41 |
+
*/
|
42 |
+
protected function _initAction()
|
43 |
+
{
|
44 |
+
// load layout, set active menu and breadcrumbs
|
45 |
+
$this->loadLayout()
|
46 |
+
->_setActiveMenu('news/manage')
|
47 |
+
->_addBreadcrumb(
|
48 |
+
Mage::helper('magentostudy_tag')->__('News Tags'),
|
49 |
+
Mage::helper('magentostudy_tag')->__('News Tags')
|
50 |
+
)
|
51 |
+
->_addBreadcrumb(
|
52 |
+
Mage::helper('magentostudy_tag')->__('Manage News Tags'),
|
53 |
+
Mage::helper('magentostudy_tag')->__('Manage News Tags')
|
54 |
+
);
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Check the permission to run it
|
60 |
+
*
|
61 |
+
* @return boolean
|
62 |
+
*/
|
63 |
+
protected function _isAllowed()
|
64 |
+
{
|
65 |
+
switch ($this->getRequest()->getActionName()) {
|
66 |
+
case 'new':
|
67 |
+
case 'save':
|
68 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage/save');
|
69 |
+
break;
|
70 |
+
case 'delete':
|
71 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage/delete');
|
72 |
+
break;
|
73 |
+
case 'approve':
|
74 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage/approve');
|
75 |
+
break;
|
76 |
+
default:
|
77 |
+
return Mage::getSingleton('admin/session')->isAllowed('newstag/manage');
|
78 |
+
break;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Index action
|
84 |
+
*
|
85 |
+
* @return void
|
86 |
+
*/
|
87 |
+
public function indexAction()
|
88 |
+
{
|
89 |
+
$this->_title($this->__('News Tags'))
|
90 |
+
->_title($this->__('Manage News Tags'));
|
91 |
+
|
92 |
+
$this->_initAction();
|
93 |
+
$this->renderLayout();
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Create new news tag
|
99 |
+
*
|
100 |
+
* @return void
|
101 |
+
*/
|
102 |
+
public function newAction()
|
103 |
+
{
|
104 |
+
// the same form is used to create and edit
|
105 |
+
$this->_forward('edit');
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Edit news tag
|
110 |
+
*
|
111 |
+
* @return void
|
112 |
+
*/
|
113 |
+
public function editAction()
|
114 |
+
{
|
115 |
+
$this->_title($this->__('News Tags'))
|
116 |
+
->_title($this->__('Manage News Tags'));
|
117 |
+
|
118 |
+
// 1. instance news tag model
|
119 |
+
/** @var $model Magentostudy_Tag_Model_Item */
|
120 |
+
$model = Mage::getModel('magentostudy_tag/item');
|
121 |
+
|
122 |
+
// 2. if exists id, check it and load data
|
123 |
+
$tagId = $this->getRequest()->getParam('id');
|
124 |
+
if ($tagId) {
|
125 |
+
$model->load($tagId);
|
126 |
+
|
127 |
+
if (!$model->getId()) {
|
128 |
+
$this->_getSession()->addError(
|
129 |
+
Mage::helper('magentostudy_tag')->__('News tag does not exist.')
|
130 |
+
);
|
131 |
+
$this->_redirect('*/*/');
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
// prepare title
|
135 |
+
$this->_title($model->getTitle());
|
136 |
+
$breadCrumb = Mage::helper('magentostudy_tag')->__('Edit Item');
|
137 |
+
} else {
|
138 |
+
$this->_title(Mage::helper('magentostudy_tag')->__('New Item'));
|
139 |
+
$breadCrumb = Mage::helper('magentostudy_tag')->__('New Item');
|
140 |
+
}
|
141 |
+
|
142 |
+
// Init breadcrumbs
|
143 |
+
$this->_initAction()->_addBreadcrumb($breadCrumb, $breadCrumb);
|
144 |
+
|
145 |
+
// 3. Set entered data if was error when we do save
|
146 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
147 |
+
if (!empty($data)) {
|
148 |
+
$model->addData($data);
|
149 |
+
}
|
150 |
+
|
151 |
+
// 4. Register model to use later in blocks
|
152 |
+
Mage::register('tag_item', $model);
|
153 |
+
|
154 |
+
// 5. render layout
|
155 |
+
$this->renderLayout();
|
156 |
+
}
|
157 |
+
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Delete news tag action
|
161 |
+
*
|
162 |
+
* @return void
|
163 |
+
*/
|
164 |
+
public function deleteAction()
|
165 |
+
{
|
166 |
+
// check if we know what should be deleted
|
167 |
+
$itemId = $this->getRequest()->getParam('id');
|
168 |
+
if ($itemId) {
|
169 |
+
try {
|
170 |
+
// init model and delete
|
171 |
+
/** @var $model Magentostudy_Tag_Model_Item */
|
172 |
+
$model = Mage::getModel('magentostudy_tag/item');
|
173 |
+
$model->load($itemId);
|
174 |
+
if (!$model->getId()) {
|
175 |
+
Mage::throwException(Mage::helper('magentostudy_tag')->__('Unable to find a news tag.'));
|
176 |
+
}
|
177 |
+
$model->delete();
|
178 |
+
|
179 |
+
// display success message
|
180 |
+
$this->_getSession()->addSuccess(
|
181 |
+
Mage::helper('magentostudy_tag')->__('The news tag has been deleted.')
|
182 |
+
);
|
183 |
+
} catch (Mage_Core_Exception $e) {
|
184 |
+
$this->_getSession()->addError($e->getMessage());
|
185 |
+
} catch (Exception $e) {
|
186 |
+
$this->_getSession()->addException($e,
|
187 |
+
Mage::helper('magentostudy_tag')->__('An error occurred while deleting the news tag.')
|
188 |
+
);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
// go to grid
|
193 |
+
$this->_redirect('*/*/');
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Save news tag action
|
198 |
+
*
|
199 |
+
* @return void
|
200 |
+
*/
|
201 |
+
public function saveAction()
|
202 |
+
{
|
203 |
+
$redirectPath = '*/*';
|
204 |
+
$redirectParams = array();
|
205 |
+
|
206 |
+
// check if data sent
|
207 |
+
$data = $this->getRequest()->getPost();
|
208 |
+
$data = $data['tag'];
|
209 |
+
if ($data) {
|
210 |
+
// init model and set data
|
211 |
+
/** @var $model Magentostudy_Tag_Model_Item */
|
212 |
+
$model = Mage::getModel('magentostudy_tag/item');
|
213 |
+
|
214 |
+
// if news tag item exists, try to load it
|
215 |
+
$tagId = $this->getRequest()->getParam('id');
|
216 |
+
if ($tagId) {
|
217 |
+
$model->load($tagId);
|
218 |
+
}
|
219 |
+
|
220 |
+
$model->addData($data);
|
221 |
+
|
222 |
+
try {
|
223 |
+
$hasError = false;
|
224 |
+
// save the data
|
225 |
+
$model->save();
|
226 |
+
|
227 |
+
// display success message
|
228 |
+
$this->_getSession()->addSuccess(
|
229 |
+
Mage::helper('magentostudy_tag')->__('News tag has been saved.')
|
230 |
+
);
|
231 |
+
|
232 |
+
// check if 'Save and Continue'
|
233 |
+
if ($this->getRequest()->getParam('back')) {
|
234 |
+
$redirectPath = '*/*/edit';
|
235 |
+
$redirectParams = array('id' => $model->getId());
|
236 |
+
}
|
237 |
+
} catch (Mage_Core_Exception $e) {
|
238 |
+
$hasError = true;
|
239 |
+
$this->_getSession()->addError($e->getMessage());
|
240 |
+
} catch (Exception $e) {
|
241 |
+
$hasError = true;
|
242 |
+
$this->_getSession()->addException($e,
|
243 |
+
Mage::helper('magentostudy_tag')->__('An error occurred while saving news tag.')
|
244 |
+
);
|
245 |
+
}
|
246 |
+
|
247 |
+
if ($hasError) {
|
248 |
+
$this->_getSession()->setFormData($data);
|
249 |
+
$redirectPath = '*/*/edit';
|
250 |
+
$redirectParams = array('id' => $this->getRequest()->getParam('id'));
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
$this->_redirect($redirectPath, $redirectParams);
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Grid ajax action
|
259 |
+
*
|
260 |
+
* @return void
|
261 |
+
*/
|
262 |
+
public function gridAction()
|
263 |
+
{
|
264 |
+
$this->loadLayout();
|
265 |
+
$this->renderLayout();
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Grid ajax action
|
270 |
+
*
|
271 |
+
* @return void
|
272 |
+
*/
|
273 |
+
public function gridRelatedNewsAction()
|
274 |
+
{
|
275 |
+
/** @var $model Magentostudy_Tag_Model_Item */
|
276 |
+
$model = Mage::getModel('magentostudy_tag/item');
|
277 |
+
|
278 |
+
$tagId = $this->getRequest()->getParam('id');
|
279 |
+
if ($tagId) {
|
280 |
+
$model->load($tagId);
|
281 |
+
}
|
282 |
+
|
283 |
+
Mage::register('tag_item', $model);
|
284 |
+
|
285 |
+
$this->loadLayout();
|
286 |
+
$this->getLayout()->getBlock('tag_edit_tab_relatednews');
|
287 |
+
$this->renderLayout();
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Grid ajax action
|
292 |
+
*
|
293 |
+
* @return void
|
294 |
+
*/
|
295 |
+
public function gridAssignedTagsAction()
|
296 |
+
{
|
297 |
+
/** @var $model Magentostudy_News_Model_Item */
|
298 |
+
$model = Mage::getModel('news/item');
|
299 |
+
|
300 |
+
$newsItemId = $this->getRequest()->getParam('id');
|
301 |
+
if ($newsItemId) {
|
302 |
+
$model->load($newsItemId);
|
303 |
+
}
|
304 |
+
|
305 |
+
Mage::register('news_item', $model);
|
306 |
+
|
307 |
+
$this->loadLayout();
|
308 |
+
$this->getLayout()->getBlock('news_edit_tab_assignedtags');
|
309 |
+
$this->renderLayout();
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Mass tags delete action
|
314 |
+
*
|
315 |
+
* @return void
|
316 |
+
*/
|
317 |
+
public function massDeleteAction()
|
318 |
+
{
|
319 |
+
$tagIds = $this->getRequest()
|
320 |
+
->getParam('tag_id');
|
321 |
+
|
322 |
+
if (!is_array($tagIds)) {
|
323 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magentostudy_tag')
|
324 |
+
->__('Please select news tags(s) to delete.'));
|
325 |
+
} else {
|
326 |
+
try {
|
327 |
+
/** @var $model Magentostudy_Tag_Model_Item */
|
328 |
+
$model = Mage::getModel('magentostudy_tag/item');
|
329 |
+
foreach ($tagIds as $tagId) {
|
330 |
+
$model->load($tagId)
|
331 |
+
->delete();
|
332 |
+
}
|
333 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
334 |
+
Mage::helper('magentostudy_tag')->__(
|
335 |
+
'Total of %d tag(s) were deleted.', count($tagIds)
|
336 |
+
)
|
337 |
+
);
|
338 |
+
} catch (Exception $e) {
|
339 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
340 |
+
}
|
341 |
+
}
|
342 |
+
$this->_redirect('*/*/index');
|
343 |
+
}
|
344 |
+
|
345 |
+
/**
|
346 |
+
* Mass tags approve action
|
347 |
+
*
|
348 |
+
* @return void
|
349 |
+
*/
|
350 |
+
public function massApproveAction()
|
351 |
+
{
|
352 |
+
$tagIds = $this->getRequest()
|
353 |
+
->getParam('tag_id');
|
354 |
+
|
355 |
+
if (!is_array($tagIds)) {
|
356 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magentostudy_tag')
|
357 |
+
->__('Please select news tags(s) to approve.'));
|
358 |
+
} else {
|
359 |
+
try {
|
360 |
+
/** @var $model Magentostudy_Tag_Model_Item */
|
361 |
+
$model = Mage::getModel('magentostudy_tag/item');
|
362 |
+
foreach ($tagIds as $tagId) {
|
363 |
+
$model->load($tagId);
|
364 |
+
if ($model->getIsApproved() != Magentostudy_Tag_Helper_Data::STATUS_APPROVED) {
|
365 |
+
$model->setIsApproved(Magentostudy_Tag_Helper_Data::STATUS_APPROVED)
|
366 |
+
->save();
|
367 |
+
}
|
368 |
+
}
|
369 |
+
|
370 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
371 |
+
Mage::helper('magentostudy_tag')->__(
|
372 |
+
'Total of %d tag(s) were approved.', count($tagIds)
|
373 |
+
)
|
374 |
+
);
|
375 |
+
} catch (Exception $e) {
|
376 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
377 |
+
}
|
378 |
+
}
|
379 |
+
$this->_redirect('*/*/index');
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Mass untag action
|
384 |
+
*
|
385 |
+
* @return void
|
386 |
+
*/
|
387 |
+
public function massUntagAction()
|
388 |
+
{
|
389 |
+
$newItemId = $this->getRequest()
|
390 |
+
->getParam('id');
|
391 |
+
$tagIds = $this->getRequest()
|
392 |
+
->getParam('tag_id');
|
393 |
+
|
394 |
+
/** @var $newsItem Magentostudy_News_Model_Item */
|
395 |
+
$newsItem = Mage::getModel('news/item');
|
396 |
+
$newsItem = $newsItem->load($newItemId);
|
397 |
+
|
398 |
+
if (!$newsItem->getId()) {
|
399 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magentostudy_tag')
|
400 |
+
->__('News item does not exists.'));
|
401 |
+
} elseif (!is_array($tagIds)) {
|
402 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magentostudy_tag')
|
403 |
+
->__('Please select news tags(s) to untag.'));
|
404 |
+
} else {
|
405 |
+
try {
|
406 |
+
/** @var $tagModel Magentostudy_Tag_Model_Item */
|
407 |
+
$tagModel = Mage::getModel('magentostudy_tag/item');
|
408 |
+
$tagModel->untagNewsItem($newsItem, $tagIds);
|
409 |
+
|
410 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
411 |
+
Mage::helper('magentostudy_tag')->__(
|
412 |
+
'Total of %d tag(s) were untagged.', count($tagIds)
|
413 |
+
)
|
414 |
+
);
|
415 |
+
} catch (Exception $e) {
|
416 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
417 |
+
}
|
418 |
+
}
|
419 |
+
$this->_redirect('*/news/edit', array('id' => $this->getRequest()->getParam('id')));
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Mass remove tag action
|
424 |
+
*
|
425 |
+
* @return void
|
426 |
+
*/
|
427 |
+
public function massRemoveTagAction()
|
428 |
+
{
|
429 |
+
$tagId = $this->getRequest()
|
430 |
+
->getParam('id');
|
431 |
+
$newsItemIds = $this->getRequest()
|
432 |
+
->getParam('item_id');
|
433 |
+
|
434 |
+
/** @var $tag Magentostudy_Tag_Model_Item */
|
435 |
+
$tag = Mage::getModel('magentostudy_tag/item');
|
436 |
+
$tag = $tag->load($tagId);
|
437 |
+
|
438 |
+
if (!$tag->getId()) {
|
439 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magentostudy_tag')
|
440 |
+
->__('Tag does not exists.'));
|
441 |
+
} elseif (!is_array($newsItemIds)) {
|
442 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('magentostudy_tag')
|
443 |
+
->__('Please select news items(s) to remove news tag.'));
|
444 |
+
} else {
|
445 |
+
try {
|
446 |
+
$tag->removeTag($tag, $newsItemIds);
|
447 |
+
|
448 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
449 |
+
Mage::helper('magentostudy_tag')->__(
|
450 |
+
'From total of %d news items(s) news tag was removed.', count($newsItemIds)
|
451 |
+
)
|
452 |
+
);
|
453 |
+
} catch (Exception $e) {
|
454 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
455 |
+
}
|
456 |
+
}
|
457 |
+
$this->_redirect('*/newstag/edit', array('id' => $this->getRequest()->getParam('id')));
|
458 |
+
}
|
459 |
+
}
|
app/code/community/Magentostudy/Tag/controllers/IndexController.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Magentostudy
|
22 |
+
* @package Tag
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Class Magentostudy_Tag_IndexController description.
|
30 |
+
*
|
31 |
+
* @category Magentostudy
|
32 |
+
* @package Tag
|
33 |
+
* @author Magento PaaS Team <paas@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Magentostudy_Tag_IndexController extends Mage_Core_Controller_Front_Action
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Add new tag to news item
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function addAction()
|
43 |
+
{
|
44 |
+
if (!Mage::helper('magentostudy_tag')->isEnabled()) {
|
45 |
+
$this->_forward('noRoute');
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
+
$newsItemId = $this->getRequest()->getParam('id');
|
50 |
+
$tag = $this->getRequest()->getParam('tag');
|
51 |
+
if (!$newsItemId || !$tag) {
|
52 |
+
$this->_forward('noRoute');
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
|
56 |
+
/** @var $tagModel Magentostudy_Tag_Model_Item */
|
57 |
+
$tagModel = Mage::getModel('magentostudy_tag/item');
|
58 |
+
$tagModel->load($tag, 'title');
|
59 |
+
|
60 |
+
/** @var $newsItemModel Magentostudy_News_Model_Item */
|
61 |
+
$newsItemModel = Mage::getModel('news/item');
|
62 |
+
$newsItemModel->load($newsItemId);
|
63 |
+
|
64 |
+
try {
|
65 |
+
$hasError = false;
|
66 |
+
$tagModel->tagNewsItem($newsItemModel, $tag);
|
67 |
+
} catch (Mage_Core_Exception $e) {
|
68 |
+
$hasError = true;
|
69 |
+
Mage::getSingleton('core/session')->addError(
|
70 |
+
$e->getMessage()
|
71 |
+
);
|
72 |
+
} catch (Exception $e) {
|
73 |
+
$hasError = true;
|
74 |
+
Mage::getSingleton('core/session')->addError(
|
75 |
+
Mage::helper('magentostudy_tag')->__(
|
76 |
+
'Unknown error happened while adding new news tag.'
|
77 |
+
)
|
78 |
+
);
|
79 |
+
}
|
80 |
+
|
81 |
+
if (!$hasError) {
|
82 |
+
if (!$tagModel->getIsApproved()) {
|
83 |
+
Mage::getSingleton('core/session')->addNotice(
|
84 |
+
Mage::helper('magentostudy_tag')->__('News Item was tagged successfully with tag "%s".', $tag)
|
85 |
+
. ' '
|
86 |
+
. Mage::helper('magentostudy_tag')->__('Your tag submission will be reviewed in next 24 hours.')
|
87 |
+
);
|
88 |
+
} else {
|
89 |
+
Mage::getSingleton('core/session')->addSuccess(
|
90 |
+
Mage::helper('magentostudy_tag')->__('News Item was tagged successfully with tag "%s".', $tag)
|
91 |
+
);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
$redirectPath = 'magentostudy_news/index/view';
|
96 |
+
$redirectParams = array('id' => $newsItemId);
|
97 |
+
$this->_redirect($redirectPath, $redirectParams);
|
98 |
+
}
|
99 |
+
}
|
app/code/community/Magentostudy/Tag/etc/adminhtml.xml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento admin config
|
5 |
+
*
|
6 |
+
* @author Magento
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<menu>
|
11 |
+
<news>
|
12 |
+
<children>
|
13 |
+
<newstag translate="title" module="magentostudy_tag">
|
14 |
+
<title>Manage News Tags</title>
|
15 |
+
<action>adminhtml/newstag</action>
|
16 |
+
<sort_order>60</sort_order>
|
17 |
+
</newstag>
|
18 |
+
</children>
|
19 |
+
</news>
|
20 |
+
</menu>
|
21 |
+
|
22 |
+
<acl>
|
23 |
+
<resources>
|
24 |
+
<admin>
|
25 |
+
<children>
|
26 |
+
<newstag translate="title" module="magentostudy_tag">
|
27 |
+
<title>News Tags</title>
|
28 |
+
<sort_order>67</sort_order>
|
29 |
+
<children>
|
30 |
+
<manage translate="title">
|
31 |
+
<title>Manage News Tags</title>
|
32 |
+
<sort_order>10</sort_order>
|
33 |
+
<children>
|
34 |
+
<save translate="title">
|
35 |
+
<title>Save Tags</title>
|
36 |
+
<sort_order>0</sort_order>
|
37 |
+
</save>
|
38 |
+
<delete translate="title">
|
39 |
+
<title>Delete Tags</title>
|
40 |
+
<sort_order>10</sort_order>
|
41 |
+
</delete>
|
42 |
+
<approve translate="title">
|
43 |
+
<title>Approve Tags</title>
|
44 |
+
<sort_order>20</sort_order>
|
45 |
+
</approve>
|
46 |
+
</children>
|
47 |
+
</manage>
|
48 |
+
</children>
|
49 |
+
</newstag>
|
50 |
+
<system>
|
51 |
+
<children>
|
52 |
+
<config>
|
53 |
+
<children>
|
54 |
+
<newstag translate="title" module="magentostudy_tag">
|
55 |
+
<title>News Tags Management</title>
|
56 |
+
</newstag>
|
57 |
+
</children>
|
58 |
+
</config>
|
59 |
+
</children>
|
60 |
+
</system>
|
61 |
+
</children>
|
62 |
+
</admin>
|
63 |
+
</resources>
|
64 |
+
</acl>
|
65 |
+
</config>
|
app/code/community/Magentostudy/Tag/etc/config.xml
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Magentostudy_Tag>
|
5 |
+
<version>1.0.0.0</version>
|
6 |
+
</Magentostudy_Tag>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<magentostudy_tag>
|
12 |
+
<class>Magentostudy_Tag_Model</class>
|
13 |
+
<resourceModel>magentostudy_tag_resource</resourceModel>
|
14 |
+
</magentostudy_tag>
|
15 |
+
|
16 |
+
<magentostudy_tag_resource>
|
17 |
+
<class>Magentostudy_Tag_Model_Resource</class>
|
18 |
+
<entities>
|
19 |
+
<item>
|
20 |
+
<table>news_tag</table>
|
21 |
+
</item>
|
22 |
+
<relation>
|
23 |
+
<table>news_tag_relation</table>
|
24 |
+
</relation>
|
25 |
+
<cloud>
|
26 |
+
<table>news_tag_cloud</table>
|
27 |
+
</cloud>
|
28 |
+
</entities>
|
29 |
+
</magentostudy_tag_resource>
|
30 |
+
</models>
|
31 |
+
|
32 |
+
<helpers>
|
33 |
+
<magentostudy_tag>
|
34 |
+
<class>Magentostudy_Tag_Helper</class>
|
35 |
+
</magentostudy_tag>
|
36 |
+
</helpers>
|
37 |
+
|
38 |
+
<blocks>
|
39 |
+
<magentostudy_tag>
|
40 |
+
<class>Magentostudy_Tag_Block</class>
|
41 |
+
</magentostudy_tag>
|
42 |
+
</blocks>
|
43 |
+
|
44 |
+
<resources>
|
45 |
+
<magentostudy_tag_setup>
|
46 |
+
<setup>
|
47 |
+
<module>Magentostudy_Tag</module>
|
48 |
+
<class>Mage_Core_Model_Resource_Setup</class>
|
49 |
+
</setup>
|
50 |
+
</magentostudy_tag_setup>
|
51 |
+
</resources>
|
52 |
+
</global>
|
53 |
+
|
54 |
+
<frontend>
|
55 |
+
<routers>
|
56 |
+
<magentostudy_tag>
|
57 |
+
<use>standard</use>
|
58 |
+
<args>
|
59 |
+
<module>Magentostudy_Tag</module>
|
60 |
+
<frontName>newstag</frontName>
|
61 |
+
</args>
|
62 |
+
</magentostudy_tag>
|
63 |
+
</routers>
|
64 |
+
|
65 |
+
<layout>
|
66 |
+
<updates>
|
67 |
+
<magentostudy_tag>
|
68 |
+
<file>newstag.xml</file>
|
69 |
+
</magentostudy_tag>
|
70 |
+
</updates>
|
71 |
+
</layout>
|
72 |
+
</frontend>
|
73 |
+
|
74 |
+
<admin>
|
75 |
+
<routers>
|
76 |
+
<adminhtml>
|
77 |
+
<args>
|
78 |
+
<modules>
|
79 |
+
<Magentostudy_Tag before="Mage_Adminhtml">Magentostudy_Tag_Adminhtml</Magentostudy_Tag>
|
80 |
+
</modules>
|
81 |
+
</args>
|
82 |
+
</adminhtml>
|
83 |
+
</routers>
|
84 |
+
</admin>
|
85 |
+
|
86 |
+
<adminhtml>
|
87 |
+
<layout>
|
88 |
+
<updates>
|
89 |
+
<magentostudy_tag>
|
90 |
+
<file>newstag.xml</file>
|
91 |
+
</magentostudy_tag>
|
92 |
+
</updates>
|
93 |
+
</layout>
|
94 |
+
</adminhtml>
|
95 |
+
|
96 |
+
<default>
|
97 |
+
<newstag>
|
98 |
+
<view>
|
99 |
+
<enabled>1</enabled>
|
100 |
+
<moderation_enabled>1</moderation_enabled>
|
101 |
+
</view>
|
102 |
+
</newstag>
|
103 |
+
</default>
|
104 |
+
</config>
|
app/code/community/Magentostudy/Tag/etc/system.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<newstag>
|
5 |
+
<class>separator-top</class>
|
6 |
+
<label>News Tags</label>
|
7 |
+
<tab>general</tab>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>510</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
|
14 |
+
<groups>
|
15 |
+
<view translate="label">
|
16 |
+
<label>News Tags Settings</label>
|
17 |
+
<frontend_type>text</frontend_type>
|
18 |
+
<sort_order>10</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
<fields>
|
23 |
+
<enabled translate="label">
|
24 |
+
<label>Enable News Tags On Frontend</label>
|
25 |
+
<frontend_type>select</frontend_type>
|
26 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
27 |
+
<sort_order>10</sort_order>
|
28 |
+
<show_in_default>1</show_in_default>
|
29 |
+
<show_in_website>1</show_in_website>
|
30 |
+
<show_in_store>1</show_in_store>
|
31 |
+
</enabled>
|
32 |
+
<moderation_enabled translate="label">
|
33 |
+
<label>Enable News Tags Moderation</label>
|
34 |
+
<frontend_type>select</frontend_type>
|
35 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
36 |
+
<depends><enabled>1</enabled></depends>
|
37 |
+
<sort_order>120</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
</moderation_enabled>
|
42 |
+
</fields>
|
43 |
+
</view>
|
44 |
+
</groups>
|
45 |
+
</newstag>
|
46 |
+
</sections>
|
47 |
+
</config>
|
app/code/community/Magentostudy/Tag/sql/magentostudy_tag_setup/mysql4-install-1.0.0.0.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** @var $installer Mage_Core_Model_Resource_Setup */
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
// prepare database environment before create table
|
7 |
+
$installer->startSetup();
|
8 |
+
|
9 |
+
$installer->run("
|
10 |
+
DROP TABLE IF EXISTS `{$installer->getTable('magentostudy_tag/item')}`;
|
11 |
+
CREATE TABLE `{$installer->getTable('magentostudy_tag/item')}` (
|
12 |
+
`tag_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
13 |
+
`title` varchar(255) DEFAULT NULL,
|
14 |
+
`is_approved` tinyint(1) unsigned NOT NULL,
|
15 |
+
`time_created` timestamp NULL DEFAULT NULL,
|
16 |
+
PRIMARY KEY (`tag_id`)
|
17 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
18 |
+
");
|
19 |
+
|
20 |
+
$installer->run("
|
21 |
+
DROP TABLE IF EXISTS `{$installer->getTable('magentostudy_tag/relation')}`;
|
22 |
+
CREATE TABLE `{$installer->getTable('magentostudy_tag/relation')}` (
|
23 |
+
`news_tag_id` INT(11) UNSIGNED NOT NULL,
|
24 |
+
`news_item_id` INT(11) UNSIGNED NOT NULL,
|
25 |
+
`weight` INT(11) UNSIGNED NOT NULL DEFAULT '1',
|
26 |
+
PRIMARY KEY (`news_tag_id`, `news_item_id`),
|
27 |
+
INDEX `news_tag_id` (`news_tag_id`),
|
28 |
+
INDEX `news_item_id` (`news_item_id`)
|
29 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
30 |
+
");
|
31 |
+
|
32 |
+
// add relation constraints
|
33 |
+
$installer->run("
|
34 |
+
ALTER TABLE `{$installer->getTable('magentostudy_tag/relation')}`
|
35 |
+
ADD CONSTRAINT `{$installer->getTable('magentostudy_tag/relation')}_ibfk_2` FOREIGN KEY (`news_item_id`) REFERENCES `{$installer->getTable('news/item')}` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
36 |
+
ADD CONSTRAINT `{$installer->getTable('magentostudy_tag/relation')}_ibfk_1` FOREIGN KEY (`news_tag_id`) REFERENCES `{$installer->getTable('magentostudy_tag/item')}` (`tag_id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
37 |
+
");
|
38 |
+
|
39 |
+
$installer->run("
|
40 |
+
DROP TABLE IF EXISTS `{$installer->getTable('magentostudy_tag/cloud')}`;
|
41 |
+
CREATE TABLE `{$installer->getTable('magentostudy_tag/cloud')}` (
|
42 |
+
`news_tag_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
|
43 |
+
`weight` INT(11) UNSIGNED NULL DEFAULT NULL,
|
44 |
+
PRIMARY KEY (`news_tag_id`),
|
45 |
+
INDEX `weight` (`weight`)
|
46 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
47 |
+
");
|
48 |
+
|
49 |
+
// add cloud constraints
|
50 |
+
$installer->run("
|
51 |
+
ALTER TABLE `{$installer->getTable('magentostudy_tag/cloud')}`
|
52 |
+
ADD CONSTRAINT `{$installer->getTable('magentostudy_tag/cloud')}_ibfk_1` FOREIGN KEY (`news_tag_id`) REFERENCES `{$installer->getTable('magentostudy_tag/item')}` (`tag_id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
53 |
+
");
|
54 |
+
|
55 |
+
|
56 |
+
// restore original database environment
|
57 |
+
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>EE18</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
-
<license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
<notes>
|
12 |
-
<authors><author><name>
|
13 |
-
<date>2011-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocale"><dir name="de_DE"><dir name="sql_translation"><file name="attributes.sql" hash=""/><file name="attributes_default.sql" hash=""/></dir><dir name="template"><dir name="email"><dir name="sales"><file name="creditmemo_new.html" hash=""/><file name="creditmemo_new_guest.html" hash=""/><file name="creditmemo_update.html" hash=""/><file name="creditmemo_update_guest.html" hash=""/><file name="invoice_new.html" hash=""/><file name="invoice_new_guest.html" hash=""/><file name="invoice_update.html" hash=""/><file name="invoice_update_guest.html" hash=""/><file name="order_new.html" hash=""/><file name="order_new_guest.html" hash=""/><file name="order_update.html" hash=""/><file name="order_update_guest.html" hash=""/><file name="shipment_new.html" hash=""/><file name="shipment_new_guest.html" hash=""/><file name="shipment_update.html" hash=""/><file name="shipment_update_guest.html" hash=""/></dir><file name="account_new.html" hash=""/><file name="account_new_confirmation.html" hash=""/><file name="account_new_confirmed.html" hash=""/><file name="admin_password_new.html" hash=""/><file name="contact_form.html" hash=""/><file name="currency_update_warning.html" hash=""/><file name="log_clean_warning.html" hash=""/><file name="moneybookers_activateemail.html" hash=""/><file name="newsletter_subscr_confirm.html" hash=""/><file name="newsletter_subscr_success.html" hash=""/><file name="newsletter_unsub_success.html" hash=""/><file name="password_new.html" hash=""/><file name="payment_failed.html" hash=""/><file name="product_alert_cron_error.html" hash=""/><file name="product_price_alert.html" hash=""/><file name="product_share.html" hash=""/><file name="product_stock_alert.html" hash=""/><file name="sitemap_generate_warning.html" hash=""/><file name="wishlist_share.html" hash=""/></dir></dir><file name="Find_Feed.csv" hash=""/><file name="Mage_AdminNotification.csv" hash=""/><file name="Mage_Adminhtml.csv" hash=""/><file name="Mage_Api.csv" hash=""/><file name="Mage_Authorizenet.csv" hash=""/><file name="Mage_Backup.csv" hash=""/><file name="Mage_Bundle.csv" hash=""/><file name="Mage_Catalog.csv" hash=""/><file name="Mage_CatalogInventory.csv" hash=""/><file name="Mage_CatalogRule.csv" hash=""/><file name="Mage_CatalogSearch.csv" hash=""/><file name="Mage_Centinel.csv" hash=""/><file name="Mage_Checkout.csv" hash=""/><file name="Mage_Cms.csv" hash=""/><file name="Mage_Compiler.csv" hash=""/><file name="Mage_Connect.csv" hash=""/><file name="Mage_Contacts.csv" hash=""/><file name="Mage_Core.csv" hash=""/><file name="Mage_Cron.csv" hash=""/><file name="Mage_Customer.csv" hash=""/><file name="Mage_Dataflow.csv" hash=""/><file name="Mage_Directory.csv" hash=""/><file name="Mage_Downloadable.csv" hash=""/><file name="Mage_Eav.csv" hash=""/><file name="Mage_GiftMessage.csv" hash=""/><file name="Mage_GoogleAnalytics.csv" hash=""/><file name="Mage_GoogleBase.csv" hash=""/><file name="Mage_GoogleCheckout.csv" hash=""/><file name="Mage_GoogleOptimizer.csv" hash=""/><file name="Mage_ImportExport.csv" hash=""/><file name="Mage_Index.csv" hash=""/><file name="Mage_Install.csv" hash=""/><file name="Mage_Log.csv" hash=""/><file name="Mage_Media.csv" hash=""/><file name="Mage_Newsletter.csv" hash=""/><file name="Mage_Page.csv" hash=""/><file name="Mage_PageCache.csv" hash=""/><file name="Mage_Paygate.csv" hash=""/><file name="Mage_Payment.csv" hash=""/><file name="Mage_Paypal.csv" hash=""/><file name="Mage_PaypalUk.csv" hash=""/><file name="Mage_Poll.csv" hash=""/><file name="Mage_ProductAlert.csv" hash=""/><file name="Mage_Rating.csv" hash=""/><file name="Mage_Reports.csv" hash=""/><file name="Mage_Review.csv" hash=""/><file name="Mage_Rss.csv" hash=""/><file name="Mage_Rule.csv" hash=""/><file name="Mage_Sales.csv" hash=""/><file name="Mage_SalesRule.csv" hash=""/><file name="Mage_Sendfriend.csv" hash=""/><file name="Mage_Shipping.csv" hash=""/><file name="Mage_Sitemap.csv" hash=""/><file name="Mage_Tag.csv" hash=""/><file name="Mage_Tax.csv" hash=""/><file name="Mage_Usa.csv" hash=""/><file name="Mage_Weee.csv" hash=""/><file name="Mage_Widget.csv" hash=""/><file name="Mage_Wishlist.csv" hash=""/><file name="Mage_XmlConnect.csv" hash=""/><file name="Phoenix_Moneybookers.csv" hash=""/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="locale"><dir name="de_DE"><file name="translate.csv" hash=""/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="locale"><dir name="de_DE"><file name="translate.csv" hash=""/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="downloader"><dir name="template_de"><dir name="install"><file name="download.phtml" hash=""/><file name="footer.phtml" hash=""/><file name="header.phtml" hash=""/><file name="writable.phtml" hash=""/></dir><dir name="pear"><file name="dist.phtml" hash=""/><file name="iframe.phtml" hash=""/><file name="packages.phtml" hash=""/></dir><file name="exception.phtml" hash=""/><file name="footer.phtml" hash=""/><file name="header.phtml" hash=""/><file name="index.phtml" hash=""/><file name="login.phtml" hash=""/><file name="messages.phtml" hash=""/><file name="noroute.phtml" hash=""/><file name="settings.phtml" hash=""/><file name="writable.phtml" hash=""/></dir><dir name="template_de_1.5"><dir name="connect"><file name="iframe.phtml" hash=""/><file name="packages.phtml" hash=""/><file name="packages_prepare.phtml" hash=""/></dir><dir name="install"><file name="download.phtml" hash=""/><file name="footer.phtml" hash=""/><file name="header.phtml" hash=""/><file name="writable.phtml" hash=""/></dir><file name="exception.phtml" hash=""/><file name="footer.phtml" hash=""/><file name="header.phtml" hash=""/><file name="index.phtml" hash=""/><file name="login.phtml" hash=""/><file name="messages.phtml" hash=""/><file name="noroute.phtml" hash=""/><file name="settings.phtml" hash=""/><file name="writable.phtml" hash=""/><file name=".htaccess" hash=""/></dir></dir><dir name="js"><dir name="tiny_mce_german"><dir name="classes"><dir name="adapter"><dir name="jquery"><file name="adapter.js" hash=""/><file name="jquery.tinymce.js" hash=""/></dir><dir name="prototype"><file name="adapter.js" hash=""/></dir></dir><dir name="dom"><file name="DOMUtils.js" hash=""/><file name="Element.js" hash=""/><file name="EventUtils.js" hash=""/><file name="Range.js" hash=""/><file name="RangeUtils.js" hash=""/><file name="Schema.js" hash=""/><file name="ScriptLoader.js" hash=""/><file name="Selection.js" hash=""/><file name="Serializer.js" hash=""/><file name="Sizzle.js" hash=""/><file name="StringWriter.js" hash=""/><file name="TreeWalker.js" hash=""/><file name="TridentSelection.js" hash=""/><file name="XMLWriter.js" hash=""/></dir><dir name="firebug"><file name="firebug-lite.js" hash=""/></dir><dir name="ui"><file name="Button.js" hash=""/><file name="ColorSplitButton.js" hash=""/><file name="Container.js" hash=""/><file name="Control.js" hash=""/><file name="DropMenu.js" hash=""/><file name="ListBox.js" hash=""/><file name="Menu.js" hash=""/><file name="MenuButton.js" hash=""/><file name="MenuItem.js" hash=""/><file name="NativeListBox.js" hash=""/><file name="Separator.js" hash=""/><file name="SplitButton.js" hash=""/><file name="Toolbar.js" hash=""/></dir><dir name="util"><file name="Cookie.js" hash=""/><file name="Dispatcher.js" hash=""/><file name="JSON.js" hash=""/><file name="JSONP.js" hash=""/><file name="JSONRequest.js" hash=""/><file name="URI.js" hash=""/><file name="XHR.js" hash=""/></dir><dir name="xml"><file name="Parser.js" hash=""/></dir><file name="AddOnManager.js" hash=""/><file name="CommandManager.js" hash=""/><file name="ControlManager.js" hash=""/><file name="Developer.js" hash=""/><file name="Editor.js" hash=""/><file name="EditorCommands.js" hash=""/><file name="EditorManager.js" hash=""/><file name="ForceBlocks.js" hash=""/><file name="Formatter.js" hash=""/><file name="LegacyInput.js" hash=""/><file name="Popup.js" hash=""/><file name="UndoManager.js" hash=""/><file name="WindowManager.js" hash=""/><file name="tinymce.js" hash=""/></dir><dir name="langs"><file name="de.js" hash=""/><file name="en.js" hash=""/></dir><dir name="plugins"><dir name="advhr"><dir name="css"><file name="advhr.css" hash=""/></dir><dir name="js"><file name="rule.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="rule.htm" hash=""/></dir><dir name="advimage"><dir name="css"><file name="advimage.css" hash=""/></dir><dir name="img"><file name="sample.gif" hash=""/></dir><dir name="js"><file name="image.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="image.htm" hash=""/></dir><dir name="advlink"><dir name="css"><file name="advlink.css" hash=""/></dir><dir name="js"><file name="advlink.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="link.htm" hash=""/></dir><dir name="advlist"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="autoresize"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="autosave"><dir name="langs"><file name="en.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="bbcode"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="contextmenu"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="directionality"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="emotions"><dir name="img"><file name="smiley-cool.gif" hash=""/><file name="smiley-cry.gif" hash=""/><file name="smiley-embarassed.gif" hash=""/><file name="smiley-foot-in-mouth.gif" hash=""/><file name="smiley-frown.gif" hash=""/><file name="smiley-innocent.gif" hash=""/><file name="smiley-kiss.gif" hash=""/><file name="smiley-laughing.gif" hash=""/><file name="smiley-money-mouth.gif" hash=""/><file name="smiley-sealed.gif" hash=""/><file name="smiley-smile.gif" hash=""/><file name="smiley-surprised.gif" hash=""/><file name="smiley-tongue-out.gif" hash=""/><file name="smiley-undecided.gif" hash=""/><file name="smiley-wink.gif" hash=""/><file name="smiley-yell.gif" hash=""/></dir><dir name="js"><file name="emotions.js" hash=""/></dir><dir name="langs"><file name="en_dlg.js" hash=""/></dir><file name="de_dlg.js" hash=""/><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="emotions.htm" hash=""/></dir><dir name="example"><dir name="img"><file name="example.gif" hash=""/></dir><dir name="js"><file name="dialog.js" hash=""/></dir><dir name="langs"><file name="en.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="dialog.htm" hash=""/><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="fullpage"><dir name="css"><file name="fullpage.css" hash=""/></dir><dir name="js"><file name="fullpage.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="fullpage.htm" hash=""/></dir><dir name="fullscreen"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="fullscreen.htm" hash=""/></dir><dir name="iespell"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="inlinepopups"><dir name="skins"><dir name="clearlooks2"><dir name="img"><file name="alert.gif" hash=""/><file name="button.gif" hash=""/><file name="buttons.gif" hash=""/><file name="confirm.gif" hash=""/><file name="corners.gif" hash=""/><file name="horizontal.gif" hash=""/><file name="vertical.gif" hash=""/></dir><file name="window.css" hash=""/></dir></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="template.htm" hash=""/></dir><dir name="insertdatetime"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="layer"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="legacyoutput"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="media"><dir name="css"><file name="content.css" hash=""/><file name="media.css" hash=""/></dir><dir name="img"><file name="flash.gif" hash=""/><file name="flv_player.swf" hash=""/><file name="quicktime.gif" hash=""/><file name="realmedia.gif" hash=""/><file name="shockwave.gif" hash=""/><file name="trans.gif" hash=""/><file name="windowsmedia.gif" hash=""/></dir><dir name="js"><file name="embed.js" hash=""/><file name="media.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="media.htm" hash=""/></dir><dir name="nonbreaking"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="noneditable"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="pagebreak"><dir name="css"><file name="content.css" hash=""/></dir><dir name="img"><file name="pagebreak.gif" hash=""/><file name="trans.gif" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="paste"><dir name="js"><file name="pastetext.js" hash=""/><file name="pasteword.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="pastetext.htm" hash=""/><file name="pasteword.htm" hash=""/></dir><dir name="preview"><dir name="jscripts"><file name="embed.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="example.html" hash=""/><file name="preview.html" hash=""/></dir><dir name="print"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="save"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="searchreplace"><dir name="css"><file name="searchreplace.css" hash=""/></dir><dir name="js"><file name="searchreplace.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="searchreplace.htm" hash=""/></dir><dir name="spellchecker"><dir name="css"><file name="content.css" hash=""/></dir><dir name="img"><file name="wline.gif" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="style"><dir name="css"><file name="props.css" hash=""/></dir><dir name="js"><file name="props.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="props.htm" hash=""/></dir><dir name="tabfocus"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="table"><dir name="css"><file name="cell.css" hash=""/><file name="row.css" hash=""/><file name="table.css" hash=""/></dir><dir name="js"><file name="cell.js" hash=""/><file name="merge_cells.js" hash=""/><file name="row.js" hash=""/><file name="table.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="cell.htm" hash=""/><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="merge_cells.htm" hash=""/><file name="row.htm" hash=""/><file name="table.htm" hash=""/></dir><dir name="template"><dir name="css"><file name="template.css" hash=""/></dir><dir name="js"><file name="template.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="blank.htm" hash=""/><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="template.htm" hash=""/></dir><dir name="visualchars"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="wordcount"><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/></dir><dir name="xhtmlxtras"><dir name="css"><file name="attributes.css" hash=""/><file name="popup.css" hash=""/></dir><dir name="js"><file name="abbr.js" hash=""/><file name="acronym.js" hash=""/><file name="attributes.js" hash=""/><file name="cite.js" hash=""/><file name="del.js" hash=""/><file name="element_common.js" hash=""/><file name="ins.js" hash=""/></dir><dir name="langs"><file name="de_dlg.js" hash=""/><file name="en_dlg.js" hash=""/></dir><file name="abbr.htm" hash=""/><file name="acronym.htm" hash=""/><file name="attributes.htm" hash=""/><file name="cite.htm" hash=""/><file name="del.htm" hash=""/><file name="editor_plugin.js" hash=""/><file name="editor_plugin_src.js" hash=""/><file name="ins.htm" hash=""/></dir></dir><dir name="themes"><dir name="advanced"><dir name="img"><file name="colorpicker.jpg" hash=""/><file name="icons.gif" hash=""/></dir><dir name="js"><file name="about.js" hash=""/><file name="anchor.js" hash=""/><file name="charmap.js" hash=""/><file name="color_picker.js" hash=""/><file name="image.js" hash=""/><file name="link.js" hash=""/><file name="source_editor.js" hash=""/></dir><dir name="langs"><file name="de.js" hash=""/><file name="de_dlg.js" hash=""/><file name="en.js" hash=""/><file name="en_dlg.js" hash=""/></dir><dir name="skins"><dir name="default"><dir name="img"><file name="buttons.png" hash=""/><file name="items.gif" hash=""/><file name="menu_arrow.gif" hash=""/><file name="menu_check.gif" hash=""/><file name="progress.gif" hash=""/><file name="tabs.gif" hash=""/></dir><file name="content.css" hash=""/><file name="dialog.css" hash=""/><file name="ui.css" hash=""/></dir><dir name="o2k7"><dir name="img"><file name="button_bg.png" hash=""/><file name="button_bg_black.png" hash=""/><file name="button_bg_silver.png" hash=""/></dir><file name="content.css" hash=""/><file name="dialog.css" hash=""/><file name="ui.css" hash=""/><file name="ui_black.css" hash=""/><file name="ui_silver.css" hash=""/></dir></dir><file name="about.htm" hash=""/><file name="anchor.htm" hash=""/><file name="charmap.htm" hash=""/><file name="color_picker.htm" hash=""/><file name="editor_template.js" hash=""/><file name="editor_template_src.js" hash=""/><file name="image.htm" hash=""/><file name="link.htm" hash=""/><file name="source_editor.htm" hash=""/></dir><dir name="simple"><dir name="img"><file name="icons.gif" hash=""/></dir><dir name="langs"><file name="de.js" hash=""/><file name="en.js" hash=""/></dir><dir name="skins"><dir name="default"><file name="content.css" hash=""/><file name="ui.css" hash=""/></dir><dir name="o2k7"><dir name="img"><file name="button_bg.png" hash=""/></dir><file name="content.css" hash=""/><file name="ui.css" hash=""/></dir></dir><file name="editor_template.js" hash=""/><file name="editor_template_src.js" hash=""/></dir></dir><dir name="utils"><file name="editable_selects.js" hash=""/><file name="form_utils.js" hash=""/><file name="mctabs.js" hash=""/><file name="validate.js" hash=""/></dir><file name="jquery.tinymce.js" hash=""/><file name="license.txt" hash=""/><file name="tiny_mce.js" hash=""/><file name="tiny_mce_dev.js" hash=""/><file name="tiny_mce_jquery.js" hash=""/><file name="tiny_mce_jquery_src.js" hash=""/><file name="tiny_mce_popup.js" hash=""/><file name="tiny_mce_prototype.js" hash=""/><file name="tiny_mce_prototype_src.js" hash=""/><file name="tiny_mce_src.js" hash=""/></dir><dir name="mage"><dir name="adminhtml"><dir name="wysiwyg"><dir name="tiny_mce"><dir name="plugins"><dir name="magentovariable"><file name="editor_plugin_de.js" hash=""/></dir><dir name="magentowidget"><file name="editor_plugin_de.js" hash=""/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>EE18</name>
|
4 |
+
<version>0.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>Mcc_Demo</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Mcc_Demo</summary>
|
10 |
+
<description>Mcc_Demo</description>
|
11 |
+
<notes>Mcc_Demo</notes>
|
12 |
+
<authors><author><name>dzavalkin</name><user>auto-converted</user><email>dzavalkin@ebay.com</email></author></authors>
|
13 |
+
<date>2011-12-14</date>
|
14 |
+
<time>10:46:21</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Magentostudy"><dir name="Tag"><dir name="Block"><file name="Add.php" hash="2a718a17c9cde8860c6ee4c08e941151"/><file name="Cloud.php" hash="9089f003d30c89f378728989d19cc367"/><file name="Item.php" hash="038e9b91160633a9963caf344022a190"/><dir name="Adminhtml"><file name="NewsTag.php" hash="f09d611cf0e098e9b9c819b900d99362"/><dir name="News"><dir name="Edit"><dir name="Tab"><file name="AssignedTags.php" hash="3dfdfdd488a0f3fcdbdc6ba7d4863395"/></dir></dir></dir><dir name="Tag"><file name="Edit.php" hash="7072320d64c4b01f858689f3220333f2"/><file name="Grid.php" hash="c14a622e5fb306854c583f1b54f60bb9"/><dir name="Edit"><file name="Form.php" hash="5b84ce057a31af8b2b80415e50c63478"/><file name="Tabs.php" hash="508434d9c46416909cb10f7e3434d6fe"/><dir name="Tab"><file name="RelatedNews.php" hash="f6332231b161306a0379d5c8d8ea7ac0"/><file name="TagInfo.php" hash="a57a5dc5c585dbcb80adfa445cba2013"/></dir></dir></dir></dir><dir name="News"><file name="Item.php" hash="520924ef8dac92029872bb49a761d1aa"/><file name="List.php" hash="0970285329b4d75c02ecaf7a249ae404"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="9db2c240a4de7ac004f5efb934aa900b"/><dir name="Adminhtml"><file name="NewstagController.php" hash="4e52ec694df58797c960ba583f3235c0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="7897dd3c8c7bebbc2369e776c6180c57"/><file name="config.xml" hash="059f82a14baf6093af85ea3b288dd801"/><file name="system.xml" hash="cfd6481ea8b093dd131c637bc215cc3f"/></dir><dir name="Helper"><file name="Data.php" hash="030d4370d9616f02b19cf974689a7e05"/></dir><dir name="Model"><file name="Item.php" hash="b056c3394ca1e86c30e02134eb199b18"/><dir name="Resource"><file name="Item.php" hash="6d083259a928d2aea48be2e904471718"/><dir name="Item"><file name="Collection.php" hash="cfcc6a9842589e460f70a8fb4af204a1"/></dir><dir name="News"><dir name="Item"><file name="Collection.php" hash="87791e54ecc2c55dd3a990569b3435b5"/></dir></dir></dir></dir><dir name="sql"><dir name="magentostudy_tag_setup"><file name="mysql4-install-1.0.0.0.php" hash="26eaaa1b6e8964498847a6903ebf13a3"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|