Version Notes
Version number: 0.1.0
Stability: Stable
Compatibility: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7, 1.8
Download this release
Release Info
Developer | khanh trieu nguyen le |
Extension | Officience_News |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Officience/News/Block/Abstract.php +206 -0
- app/code/community/Officience/News/Block/Adminhtml/Category.php +13 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Edit.php +37 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Form.php +28 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Tab/Additional.php +65 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Tab/Form.php +221 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Tabs.php +28 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Grid.php +130 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Grid/Column/Renderer/Action.php +146 -0
- app/code/community/Officience/News/Block/Adminhtml/Category/Grid/Column/Renderer/SubCategories.php +25 -0
- app/code/community/Officience/News/Block/Adminhtml/Comment.php +14 -0
- app/code/community/Officience/News/Block/Adminhtml/Comment/Edit.php +46 -0
- app/code/community/Officience/News/Block/Adminhtml/Comment/Edit/Form.php +77 -0
- app/code/community/Officience/News/Block/Adminhtml/Comment/Grid.php +117 -0
- app/code/community/Officience/News/Block/Adminhtml/News.php +13 -0
- app/code/community/Officience/News/Block/Adminhtml/News/Edit.php +57 -0
- app/code/community/Officience/News/Block/Adminhtml/News/Edit/Form.php +31 -0
- app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tab/Additional.php +78 -0
- app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tab/Category.php +131 -0
- app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tab/Info.php +305 -0
- app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tabs.php +35 -0
- app/code/community/Officience/News/Block/Adminhtml/News/Grid.php +180 -0
- app/code/community/Officience/News/Block/Category.php +99 -0
- app/code/community/Officience/News/Block/Menu.php +134 -0
- app/code/community/Officience/News/Block/Newspost.php +180 -0
- app/code/community/Officience/News/Block/Rss.php +65 -0
- app/code/community/Officience/News/Block/Tags.php +74 -0
- app/code/community/Officience/News/Controller/Router.php +202 -0
- app/code/community/Officience/News/Helper/Cat.php +7 -0
- app/code/community/Officience/News/Helper/Data.php +262 -0
- app/code/community/Officience/News/Helper/Versions.php +82 -0
- app/code/community/Officience/News/Model/Category.php +61 -0
- app/code/community/Officience/News/Model/CategoryStore.php +25 -0
- app/code/community/Officience/News/Model/Check.php +87 -0
- app/code/community/Officience/News/Model/Comment.php +12 -0
- app/code/community/Officience/News/Model/Config/Source/Dateformat.php +16 -0
- app/code/community/Officience/News/Model/Config/Source/Parentcat.php +14 -0
- app/code/community/Officience/News/Model/Config/Source/Timeformat.php +15 -0
- app/code/community/Officience/News/Model/Config/Source/Urloption.php +14 -0
- app/code/community/Officience/News/Model/Mysql4/Category.php +102 -0
- app/code/community/Officience/News/Model/Mysql4/Category/Collection.php +63 -0
- app/code/community/Officience/News/Model/Mysql4/CategoryStore.php +9 -0
- app/code/community/Officience/News/Model/Mysql4/CategoryStore/Collection.php +10 -0
- app/code/community/Officience/News/Model/Mysql4/Comment.php +9 -0
- app/code/community/Officience/News/Model/Mysql4/Comment/Collection.php +25 -0
- app/code/community/Officience/News/Model/Mysql4/News.php +92 -0
- app/code/community/Officience/News/Model/Mysql4/News/Collection.php +68 -0
- app/code/community/Officience/News/Model/Mysql4/NewsStore.php +10 -0
- app/code/community/Officience/News/Model/Mysql4/NewsStore/Collection.php +10 -0
- app/code/community/Officience/News/Model/News.php +73 -0
- app/code/community/Officience/News/Model/NewsStore.php +40 -0
- app/code/community/Officience/News/Model/Wysiwyg/Config.php +109 -0
- app/code/community/Officience/News/controllers/Adminhtml/CategoryController.php +256 -0
- app/code/community/Officience/News/controllers/Adminhtml/CommentController.php +168 -0
- app/code/community/Officience/News/controllers/Adminhtml/NewsController.php +452 -0
- app/code/community/Officience/News/controllers/IndexController.php +42 -0
- app/code/community/Officience/News/controllers/NewspostController.php +99 -0
- app/code/community/Officience/News/controllers/RssController.php +44 -0
- app/code/community/Officience/News/etc/config.xml +285 -0
- app/code/community/Officience/News/etc/system.xml +295 -0
- app/code/community/Officience/News/sql/offinews_setup/mysql4-install-0.1.0.php +118 -0
- app/design/adminhtml/default/default/layout/officience_news.xml +29 -0
- app/design/adminhtml/default/default/template/officience/news/listCategory.phtml +27 -0
- app/design/frontend/base/default/layout/officience_news.xml +64 -0
- app/design/frontend/default/default/template/officience/news/list.phtml +90 -0
- app/design/frontend/default/default/template/officience/news/menu.phtml +3 -0
- app/design/frontend/default/default/template/officience/news/newspost.phtml +111 -0
- app/design/frontend/default/default/template/officience/news/print.phtml +40 -0
- app/etc/modules/Officience_News.xml +9 -0
- js/officience/news/css/images/folder.gif +0 -0
- js/officience/news/css/newscat.css +21 -0
- js/officience/news/jquery-1.4.4.js +7180 -0
- js/officience/news/jquery-1.7.1-min.js +6 -0
- js/officience/news/noconflict.js +2 -0
- package.xml +21 -0
- skin/frontend/default/default/css/officience/news/images/arr_t.png +0 -0
- skin/frontend/default/default/css/officience/news/images/i_print.gif +0 -0
- skin/frontend/default/default/css/officience/news/images/news-ct.png +0 -0
- skin/frontend/default/default/css/officience/news/images/rss.gif +0 -0
- skin/frontend/default/default/css/officience/news/style.css +118 -0
app/code/community/Officience/News/Block/Abstract.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Abstract extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
protected $_pagesCount = null;
|
6 |
+
protected $_currentPage = null;
|
7 |
+
protected $_itemsOnPage = 10;
|
8 |
+
protected $_itemsLimit;
|
9 |
+
protected $_pages;
|
10 |
+
protected $_latestItemsCount = 2;
|
11 |
+
protected $_showFlag = 0;
|
12 |
+
|
13 |
+
protected function _construct() {
|
14 |
+
$this->_currentPage = $this->getRequest()->getParam('page');
|
15 |
+
if (!$this->_currentPage) {
|
16 |
+
$this->_currentPage = 1;
|
17 |
+
}
|
18 |
+
|
19 |
+
$itemsPerPage = (int) Mage::getStoreConfig('offinews/news/itemsperpage');
|
20 |
+
if ($itemsPerPage > 0) {
|
21 |
+
$this->_itemsOnPage = $itemsPerPage;
|
22 |
+
}
|
23 |
+
|
24 |
+
$itemsLimit = (int) $this->getData('itemslimit');
|
25 |
+
if ($itemsLimit == null) {
|
26 |
+
$itemsLimit = (int) Mage::getStoreConfig('offinews/news/itemslimit');
|
27 |
+
}
|
28 |
+
if ($itemsLimit > 0) {
|
29 |
+
$this->_itemsLimit = $itemsLimit;
|
30 |
+
} else {
|
31 |
+
$this->_itemsLimit = null;
|
32 |
+
}
|
33 |
+
|
34 |
+
$latestItemsCount = (int) Mage::getStoreConfig('offinews/news/latestitemscount');
|
35 |
+
if ($latestItemsCount > 0) {
|
36 |
+
$this->_latestItemsCount = $latestItemsCount;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getNewsPost() {
|
41 |
+
$this->_showFlag = 1;
|
42 |
+
$collection = Mage::getModel('offinews/news')->getCollection()
|
43 |
+
;
|
44 |
+
$category = $this->getCategory();
|
45 |
+
$storeId = Mage::app()->getStore()->getId();
|
46 |
+
if ($category != null) {
|
47 |
+
|
48 |
+
if ($category) {
|
49 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('officience_news_category');
|
50 |
+
$collection->getSelect()->join(array("t2" => $tableName), 'main_table.news_id = t2.news_id', 't2.category_id');
|
51 |
+
$collection->getSelect()->where('t2.category_id =?', $category);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
$collection
|
56 |
+
->addEnableFilter(1)
|
57 |
+
->addStoreFilter($storeId)
|
58 |
+
->addStoreEnableFilter(1);
|
59 |
+
if ($this->_itemsLimit != null && $this->_itemsLimit < $collection->getSize()) {
|
60 |
+
$this->_pagesCount = ceil($this->_itemsLimit / $this->_itemsOnPage);
|
61 |
+
} else {
|
62 |
+
$this->_pagesCount = ceil($collection->getSize() / $this->_itemsOnPage);
|
63 |
+
}
|
64 |
+
for ($i = 1; $i <= $this->_pagesCount; $i++) {
|
65 |
+
$this->_pages[] = $i;
|
66 |
+
}
|
67 |
+
$this->setLastPageNum($this->_pagesCount);
|
68 |
+
|
69 |
+
$offset = $this->_itemsOnPage * ($this->_currentPage - 1 );
|
70 |
+
if ($this->_itemsLimit != null) {
|
71 |
+
$_itemsCurrentPage = $this->_itemsLimit - $offset;
|
72 |
+
if ($_itemsCurrentPage > $this->_itemsOnPage) {
|
73 |
+
$_itemsCurrentPage = $this->_itemsOnPage;
|
74 |
+
}
|
75 |
+
$collection->getSelect()->limit($_itemsCurrentPage, $offset);
|
76 |
+
} else {
|
77 |
+
$collection->getSelect()->limit($this->_itemsOnPage, $offset);
|
78 |
+
}
|
79 |
+
return $collection;
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function getCategory() {
|
83 |
+
return Mage::registry('current_offi_news_cat_id');
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getTopLink() {
|
87 |
+
$route = Mage::helper('offinews')->getRoute();
|
88 |
+
$title = Mage::helper('offinews')->__(Mage::getStoreConfig('offinews/news/title'));
|
89 |
+
if ($this->getParentBlock() && $this->getParentBlock() != null) {
|
90 |
+
$this->getParentBlock()->addLink($title, $route, $title, true, array(), 15, null, 'class="top-link-news"');
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
public function getPages() {
|
95 |
+
// if ((int) Mage::getStoreConfig('offinews/news/perpage') != 0) {
|
96 |
+
$collection = Mage::getModel('offinews/news')->getCollection();
|
97 |
+
if ($category = $this->getCategory()) {
|
98 |
+
$modelCat = Mage::getModel('offinews/category')->load($category);
|
99 |
+
$url = $modelCat->getUrl() . '?page=';
|
100 |
+
} else {
|
101 |
+
$url = Mage::getUrl(Mage::helper('offinews')->getRoute()) . '?page=';
|
102 |
+
}
|
103 |
+
$storeId = Mage::app()->getStore()->getId();
|
104 |
+
if ($category != null) {
|
105 |
+
|
106 |
+
if ($category) {
|
107 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('officience_news_category');
|
108 |
+
$collection->getSelect()->join(array("t2" => $tableName), 'main_table.news_id = t2.news_id', 't2.category_id');
|
109 |
+
$collection->getSelect()->where('t2.category_id =?', $category);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
$currentPage = (int) $this->getRequest()->getParam('page');
|
113 |
+
$links = "<div class='post-page-break'>";
|
114 |
+
if ($currentPage > 1) {
|
115 |
+
$links .= '<div class="left"><a href="' . $url . ($this->_currentPage - 1) . '" >< Newer Posts</a></div>';
|
116 |
+
}
|
117 |
+
if ($currentPage < $this->_pagesCount || $currentPage == 1) {
|
118 |
+
$links .= '<div class="right"><a href="' . $url . ($this->_currentPage + 1) . '" >Older Posts ></a></div>';
|
119 |
+
}
|
120 |
+
$links .= "</div>";
|
121 |
+
|
122 |
+
echo $links;
|
123 |
+
//}
|
124 |
+
}
|
125 |
+
|
126 |
+
public function isFirstPage() {
|
127 |
+
if ($this->_currentPage == 1) {
|
128 |
+
return true;
|
129 |
+
}
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
|
133 |
+
public function isLastPage() {
|
134 |
+
if ($this->_currentPage == $this->_pagesCount) {
|
135 |
+
return true;
|
136 |
+
}
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
|
140 |
+
public function isPageCurrent($page) {
|
141 |
+
if ($page == $this->_currentPage) {
|
142 |
+
return true;
|
143 |
+
}
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
public function getPageUrl($page) {
|
148 |
+
if (Mage::app()->getRequest()->getModuleName() == Mage::helper('offinews')->getRoute()) {
|
149 |
+
if ($category = $this->getCategoryKey()) {
|
150 |
+
return $this->getUrl('*', array('category' => $category, 'page' => $page));
|
151 |
+
} else {
|
152 |
+
return $this->getUrl('*', array('page' => $page));
|
153 |
+
}
|
154 |
+
} else {
|
155 |
+
if (strstr(Mage::helper("core/url")->getCurrentUrl(), '?')) {
|
156 |
+
$sign = '&';
|
157 |
+
} else {
|
158 |
+
$sign = '?';
|
159 |
+
}
|
160 |
+
if (strstr(Mage::helper("core/url")->getCurrentUrl(), 'page=')) {
|
161 |
+
return preg_replace('(page=[0-9]+)', 'page=' . $page, Mage::helper("core/url")->getCurrentUrl());
|
162 |
+
} else {
|
163 |
+
return Mage::helper("core/url")->getCurrentUrl() . $sign . 'page=' . $page;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
public function getNextPageUrl() {
|
169 |
+
$page = $this->_currentPage + 1;
|
170 |
+
return $this->getPageUrl($page);
|
171 |
+
}
|
172 |
+
|
173 |
+
public function getPreviousPageUrl() {
|
174 |
+
$page = $this->_currentPage - 1;
|
175 |
+
return $this->getPageUrl($page);
|
176 |
+
}
|
177 |
+
|
178 |
+
public function getCurrentCategory() {
|
179 |
+
$storeId = Mage::app()->getStore()->getId();
|
180 |
+
if ($catId = Mage::registry('current_offi_news_cat_id')) {
|
181 |
+
$categories = Mage::getModel('offinews/category')->load($catId);
|
182 |
+
return $categories;
|
183 |
+
}
|
184 |
+
return null;
|
185 |
+
}
|
186 |
+
|
187 |
+
protected function _toHtml() {
|
188 |
+
$html = parent::_toHtml();
|
189 |
+
if ($this->_showFlag == 1) {
|
190 |
+
$html = $html . '<div align="right" class="copyright">© Developed by <a href="http://officience.com/" target="_blank">Officience</a></div>';
|
191 |
+
}
|
192 |
+
return $html;
|
193 |
+
}
|
194 |
+
|
195 |
+
protected function getChildCatBlog($parentId) {
|
196 |
+
$storeId = Mage::app()->getStore()->getId();
|
197 |
+
$data = Mage::getModel('offinews/category')->getCollection()
|
198 |
+
->addFieldToFilter('parent_id', array('eq' => $parentId))
|
199 |
+
->addStoreFilter($storeId)
|
200 |
+
->addStoreEnableFilter(1)
|
201 |
+
->setOrder('sort_order', 'ASC')
|
202 |
+
;
|
203 |
+
return $data;
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Category.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_controller = 'adminhtml_category';
|
8 |
+
$this->_blockGroup = 'offinews';
|
9 |
+
$this->_headerText = Mage::helper('offinews')->__('Category Manager');
|
10 |
+
$this->_addButtonLabel = Mage::helper('offinews')->__('Add Category');
|
11 |
+
parent::__construct();
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Category/Edit.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
|
7 |
+
$this->_objectId = 'id';
|
8 |
+
$this->_blockGroup = 'offinews';
|
9 |
+
$this->_controller = 'adminhtml_category';
|
10 |
+
parent::__construct();
|
11 |
+
|
12 |
+
$this->_updateButton('save', 'label', $this->__('Save Category'));
|
13 |
+
$this->_updateButton('delete', 'label', $this->__('Delete Category'));
|
14 |
+
|
15 |
+
$this->_addButton('saveandcontinue', array(
|
16 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
17 |
+
'onclick' => 'saveAndContinueEdit()',
|
18 |
+
'class' => 'save',
|
19 |
+
), -100);
|
20 |
+
|
21 |
+
$this->_formScripts[] = "
|
22 |
+
function saveAndContinueEdit(){
|
23 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
24 |
+
}
|
25 |
+
";
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getHeaderText() {
|
29 |
+
if (Mage::registry('cat_data') && Mage::registry('cat_data')->getId()) {
|
30 |
+
return $this->__("Edit News Category '%s'", $this->htmlEscape(Mage::registry('cat_data')->getTitle()));
|
31 |
+
} else {
|
32 |
+
return $this->__('Add News Category');
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Form.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->setId('news_form');
|
8 |
+
$this->setTitle($this->__('Category Infomation'));
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _prepareForm() {
|
12 |
+
$model = Mage::registry('cat_data');
|
13 |
+
|
14 |
+
$form = new Varien_Data_Form(array(
|
15 |
+
'id' => 'edit_form',
|
16 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'), 'store' => $this->getRequest()->getParam('store', 0))),
|
17 |
+
'method' => 'post',
|
18 |
+
'enctype' => 'multipart/form-data',
|
19 |
+
));
|
20 |
+
|
21 |
+
$form->setUseContainer(true);
|
22 |
+
$this->setForm($form);
|
23 |
+
return parent::_prepareForm();
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
?>
|
28 |
+
|
app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Tab/Additional.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Edit_Tab_Additional extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
public function initForm() {
|
6 |
+
$form = new Varien_Data_Form();
|
7 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
8 |
+
$model = Mage::registry('cat_data');
|
9 |
+
$fieldset = $form->addFieldset('news_meta_data', array('legend' => Mage::helper('offinews')->__('Meta Data')));
|
10 |
+
if ($storeId) {
|
11 |
+
$defaultValue = $model->getData();
|
12 |
+
$defaultValueArr = $defaultValue['default_value'];
|
13 |
+
/* ==meta keywords== */
|
14 |
+
$arrMetaKeywords = array(
|
15 |
+
'label' => $this->__('Meta keyword'),
|
16 |
+
'title' => $this->__('Meta keyword'),
|
17 |
+
'name' => 'meta_keywords',
|
18 |
+
);
|
19 |
+
|
20 |
+
if (isset($defaultValueArr['title']) && $defaultValueArr['title']) {
|
21 |
+
$arrMetaKeywords['disabled'] = ' ';
|
22 |
+
$arrMetaKeywords['class'] = 'disabled';
|
23 |
+
}
|
24 |
+
|
25 |
+
$fieldset->addField('meta_keywords', 'textarea', $arrMetaKeywords)
|
26 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('meta_keywords', $defaultValueArr['meta_keywords']));
|
27 |
+
|
28 |
+
/* ==End meta keywords== */
|
29 |
+
/* ==meta description== */
|
30 |
+
$arrMetaDescription = array(
|
31 |
+
'label' => $this->__('Meta description'),
|
32 |
+
'title' => $this->__('Meta description'),
|
33 |
+
'name' => 'meta_description',
|
34 |
+
);
|
35 |
+
|
36 |
+
if (isset($defaultValueArr['title']) && $defaultValueArr['title']) {
|
37 |
+
$arrMetaDescription['disabled'] = ' ';
|
38 |
+
$arrMetaDescription['class'] = 'disabled';
|
39 |
+
}
|
40 |
+
$fieldset->addField('meta_description', 'textarea', $arrMetaDescription)
|
41 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('meta_description', $defaultValueArr['meta_description']));
|
42 |
+
/* ==End meta description== */
|
43 |
+
} else {
|
44 |
+
$fieldset->addField('meta_keywords', 'textarea', array(
|
45 |
+
'label' => $this->__('Meta keyword'),
|
46 |
+
'title' => $this->__('Meta keyword'),
|
47 |
+
'name' => 'meta_keywords',
|
48 |
+
));
|
49 |
+
|
50 |
+
$fieldset->addField('meta_description', 'textarea', array(
|
51 |
+
'label' => Mage::helper('offinews')->__('Meta description'),
|
52 |
+
'title' => Mage::helper('offinews')->__('Meta description'),
|
53 |
+
'name' => 'meta_description',
|
54 |
+
));
|
55 |
+
}
|
56 |
+
if (Mage::registry('cat_data')) {
|
57 |
+
$form->setValues(Mage::registry('cat_data')->getData());
|
58 |
+
}
|
59 |
+
$this->setForm($form);
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
?>
|
65 |
+
|
app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
public function initForm() {
|
6 |
+
|
7 |
+
$model = Mage::registry('cat_data');
|
8 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
9 |
+
$form = new Varien_Data_Form();
|
10 |
+
$this->setForm($form);
|
11 |
+
$fieldset = $form->addFieldset('news_form', array(
|
12 |
+
'legend' => $this->__('Category Information'),
|
13 |
+
));
|
14 |
+
if ($storeId) {
|
15 |
+
$defaultValue = $model->getData();
|
16 |
+
$defaultValueArr = $defaultValue['default_value'];
|
17 |
+
/* ==Title== */
|
18 |
+
$arrTitle = array(
|
19 |
+
'label' => Mage::helper('offinews')->__('Title'),
|
20 |
+
'title' => Mage::helper('offinews')->__('Title'),
|
21 |
+
'name' => 'title',
|
22 |
+
'required' => true,
|
23 |
+
);
|
24 |
+
|
25 |
+
if (isset($defaultValueArr['title']) && $defaultValueArr['title']) {
|
26 |
+
$arrTitle['disabled'] = ' ';
|
27 |
+
$arrTitle['class'] = 'disabled';
|
28 |
+
}
|
29 |
+
$fieldset->addField('title', 'text', $arrTitle)
|
30 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('title', $defaultValueArr['title']));
|
31 |
+
/* ==End Title== */
|
32 |
+
/* ==Identifier== */
|
33 |
+
$arrIdentifier = array(
|
34 |
+
'label' => Mage::helper('offinews')->__('URL Key'),
|
35 |
+
'title' => Mage::helper('offinews')->__('URL Key'),
|
36 |
+
'name' => 'identifier',
|
37 |
+
);
|
38 |
+
if (isset($defaultValueArr['identifier']) && $defaultValueArr['identifier']) {
|
39 |
+
$arrIdentifier['disabled'] = ' ';
|
40 |
+
$arrIdentifier['class'] = 'disabled';
|
41 |
+
}
|
42 |
+
$fieldset->addField('identifier', 'text', $arrIdentifier)
|
43 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('identifier', $defaultValueArr['identifier']));
|
44 |
+
/* ==End Identifier== */
|
45 |
+
/* Status */
|
46 |
+
$arrStatus = array(
|
47 |
+
'label' => Mage::helper('offinews')->__('Status'),
|
48 |
+
'title' => Mage::helper('offinews')->__('Status'),
|
49 |
+
'name' => 'category_status',
|
50 |
+
'values' => array(
|
51 |
+
array(
|
52 |
+
'value' => 1,
|
53 |
+
'label' => Mage::helper('offinews')->__('Enabled'),
|
54 |
+
),
|
55 |
+
array(
|
56 |
+
'value' => 2,
|
57 |
+
'label' => Mage::helper('offinews')->__('Disabled'),
|
58 |
+
),
|
59 |
+
),
|
60 |
+
);
|
61 |
+
$fieldset->addField('category_status', 'select', $arrStatus)
|
62 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('category_status', $defaultValueArr['category_status']));
|
63 |
+
/* End status */
|
64 |
+
/* display setting */
|
65 |
+
$arrStatus = array(
|
66 |
+
'label' => Mage::helper('offinews')->__('Display setting'),
|
67 |
+
'title' => Mage::helper('offinews')->__('Display setting'),
|
68 |
+
'name' => 'display_setting',
|
69 |
+
'values' => array(
|
70 |
+
array(
|
71 |
+
'value' => 1,
|
72 |
+
'label' => Mage::helper('offinews')->__('Display categories'),
|
73 |
+
),
|
74 |
+
array(
|
75 |
+
'value' => 2,
|
76 |
+
'label' => Mage::helper('offinews')->__('Display products'),
|
77 |
+
),
|
78 |
+
),
|
79 |
+
);
|
80 |
+
$fieldset->addField('display_setting', 'select', $arrStatus)
|
81 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('display_setting', $defaultValueArr['display_setting']));
|
82 |
+
/* End display setting */
|
83 |
+
/* ==Order== */
|
84 |
+
$arrOrder = array(
|
85 |
+
'label' => Mage::helper('offinews')->__('Order'),
|
86 |
+
'title' => Mage::helper('offinews')->__('Order'),
|
87 |
+
'name' => 'sort_order',
|
88 |
+
);
|
89 |
+
|
90 |
+
if (isset($defaultValueArr['sort_order']) && $defaultValueArr['sort_order']) {
|
91 |
+
$arrOrder['disabled'] = ' ';
|
92 |
+
$arrOrder['class'] = 'disabled';
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
$fieldset->addField('sort_order', 'text', $arrOrder)
|
97 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('sort_order', $defaultValueArr['sort_order']));
|
98 |
+
/* ==End Order== */
|
99 |
+
/* ==description== */
|
100 |
+
$arrDescription = array(
|
101 |
+
'label' => Mage::helper('offinews')->__('Description'),
|
102 |
+
'title' => Mage::helper('offinews')->__('Description'),
|
103 |
+
'name' => 'description',
|
104 |
+
);
|
105 |
+
if (isset($defaultValueArr['description']) && $defaultValueArr['description']) {
|
106 |
+
$arrDescription['disabled'] = ' ';
|
107 |
+
$arrDescription['class'] = 'disabled';
|
108 |
+
}
|
109 |
+
$fieldset->addField('description', 'textarea', $arrDescription)
|
110 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('description', $defaultValueArr['description']));
|
111 |
+
/* ==End description== */
|
112 |
+
} else {
|
113 |
+
$fieldset->addField('title', 'text', array(
|
114 |
+
'label' => Mage::helper('offinews')->__('Title'),
|
115 |
+
'title' => Mage::helper('offinews')->__('Title'),
|
116 |
+
'name' => 'title',
|
117 |
+
'required' => true,
|
118 |
+
));
|
119 |
+
|
120 |
+
$fieldset->addField('identifier', 'text', array(
|
121 |
+
'label' => Mage::helper('offinews')->__('URL Key'),
|
122 |
+
'title' => Mage::helper('offinews')->__('URL Key'),
|
123 |
+
'name' => 'identifier',
|
124 |
+
));
|
125 |
+
|
126 |
+
$fieldset->addField('category_status', 'select', array(
|
127 |
+
'label' => Mage::helper('offinews')->__('Status'),
|
128 |
+
'title' => Mage::helper('offinews')->__('Status'),
|
129 |
+
'name' => 'category_status',
|
130 |
+
'values' => array(
|
131 |
+
array(
|
132 |
+
'value' => 1,
|
133 |
+
'label' => Mage::helper('offinews')->__('Enabled'),
|
134 |
+
),
|
135 |
+
array(
|
136 |
+
'value' => 2,
|
137 |
+
'label' => Mage::helper('offinews')->__('Disabled'),
|
138 |
+
),
|
139 |
+
),
|
140 |
+
));
|
141 |
+
|
142 |
+
$fieldset->addField('display_setting', 'select', array(
|
143 |
+
'label' => Mage::helper('offinews')->__('Display setting'),
|
144 |
+
'title' => Mage::helper('offinews')->__('Display setting'),
|
145 |
+
'name' => 'display_setting',
|
146 |
+
'values' => array(
|
147 |
+
array(
|
148 |
+
'value' => 1,
|
149 |
+
'label' => Mage::helper('offinews')->__('Display categories'),
|
150 |
+
),
|
151 |
+
array(
|
152 |
+
'value' => 2,
|
153 |
+
'label' => Mage::helper('offinews')->__('Display products'),
|
154 |
+
),
|
155 |
+
),
|
156 |
+
));
|
157 |
+
|
158 |
+
$fieldset->addField('thumbnail', 'image', array(
|
159 |
+
'label' => Mage::helper('offinews')->__('Thumbnail'),
|
160 |
+
'title' => Mage::helper('offinews')->__('Thumbnail'),
|
161 |
+
'name' => 'thumbnail',
|
162 |
+
));
|
163 |
+
|
164 |
+
$fieldset->addField('sort_order', 'text', array(
|
165 |
+
'label' => Mage::helper('offinews')->__('Order'),
|
166 |
+
'title' => Mage::helper('offinews')->__('Order'),
|
167 |
+
'name' => 'sort_order',
|
168 |
+
));
|
169 |
+
|
170 |
+
$fieldset->addField('description', 'textarea', array(
|
171 |
+
'label' => Mage::helper('offinews')->__('Description'),
|
172 |
+
'title' => Mage::helper('offinews')->__('Description'),
|
173 |
+
'name' => 'description',
|
174 |
+
));
|
175 |
+
}
|
176 |
+
|
177 |
+
$pid = $this->getRequest()->getParam('parent_id', 0);
|
178 |
+
$fieldset->addField('parent_id', 'hidden', array(
|
179 |
+
'name' => 'parent_id',
|
180 |
+
'value' => $pid,
|
181 |
+
));
|
182 |
+
|
183 |
+
|
184 |
+
$levelCat = 0;
|
185 |
+
if ($pid != 0) {
|
186 |
+
$category = Mage::getModel('offinews/category')->load($pid);
|
187 |
+
$lev = $category->getLevel();
|
188 |
+
if ($lev) {
|
189 |
+
$levelCat = $lev + 1;
|
190 |
+
} else {
|
191 |
+
$levelCat = '1';
|
192 |
+
}
|
193 |
+
} else {
|
194 |
+
$levelCat = '1';
|
195 |
+
}
|
196 |
+
|
197 |
+
$fieldset->addField('level', 'hidden', array(
|
198 |
+
'name' => 'level',
|
199 |
+
'value' => $levelCat,
|
200 |
+
));
|
201 |
+
|
202 |
+
|
203 |
+
if ($this->getRequest()->getParam('id')) {
|
204 |
+
$fieldset->addField('category_id', 'hidden', array(
|
205 |
+
'name' => 'category_id',
|
206 |
+
));
|
207 |
+
$form->setValues($this->getRequest()->getParam('id'));
|
208 |
+
}
|
209 |
+
if (Mage::getSingleton('adminhtml/session')->getNewsData()) {
|
210 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
|
211 |
+
Mage::getSingleton('adminhtml/session')->setNewsData(null);
|
212 |
+
} elseif ($model) {
|
213 |
+
$form->setValues($model->getData());
|
214 |
+
}
|
215 |
+
|
216 |
+
return $this;
|
217 |
+
}
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
?>
|
app/code/community/Officience/News/Block/Adminhtml/Category/Edit/Tabs.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->setId('news_tabs');
|
8 |
+
$this->setDestElementId('edit_form');
|
9 |
+
$this->setTitle($this->__('News'));
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _beforeToHtml() {
|
13 |
+
$this->addTab('form', array(
|
14 |
+
'label' => $this->__('General Infomation'),
|
15 |
+
'title' => $this->__('General Infomation'),
|
16 |
+
'content' => $this->getLayout()->createBlock('offinews/adminhtml_category_edit_tab_form')->initForm()->toHtml(),
|
17 |
+
));
|
18 |
+
$this->addTab('additional', array(
|
19 |
+
'label' => $this->__('Meta'),
|
20 |
+
'title' => $this->__('Meta'),
|
21 |
+
'content' => $this->getLayout()->createBlock('offinews/adminhtml_category_edit_tab_additional')->initForm()->toHtml(),
|
22 |
+
));
|
23 |
+
return parent::_beforeToHtml();
|
24 |
+
}
|
25 |
+
|
26 |
+
}
|
27 |
+
?>
|
28 |
+
|
app/code/community/Officience/News/Block/Adminhtml/Category/Grid.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('categoryGrid');
|
8 |
+
$this->setSaveParametersInSession(true);
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _prepareCollection() {
|
12 |
+
$collection = Mage::getModel('offinews/category')->getCollection();
|
13 |
+
$collection->getSelect()->order('sort_order ASC');
|
14 |
+
$sortData = array();
|
15 |
+
$this->_sortCatBlog($collection->getData(), 0, $sortData);
|
16 |
+
$data = new Varien_Data_Collection();
|
17 |
+
foreach ($sortData as $item) {
|
18 |
+
$rowObj = new Varien_Object();
|
19 |
+
$rowObj->setData($item);
|
20 |
+
$data->addItem($rowObj);
|
21 |
+
}
|
22 |
+
$this->setCollection($data);
|
23 |
+
return parent::_prepareCollection();
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function _sortCatBlog($data, $parent_id, &$sortData) {
|
27 |
+
foreach ($data as $listitem) {
|
28 |
+
if ($listitem['parent_id'] == $parent_id) {
|
29 |
+
|
30 |
+
$sortData[] = $listitem;
|
31 |
+
$this->_sortCatBlog($data, $listitem['category_id'], $sortData);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function _prepareColumns() {
|
38 |
+
$this->addColumn('category_id', array(
|
39 |
+
'header' => Mage::helper('offinews')->__('ID'),
|
40 |
+
'align' => 'right',
|
41 |
+
'width' => '50',
|
42 |
+
'index' => 'category_id',
|
43 |
+
));
|
44 |
+
|
45 |
+
$this->addColumn('title', array(
|
46 |
+
'header' => Mage::helper('offinews')->__('Title'),
|
47 |
+
'align' => 'left',
|
48 |
+
'index' => 'title',
|
49 |
+
'renderer' => 'offinews/adminhtml_category_grid_column_renderer_subCategories',
|
50 |
+
));
|
51 |
+
|
52 |
+
$this->addColumn('identifier', array(
|
53 |
+
'header' => Mage::helper('offinews')->__('URL Key'),
|
54 |
+
'align' => 'left',
|
55 |
+
'index' => 'identifier',
|
56 |
+
));
|
57 |
+
|
58 |
+
$this->addColumn('order', array(
|
59 |
+
'header' => Mage::helper('offinews')->__('Sort Order'),
|
60 |
+
'align' => 'left',
|
61 |
+
'width' => '50',
|
62 |
+
'index' => 'order',
|
63 |
+
));
|
64 |
+
|
65 |
+
$this->addColumn('category_status', array(
|
66 |
+
'header' => Mage::helper('offinews')->__('Status'),
|
67 |
+
'align' => 'left',
|
68 |
+
'width' => '70',
|
69 |
+
'index' => 'category_status',
|
70 |
+
'type' => 'options',
|
71 |
+
'options' => array(
|
72 |
+
1 => Mage::helper('offinews')->__('Enabled'),
|
73 |
+
2 => Mage::helper('offinews')->__('Disabled')
|
74 |
+
),
|
75 |
+
));
|
76 |
+
|
77 |
+
|
78 |
+
$this->addColumn('action', array(
|
79 |
+
'header' => Mage::helper('offinews')->__('Action'),
|
80 |
+
'type' => 'action',
|
81 |
+
'getter' => 'getId',
|
82 |
+
'actions' => array(
|
83 |
+
array(
|
84 |
+
'caption' => Mage::helper('offinews')->__('Edit'),
|
85 |
+
'url' => array('base' => '*/*/edit'),
|
86 |
+
'field' => 'id'
|
87 |
+
),
|
88 |
+
array(
|
89 |
+
'caption' => Mage::helper('offinews')->__('Add Sub Category'),
|
90 |
+
'url' => array('base' => '*/*/new'),
|
91 |
+
'field' => 'parent_id'
|
92 |
+
)
|
93 |
+
),
|
94 |
+
'width' => '70',
|
95 |
+
'index' => 'stores',
|
96 |
+
'is_system' => true,
|
97 |
+
'filter' => false,
|
98 |
+
'sortable' => false,
|
99 |
+
'renderer' => 'offinews/adminhtml_category_grid_column_renderer_action',
|
100 |
+
));
|
101 |
+
|
102 |
+
return parent::_prepareColumns();
|
103 |
+
}
|
104 |
+
|
105 |
+
protected function _prepareMassaction() {
|
106 |
+
$this->setMassactionIdField('category_id');
|
107 |
+
$this->getMassactionBlock()->setFormFieldName('category');
|
108 |
+
|
109 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
110 |
+
'label' => Mage::helper('offinews')->__('Delete'),
|
111 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
112 |
+
'confirm' => Mage::helper('offinews')->__('Are you sure?')
|
113 |
+
));
|
114 |
+
|
115 |
+
return $this;
|
116 |
+
}
|
117 |
+
|
118 |
+
protected function _filterStoreCondition($collection, $column) {
|
119 |
+
if (!$value = $column->getFilter()->getValue()) {
|
120 |
+
return;
|
121 |
+
}
|
122 |
+
|
123 |
+
$this->getCollection()->addStoreFilter($value);
|
124 |
+
}
|
125 |
+
|
126 |
+
public function getRowUrl($row) {
|
127 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getCategoryId()));
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Category/Grid/Column/Renderer/Action.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Grid_Column_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Text {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Renders column
|
7 |
+
*
|
8 |
+
* @param Varien_Object $row
|
9 |
+
* @return string
|
10 |
+
*/
|
11 |
+
public function render(Varien_Object $row) {
|
12 |
+
$actions = $this->getColumn()->getActions();
|
13 |
+
if (empty($actions) || !is_array($actions)) {
|
14 |
+
return ' ';
|
15 |
+
}
|
16 |
+
|
17 |
+
if (sizeof($actions) == 1 && !$this->getColumn()->getNoLink()) {
|
18 |
+
foreach ($actions as $action) {
|
19 |
+
if (is_array($action)) {
|
20 |
+
return $this->_toLinkHtml($action, $row);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
$out = '<select class="action-select" onchange="varienGridAction.execute(this);">'
|
26 |
+
. '<option value=""></option>';
|
27 |
+
$i = 0;
|
28 |
+
foreach ($actions as $action) {
|
29 |
+
$i++;
|
30 |
+
if (is_array($action)) {
|
31 |
+
if ($this->checkLimit($row->getId()) < 5) {
|
32 |
+
$out .= $this->_toOptionHtml($action, $row);
|
33 |
+
} else {
|
34 |
+
if ($action['caption'] == 'Edit') {
|
35 |
+
$out .= $this->_toOptionHtml($action, $row);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
$out .= '</select>';
|
41 |
+
return $out;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Render single action as dropdown option html
|
46 |
+
*
|
47 |
+
* @param unknown_type $action
|
48 |
+
* @param Varien_Object $row
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
protected function _toOptionHtml($action, Varien_Object $row) {
|
52 |
+
$actionAttributes = new Varien_Object();
|
53 |
+
|
54 |
+
$actionCaption = '';
|
55 |
+
$this->_transformActionData($action, $actionCaption, $row);
|
56 |
+
|
57 |
+
$htmlAttibutes = array('value' => $this->htmlEscape(Mage::helper('core')->jsonEncode($action)));
|
58 |
+
$actionAttributes->setData($htmlAttibutes);
|
59 |
+
return '<option ' . $actionAttributes->serialize() . '>' . $actionCaption . '</option>';
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Render single action as link html
|
64 |
+
*
|
65 |
+
* @param array $action
|
66 |
+
* @param Varien_Object $row
|
67 |
+
* @return string
|
68 |
+
*/
|
69 |
+
protected function _toLinkHtml($action, Varien_Object $row) {
|
70 |
+
$actionAttributes = new Varien_Object();
|
71 |
+
|
72 |
+
$actionCaption = '';
|
73 |
+
$this->_transformActionData($action, $actionCaption, $row);
|
74 |
+
|
75 |
+
if (isset($action['confirm'])) {
|
76 |
+
$action['onclick'] = 'return window.confirm(\''
|
77 |
+
. addslashes($this->htmlEscape($action['confirm']))
|
78 |
+
. '\')';
|
79 |
+
unset($action['confirm']);
|
80 |
+
}
|
81 |
+
|
82 |
+
$actionAttributes->setData($action);
|
83 |
+
return '<a ' . $actionAttributes->serialize() . '>' . $actionCaption . '</a>';
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Prepares action data for html render
|
88 |
+
*
|
89 |
+
* @param array $action
|
90 |
+
* @param string $actionCaption
|
91 |
+
* @param Varien_Object $row
|
92 |
+
* @return Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
93 |
+
*/
|
94 |
+
protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row) {
|
95 |
+
foreach ($action as $attibute => $value) {
|
96 |
+
|
97 |
+
if (isset($action[$attibute]) && !is_array($action[$attibute])) {
|
98 |
+
$this->getColumn()->setFormat($action[$attibute]);
|
99 |
+
$action[$attibute] = parent::render($row);
|
100 |
+
} else {
|
101 |
+
$this->getColumn()->setFormat(null);
|
102 |
+
}
|
103 |
+
|
104 |
+
switch ($attibute) {
|
105 |
+
case 'caption':
|
106 |
+
$actionCaption = $action['caption'];
|
107 |
+
unset($action['caption']);
|
108 |
+
break;
|
109 |
+
|
110 |
+
case 'url':
|
111 |
+
if (is_array($action['url'])) {
|
112 |
+
$params = array($action['field'] => $row->getCategoryId());
|
113 |
+
if (isset($action['url']['params'])) {
|
114 |
+
$params = array_merge($action['url']['params'], $params);
|
115 |
+
}
|
116 |
+
$action['href'] = $this->getUrl($action['url']['base'], $params);
|
117 |
+
unset($action['field']);
|
118 |
+
} else {
|
119 |
+
$action['href'] = $action['url'];
|
120 |
+
}
|
121 |
+
unset($action['url']);
|
122 |
+
break;
|
123 |
+
|
124 |
+
case 'popup':
|
125 |
+
$action['onclick'] = 'popWin(this.href, \'_blank\', \'width=800,height=700,resizable=1,scrollbars=1\');return false;';
|
126 |
+
break;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
return $this;
|
130 |
+
}
|
131 |
+
|
132 |
+
protected function checkLimit($id) {
|
133 |
+
if ($id) {
|
134 |
+
$collection = Mage::getModel('offinews/category')->getCollection();
|
135 |
+
$collection->getSelect()->order('main_table.level DESC');
|
136 |
+
$collection->getSelect()->where('main_table.category_id =?', $id);
|
137 |
+
$collection->getSelect()->limit(1);
|
138 |
+
if (count($collection) > 0) {
|
139 |
+
$level = $collection->getData('level');
|
140 |
+
$level = $level[0]['level'];
|
141 |
+
return $level;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Category/Grid/Column/Renderer/SubCategories.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Category_Grid_Column_Renderer_SubCategories extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
|
4 |
+
|
5 |
+
public function render(Varien_Object $row) {
|
6 |
+
$strspace = '    ';
|
7 |
+
$value = $row->getData($this->getColumn()->getIndex());
|
8 |
+
if ($row->getData('level') == 1) {
|
9 |
+
return '<span>' . str_repeat($strspace, 1) . $value . '</span>';
|
10 |
+
} else if ($row->getData('level') == 2) {
|
11 |
+
return '<span>' . str_repeat($strspace, 2) . $value . '</span>';
|
12 |
+
} else if ($row->getData('level') == 3) {
|
13 |
+
return '<span>' . str_repeat($strspace, 3) . $value . '</span>';
|
14 |
+
} else if ($row->getData('level') == 4) {
|
15 |
+
return '<span>' . str_repeat($strspace, 4) . $value . '</span>';
|
16 |
+
} else if ($row->getData('level') == 5) {
|
17 |
+
return '<span>' . str_repeat($strspace, 5) . $value . '</span>';
|
18 |
+
} else {
|
19 |
+
return $value;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
?>
|
app/code/community/Officience/News/Block/Adminhtml/Comment.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Officience_News_Block_Adminhtml_Comment extends Mage_Adminhtml_Block_Widget_Grid_Container
|
5 |
+
{
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->_controller = 'adminhtml_comment';
|
9 |
+
$this->_blockGroup = 'offinews';
|
10 |
+
$this->_headerText = Mage::helper('offinews')->__('Comment Manager');
|
11 |
+
parent::__construct();
|
12 |
+
$this->_removeButton('add');
|
13 |
+
}
|
14 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Comment/Edit.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Comment_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_objectId = 'id';
|
10 |
+
$this->_blockGroup = 'offinews';
|
11 |
+
$this->_controller = 'adminhtml_comment';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('offinews')->__('Save Comment'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('offinews')->__('Delete Comment'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('news_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'news_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'news_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if ( Mage::registry('news_data') && Mage::registry('news_data')->getId() ) {
|
40 |
+
return Mage::helper('offinews')->__("Edit Comment By '%s'",
|
41 |
+
$this->htmlEscape(Mage::registry('news_data')->getUser()));
|
42 |
+
} else {
|
43 |
+
return Mage::helper('offinews')->__('Add Comment');
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Comment/Edit/Form.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Comment_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
protected function _prepareForm() {
|
6 |
+
$collection = Mage::getResourceModel('offinews/comment_collection');
|
7 |
+
|
8 |
+
$news_id = $this->getRequest()->getParam('id');
|
9 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('officience_news');
|
10 |
+
$collection->getSelect()->joinLeft(array("t2" => $tableName), 'main_table.news_id = t2.news_id', 'title');
|
11 |
+
$collection->getSelect()->distinct();
|
12 |
+
$collection->getSelect()->where('main_table.news_id =' . $news_id);
|
13 |
+
$collection->getSelect()->limit(1);
|
14 |
+
$data = $collection->getData();
|
15 |
+
$form = new Varien_Data_Form(array(
|
16 |
+
'id' => 'edit_form',
|
17 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
18 |
+
'method' => 'post',
|
19 |
+
));
|
20 |
+
|
21 |
+
$fieldset = $form->addFieldset('comment_form', array('legend' => Mage::helper('offinews')->__('Comment Information')));
|
22 |
+
|
23 |
+
|
24 |
+
// $fieldset->addField('title', 'hidden', array(
|
25 |
+
// 'label' => Mage::helper('offinews')->__('News Name'),
|
26 |
+
// 'after_element_html' => '<tr><td class="label"><label for="title">News Name</label></td>
|
27 |
+
// <td class="value">' . $data[0]['title'] . '</td></tr>',
|
28 |
+
// ));
|
29 |
+
|
30 |
+
$fieldset->addField('user', 'text', array(
|
31 |
+
'label' => Mage::helper('offinews')->__('User'),
|
32 |
+
'name' => 'user',
|
33 |
+
));
|
34 |
+
|
35 |
+
$fieldset->addField('email', 'text', array(
|
36 |
+
'label' => Mage::helper('offinews')->__('Email Address'),
|
37 |
+
'name' => 'email',
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('comment_status', 'select', array(
|
41 |
+
'label' => Mage::helper('offinews')->__('Status'),
|
42 |
+
'name' => 'comment_status',
|
43 |
+
'values' => array(
|
44 |
+
array(
|
45 |
+
'value' => Officience_News_Helper_Data::UNAPPROVED_STATUS,
|
46 |
+
'label' => Mage::helper('offinews')->__('Unapproved'),
|
47 |
+
),
|
48 |
+
array(
|
49 |
+
'value' => Officience_News_Helper_Data::APPROVED_STATUS,
|
50 |
+
'label' => Mage::helper('offinews')->__('Approved'),
|
51 |
+
),
|
52 |
+
),
|
53 |
+
));
|
54 |
+
|
55 |
+
$fieldset->addField('comment', 'editor', array(
|
56 |
+
'name' => 'comment',
|
57 |
+
'label' => Mage::helper('offinews')->__('Comment'),
|
58 |
+
'title' => Mage::helper('offinews')->__('Comment'),
|
59 |
+
'style' => 'width:500px; height:250px;',
|
60 |
+
'wysiwyg' => false,
|
61 |
+
'required' => false,
|
62 |
+
));
|
63 |
+
|
64 |
+
if (Mage::getSingleton('adminhtml/session')->getNewsData()) {
|
65 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
|
66 |
+
Mage::getSingleton('adminhtml/session')->setNewsData(null);
|
67 |
+
} elseif (Mage::registry('offi_comment_data')) {
|
68 |
+
$form->setValues(Mage::registry('offi_comment_data')->getData());
|
69 |
+
}
|
70 |
+
|
71 |
+
$form->setUseContainer(true);
|
72 |
+
$this->setForm($form);
|
73 |
+
|
74 |
+
return parent::_prepareForm();
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/Comment/Grid.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_Comment_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('commentGrid');
|
8 |
+
$this->setDefaultSort('comment_status');
|
9 |
+
$this->setDefaultDir('ASC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareCollection() {
|
14 |
+
$collection = Mage::getResourceModel('offinews/comment_collection');
|
15 |
+
if ($this->getRequest()->getParam('news_id')) {
|
16 |
+
$collection->addNewsFilter($this->getRequest()->getParam('news_id'));
|
17 |
+
} else {
|
18 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('officience_news');
|
19 |
+
$collection->getSelect()->joinLeft($tableName, 'main_table.news_id = ' . $tableName . '.news_id', array($tableName . '.title as title'));
|
20 |
+
}
|
21 |
+
$this->setCollection($collection);
|
22 |
+
return parent::_prepareCollection();
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _prepareColumns() {
|
26 |
+
$this->addColumn('comment', array(
|
27 |
+
'header' => Mage::helper('offinews')->__('Comment'),
|
28 |
+
'align' => 'left',
|
29 |
+
'index' => 'comment',
|
30 |
+
));
|
31 |
+
|
32 |
+
$this->addColumn('title', array(
|
33 |
+
'header' => Mage::helper('offinews')->__('News Name'),
|
34 |
+
'index' => 'title',
|
35 |
+
));
|
36 |
+
|
37 |
+
$this->addColumn('user', array(
|
38 |
+
'header' => Mage::helper('offinews')->__('User'),
|
39 |
+
'index' => 'user',
|
40 |
+
));
|
41 |
+
|
42 |
+
$this->addColumn('email', array(
|
43 |
+
'header' => Mage::helper('offinews')->__('E-mail'),
|
44 |
+
'index' => 'email',
|
45 |
+
));
|
46 |
+
|
47 |
+
$this->addColumn('created_time', array(
|
48 |
+
'header' => Mage::helper('offinews')->__('Created'),
|
49 |
+
'align' => 'center',
|
50 |
+
'width' => '120px',
|
51 |
+
'type' => 'date',
|
52 |
+
'default' => '--',
|
53 |
+
'index' => 'created_time',
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('comment_status', array(
|
57 |
+
'header' => Mage::helper('offinews')->__('Status'),
|
58 |
+
'align' => 'center',
|
59 |
+
'width' => '80px',
|
60 |
+
'index' => 'comment_status',
|
61 |
+
'type' => 'options',
|
62 |
+
'options' => array(
|
63 |
+
Officience_News_Helper_Data::UNAPPROVED_STATUS => 'Unapproved',
|
64 |
+
Officience_News_Helper_Data::APPROVED_STATUS => 'Approved',
|
65 |
+
),
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn('action', array(
|
69 |
+
'header' => Mage::helper('offinews')->__('Action'),
|
70 |
+
'width' => '50',
|
71 |
+
'type' => 'action',
|
72 |
+
'getter' => 'getId',
|
73 |
+
'actions' => array(
|
74 |
+
array(
|
75 |
+
'caption' => Mage::helper('offinews')->__('Edit'),
|
76 |
+
'url' => array('base' => '*/*/edit'),
|
77 |
+
'field' => 'id'
|
78 |
+
),
|
79 |
+
),
|
80 |
+
'filter' => false,
|
81 |
+
'sortable' => false,
|
82 |
+
'index' => 'stores',
|
83 |
+
'is_system' => true,
|
84 |
+
));
|
85 |
+
|
86 |
+
return parent::_prepareColumns();
|
87 |
+
}
|
88 |
+
|
89 |
+
protected function _prepareMassaction() {
|
90 |
+
$this->setMassactionIdField('post_id');
|
91 |
+
$this->getMassactionBlock()->setFormFieldName('comments');
|
92 |
+
|
93 |
+
$this->getMassactionBlock()->addItem('approve', array(
|
94 |
+
'label' => Mage::helper('offinews')->__('Approve'),
|
95 |
+
'url' => $this->getUrl('*/*/massApprove'),
|
96 |
+
'confirm' => Mage::helper('offinews')->__('Are you sure?')
|
97 |
+
));
|
98 |
+
|
99 |
+
$this->getMassactionBlock()->addItem('unapprove', array(
|
100 |
+
'label' => Mage::helper('offinews')->__('Not Approve'),
|
101 |
+
'url' => $this->getUrl('*/*/massUnapprove'),
|
102 |
+
'confirm' => Mage::helper('offinews')->__('Are you sure?')
|
103 |
+
));
|
104 |
+
|
105 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
106 |
+
'label' => Mage::helper('offinews')->__('Delete'),
|
107 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
108 |
+
'confirm' => Mage::helper('offinews')->__('Are you sure?')
|
109 |
+
));
|
110 |
+
return $this;
|
111 |
+
}
|
112 |
+
|
113 |
+
public function getRowUrl($row) {
|
114 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
115 |
+
}
|
116 |
+
|
117 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_News extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_controller = 'adminhtml_news';
|
8 |
+
$this->_blockGroup = 'offinews';
|
9 |
+
$this->_headerText = Mage::helper('offinews')->__('News Manager');
|
10 |
+
$this->_addButtonLabel = Mage::helper('offinews')->__('Add New Article');
|
11 |
+
parent::__construct();
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News/Edit.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_News_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
$this->_objectId = 'id';
|
8 |
+
$this->_blockGroup = 'offinews';
|
9 |
+
$this->_controller = 'adminhtml_news';
|
10 |
+
|
11 |
+
parent::__construct();
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('offinews')->__('Save News Article'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('offinews')->__('Delete News Article'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('news_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'news_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'news_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
|
35 |
+
function checkboxSwitch(){
|
36 |
+
if (jQuery('#use_full_img').is(':checked')) {
|
37 |
+
jQuery('#image_short_content').parent().parent().css('display','none');
|
38 |
+
} else {
|
39 |
+
jQuery('#image_short_content').parent().parent().css('display', 'table-row');
|
40 |
+
jQuery('#image_short_content').siblings('a').css('float', 'left');
|
41 |
+
jQuery('#image_short_content').siblings('a').css('margin-right', '4px');
|
42 |
+
jQuery('#image_short_content').parent().parent().css('width','155px');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
";
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getHeaderText()
|
49 |
+
{
|
50 |
+
if (Mage::registry('news_data') && Mage::registry('news_data')->getId()) {
|
51 |
+
return Mage::helper('offinews')->__("Edit News Article '%s'",
|
52 |
+
$this->htmlEscape(Mage::registry('news_data')->getTitle()));
|
53 |
+
} else {
|
54 |
+
return Mage::helper('offinews')->__('New post');
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News/Edit/Form.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_News_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Load Wysiwyg on demand and Prepare layout
|
7 |
+
*/
|
8 |
+
protected function _prepareLayout() {
|
9 |
+
parent::_prepareLayout();
|
10 |
+
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
|
11 |
+
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
protected function _prepareForm() {
|
16 |
+
$form = new Varien_Data_Form(array(
|
17 |
+
'id' => 'edit_form',
|
18 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'),
|
19 |
+
'store' => $this->getRequest()->getParam('store', 0),
|
20 |
+
)),
|
21 |
+
'method' => 'post',
|
22 |
+
'enctype' => 'multipart/form-data'
|
23 |
+
)
|
24 |
+
);
|
25 |
+
|
26 |
+
$form->setUseContainer(true);
|
27 |
+
$this->setForm($form);
|
28 |
+
return parent::_prepareForm();
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tab/Additional.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_News_Edit_Tab_Additional extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
public function initForm() {
|
6 |
+
$form = new Varien_Data_Form();
|
7 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
8 |
+
$data = Mage::registry('news_data');
|
9 |
+
$fieldset = $form->addFieldset('news_meta_data', array('legend' => Mage::helper('offinews')->__('Meta Data')));
|
10 |
+
|
11 |
+
if ($storeId) {
|
12 |
+
|
13 |
+
|
14 |
+
$arrMetaKeywords = array(
|
15 |
+
'name' => 'meta_keywords',
|
16 |
+
'label' => Mage::helper('offinews')->__('Keywords'),
|
17 |
+
'title' => Mage::helper('offinews')->__('Meta Keywords'),
|
18 |
+
'style' => 'width: 520px;',
|
19 |
+
);
|
20 |
+
$fieldset->addField('meta_keywords', 'editor', $arrMetaKeywords)
|
21 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('meta_keywords', $defaultValueArr['meta_keywords']));
|
22 |
+
|
23 |
+
$arrMetaDescription = array(
|
24 |
+
'name' => 'meta_description',
|
25 |
+
'label' => Mage::helper('offinews')->__('Description'),
|
26 |
+
'title' => Mage::helper('offinews')->__('Meta Description'),
|
27 |
+
'style' => 'width: 520px;',
|
28 |
+
);
|
29 |
+
$fieldset->addField('meta_description', 'editor', $arrMetaDescription)
|
30 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('meta_description', $defaultValueArr['meta_description']));
|
31 |
+
|
32 |
+
$fieldset = $form->addFieldset('news_options_data', array('legend' => Mage::helper('offinews')->__('Advanced Post Options')));
|
33 |
+
|
34 |
+
$arrAuthor = array(
|
35 |
+
'label' => Mage::helper('offinews')->__('Author name'),
|
36 |
+
'name' => 'author',
|
37 |
+
'style' => 'width: 520px;',
|
38 |
+
'after_element_html' => '<span class="hint"><p class="note">' . $this->__('Leave blank to disable') . '</p></span>',
|
39 |
+
);
|
40 |
+
$fieldset->addField('author', 'text', $arrAuthor)
|
41 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('author', $defaultValueArr['author']));
|
42 |
+
} else {
|
43 |
+
|
44 |
+
$fieldset->addField('meta_keywords', 'editor', array(
|
45 |
+
'name' => 'meta_keywords',
|
46 |
+
'label' => Mage::helper('offinews')->__('Keywords'),
|
47 |
+
'title' => Mage::helper('offinews')->__('Meta Keywords'),
|
48 |
+
'style' => 'width: 520px;',
|
49 |
+
));
|
50 |
+
|
51 |
+
$fieldset->addField('meta_description', 'editor', array(
|
52 |
+
'name' => 'meta_description',
|
53 |
+
'label' => Mage::helper('offinews')->__('Description'),
|
54 |
+
'title' => Mage::helper('offinews')->__('Meta Description'),
|
55 |
+
'style' => 'width: 520px;',
|
56 |
+
));
|
57 |
+
|
58 |
+
$fieldset = $form->addFieldset('news_options_data', array('legend' => Mage::helper('offinews')->__('Advanced Post Options')));
|
59 |
+
|
60 |
+
$fieldset->addField('author', 'text', array(
|
61 |
+
'label' => Mage::helper('offinews')->__('Author name'),
|
62 |
+
'name' => 'author',
|
63 |
+
'style' => 'width: 520px;',
|
64 |
+
'after_element_html' => '<span class="hint"><p class="note">' . $this->__('Leave blank to disable') . '</p></span>',
|
65 |
+
));
|
66 |
+
}
|
67 |
+
|
68 |
+
if (Mage::getSingleton('adminhtml/session')->getNewsData()) {
|
69 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
|
70 |
+
Mage::getSingleton('adminhtml/session')->setNewsData(null);
|
71 |
+
} elseif (Mage::registry('news_data')) {
|
72 |
+
$form->setValues(Mage::registry('news_data')->getData());
|
73 |
+
}
|
74 |
+
$this->setForm($form);
|
75 |
+
return $this;
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tab/Category.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_News_Edit_Tab_Category extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setTemplate('officience/news/listCategory.phtml');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getListMenuCatBlog() {
|
11 |
+
|
12 |
+
$data = $this->getChildCatBlog(0);
|
13 |
+
$childrenWrapClass = '';
|
14 |
+
$storeId = $this->getRequest()->getParam('store', 0);
|
15 |
+
$html = $this->_getHtmlCat($data, $childrenWrapClass, $this->getNewsCategory(), $storeId);
|
16 |
+
return $html;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getNewsCategory() {
|
20 |
+
if ($this->getRequest()->getParam('id', 0)) {
|
21 |
+
$data = Mage::registry('news_data');
|
22 |
+
return $data->getData('news_category');
|
23 |
+
}
|
24 |
+
return array();
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function getChildCatBlog($parentId) {
|
28 |
+
$data = Mage::getModel('offinews/category')->getCollection()
|
29 |
+
->addFieldToFilter('parent_id', array('eq' => $parentId))
|
30 |
+
// ->addFieldToFilter('category_status', array('eq' => 1))
|
31 |
+
->setOrder('sort_order', 'ASC')
|
32 |
+
->load()
|
33 |
+
->getData();
|
34 |
+
foreach ($data as &$items) {
|
35 |
+
$items['child'] = $this->getChildCatBlog($items['category_id']);
|
36 |
+
}
|
37 |
+
return $data;
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _getHtmlCat($menuTree, $childrenWrapClass, $arrCat = array(), $storeId = 0) {
|
41 |
+
|
42 |
+
$html = '';
|
43 |
+
$counter = 1;
|
44 |
+
foreach ($menuTree as $node) {
|
45 |
+
|
46 |
+
$childrenCount = count($menuTree);
|
47 |
+
$children = $node['child'];
|
48 |
+
//$node['First'] = ($counter == 1);
|
49 |
+
//$node['Last'] = ($counter == $childrenCount);
|
50 |
+
$parentLevel = $node['level'];
|
51 |
+
$childLevel = (is_null($parentLevel) || $parentLevel == 0) ? 0 : $parentLevel;
|
52 |
+
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($node) . ' >';
|
53 |
+
$html.='<div class="offinews-node-leaf">';
|
54 |
+
$html .='<img id="ext-gen11" class="offinews-node-icon" unselectable="on" src="' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . 'spacer.gif">';
|
55 |
+
$html .='<input type="checkbox" class="l-tcb ' . ($storeId ? ' disabled ' : '') . '" ';
|
56 |
+
if (count($arrCat) && in_array($node['category_id'], $arrCat)) {
|
57 |
+
$html.=' checked="checked" ';
|
58 |
+
}
|
59 |
+
if ($storeId) {
|
60 |
+
$html.= ' disabled= "" ';
|
61 |
+
}
|
62 |
+
$html.=' name="news_category[]" value="' . $node['category_id'] . '">';
|
63 |
+
$html .= '<a><span>'
|
64 |
+
. $this->escapeHtml($node['title']) . '</span></a>';
|
65 |
+
if (!empty($children)) {
|
66 |
+
$html .= '<ul class="level' . $childLevel . '">';
|
67 |
+
$html .= $this->_getHtmlCat($children, $childrenWrapClass, $arrCat, $storeId);
|
68 |
+
$html .= '</ul>';
|
69 |
+
}
|
70 |
+
$html .='</div>';
|
71 |
+
$html .= '</li>';
|
72 |
+
$counter++;
|
73 |
+
}
|
74 |
+
|
75 |
+
return $html;
|
76 |
+
}
|
77 |
+
|
78 |
+
protected function _getRenderedMenuItemAttributes($item) {
|
79 |
+
$html = '';
|
80 |
+
$attributes = $this->_getMenuItemAttributes($item);
|
81 |
+
|
82 |
+
foreach ($attributes as $attributeName => $attributeValue) {
|
83 |
+
$html .= ' ' . $attributeName . '="' . str_replace('"', '\"', $attributeValue) . '"';
|
84 |
+
}
|
85 |
+
|
86 |
+
return $html;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Returns array of menu item's attributes
|
91 |
+
*
|
92 |
+
* @param Varien_Data_Tree_Node $item
|
93 |
+
* @return array
|
94 |
+
*/
|
95 |
+
protected function _getMenuItemAttributes($item) {
|
96 |
+
$menuItemClasses = $this->_getMenuItemClasses($item);
|
97 |
+
$attributes = array(
|
98 |
+
'class' => implode(' ', $menuItemClasses)
|
99 |
+
);
|
100 |
+
|
101 |
+
return $attributes;
|
102 |
+
}
|
103 |
+
|
104 |
+
protected function _getMenuItemClasses($item) {
|
105 |
+
$classes = array();
|
106 |
+
|
107 |
+
$classes[] = ' offinews-tree-node';
|
108 |
+
|
109 |
+
|
110 |
+
if (isset($item['Active']) && $item['Active']) {
|
111 |
+
$classes[] = 'active';
|
112 |
+
}
|
113 |
+
|
114 |
+
if (!empty($item['child'])) {
|
115 |
+
$classes[] = 'parent';
|
116 |
+
}
|
117 |
+
return $classes;
|
118 |
+
}
|
119 |
+
|
120 |
+
protected function _sortCatBlog($data, $parent_id, &$sortData) {
|
121 |
+
foreach ($data as $listitem) {
|
122 |
+
if ($listitem['parent_id'] == $parent_id) {
|
123 |
+
|
124 |
+
$sortData[] = $listitem;
|
125 |
+
$this->_sortCatBlog($data, $listitem['cat_id'], $sortData);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
return;
|
129 |
+
}
|
130 |
+
|
131 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tab/Info.php
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_News_Edit_Tab_Info extends Mage_Adminhtml_Block_Widget_Form {
|
4 |
+
|
5 |
+
public function initForm() {
|
6 |
+
|
7 |
+
$data = Mage::registry('news_data');
|
8 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
9 |
+
$form = new Varien_Data_Form();
|
10 |
+
|
11 |
+
$fieldset = $form->addFieldset('news_form', array('legend' => Mage::helper('offinews')->__('News information'),
|
12 |
+
));
|
13 |
+
|
14 |
+
if ($storeId) {
|
15 |
+
/* Title */
|
16 |
+
$arrTitle = array(
|
17 |
+
'label' => Mage::helper('offinews')->__('Title'),
|
18 |
+
'class' => 'required-entry',
|
19 |
+
'required' => true,
|
20 |
+
'name' => 'title',
|
21 |
+
);
|
22 |
+
$fieldset->addField('title', 'text', $arrTitle);
|
23 |
+
/* End Title */
|
24 |
+
/* identifier */
|
25 |
+
$arrIdentifier = array(
|
26 |
+
'label' => Mage::helper('offinews')->__('Identifier'),
|
27 |
+
'title' => Mage::helper('offinews')->__('Identifier'),
|
28 |
+
'class' => 'required-entry',
|
29 |
+
'required' => false,
|
30 |
+
'name' => 'identifier',
|
31 |
+
'class' => 'validate-identifier',
|
32 |
+
'after_element_html' => '<div class="hint"><p class="note">' . $this->__('e.g. domain.com/news/identifier') . '</p></div>',
|
33 |
+
);
|
34 |
+
$fieldset->addField('identifier', 'text', $arrIdentifier)
|
35 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('identifier', $defaultValueArr['identifier']));
|
36 |
+
|
37 |
+
/* End identifier */
|
38 |
+
/* status */
|
39 |
+
$arrStatus = array(
|
40 |
+
'label' => Mage::helper('offinews')->__('Status'),
|
41 |
+
'name' => 'news_status',
|
42 |
+
'values' => array(
|
43 |
+
array(
|
44 |
+
'value' => 1,
|
45 |
+
'label' => Mage::helper('offinews')->__('Enabled'),
|
46 |
+
),
|
47 |
+
array(
|
48 |
+
'value' => 2,
|
49 |
+
'label' => Mage::helper('offinews')->__('Disabled'),
|
50 |
+
),
|
51 |
+
),
|
52 |
+
);
|
53 |
+
$fieldset->addField('news_status', 'select', $arrStatus)
|
54 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('news_status', $defaultValueArr['news_status']));
|
55 |
+
/* End status */
|
56 |
+
/* publicate_from_time */
|
57 |
+
/*$arrPublicateFromDate = array(
|
58 |
+
'label' => $this->__('publicate_from_date'),
|
59 |
+
'name' => 'publicate_from_date',
|
60 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
61 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
62 |
+
);
|
63 |
+
$fieldset->addField('publicate_from_date', 'date', $arrPublicateFromDate)
|
64 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('publicate_from_date', $defaultValueArr['publicate_from_date']));
|
65 |
+
*/
|
66 |
+
/* End publicate_from_time */
|
67 |
+
/* identifier */
|
68 |
+
/*
|
69 |
+
$arrPublicateFromTime = array(
|
70 |
+
'label' => Mage::helper('offinews')->__('publicate_from_time'),
|
71 |
+
'name' => 'publicate_from_time',
|
72 |
+
'value' => '12,04,15',
|
73 |
+
'after_element_html' => '<small>Comments</small>',
|
74 |
+
);
|
75 |
+
$fieldset->addField('publicate_from_time', 'time', $arrPublicateFromTime)
|
76 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('publicate_from_time', $defaultValueArr['publicate_from_time']));
|
77 |
+
*/
|
78 |
+
/* identifier */
|
79 |
+
|
80 |
+
/* publicate_to_date */
|
81 |
+
/* $arrPublicateToDate = array(
|
82 |
+
'label' => $this->__('publicate_to_date'),
|
83 |
+
'name' => 'publicate_to_date',
|
84 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
85 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)
|
86 |
+
);
|
87 |
+
$fieldset->addField('publicate_to_date', 'date', $arrPublicateToDate)
|
88 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('publicate_to_date', $defaultValueArr['publicate_to_date']));
|
89 |
+
*/
|
90 |
+
/* End publicate_to_date */
|
91 |
+
/* publicate_to_time *//*
|
92 |
+
$arrPublicateToTime = array(
|
93 |
+
'label' => Mage::helper('offinews')->__('publicate_to_time'),
|
94 |
+
'name' => 'publicate_to_time',
|
95 |
+
'onclick' => "",
|
96 |
+
'onchange' => "",
|
97 |
+
'value' => '01,00,01',
|
98 |
+
'disabled' => false,
|
99 |
+
'readonly' => false,
|
100 |
+
'after_element_html' => '<small>Comments</small>',
|
101 |
+
);
|
102 |
+
$fieldset->addField('publicate_to_time', 'time', $arrPublicateToTime)
|
103 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('publicate_to_time', $defaultValueArr['publicate_to_time']));
|
104 |
+
*/
|
105 |
+
/* End publicate_to_time */
|
106 |
+
/* comments_enabled */
|
107 |
+
$arrCommentsEnabled = array(
|
108 |
+
'label' => Mage::helper('offinews')->__('Comments'),
|
109 |
+
'name' => 'comments_enabled',
|
110 |
+
'values' => array(
|
111 |
+
array(
|
112 |
+
'value' => 1,
|
113 |
+
'label' => Mage::helper('offinews')->__('Enabled'),
|
114 |
+
),
|
115 |
+
array(
|
116 |
+
'value' => 0,
|
117 |
+
'label' => Mage::helper('offinews')->__('Disabled'),
|
118 |
+
),
|
119 |
+
),
|
120 |
+
);
|
121 |
+
$fieldset->addField('comments_enabled', 'select', $arrCommentsEnabled)
|
122 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('comments_enabled', $defaultValueArr['comments_enabled']));
|
123 |
+
|
124 |
+
|
125 |
+
/* End comments_enabled */
|
126 |
+
/* description */
|
127 |
+
$arrDescription = array(
|
128 |
+
'name' => 'description',
|
129 |
+
'label' => Mage::helper('offinews')->__('Description'),
|
130 |
+
'title' => Mage::helper('offinews')->__('Description'),
|
131 |
+
'style' => 'height:36em',
|
132 |
+
'config' => Mage::getSingleton('offinews/wysiwyg_config')->getConfig(),
|
133 |
+
'wysiwyg' => true
|
134 |
+
);
|
135 |
+
$fieldset->addField('description', 'editor', $arrDescription)
|
136 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('description', $defaultValueArr['description']));
|
137 |
+
/* End description */
|
138 |
+
/* full_content */
|
139 |
+
$arrFullContent = array(
|
140 |
+
'name' => 'full_content',
|
141 |
+
'label' => Mage::helper('offinews')->__('Full Description'),
|
142 |
+
'title' => Mage::helper('offinews')->__('Full Description'),
|
143 |
+
'style' => 'height:36em',
|
144 |
+
'config' => Mage::getSingleton('offinews/wysiwyg_config')->getConfig(),
|
145 |
+
'wysiwyg' => true
|
146 |
+
);
|
147 |
+
$fieldset->addField('full_content', 'editor', $arrFullContent)
|
148 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('full_content', $defaultValueArr['full_content']));
|
149 |
+
/* End full_content */
|
150 |
+
/* tags */
|
151 |
+
$arrTags = array(
|
152 |
+
'label' => Mage::helper('offinews')->__('Add Tags'),
|
153 |
+
'title' => Mage::helper('offinews')->__('Add Tags'),
|
154 |
+
'name' => 'tags',
|
155 |
+
'after_element_html' => '<div class="hint"><p class="note">' . $this->__('Use comma for multiple words') . '</p></div>',
|
156 |
+
);
|
157 |
+
$fieldset->addField('tags', 'text', $arrTags)
|
158 |
+
->setAfterElementHtml(Mage::helper('offinews')->addAfterElement('tags', $defaultValueArr['tags']));
|
159 |
+
/* End tags */
|
160 |
+
} else {
|
161 |
+
$fieldset->addField('title', 'text', array(
|
162 |
+
'label' => Mage::helper('offinews')->__('Title'),
|
163 |
+
'class' => 'required-entry',
|
164 |
+
'required' => true,
|
165 |
+
'name' => 'title',
|
166 |
+
));
|
167 |
+
|
168 |
+
$fieldset->addField('identifier', 'text', array(
|
169 |
+
'label' => Mage::helper('offinews')->__('Identifier'),
|
170 |
+
'title' => Mage::helper('offinews')->__('Identifier'),
|
171 |
+
'class' => 'required-entry',
|
172 |
+
'required' => false,
|
173 |
+
'name' => 'identifier',
|
174 |
+
'class' => 'validate-identifier',
|
175 |
+
'after_element_html' => '<div class="hint"><p class="note">' . $this->__('e.g. domain.com/news/identifier') . '</p></div>',
|
176 |
+
));
|
177 |
+
|
178 |
+
$fieldset->addField('news_status', 'select', array(
|
179 |
+
'label' => Mage::helper('offinews')->__('Status'),
|
180 |
+
'name' => 'news_status',
|
181 |
+
'values' => array(
|
182 |
+
array(
|
183 |
+
'value' => 1,
|
184 |
+
'label' => Mage::helper('offinews')->__('Enabled'),
|
185 |
+
),
|
186 |
+
array(
|
187 |
+
'value' => 2,
|
188 |
+
'label' => Mage::helper('offinews')->__('Disabled'),
|
189 |
+
),
|
190 |
+
),
|
191 |
+
));
|
192 |
+
|
193 |
+
/*
|
194 |
+
$fieldset->addField('publicate_from_date', 'date', array(
|
195 |
+
'label' => $this->__('publicate from date'),
|
196 |
+
'name' => 'publicate_from_date',
|
197 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
198 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
199 |
+
));
|
200 |
+
|
201 |
+
$fieldset->addField('publicate_from_time', 'time', array(
|
202 |
+
'label' => Mage::helper('offinews')->__('publicate from time'),
|
203 |
+
'name' => 'publicate_from_time',
|
204 |
+
'value' => '12,04,15',
|
205 |
+
'after_element_html' => '<small>Comments</small>',
|
206 |
+
));
|
207 |
+
|
208 |
+
$fieldset->addField('publicate_to_date', 'date', array(
|
209 |
+
'label' => $this->__('publicate to date'),
|
210 |
+
'name' => 'publicate_to_date',
|
211 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
212 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
213 |
+
));
|
214 |
+
|
215 |
+
$fieldset->addField('publicate_to_time', 'time', array(
|
216 |
+
'label' => Mage::helper('offinews')->__('publicate to time'),
|
217 |
+
'name' => 'publicate_to_time',
|
218 |
+
'onclick' => "",
|
219 |
+
'onchange' => "",
|
220 |
+
'value' => '01,00,01',
|
221 |
+
'disabled' => false,
|
222 |
+
'readonly' => false,
|
223 |
+
'after_element_html' => '<small>Comments</small>',
|
224 |
+
));
|
225 |
+
*/
|
226 |
+
|
227 |
+
$fieldset->addField('thumbnail', 'image', array(
|
228 |
+
'label' => Mage::helper('offinews')->__('Thumnail'),
|
229 |
+
'required' => false,
|
230 |
+
'name' => 'thumbnail',
|
231 |
+
));
|
232 |
+
|
233 |
+
|
234 |
+
$fieldset->addField('comments_enabled', 'select', array(
|
235 |
+
'label' => Mage::helper('offinews')->__('Comments'),
|
236 |
+
'name' => 'comments_enabled',
|
237 |
+
'values' => array(
|
238 |
+
array(
|
239 |
+
'value' => 1,
|
240 |
+
'label' => Mage::helper('offinews')->__('Enabled'),
|
241 |
+
),
|
242 |
+
array(
|
243 |
+
'value' => 0,
|
244 |
+
'label' => Mage::helper('offinews')->__('Disabled'),
|
245 |
+
),
|
246 |
+
),
|
247 |
+
));
|
248 |
+
|
249 |
+
|
250 |
+
|
251 |
+
$fieldset->addField('description', 'editor', array(
|
252 |
+
'name' => 'description',
|
253 |
+
'label' => Mage::helper('offinews')->__('Description'),
|
254 |
+
'title' => Mage::helper('offinews')->__('Description'),
|
255 |
+
'style' => 'height:36em',
|
256 |
+
'config' => Mage::getSingleton('offinews/wysiwyg_config')->getConfig(),
|
257 |
+
'wysiwyg' => true
|
258 |
+
));
|
259 |
+
|
260 |
+
$fieldset->addField('full_content', 'editor', array(
|
261 |
+
'name' => 'full_content',
|
262 |
+
'label' => Mage::helper('offinews')->__('Full Description'),
|
263 |
+
'title' => Mage::helper('offinews')->__('Full Description'),
|
264 |
+
'style' => 'height:36em',
|
265 |
+
'config' => Mage::getSingleton('offinews/wysiwyg_config')->getConfig(),
|
266 |
+
'wysiwyg' => true
|
267 |
+
));
|
268 |
+
|
269 |
+
$fieldset->addField('tags', 'text', array(
|
270 |
+
'label' => Mage::helper('offinews')->__('Add Tags'),
|
271 |
+
'title' => Mage::helper('offinews')->__('Add Tags'),
|
272 |
+
'name' => 'tags',
|
273 |
+
'after_element_html' => '<div class="hint"><p class="note">' . $this->__('Use comma for multiple words') . '</p></div>',
|
274 |
+
));
|
275 |
+
}
|
276 |
+
|
277 |
+
if ($this->getRequest()->getParam('id', 0)) {
|
278 |
+
$fieldset->addField('news_id', 'hidden', array(
|
279 |
+
'name' => 'news_id',
|
280 |
+
));
|
281 |
+
$form->setValues($this->getRequest()->getParam('id'));
|
282 |
+
}
|
283 |
+
|
284 |
+
if (Mage::getSingleton('adminhtml/session')->getNewsData()) {
|
285 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
|
286 |
+
Mage::getSingleton('adminhtml/session')->setNewsData(null);
|
287 |
+
} elseif (Mage::registry('news_data')) {
|
288 |
+
$data = Mage::registry('news_data');
|
289 |
+
if (($data->getImageShortContent() == $data->getImageFullContent()) || $data->getImageShortContent() == '' || !$data->getImageShortContent()) {
|
290 |
+
$data->setUseFullImg(1);
|
291 |
+
}
|
292 |
+
$form->setValues($data->getData());
|
293 |
+
}
|
294 |
+
|
295 |
+
if (Mage::app()->isSingleStoreMode()) {
|
296 |
+
$fieldset->addField('store_id', 'hidden', array(
|
297 |
+
'name' => 'stores[]',
|
298 |
+
'value' => Mage::app()->getStore(true)->getId()
|
299 |
+
));
|
300 |
+
}
|
301 |
+
$this->setForm($form);
|
302 |
+
return $this;
|
303 |
+
}
|
304 |
+
|
305 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News/Edit/Tabs.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Officience_News_Block_Adminhtml_News_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
5 |
+
{
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('news_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('offinews')->__('Main Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('info', array(
|
17 |
+
'label' => Mage::helper('offinews')->__('Main Information'),
|
18 |
+
'content' => $this->getLayout()->createBlock('offinews/adminhtml_news_edit_tab_info')->initForm()->toHtml(),
|
19 |
+
));
|
20 |
+
|
21 |
+
$this->addTab('category', array(
|
22 |
+
'label' => Mage::helper('offinews')->__('Category'),
|
23 |
+
'content' => $this->getLayout()
|
24 |
+
->createBlock('offinews/adminhtml_news_edit_tab_category')->toHtml(),
|
25 |
+
));
|
26 |
+
|
27 |
+
$this->addTab('additional', array(
|
28 |
+
'label' => Mage::helper('offinews')->__('Additional Options'),
|
29 |
+
'content' => $this->getLayout()
|
30 |
+
->createBlock('offinews/adminhtml_news_edit_tab_additional')->initForm()->toHtml(),
|
31 |
+
));
|
32 |
+
|
33 |
+
return parent::_beforeToHtml();
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Officience/News/Block/Adminhtml/News/Grid.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Adminhtml_News_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('newsGrid');
|
9 |
+
$this->setDefaultDir('DESC');
|
10 |
+
$this->setSaveParametersInSession(true);
|
11 |
+
}
|
12 |
+
|
13 |
+
protected function _prepareCollection()
|
14 |
+
{
|
15 |
+
$collection = Mage::getModel('offinews/news')->getCollection();
|
16 |
+
// foreach($collection as $item) {
|
17 |
+
// $stores = $this->lookupStoreIds($item->getId());
|
18 |
+
// $item->setData('store_id', $stores);
|
19 |
+
// }
|
20 |
+
$this->setCollection($collection);
|
21 |
+
return parent::_prepareCollection();
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _prepareColumns()
|
25 |
+
{
|
26 |
+
$this->addColumn('news_id', array(
|
27 |
+
'header' => Mage::helper('offinews')->__('ID'),
|
28 |
+
'align' =>'right',
|
29 |
+
'width' => '50',
|
30 |
+
'index' => 'news_id',
|
31 |
+
));
|
32 |
+
|
33 |
+
$this->addColumn('title', array(
|
34 |
+
'header' => Mage::helper('offinews')->__('Title'),
|
35 |
+
'align' =>'left',
|
36 |
+
'index' => 'title',
|
37 |
+
));
|
38 |
+
|
39 |
+
$this->addColumn('identifier', array(
|
40 |
+
'header' => Mage::helper('offinews')->__('URL Key'),
|
41 |
+
'align' => 'left',
|
42 |
+
'index' => 'identifier',
|
43 |
+
));
|
44 |
+
|
45 |
+
$this->addColumn('author', array(
|
46 |
+
'header' => Mage::helper('offinews')->__('Author'),
|
47 |
+
'index' => 'author',
|
48 |
+
));
|
49 |
+
|
50 |
+
|
51 |
+
$this->addColumn('created_time', array(
|
52 |
+
'header' => Mage::helper('offinews')->__('Created'),
|
53 |
+
'align' => 'left',
|
54 |
+
'width' => '100',
|
55 |
+
'type' => 'datetime',
|
56 |
+
'default' => '--',
|
57 |
+
'index' => 'created_time',
|
58 |
+
));
|
59 |
+
|
60 |
+
$this->addColumn('update_time', array(
|
61 |
+
'header' => Mage::helper('offinews')->__('Updated'),
|
62 |
+
'align' => 'left',
|
63 |
+
'width' => '100',
|
64 |
+
'type' => 'datetime',
|
65 |
+
'default' => '--',
|
66 |
+
'index' => 'update_time',
|
67 |
+
));
|
68 |
+
|
69 |
+
$this->addColumn('news_status', array(
|
70 |
+
'header' => Mage::helper('offinews')->__('Status'),
|
71 |
+
'align' => 'left',
|
72 |
+
'width' => '70',
|
73 |
+
'index' => 'news_status',
|
74 |
+
'type' => 'options',
|
75 |
+
'options' => array(
|
76 |
+
1 => Mage::helper('offinews')->__('Enabled'),
|
77 |
+
2 => Mage::helper('offinews')->__('Disabled')
|
78 |
+
),
|
79 |
+
));
|
80 |
+
|
81 |
+
$this->addColumn('action',
|
82 |
+
array(
|
83 |
+
'header' => Mage::helper('offinews')->__('Action'),
|
84 |
+
'width' => '60',
|
85 |
+
'type' => 'action',
|
86 |
+
'getter' => 'getId',
|
87 |
+
'actions' => array(
|
88 |
+
array(
|
89 |
+
'caption' => Mage::helper('offinews')->__('Edit'),
|
90 |
+
'url' => array('base'=> '*/*/edit'),
|
91 |
+
'field' => 'id'
|
92 |
+
),
|
93 |
+
),
|
94 |
+
'filter' => false,
|
95 |
+
'sortable' => false,
|
96 |
+
'index' => 'stores',
|
97 |
+
'is_system' => true,
|
98 |
+
));
|
99 |
+
|
100 |
+
$this->addColumn('view_comments',
|
101 |
+
array(
|
102 |
+
'header' => Mage::helper('offinews')->__('Comments'),
|
103 |
+
'width' => '100',
|
104 |
+
'type' => 'action',
|
105 |
+
'getter' => 'getId',
|
106 |
+
'actions' => array(
|
107 |
+
array(
|
108 |
+
'caption' => Mage::helper('offinews')->__('View comments'),
|
109 |
+
'url' => array('base'=> 'offinews/adminhtml_comment/index'),
|
110 |
+
'field' => 'news_id'
|
111 |
+
)
|
112 |
+
),
|
113 |
+
'filter' => false,
|
114 |
+
'sortable' => false,
|
115 |
+
'index' => 'stores',
|
116 |
+
'is_system' => true,
|
117 |
+
));
|
118 |
+
|
119 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
120 |
+
return parent::_prepareColumns();
|
121 |
+
}
|
122 |
+
|
123 |
+
protected function _prepareMassaction()
|
124 |
+
{
|
125 |
+
$this->setMassactionIdField('news_id');
|
126 |
+
$this->getMassactionBlock()->setFormFieldName('news');
|
127 |
+
|
128 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
129 |
+
'label' => Mage::helper('offinews')->__('Delete'),
|
130 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
131 |
+
'confirm' => Mage::helper('offinews')->__('Are you sure?')
|
132 |
+
));
|
133 |
+
|
134 |
+
$statuses = array(
|
135 |
+
1 => Mage::helper('offinews')->__('Enabled'),
|
136 |
+
0 => Mage::helper('offinews')->__('Disabled')
|
137 |
+
);
|
138 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
139 |
+
$this->getMassactionBlock()->addItem('news_status', array(
|
140 |
+
'label'=> Mage::helper('offinews')->__('Change status'),
|
141 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
142 |
+
'additional' => array(
|
143 |
+
'visibility' => array(
|
144 |
+
'name' => 'news_status',
|
145 |
+
'type' => 'select',
|
146 |
+
'class' => 'required-entry',
|
147 |
+
'label' => Mage::helper('offinews')->__('Status'),
|
148 |
+
'values' => $statuses
|
149 |
+
)
|
150 |
+
)
|
151 |
+
));
|
152 |
+
return $this;
|
153 |
+
}
|
154 |
+
|
155 |
+
protected function _filterStoreCondition($collection, $column)
|
156 |
+
{
|
157 |
+
if (!$value = $column->getFilter()->getValue()) {
|
158 |
+
return;
|
159 |
+
}
|
160 |
+
|
161 |
+
$this->getCollection()->addStoreFilter($value);
|
162 |
+
}
|
163 |
+
|
164 |
+
public function getRowUrl($row)
|
165 |
+
{
|
166 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
167 |
+
}
|
168 |
+
|
169 |
+
public function lookupStoreIds($objectId)
|
170 |
+
{
|
171 |
+
$adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
|
172 |
+
|
173 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('officience_news_store');
|
174 |
+
$select = $adapter->select()
|
175 |
+
->from($tableName, 'store_id')
|
176 |
+
->where('news_id = ?',(int)$objectId);
|
177 |
+
|
178 |
+
return $adapter->fetchCol($select);
|
179 |
+
}
|
180 |
+
}
|
app/code/community/Officience/News/Block/Category.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Category extends Officience_News_Block_Abstract {
|
4 |
+
|
5 |
+
protected function _prepareLayout() {
|
6 |
+
if ($head = $this->getLayout()->getBlock('head')) {
|
7 |
+
// show breadcrumbs
|
8 |
+
|
9 |
+
$moduleName = $this->getRequest()->getModuleName();
|
10 |
+
$showBreadcrumbs = (int) Mage::getStoreConfig('offinews/news/showbreadcrumbs');
|
11 |
+
if ($showBreadcrumbs && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))) {
|
12 |
+
$breadcrumbs->addCrumb('home', array(
|
13 |
+
'label' => Mage::helper('offinews')->__('Home'),
|
14 |
+
'title' => Mage::helper('offinews')->__('Go to Home Page'),
|
15 |
+
'link' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)));
|
16 |
+
$breadcrumbs->addCrumb('offinews', array(
|
17 |
+
'label' => Mage::helper('offinews')->__(Mage::getStoreConfig('offinews/news/title')),
|
18 |
+
'title' => Mage::helper('offinews')->__('Return to %s', Mage::helper('offinews')->__('News')),
|
19 |
+
'link' => Mage::getUrl(Mage::helper('offinews')->getRoute())
|
20 |
+
));
|
21 |
+
|
22 |
+
if (Mage::helper('offinews')->getUrloption() == 2) {
|
23 |
+
if (Mage::registry('current_offi_news_cat_path')) {
|
24 |
+
$catPath = explode('/', Mage::registry('current_offi_news_cat_path'));
|
25 |
+
if (count($catPath) > 0) {
|
26 |
+
$countPath = count($catPath);
|
27 |
+
$countKey = 0;
|
28 |
+
foreach ($catPath as $key => $catItem) {
|
29 |
+
$countKey++;
|
30 |
+
$modelCatItem = Mage::getModel('offinews/category')->load($catItem);
|
31 |
+
if ($modelCatItem->getTitle() != "") {
|
32 |
+
if ($countKey != $countPath) {
|
33 |
+
$breadcrumbs->addCrumb('category-' . $key, array(
|
34 |
+
'label' => $modelCatItem->getTitle(),
|
35 |
+
'title' => Mage::helper('offinews')->__('Return to ' . $modelCatItem->getTitle()),
|
36 |
+
'link' => $modelCatItem->getUrl())
|
37 |
+
);
|
38 |
+
} else {
|
39 |
+
$breadcrumbs->addCrumb('category', array(
|
40 |
+
'label' => $modelCatItem->getTitle(),
|
41 |
+
'title' => Mage::helper('offinews')->__('Return to ' . $modelCatItem->getTitle()),
|
42 |
+
));
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
} else {
|
49 |
+
if (Mage::registry('current_offi_news_cat_id')) {
|
50 |
+
$titleCat = Mage::getModel('offinews/category')->load(Mage::registry('current_offi_news_cat_id'))->getTitle();
|
51 |
+
$breadcrumbs->addCrumb('category', array(
|
52 |
+
'label' => $titleCat,
|
53 |
+
'title' => Mage::helper('offinews')->__('Return to ' . $titleCat),
|
54 |
+
));
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
if ($moduleName == 'offinews') {
|
60 |
+
// set default meta data
|
61 |
+
$head->setTitle(Mage::getStoreConfig('offinews/news/metatitle'));
|
62 |
+
$head->setKeywords(Mage::getStoreConfig('offinews/news/metakeywords'));
|
63 |
+
$head->setDescription(Mage::getStoreConfig('offinews/news/metadescription'));
|
64 |
+
// set category meta data if defined
|
65 |
+
$currentCategory = $this->getCurrentCategory();
|
66 |
+
if ($currentCategory != null) {
|
67 |
+
if ($currentCategory->getTitle() != '') {
|
68 |
+
$head->setTitle($currentCategory->getTitle());
|
69 |
+
}
|
70 |
+
if ($currentCategory->getMetaKeywords() != '') {
|
71 |
+
$head->setKeywords($currentCategory->getMetaKeywords());
|
72 |
+
}
|
73 |
+
if ($currentCategory->getMetaDescription() != '') {
|
74 |
+
$head->setDescription($currentCategory->getMetaDescription());
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
public function getUrlRss() {
|
82 |
+
$curRequest = $this->getRequest()->getPathInfo();
|
83 |
+
if (substr($curRequest, 0, strlen('/' . Mage::helper('offinews')->getRoute())) == '/' . Mage::helper('offinews')->getRoute()) {
|
84 |
+
$curRequest = str_replace('/' . Mage::helper('offinews')->getRoute(), Mage::helper('offinews')->getRoute() . '/rss', $curRequest);
|
85 |
+
}
|
86 |
+
return Mage::getUrl() . $curRequest;
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getSubCategory() {
|
90 |
+
$data = array();
|
91 |
+
if ($this->getCategory()) {
|
92 |
+
$data = $this->getChildCatBlog($this->getCategory());
|
93 |
+
} else {
|
94 |
+
$data = $this->getChildCatBlog(0);
|
95 |
+
}
|
96 |
+
return $data;
|
97 |
+
}
|
98 |
+
|
99 |
+
}
|
app/code/community/Officience/News/Block/Menu.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Menu extends Officience_News_Block_Abstract {
|
4 |
+
|
5 |
+
public function getMenu() {
|
6 |
+
$data = $this->getChildCatBlog(0);
|
7 |
+
$childrenWrapClass = '';
|
8 |
+
$html = $this->_getHtml($data, $childrenWrapClass);
|
9 |
+
return $html;
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _sortCatBlog($data, $parent_id, &$sortData) {
|
13 |
+
foreach ($data as $listitem) {
|
14 |
+
if ($listitem['parent_id'] == $parent_id) {
|
15 |
+
|
16 |
+
$sortData[] = $listitem;
|
17 |
+
$this->_sortCatBlog($data, $listitem['category_id'], $sortData);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function getChildCatBlog($parentId) {
|
24 |
+
$storeId = Mage::app()->getStore()->getId();
|
25 |
+
$data = Mage::getModel('offinews/category')->getCollection()
|
26 |
+
->addFieldToFilter('parent_id', array('eq' => $parentId))
|
27 |
+
->addStoreFilter($storeId)
|
28 |
+
->addStoreEnableFilter(1)
|
29 |
+
->setOrder('sort_order', 'ASC')
|
30 |
+
;
|
31 |
+
foreach ($data as &$items) {
|
32 |
+
$items->setUrl($items->getUrl());
|
33 |
+
$items->setChild($this->getChildCatBlog($items->getId()));
|
34 |
+
}
|
35 |
+
return $data;
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _getHtml($menuTree, $childrenWrapClass) {
|
39 |
+
|
40 |
+
$html = '';
|
41 |
+
$counter = 1;
|
42 |
+
foreach ($menuTree as $node) {
|
43 |
+
|
44 |
+
$childrenCount = count($menuTree);
|
45 |
+
$children = $node['child'];
|
46 |
+
$node['First'] = ($counter == 1);
|
47 |
+
$node['Last'] = ($counter == $childrenCount);
|
48 |
+
$parentLevel = $node['level'];
|
49 |
+
$childLevel = (is_null($parentLevel) || $parentLevel == 0) ? 0 : $parentLevel;
|
50 |
+
|
51 |
+
//$parentPositionClass = $menuTree->getPositionClass();
|
52 |
+
//$itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
|
53 |
+
|
54 |
+
$html .= '<li ' . $this->_getRenderedMenuItemAttributes($node) . ' >';
|
55 |
+
$html .= '<a href="' . $node['url'] . '" ><span>'
|
56 |
+
. $this->escapeHtml($node['title']) . '</span></a>';
|
57 |
+
|
58 |
+
if (!empty($children)) {
|
59 |
+
if (!empty($childrenWrapClass)) {
|
60 |
+
$html .= '<div class="' . $childrenWrapClass . '">';
|
61 |
+
}
|
62 |
+
$html .= '<ul class="level' . $childLevel . '">';
|
63 |
+
$html .= $this->_getHtml($children, $childrenWrapClass);
|
64 |
+
$html .= '</ul>';
|
65 |
+
|
66 |
+
if (!empty($childrenWrapClass)) {
|
67 |
+
$html .= '</div>';
|
68 |
+
}
|
69 |
+
}
|
70 |
+
$html .= '</li>';
|
71 |
+
$counter++;
|
72 |
+
}
|
73 |
+
|
74 |
+
return $html;
|
75 |
+
}
|
76 |
+
|
77 |
+
protected function _getRenderedMenuItemAttributes($item) {
|
78 |
+
$html = '';
|
79 |
+
$attributes = $this->_getMenuItemAttributes($item);
|
80 |
+
|
81 |
+
foreach ($attributes as $attributeName => $attributeValue) {
|
82 |
+
$html .= ' ' . $attributeName . '="' . str_replace('"', '\"', $attributeValue) . '"';
|
83 |
+
}
|
84 |
+
|
85 |
+
return $html;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Returns array of menu item's attributes
|
90 |
+
*
|
91 |
+
* @param Varien_Data_Tree_Node $item
|
92 |
+
* @return array
|
93 |
+
*/
|
94 |
+
protected function _getMenuItemAttributes($item) {
|
95 |
+
$menuItemClasses = $this->_getMenuItemClasses($item);
|
96 |
+
$attributes = array(
|
97 |
+
'class' => implode(' ', $menuItemClasses)
|
98 |
+
);
|
99 |
+
|
100 |
+
return $attributes;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Returns array of menu item's classes
|
105 |
+
*
|
106 |
+
* @param Varien_Data_Tree_Node $item
|
107 |
+
* @return array
|
108 |
+
*/
|
109 |
+
protected function _getMenuItemClasses($item) {
|
110 |
+
$classes = array();
|
111 |
+
|
112 |
+
$classes[] = 'level' . $item['level'];
|
113 |
+
|
114 |
+
if ($item['First']) {
|
115 |
+
$classes[] = 'first';
|
116 |
+
}
|
117 |
+
|
118 |
+
if (isset($item['Active']) && $item['Active']) {
|
119 |
+
$classes[] = 'active';
|
120 |
+
}
|
121 |
+
|
122 |
+
if ($item['Last']) {
|
123 |
+
$classes[] = 'last';
|
124 |
+
}
|
125 |
+
|
126 |
+
if (!empty($item['child'])) {
|
127 |
+
$classes[] = 'parent';
|
128 |
+
}
|
129 |
+
return $classes;
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
?>
|
app/code/community/Officience/News/Block/Newspost.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Newspost extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
protected $_pagesCount = null;
|
6 |
+
protected $_currentPage = null;
|
7 |
+
protected $_itemsOnPage = 10;
|
8 |
+
protected $_pages;
|
9 |
+
|
10 |
+
protected function _construct() {
|
11 |
+
$this->_currentPage = $this->getRequest()->getParam('page');
|
12 |
+
if (!$this->_currentPage) {
|
13 |
+
$this->_currentPage = 1;
|
14 |
+
}
|
15 |
+
|
16 |
+
$itemsPerPage = (int) Mage::getStoreConfig('offinews/comments/commentsperpage');
|
17 |
+
if ($itemsPerPage > 0) {
|
18 |
+
$this->_itemsOnPage = $itemsPerPage;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _prepareLayout() {
|
23 |
+
if ($head = $this->getLayout()->getBlock('head')) {
|
24 |
+
$newspost = $this->getNewsPost();
|
25 |
+
|
26 |
+
if ($newspost == null) {
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
$showBreadcrumbs = (int) Mage::getStoreConfig('offinews/news/showbreadcrumbs');
|
30 |
+
if ($showBreadcrumbs && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))) {
|
31 |
+
$breadcrumbs->addCrumb('home', array(
|
32 |
+
'label' => Mage::helper('offinews')->__('Home'),
|
33 |
+
'title' => Mage::helper('offinews')->__('Go to Home Page'),
|
34 |
+
'link' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)
|
35 |
+
));
|
36 |
+
|
37 |
+
$breadcrumbs->addCrumb('offinews', array(
|
38 |
+
'label' => Mage::helper('offinews')->__(Mage::getStoreConfig('offinews/news/title')),
|
39 |
+
'title' => Mage::helper('offinews')->__('Return to %s', Mage::helper('offinews')->__('News')),
|
40 |
+
'link' => Mage::getUrl(Mage::helper('offinews')->getRoute())
|
41 |
+
));
|
42 |
+
|
43 |
+
if (Mage::helper('offinews')->getUrloption() == 2) {
|
44 |
+
if (Mage::registry('current_offi_news_cat_path')) {
|
45 |
+
$catPath = explode('/', Mage::registry('current_offi_news_cat_path'));
|
46 |
+
if (count($catPath) > 0) {
|
47 |
+
foreach ($catPath as $key => $catItem) {
|
48 |
+
$modelCatItem = Mage::getModel('offinews/category')->load($catItem);
|
49 |
+
if ($modelCatItem->getTitle() != "") {
|
50 |
+
$breadcrumbs->addCrumb('category', array(
|
51 |
+
'label' => $modelCatItem->getTitle(),
|
52 |
+
'title' => Mage::helper('offinews')->__('Return to ' . $modelCatItem->getTitle()),
|
53 |
+
'link' => $modelCatItem->getUrl())
|
54 |
+
);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
} else {
|
60 |
+
if (Mage::registry('current_offi_news_cat_id')) {
|
61 |
+
$loadCurCat = Mage::getModel('offinews/category')->load(Mage::registry('current_offi_news_cat_id'));
|
62 |
+
$breadcrumbs->addCrumb('category', array(
|
63 |
+
'label' => $loadCurCat->getTitle(),
|
64 |
+
'title' => Mage::helper('offinews')->__('Return to %s', $loadCurCat->getTitle()),
|
65 |
+
'link' => $loadCurCat->getUrl()
|
66 |
+
));
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
$breadcrumbs->addCrumb('item', array(
|
73 |
+
'label' => $newspost->getTitle(),
|
74 |
+
'title' => $newspost->getTitle()
|
75 |
+
));
|
76 |
+
}
|
77 |
+
|
78 |
+
$head->setTitle($newspost->getTitle());
|
79 |
+
if ($newspost->getMetaKeywords() != '') {
|
80 |
+
$head->setKeywords($newspost->getMetaKeywords());
|
81 |
+
} else {
|
82 |
+
$head->setKeywords(Mage::getStoreConfig('offinews/news/metakeywords'));
|
83 |
+
}
|
84 |
+
if ($newspost->getMetaDescription() != '') {
|
85 |
+
$head->setDescription($newspost->getMetaDescription());
|
86 |
+
} else {
|
87 |
+
$head->setDescription(Mage::getStoreConfig('offinews/news/metadescription'));
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
public function getNewsPost() {
|
93 |
+
return Mage::registry('newspost');
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getComments() {
|
97 |
+
$newspost = $this->getNewsPost();
|
98 |
+
|
99 |
+
$collection = Mage::getModel('offinews/comment')->getCollection()
|
100 |
+
->addNewsFilter($newspost->getNewsId())
|
101 |
+
->addApproveFilter(Officience_News_Helper_Data::APPROVED_STATUS)
|
102 |
+
->setOrder('created_time ', 'asc');
|
103 |
+
$this->_pagesCount = ceil($collection->getSize() / $this->_itemsOnPage);
|
104 |
+
for ($i = 1; $i <= $this->_pagesCount; $i++) {
|
105 |
+
$this->_pages[] = $i;
|
106 |
+
}
|
107 |
+
$this->setLastPageNum($this->_pagesCount);
|
108 |
+
|
109 |
+
$collection->setPageSize($this->_itemsOnPage);
|
110 |
+
$collection->setCurPage($this->_currentPage);
|
111 |
+
|
112 |
+
return $collection;
|
113 |
+
}
|
114 |
+
|
115 |
+
public function getRequireLogin() {
|
116 |
+
return Mage::getStoreConfig('offinews/comments/need_login');
|
117 |
+
}
|
118 |
+
|
119 |
+
public function getPrintLogoUrl() {
|
120 |
+
// load html logo
|
121 |
+
$logo = Mage::getStoreConfig('sales/identity/logo_html');
|
122 |
+
if (!empty($logo)) {
|
123 |
+
$logo = 'sales/store/logo_html/' . $logo;
|
124 |
+
}
|
125 |
+
|
126 |
+
// load default logo
|
127 |
+
if (empty($logo)) {
|
128 |
+
$logo = Mage::getStoreConfig('sales/identity/logo');
|
129 |
+
if (!empty($logo)) {
|
130 |
+
// prevent tiff format displaying in html
|
131 |
+
if (strtolower(substr($logo, -5)) === '.tiff' || strtolower(substr($logo, -4)) === '.tif') {
|
132 |
+
$logo = '';
|
133 |
+
} else {
|
134 |
+
$logo = 'sales/store/logo/' . $logo;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
// buld url
|
140 |
+
if (!empty($logo)) {
|
141 |
+
$logo = Mage::getStoreConfig('web/unsecure/base_media_url') . $logo;
|
142 |
+
} else {
|
143 |
+
$logo = '';
|
144 |
+
}
|
145 |
+
|
146 |
+
return $logo;
|
147 |
+
}
|
148 |
+
|
149 |
+
public function getPrintLogoText() {
|
150 |
+
return Mage::getStoreConfig('sales/identity/address');
|
151 |
+
}
|
152 |
+
|
153 |
+
public function getLang() {
|
154 |
+
if (!$this->hasData('lang')) {
|
155 |
+
$this->setData('lang', substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2));
|
156 |
+
}
|
157 |
+
return $this->getData('lang');
|
158 |
+
}
|
159 |
+
|
160 |
+
public function getAbsoluteFooter() {
|
161 |
+
return Mage::getStoreConfig('design/footer/absolute_footer');
|
162 |
+
}
|
163 |
+
|
164 |
+
public function getBodyClass() {
|
165 |
+
return $this->_getData('body_class');
|
166 |
+
}
|
167 |
+
|
168 |
+
public function contentFilter($content) {
|
169 |
+
$helper = Mage::helper('cms');
|
170 |
+
$processor = $helper->getPageTemplateProcessor();
|
171 |
+
$html = $processor->filter($content);
|
172 |
+
return $html;
|
173 |
+
}
|
174 |
+
|
175 |
+
protected function _toHtml() {
|
176 |
+
$html = parent::_toHtml();
|
177 |
+
return $html . '<div align="right" class="copyright">© Developed by <a href="http://officience.com/">Officience</a></div>';
|
178 |
+
}
|
179 |
+
|
180 |
+
}
|
app/code/community/Officience/News/Block/Rss.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Rss extends Mage_Rss_Block_Abstract {
|
4 |
+
|
5 |
+
protected function _toHtml() {
|
6 |
+
$rssObj = Mage::getModel('rss/rss');
|
7 |
+
|
8 |
+
$data = array('title' => 'News',
|
9 |
+
'description' => 'News',
|
10 |
+
'link' => $this->getUrl('offinews/rss'),
|
11 |
+
'charset' => 'UTF-8',
|
12 |
+
'language' => Mage::getStoreConfig('general/locale/code')
|
13 |
+
);
|
14 |
+
|
15 |
+
$rssObj->_addHeader($data);
|
16 |
+
|
17 |
+
$collection = $this->getNewsPost();
|
18 |
+
if ($collection->getSize() > 0) {
|
19 |
+
foreach ($collection as $item) {
|
20 |
+
$data = array(
|
21 |
+
'title' => $item->getTitle(),
|
22 |
+
'link' => $item->getUrl(),
|
23 |
+
'description' => $item->getDescription(),
|
24 |
+
);
|
25 |
+
|
26 |
+
$rssObj->_addEntry($data);
|
27 |
+
}
|
28 |
+
} else {
|
29 |
+
$data = array('title' => Mage::helper('offinews')->__('Cannot retrieve the news'),
|
30 |
+
'description' => Mage::helper('offinews')->__('Cannot retrieve the news'),
|
31 |
+
'link' => Mage::getUrl(),
|
32 |
+
'charset' => 'UTF-8',
|
33 |
+
);
|
34 |
+
$rssObj->_addHeader($data);
|
35 |
+
}
|
36 |
+
|
37 |
+
return $rssObj->createRssXml();
|
38 |
+
}
|
39 |
+
|
40 |
+
public function getNewsPost() {
|
41 |
+
$this->_showFlag = 1;
|
42 |
+
$collection = Mage::getModel('offinews/news')->getCollection()
|
43 |
+
;
|
44 |
+
$category = $this->getCategory();
|
45 |
+
$storeId = Mage::app()->getStore()->getId();
|
46 |
+
if ($category != null) {
|
47 |
+
|
48 |
+
if ($category) {
|
49 |
+
$tableName = Mage::getSingleton('core/resource')->getTableName('officience_news_category');
|
50 |
+
$collection->getSelect()->join(array("t2" => $tableName), 'main_table.news_id = t2.news_id', 't2.category_id');
|
51 |
+
$collection->getSelect()->where('t2.category_id =?', $category);
|
52 |
+
}
|
53 |
+
}
|
54 |
+
$collection
|
55 |
+
->addEnableFilter(1)
|
56 |
+
->addStoreFilter($storeId)
|
57 |
+
->addStoreEnableFilter(1);
|
58 |
+
return $collection;
|
59 |
+
}
|
60 |
+
|
61 |
+
private function getCategory() {
|
62 |
+
return Mage::registry('current_offi_news_cat_id');
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
app/code/community/Officience/News/Block/Tags.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Block_Tags extends Officience_News_Block_Abstract {
|
4 |
+
|
5 |
+
protected function _prepareLayout() {
|
6 |
+
if ($head = $this->getLayout()->getBlock('head')) {
|
7 |
+
// show breadcrumbs
|
8 |
+
|
9 |
+
$moduleName = $this->getRequest()->getModuleName();
|
10 |
+
$showBreadcrumbs = (int) Mage::getStoreConfig('offinews/news/showbreadcrumbs');
|
11 |
+
if ($showBreadcrumbs && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs'))) {
|
12 |
+
$breadcrumbs->addCrumb('home', array(
|
13 |
+
'label' => Mage::helper('offinews')->__('Home'),
|
14 |
+
'title' => Mage::helper('offinews')->__('Go to Home Page'),
|
15 |
+
'link' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)));
|
16 |
+
$breadcrumbs->addCrumb('offinews', array(
|
17 |
+
'label' => Mage::helper('offinews')->__(Mage::getStoreConfig('offinews/news/title')),
|
18 |
+
'title' => Mage::helper('offinews')->__('Return to %s', Mage::helper('offinews')->__('News')),
|
19 |
+
'link' => Mage::getUrl(Mage::helper('offinews')->getRoute())
|
20 |
+
));
|
21 |
+
|
22 |
+
$breadcrumbs->addCrumb('tag', array(
|
23 |
+
'label' => Mage::helper('offinews')->__("Tag"),
|
24 |
+
'title' => Mage::helper('offinews')->__('Tag'),
|
25 |
+
));
|
26 |
+
|
27 |
+
$breadcrumbs->addCrumb('tagitem', array(
|
28 |
+
'label' => Mage::helper('offinews')->__("Tag item"),
|
29 |
+
'title' => Mage::helper('offinews')->__('Tag item'),
|
30 |
+
));
|
31 |
+
}
|
32 |
+
|
33 |
+
if ($moduleName == 'offinews') {
|
34 |
+
// set default meta data
|
35 |
+
$head->setTitle(Mage::getStoreConfig('offinews/news/metatitle'));
|
36 |
+
$head->setKeywords(Mage::getStoreConfig('offinews/news/metakeywords'));
|
37 |
+
$head->setDescription(Mage::getStoreConfig('offinews/news/metadescription'));
|
38 |
+
// set category meta data if defined
|
39 |
+
$currentCategory = $this->getCurrentCategory();
|
40 |
+
if ($currentCategory != null) {
|
41 |
+
if ($currentCategory->getTitle() != '') {
|
42 |
+
$head->setTitle($currentCategory->getTitle());
|
43 |
+
}
|
44 |
+
if ($currentCategory->getMetaKeywords() != '') {
|
45 |
+
$head->setKeywords($currentCategory->getMetaKeywords());
|
46 |
+
}
|
47 |
+
if ($currentCategory->getMetaDescription() != '') {
|
48 |
+
$head->setDescription($currentCategory->getMetaDescription());
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getCurrentCategory() {
|
56 |
+
return false;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getNewsPost() {
|
60 |
+
$tag = $this->getRequest()->getParam('tag');
|
61 |
+
$tag = trim($tag);
|
62 |
+
$tag = str_replace('-', ' ', $tag);
|
63 |
+
$collection = Mage::getModel('offinews/news')->getCollection()
|
64 |
+
;
|
65 |
+
$storeId = Mage::app()->getStore()->getId();
|
66 |
+
$collection
|
67 |
+
->addEnableFilter(1)
|
68 |
+
->addStoreFilter($storeId)
|
69 |
+
->addStoreEnableFilter(1);
|
70 |
+
$collection->getSelect()->where("main_table.tags LIKE '%" . $tag . "%'");
|
71 |
+
return $collection;
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
app/code/community/Officience/News/Controller/Router.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract {
|
4 |
+
|
5 |
+
public function initControllerRouters($observer) {
|
6 |
+
$front = $observer->getEvent()->getFront();
|
7 |
+
$news = new Officience_News_Controller_Router();
|
8 |
+
$front->addRouter('offinews', $news);
|
9 |
+
}
|
10 |
+
|
11 |
+
public function match(Zend_Controller_Request_Http $request) {
|
12 |
+
if (!Mage::app()->isInstalled()) {
|
13 |
+
Mage::app()->getFrontController()->getResponse()
|
14 |
+
->setRedirect(Mage::getUrl('install'))
|
15 |
+
->sendResponse();
|
16 |
+
exit;
|
17 |
+
}
|
18 |
+
$route = Mage::helper('offinews')->getRoute();
|
19 |
+
$identifier = $request->getPathInfo();
|
20 |
+
|
21 |
+
if (substr(str_replace("/", "", $identifier), 0, strlen($route)) != $route) {
|
22 |
+
return false;
|
23 |
+
}
|
24 |
+
|
25 |
+
$identifier = substr_replace($request->getPathInfo(), '', 0, strlen("/" . $route . "/"));
|
26 |
+
$identifier = str_replace(Mage::helper('offinews')->getNewsitemUrlSuffix(), '', $identifier);
|
27 |
+
|
28 |
+
$urlOption = Mage::helper('offinews')->getUrloption();
|
29 |
+
|
30 |
+
if (substr($identifier, -1) == '/') {
|
31 |
+
$identifier = substr_replace($identifier, '', -1);
|
32 |
+
}
|
33 |
+
if ($identifier == '') {
|
34 |
+
$request->setModuleName('offinews')
|
35 |
+
->setControllerName('index')
|
36 |
+
->setActionName('index');
|
37 |
+
return true;
|
38 |
+
}
|
39 |
+
if ($urlOption == 2) {
|
40 |
+
$printEnable = 0;
|
41 |
+
if (substr($identifier, 0, strlen('print/')) === 'print/') {
|
42 |
+
$printEnable = 1;
|
43 |
+
|
44 |
+
$identifier = substr_replace($identifier, '', 0, strlen('print/'));
|
45 |
+
}
|
46 |
+
$arrIndentifier = explode('/', $identifier);
|
47 |
+
if (substr($identifier, 0, strlen('rss/')) === 'rss/') {
|
48 |
+
$identifier = substr_replace($identifier, '', 0, strlen('rss/'));
|
49 |
+
if ($identifier == '') {
|
50 |
+
$request->setModuleName('offinews')
|
51 |
+
->setControllerName('rss')
|
52 |
+
->setActionName('index');
|
53 |
+
return true;
|
54 |
+
}
|
55 |
+
$arrIndentifier = explode('/', $identifier);
|
56 |
+
$identifierArticle = end($arrIndentifier);
|
57 |
+
$getModel = Mage::helper('offinews')->getListIdentifier($arrIndentifier);
|
58 |
+
$countElement = count($arrIndentifier) - count($getModel);
|
59 |
+
if ($countElement == 0) {
|
60 |
+
|
61 |
+
|
62 |
+
if (Mage::helper('offinews')->checkURL($arrIndentifier, $getModel)) {
|
63 |
+
$request->setModuleName('offinews')
|
64 |
+
->setControllerName('rss')
|
65 |
+
->setActionName('index')
|
66 |
+
->setParam('category', Mage::registry('current_offi_news_cat_identifier'));
|
67 |
+
|
68 |
+
if (strpos($request->getRequestUri(), '?page=')) {
|
69 |
+
$pageNumber = intval(strstr($identifier, '?page='));
|
70 |
+
$request->setParam('page', $pageNumber);
|
71 |
+
}
|
72 |
+
return true;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
return false;
|
76 |
+
} elseif (substr($identifier, 0, strlen('tag/')) === 'tag/') {
|
77 |
+
$identifier = str_replace('tag/', '', $identifier);
|
78 |
+
$param = trim(str_replace(Mage::helper('offinews')->getNewsitemUrlSuffix(), '', $identifier));
|
79 |
+
$request->setModuleName('offinews')
|
80 |
+
->setControllerName('index')
|
81 |
+
->setActionName('tag')
|
82 |
+
->setParam('tag', $param);
|
83 |
+
return true;
|
84 |
+
} else {
|
85 |
+
$identifierArticle = end($arrIndentifier);
|
86 |
+
$getModel = Mage::helper('offinews')->getListIdentifier($arrIndentifier);
|
87 |
+
$countElement = count($arrIndentifier) - count($getModel);
|
88 |
+
//if($printEnable)
|
89 |
+
if ($countElement > 1) {
|
90 |
+
return false;
|
91 |
+
} elseif ($countElement == 1) {
|
92 |
+
$urlPost = '/' . $arrIndentifier[count($arrIndentifier) - 1] . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
93 |
+
if ($printEnable) {
|
94 |
+
$url = strstr($request->getPathInfo(), $urlPost, true) . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
95 |
+
$url = str_replace('print/', '', $url);
|
96 |
+
} else {
|
97 |
+
$url = strstr($request->getPathInfo(), $urlPost, true) . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
98 |
+
}
|
99 |
+
if (!$getModel) {
|
100 |
+
$request->setModuleName('offinews')
|
101 |
+
->setControllerName('newspost')
|
102 |
+
->setActionName('view')
|
103 |
+
->setParam('key', $identifierArticle);
|
104 |
+
if ($printEnable) {
|
105 |
+
$request->setParam('mode', 'print');
|
106 |
+
}
|
107 |
+
return true;
|
108 |
+
} else {
|
109 |
+
unset($arrIndentifier[count($arrIndentifier) - 1]);
|
110 |
+
if (Mage::helper('offinews')->checkURL($arrIndentifier, $getModel)) {
|
111 |
+
|
112 |
+
$request->setModuleName('offinews')
|
113 |
+
->setControllerName('newspost')
|
114 |
+
->setActionName('view')
|
115 |
+
->setParam('key', $identifierArticle)
|
116 |
+
->setParam('category', Mage::registry('current_offi_news_cat_identifier'));
|
117 |
+
if ($printEnable) {
|
118 |
+
$request->setParam('mode', 'print');
|
119 |
+
}
|
120 |
+
return true;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
return false;
|
124 |
+
} else if ($countElement == 0) {
|
125 |
+
if (Mage::helper('offinews')->checkURL($arrIndentifier, $getModel)) {
|
126 |
+
$request->setModuleName('offinews')
|
127 |
+
->setControllerName('index')
|
128 |
+
->setActionName('index')
|
129 |
+
->setParam('category', Mage::registry('current_offi_news_cat_identifier'));
|
130 |
+
|
131 |
+
if (strpos($request->getRequestUri(), '?page=')) {
|
132 |
+
$pageNumber = intval(str_replace('?page=', '', strstr($request->getRequestUri(), '?page=')));
|
133 |
+
$request->setParam('page', $pageNumber);
|
134 |
+
}
|
135 |
+
return true;
|
136 |
+
}
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
} else {
|
142 |
+
|
143 |
+
if (substr($identifier, 0, 9) === 'category/') {
|
144 |
+
$identifier = str_replace('category/', '', $identifier);
|
145 |
+
$pageNumber = 1;
|
146 |
+
if (strpos($request->getRequestUri(), '?page=')) {
|
147 |
+
$pageNumber = intval(str_replace('?page=', '', strstr($request->getRequestUri(), '?page=')));
|
148 |
+
}
|
149 |
+
$request->setModuleName('offinews')
|
150 |
+
->setControllerName('index')
|
151 |
+
->setActionName('index')
|
152 |
+
->setParam('category', $identifier)
|
153 |
+
->setParam('page', $pageNumber);
|
154 |
+
return true;
|
155 |
+
} elseif (substr($identifier, 0, 4) === 'rss/') {
|
156 |
+
$identifier = str_replace('rss/', '', $identifier);
|
157 |
+
if (substr($identifier, 0, 9) === 'category/') {
|
158 |
+
$identifier = str_replace('category/', '', $identifier);
|
159 |
+
$pageNumber = 1;
|
160 |
+
if (strpos($request->getRequestUri(), '?page=')) {
|
161 |
+
$pageNumber = intval(str_replace('?page=', '', strstr($request->getRequestUri(), '?page=')));
|
162 |
+
}
|
163 |
+
|
164 |
+
Mage::register('current_offi_news_cat_identifier', $identifier);
|
165 |
+
$request->setModuleName('offinews')
|
166 |
+
->setControllerName('rss')
|
167 |
+
->setActionName('index')
|
168 |
+
->setParam('category', $identifier)
|
169 |
+
->setParam('page', $pageNumber);
|
170 |
+
return true;
|
171 |
+
} else {
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
} elseif (substr($identifier, 0, 4) === 'tag/') {
|
175 |
+
$identifier = str_replace('tag/', '', $identifier);
|
176 |
+
$param = trim(str_replace(Mage::helper('offinews')->getNewsitemUrlSuffix(), '', $identifier));
|
177 |
+
$request->setModuleName('offinews')
|
178 |
+
->setControllerName('index')
|
179 |
+
->setActionName('tag')
|
180 |
+
->setParam('tag', $param);
|
181 |
+
return true;
|
182 |
+
} else {
|
183 |
+
if (strpos($request->getRequestUri(), '?mode=print')) {
|
184 |
+
$identifier = str_replace('?mode=print', '', $identifier);
|
185 |
+
$request->setModuleName('offinews')
|
186 |
+
->setControllerName('newspost')
|
187 |
+
->setActionName('print')
|
188 |
+
->setParam('key', $identifier);
|
189 |
+
return true;
|
190 |
+
} else {
|
191 |
+
$request->setModuleName('offinews')
|
192 |
+
->setControllerName('newspost')
|
193 |
+
->setActionName('view')
|
194 |
+
->setParam('key', $identifier);
|
195 |
+
return true;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
return false;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
}
|
app/code/community/Officience/News/Helper/Cat.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Helper_Cat extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
}
|
app/code/community/Officience/News/Helper/Data.php
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
const UNAPPROVED_STATUS = 0;
|
6 |
+
const APPROVED_STATUS = 1;
|
7 |
+
const XML_PATH_ENABLED = 'offinews/news/enabled';
|
8 |
+
const XML_PATH_TITLE = 'offinews/news/title';
|
9 |
+
const XML_PATH_MENU_LEFT = 'offinews/news/menuLeft';
|
10 |
+
const XML_PATH_MENU_RIGHT = 'offinews/news/menuRoght';
|
11 |
+
const XML_PATH_FOOTER_ENABLED = 'offinews/news/footerEnabled';
|
12 |
+
const XML_PATH_LAYOUT = 'offinews/news/layout';
|
13 |
+
|
14 |
+
public function isEnabled() {
|
15 |
+
return Mage::getStoreConfig(self::XML_PATH_ENABLED);
|
16 |
+
}
|
17 |
+
|
18 |
+
public function isTitle() {
|
19 |
+
return Mage::getStoreConfig(self::XML_PATH_TITLE);
|
20 |
+
}
|
21 |
+
|
22 |
+
public function isMenuLeft() {
|
23 |
+
return Mage::getStoreConfig(self::XML_PATH_MENU_LEFT);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function isMenuRight() {
|
27 |
+
return Mage::getStoreConfig(self::XML_PATH_MENU_RIGHT);
|
28 |
+
}
|
29 |
+
|
30 |
+
public function isFooterEnabled() {
|
31 |
+
return Mage::getStoreConfig(self::XML_PATH_FOOTER_ENABLED);
|
32 |
+
}
|
33 |
+
|
34 |
+
public function isLayout() {
|
35 |
+
return Mage::getStoreConfig(self::XML_PATH_LAYOUT);
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getUserName() {
|
39 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
40 |
+
return trim("{$customer->getFirstname()} {$customer->getLastname()}");
|
41 |
+
}
|
42 |
+
|
43 |
+
public function getUrloption() {
|
44 |
+
return Mage::getStoreConfig('offinews/urloption/urlnews');
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getRoute() {
|
48 |
+
$route = Mage::getStoreConfig('offinews/news/route');
|
49 |
+
if (!$route) {
|
50 |
+
$route = "news";
|
51 |
+
}
|
52 |
+
return $route;
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getUserEmail() {
|
56 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
57 |
+
return $customer->getEmail();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function getRssLink($categoryId) {
|
61 |
+
if ($categoryId) {
|
62 |
+
return Mage::getUrl('offinews/rss', array('category' => $categoryId));
|
63 |
+
} else {
|
64 |
+
return Mage::getUrl('offinews/rss');
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getFileUrl($newsitem) {
|
69 |
+
$file = Mage::getBaseDir('media') . 'offinews' . DS . $newsitem->getDocument();
|
70 |
+
$file = str_replace(Mage::getBaseDir('media'), Mage::getBaseUrl('media'), $file);
|
71 |
+
$file = str_replace('\\', '/', $file);
|
72 |
+
return $file;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function showAuthor() {
|
76 |
+
return Mage::getStoreConfig('offinews/news/showauthorofnews');
|
77 |
+
}
|
78 |
+
|
79 |
+
public function showCategory() {
|
80 |
+
return Mage::getStoreConfig('offinews/news/showcategoryofnews');
|
81 |
+
}
|
82 |
+
|
83 |
+
public function showDate() {
|
84 |
+
return Mage::getStoreConfig('offinews/news/showdateofnews');
|
85 |
+
}
|
86 |
+
|
87 |
+
public function showTime() {
|
88 |
+
return Mage::getStoreConfig('offinews/news/showtimeofnews');
|
89 |
+
}
|
90 |
+
|
91 |
+
public function enableLinkRoute() {
|
92 |
+
return Mage::getStoreConfig('offinews/news/enablelinkrout');
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getLinkRoute() {
|
96 |
+
return Mage::getStoreConfig('offinews/news/linkrout');
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getPrintEnable() {
|
100 |
+
return Mage::getStoreConfig('offinews/news/printable');
|
101 |
+
}
|
102 |
+
|
103 |
+
public function getRequireLogin() {
|
104 |
+
return Mage::getStoreConfig('offinews/comments/need_login');
|
105 |
+
}
|
106 |
+
|
107 |
+
public function getCaptchaEnable() {
|
108 |
+
return Mage::getStoreConfig('offinews/captcha/enabled');
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getTagsAccess() {
|
112 |
+
return Mage::getStoreConfig('offinews/news/tags');
|
113 |
+
}
|
114 |
+
|
115 |
+
public function getNewsitemUrlSuffix() {
|
116 |
+
return Mage::getStoreConfig('offinews/news/itemurlsuffix');
|
117 |
+
}
|
118 |
+
|
119 |
+
public function getparentcategorydisplaysetting()
|
120 |
+
{
|
121 |
+
return Mage::getStoreConfig('offinews/news/parentcategory');
|
122 |
+
}
|
123 |
+
|
124 |
+
public function formatDate($date) {
|
125 |
+
|
126 |
+
$date = Mage::helper('core')->formatDate($date, 'short', true);
|
127 |
+
if (!Mage::helper('offinews')->showTime()) {
|
128 |
+
$date = Mage::helper('core')->formatDate($date, 'short', true);
|
129 |
+
} else {
|
130 |
+
$date = Mage::helper('core')->formatDate($date, 'short', false);
|
131 |
+
}
|
132 |
+
return $date;
|
133 |
+
}
|
134 |
+
|
135 |
+
public function getRssEnable() {
|
136 |
+
return Mage::getStoreConfig('offinews/rss/enable');
|
137 |
+
}
|
138 |
+
|
139 |
+
public function vnFilter($str) {
|
140 |
+
$unicode = array(
|
141 |
+
'a' => 'á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ',
|
142 |
+
'd' => 'đ',
|
143 |
+
'e' => 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ',
|
144 |
+
'i' => 'í|ì|ỉ|ĩ|ị',
|
145 |
+
'o' => 'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ',
|
146 |
+
'u' => 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự',
|
147 |
+
'y' => 'ý|ỳ|ỷ|ỹ|ỵ',
|
148 |
+
'A' => 'Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ',
|
149 |
+
'D' => 'Đ',
|
150 |
+
'E' => 'É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ',
|
151 |
+
'I' => 'Í|Ì|Ỉ|Ĩ|Ị',
|
152 |
+
'O' => 'Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ',
|
153 |
+
'U' => 'Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự',
|
154 |
+
'Y' => 'Ý|Ỳ|Ỷ|Ỹ|Ỵ',
|
155 |
+
);
|
156 |
+
|
157 |
+
foreach ($unicode as $nonUnicode => $uni) {
|
158 |
+
|
159 |
+
$str = preg_replace("/($uni)/i", $nonUnicode, $str);
|
160 |
+
}
|
161 |
+
$urlKey = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($str));
|
162 |
+
$urlKey = strtolower($urlKey);
|
163 |
+
$urlKey = trim($urlKey, '-');
|
164 |
+
return $urlKey;
|
165 |
+
}
|
166 |
+
|
167 |
+
public function addAfterElement($id, $value = 1) {
|
168 |
+
$html = "";
|
169 |
+
$html.= '<td class="scope-label"><span class="nobr">[STORE VIEW]</span></td>';
|
170 |
+
$html.='<td class="value use-default">';
|
171 |
+
$html.= '<input type="checkbox"';
|
172 |
+
$html .= $value ? ' checked="checked" ' : '';
|
173 |
+
$html.=' value="1" id="' . $id . '_default" onclick="toggleValueElements(this, this.parentNode.parentNode)" name="default_value[' . $id . ']" />';
|
174 |
+
$html.='<label class="normal" for="' . $id . '_default">Use Default Value</label>';
|
175 |
+
$html.= '<td>';
|
176 |
+
return $html;
|
177 |
+
}
|
178 |
+
|
179 |
+
public function getDefaultValueData($data) {
|
180 |
+
$arr = array();
|
181 |
+
|
182 |
+
if (is_array($data))
|
183 |
+
$defaulValueList = explode(',', $data['default_value']);
|
184 |
+
elseif ($data)
|
185 |
+
$defaulValueList = explode(',', $data);
|
186 |
+
foreach ($defaulValueList as $value) {
|
187 |
+
$temp = explode('->', $value);
|
188 |
+
if (count($temp) == 2) {
|
189 |
+
$arr[$temp[0]] = $temp[1];
|
190 |
+
}
|
191 |
+
}
|
192 |
+
return $arr;
|
193 |
+
}
|
194 |
+
|
195 |
+
public function renderDefaultToText($data) {
|
196 |
+
foreach ($data['default_value'] as $key => $default_value) {
|
197 |
+
$arrListDefaultvalue[$key] = $default_value;
|
198 |
+
}
|
199 |
+
$arrTemp = array();
|
200 |
+
foreach ($arrListDefaultvalue as $key => $value) {
|
201 |
+
$arrTemp[] = $key . '->' . $value;
|
202 |
+
}
|
203 |
+
return implode(',', $arrTemp);
|
204 |
+
}
|
205 |
+
|
206 |
+
public function listDefaultCat() {
|
207 |
+
$str = 'title->1,identifier->1,category_status->1,display_setting->1,sort_order->1,description->1,meta_keywords->1,meta_description->1,default_value->1';
|
208 |
+
return $str;
|
209 |
+
}
|
210 |
+
|
211 |
+
public function listDefaultNews() {
|
212 |
+
$str = 'title->1,identifier->1,description->1,full_content->1,news_status->1,publicate_from_date->1,publicate_to_date->1,publicate_from_time->1,publicate_to_time->1,author->1,meta_keywords->1,meta_description->1,comments_enabled->1,tags->1,sort_order->1,default_value->1';
|
213 |
+
return $str;
|
214 |
+
}
|
215 |
+
|
216 |
+
public function getListIdentifier($listIndetifier) {
|
217 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
218 |
+
$table = Mage::getSingleton('core/resource')->getTableName('officience_category_store');
|
219 |
+
$select = $connection->select()
|
220 |
+
->from(array($table), array('category_id', 'identifier', 'path'))
|
221 |
+
->where('identifier in (?)', $listIndetifier);
|
222 |
+
$stmt = $connection->query($select);
|
223 |
+
$result = $stmt->fetchAll();
|
224 |
+
return $result;
|
225 |
+
}
|
226 |
+
|
227 |
+
public function checkURL($arrIndentifier, $model) {
|
228 |
+
$endIdentifier = end($arrIndentifier);
|
229 |
+
|
230 |
+
$path = "";
|
231 |
+
$curCatId = "";
|
232 |
+
$curCatIdentifier = "";
|
233 |
+
foreach ($model as $valueTemp) {
|
234 |
+
if ($valueTemp['identifier'] == $endIdentifier) {
|
235 |
+
$path = $valueTemp['path'];
|
236 |
+
$curCatId = $valueTemp['category_id'];
|
237 |
+
$curCatIdentifier = $valueTemp['identifier'];
|
238 |
+
}
|
239 |
+
}
|
240 |
+
$arrPath = explode('/', $path);
|
241 |
+
$arr = array();
|
242 |
+
foreach ($arrPath as $value) {
|
243 |
+
foreach ($model as $valueCate) {
|
244 |
+
if ($valueCate['category_id'] == $value) {
|
245 |
+
$arr[] = $valueCate['identifier'];
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
if (count(array_diff($arr, $arrIndentifier)) < 1 && count(array_diff($arrIndentifier, $arr)) < 1) {
|
250 |
+
// Mage::register('current_offi_news_cat_url', $curUrl);
|
251 |
+
if ($path)
|
252 |
+
Mage::register('current_offi_news_cat_path', $path);
|
253 |
+
if ($curCatId)
|
254 |
+
Mage::register('current_offi_news_cat_id', $curCatId);
|
255 |
+
if ($curCatIdentifier)
|
256 |
+
Mage::register('current_offi_news_cat_identifier', $curCatIdentifier);
|
257 |
+
return true;
|
258 |
+
}
|
259 |
+
return false;
|
260 |
+
}
|
261 |
+
|
262 |
+
}
|
app/code/community/Officience/News/Helper/Versions.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Officience_News_Helper_Versions extends Mage_Core_Helper_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
const EE_PLATFORM = 100;
|
8 |
+
const PE_PLATFORM = 10;
|
9 |
+
const CE_PLATFORM = 0;
|
10 |
+
|
11 |
+
const ENTERPRISE_DETECT_COMPANY = 'Enterprise';
|
12 |
+
const ENTERPRISE_DETECT_EXTENSION = 'Enterprise';
|
13 |
+
const ENTERPRISE_DESIGN_NAME = "enterprise";
|
14 |
+
const PROFESSIONAL_DESIGN_NAME = "pro";
|
15 |
+
|
16 |
+
protected static $_platform = -1;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Checks which edition is used
|
20 |
+
* @return int
|
21 |
+
*/
|
22 |
+
public static function getPlatform()
|
23 |
+
{
|
24 |
+
if (self::$_platform == -1) {
|
25 |
+
$pathToClaim = BP . DS . "app" . DS . "etc" . DS . "modules" . DS . self::ENTERPRISE_DETECT_COMPANY . "_" . self::ENTERPRISE_DETECT_EXTENSION . ".xml";
|
26 |
+
$pathToEEConfig = BP . DS . "app" . DS . "code" . DS . "core" . DS . self::ENTERPRISE_DETECT_COMPANY . DS . self::ENTERPRISE_DETECT_EXTENSION . DS . "etc" . DS . "config.xml";
|
27 |
+
$isCommunity = !file_exists($pathToClaim) || !file_exists($pathToEEConfig);
|
28 |
+
if ($isCommunity) {
|
29 |
+
self::$_platform = self::CE_PLATFORM;
|
30 |
+
} else {
|
31 |
+
$_xml = @simplexml_load_file($pathToEEConfig,'SimpleXMLElement', LIBXML_NOCDATA);
|
32 |
+
if(!$_xml===FALSE) {
|
33 |
+
$package = (string)$_xml->default->design->package->name;
|
34 |
+
$theme = (string)$_xml->install->design->theme->default;
|
35 |
+
$skin = (string)$_xml->stores->admin->design->theme->skin;
|
36 |
+
$isProffessional = ($package == self::PROFESSIONAL_DESIGN_NAME) && ($theme == self::PROFESSIONAL_DESIGN_NAME) && ($skin == self::PROFESSIONAL_DESIGN_NAME);
|
37 |
+
if ($isProffessional) {
|
38 |
+
self::$_platform = self::PE_PLATFORM;
|
39 |
+
return self::$_platform;
|
40 |
+
}
|
41 |
+
self::$_platform = self::EE_PLATFORM;
|
42 |
+
return self::$_platform;
|
43 |
+
}
|
44 |
+
self::$_platform = self::EE_PLATFORM;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
return self::$_platform;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Convert platform from string to int and backwards
|
52 |
+
* @static
|
53 |
+
* @param $platformCode
|
54 |
+
* @return int|string
|
55 |
+
*/
|
56 |
+
public static function convertPlatform($platformCode)
|
57 |
+
{
|
58 |
+
if (is_numeric($platformCode)) {
|
59 |
+
// Convert predefined to letters code
|
60 |
+
$platform = ($platformCode == self::EE_PLATFORM ? 'ee' : ($platformCode == self::PE_PLATFORM ? 'pe'
|
61 |
+
: 'ce'));
|
62 |
+
} elseif (is_string($platformCode)) {
|
63 |
+
$platformCode = strtolower($platformCode);
|
64 |
+
$platform = ($platformCode == 'ee' ? self::EE_PLATFORM : ($platformCode == 'pe' ? self::PE_PLATFORM
|
65 |
+
: self::CE_PLATFORM));
|
66 |
+
}else{$platform = self::CE_PLATFORM;}
|
67 |
+
return $platform;
|
68 |
+
}
|
69 |
+
|
70 |
+
public static function convertVersion($v)
|
71 |
+
{
|
72 |
+
$digits = @explode(".", $v);
|
73 |
+
$version = 0;
|
74 |
+
if (is_array($digits)) {
|
75 |
+
foreach ($digits as $k => $v) {
|
76 |
+
$version += ($v * pow(10, max(0, (3 - $k))));
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
return $version;
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Officience/News/Model/Category.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Category extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
protected function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/category');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getDefaultValue($id, $store) {
|
11 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
12 |
+
$maintable = Mage::getSingleton('core/resource')->getTableName('officience_category_store');
|
13 |
+
;
|
14 |
+
|
15 |
+
$select = $db->select()
|
16 |
+
->from($maintable, array('default_value'))
|
17 |
+
->where('category_id = ?', $id)
|
18 |
+
->where('store_id =?', $store);
|
19 |
+
$stmt = $db->query($select);
|
20 |
+
$result = $stmt->fetchAll();
|
21 |
+
return $result[0]['default_value'];
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getUrl() {
|
25 |
+
$urlOption = Mage::helper('offinews')->getUrloption();
|
26 |
+
$url = "";
|
27 |
+
if ($urlOption == 2) {
|
28 |
+
$arr = array();
|
29 |
+
if ($this->getPath()) {
|
30 |
+
$pathArr = explode('/', $this->getPath());
|
31 |
+
if (count($pathArr) <= 1) {
|
32 |
+
$arr[] = $this->getIdentifier();
|
33 |
+
} else {
|
34 |
+
$table = Mage::getSingleton('core/resource')->getTableName('officience_category_store');
|
35 |
+
|
36 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
37 |
+
$select = $db->select()
|
38 |
+
->from($table, array('category_id', 'identifier'))
|
39 |
+
->where('category_id in (?)', $pathArr);
|
40 |
+
|
41 |
+
$value = $db->query($select)->fetchAll();
|
42 |
+
$arrTemp = array();
|
43 |
+
foreach ($value as $item) {
|
44 |
+
$arrTemp[$item['category_id']] = $item['identifier'];
|
45 |
+
}
|
46 |
+
$arUrl = array();
|
47 |
+
foreach ($pathArr as $item2) {
|
48 |
+
$arUrl[] = $arrTemp[$item2];
|
49 |
+
}
|
50 |
+
$urlarr = implode($arUrl, '/');
|
51 |
+
$arr[] = $urlarr;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
$url = Mage::getUrl(Mage::helper('offinews')->getRoute()) . implode($arr, '/') . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
55 |
+
} else {
|
56 |
+
$url = Mage::getUrl(Mage::helper('offinews')->getRoute()) . 'category/' . $this->getIdentifier() . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
57 |
+
}
|
58 |
+
return $url;
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
app/code/community/Officience/News/Model/CategoryStore.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_CategoryStore extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
protected function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/categoryStore');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function deleteCategoryStore($categoryId, $storeId) {
|
11 |
+
|
12 |
+
$connection = Mage::getSingleton('core/resource')
|
13 |
+
->getConnection('core_write');
|
14 |
+
$table = Mage::getSingleton('core/resource')->getTableName('officience_category_store');
|
15 |
+
$condition = array(
|
16 |
+
$connection->quoteInto('category_id=?', $categoryId),
|
17 |
+
$connection->quoteInto('store_id=?', $storeId),
|
18 |
+
);
|
19 |
+
|
20 |
+
$connection->delete($table, $condition);
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
?>
|
app/code/community/Officience/News/Model/Check.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Officience_News_Model_Check extends Mage_Core_Model_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
public function checkExtensions()
|
8 |
+
{
|
9 |
+
$modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
10 |
+
sort($modules);
|
11 |
+
|
12 |
+
$magentoPlatform = Officience_News_Helper_Versions::getPlatform();
|
13 |
+
foreach ($modules as $extensionName) {
|
14 |
+
if (strstr($extensionName, 'Officience_') === false) {
|
15 |
+
continue;
|
16 |
+
}
|
17 |
+
if ($extensionName == 'Officience_Core' || $extensionName == 'Officience_All') {
|
18 |
+
continue;
|
19 |
+
}
|
20 |
+
if ($platformNode = $this->getExtensionPlatform($extensionName)) {
|
21 |
+
$extensionPlatform = Officience_News_Helper_Versions::convertPlatform($platformNode);
|
22 |
+
if ($extensionPlatform < $magentoPlatform) {
|
23 |
+
$this->disableExtensionOutput($extensionName);
|
24 |
+
Mage::getSingleton('adminhtml/session')
|
25 |
+
->addError(Mage::helper('offinews')->__('Platform version is not correct for News module!'));
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getExtensionPlatform($extensionName)
|
34 |
+
{
|
35 |
+
try {
|
36 |
+
if ($platform = Mage::getConfig()->getNode("modules/$extensionName/platform")) {
|
37 |
+
$platform = strtolower($platform);
|
38 |
+
return $platform;
|
39 |
+
} else {
|
40 |
+
throw new Exception();
|
41 |
+
}
|
42 |
+
} catch (Exception $e) {
|
43 |
+
return false;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
public function disableExtensionOutput($extensionName)
|
49 |
+
{
|
50 |
+
$coll = Mage::getModel('core/config_data')->getCollection();
|
51 |
+
$coll->getSelect()->where("path='advanced/modules_disable_output/$extensionName'");
|
52 |
+
$i = 0;
|
53 |
+
foreach ($coll as $cd) {
|
54 |
+
$i++;
|
55 |
+
$cd->setValue(1)->save();
|
56 |
+
}
|
57 |
+
if ($i == 0) {
|
58 |
+
Mage::getModel('core/config_data')
|
59 |
+
->setPath("advanced/modules_disable_output/$extensionName")
|
60 |
+
->setValue(1)
|
61 |
+
->save();
|
62 |
+
}
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function checkConfiguration()
|
67 |
+
{
|
68 |
+
$coll = Mage::getModel('core/config_data')->getCollection();
|
69 |
+
$coll->getSelect()->where("path='offinews/news/showrightblock'");
|
70 |
+
foreach ($coll as $cd) {
|
71 |
+
if ($cd->getValue() == 1) {
|
72 |
+
$loll = Mage::getModel('core/config_data')->getCollection();
|
73 |
+
$loll->getSelect()->where("path='offinews/news/showleftblock'");
|
74 |
+
foreach ($loll as $ld) {
|
75 |
+
if ($ld->getValue() == 1) {
|
76 |
+
$ld->setValue(0)->save();
|
77 |
+
Mage::getSingleton('adminhtml/session')
|
78 |
+
->addSuccess(Mage::helper('offinews')->__('News category tree can be shown only in one column'));
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
return $this;
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
}
|
app/code/community/Officience/News/Model/Comment.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Comment extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct(){
|
6 |
+
$this->_init('offinews/comment');
|
7 |
+
}
|
8 |
+
|
9 |
+
public function load($id, $field=null){
|
10 |
+
return parent::load($id, $field);
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Officience/News/Model/Config/Source/Dateformat.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Config_Source_Dateformat {
|
4 |
+
|
5 |
+
public function toOptionArray() {
|
6 |
+
return array(
|
7 |
+
array('value' => 1, 'label' => (date('d/M/Y') . '<div> </div>')),
|
8 |
+
array('value' => 2, 'label' => (date('Y/m/d') . '<div> </div>')),
|
9 |
+
array('value' => 3, 'label' => (date('m/d/Y') . '<div> </div>')),
|
10 |
+
array('value' => 4, 'label' => (date('d/m/Y') . '<div> </div>')),
|
11 |
+
);
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
?>
|
app/code/community/Officience/News/Model/Config/Source/Parentcat.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Config_Source_Parentcat {
|
4 |
+
|
5 |
+
public function toOptionArray() {
|
6 |
+
return array(
|
7 |
+
array('value' => 1, 'label' => Mage::helper('offinews')->__('Show list products')),
|
8 |
+
array('value' => 2, 'label' => Mage::helper('offinews')->__('Show list categories')),
|
9 |
+
);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
?>
|
app/code/community/Officience/News/Model/Config/Source/Timeformat.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Config_Source_Timeformat {
|
4 |
+
|
5 |
+
public function toOptionArray() {
|
6 |
+
return array(
|
7 |
+
array('value' => 1, 'label' => '8:56 pm' . '<div> </div>'),
|
8 |
+
array('value' => 2, 'label' => '8:56 PM' . '<div> </div>'),
|
9 |
+
array('value' => 3, 'label' => '20:56' . '<div> </div>'),
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
?>
|
app/code/community/Officience/News/Model/Config/Source/Urloption.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Config_Source_Urloption {
|
4 |
+
|
5 |
+
public function toOptionArray() {
|
6 |
+
return array(
|
7 |
+
array('value' => 1, 'label' => 'Default'),
|
8 |
+
array('value' => 2, 'label' => 'Category and name'),
|
9 |
+
);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
?>
|
app/code/community/Officience/News/Model/Mysql4/Category.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_Category extends Mage_Core_Model_Mysql4_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
$this->_init('offinews/category', 'category_id');
|
7 |
+
}
|
8 |
+
|
9 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object) {
|
10 |
+
$allStores = Mage::app()->getStores();
|
11 |
+
$parentId = $object->getParentId();
|
12 |
+
|
13 |
+
if ($parentId != 0) {
|
14 |
+
$modelParentData = $this->_getPathParent($parentId);
|
15 |
+
$pathInsert = $modelParentData['path'] . '/' . $object->getId();
|
16 |
+
} else {
|
17 |
+
$pathInsert = $object->getId();
|
18 |
+
}
|
19 |
+
$this->_updatePathCatId($object->getId(), $pathInsert);
|
20 |
+
|
21 |
+
|
22 |
+
foreach ($allStores as $value) {
|
23 |
+
$select = $this->_getReadAdapter()->select()
|
24 |
+
->from($this->getTable('categoryStore'))
|
25 |
+
->where('category_id = ?', $object->getCategoryId())
|
26 |
+
->where('store_id = ?', $value->getStoreId());
|
27 |
+
$where[] = $this->_getWriteAdapter()->quoteInto('category_id = ?', $object->getId());
|
28 |
+
$where[] = $this->_getWriteAdapter()->quoteInto('store_id = ?', $value->getStoreId());
|
29 |
+
if ($data = $this->_getReadAdapter()->fetchAll($select)) {
|
30 |
+
$arrValue = array('category_id' => $object->getCategoryId(),
|
31 |
+
'store_id' => $value->getStoreId(),
|
32 |
+
'default_value' => $data[0]['default_value'],
|
33 |
+
);
|
34 |
+
$defaultValueArr = Mage::helper('offinews')->getDefaultValueData($data[0]);
|
35 |
+
foreach ($defaultValueArr as $key => $defaultData) {
|
36 |
+
if ($defaultData) {
|
37 |
+
$arrValue[$key] = $object->getData($key);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
$this->_getWriteAdapter()->update($this->getTable('categoryStore'), $arrValue, $where);
|
41 |
+
} else {
|
42 |
+
$arrData = array(
|
43 |
+
'category_id' => $object->getId(),
|
44 |
+
'store_id' => $value->getStoreId(),
|
45 |
+
'title' => $object->getTitle(),
|
46 |
+
'display_setting' => $object->getDisplaySetting(),
|
47 |
+
'path' => $object->getPath(),
|
48 |
+
'category_status' => $object->getCategoryStatus(),
|
49 |
+
'identifier' => $object->getIdentifier(),
|
50 |
+
'sort_order' => $object->getSortOrder(),
|
51 |
+
'description' => $object->getDescription(),
|
52 |
+
'meta_keywords' => $object->getMetaKeywords(),
|
53 |
+
'meta_description' => $object->getMetaDescription(),
|
54 |
+
'default_value' => Mage::helper('offinews')->listDefaultCat(),
|
55 |
+
);
|
56 |
+
$this->_getWriteAdapter()->insert($this->getTable('categoryStore'), $arrData);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
return parent::_afterSave($object);
|
62 |
+
}
|
63 |
+
|
64 |
+
private function _updatePathCatId($catId, $path) {
|
65 |
+
try {
|
66 |
+
|
67 |
+
$table = $this->getMainTable();
|
68 |
+
$where = $this->_getWriteAdapter()->quoteInto('category_id = ?', $catId);
|
69 |
+
$query = $this->_getWriteAdapter()->update($table, array('path' => $path), $where);
|
70 |
+
} catch (Exception $e) {
|
71 |
+
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
private function _getPathParent($parentId) {
|
76 |
+
try {
|
77 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
78 |
+
$table = $this->getMainTable();
|
79 |
+
$where = $this->_getReadAdapter()->quoteInto('category_id = ?', $parentId);
|
80 |
+
$query = $this->_getReadAdapter()->select()->from($table, array('path'))
|
81 |
+
->where($where);
|
82 |
+
$data = $db->query($query);
|
83 |
+
return $data->fetch();
|
84 |
+
} catch (Exception $e) {
|
85 |
+
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
public function getDefaultValue($id, $store) {
|
90 |
+
$maintable = Mage::getSingleton('core/resource')->getTableName('officience_category_store');
|
91 |
+
;
|
92 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
93 |
+
$where = $this->_getReadAdapter()->quoteInto('category_id = ? AND', $id) .
|
94 |
+
$this->_getReadAdapter()->quoteInto('store_id =?', $store);
|
95 |
+
$select = $this->_getReadAdapter()->select()
|
96 |
+
->from($maintable, array('default_value'))
|
97 |
+
->where($where);
|
98 |
+
$data = $db->query($select);
|
99 |
+
return $data->fetch();
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/Category/Collection.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_Category_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/category');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function addEnableFilter($status) {
|
11 |
+
$this->getSelect()
|
12 |
+
->where('main_table.category_status = ?', $status);
|
13 |
+
return $this;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function addStoreEnableFilter($status) {
|
17 |
+
$this->getSelect()
|
18 |
+
->where('category_store_table.category_status = ?', $status);
|
19 |
+
return $this;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function filterByIdentifier($identifier) {
|
23 |
+
$this->getSelect()
|
24 |
+
->where('category_store_table.identifier = ?', $identifier);
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function filterIdentifierIn($identifier) {
|
29 |
+
$this->getSelect()
|
30 |
+
->where('category_store_table.identifier in (?)', $identifier);
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
public function addStoreFilterPath($store) {
|
35 |
+
$this->addFieldToSelect(array('parent_id', 'level'));
|
36 |
+
$this->getSelect()->join(
|
37 |
+
array('category_store_table' => $this->getTable('categoryStore')), 'main_table.category_id = category_store_table.category_id and category_store_table.store_id=' . $store, array(
|
38 |
+
'category_store_table.identifier', 'category_store_table.path'
|
39 |
+
)
|
40 |
+
)
|
41 |
+
;
|
42 |
+
$this->getSelect()->distinct();
|
43 |
+
return $this;
|
44 |
+
}
|
45 |
+
|
46 |
+
public function addStoreFilter($store) {
|
47 |
+
$this->addFieldToSelect(array('thumbnail', 'parent_id', 'level', 'path'));
|
48 |
+
$this->getSelect()->join(
|
49 |
+
array('category_store_table' => $this->getTable('categoryStore')), 'main_table.category_id = category_store_table.category_id and category_store_table.store_id=' . $store, array('category_store_table.title',
|
50 |
+
'category_store_table.store_id',
|
51 |
+
'category_store_table.identifier',
|
52 |
+
'category_store_table.description',
|
53 |
+
'category_store_table.sort_order',
|
54 |
+
'category_store_table.meta_keywords',
|
55 |
+
'category_store_table.meta_description',
|
56 |
+
)
|
57 |
+
)
|
58 |
+
;
|
59 |
+
$this->getSelect()->distinct();
|
60 |
+
return $this;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/CategoryStore.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_CategoryStore extends Mage_Core_Model_Mysql4_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
$this->_init('offinews/categoryStore', array('category_id,store_id'));
|
7 |
+
}
|
8 |
+
|
9 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/CategoryStore/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_CategoryStore_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/categoryStore');
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/Comment.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_Comment extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('offinews/comment', 'comment_id');
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/Comment/Collection.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Officience_News_Model_Mysql4_Comment_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
5 |
+
{
|
6 |
+
public function _construct()
|
7 |
+
{
|
8 |
+
parent::_construct();
|
9 |
+
$this->_init('offinews/comment');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function addApproveFilter($status)
|
13 |
+
{
|
14 |
+
$this->getSelect()
|
15 |
+
->where('comment_status = ?', $status);
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function addNewsFilter($newsId)
|
20 |
+
{
|
21 |
+
$this->getSelect()
|
22 |
+
->where('news_id = ?', $newsId);
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/News.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_News extends Mage_Core_Model_Mysql4_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
$this->_init('offinews/news', 'news_id');
|
7 |
+
}
|
8 |
+
|
9 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object) {
|
10 |
+
$allStores = Mage::app()->getStores();
|
11 |
+
|
12 |
+
foreach ($allStores as $value) {
|
13 |
+
$select = $this->_getReadAdapter()->select()
|
14 |
+
->from($this->getTable('newsStore'))
|
15 |
+
->where('news_id = ?', $object->getId())
|
16 |
+
->where('store_id = ?', $value->getStoreId());
|
17 |
+
$where[] = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
|
18 |
+
$where[] = $this->_getWriteAdapter()->quoteInto('store_id = ?', $value->getStoreId());
|
19 |
+
if ($data = $this->_getReadAdapter()->fetchAll($select)) {
|
20 |
+
$arrValue = array('news_id' => $object->getId(),
|
21 |
+
'store_id' => $value->getStoreId(),
|
22 |
+
'default_value' => $data[0]['default_value'],
|
23 |
+
);
|
24 |
+
$defaultValueArr = Mage::helper('offinews')->getDefaultValueData($data[0]);
|
25 |
+
foreach ($defaultValueArr as $key => $defaultData) {
|
26 |
+
if ($defaultData) {
|
27 |
+
$arrValue[$key] = $object->getData($key);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
$this->_getWriteAdapter()->update($this->getTable('newsStore'), $arrValue, $where);
|
31 |
+
} else {
|
32 |
+
$arrData = array(
|
33 |
+
'news_id' => $object->getId(),
|
34 |
+
'store_id' => $value->getStoreId(),
|
35 |
+
'title' => $object->getTitle(),
|
36 |
+
'identifier' => $object->getIdentifier(),
|
37 |
+
'description' => $object->getDescription(),
|
38 |
+
'full_content' => $object->getFullContent(),
|
39 |
+
'news_status' => $object->getNewsStatus(),
|
40 |
+
'publicate_from_date' => $object->getPublicateFromDate(),
|
41 |
+
'publicate_to_date' => $object->getPublicateToDate(),
|
42 |
+
'publicate_from_time' => $object->getPublicateFromTime(),
|
43 |
+
'publicate_to_time' => $object->getPublicateToTime(),
|
44 |
+
'author' => $object->getAuthor(),
|
45 |
+
'meta_keywords' => $object->getMetaKeywords(),
|
46 |
+
'meta_description' => $object->getMetaDescription(),
|
47 |
+
'comments_enabled' => $object->getCommentsEnabled(),
|
48 |
+
'tags' => $object->getTags(),
|
49 |
+
'sort_order' => $object->getSortOrder(),
|
50 |
+
'default_value' => Mage::helper('offinews')->listDefaultNews(),
|
51 |
+
);
|
52 |
+
$this->_getWriteAdapter()->insert($this->getTable('newsStore'), $arrData);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
$condition = $this->_getWriteAdapter()->quoteInto('news_id = ?', $object->getId());
|
59 |
+
$this->_getWriteAdapter()->delete($this->getTable('newsCategory'), $condition);
|
60 |
+
foreach ((array) $object->getData('news_category') as $category) {
|
61 |
+
$data = array();
|
62 |
+
$data['news_id'] = $object->getId();
|
63 |
+
$data['category_id'] = $category;
|
64 |
+
$this->_getWriteAdapter()->insert($this->getTable('newsCategory'), $data);
|
65 |
+
}
|
66 |
+
return parent::_afterSave($object);
|
67 |
+
}
|
68 |
+
|
69 |
+
protected function _afterLoad(Mage_Core_Model_Abstract $object) {
|
70 |
+
|
71 |
+
$select = $this->_getReadAdapter()->select()
|
72 |
+
->from($this->getTable('newsCategory'))
|
73 |
+
->where('news_id = ?', $object->getId());
|
74 |
+
|
75 |
+
if ($data = $this->_getReadAdapter()->fetchAll($select)) {
|
76 |
+
$categories = array();
|
77 |
+
foreach ($data as $row) {
|
78 |
+
$categories[] = $row['category_id'];
|
79 |
+
}
|
80 |
+
$object->setData('news_category', $categories);
|
81 |
+
}
|
82 |
+
|
83 |
+
return parent::_afterLoad($object);
|
84 |
+
}
|
85 |
+
|
86 |
+
protected function _beforeDelete(Mage_Core_Model_Abstract $object) {
|
87 |
+
$adapter = $this->_getReadAdapter();
|
88 |
+
$adapter->delete($this->getTable('news/newsCategory'), 'news_id=' . $object->getId());
|
89 |
+
$adapter->delete($this->getTable('news/comment'), 'news_id=' . $object->getId());
|
90 |
+
}
|
91 |
+
|
92 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/News/Collection.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_News_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/news');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function addEnableFilter($status) {
|
11 |
+
$this->getSelect()
|
12 |
+
->where('main_table.news_status = ?', $status);
|
13 |
+
return $this;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function addFilterByIdentifier($identifier) {
|
17 |
+
$this->getSelect()
|
18 |
+
->where('news_store_table.identifier = ?', $identifier);
|
19 |
+
return $this;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function addCategoryFilter($categoryId) {
|
23 |
+
$this->getSelect()->join(
|
24 |
+
array('news_category_table' => $this->getTable('news_category')), 'main_table.news_id = news_category_table.news_id', array()
|
25 |
+
)->join(
|
26 |
+
array('category_table' => $this->getTable('category')), 'news_category_table.category_id = category_table.category_id', array()
|
27 |
+
)->join(
|
28 |
+
array('category_store_table' => $this->getTable('category_store')), 'category_table.category_id = category_store_table.category_id', array()
|
29 |
+
)
|
30 |
+
->where('category_table.identifier = "' . $categoryId . '"')
|
31 |
+
->where('category_store_table.store_id in (?)', array(0, Mage::app()->getStore()->getId()))
|
32 |
+
;
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function addStoreEnableFilter($status) {
|
37 |
+
$this->getSelect()
|
38 |
+
->where('news_store_table.news_status = ?', $status);
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function addStoreFilter($store) {
|
43 |
+
$this->addFieldToSelect(array('thumbnail', 'created_time'));
|
44 |
+
$this->getSelect()->join(
|
45 |
+
array('news_store_table' => $this->getTable('newsStore')), 'main_table.news_id = news_store_table.news_id and news_store_table.store_id=' . $store, array('news_store_table.title',
|
46 |
+
'news_store_table.identifier',
|
47 |
+
'news_store_table.description',
|
48 |
+
'news_store_table.full_content',
|
49 |
+
'news_store_table.news_status',
|
50 |
+
'news_store_table.publicate_from_date',
|
51 |
+
'news_store_table.publicate_to_date',
|
52 |
+
'news_store_table.publicate_from_time',
|
53 |
+
'news_store_table.publicate_to_time',
|
54 |
+
'news_store_table.author',
|
55 |
+
'news_store_table.meta_keywords',
|
56 |
+
'news_store_table.meta_description',
|
57 |
+
'news_store_table.comments_enabled',
|
58 |
+
'news_store_table.tags',
|
59 |
+
'news_store_table.sort_order',
|
60 |
+
)
|
61 |
+
)
|
62 |
+
// ->where('news_store_table.store_id in (?)', array(0, $store))
|
63 |
+
;
|
64 |
+
$this->getSelect()->distinct();
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/NewsStore.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_NewsStore extends Mage_Core_Model_Mysql4_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
$this->_init('offinews/newsStore', array('news_id,store_id'));
|
7 |
+
}
|
8 |
+
|
9 |
+
|
10 |
+
}
|
app/code/community/Officience/News/Model/Mysql4/NewsStore/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_Mysql4_NewsStore_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/newsStore');
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/community/Officience/News/Model/News.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_News extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
public function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/news');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function getUrl() {
|
11 |
+
$urlOption = Mage::helper('offinews')->getUrloption();
|
12 |
+
$url = "";
|
13 |
+
if ($urlOption == 2) {
|
14 |
+
$catUrl = Mage::app()->getRequest()->getPathInfo();
|
15 |
+
if (substr($catUrl, 0, 1) == '/') {
|
16 |
+
$catUrl = substr($catUrl, 1);
|
17 |
+
}
|
18 |
+
if (substr($catUrl, -1) == '/') {
|
19 |
+
$catUrl = substr($catUrl, 0, -1);
|
20 |
+
}
|
21 |
+
$urlSuffix = '/' . $this->getIdentifier() . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
22 |
+
$catUrl = str_replace(Mage::helper('offinews')->getNewsitemUrlSuffix(), '', $catUrl);
|
23 |
+
$url = Mage::getUrl() . $catUrl . $urlSuffix;
|
24 |
+
} else {
|
25 |
+
$url = Mage::getUrl(Mage::helper('offinews')->getRoute()) . $this->getIdentifier() . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
26 |
+
}
|
27 |
+
return $url;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getCommentsCount() {
|
31 |
+
$model = Mage::getModel('offinews/comment')->getCollection()
|
32 |
+
->addFieldToFilter('news_id', $this->getId())
|
33 |
+
->count();
|
34 |
+
return $model;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getUrlPrint() {
|
38 |
+
$urlOption = Mage::helper('offinews')->getUrloption();
|
39 |
+
$url = "";
|
40 |
+
if ($urlOption == 2) {
|
41 |
+
$catUrl = str_replace(Mage::helper('offinews')->getNewsitemUrlSuffix(), '', Mage::registry('current_offi_news_cat_url'));
|
42 |
+
$catUrl = str_replace(Mage::getUrl(Mage::helper('offinews')->getRoute()), '', $catUrl);
|
43 |
+
if ($catUrl) {
|
44 |
+
$catUrl = $catUrl . '/';
|
45 |
+
}
|
46 |
+
$url = Mage::getUrl(Mage::helper('offinews')->getRoute() . '/print') . $catUrl . $this->getIdentifier() . Mage::helper('offinews')->getNewsitemUrlSuffix();
|
47 |
+
} else {
|
48 |
+
$url = Mage::getUrl(Mage::helper('offinews')->getRoute()) . $this->getIdentifier() . Mage::helper('offinews')->getNewsitemUrlSuffix() . '?mode=print';
|
49 |
+
}
|
50 |
+
return $url;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Reset all model data
|
55 |
+
*
|
56 |
+
* @return Officience_News_Model_News
|
57 |
+
*/
|
58 |
+
public function reset() {
|
59 |
+
$this->setData(array());
|
60 |
+
$this->setOrigData();
|
61 |
+
$this->_attributes = null;
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getTimePublic() {
|
66 |
+
if ($this->getPublicateFromDate()) {
|
67 |
+
return Mage::helper('offinews')->formatDate($this->getCreatedTime());
|
68 |
+
} else {
|
69 |
+
return Mage::helper('offinews')->formatDate($this->getPublicateFromDate());
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
app/code/community/Officience/News/Model/NewsStore.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Model_NewsStore extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
protected function _construct() {
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('offinews/newsStore');
|
8 |
+
}
|
9 |
+
|
10 |
+
|
11 |
+
public function deleteNewsStore($NewsId, $storeId) {
|
12 |
+
|
13 |
+
$connection = Mage::getSingleton('core/resource')
|
14 |
+
->getConnection('core_write');
|
15 |
+
$table = Mage::getSingleton('core/resource')->getTableName('officience_news_store');
|
16 |
+
$condition = array(
|
17 |
+
$connection->quoteInto('news_id=?', $NewsId),
|
18 |
+
$connection->quoteInto('store_id=?', $storeId),
|
19 |
+
);
|
20 |
+
|
21 |
+
$connection->delete($table, $condition);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getDefaultValue($id, $store) {
|
25 |
+
$db = Mage::getSingleton('core/resource')->getConnection('core_read');
|
26 |
+
$maintable = Mage::getSingleton('core/resource')->getTableName('officience_news_store');
|
27 |
+
;
|
28 |
+
|
29 |
+
$select = $db->select()
|
30 |
+
->from($maintable, array('default_value'))//->columns(array('default_value'))
|
31 |
+
->where('news_id = ?', $id)
|
32 |
+
->where('store_id =?', $store);
|
33 |
+
$stmt = $db->query($select);
|
34 |
+
$result = $stmt->fetchAll();
|
35 |
+
return $result[0]['default_value'];
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
?>
|
app/code/community/Officience/News/Model/Wysiwyg/Config.php
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Officience_News_Model_Wysiwyg_Config extends Mage_Cms_Model_Wysiwyg_Config
|
5 |
+
{
|
6 |
+
/**
|
7 |
+
* Wysiwyg behaviour
|
8 |
+
*/
|
9 |
+
const WYSIWYG_ENABLED = 'enabled';
|
10 |
+
const WYSIWYG_HIDDEN = 'hidden';
|
11 |
+
const WYSIWYG_DISABLED = 'disabled';
|
12 |
+
const IMAGE_DIRECTORY = 'wysiwyg';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Return Wysiwyg config as Varien_Object
|
16 |
+
*
|
17 |
+
* Config options description:
|
18 |
+
*
|
19 |
+
* enabled: Enabled Visual Editor or not
|
20 |
+
* hidden: Show Visual Editor on page load or not
|
21 |
+
* use_container: Wrap Editor contents into div or not
|
22 |
+
* no_display: Hide Editor container or not (related to use_container)
|
23 |
+
* translator: Helper to translate phrases in lib
|
24 |
+
* files_browser_*: Files Browser (media, images) settings
|
25 |
+
* encode_directives: Encode template directives with JS or not
|
26 |
+
*
|
27 |
+
* @param $data Varien_Object constructor params to override default config values
|
28 |
+
* @return Varien_Object
|
29 |
+
*/
|
30 |
+
public function getConfig($data = array())
|
31 |
+
{
|
32 |
+
$config = new Varien_Object();
|
33 |
+
|
34 |
+
$config->setData(array(
|
35 |
+
'enabled' => $this->isEnabled(),
|
36 |
+
'hidden' => $this->isHidden(),
|
37 |
+
'use_container' => false,
|
38 |
+
'add_variables' => true,
|
39 |
+
'add_widgets' => true,
|
40 |
+
'no_display' => false,
|
41 |
+
'translator' => Mage::helper('cms'),
|
42 |
+
'encode_directives' => true,
|
43 |
+
'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
|
44 |
+
'popup_css' =>
|
45 |
+
Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css',
|
46 |
+
'content_css' =>
|
47 |
+
Mage::getBaseUrl('js').'mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css',
|
48 |
+
'width' => '100%',
|
49 |
+
'plugins' => array()
|
50 |
+
));
|
51 |
+
|
52 |
+
$config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
|
53 |
+
|
54 |
+
if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) {
|
55 |
+
$config->addData(array(
|
56 |
+
'add_images' => true,
|
57 |
+
'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index'),
|
58 |
+
'files_browser_window_width' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'),
|
59 |
+
'files_browser_window_height' => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'),
|
60 |
+
'encode_directives' => true,
|
61 |
+
'directives_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive'),
|
62 |
+
));
|
63 |
+
}
|
64 |
+
|
65 |
+
if (is_array($data)) {
|
66 |
+
$config->addData($data);
|
67 |
+
}
|
68 |
+
|
69 |
+
Mage::dispatchEvent('cms_wysiwyg_config_prepare', array('config' => $config));
|
70 |
+
|
71 |
+
return $config;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Return URL for skin images placeholder
|
76 |
+
*
|
77 |
+
* @return string
|
78 |
+
*/
|
79 |
+
public function getSkinImagePlaceholderUrl()
|
80 |
+
{
|
81 |
+
return Mage::getDesign()->getSkinUrl('images/wysiwyg/skin_image.png');
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Check whether Wysiwyg is enabled or not
|
86 |
+
*
|
87 |
+
* @return bool
|
88 |
+
*/
|
89 |
+
public function isEnabled()
|
90 |
+
{
|
91 |
+
$storeId = $this->getStoreId();
|
92 |
+
if (!is_null($storeId)) {
|
93 |
+
$wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled', $storeId);
|
94 |
+
} else {
|
95 |
+
$wysiwygState = Mage::getStoreConfig('cms/wysiwyg/enabled');
|
96 |
+
}
|
97 |
+
return in_array($wysiwygState, array(self::WYSIWYG_ENABLED, self::WYSIWYG_HIDDEN));
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Check whether Wysiwyg is loaded on demand or not
|
102 |
+
*
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
+
public function isHidden()
|
106 |
+
{
|
107 |
+
return Mage::getStoreConfig('cms/wysiwyg/enabled') == self::WYSIWYG_HIDDEN;
|
108 |
+
}
|
109 |
+
}
|
app/code/community/Officience/News/controllers/Adminhtml/CategoryController.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Adminhtml_CategoryController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
public function preDispatch() {
|
6 |
+
parent::preDispatch();
|
7 |
+
}
|
8 |
+
|
9 |
+
protected function _initAction() {
|
10 |
+
$this->loadLayout()
|
11 |
+
->_setActiveMenu('offinews/category');
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
public function indexAction() {
|
16 |
+
$this->_initAction()
|
17 |
+
->_addContent($this->getLayout()->createBlock('offinews/adminhtml_category'))
|
18 |
+
->renderLayout();
|
19 |
+
}
|
20 |
+
|
21 |
+
public function newAction() {
|
22 |
+
$this->_forward('edit');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function editAction() {
|
26 |
+
$id = $this->getRequest()->getParam('id');
|
27 |
+
if ($id) {
|
28 |
+
$storeId = $this->getRequest()->getParam('store', 0);
|
29 |
+
|
30 |
+
if ($storeId != 0) {
|
31 |
+
$tbCategoryStore = Mage::getSingleton('core/resource')->getTableName('officience_category_store');
|
32 |
+
|
33 |
+
$model = Mage::getModel('offinews/category')->getCollection();
|
34 |
+
|
35 |
+
$model->addFieldToFilter('main_table.category_id', array('eq' => $id));
|
36 |
+
|
37 |
+
$model->addFieldToSelect(array('thumbnail', 'parent_id', 'path', 'level'));
|
38 |
+
|
39 |
+
$model->getSelect()->join(array("t2" => $tbCategoryStore), 'main_table.category_id = t2.category_id and store_id=' . $storeId
|
40 |
+
, array('t2.title', 't2.description', 't2.identifier', 't2.sort_order', 't2.meta_keywords', 't2.meta_description', 't2.default_value'));
|
41 |
+
|
42 |
+
$firstData = $model->getFirstItem();
|
43 |
+
$modelGr = Mage::getModel('offinews/category')->load($id);
|
44 |
+
if (!$firstData->getData()) {
|
45 |
+
$firstData = $modelGr;
|
46 |
+
$firstData->setData('default_value', Mage::helper('offinews')->listDefaultCat());
|
47 |
+
try {
|
48 |
+
Mage::getModel('offinews/categoryStore')->setData($firstData->getData())->save();
|
49 |
+
} catch (Exception $e) {
|
50 |
+
|
51 |
+
}
|
52 |
+
}
|
53 |
+
$defaultValueArr = Mage::helper('offinews')->getDefaultValueData($firstData->getData());
|
54 |
+
foreach ($defaultValueArr as $keyDf => $valueDf) {
|
55 |
+
if (!$valueDf == '0') {
|
56 |
+
$firstData->setData($keyDf, $modelGr->getData($keyDf));
|
57 |
+
}
|
58 |
+
}
|
59 |
+
$firstData->setData('default_value', $defaultValueArr);
|
60 |
+
|
61 |
+
if (!$firstData->getId()) {
|
62 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('offinews')->__('Page access error'));
|
63 |
+
$this->_redirect('*/*/');
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
Mage::register('cat_data', $firstData);
|
67 |
+
} else {
|
68 |
+
$model = Mage::getModel('offinews/category');
|
69 |
+
$model->load($id);
|
70 |
+
if (!$model->getId()) {
|
71 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('news')->__('Page access error'));
|
72 |
+
$this->_redirect('*/*/');
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
76 |
+
if (!empty($data)) {
|
77 |
+
$model->setData($data);
|
78 |
+
}
|
79 |
+
|
80 |
+
Mage::register('cat_data', $model);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
$this->_initAction()
|
85 |
+
->_addContent($this->getLayout()->createBlock('offinews/adminhtml_category_edit'))
|
86 |
+
->_addLeft($this->getLayout()->createBlock('offinews/adminhtml_category_edit_tabs'));
|
87 |
+
|
88 |
+
$this->renderLayout();
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function ImageUrlSave() {
|
92 |
+
return 'Officience/News/Category';
|
93 |
+
}
|
94 |
+
|
95 |
+
public function saveAction() {
|
96 |
+
// check if data sent
|
97 |
+
if ($this->getRequest()->getPost()) {
|
98 |
+
$dataCur = array();
|
99 |
+
$store = intval($this->getRequest()->getParam('store', 0));
|
100 |
+
if ($store != 0 && $this->getRequest()->getPost('category_id')) {
|
101 |
+
$datatemp = $this->getRequest()->getPost();
|
102 |
+
// try {
|
103 |
+
$id = $this->getRequest()->getPost('category_id');
|
104 |
+
$str = Mage::getModel('offinews/category')->getDefaultValue($datatemp['category_id'], $store);
|
105 |
+
$arrStr = Mage::helper('offinews')->getDefaultValueData($str);
|
106 |
+
|
107 |
+
foreach ($arrStr as $key1 => $value1) {
|
108 |
+
if (isset($datatemp['default_value'][$key1])) {
|
109 |
+
$datatemp['default_value'][$key1] = $value1;
|
110 |
+
} else {
|
111 |
+
$datatemp['default_value'][$key1] = 0;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
$dataCur = Mage::getModel('offinews/category')->load($id)->getData();
|
116 |
+
foreach ($dataCur as $key => $value) {
|
117 |
+
if (isset($datatemp[$key])) {
|
118 |
+
$dataCur[$key] = $datatemp[$key];
|
119 |
+
}
|
120 |
+
}
|
121 |
+
$dataCur['store_id'] = $store;
|
122 |
+
unset($dataCur['level'], $dataCur['form_key'], $dataCur['parent_id']);
|
123 |
+
|
124 |
+
$dataCur['default_value'] = Mage::helper('offinews')->renderDefaultToText($datatemp);
|
125 |
+
Mage::getModel('offinews/categoryStore')->deleteCategoryStore($id, $store);
|
126 |
+
|
127 |
+
$modelCatStore = Mage::getModel('offinews/categoryStore')->setData($dataCur);
|
128 |
+
|
129 |
+
$modelCatStore->save();
|
130 |
+
try {
|
131 |
+
|
132 |
+
Mage::getSingleton('adminhtml/session')
|
133 |
+
->addSuccess(Mage::helper('offinews')->__('Category was successfully saved'));
|
134 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
135 |
+
|
136 |
+
// check if 'Save and Continue'
|
137 |
+
if ($this->getRequest()->getParam('back')) {
|
138 |
+
if ($store)
|
139 |
+
$this->_redirect('*/*/edit', array('id' => $id, 'store' => $store));
|
140 |
+
else
|
141 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
$this->_redirect('*/*/');
|
145 |
+
return;
|
146 |
+
} catch (Exception $e) {
|
147 |
+
|
148 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
149 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
150 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('category_id')));
|
151 |
+
return;
|
152 |
+
}
|
153 |
+
// } catch (Exception $e) {
|
154 |
+
//
|
155 |
+
// }
|
156 |
+
} else {
|
157 |
+
$data = $this->getRequest()->getPost();
|
158 |
+
if (isset($_FILES['thumbnail']['name']) and (file_exists($_FILES['thumbnail']['tmp_name']))) {
|
159 |
+
try {
|
160 |
+
$upload = new Varien_File_Uploader('thumbnail');
|
161 |
+
$upload->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
|
162 |
+
$upload->setAllowRenameFiles(true);
|
163 |
+
$upload->setFilesDispersion(false);
|
164 |
+
$path = Mage::getBaseDir('media') . DS . $this->ImageUrlSave();
|
165 |
+
$upload->save($path, str_replace(' ', '', $_FILES['thumbnail']['name']));
|
166 |
+
$data['thumbnail'] = $this->ImageUrlSave() . '/' . str_replace(' ', '', $_FILES['thumbnail']['name']);
|
167 |
+
} catch (Exception $e) {
|
168 |
+
|
169 |
+
}
|
170 |
+
} else {
|
171 |
+
if (isset($data['thumbnail']['delete']) && $data['thumbnail']['delete'] == 1) {
|
172 |
+
$data['thumbnail'] = '';
|
173 |
+
} else {
|
174 |
+
unset($data['thumbnail']);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
$identifier = '';
|
179 |
+
if ($data['identifier'] != '') {
|
180 |
+
$identifier = Mage::helper('offinews')->vnFilter($data['identifier']);
|
181 |
+
} else {
|
182 |
+
$identifier = Mage::helper('offinews')->vnFilter($data['title']);
|
183 |
+
}
|
184 |
+
$data['identifier'] = $identifier;
|
185 |
+
$model = Mage::getModel('offinews/category');
|
186 |
+
|
187 |
+
$model->setData($data);
|
188 |
+
$model->save();
|
189 |
+
|
190 |
+
try {
|
191 |
+
|
192 |
+
Mage::getSingleton('adminhtml/session')
|
193 |
+
->addSuccess(Mage::helper('offinews')->__('Category was successfully saved'));
|
194 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
195 |
+
|
196 |
+
// check if 'Save and Continue'
|
197 |
+
if ($this->getRequest()->getParam('back')) {
|
198 |
+
if ($store)
|
199 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId(), 'store' => $store));
|
200 |
+
else
|
201 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
202 |
+
return;
|
203 |
+
}
|
204 |
+
$this->_redirect('*/*/');
|
205 |
+
return;
|
206 |
+
} catch (Exception $e) {
|
207 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
208 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
209 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('category_id')));
|
210 |
+
return;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
$this->_redirect('*/*/');
|
215 |
+
}
|
216 |
+
|
217 |
+
public function deleteAction() {
|
218 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
219 |
+
try {
|
220 |
+
$model = Mage::getModel('offinews/category');
|
221 |
+
$model->load($id);
|
222 |
+
$model->delete();
|
223 |
+
|
224 |
+
Mage::getSingleton('adminhtml/session')
|
225 |
+
->addSuccess(Mage::helper('offinews')->__('Category was successfully deleted'));
|
226 |
+
$this->_redirect('*/*/');
|
227 |
+
} catch (Exception $e) {
|
228 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
229 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
230 |
+
}
|
231 |
+
}
|
232 |
+
$this->_redirect('*/*/');
|
233 |
+
}
|
234 |
+
|
235 |
+
public function massDeleteAction() {
|
236 |
+
$categoryIds = $this->getRequest()->getParam('category');
|
237 |
+
if (!is_array($categoryIds)) {
|
238 |
+
Mage::getSingleton('adminhtml/session')
|
239 |
+
->addError(Mage::helper('adminhtml')->__('Please select categories'));
|
240 |
+
} else {
|
241 |
+
try {
|
242 |
+
foreach ($categoryIds as $categoryId) {
|
243 |
+
$model = Mage::getModel('offinews/category')->load($categoryId);
|
244 |
+
$model->delete();
|
245 |
+
}
|
246 |
+
Mage::getSingleton('adminhtml/session')
|
247 |
+
->addSuccess(Mage::helper('adminhtml')
|
248 |
+
->__('%d categories have been successfully deleted', count($categoryIds)));
|
249 |
+
} catch (Exception $e) {
|
250 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
251 |
+
}
|
252 |
+
}
|
253 |
+
$this->_redirect('*/*/');
|
254 |
+
}
|
255 |
+
|
256 |
+
}
|
app/code/community/Officience/News/controllers/Adminhtml/CommentController.php
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Adminhtml_CommentController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function preDispatch() {
|
6 |
+
parent::preDispatch();
|
7 |
+
}
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Init actions
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
protected function _initAction() {
|
14 |
+
// load layout, set active menu
|
15 |
+
$this->loadLayout()
|
16 |
+
->_setActiveMenu('offinews/comment');
|
17 |
+
return $this;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function indexAction() {
|
21 |
+
$this->_initAction()
|
22 |
+
->_addContent($this->getLayout()->createBlock('offinews/adminhtml_comment'))
|
23 |
+
->renderLayout();
|
24 |
+
}
|
25 |
+
|
26 |
+
public function editAction() {
|
27 |
+
$id = $this->getRequest()->getParam('id');
|
28 |
+
$model = Mage::getModel('offinews/comment');
|
29 |
+
|
30 |
+
if ($id) {
|
31 |
+
$model->load($id);
|
32 |
+
if (!$model->getId()) {
|
33 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('offinews')->__('Page access error'));
|
34 |
+
$this->_redirect('*/*/');
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
40 |
+
if (!empty($data)) {
|
41 |
+
$model->setData($data);
|
42 |
+
}
|
43 |
+
|
44 |
+
Mage::register('offi_comment_data', $model);
|
45 |
+
|
46 |
+
$this->loadLayout()
|
47 |
+
->_addContent($this->getLayout()->createBlock('offinews/adminhtml_comment_edit'))
|
48 |
+
->renderLayout();
|
49 |
+
}
|
50 |
+
|
51 |
+
public function saveAction() {
|
52 |
+
if ($data = $this->getRequest()->getPost()) {
|
53 |
+
$model = Mage::getModel('offinews/comment');
|
54 |
+
$model->setData($data)
|
55 |
+
->setId($this->getRequest()->getParam('id'));
|
56 |
+
|
57 |
+
try {
|
58 |
+
$model->setUpdateTime(now())
|
59 |
+
->save();
|
60 |
+
Mage::getSingleton('adminhtml/session')
|
61 |
+
->addSuccess(Mage::helper('offinews')->__('Comment was successfully saved'));
|
62 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
63 |
+
|
64 |
+
if ($this->getRequest()->getParam('back')) {
|
65 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
$this->_redirect('*/*/');
|
69 |
+
return;
|
70 |
+
} catch (Exception $e) {
|
71 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
72 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
73 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
$this->_redirect('*/*/');
|
78 |
+
}
|
79 |
+
|
80 |
+
public function deleteAction() {
|
81 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
82 |
+
try {
|
83 |
+
$model = Mage::getModel('offinews/comment');
|
84 |
+
$model->load($id);
|
85 |
+
$model->delete();
|
86 |
+
|
87 |
+
Mage::getSingleton('adminhtml/session')
|
88 |
+
->addSuccess(Mage::helper('offinews')->__('Comment was successfully deleted'));
|
89 |
+
$this->_redirect('*/*/');
|
90 |
+
} catch (Exception $e) {
|
91 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
92 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
93 |
+
}
|
94 |
+
}
|
95 |
+
$this->_redirect('*/*/');
|
96 |
+
}
|
97 |
+
|
98 |
+
public function massApproveAction()
|
99 |
+
{
|
100 |
+
$commentIds = $this->getRequest()->getParam('comments');
|
101 |
+
if (!is_array($commentIds)) {
|
102 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select comment(s)'));
|
103 |
+
} else {
|
104 |
+
try {
|
105 |
+
foreach ($commentIds as $commentId) {
|
106 |
+
$model = Mage::getSingleton('offinews/comment')
|
107 |
+
->load($commentId)
|
108 |
+
->setCommentStatus(Officience_News_Helper_Data::APPROVED_STATUS)
|
109 |
+
->setIsMassupdate(true)
|
110 |
+
->save();
|
111 |
+
}
|
112 |
+
$this->_getSession()
|
113 |
+
->addSuccess($this
|
114 |
+
->__('%d comment(s) have been successfully approved',
|
115 |
+
count($commentIds)));
|
116 |
+
} catch (Exception $e) {
|
117 |
+
$this->_getSession()->addError($e->getMessage());
|
118 |
+
}
|
119 |
+
}
|
120 |
+
$this->_redirect('*/*/');
|
121 |
+
}
|
122 |
+
|
123 |
+
public function massUnapproveAction()
|
124 |
+
{
|
125 |
+
$commentIds = $this->getRequest()->getParam('comments');
|
126 |
+
if (!is_array($commentIds)) {
|
127 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select comment(s)'));
|
128 |
+
} else {
|
129 |
+
try {
|
130 |
+
foreach ($commentIds as $commentId) {
|
131 |
+
$model = Mage::getSingleton('offinews/comment')
|
132 |
+
->load($commentId)
|
133 |
+
->setCommentStatus(Officience_News_Helper_Data::UNAPPROVED_STATUS)
|
134 |
+
->setIsMassupdate(true)
|
135 |
+
->save();
|
136 |
+
}
|
137 |
+
$this->_getSession()
|
138 |
+
->addSuccess($this
|
139 |
+
->__('%d comment(s) have been successfully unapproved', count($commentIds)));
|
140 |
+
} catch (Exception $e) {
|
141 |
+
$this->_getSession()->addError($e->getMessage());
|
142 |
+
}
|
143 |
+
}
|
144 |
+
$this->_redirect('*/*/');
|
145 |
+
}
|
146 |
+
|
147 |
+
public function massDeleteAction() {
|
148 |
+
$commentIds = $this->getRequest()->getParam('comments');
|
149 |
+
if (!is_array($commentIds)) {
|
150 |
+
Mage::getSingleton('adminhtml/session')
|
151 |
+
->addError(Mage::helper('adminhtml')->__('Please select comment(s)'));
|
152 |
+
} else {
|
153 |
+
try {
|
154 |
+
foreach ($commentIds as $commentId) {
|
155 |
+
$model = Mage::getModel('offinews/comment')->load($commentId);
|
156 |
+
$model->delete();
|
157 |
+
}
|
158 |
+
Mage::getSingleton('adminhtml/session')
|
159 |
+
->addSuccess(Mage::helper('adminhtml')
|
160 |
+
->__('%d comments(s) have been successfully deleted',
|
161 |
+
count($commentIds)));
|
162 |
+
} catch (Exception $e) {
|
163 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
164 |
+
}
|
165 |
+
}
|
166 |
+
$this->_redirect('*/*/');
|
167 |
+
}
|
168 |
+
}
|
app/code/community/Officience/News/controllers/Adminhtml/NewsController.php
ADDED
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_Adminhtml_NewsController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
public function preDispatch() {
|
6 |
+
parent::preDispatch();
|
7 |
+
}
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Init actions
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
protected function _initAction() {
|
14 |
+
// load layout, set active menu
|
15 |
+
$this->loadLayout()
|
16 |
+
->_setActiveMenu('offinews/items');
|
17 |
+
return $this;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function indexAction() {
|
21 |
+
$this->_initAction()
|
22 |
+
->_addContent($this->getLayout()->createBlock('offinews/adminhtml_news'))
|
23 |
+
->renderLayout();
|
24 |
+
}
|
25 |
+
|
26 |
+
public function newAction() {
|
27 |
+
|
28 |
+
$this->_forward('edit');
|
29 |
+
}
|
30 |
+
|
31 |
+
public function editAction() {
|
32 |
+
$id = $this->getRequest()->getParam('id');
|
33 |
+
|
34 |
+
//$model = Mage::getModel('offinews/news')->load($id);
|
35 |
+
if ($id) {
|
36 |
+
$storeId = $this->getRequest()->getParam('store', 0);
|
37 |
+
if ($storeId != 0) {
|
38 |
+
$tbNewsStore = Mage::getSingleton('core/resource')->getTablename('officience_news_store');
|
39 |
+
$model = Mage::getModel('offinews/news')->getCollection();
|
40 |
+
$model->addFieldToFilter('main_table.news_id', array('eq' => $id));
|
41 |
+
$model->addFieldToSelect('news_id');
|
42 |
+
$model->getSelect()->join(array('t2' => $tbNewsStore), 'main_table.news_id = t2.news_id and t2.store_id=' . $storeId, array('t2.title',
|
43 |
+
't2.identifier', 't2.description', 't2.full_content', 't2.news_status', 't2.publicate_from_date',
|
44 |
+
't2.publicate_to_date', 't2.publicate_from_time', 't2.publicate_to_time', 't2.author', 't2.meta_keywords',
|
45 |
+
't2.meta_description', 't2.comments_enabled', 't2.tags', 't2.sort_order', 't2.default_value'));
|
46 |
+
$firstData = $model->getFirstItem();
|
47 |
+
|
48 |
+
|
49 |
+
$modelGr = Mage::getModel('offinews/news')->load($id);
|
50 |
+
if (!$firstData->getData()) {
|
51 |
+
$firstData = $modelGr;
|
52 |
+
$firstData->setData('default_value', Mage::helper('offinews')->listDefaultNews());
|
53 |
+
try {
|
54 |
+
Mage::getModel('offinews/newsStore')->setData($firstData->getData())->save();
|
55 |
+
} catch (Exception $e) {
|
56 |
+
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
$defaultValueArr = Mage::helper('offinews')->getDefaultValueData($firstData->getData());
|
61 |
+
foreach ($defaultValueArr as $keyDf => $valueDf) {
|
62 |
+
if (!$valueDf == '0') {
|
63 |
+
$firstData->setData($keyDf, $modelGr->getData($keyDf));
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
$firstData->setData('default_value', $defaultValueArr);
|
68 |
+
if (!$firstData->getId()) {
|
69 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('offinews')->__('Page access error'));
|
70 |
+
$this->_redirect('*/*/');
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
74 |
+
|
75 |
+
if (!empty($data)) {
|
76 |
+
$model->getFirstItem()->setData($data);
|
77 |
+
}
|
78 |
+
|
79 |
+
Mage::register('news_data', $firstData);
|
80 |
+
} else {
|
81 |
+
$model = Mage::getModel('offinews/news');
|
82 |
+
$model->load($id);
|
83 |
+
|
84 |
+
if (!$model->getId()) {
|
85 |
+
Mage::getSingleton('adminhtml/session')
|
86 |
+
->addError(Mage::helper('offinews')->__('News article does not exist'));
|
87 |
+
$this->_redirect('*/*/');
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
91 |
+
|
92 |
+
if (!empty($data)) {
|
93 |
+
$model->setData($data);
|
94 |
+
}
|
95 |
+
Mage::register('news_data', $model);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
$this->_initAction()
|
104 |
+
->_addContent($this->getLayout()->createBlock('offinews/adminhtml_news_edit'))
|
105 |
+
->_addLeft($this->getLayout()->createBlock('offinews/adminhtml_news_edit_tabs'))
|
106 |
+
->renderLayout();
|
107 |
+
}
|
108 |
+
|
109 |
+
public function saveAction() {
|
110 |
+
if ($this->getRequest()->getPost()) {
|
111 |
+
|
112 |
+
$dataCur = array();
|
113 |
+
$id = $this->getRequest()->getPost('news_id');
|
114 |
+
$store = intval($this->getRequest()->getParam('store', 0));
|
115 |
+
|
116 |
+
|
117 |
+
if ($store != 0 && $id) {
|
118 |
+
|
119 |
+
$datatemp = $this->getRequest()->getPost();
|
120 |
+
|
121 |
+
$newsCollection = Mage::getModel('offinews/newsStore')->getCollection()
|
122 |
+
->addFieldToFilter('identifier', $datatemp['identifier']);
|
123 |
+
|
124 |
+
$arr = $newsCollection->getData();
|
125 |
+
if (isset($arr[0]) && $this->getRequest()->getParam('id') == $arr[0]['news_id'] && $datatemp['identifier'] == $arr[0]['identifier']) {
|
126 |
+
$sameUrl = null;
|
127 |
+
} else {
|
128 |
+
$sameUrl = $newsCollection->getData();
|
129 |
+
}
|
130 |
+
if ($sameUrl != null) {
|
131 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('offinews')->__('News Item with such identifier already exists'));
|
132 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
133 |
+
}
|
134 |
+
|
135 |
+
$str = Mage::getModel('offinews/news')->getDefaultValue($datatemp['news_id'], $store);
|
136 |
+
$arrStr = Mage::helper('offinews')->getDefaultValueData($str);
|
137 |
+
foreach ($arrStr as $key1 => $value1) {
|
138 |
+
if (isset($datatemp['default_value'][$key1])) {
|
139 |
+
$datatemp['default_value'][$key1] = $value1;
|
140 |
+
} else {
|
141 |
+
$datatemp['default_value'][$key1] = 0;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
/*
|
145 |
+
if (isset($datatemp['publicate_from_time'])) {
|
146 |
+
$timeFrom = implode(',', $this->getRequest()->getParam('publicate_from_time'));
|
147 |
+
$datatemp['publicate_from_time'] = $timeFrom;
|
148 |
+
}
|
149 |
+
if (isset($datatemp['publicate_to_time'])) {
|
150 |
+
$timeTo = implode(',', $this->getRequest()->getParam('publicate_to_time'));
|
151 |
+
$datatemp['publicate_to_time'] = $timeTo;
|
152 |
+
}
|
153 |
+
|
154 |
+
*/
|
155 |
+
|
156 |
+
$dataCur = Mage::getModel('offinews/news')->load($id)->getData();
|
157 |
+
foreach ($dataCur as $key => $value) {
|
158 |
+
if (isset($datatemp[$key])) {
|
159 |
+
$dataCur[$key] = $datatemp[$key];
|
160 |
+
}
|
161 |
+
}
|
162 |
+
$dataCur['store_id'] = $store;
|
163 |
+
unset($dataCur['thumbnail']);
|
164 |
+
|
165 |
+
$dataCur['default_value'] = Mage::helper('offinews')->renderDefaultToText($datatemp);
|
166 |
+
Mage::getModel('offinews/newsStore')->deleteNewsStore($id, $store);
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
$modelNewsStore = Mage::getModel('offinews/newsStore')->setData($dataCur);
|
173 |
+
try {
|
174 |
+
$modelNewsStore->save();
|
175 |
+
|
176 |
+
Mage::getSingleton('adminhtml/session')
|
177 |
+
->addSuccess(Mage::helper('offinews')->__('News was successfully saved'));
|
178 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
179 |
+
|
180 |
+
// check if 'Save and Continue'
|
181 |
+
if ($this->getRequest()->getParam('back')) {
|
182 |
+
if ($store)
|
183 |
+
$this->_redirect('*/*/edit', array('id' => $id, 'store' => $store));
|
184 |
+
else
|
185 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
186 |
+
return;
|
187 |
+
}
|
188 |
+
$this->_redirect('*/*/');
|
189 |
+
return;
|
190 |
+
} catch (Exception $e) {
|
191 |
+
|
192 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
193 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
194 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('news_id')));
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
} else {
|
198 |
+
$data = $this->getRequest()->getPost();
|
199 |
+
$newsCollection = Mage::getModel('offinews/news')->getCollection()
|
200 |
+
->addFieldToFilter('identifier', $data['identifier']);
|
201 |
+
$arr = array();
|
202 |
+
$arr = $newsCollection->getData();
|
203 |
+
if (isset($arr[0]) && $this->getRequest()->getParam('id') == $arr[0]['news_id'] && $data['identifier'] == $arr[0]['identifier']) {
|
204 |
+
$sameUrl = null;
|
205 |
+
} else {
|
206 |
+
$sameUrl = $newsCollection->getData();
|
207 |
+
}
|
208 |
+
if ($sameUrl != null) {
|
209 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('offinews')->__('News Item with such identifier already exists'));
|
210 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
211 |
+
} else {
|
212 |
+
|
213 |
+
if (isset($data['is_delete'])) {
|
214 |
+
$isDeleteFile = true;
|
215 |
+
} else {
|
216 |
+
$isDeleteFile = false;
|
217 |
+
}
|
218 |
+
|
219 |
+
|
220 |
+
|
221 |
+
if (isset($_FILES['thumbnail']['name']) && ($_FILES['thumbnail']['name'] != '') && ($_FILES['thumbnail']['size'] != 0)) {
|
222 |
+
try {
|
223 |
+
$uploader = new Varien_File_Uploader('thumbnail');
|
224 |
+
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
|
225 |
+
$uploader->setAllowRenameFiles(false);
|
226 |
+
$uploader->setFilesDispersion(false);
|
227 |
+
$path = Mage::getBaseDir('media') . DS . $this->ImageUrlSave();
|
228 |
+
$prefix = time() . rand();
|
229 |
+
$fileName = $prefix . '.' . pathinfo($_FILES['thumbnail']['name'], PATHINFO_EXTENSION);
|
230 |
+
$uploader->save($path, $fileName);
|
231 |
+
$filepath = $this->ImageUrlSave() . DS . $fileName;
|
232 |
+
$data['thumbnail'] = $filepath;
|
233 |
+
$data['thumbnail'] = str_replace('\\', '/', $data['thumbnail']);
|
234 |
+
} catch (Exception $e) {
|
235 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
236 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
237 |
+
return;
|
238 |
+
}
|
239 |
+
} elseif (isset($data['thumbnail']['delete'])) {
|
240 |
+
$path = Mage::getBaseDir('media') . DS;
|
241 |
+
$result = unlink($path . $data['thumbnail']['value']);
|
242 |
+
$data['thumbnail'] = '';
|
243 |
+
} else {
|
244 |
+
if (isset($data['thumbnail']['value'])) {
|
245 |
+
$data['thumbnail'] = $data['thumbnail']['value'];
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
$model = Mage::getModel('offinews/news');
|
250 |
+
/*
|
251 |
+
$dateFrom = $this->getRequest()->getParam('publicate_from_date');
|
252 |
+
$dateTo = $this->getRequest()->getParam('publicate_to_date');
|
253 |
+
$timeFrom = implode(',', $this->getRequest()->getParam('publicate_from_time'));
|
254 |
+
$timeTo = implode(',', $this->getRequest()->getParam('publicate_to_time'));
|
255 |
+
|
256 |
+
$data['publicate_from_time'] = $timeFrom;
|
257 |
+
$data['publicate_to_time'] = $timeTo;
|
258 |
+
*
|
259 |
+
*/
|
260 |
+
$data['tags'] = $this->getRequest()->getParam('tags');
|
261 |
+
|
262 |
+
// prepare dates
|
263 |
+
//
|
264 |
+
// $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
265 |
+
// if ($dateFrom != '') {
|
266 |
+
// if (!Zend_Date::isDate($dateFrom, $dateFormatIso)) {
|
267 |
+
// throw new Exception($this->__(('News date field is required')));
|
268 |
+
// }
|
269 |
+
// } else {
|
270 |
+
// $data['publicate_from_date'] = new Zend_Db_Expr('null');
|
271 |
+
// }
|
272 |
+
//
|
273 |
+
//
|
274 |
+
// if ($dateTo != '') {
|
275 |
+
// if (!Zend_Date::isDate($dateTo . ' ' . $timeTo, $dateFormatIso)) {
|
276 |
+
// throw new Exception($this->__(('News date field is required')));
|
277 |
+
// }
|
278 |
+
// } else {
|
279 |
+
// $data['publicate_to_date'] = new Zend_Db_Expr('null');
|
280 |
+
// }
|
281 |
+
// if ($id) {
|
282 |
+
// $data['update_time'] = now();
|
283 |
+
// } else {
|
284 |
+
// $data['created_time'] = now();
|
285 |
+
// $data['update_time'] = now();
|
286 |
+
// }
|
287 |
+
|
288 |
+
if ($this->getRequest()->getParam('author') == NULL) {
|
289 |
+
$model->setUpdateAuthor(NULL);
|
290 |
+
} else {
|
291 |
+
$model->setUpdateAuthor(Mage::getSingleton('admin/session')->getUser()->getFirstname() .
|
292 |
+
" " . Mage::getSingleton('admin/session')->getUser()->getLastname());
|
293 |
+
}
|
294 |
+
|
295 |
+
$model->setData($data);
|
296 |
+
|
297 |
+
try {
|
298 |
+
|
299 |
+
|
300 |
+
$model->save();
|
301 |
+
|
302 |
+
Mage::getSingleton('adminhtml/session')
|
303 |
+
->addSuccess(Mage::helper('offinews')->__('News article has been successfully saved'));
|
304 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
305 |
+
|
306 |
+
if ($this->getRequest()->getParam('back')) {
|
307 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
308 |
+
return;
|
309 |
+
}
|
310 |
+
$this->_redirect('*/*/');
|
311 |
+
return;
|
312 |
+
} catch (Exception $e) {
|
313 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
314 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
315 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
316 |
+
return;
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('offinews')->__('No items to save'));
|
321 |
+
$this->_redirect('*/*/');
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
protected function ImageUrlSave() {
|
327 |
+
return 'Officience/News/Post/Thumbnail';
|
328 |
+
}
|
329 |
+
|
330 |
+
public function deleteAction() {
|
331 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
332 |
+
try {
|
333 |
+
$model = Mage::getModel('offinews/news');
|
334 |
+
$model->load($id);
|
335 |
+
$model->delete();
|
336 |
+
|
337 |
+
Mage::getSingleton('adminhtml/session')
|
338 |
+
->addSuccess(Mage::helper('adminhtml')->__('Item has been successfully deleted'));
|
339 |
+
$this->_redirect('*/*/');
|
340 |
+
} catch (Exception $e) {
|
341 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
342 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
343 |
+
}
|
344 |
+
}
|
345 |
+
$this->_redirect('*/*/');
|
346 |
+
}
|
347 |
+
|
348 |
+
public function massDeleteAction() {
|
349 |
+
$newsIds = $this->getRequest()->getParam('offinews');
|
350 |
+
if (!is_array($newsIds)) {
|
351 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
352 |
+
} else {
|
353 |
+
try {
|
354 |
+
$model = Mage::getModel('offinews/news');
|
355 |
+
foreach ($newsIds as $newsId) {
|
356 |
+
$model->reset()
|
357 |
+
->load($newsId)
|
358 |
+
->delete();
|
359 |
+
}
|
360 |
+
Mage::getSingleton('adminhtml/session')
|
361 |
+
->addSuccess(Mage::helper('adminhtml')
|
362 |
+
->__('%d record(s) have been successfully deleted', count($newsIds)));
|
363 |
+
} catch (Exception $e) {
|
364 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
365 |
+
}
|
366 |
+
}
|
367 |
+
$this->_redirect('*/*/index');
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Export order grid to CSV format
|
372 |
+
*/
|
373 |
+
public function exportCsvAction() {
|
374 |
+
$fileName = 'news.csv';
|
375 |
+
$grid = $this->getLayout()
|
376 |
+
->createBlock('offinews/adminhtml_news_grid')
|
377 |
+
->addColumn('news_id', array(
|
378 |
+
'header' => Mage::helper('offinews')->__('ID'),
|
379 |
+
'align' => 'right',
|
380 |
+
'width' => '50',
|
381 |
+
'index' => 'news_id',
|
382 |
+
))->addColumn('title', array(
|
383 |
+
'header' => Mage::helper('offinews')->__('Title'),
|
384 |
+
'align' => 'left',
|
385 |
+
'index' => 'title',
|
386 |
+
))->addColumn('identifier', array(
|
387 |
+
'header' => Mage::helper('offinews')->__('URL Key'),
|
388 |
+
'align' => 'left',
|
389 |
+
'index' => 'identifier',
|
390 |
+
))->addColumn('author', array(
|
391 |
+
'header' => Mage::helper('offinews')->__('Author'),
|
392 |
+
'index' => 'author',
|
393 |
+
))->addColumn('short_content', array(
|
394 |
+
'header' => Mage::helper('offinews')->__('Short Content'),
|
395 |
+
'type' => 'text',
|
396 |
+
'index' => 'short_content',
|
397 |
+
))->addColumn('image_short_content', array(
|
398 |
+
'header' => Mage::helper('offinews')->__('Short Content Image'),
|
399 |
+
'type' => 'text',
|
400 |
+
'display' => 'none',
|
401 |
+
'index' => 'image_short_content',
|
402 |
+
))->addColumn('full_content', array(
|
403 |
+
'header' => Mage::helper('offinews')->__('Full Content'),
|
404 |
+
'type' => 'text',
|
405 |
+
'index' => 'full_content',
|
406 |
+
))->addColumn('image_full_content', array(
|
407 |
+
'header' => Mage::helper('offinews')->__('Full Content Image'),
|
408 |
+
'type' => 'text',
|
409 |
+
'index' => 'image_full_content',
|
410 |
+
))->addColumn('document', array(
|
411 |
+
'header' => Mage::helper('offinews')->__('Document'),
|
412 |
+
'type' => 'text',
|
413 |
+
'index' => 'document',
|
414 |
+
))->addColumn('meta_keywords', array(
|
415 |
+
'header' => Mage::helper('offinews')->__('Meta Keywords'),
|
416 |
+
'type' => 'text',
|
417 |
+
'index' => 'meta_keywords',
|
418 |
+
))->addColumn('meta_description', array(
|
419 |
+
'header' => Mage::helper('offinews')->__('Meta Description'),
|
420 |
+
'type' => 'text',
|
421 |
+
'index' => 'meta_description',
|
422 |
+
))->addColumn('tags', array(
|
423 |
+
'header' => Mage::helper('offinews')->__('Tags'),
|
424 |
+
'type' => 'text',
|
425 |
+
'index' => 'tags',
|
426 |
+
));
|
427 |
+
|
428 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
429 |
+
}
|
430 |
+
|
431 |
+
public function massStatusAction() {
|
432 |
+
$newsIds = $this->getRequest()->getParam('news');
|
433 |
+
if (!is_array($newsIds)) {
|
434 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
435 |
+
} else {
|
436 |
+
try {
|
437 |
+
foreach ($newsIds as $newsId) {
|
438 |
+
$model = Mage::getSingleton('offinews/news')
|
439 |
+
->setId($newsId)
|
440 |
+
->setStatus($this->getRequest()->getParam('news_status'))
|
441 |
+
->save();
|
442 |
+
}
|
443 |
+
$this->_getSession()
|
444 |
+
->addSuccess($this->__('%d record(s) have been successfully updated', count($newsIds)));
|
445 |
+
} catch (Exception $e) {
|
446 |
+
$this->_getSession()->addError($e->getMessage());
|
447 |
+
}
|
448 |
+
}
|
449 |
+
$this->_redirect('*/*/index');
|
450 |
+
}
|
451 |
+
|
452 |
+
}
|
app/code/community/Officience/News/controllers/IndexController.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
//// check if this category is allowed to view
|
7 |
+
if ($category = $this->getRequest()->getParam('category')) {
|
8 |
+
$collection = Mage::getModel('offinews/category')->getCollection()
|
9 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
10 |
+
->filterByIdentifier($category)
|
11 |
+
->getFirstItem()
|
12 |
+
;
|
13 |
+
if (count($collection->getData()) < 1) {
|
14 |
+
$this->_forward('NoRoute');
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
if (!Mage::registry('current_offi_news_cat_id')) {
|
18 |
+
Mage::register('current_offi_news_cat_id', $collection->getId());
|
19 |
+
}
|
20 |
+
if (!Mage::registry('current_offi_news_cat_identifier')) {
|
21 |
+
Mage::register('current_offi_news_cat_identifier', $collection->getIdentifier());
|
22 |
+
}
|
23 |
+
}
|
24 |
+
$this->loadLayout();
|
25 |
+
$this->renderLayout();
|
26 |
+
}
|
27 |
+
|
28 |
+
public function tagAction() {
|
29 |
+
$urlOption = Mage::helper('offinews')->getUrloption();
|
30 |
+
|
31 |
+
$collection = Mage::getModel('offinews/news')->getCollection()
|
32 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
33 |
+
->getFirstItem();
|
34 |
+
if (count($collection->getData()) < 1) {
|
35 |
+
$this->_forward('NoRoute');
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
$this->loadLayout();
|
39 |
+
$this->renderLayout();
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
app/code/community/Officience/News/controllers/NewspostController.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_NewspostController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function viewAction() {
|
6 |
+
|
7 |
+
|
8 |
+
$session = Mage::getSingleton('core/session');
|
9 |
+
|
10 |
+
$identifier = $this->getRequest()->getParam('key');
|
11 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
12 |
+
if (preg_match('/[A-Za-z0-9\-\_]+/', $identifier)) {
|
13 |
+
$newspost = Mage::getModel('offinews/news')->getCollection()
|
14 |
+
->addEnableFilter(1)
|
15 |
+
->addFilterByIdentifier($identifier)
|
16 |
+
->addStoreFilter($storeId)
|
17 |
+
->getFirstItem()
|
18 |
+
;
|
19 |
+
Mage::register('newspost', $newspost);
|
20 |
+
if (!$newspost->getData() && !$newspost->getData('news_status') == 1) {
|
21 |
+
$this->_forward('NoRoute');
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
$mode = $this->getRequest()->getParam('mode');
|
26 |
+
if ($mode == 'print') {
|
27 |
+
$this->_forward('print');
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
$newspost = Mage::registry('newspost');
|
32 |
+
if (!$newspost) {
|
33 |
+
$this->_forward('NoRoute');
|
34 |
+
}
|
35 |
+
|
36 |
+
if ($data = $this->getRequest()->getPost()) {
|
37 |
+
|
38 |
+
if (!$newspost->getCommentsEnabled()) {
|
39 |
+
$session->addError(Mage::helper('offinews')->__('Comments are not enabled.'));
|
40 |
+
$this->_forward('NoRoute');
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
44 |
+
$data['user'] = (Mage::helper('offinews')->getUserName());
|
45 |
+
$data['email'] = Mage::helper('offinews')->getUserEmail();
|
46 |
+
}
|
47 |
+
$data['created_time'] = now();
|
48 |
+
$data['comment'] = htmlspecialchars($data['comment'], ENT_QUOTES);
|
49 |
+
if ($data['comment']) {
|
50 |
+
try {
|
51 |
+
if ((int) Mage::getStoreConfig('offinews/comments/need_confirmation')) {
|
52 |
+
$data['comment_status'] = Officience_News_Helper_Data::UNAPPROVED_STATUS;
|
53 |
+
$session->addSuccess(Mage::helper('offinews')->__('Your comment has been successfully sent. It will be added after approval by our admin'));
|
54 |
+
} else {
|
55 |
+
$data['comment_status'] = Officience_News_Helper_Data::APPROVED_STATUS;
|
56 |
+
$session->addSuccess(Mage::helper('offinews')->__('Thank you for adding a comment.'));
|
57 |
+
}
|
58 |
+
$modelComment = Mage::getModel('offinews/comment');
|
59 |
+
$modelComment->setData($data);
|
60 |
+
$modelComment->save();
|
61 |
+
} catch (Exception $e) {
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
$this->loadLayout();
|
66 |
+
$this->renderLayout();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function printAction() {
|
70 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
71 |
+
$head = $this->getLayout()->getBlock('head');
|
72 |
+
$identifier = $this->getRequest()->getParam('key');
|
73 |
+
if ($identifier && !Mage::registry('news')) {
|
74 |
+
$printPost = Mage::getModel('offinews/news')->getCollection()
|
75 |
+
->addEnableFilter(1)
|
76 |
+
->addFilterByIdentifier($identifier)
|
77 |
+
->addStoreFilter($storeId)
|
78 |
+
->getFirstItem()
|
79 |
+
;
|
80 |
+
if ($printPost != null) {
|
81 |
+
if (!Mage::registry('newspost'))
|
82 |
+
Mage::register('newspost', $printPost);
|
83 |
+
} else {
|
84 |
+
$this->_redirect(Mage::helper('offinews')->getRoute());
|
85 |
+
}
|
86 |
+
}
|
87 |
+
$block = $this->getLayout()->createBlock('offinews/newspost')->setTemplate('officience/news/print.phtml');
|
88 |
+
echo $block->toHtml();
|
89 |
+
}
|
90 |
+
|
91 |
+
private function checkUrlOption() {
|
92 |
+
$urlOption = Mage::helper('offinews')->getUrloption();
|
93 |
+
if ($urlOption == 2) {
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
}
|
app/code/community/Officience/News/controllers/RssController.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Officience_News_RssController extends Mage_Core_Controller_Front_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
6 |
+
if ((int) Mage::getStoreConfig('offinews/rss/enable')) {
|
7 |
+
if ($category = $this->getRequest()->getParam('category')) {
|
8 |
+
$collection = Mage::getModel('offinews/category')->getCollection()
|
9 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
10 |
+
->filterByIdentifier($category)
|
11 |
+
->getFirstItem()
|
12 |
+
;
|
13 |
+
if (Mage::registry('current_offi_news_cat_id')) {
|
14 |
+
Mage::unregister('current_offi_news_cat_id');
|
15 |
+
}
|
16 |
+
Mage::register('current_offi_news_cat_id', $collection->getId());
|
17 |
+
|
18 |
+
if (Mage::registry('current_offi_news_cat_identifier')) {
|
19 |
+
Mage::unregister('current_offi_news_cat_identifier');
|
20 |
+
}
|
21 |
+
Mage::register('current_offi_news_cat_identifier', $collection->getIdentifier());
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
$this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
|
27 |
+
$this->loadLayout(false);
|
28 |
+
$this->renderLayout();
|
29 |
+
} else {
|
30 |
+
$this->_forward('NoRoute');
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
public function noRouteAction($coreRoute = null) {
|
35 |
+
$this->getResponse()->setHeader('HTTP/1.1', '404 Not Found');
|
36 |
+
$this->getResponse()->setHeader('Status', '404 File not found');
|
37 |
+
|
38 |
+
$pageId = Mage::getStoreConfig('web/default/cms_no_route');
|
39 |
+
if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
|
40 |
+
$this->_forward('defaultNoRoute');
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/Officience/News/etc/config.xml
ADDED
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Officience_News>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Officience_News>
|
7 |
+
</modules>
|
8 |
+
<admin>
|
9 |
+
<routers>
|
10 |
+
<offinews>
|
11 |
+
<use>admin</use>
|
12 |
+
<args>
|
13 |
+
<module>Officience_News</module>
|
14 |
+
<frontName>offinews</frontName>
|
15 |
+
</args>
|
16 |
+
</offinews>
|
17 |
+
</routers>
|
18 |
+
</admin>
|
19 |
+
<frontend>
|
20 |
+
<routers>
|
21 |
+
<offinews>
|
22 |
+
<use>standard</use>
|
23 |
+
<args>
|
24 |
+
<module>Officience_News</module>
|
25 |
+
<frontName>offinews</frontName>
|
26 |
+
</args>
|
27 |
+
</offinews>
|
28 |
+
</routers>
|
29 |
+
<layout>
|
30 |
+
<updates>
|
31 |
+
<offinews>
|
32 |
+
<file>officience_news.xml</file>
|
33 |
+
</offinews>
|
34 |
+
</updates>
|
35 |
+
</layout>
|
36 |
+
<translate>
|
37 |
+
<modules>
|
38 |
+
<Officience_News>
|
39 |
+
<files>
|
40 |
+
<Officience_News>Officience_News.csv</Officience_News>
|
41 |
+
</files>
|
42 |
+
</Officience_News>
|
43 |
+
</modules>
|
44 |
+
</translate>
|
45 |
+
</frontend>
|
46 |
+
|
47 |
+
<adminhtml>
|
48 |
+
<translate>
|
49 |
+
<modules>
|
50 |
+
<Officience_News>
|
51 |
+
<files>
|
52 |
+
<default>Officience_News.csv</default>
|
53 |
+
</files>
|
54 |
+
</Officience_News>
|
55 |
+
</modules>
|
56 |
+
</translate>
|
57 |
+
|
58 |
+
<menu>
|
59 |
+
<offinews module="offinews">
|
60 |
+
<title>News</title>
|
61 |
+
<sort_order>80</sort_order>
|
62 |
+
<children>
|
63 |
+
<add translate="title" module="offinews">
|
64 |
+
<title>New post</title>
|
65 |
+
<sort_order>0</sort_order>
|
66 |
+
<action>offinews/adminhtml_news/new</action>
|
67 |
+
</add>
|
68 |
+
<items translate="title" module="offinews">
|
69 |
+
<title>Management news</title>
|
70 |
+
<sort_order>10</sort_order>
|
71 |
+
<action>offinews/adminhtml_news/index</action>
|
72 |
+
</items>
|
73 |
+
<category module="offinews">
|
74 |
+
<title>Categories</title>
|
75 |
+
<sort_order>20</sort_order>
|
76 |
+
<action>offinews/adminhtml_category/</action>
|
77 |
+
</category>
|
78 |
+
<comments module="offinews">
|
79 |
+
<title>Comments</title>
|
80 |
+
<sort_order>30</sort_order>
|
81 |
+
<action>offinews/adminhtml_comment/</action>
|
82 |
+
</comments>
|
83 |
+
<settings translate="title" module="offinews">
|
84 |
+
<title>Settings</title>
|
85 |
+
<sort_order>40</sort_order>
|
86 |
+
<action>adminhtml/system_config/edit/section/offinews</action>
|
87 |
+
</settings>
|
88 |
+
</children>
|
89 |
+
</offinews>
|
90 |
+
</menu>
|
91 |
+
<acl>
|
92 |
+
<resources>
|
93 |
+
<all>
|
94 |
+
<title>Allow Everything</title>
|
95 |
+
</all>
|
96 |
+
<admin>
|
97 |
+
<children>
|
98 |
+
<offinews>
|
99 |
+
<title>News</title>
|
100 |
+
<sort_order>50</sort_order>
|
101 |
+
<children>
|
102 |
+
<items translate="title">
|
103 |
+
<title>News</title>
|
104 |
+
<sort_order>10</sort_order>
|
105 |
+
</items>
|
106 |
+
<category translate="title">
|
107 |
+
<title>Categories</title>
|
108 |
+
<sort_order>20</sort_order>
|
109 |
+
</category>
|
110 |
+
<comments translate="title">
|
111 |
+
<title>Comments</title>
|
112 |
+
<sort_order>30</sort_order>
|
113 |
+
</comments>
|
114 |
+
</children>
|
115 |
+
</offinews>
|
116 |
+
<system>
|
117 |
+
<children>
|
118 |
+
<config>
|
119 |
+
<children>
|
120 |
+
<offinews>
|
121 |
+
<title>News Section</title>
|
122 |
+
</offinews>
|
123 |
+
</children>
|
124 |
+
</config>
|
125 |
+
</children>
|
126 |
+
</system>
|
127 |
+
</children>
|
128 |
+
</admin>
|
129 |
+
</resources>
|
130 |
+
</acl>
|
131 |
+
<layout>
|
132 |
+
<updates>
|
133 |
+
<offinews>
|
134 |
+
<file>officience_news.xml</file>
|
135 |
+
</offinews>
|
136 |
+
</updates>
|
137 |
+
</layout>
|
138 |
+
<events>
|
139 |
+
<controller_action_predispatch>
|
140 |
+
<observers>
|
141 |
+
<offinews>
|
142 |
+
<type>singleton</type>
|
143 |
+
<class>offinews/check</class>
|
144 |
+
<method>checkExtensions</method>
|
145 |
+
</offinews>
|
146 |
+
</observers>
|
147 |
+
</controller_action_predispatch>
|
148 |
+
<admin_system_config_changed_section_offinews>
|
149 |
+
<observers>
|
150 |
+
<admin_system_config_changed_section_offinews>
|
151 |
+
<class>offinews/check</class>
|
152 |
+
<method>checkConfiguration</method>
|
153 |
+
</admin_system_config_changed_section_offinews>
|
154 |
+
</observers>
|
155 |
+
</admin_system_config_changed_section_offinews>
|
156 |
+
</events>
|
157 |
+
</adminhtml>
|
158 |
+
<global>
|
159 |
+
<models>
|
160 |
+
<offinews>
|
161 |
+
<class>Officience_News_Model</class>
|
162 |
+
<resourceModel>offinews_mysql4</resourceModel>
|
163 |
+
</offinews>
|
164 |
+
<offinews_mysql4>
|
165 |
+
<class>Officience_News_Model_Mysql4</class>
|
166 |
+
<entities>
|
167 |
+
<news>
|
168 |
+
<table>officience_news</table>
|
169 |
+
</news>
|
170 |
+
<comment>
|
171 |
+
<table>officience_comment</table>
|
172 |
+
</comment>
|
173 |
+
<category>
|
174 |
+
<table>officience_category</table>
|
175 |
+
</category>
|
176 |
+
<newsCategory>
|
177 |
+
<table>officience_news_category</table>
|
178 |
+
</newsCategory>
|
179 |
+
<newsStore>
|
180 |
+
<table>officience_news_store</table>
|
181 |
+
</newsStore>
|
182 |
+
<categoryStore>
|
183 |
+
<table>officience_category_store</table>
|
184 |
+
</categoryStore>
|
185 |
+
</entities>
|
186 |
+
</offinews_mysql4>
|
187 |
+
</models>
|
188 |
+
<resources>
|
189 |
+
<offinews_setup>
|
190 |
+
<setup>
|
191 |
+
<module>Officience_News</module>
|
192 |
+
</setup>
|
193 |
+
<connection>
|
194 |
+
<use>core_setup</use>
|
195 |
+
</connection>
|
196 |
+
</offinews_setup>
|
197 |
+
<offinews_write>
|
198 |
+
<connection>
|
199 |
+
<use>core_write</use>
|
200 |
+
</connection>
|
201 |
+
</offinews_write>
|
202 |
+
<offinews_read>
|
203 |
+
<connection>
|
204 |
+
<use>core_read</use>
|
205 |
+
</connection>
|
206 |
+
</offinews_read>
|
207 |
+
</resources>
|
208 |
+
<blocks>
|
209 |
+
<offinews>
|
210 |
+
<class>Officience_News_Block</class>
|
211 |
+
</offinews>
|
212 |
+
</blocks>
|
213 |
+
<helpers>
|
214 |
+
<offinews>
|
215 |
+
<class>Officience_News_Helper</class>
|
216 |
+
</offinews>
|
217 |
+
</helpers>
|
218 |
+
<events>
|
219 |
+
<controller_front_init_routers>
|
220 |
+
<observers>
|
221 |
+
<offinews>
|
222 |
+
<type>singleton</type>
|
223 |
+
<class>Officience_News_Controller_Router</class>
|
224 |
+
<method>initControllerRouters</method>
|
225 |
+
</offinews>
|
226 |
+
</observers>
|
227 |
+
</controller_front_init_routers>
|
228 |
+
</events>
|
229 |
+
<rewrite>
|
230 |
+
<offinews_category_view>
|
231 |
+
<complete />
|
232 |
+
<from>#^/offinews/category/([A-Za-z0-9\-\_]+)\.html/*#</from>
|
233 |
+
<to>/offinews/index/index/category/$1</to>
|
234 |
+
</offinews_category_view>
|
235 |
+
<offinews_newsitem_view>
|
236 |
+
<complete />
|
237 |
+
<from>#^/offinews/([A-Za-z0-9\-\_]+)\.html/*#</from>
|
238 |
+
<to>/offinews/newsitem/view/key/$1</to>
|
239 |
+
</offinews_newsitem_view>
|
240 |
+
<offinews_newsitem_category_view>
|
241 |
+
<complete />
|
242 |
+
<from>#^/offinews/([A-Za-z0-9\-\_]+)/([A-Za-z0-9\-\_]+)\.html/*#</from>
|
243 |
+
<to>/offinews/newsitem/view/category/$1/key/$2</to>
|
244 |
+
</offinews_newsitem_category_view>
|
245 |
+
</rewrite>
|
246 |
+
<template>
|
247 |
+
<email>
|
248 |
+
<offinews_comments_email_template translate="label" module="offinews">
|
249 |
+
<label>New Comment</label>
|
250 |
+
<file>offinews/new_comment.html</file>
|
251 |
+
<type>text</type>
|
252 |
+
</offinews_comments_email_template>
|
253 |
+
</email>
|
254 |
+
</template>
|
255 |
+
</global>
|
256 |
+
<default>
|
257 |
+
<offinews>
|
258 |
+
<urloption>
|
259 |
+
<urlnews>1</urlnews>
|
260 |
+
</urloption>
|
261 |
+
<news>
|
262 |
+
<title>News</title>
|
263 |
+
<route>news</route>
|
264 |
+
<showbreadcrumbs>1</showbreadcrumbs>
|
265 |
+
<itemsperpage>10</itemsperpage>
|
266 |
+
<itemurlsuffix>.html</itemurlsuffix>
|
267 |
+
<enablelinkrout>1</enablelinkrout>
|
268 |
+
<linkrout>View More</linkrout>
|
269 |
+
<showdateofnews>1</showdateofnews>
|
270 |
+
<showtimeofnews>0</showtimeofnews>
|
271 |
+
<tags>0</tags>
|
272 |
+
<printable>1</printable>
|
273 |
+
<parentcategory>1</parentcategory>
|
274 |
+
</news>
|
275 |
+
<comments>
|
276 |
+
<enabled>1</enabled>
|
277 |
+
<commentsperpage>10</commentsperpage>
|
278 |
+
</comments>
|
279 |
+
<rss>
|
280 |
+
<enable>0</enable>
|
281 |
+
<posts>10</posts>
|
282 |
+
</rss>
|
283 |
+
</offinews>
|
284 |
+
</default>
|
285 |
+
</config>
|
app/code/community/Officience/News/etc/system.xml
ADDED
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<offinews translate="label" module="offinews">
|
5 |
+
<label>Officience News Extensions</label>
|
6 |
+
<sort_order>300</sort_order>
|
7 |
+
</offinews>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<offinews translate="label" module="offinews">
|
11 |
+
<label>News</label>
|
12 |
+
<tab>offinews</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>100</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<urloption translate="label">
|
20 |
+
<label>URL Option</label>
|
21 |
+
<frontend_type>select</frontend_type>
|
22 |
+
<sort_order>9</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<urlnews translate="label">
|
28 |
+
<label>Url option</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>offinews/config_source_Urloption</source_model>
|
31 |
+
<sort_order>10</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</urlnews>
|
36 |
+
</fields>
|
37 |
+
</urloption>
|
38 |
+
<news translate="label">
|
39 |
+
<label>News Settings</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<fields>
|
46 |
+
<title translate="label">
|
47 |
+
<label>News Title</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>10</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</title>
|
54 |
+
<route translate="label">
|
55 |
+
<label>Route to News</label>
|
56 |
+
<comment>e.g. "news" will make the news accessible from domain.com/news. Should not contain slashes. Leave blank for default - news</comment>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>12</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</route>
|
63 |
+
<parentcategory translate="label">
|
64 |
+
<label>Parent category display setting</label>
|
65 |
+
<frontend_type>select</frontend_type>
|
66 |
+
<source_model>offinews/config_source_parentcat</source_model>
|
67 |
+
<sort_order>12</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</parentcategory>
|
72 |
+
<showbreadcrumbs translate="label">
|
73 |
+
<label>Show Breadcrumbs</label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
76 |
+
<sort_order>20</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
</showbreadcrumbs>
|
81 |
+
<itemsperpage translate="label">
|
82 |
+
<label>Articles per Page</label>
|
83 |
+
<comment>The number of articles displayed per page</comment>
|
84 |
+
<frontend_type>text</frontend_type>
|
85 |
+
<sort_order>30</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
</itemsperpage>
|
90 |
+
<itemslimit translate="label">
|
91 |
+
<label>Articles Limit</label>
|
92 |
+
<comment>Limit for the total number of articles</comment>
|
93 |
+
<frontend_type>text</frontend_type>
|
94 |
+
<sort_order>30</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>1</show_in_store>
|
98 |
+
</itemslimit>
|
99 |
+
<showdateofnews translate="label">
|
100 |
+
<label>Show Date of the News</label>
|
101 |
+
<frontend_type>select</frontend_type>
|
102 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
103 |
+
<sort_order>36</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
<show_in_website>1</show_in_website>
|
106 |
+
<show_in_store>1</show_in_store>
|
107 |
+
</showdateofnews>
|
108 |
+
<showtimeofnews translate="label">
|
109 |
+
<label>Show Time of the News</label>
|
110 |
+
<frontend_type>select</frontend_type>
|
111 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
112 |
+
<sort_order>37</sort_order>
|
113 |
+
<show_in_default>1</show_in_default>
|
114 |
+
<show_in_website>1</show_in_website>
|
115 |
+
<show_in_store>1</show_in_store>
|
116 |
+
</showtimeofnews>
|
117 |
+
<showauthorofnews translate="label">
|
118 |
+
<label>Show Author of the News</label>
|
119 |
+
<frontend_type>select</frontend_type>
|
120 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
121 |
+
<sort_order>40</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
</showauthorofnews>
|
126 |
+
<enablelinkrout translate="label">
|
127 |
+
<label>Enable Link "View More"</label>
|
128 |
+
<comment>default: view more</comment>
|
129 |
+
<frontend_type>select</frontend_type>
|
130 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
131 |
+
<sort_order>42</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>1</show_in_store>
|
135 |
+
</enablelinkrout>
|
136 |
+
<linkrout translate="label">
|
137 |
+
<label>Name of the Link</label>
|
138 |
+
<comment>example: view more</comment>
|
139 |
+
<frontend_type>text</frontend_type>
|
140 |
+
<sort_order>41</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
</linkrout>
|
145 |
+
<itemurlsuffix translate="label">
|
146 |
+
<label>News item URL Suffix</label>
|
147 |
+
<comment>example: .html</comment>
|
148 |
+
<frontend_type>text</frontend_type>
|
149 |
+
<sort_order>41</sort_order>
|
150 |
+
<show_in_default>1</show_in_default>
|
151 |
+
<show_in_website>1</show_in_website>
|
152 |
+
<show_in_store>1</show_in_store>
|
153 |
+
</itemurlsuffix>
|
154 |
+
<tags translate="label">
|
155 |
+
<label>Tags on news</label>
|
156 |
+
<frontend_type>select</frontend_type>
|
157 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
158 |
+
<sort_order>42</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
</tags>
|
163 |
+
<printable translate="label">
|
164 |
+
<label>Print able</label>
|
165 |
+
<frontend_type>select</frontend_type>
|
166 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
167 |
+
<sort_order>43</sort_order>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>1</show_in_store>
|
171 |
+
</printable>
|
172 |
+
<metatitle translate="label">
|
173 |
+
<label>Default Meta Title</label>
|
174 |
+
<frontend_type>text</frontend_type>
|
175 |
+
<sort_order>47</sort_order>
|
176 |
+
<show_in_default>1</show_in_default>
|
177 |
+
<show_in_website>1</show_in_website>
|
178 |
+
<show_in_store>1</show_in_store>
|
179 |
+
</metatitle>
|
180 |
+
<metakeywords translate="label">
|
181 |
+
<label>Default Meta Keywords</label>
|
182 |
+
<frontend_type>textarea</frontend_type>
|
183 |
+
<sort_order>50</sort_order>
|
184 |
+
<show_in_default>1</show_in_default>
|
185 |
+
<show_in_website>1</show_in_website>
|
186 |
+
<show_in_store>1</show_in_store>
|
187 |
+
</metakeywords>
|
188 |
+
<metadescription translate="label">
|
189 |
+
<label>Default Meta Description</label>
|
190 |
+
<frontend_type>textarea</frontend_type>
|
191 |
+
<sort_order>60</sort_order>
|
192 |
+
<show_in_default>1</show_in_default>
|
193 |
+
<show_in_website>1</show_in_website>
|
194 |
+
<show_in_store>1</show_in_store>
|
195 |
+
</metadescription>
|
196 |
+
</fields>
|
197 |
+
</news>
|
198 |
+
<comments translate="label">
|
199 |
+
<label>Comments</label>
|
200 |
+
<frontend_type>text</frontend_type>
|
201 |
+
<sort_order>40</sort_order>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>1</show_in_website>
|
204 |
+
<show_in_store>1</show_in_store>
|
205 |
+
<fields>
|
206 |
+
<recipient_email translate="label">
|
207 |
+
<label>Send comments to email</label>
|
208 |
+
<frontend_type>text</frontend_type>
|
209 |
+
<sort_order>40</sort_order>
|
210 |
+
<show_in_default>1</show_in_default>
|
211 |
+
<show_in_website>1</show_in_website>
|
212 |
+
<show_in_store>1</show_in_store>
|
213 |
+
</recipient_email>
|
214 |
+
<sender_email_identity translate="label">
|
215 |
+
<label>Email Sender</label>
|
216 |
+
<frontend_type>select</frontend_type>
|
217 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
218 |
+
<sort_order>50</sort_order>
|
219 |
+
<show_in_default>1</show_in_default>
|
220 |
+
<show_in_website>1</show_in_website>
|
221 |
+
<show_in_store>1</show_in_store>
|
222 |
+
</sender_email_identity>
|
223 |
+
<email_template translate="label">
|
224 |
+
<label>Email Template</label>
|
225 |
+
<frontend_type>select</frontend_type>
|
226 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
227 |
+
<sort_order>60</sort_order>
|
228 |
+
<show_in_default>1</show_in_default>
|
229 |
+
<show_in_website>1</show_in_website>
|
230 |
+
<show_in_store>1</show_in_store>
|
231 |
+
</email_template>
|
232 |
+
<need_confirmation translate="label">
|
233 |
+
<label>Should comments be pre-moderated</label>
|
234 |
+
<frontend_type>select</frontend_type>
|
235 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
236 |
+
<sort_order>70</sort_order>
|
237 |
+
<show_in_default>1</show_in_default>
|
238 |
+
<show_in_website>1</show_in_website>
|
239 |
+
<show_in_store>1</show_in_store>
|
240 |
+
</need_confirmation>
|
241 |
+
<need_login translate="label">
|
242 |
+
<label>Should user be logged in to leave a comment</label>
|
243 |
+
<frontend_type>select</frontend_type>
|
244 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
245 |
+
<sort_order>71</sort_order>
|
246 |
+
<show_in_default>1</show_in_default>
|
247 |
+
<show_in_website>1</show_in_website>
|
248 |
+
<show_in_store>1</show_in_store>
|
249 |
+
</need_login>
|
250 |
+
<commentsperpage translate="label">
|
251 |
+
<label>Comments per Page</label>
|
252 |
+
<comment>The number of comments displayed per page</comment>
|
253 |
+
<frontend_type>text</frontend_type>
|
254 |
+
<sort_order>75</sort_order>
|
255 |
+
<show_in_default>1</show_in_default>
|
256 |
+
<show_in_website>1</show_in_website>
|
257 |
+
<show_in_store>1</show_in_store>
|
258 |
+
</commentsperpage>
|
259 |
+
</fields>
|
260 |
+
</comments>
|
261 |
+
<times>
|
262 |
+
|
263 |
+
</times>
|
264 |
+
<rss translate="label">
|
265 |
+
<label>RSS Feed</label>
|
266 |
+
<frontend_type>text</frontend_type>
|
267 |
+
<sort_order>60</sort_order>
|
268 |
+
<show_in_default>1</show_in_default>
|
269 |
+
<show_in_website>1</show_in_website>
|
270 |
+
<show_in_store>1</show_in_store>
|
271 |
+
<fields>
|
272 |
+
<enable translate="label">
|
273 |
+
<label>Enable</label>
|
274 |
+
<frontend_type>select</frontend_type>
|
275 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
276 |
+
<sort_order>1</sort_order>
|
277 |
+
<show_in_default>1</show_in_default>
|
278 |
+
<show_in_website>1</show_in_website>
|
279 |
+
<show_in_store>1</show_in_store>
|
280 |
+
</enable>
|
281 |
+
<posts translate="label">
|
282 |
+
<label>Articles to show</label>
|
283 |
+
<comment>Number of articles to show in the RSS feed.</comment>
|
284 |
+
<frontend_type>text</frontend_type>
|
285 |
+
<sort_order>2</sort_order>
|
286 |
+
<show_in_default>1</show_in_default>
|
287 |
+
<show_in_website>1</show_in_website>
|
288 |
+
<show_in_store>1</show_in_store>
|
289 |
+
</posts>
|
290 |
+
</fields>
|
291 |
+
</rss>
|
292 |
+
</groups>
|
293 |
+
</offinews>
|
294 |
+
</sections>
|
295 |
+
</config>
|
app/code/community/Officience/News/sql/offinews_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
try {
|
6 |
+
$installer->run("
|
7 |
+
DROP TABLE IF EXISTS {$this->getTable('officience_news')};
|
8 |
+
CREATE TABLE {$this->getTable('officience_news')} (
|
9 |
+
`news_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
10 |
+
`title` varchar(255) NOT NULL DEFAULT '',
|
11 |
+
`identifier` varchar(255) NOT NULL DEFAULT '',
|
12 |
+
`description` text NOT NULL,
|
13 |
+
`full_content` text NOT NULL,
|
14 |
+
`thumbnail` varchar(255) NOT NULL DEFAULT '',
|
15 |
+
`news_status` smallint(6) NOT NULL DEFAULT '0',
|
16 |
+
`created_time` datetime DEFAULT NULL,
|
17 |
+
`update_time` datetime DEFAULT NULL,
|
18 |
+
`publicate_from_date` datetime DEFAULT NULL,
|
19 |
+
`publicate_to_date` datetime DEFAULT NULL,
|
20 |
+
`publicate_from_time` varchar(255) DEFAULT '0',
|
21 |
+
`publicate_to_time` varchar(255) DEFAULT '0',
|
22 |
+
`author` varchar(255) NOT NULL DEFAULT '',
|
23 |
+
`meta_keywords` text NOT NULL,
|
24 |
+
`meta_description` text NOT NULL,
|
25 |
+
`comments_enabled` tinyint(11) NOT NULL,
|
26 |
+
`tags` text NOT NULL,
|
27 |
+
`sort_order` int(11) default '0',
|
28 |
+
PRIMARY KEY ( `news_id` )
|
29 |
+
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
30 |
+
|
31 |
+
|
32 |
+
DROP TABLE IF EXISTS {$this->getTable('officience_comment')};
|
33 |
+
CREATE TABLE {$this->getTable('officience_comment')} (
|
34 |
+
`comment_id` int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
|
35 |
+
`news_id` smallint( 11 ) NOT NULL default '0',
|
36 |
+
`comment` text NOT NULL ,
|
37 |
+
`comment_status` smallint( 6 ) NOT NULL default '0',
|
38 |
+
`created_time` datetime default NULL ,
|
39 |
+
`user` varchar( 255 ) NOT NULL default '',
|
40 |
+
`email` varchar( 255 ) NOT NULL default '',
|
41 |
+
PRIMARY KEY ( `comment_id` )
|
42 |
+
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
43 |
+
|
44 |
+
|
45 |
+
DROP TABLE IF EXISTS {$this->getTable('officience_category')};
|
46 |
+
CREATE TABLE {$this->getTable('officience_category')} (
|
47 |
+
`category_id` int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
|
48 |
+
`title` varchar( 255 ) NOT NULL default '',
|
49 |
+
`description` varchar(255) default '',
|
50 |
+
`display_setting` int(11) default '0' ,
|
51 |
+
`category_status` int(11) default '0',
|
52 |
+
`thumbnail` varchar(255) default '',
|
53 |
+
`identifier` varchar( 255 ) NOT NULL default '',
|
54 |
+
`parent_id` int(11) default '0',
|
55 |
+
`path` varchar(255) default '',
|
56 |
+
`level` varchar(255) default '',
|
57 |
+
`sort_order` int(11) default '0',
|
58 |
+
`meta_keywords` text NOT NULL ,
|
59 |
+
`meta_description` text NOT NULL ,
|
60 |
+
PRIMARY KEY ( `category_id` )
|
61 |
+
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
62 |
+
|
63 |
+
|
64 |
+
DROP TABLE IF EXISTS {$this->getTable('officience_news_store')};
|
65 |
+
CREATE TABLE {$this->getTable('officience_news_store')} (
|
66 |
+
`news_id` int(11) unsigned,
|
67 |
+
`store_id` int(11) unsigned,
|
68 |
+
`title` varchar(255) NOT NULL DEFAULT '',
|
69 |
+
`identifier` varchar(255) NOT NULL DEFAULT '',
|
70 |
+
`description` text NOT NULL,
|
71 |
+
`full_content` text NOT NULL,
|
72 |
+
`news_status` smallint(6) NOT NULL DEFAULT '0',
|
73 |
+
`publicate_from_date` datetime DEFAULT NULL,
|
74 |
+
`publicate_to_date` datetime DEFAULT NULL,
|
75 |
+
`publicate_from_time` varchar(255) DEFAULT '0',
|
76 |
+
`publicate_to_time` varchar(255) DEFAULT '0',
|
77 |
+
`author` varchar(255) NOT NULL DEFAULT '',
|
78 |
+
`meta_keywords` text NOT NULL,
|
79 |
+
`meta_description` text NOT NULL,
|
80 |
+
`comments_enabled` tinyint(11) NOT NULL,
|
81 |
+
`tags` text NOT NULL,
|
82 |
+
`sort_order` int(11) default '0',
|
83 |
+
`default_value` varchar(500) default '',
|
84 |
+
PRIMARY KEY ( `news_id`,`store_id` )
|
85 |
+
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
86 |
+
|
87 |
+
DROP TABLE IF EXISTS {$this->getTable('officience_category_store')};
|
88 |
+
CREATE TABLE {$this->getTable('officience_category_store')} (
|
89 |
+
`category_id` int(11),
|
90 |
+
`store_id` int(11) unsigned,
|
91 |
+
`category_status` int(11) default '0',
|
92 |
+
`path` varchar(255) default '',
|
93 |
+
`display_setting`int(11) default '0' ,
|
94 |
+
`title` varchar( 255 ) NOT NULL default '',
|
95 |
+
`description` varchar(255) default '',
|
96 |
+
`identifier` varchar( 255 ) NOT NULL default '',
|
97 |
+
`sort_order` int(11) default '0',
|
98 |
+
`meta_keywords` text NOT NULL ,
|
99 |
+
`meta_description` text NOT NULL ,
|
100 |
+
`default_value` varchar(500) default '',
|
101 |
+
|
102 |
+
|
103 |
+
PRIMARY KEY ( `category_id`,`store_id` )
|
104 |
+
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
105 |
+
|
106 |
+
DROP TABLE IF EXISTS {$this->getTable('officience_news_category')};
|
107 |
+
CREATE TABLE {$this->getTable('officience_news_category')} (
|
108 |
+
`category_id` int(11)unsigned ,
|
109 |
+
`news_id` int(11)unsigned,
|
110 |
+
PRIMARY KEY ( `category_id`,`news_id` )
|
111 |
+
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
112 |
+
");
|
113 |
+
} catch (Exception $e) {
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
$installer->endSetup();
|
118 |
+
?>
|
app/design/adminhtml/default/default/layout/officience_news.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<layout>
|
3 |
+
<default>
|
4 |
+
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addItem">
|
7 |
+
<type>js_css</type>
|
8 |
+
<name>officience/news/css/newscat.css</name>
|
9 |
+
</action>
|
10 |
+
</reference>
|
11 |
+
|
12 |
+
</default>
|
13 |
+
<offinews_adminhtml_category_edit>
|
14 |
+
<reference name="left">
|
15 |
+
<block type="adminhtml/store_switcher" name="store_switcher" before="-"></block>
|
16 |
+
</reference>
|
17 |
+
<reference name="js">
|
18 |
+
<block type="core/template" name="catalog.wysiwyg.js" template="catalog/wysiwyg/js.phtml"/>
|
19 |
+
</reference>
|
20 |
+
</offinews_adminhtml_category_edit>
|
21 |
+
<offinews_adminhtml_news_edit>
|
22 |
+
<reference name="left">
|
23 |
+
<block type="adminhtml/store_switcher" name="store_switcher" before="-"></block>
|
24 |
+
</reference>
|
25 |
+
<reference name="js">
|
26 |
+
<block type="core/template" name="catalog.wysiwyg.js" template="catalog/wysiwyg/js.phtml"/>
|
27 |
+
</reference>
|
28 |
+
</offinews_adminhtml_news_edit>
|
29 |
+
</layout>
|
app/design/adminhtml/default/default/template/officience/news/listCategory.phtml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<div class="entry-edit-head">
|
3 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('offinews')->__('Category') ?></h4>
|
4 |
+
</div>
|
5 |
+
<fieldset id="grop_fields">
|
6 |
+
<input type="hidden" name="category_ids" id="product_categories" value="<?php echo $this->getIdsString() ?>">
|
7 |
+
|
8 |
+
|
9 |
+
<div class="tree x-tree">
|
10 |
+
<?php $listcategory = $this->getListMenuCatBlog(); ?>
|
11 |
+
<?php if ($listcategory): ?>
|
12 |
+
<ul class="offinews-tree-root-ct">
|
13 |
+
<div class="offinews-tree-root-node">
|
14 |
+
<?php echo $listcategory; ?>
|
15 |
+
</div>
|
16 |
+
</ul>
|
17 |
+
<?php else: ?>
|
18 |
+
error
|
19 |
+
<?php endif; ?>
|
20 |
+
</div>
|
21 |
+
|
22 |
+
</fieldset>
|
23 |
+
|
24 |
+
|
25 |
+
</div>
|
26 |
+
|
27 |
+
|
app/design/frontend/base/default/layout/officience_news.xml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category design_default
|
17 |
+
* @package Mage
|
18 |
+
* @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
-->
|
22 |
+
<layout version="0.1.0">
|
23 |
+
<default>
|
24 |
+
<reference name="root">
|
25 |
+
<action method="setTemplate">
|
26 |
+
<template>page/2columns-right.phtml</template>
|
27 |
+
</action>
|
28 |
+
</reference>
|
29 |
+
<reference name="head">
|
30 |
+
<action method="addItem">
|
31 |
+
<type>skin_css</type>
|
32 |
+
<name>css/officience/news/style.css</name>
|
33 |
+
</action>
|
34 |
+
<action method="addJs">
|
35 |
+
<script>officience/news/jquery-1.4.4.js</script>
|
36 |
+
</action>
|
37 |
+
<action method="addJs">
|
38 |
+
<script>officience/news/noconflict.js</script>
|
39 |
+
</action>
|
40 |
+
</reference>
|
41 |
+
</default>
|
42 |
+
<offinews_index_index>
|
43 |
+
|
44 |
+
<reference name="content">
|
45 |
+
<block type="offinews/category" name="news" template="officience/news/list.phtml"/>
|
46 |
+
</reference>
|
47 |
+
</offinews_index_index>
|
48 |
+
<offinews_index_tag>
|
49 |
+
|
50 |
+
<reference name="content">
|
51 |
+
<block type="offinews/tags" name="news" template="officience/news/list.phtml"/>
|
52 |
+
</reference>
|
53 |
+
</offinews_index_tag>
|
54 |
+
|
55 |
+
<offinews_newspost_view>
|
56 |
+
|
57 |
+
<reference name="content">
|
58 |
+
<block type="offinews/newspost" name="newsitem" template="officience/news/newspost.phtml"/>
|
59 |
+
</reference>
|
60 |
+
</offinews_newspost_view>
|
61 |
+
<offinews_rss_index>
|
62 |
+
<block type="offinews/rss" output="toHtml" name="news.rss"/>
|
63 |
+
</offinews_rss_index>
|
64 |
+
</layout>
|
app/design/frontend/default/default/template/officience/news/list.phtml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2><?php echo $this->__(Mage::getStoreConfig('news/news/title')) ?>
|
2 |
+
<?php if (Mage::helper('offinews')->getRssEnable()): ?>
|
3 |
+
<?php if ($this->getCurrentCategory()): ?>
|
4 |
+
<a href="<?php echo $this->getUrlRss() ?>" target="_blank">
|
5 |
+
<img src="<?php echo $this->getSkinUrl('css/officience/news/images/rss.gif') ?>">
|
6 |
+
</a>
|
7 |
+
<?php endif; ?>
|
8 |
+
<?php endif ?>
|
9 |
+
</h2>
|
10 |
+
<?php if ((Mage::helper('offinews')->getparentcategorydisplaysetting() == '2' && !$this->getCurrentCategory()) || ($this->getCurrentCategory() && $this->getCurrentCategory()->getDisplaySetting() == '1')): ?>
|
11 |
+
<?php $items = $this->getSubCategory() ?>
|
12 |
+
<?php if (count($items->getData()) < 1): ?>
|
13 |
+
<div>Sorry not found item</div>
|
14 |
+
<?php else: ?>
|
15 |
+
<div class="post listing-type-list">
|
16 |
+
<div class="post-listing">
|
17 |
+
<ul>
|
18 |
+
<?php
|
19 |
+
foreach ($items as $item):
|
20 |
+
?>
|
21 |
+
|
22 |
+
<li>
|
23 |
+
<span></span>
|
24 |
+
<?php if ($item->getThumbnail()) { ?>
|
25 |
+
<a href="<?php echo $item->getUrl(); ?>" title="<?php echo $item->getTitle(); ?>" />
|
26 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $item->getThumbnail(); ?>" alt="<?php echo $item->getTitle(); ?>" />
|
27 |
+
</a>
|
28 |
+
<?php } ?>
|
29 |
+
<h2>
|
30 |
+
<a href="<?php echo $item->getUrl(); ?>"><?php echo $item->getTitle(); ?></a>
|
31 |
+
</h2>
|
32 |
+
</li>
|
33 |
+
<?php
|
34 |
+
endforeach;
|
35 |
+
?>
|
36 |
+
</ul>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
<?php endif; ?>
|
40 |
+
<?php else: ?>
|
41 |
+
<?php $items = $this->getNewsPost() ?>
|
42 |
+
<?php if (!$items->getData()): ?>
|
43 |
+
<div>Sorry not found item</div>
|
44 |
+
<?php else: ?>
|
45 |
+
|
46 |
+
<div class="post listing-type-list">
|
47 |
+
<div class="post-listing">
|
48 |
+
<?php
|
49 |
+
foreach ($items as $item):
|
50 |
+
?>
|
51 |
+
|
52 |
+
<div class="post-item">
|
53 |
+
<?php if ($item->getThumbnail()) { ?>
|
54 |
+
<a href="<?php echo $item->getUrl(); ?>" title="<?php echo $item->getTitle(); ?>" />
|
55 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $item->getThumbnail(); ?>" alt="<?php echo $item->getTitle(); ?>" />
|
56 |
+
</a>
|
57 |
+
<?php } ?>
|
58 |
+
<div class="post-item-top">
|
59 |
+
<?php if (Mage::helper('offinews')->showDate()): ?>
|
60 |
+
<span class="date"><?php echo Mage::helper('offinews')->formatDate($item->getNewsTime()) ?></span>
|
61 |
+
<?php endif; ?>
|
62 |
+
<?php if ($item->getAuthor()): ?>
|
63 |
+
<span class="author"> <?php if (Mage::helper('offinews')->showAuthor()): ?>By : <?php echo $item->getAuthor() ?><?php endif; ?></span>
|
64 |
+
<?php endif; ?>
|
65 |
+
<?php if ($item->getCommentsEnabled()): ?>
|
66 |
+
<a href="<?php echo $item->getUrl() ?>#commentBox" class="comment"><?php echo $item->getCommentsCount(); ?> <?php echo $this->__('Comment(s)') ?></a>
|
67 |
+
<?php endif; ?>
|
68 |
+
</div>
|
69 |
+
<div class="post-title">
|
70 |
+
<a href="<?php echo $item->getUrl(); ?>"><?php echo $item->getTitle(); ?></a>
|
71 |
+
</div>
|
72 |
+
<div class="post-desc">
|
73 |
+
<?php echo $item->getDescription(); ?>
|
74 |
+
<?php if (Mage::helper('offinews')->enableLinkRoute()): ?>
|
75 |
+
<?php if ($link = Mage::helper('offinews')->getLinkRoute()): ?>
|
76 |
+
<a href="<?php echo $item->getUrl($this->getCategory()) ?>" class="more"><?php echo $link . '»'; ?></a>
|
77 |
+
<?php else: ?>
|
78 |
+
<a href="<?php echo $item->getUrl($this->getCategory()) ?>" class="more"><?php echo Mage::helper('offinews')->getLinkRoute() . '»'; ?></a>
|
79 |
+
<?php endif; ?>
|
80 |
+
<?php endif; ?>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
<?php
|
84 |
+
endforeach;
|
85 |
+
?>
|
86 |
+
<?php echo $this->getPages(); ?>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
<?php endif; ?>
|
90 |
+
<?php endif; ?>
|
app/design/frontend/default/default/template/officience/news/menu.phtml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<ul>
|
2 |
+
<?php echo $this->getMenu(); ?>
|
3 |
+
</ul>
|
app/design/frontend/default/default/template/officience/news/newspost.phtml
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $item = $this->getNewsPost(); ?>
|
2 |
+
<h3><?php echo $item->getTitle() ?></h3>
|
3 |
+
<div class="post-item-top">
|
4 |
+
<?php if (Mage::helper('offinews')->showDate()): ?>
|
5 |
+
<span class="date"><?php echo $item->getTimePublic() ?></span>
|
6 |
+
<?php endif; ?>
|
7 |
+
<?php if (Mage::helper('offinews')->showAuthor()): ?>
|
8 |
+
<?php if ($item->getAuthor()): ?>
|
9 |
+
<span class="author">by <?php echo $item->getAuthor() ?></span>
|
10 |
+
<?php endif ?>
|
11 |
+
<?php endif; ?>
|
12 |
+
<?php if (Mage::helper('offinews')->getPrintEnable()): ?>
|
13 |
+
<div class="social">
|
14 |
+
<a href="<?php echo $item->getUrlPrint() ?>" class="print-btn"><?php echo $this->__('Print Version'); ?></a>
|
15 |
+
</div>
|
16 |
+
<?php endif; ?>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<div class="news">
|
20 |
+
<?php echo $this->contentFilter($item->getFullContent()); ?>
|
21 |
+
</div>
|
22 |
+
|
23 |
+
<p>
|
24 |
+
<?php if (Mage::helper('offinews')->getTagsAccess()): ?>
|
25 |
+
<?php if ($item->getTags()): ?>
|
26 |
+
<?php $arr = preg_split('/,/', $item->getTags()); ?>
|
27 |
+
<?php $tags = ''; ?>
|
28 |
+
<?php $count = count($arr); ?>
|
29 |
+
<?php $k = 1; ?>
|
30 |
+
<?php foreach ($arr as $val): ?>
|
31 |
+
<?php $valtag = str_replace(" ", '-', $val); ?>
|
32 |
+
<?php $tags .= '<a href="' . $this->getUrl(Mage::helper('offinews')->getRoute() . '/tag') . $valtag . Mage::helper('offinews')->getNewsitemUrlSuffix() . '" >' . $val . '</a> '; ?>
|
33 |
+
<?php if ($k != $count): ?>
|
34 |
+
<?php $tags .= ', '; ?>
|
35 |
+
<?php endif; ?>
|
36 |
+
<?php $k++; ?>
|
37 |
+
<?php endforeach; ?>
|
38 |
+
<img src="<?php echo $this->getSkinUrl('css/offinews/images/i-tags.gif') ?>"/> <?php echo $tags; ?>
|
39 |
+
<?php endif; ?>
|
40 |
+
<?php endif; ?>
|
41 |
+
</p>
|
42 |
+
|
43 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
|
44 |
+
|
45 |
+
<div class="news-item-comment">
|
46 |
+
|
47 |
+
<?php if ($item->getCommentsEnabled()): ?>
|
48 |
+
<?php $comments = $this->getComments(); ?>
|
49 |
+
<div>
|
50 |
+
<a name="commentBox" ></a>
|
51 |
+
<h2><?php echo $this->getCommentTotalString($comments); ?></h2>
|
52 |
+
</div>
|
53 |
+
<div id="clloader" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/offinews/ajax-loader.gif') ?>"/></div>
|
54 |
+
<div id="comment_block">
|
55 |
+
<?php $k = 0; ?>
|
56 |
+
<?php foreach ($comments as $comment): ?>
|
57 |
+
<div id="comment_item_<?php echo $k; ?>" class="comment-item">
|
58 |
+
<h4 class="username"><?php echo $comment->getUser(); ?></h4>
|
59 |
+
<?php echo $this->__("posted on") ?> <?php echo Mage::helper('offinews')->formatDate($comment->getCreatedTime()); ?>
|
60 |
+
<div><?php echo $comment->getComment(); ?></div>
|
61 |
+
</div>
|
62 |
+
<?php $k++; ?>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
</div>
|
65 |
+
<?php //if (!Mage::helper('offinews')->getRequireLogin() || (Mage::helper('offinews')->getRequireLogin() && $this->helper('customer')->isLoggedIn())): ?>
|
66 |
+
<form id="postComment" method="post" action="">
|
67 |
+
<h4><?php echo Mage::helper('offinews')->__('Comment') ?></h4>
|
68 |
+
<ul>
|
69 |
+
<li>
|
70 |
+
<?php if (!Mage::helper('customer')->isLoggedIn()): ?>
|
71 |
+
<div class="input-box">
|
72 |
+
<label for="name"><?php echo Mage::helper('offinews')->__('Name') ?> <span class="required">*</span></label>
|
73 |
+
<input name="user" id="user" value="<?php echo $this->getCommentName(); ?>" title="<?php echo $this->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('offinews')->getUserName()) ?>" class="required-entry input-text" type="text" />
|
74 |
+
</div>
|
75 |
+
<div class="clear"></div>
|
76 |
+
|
77 |
+
<div class="input-box">
|
78 |
+
<label for="email"><?php echo Mage::helper('offinews')->__('Email') ?> <span class="required">*</span></label>
|
79 |
+
<input name="email" id="email" value="<?php echo $this->getCommentEmail(); ?>" title="<?php echo $this->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('offinews')->getUserEmail()) ?>" class="required-entry input-text validate-email" type="text" />
|
80 |
+
</div>
|
81 |
+
<?php else: ?>
|
82 |
+
<input name="email" type="hidden" value="<?php echo $this->htmlEscape(Mage::helper('offinews')->getUserEmail()) ?>"/><br/>
|
83 |
+
<input name="user" type="hidden" value="<?php echo $this->htmlEscape(Mage::helper('offinews')->getUserName()) ?>"/><br/>
|
84 |
+
<?php endif ?>
|
85 |
+
<div class="clear"></div>
|
86 |
+
<div class="input-box">
|
87 |
+
<label for="comment"><?php echo Mage::helper('offinews')->__('Comment') ?> <span class="required">*</span></label>
|
88 |
+
<textarea name="comment" id="comment" title="<?php echo Mage::helper('offinews')->__('Comment') ?>" class="required-entry input-text" style="height:150px;width:400px;" cols="50" rows="5"><?php echo $this->getCommentText(); ?></textarea>
|
89 |
+
</div>
|
90 |
+
</li>
|
91 |
+
<?php if (Mage::helper('offinews')->getCaptchaEnable()): ?>
|
92 |
+
<!-- - -->
|
93 |
+
<?php endif ?>
|
94 |
+
</li>
|
95 |
+
</ul>
|
96 |
+
<div class="button-set">
|
97 |
+
<input name="news_id" type="hidden" value="<?php echo $item->getId() ?>" />
|
98 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
99 |
+
<button class="button" type="submit"><span><span><?php echo Mage::helper('offinews')->__('Submit Comment') ?></span></span></button>
|
100 |
+
</div>
|
101 |
+
</form>
|
102 |
+
|
103 |
+
<script type="text/javascript">
|
104 |
+
var contactForm = new VarienForm('postComment', false);
|
105 |
+
</script>
|
106 |
+
<?php else: ?>
|
107 |
+
<p><?php echo Mage::helper('offinews')->__('You must be logged in to post a comment.'); ?></p>
|
108 |
+
<p><a href="<?php echo Mage::helper('customer')->getLoginUrl(); ?>"><?php echo Mage::helper('offinews')->__('click here'); ?></a> <?php echo Mage::helper('offinews')->__('to log in'); ?></p>
|
109 |
+
<?php endif; ?>
|
110 |
+
<?php //endif; ?>
|
111 |
+
</div>
|
app/design/frontend/default/default/template/officience/news/print.phtml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
|
3 |
+
<head>
|
4 |
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
5 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('css/print.css'); ?>" media="print">
|
6 |
+
<script type="text/javascript" src="<?php echo $this->getJsUrl(); ?>officience/jquery-1.4.2.min.js"></script>
|
7 |
+
<style type="text/css">
|
8 |
+
body {font:9pt Arial, Helvetica, sans-serif;padding:15px;}
|
9 |
+
a {color:#2976c9;}
|
10 |
+
.print-head {height:50px;}
|
11 |
+
.logo {float:left;margin-right:150px;}
|
12 |
+
h4 {clear:both;font-size:10pt;}
|
13 |
+
.print {float:left;margin-top:15px;}
|
14 |
+
.print img {border:none;margin:2px 4px -2px 0;}
|
15 |
+
</style>
|
16 |
+
</head>
|
17 |
+
<body class="page-print<?php echo $this->getBodyClass()?$this->getBodyClass():'' ?>">
|
18 |
+
<div>
|
19 |
+
<div class="print-head">
|
20 |
+
<img src="<?php echo $this->getPrintLogoUrl() ? $this->getPrintLogoUrl() : $this->getSkinUrl('images/logo_print.gif') ?>" class="logo" alt="" />
|
21 |
+
<?php if ($this->getPrintLogoText()):?>
|
22 |
+
<address><?php echo nl2br($this->htmlEscape($this->getPrintLogoText())) ?></address>
|
23 |
+
<?php endif;?>
|
24 |
+
|
25 |
+
<a href="javascript:window.print();" class="print"><img class="ic_print" height="16" width="16" alt="" title="" src="<? echo $this->getSkinUrl('images/i_print.gif'); ?>"><?php echo $this->__('Print') ?></a>
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<?php $item = $this->getNewsPost(); ?>
|
29 |
+
<h4><?php echo $item->getTitle() ?></h4>
|
30 |
+
<?php if (Mage::helper('offinews')->showDate()): ?>
|
31 |
+
<span class="date"><?php echo Mage::helper('offinews')->formatDate($item->getNewsTime()) ?></span>
|
32 |
+
<?php endif; ?>
|
33 |
+
<?php if (Mage::helper('offinews')->showCategory() && ($this->getCategoryByNews($item->getID())->getData('title')!='')): ?>
|
34 |
+
<span class="date"> | <?php echo $this->getCategoryByNews($item->getID())->getData('title'); ?></span>
|
35 |
+
<?php endif; ?>
|
36 |
+
<?php echo $item->getFullContent(); ?>
|
37 |
+
<?php echo $this->getAbsoluteFooter(); ?>
|
38 |
+
</div>
|
39 |
+
</body>
|
40 |
+
</html>
|
app/etc/modules/Officience_News.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Officience_News>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Officience_News>
|
8 |
+
</modules>
|
9 |
+
</config>
|
js/officience/news/css/images/folder.gif
ADDED
Binary file
|
js/officience/news/css/newscat.css
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.offinews-node-leaf .offinews-node-icon{
|
2 |
+
border: 0 none;
|
3 |
+
height: 25px;
|
4 |
+
margin: 0;
|
5 |
+
padding: 0;
|
6 |
+
vertical-align: middle;
|
7 |
+
width: 16px;
|
8 |
+
background: url("images/folder.gif") no-repeat scroll 0 50% rgba(0, 0, 0, 0);
|
9 |
+
}
|
10 |
+
.offinews-tree-root-ct li.parent ul{
|
11 |
+
margin-left: 10px;
|
12 |
+
}
|
13 |
+
.offinews-tree-root-ct a span{
|
14 |
+
color: #000000;
|
15 |
+
padding: 1px 3px 1px 2px;
|
16 |
+
|
17 |
+
}
|
18 |
+
.offinews-tree-root-ct a,.offinews-tree-root-ct a:hover{
|
19 |
+
text-decoration: none;
|
20 |
+
}
|
21 |
+
|
js/officience/news/jquery-1.4.4.js
ADDED
@@ -0,0 +1,7180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery JavaScript Library v1.4.4
|
3 |
+
* http://jquery.com/
|
4 |
+
*
|
5 |
+
* Copyright 2010, John Resig
|
6 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
7 |
+
* http://jquery.org/license
|
8 |
+
*
|
9 |
+
* Includes Sizzle.js
|
10 |
+
* http://sizzlejs.com/
|
11 |
+
* Copyright 2010, The Dojo Foundation
|
12 |
+
* Released under the MIT, BSD, and GPL Licenses.
|
13 |
+
*
|
14 |
+
* Date: Thu Nov 11 19:04:53 2010 -0500
|
15 |
+
*/
|
16 |
+
(function( window, undefined ) {
|
17 |
+
|
18 |
+
// Use the correct document accordingly with window argument (sandbox)
|
19 |
+
var document = window.document;
|
20 |
+
var jQuery = (function() {
|
21 |
+
|
22 |
+
// Define a local copy of jQuery
|
23 |
+
var jQuery = function( selector, context ) {
|
24 |
+
// The jQuery object is actually just the init constructor 'enhanced'
|
25 |
+
return new jQuery.fn.init( selector, context );
|
26 |
+
},
|
27 |
+
|
28 |
+
// Map over jQuery in case of overwrite
|
29 |
+
_jQuery = window.jQuery,
|
30 |
+
|
31 |
+
// Map over the $ in case of overwrite
|
32 |
+
_$ = window.$,
|
33 |
+
|
34 |
+
// A central reference to the root jQuery(document)
|
35 |
+
rootjQuery,
|
36 |
+
|
37 |
+
// A simple way to check for HTML strings or ID strings
|
38 |
+
// (both of which we optimize for)
|
39 |
+
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
|
40 |
+
|
41 |
+
// Is it a simple selector
|
42 |
+
isSimple = /^.[^:#\[\.,]*$/,
|
43 |
+
|
44 |
+
// Check if a string has a non-whitespace character in it
|
45 |
+
rnotwhite = /\S/,
|
46 |
+
rwhite = /\s/,
|
47 |
+
|
48 |
+
// Used for trimming whitespace
|
49 |
+
trimLeft = /^\s+/,
|
50 |
+
trimRight = /\s+$/,
|
51 |
+
|
52 |
+
// Check for non-word characters
|
53 |
+
rnonword = /\W/,
|
54 |
+
|
55 |
+
// Check for digits
|
56 |
+
rdigit = /\d/,
|
57 |
+
|
58 |
+
// Match a standalone tag
|
59 |
+
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
|
60 |
+
|
61 |
+
// JSON RegExp
|
62 |
+
rvalidchars = /^[\],:{}\s]*$/,
|
63 |
+
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
|
64 |
+
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
65 |
+
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
66 |
+
|
67 |
+
// Useragent RegExp
|
68 |
+
rwebkit = /(webkit)[ \/]([\w.]+)/,
|
69 |
+
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
|
70 |
+
rmsie = /(msie) ([\w.]+)/,
|
71 |
+
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
72 |
+
|
73 |
+
// Keep a UserAgent string for use with jQuery.browser
|
74 |
+
userAgent = navigator.userAgent,
|
75 |
+
|
76 |
+
// For matching the engine and version of the browser
|
77 |
+
browserMatch,
|
78 |
+
|
79 |
+
// Has the ready events already been bound?
|
80 |
+
readyBound = false,
|
81 |
+
|
82 |
+
// The functions to execute on DOM ready
|
83 |
+
readyList = [],
|
84 |
+
|
85 |
+
// The ready event handler
|
86 |
+
DOMContentLoaded,
|
87 |
+
|
88 |
+
// Save a reference to some core methods
|
89 |
+
toString = Object.prototype.toString,
|
90 |
+
hasOwn = Object.prototype.hasOwnProperty,
|
91 |
+
push = Array.prototype.push,
|
92 |
+
slice = Array.prototype.slice,
|
93 |
+
trim = String.prototype.trim,
|
94 |
+
indexOf = Array.prototype.indexOf,
|
95 |
+
|
96 |
+
// [[Class]] -> type pairs
|
97 |
+
class2type = {};
|
98 |
+
|
99 |
+
jQuery.fn = jQuery.prototype = {
|
100 |
+
init: function( selector, context ) {
|
101 |
+
var match, elem, ret, doc;
|
102 |
+
|
103 |
+
// Handle $(""), $(null), or $(undefined)
|
104 |
+
if ( !selector ) {
|
105 |
+
return this;
|
106 |
+
}
|
107 |
+
|
108 |
+
// Handle $(DOMElement)
|
109 |
+
if ( selector.nodeType ) {
|
110 |
+
this.context = this[0] = selector;
|
111 |
+
this.length = 1;
|
112 |
+
return this;
|
113 |
+
}
|
114 |
+
|
115 |
+
// The body element only exists once, optimize finding it
|
116 |
+
if ( selector === "body" && !context && document.body ) {
|
117 |
+
this.context = document;
|
118 |
+
this[0] = document.body;
|
119 |
+
this.selector = "body";
|
120 |
+
this.length = 1;
|
121 |
+
return this;
|
122 |
+
}
|
123 |
+
|
124 |
+
// Handle HTML strings
|
125 |
+
if ( typeof selector === "string" ) {
|
126 |
+
// Are we dealing with HTML string or an ID?
|
127 |
+
match = quickExpr.exec( selector );
|
128 |
+
|
129 |
+
// Verify a match, and that no context was specified for #id
|
130 |
+
if ( match && (match[1] || !context) ) {
|
131 |
+
|
132 |
+
// HANDLE: $(html) -> $(array)
|
133 |
+
if ( match[1] ) {
|
134 |
+
doc = (context ? context.ownerDocument || context : document);
|
135 |
+
|
136 |
+
// If a single string is passed in and it's a single tag
|
137 |
+
// just do a createElement and skip the rest
|
138 |
+
ret = rsingleTag.exec( selector );
|
139 |
+
|
140 |
+
if ( ret ) {
|
141 |
+
if ( jQuery.isPlainObject( context ) ) {
|
142 |
+
selector = [ document.createElement( ret[1] ) ];
|
143 |
+
jQuery.fn.attr.call( selector, context, true );
|
144 |
+
|
145 |
+
} else {
|
146 |
+
selector = [ doc.createElement( ret[1] ) ];
|
147 |
+
}
|
148 |
+
|
149 |
+
} else {
|
150 |
+
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
|
151 |
+
selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
|
152 |
+
}
|
153 |
+
|
154 |
+
return jQuery.merge( this, selector );
|
155 |
+
|
156 |
+
// HANDLE: $("#id")
|
157 |
+
} else {
|
158 |
+
elem = document.getElementById( match[2] );
|
159 |
+
|
160 |
+
// Check parentNode to catch when Blackberry 4.6 returns
|
161 |
+
// nodes that are no longer in the document #6963
|
162 |
+
if ( elem && elem.parentNode ) {
|
163 |
+
// Handle the case where IE and Opera return items
|
164 |
+
// by name instead of ID
|
165 |
+
if ( elem.id !== match[2] ) {
|
166 |
+
return rootjQuery.find( selector );
|
167 |
+
}
|
168 |
+
|
169 |
+
// Otherwise, we inject the element directly into the jQuery object
|
170 |
+
this.length = 1;
|
171 |
+
this[0] = elem;
|
172 |
+
}
|
173 |
+
|
174 |
+
this.context = document;
|
175 |
+
this.selector = selector;
|
176 |
+
return this;
|
177 |
+
}
|
178 |
+
|
179 |
+
// HANDLE: $("TAG")
|
180 |
+
} else if ( !context && !rnonword.test( selector ) ) {
|
181 |
+
this.selector = selector;
|
182 |
+
this.context = document;
|
183 |
+
selector = document.getElementsByTagName( selector );
|
184 |
+
return jQuery.merge( this, selector );
|
185 |
+
|
186 |
+
// HANDLE: $(expr, $(...))
|
187 |
+
} else if ( !context || context.jquery ) {
|
188 |
+
return (context || rootjQuery).find( selector );
|
189 |
+
|
190 |
+
// HANDLE: $(expr, context)
|
191 |
+
// (which is just equivalent to: $(context).find(expr)
|
192 |
+
} else {
|
193 |
+
return jQuery( context ).find( selector );
|
194 |
+
}
|
195 |
+
|
196 |
+
// HANDLE: $(function)
|
197 |
+
// Shortcut for document ready
|
198 |
+
} else if ( jQuery.isFunction( selector ) ) {
|
199 |
+
return rootjQuery.ready( selector );
|
200 |
+
}
|
201 |
+
|
202 |
+
if (selector.selector !== undefined) {
|
203 |
+
this.selector = selector.selector;
|
204 |
+
this.context = selector.context;
|
205 |
+
}
|
206 |
+
|
207 |
+
return jQuery.makeArray( selector, this );
|
208 |
+
},
|
209 |
+
|
210 |
+
// Start with an empty selector
|
211 |
+
selector: "",
|
212 |
+
|
213 |
+
// The current version of jQuery being used
|
214 |
+
jquery: "1.4.4",
|
215 |
+
|
216 |
+
// The default length of a jQuery object is 0
|
217 |
+
length: 0,
|
218 |
+
|
219 |
+
// The number of elements contained in the matched element set
|
220 |
+
size: function() {
|
221 |
+
return this.length;
|
222 |
+
},
|
223 |
+
|
224 |
+
toArray: function() {
|
225 |
+
return slice.call( this, 0 );
|
226 |
+
},
|
227 |
+
|
228 |
+
// Get the Nth element in the matched element set OR
|
229 |
+
// Get the whole matched element set as a clean array
|
230 |
+
get: function( num ) {
|
231 |
+
return num == null ?
|
232 |
+
|
233 |
+
// Return a 'clean' array
|
234 |
+
this.toArray() :
|
235 |
+
|
236 |
+
// Return just the object
|
237 |
+
( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
|
238 |
+
},
|
239 |
+
|
240 |
+
// Take an array of elements and push it onto the stack
|
241 |
+
// (returning the new matched element set)
|
242 |
+
pushStack: function( elems, name, selector ) {
|
243 |
+
// Build a new jQuery matched element set
|
244 |
+
var ret = jQuery();
|
245 |
+
|
246 |
+
if ( jQuery.isArray( elems ) ) {
|
247 |
+
push.apply( ret, elems );
|
248 |
+
|
249 |
+
} else {
|
250 |
+
jQuery.merge( ret, elems );
|
251 |
+
}
|
252 |
+
|
253 |
+
// Add the old object onto the stack (as a reference)
|
254 |
+
ret.prevObject = this;
|
255 |
+
|
256 |
+
ret.context = this.context;
|
257 |
+
|
258 |
+
if ( name === "find" ) {
|
259 |
+
ret.selector = this.selector + (this.selector ? " " : "") + selector;
|
260 |
+
} else if ( name ) {
|
261 |
+
ret.selector = this.selector + "." + name + "(" + selector + ")";
|
262 |
+
}
|
263 |
+
|
264 |
+
// Return the newly-formed element set
|
265 |
+
return ret;
|
266 |
+
},
|
267 |
+
|
268 |
+
// Execute a callback for every element in the matched set.
|
269 |
+
// (You can seed the arguments with an array of args, but this is
|
270 |
+
// only used internally.)
|
271 |
+
each: function( callback, args ) {
|
272 |
+
return jQuery.each( this, callback, args );
|
273 |
+
},
|
274 |
+
|
275 |
+
ready: function( fn ) {
|
276 |
+
// Attach the listeners
|
277 |
+
jQuery.bindReady();
|
278 |
+
|
279 |
+
// If the DOM is already ready
|
280 |
+
if ( jQuery.isReady ) {
|
281 |
+
// Execute the function immediately
|
282 |
+
fn.call( document, jQuery );
|
283 |
+
|
284 |
+
// Otherwise, remember the function for later
|
285 |
+
} else if ( readyList ) {
|
286 |
+
// Add the function to the wait list
|
287 |
+
readyList.push( fn );
|
288 |
+
}
|
289 |
+
|
290 |
+
return this;
|
291 |
+
},
|
292 |
+
|
293 |
+
eq: function( i ) {
|
294 |
+
return i === -1 ?
|
295 |
+
this.slice( i ) :
|
296 |
+
this.slice( i, +i + 1 );
|
297 |
+
},
|
298 |
+
|
299 |
+
first: function() {
|
300 |
+
return this.eq( 0 );
|
301 |
+
},
|
302 |
+
|
303 |
+
last: function() {
|
304 |
+
return this.eq( -1 );
|
305 |
+
},
|
306 |
+
|
307 |
+
slice: function() {
|
308 |
+
return this.pushStack( slice.apply( this, arguments ),
|
309 |
+
"slice", slice.call(arguments).join(",") );
|
310 |
+
},
|
311 |
+
|
312 |
+
map: function( callback ) {
|
313 |
+
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
314 |
+
return callback.call( elem, i, elem );
|
315 |
+
}));
|
316 |
+
},
|
317 |
+
|
318 |
+
end: function() {
|
319 |
+
return this.prevObject || jQuery(null);
|
320 |
+
},
|
321 |
+
|
322 |
+
// For internal use only.
|
323 |
+
// Behaves like an Array's method, not like a jQuery method.
|
324 |
+
push: push,
|
325 |
+
sort: [].sort,
|
326 |
+
splice: [].splice
|
327 |
+
};
|
328 |
+
|
329 |
+
// Give the init function the jQuery prototype for later instantiation
|
330 |
+
jQuery.fn.init.prototype = jQuery.fn;
|
331 |
+
|
332 |
+
jQuery.extend = jQuery.fn.extend = function() {
|
333 |
+
var options, name, src, copy, copyIsArray, clone,
|
334 |
+
target = arguments[0] || {},
|
335 |
+
i = 1,
|
336 |
+
length = arguments.length,
|
337 |
+
deep = false;
|
338 |
+
|
339 |
+
// Handle a deep copy situation
|
340 |
+
if ( typeof target === "boolean" ) {
|
341 |
+
deep = target;
|
342 |
+
target = arguments[1] || {};
|
343 |
+
// skip the boolean and the target
|
344 |
+
i = 2;
|
345 |
+
}
|
346 |
+
|
347 |
+
// Handle case when target is a string or something (possible in deep copy)
|
348 |
+
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
349 |
+
target = {};
|
350 |
+
}
|
351 |
+
|
352 |
+
// extend jQuery itself if only one argument is passed
|
353 |
+
if ( length === i ) {
|
354 |
+
target = this;
|
355 |
+
--i;
|
356 |
+
}
|
357 |
+
|
358 |
+
for ( ; i < length; i++ ) {
|
359 |
+
// Only deal with non-null/undefined values
|
360 |
+
if ( (options = arguments[ i ]) != null ) {
|
361 |
+
// Extend the base object
|
362 |
+
for ( name in options ) {
|
363 |
+
src = target[ name ];
|
364 |
+
copy = options[ name ];
|
365 |
+
|
366 |
+
// Prevent never-ending loop
|
367 |
+
if ( target === copy ) {
|
368 |
+
continue;
|
369 |
+
}
|
370 |
+
|
371 |
+
// Recurse if we're merging plain objects or arrays
|
372 |
+
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
373 |
+
if ( copyIsArray ) {
|
374 |
+
copyIsArray = false;
|
375 |
+
clone = src && jQuery.isArray(src) ? src : [];
|
376 |
+
|
377 |
+
} else {
|
378 |
+
clone = src && jQuery.isPlainObject(src) ? src : {};
|
379 |
+
}
|
380 |
+
|
381 |
+
// Never move original objects, clone them
|
382 |
+
target[ name ] = jQuery.extend( deep, clone, copy );
|
383 |
+
|
384 |
+
// Don't bring in undefined values
|
385 |
+
} else if ( copy !== undefined ) {
|
386 |
+
target[ name ] = copy;
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
// Return the modified object
|
393 |
+
return target;
|
394 |
+
};
|
395 |
+
|
396 |
+
jQuery.extend({
|
397 |
+
noConflict: function( deep ) {
|
398 |
+
window.$ = _$;
|
399 |
+
|
400 |
+
if ( deep ) {
|
401 |
+
window.jQuery = _jQuery;
|
402 |
+
}
|
403 |
+
|
404 |
+
return jQuery;
|
405 |
+
},
|
406 |
+
|
407 |
+
// Is the DOM ready to be used? Set to true once it occurs.
|
408 |
+
isReady: false,
|
409 |
+
|
410 |
+
// A counter to track how many items to wait for before
|
411 |
+
// the ready event fires. See #6781
|
412 |
+
readyWait: 1,
|
413 |
+
|
414 |
+
// Handle when the DOM is ready
|
415 |
+
ready: function( wait ) {
|
416 |
+
// A third-party is pushing the ready event forwards
|
417 |
+
if ( wait === true ) {
|
418 |
+
jQuery.readyWait--;
|
419 |
+
}
|
420 |
+
|
421 |
+
// Make sure that the DOM is not already loaded
|
422 |
+
if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
|
423 |
+
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
424 |
+
if ( !document.body ) {
|
425 |
+
return setTimeout( jQuery.ready, 1 );
|
426 |
+
}
|
427 |
+
|
428 |
+
// Remember that the DOM is ready
|
429 |
+
jQuery.isReady = true;
|
430 |
+
|
431 |
+
// If a normal DOM Ready event fired, decrement, and wait if need be
|
432 |
+
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
433 |
+
return;
|
434 |
+
}
|
435 |
+
|
436 |
+
// If there are functions bound, to execute
|
437 |
+
if ( readyList ) {
|
438 |
+
// Execute all of them
|
439 |
+
var fn,
|
440 |
+
i = 0,
|
441 |
+
ready = readyList;
|
442 |
+
|
443 |
+
// Reset the list of functions
|
444 |
+
readyList = null;
|
445 |
+
|
446 |
+
while ( (fn = ready[ i++ ]) ) {
|
447 |
+
fn.call( document, jQuery );
|
448 |
+
}
|
449 |
+
|
450 |
+
// Trigger any bound ready events
|
451 |
+
if ( jQuery.fn.trigger ) {
|
452 |
+
jQuery( document ).trigger( "ready" ).unbind( "ready" );
|
453 |
+
}
|
454 |
+
}
|
455 |
+
}
|
456 |
+
},
|
457 |
+
|
458 |
+
bindReady: function() {
|
459 |
+
if ( readyBound ) {
|
460 |
+
return;
|
461 |
+
}
|
462 |
+
|
463 |
+
readyBound = true;
|
464 |
+
|
465 |
+
// Catch cases where $(document).ready() is called after the
|
466 |
+
// browser event has already occurred.
|
467 |
+
if ( document.readyState === "complete" ) {
|
468 |
+
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
469 |
+
return setTimeout( jQuery.ready, 1 );
|
470 |
+
}
|
471 |
+
|
472 |
+
// Mozilla, Opera and webkit nightlies currently support this event
|
473 |
+
if ( document.addEventListener ) {
|
474 |
+
// Use the handy event callback
|
475 |
+
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
476 |
+
|
477 |
+
// A fallback to window.onload, that will always work
|
478 |
+
window.addEventListener( "load", jQuery.ready, false );
|
479 |
+
|
480 |
+
// If IE event model is used
|
481 |
+
} else if ( document.attachEvent ) {
|
482 |
+
// ensure firing before onload,
|
483 |
+
// maybe late but safe also for iframes
|
484 |
+
document.attachEvent("onreadystatechange", DOMContentLoaded);
|
485 |
+
|
486 |
+
// A fallback to window.onload, that will always work
|
487 |
+
window.attachEvent( "onload", jQuery.ready );
|
488 |
+
|
489 |
+
// If IE and not a frame
|
490 |
+
// continually check to see if the document is ready
|
491 |
+
var toplevel = false;
|
492 |
+
|
493 |
+
try {
|
494 |
+
toplevel = window.frameElement == null;
|
495 |
+
} catch(e) {}
|
496 |
+
|
497 |
+
if ( document.documentElement.doScroll && toplevel ) {
|
498 |
+
doScrollCheck();
|
499 |
+
}
|
500 |
+
}
|
501 |
+
},
|
502 |
+
|
503 |
+
// See test/unit/core.js for details concerning isFunction.
|
504 |
+
// Since version 1.3, DOM methods and functions like alert
|
505 |
+
// aren't supported. They return false on IE (#2968).
|
506 |
+
isFunction: function( obj ) {
|
507 |
+
return jQuery.type(obj) === "function";
|
508 |
+
},
|
509 |
+
|
510 |
+
isArray: Array.isArray || function( obj ) {
|
511 |
+
return jQuery.type(obj) === "array";
|
512 |
+
},
|
513 |
+
|
514 |
+
// A crude way of determining if an object is a window
|
515 |
+
isWindow: function( obj ) {
|
516 |
+
return obj && typeof obj === "object" && "setInterval" in obj;
|
517 |
+
},
|
518 |
+
|
519 |
+
isNaN: function( obj ) {
|
520 |
+
return obj == null || !rdigit.test( obj ) || isNaN( obj );
|
521 |
+
},
|
522 |
+
|
523 |
+
type: function( obj ) {
|
524 |
+
return obj == null ?
|
525 |
+
String( obj ) :
|
526 |
+
class2type[ toString.call(obj) ] || "object";
|
527 |
+
},
|
528 |
+
|
529 |
+
isPlainObject: function( obj ) {
|
530 |
+
// Must be an Object.
|
531 |
+
// Because of IE, we also have to check the presence of the constructor property.
|
532 |
+
// Make sure that DOM nodes and window objects don't pass through, as well
|
533 |
+
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
534 |
+
return false;
|
535 |
+
}
|
536 |
+
|
537 |
+
// Not own constructor property must be Object
|
538 |
+
if ( obj.constructor &&
|
539 |
+
!hasOwn.call(obj, "constructor") &&
|
540 |
+
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
|
541 |
+
return false;
|
542 |
+
}
|
543 |
+
|
544 |
+
// Own properties are enumerated firstly, so to speed up,
|
545 |
+
// if last one is own, then all properties are own.
|
546 |
+
|
547 |
+
var key;
|
548 |
+
for ( key in obj ) {}
|
549 |
+
|
550 |
+
return key === undefined || hasOwn.call( obj, key );
|
551 |
+
},
|
552 |
+
|
553 |
+
isEmptyObject: function( obj ) {
|
554 |
+
for ( var name in obj ) {
|
555 |
+
return false;
|
556 |
+
}
|
557 |
+
return true;
|
558 |
+
},
|
559 |
+
|
560 |
+
error: function( msg ) {
|
561 |
+
throw msg;
|
562 |
+
},
|
563 |
+
|
564 |
+
parseJSON: function( data ) {
|
565 |
+
if ( typeof data !== "string" || !data ) {
|
566 |
+
return null;
|
567 |
+
}
|
568 |
+
|
569 |
+
// Make sure leading/trailing whitespace is removed (IE can't handle it)
|
570 |
+
data = jQuery.trim( data );
|
571 |
+
|
572 |
+
// Make sure the incoming data is actual JSON
|
573 |
+
// Logic borrowed from http://json.org/json2.js
|
574 |
+
if ( rvalidchars.test(data.replace(rvalidescape, "@")
|
575 |
+
.replace(rvalidtokens, "]")
|
576 |
+
.replace(rvalidbraces, "")) ) {
|
577 |
+
|
578 |
+
// Try to use the native JSON parser first
|
579 |
+
return window.JSON && window.JSON.parse ?
|
580 |
+
window.JSON.parse( data ) :
|
581 |
+
(new Function("return " + data))();
|
582 |
+
|
583 |
+
} else {
|
584 |
+
jQuery.error( "Invalid JSON: " + data );
|
585 |
+
}
|
586 |
+
},
|
587 |
+
|
588 |
+
noop: function() {},
|
589 |
+
|
590 |
+
// Evalulates a script in a global context
|
591 |
+
globalEval: function( data ) {
|
592 |
+
if ( data && rnotwhite.test(data) ) {
|
593 |
+
// Inspired by code by Andrea Giammarchi
|
594 |
+
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
|
595 |
+
var head = document.getElementsByTagName("head")[0] || document.documentElement,
|
596 |
+
script = document.createElement("script");
|
597 |
+
|
598 |
+
script.type = "text/javascript";
|
599 |
+
|
600 |
+
if ( jQuery.support.scriptEval ) {
|
601 |
+
script.appendChild( document.createTextNode( data ) );
|
602 |
+
} else {
|
603 |
+
script.text = data;
|
604 |
+
}
|
605 |
+
|
606 |
+
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
607 |
+
// This arises when a base node is used (#2709).
|
608 |
+
head.insertBefore( script, head.firstChild );
|
609 |
+
head.removeChild( script );
|
610 |
+
}
|
611 |
+
},
|
612 |
+
|
613 |
+
nodeName: function( elem, name ) {
|
614 |
+
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
|
615 |
+
},
|
616 |
+
|
617 |
+
// args is for internal usage only
|
618 |
+
each: function( object, callback, args ) {
|
619 |
+
var name, i = 0,
|
620 |
+
length = object.length,
|
621 |
+
isObj = length === undefined || jQuery.isFunction(object);
|
622 |
+
|
623 |
+
if ( args ) {
|
624 |
+
if ( isObj ) {
|
625 |
+
for ( name in object ) {
|
626 |
+
if ( callback.apply( object[ name ], args ) === false ) {
|
627 |
+
break;
|
628 |
+
}
|
629 |
+
}
|
630 |
+
} else {
|
631 |
+
for ( ; i < length; ) {
|
632 |
+
if ( callback.apply( object[ i++ ], args ) === false ) {
|
633 |
+
break;
|
634 |
+
}
|
635 |
+
}
|
636 |
+
}
|
637 |
+
|
638 |
+
// A special, fast, case for the most common use of each
|
639 |
+
} else {
|
640 |
+
if ( isObj ) {
|
641 |
+
for ( name in object ) {
|
642 |
+
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
|
643 |
+
break;
|
644 |
+
}
|
645 |
+
}
|
646 |
+
} else {
|
647 |
+
for ( var value = object[0];
|
648 |
+
i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
|
649 |
+
}
|
650 |
+
}
|
651 |
+
|
652 |
+
return object;
|
653 |
+
},
|
654 |
+
|
655 |
+
// Use native String.trim function wherever possible
|
656 |
+
trim: trim ?
|
657 |
+
function( text ) {
|
658 |
+
return text == null ?
|
659 |
+
"" :
|
660 |
+
trim.call( text );
|
661 |
+
} :
|
662 |
+
|
663 |
+
// Otherwise use our own trimming functionality
|
664 |
+
function( text ) {
|
665 |
+
return text == null ?
|
666 |
+
"" :
|
667 |
+
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
|
668 |
+
},
|
669 |
+
|
670 |
+
// results is for internal usage only
|
671 |
+
makeArray: function( array, results ) {
|
672 |
+
var ret = results || [];
|
673 |
+
|
674 |
+
if ( array != null ) {
|
675 |
+
// The window, strings (and functions) also have 'length'
|
676 |
+
// The extra typeof function check is to prevent crashes
|
677 |
+
// in Safari 2 (See: #3039)
|
678 |
+
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
|
679 |
+
var type = jQuery.type(array);
|
680 |
+
|
681 |
+
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
|
682 |
+
push.call( ret, array );
|
683 |
+
} else {
|
684 |
+
jQuery.merge( ret, array );
|
685 |
+
}
|
686 |
+
}
|
687 |
+
|
688 |
+
return ret;
|
689 |
+
},
|
690 |
+
|
691 |
+
inArray: function( elem, array ) {
|
692 |
+
if ( array.indexOf ) {
|
693 |
+
return array.indexOf( elem );
|
694 |
+
}
|
695 |
+
|
696 |
+
for ( var i = 0, length = array.length; i < length; i++ ) {
|
697 |
+
if ( array[ i ] === elem ) {
|
698 |
+
return i;
|
699 |
+
}
|
700 |
+
}
|
701 |
+
|
702 |
+
return -1;
|
703 |
+
},
|
704 |
+
|
705 |
+
merge: function( first, second ) {
|
706 |
+
var i = first.length,
|
707 |
+
j = 0;
|
708 |
+
|
709 |
+
if ( typeof second.length === "number" ) {
|
710 |
+
for ( var l = second.length; j < l; j++ ) {
|
711 |
+
first[ i++ ] = second[ j ];
|
712 |
+
}
|
713 |
+
|
714 |
+
} else {
|
715 |
+
while ( second[j] !== undefined ) {
|
716 |
+
first[ i++ ] = second[ j++ ];
|
717 |
+
}
|
718 |
+
}
|
719 |
+
|
720 |
+
first.length = i;
|
721 |
+
|
722 |
+
return first;
|
723 |
+
},
|
724 |
+
|
725 |
+
grep: function( elems, callback, inv ) {
|
726 |
+
var ret = [], retVal;
|
727 |
+
inv = !!inv;
|
728 |
+
|
729 |
+
// Go through the array, only saving the items
|
730 |
+
// that pass the validator function
|
731 |
+
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
732 |
+
retVal = !!callback( elems[ i ], i );
|
733 |
+
if ( inv !== retVal ) {
|
734 |
+
ret.push( elems[ i ] );
|
735 |
+
}
|
736 |
+
}
|
737 |
+
|
738 |
+
return ret;
|
739 |
+
},
|
740 |
+
|
741 |
+
// arg is for internal usage only
|
742 |
+
map: function( elems, callback, arg ) {
|
743 |
+
var ret = [], value;
|
744 |
+
|
745 |
+
// Go through the array, translating each of the items to their
|
746 |
+
// new value (or values).
|
747 |
+
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
748 |
+
value = callback( elems[ i ], i, arg );
|
749 |
+
|
750 |
+
if ( value != null ) {
|
751 |
+
ret[ ret.length ] = value;
|
752 |
+
}
|
753 |
+
}
|
754 |
+
|
755 |
+
return ret.concat.apply( [], ret );
|
756 |
+
},
|
757 |
+
|
758 |
+
// A global GUID counter for objects
|
759 |
+
guid: 1,
|
760 |
+
|
761 |
+
proxy: function( fn, proxy, thisObject ) {
|
762 |
+
if ( arguments.length === 2 ) {
|
763 |
+
if ( typeof proxy === "string" ) {
|
764 |
+
thisObject = fn;
|
765 |
+
fn = thisObject[ proxy ];
|
766 |
+
proxy = undefined;
|
767 |
+
|
768 |
+
} else if ( proxy && !jQuery.isFunction( proxy ) ) {
|
769 |
+
thisObject = proxy;
|
770 |
+
proxy = undefined;
|
771 |
+
}
|
772 |
+
}
|
773 |
+
|
774 |
+
if ( !proxy && fn ) {
|
775 |
+
proxy = function() {
|
776 |
+
return fn.apply( thisObject || this, arguments );
|
777 |
+
};
|
778 |
+
}
|
779 |
+
|
780 |
+
// Set the guid of unique handler to the same of original handler, so it can be removed
|
781 |
+
if ( fn ) {
|
782 |
+
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
|
783 |
+
}
|
784 |
+
|
785 |
+
// So proxy can be declared as an argument
|
786 |
+
return proxy;
|
787 |
+
},
|
788 |
+
|
789 |
+
// Mutifunctional method to get and set values to a collection
|
790 |
+
// The value/s can be optionally by executed if its a function
|
791 |
+
access: function( elems, key, value, exec, fn, pass ) {
|
792 |
+
var length = elems.length;
|
793 |
+
|
794 |
+
// Setting many attributes
|
795 |
+
if ( typeof key === "object" ) {
|
796 |
+
for ( var k in key ) {
|
797 |
+
jQuery.access( elems, k, key[k], exec, fn, value );
|
798 |
+
}
|
799 |
+
return elems;
|
800 |
+
}
|
801 |
+
|
802 |
+
// Setting one attribute
|
803 |
+
if ( value !== undefined ) {
|
804 |
+
// Optionally, function values get executed if exec is true
|
805 |
+
exec = !pass && exec && jQuery.isFunction(value);
|
806 |
+
|
807 |
+
for ( var i = 0; i < length; i++ ) {
|
808 |
+
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
|
809 |
+
}
|
810 |
+
|
811 |
+
return elems;
|
812 |
+
}
|
813 |
+
|
814 |
+
// Getting an attribute
|
815 |
+
return length ? fn( elems[0], key ) : undefined;
|
816 |
+
},
|
817 |
+
|
818 |
+
now: function() {
|
819 |
+
return (new Date()).getTime();
|
820 |
+
},
|
821 |
+
|
822 |
+
// Use of jQuery.browser is frowned upon.
|
823 |
+
// More details: http://docs.jquery.com/Utilities/jQuery.browser
|
824 |
+
uaMatch: function( ua ) {
|
825 |
+
ua = ua.toLowerCase();
|
826 |
+
|
827 |
+
var match = rwebkit.exec( ua ) ||
|
828 |
+
ropera.exec( ua ) ||
|
829 |
+
rmsie.exec( ua ) ||
|
830 |
+
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
|
831 |
+
[];
|
832 |
+
|
833 |
+
return { browser: match[1] || "", version: match[2] || "0" };
|
834 |
+
},
|
835 |
+
|
836 |
+
browser: {}
|
837 |
+
});
|
838 |
+
|
839 |
+
// Populate the class2type map
|
840 |
+
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
|
841 |
+
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
842 |
+
});
|
843 |
+
|
844 |
+
browserMatch = jQuery.uaMatch( userAgent );
|
845 |
+
if ( browserMatch.browser ) {
|
846 |
+
jQuery.browser[ browserMatch.browser ] = true;
|
847 |
+
jQuery.browser.version = browserMatch.version;
|
848 |
+
}
|
849 |
+
|
850 |
+
// Deprecated, use jQuery.browser.webkit instead
|
851 |
+
if ( jQuery.browser.webkit ) {
|
852 |
+
jQuery.browser.safari = true;
|
853 |
+
}
|
854 |
+
|
855 |
+
if ( indexOf ) {
|
856 |
+
jQuery.inArray = function( elem, array ) {
|
857 |
+
return indexOf.call( array, elem );
|
858 |
+
};
|
859 |
+
}
|
860 |
+
|
861 |
+
// Verify that \s matches non-breaking spaces
|
862 |
+
// (IE fails on this test)
|
863 |
+
if ( !rwhite.test( "\xA0" ) ) {
|
864 |
+
trimLeft = /^[\s\xA0]+/;
|
865 |
+
trimRight = /[\s\xA0]+$/;
|
866 |
+
}
|
867 |
+
|
868 |
+
// All jQuery objects should point back to these
|
869 |
+
rootjQuery = jQuery(document);
|
870 |
+
|
871 |
+
// Cleanup functions for the document ready method
|
872 |
+
if ( document.addEventListener ) {
|
873 |
+
DOMContentLoaded = function() {
|
874 |
+
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
875 |
+
jQuery.ready();
|
876 |
+
};
|
877 |
+
|
878 |
+
} else if ( document.attachEvent ) {
|
879 |
+
DOMContentLoaded = function() {
|
880 |
+
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
881 |
+
if ( document.readyState === "complete" ) {
|
882 |
+
document.detachEvent( "onreadystatechange", DOMContentLoaded );
|
883 |
+
jQuery.ready();
|
884 |
+
}
|
885 |
+
};
|
886 |
+
}
|
887 |
+
|
888 |
+
// The DOM ready check for Internet Explorer
|
889 |
+
function doScrollCheck() {
|
890 |
+
if ( jQuery.isReady ) {
|
891 |
+
return;
|
892 |
+
}
|
893 |
+
|
894 |
+
try {
|
895 |
+
// If IE is used, use the trick by Diego Perini
|
896 |
+
// http://javascript.nwbox.com/IEContentLoaded/
|
897 |
+
document.documentElement.doScroll("left");
|
898 |
+
} catch(e) {
|
899 |
+
setTimeout( doScrollCheck, 1 );
|
900 |
+
return;
|
901 |
+
}
|
902 |
+
|
903 |
+
// and execute any waiting functions
|
904 |
+
jQuery.ready();
|
905 |
+
}
|
906 |
+
|
907 |
+
// Expose jQuery to the global object
|
908 |
+
return (window.jQuery = window.$ = jQuery);
|
909 |
+
|
910 |
+
})();
|
911 |
+
|
912 |
+
|
913 |
+
(function() {
|
914 |
+
|
915 |
+
jQuery.support = {};
|
916 |
+
|
917 |
+
var root = document.documentElement,
|
918 |
+
script = document.createElement("script"),
|
919 |
+
div = document.createElement("div"),
|
920 |
+
id = "script" + jQuery.now();
|
921 |
+
|
922 |
+
div.style.display = "none";
|
923 |
+
div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
924 |
+
|
925 |
+
var all = div.getElementsByTagName("*"),
|
926 |
+
a = div.getElementsByTagName("a")[0],
|
927 |
+
select = document.createElement("select"),
|
928 |
+
opt = select.appendChild( document.createElement("option") );
|
929 |
+
|
930 |
+
// Can't get basic test support
|
931 |
+
if ( !all || !all.length || !a ) {
|
932 |
+
return;
|
933 |
+
}
|
934 |
+
|
935 |
+
jQuery.support = {
|
936 |
+
// IE strips leading whitespace when .innerHTML is used
|
937 |
+
leadingWhitespace: div.firstChild.nodeType === 3,
|
938 |
+
|
939 |
+
// Make sure that tbody elements aren't automatically inserted
|
940 |
+
// IE will insert them into empty tables
|
941 |
+
tbody: !div.getElementsByTagName("tbody").length,
|
942 |
+
|
943 |
+
// Make sure that link elements get serialized correctly by innerHTML
|
944 |
+
// This requires a wrapper element in IE
|
945 |
+
htmlSerialize: !!div.getElementsByTagName("link").length,
|
946 |
+
|
947 |
+
// Get the style information from getAttribute
|
948 |
+
// (IE uses .cssText insted)
|
949 |
+
style: /red/.test( a.getAttribute("style") ),
|
950 |
+
|
951 |
+
// Make sure that URLs aren't manipulated
|
952 |
+
// (IE normalizes it by default)
|
953 |
+
hrefNormalized: a.getAttribute("href") === "/a",
|
954 |
+
|
955 |
+
// Make sure that element opacity exists
|
956 |
+
// (IE uses filter instead)
|
957 |
+
// Use a regex to work around a WebKit issue. See #5145
|
958 |
+
opacity: /^0.55$/.test( a.style.opacity ),
|
959 |
+
|
960 |
+
// Verify style float existence
|
961 |
+
// (IE uses styleFloat instead of cssFloat)
|
962 |
+
cssFloat: !!a.style.cssFloat,
|
963 |
+
|
964 |
+
// Make sure that if no value is specified for a checkbox
|
965 |
+
// that it defaults to "on".
|
966 |
+
// (WebKit defaults to "" instead)
|
967 |
+
checkOn: div.getElementsByTagName("input")[0].value === "on",
|
968 |
+
|
969 |
+
// Make sure that a selected-by-default option has a working selected property.
|
970 |
+
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
971 |
+
optSelected: opt.selected,
|
972 |
+
|
973 |
+
// Will be defined later
|
974 |
+
deleteExpando: true,
|
975 |
+
optDisabled: false,
|
976 |
+
checkClone: false,
|
977 |
+
scriptEval: false,
|
978 |
+
noCloneEvent: true,
|
979 |
+
boxModel: null,
|
980 |
+
inlineBlockNeedsLayout: false,
|
981 |
+
shrinkWrapBlocks: false,
|
982 |
+
reliableHiddenOffsets: true
|
983 |
+
};
|
984 |
+
|
985 |
+
// Make sure that the options inside disabled selects aren't marked as disabled
|
986 |
+
// (WebKit marks them as diabled)
|
987 |
+
select.disabled = true;
|
988 |
+
jQuery.support.optDisabled = !opt.disabled;
|
989 |
+
|
990 |
+
script.type = "text/javascript";
|
991 |
+
try {
|
992 |
+
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
|
993 |
+
} catch(e) {}
|
994 |
+
|
995 |
+
root.insertBefore( script, root.firstChild );
|
996 |
+
|
997 |
+
// Make sure that the execution of code works by injecting a script
|
998 |
+
// tag with appendChild/createTextNode
|
999 |
+
// (IE doesn't support this, fails, and uses .text instead)
|
1000 |
+
if ( window[ id ] ) {
|
1001 |
+
jQuery.support.scriptEval = true;
|
1002 |
+
delete window[ id ];
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
// Test to see if it's possible to delete an expando from an element
|
1006 |
+
// Fails in Internet Explorer
|
1007 |
+
try {
|
1008 |
+
delete script.test;
|
1009 |
+
|
1010 |
+
} catch(e) {
|
1011 |
+
jQuery.support.deleteExpando = false;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
root.removeChild( script );
|
1015 |
+
|
1016 |
+
if ( div.attachEvent && div.fireEvent ) {
|
1017 |
+
div.attachEvent("onclick", function click() {
|
1018 |
+
// Cloning a node shouldn't copy over any
|
1019 |
+
// bound event handlers (IE does this)
|
1020 |
+
jQuery.support.noCloneEvent = false;
|
1021 |
+
div.detachEvent("onclick", click);
|
1022 |
+
});
|
1023 |
+
div.cloneNode(true).fireEvent("onclick");
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
div = document.createElement("div");
|
1027 |
+
div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
|
1028 |
+
|
1029 |
+
var fragment = document.createDocumentFragment();
|
1030 |
+
fragment.appendChild( div.firstChild );
|
1031 |
+
|
1032 |
+
// WebKit doesn't clone checked state correctly in fragments
|
1033 |
+
jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
|
1034 |
+
|
1035 |
+
// Figure out if the W3C box model works as expected
|
1036 |
+
// document.body must exist before we can do this
|
1037 |
+
jQuery(function() {
|
1038 |
+
var div = document.createElement("div");
|
1039 |
+
div.style.width = div.style.paddingLeft = "1px";
|
1040 |
+
|
1041 |
+
document.body.appendChild( div );
|
1042 |
+
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
|
1043 |
+
|
1044 |
+
if ( "zoom" in div.style ) {
|
1045 |
+
// Check if natively block-level elements act like inline-block
|
1046 |
+
// elements when setting their display to 'inline' and giving
|
1047 |
+
// them layout
|
1048 |
+
// (IE < 8 does this)
|
1049 |
+
div.style.display = "inline";
|
1050 |
+
div.style.zoom = 1;
|
1051 |
+
jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
|
1052 |
+
|
1053 |
+
// Check if elements with layout shrink-wrap their children
|
1054 |
+
// (IE 6 does this)
|
1055 |
+
div.style.display = "";
|
1056 |
+
div.innerHTML = "<div style='width:4px;'></div>";
|
1057 |
+
jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
|
1061 |
+
var tds = div.getElementsByTagName("td");
|
1062 |
+
|
1063 |
+
// Check if table cells still have offsetWidth/Height when they are set
|
1064 |
+
// to display:none and there are still other visible table cells in a
|
1065 |
+
// table row; if so, offsetWidth/Height are not reliable for use when
|
1066 |
+
// determining if an element has been hidden directly using
|
1067 |
+
// display:none (it is still safe to use offsets if a parent element is
|
1068 |
+
// hidden; don safety goggles and see bug #4512 for more information).
|
1069 |
+
// (only IE 8 fails this test)
|
1070 |
+
jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
|
1071 |
+
|
1072 |
+
tds[0].style.display = "";
|
1073 |
+
tds[1].style.display = "none";
|
1074 |
+
|
1075 |
+
// Check if empty table cells still have offsetWidth/Height
|
1076 |
+
// (IE < 8 fail this test)
|
1077 |
+
jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
|
1078 |
+
div.innerHTML = "";
|
1079 |
+
|
1080 |
+
document.body.removeChild( div ).style.display = "none";
|
1081 |
+
div = tds = null;
|
1082 |
+
});
|
1083 |
+
|
1084 |
+
// Technique from Juriy Zaytsev
|
1085 |
+
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
1086 |
+
var eventSupported = function( eventName ) {
|
1087 |
+
var el = document.createElement("div");
|
1088 |
+
eventName = "on" + eventName;
|
1089 |
+
|
1090 |
+
var isSupported = (eventName in el);
|
1091 |
+
if ( !isSupported ) {
|
1092 |
+
el.setAttribute(eventName, "return;");
|
1093 |
+
isSupported = typeof el[eventName] === "function";
|
1094 |
+
}
|
1095 |
+
el = null;
|
1096 |
+
|
1097 |
+
return isSupported;
|
1098 |
+
};
|
1099 |
+
|
1100 |
+
jQuery.support.submitBubbles = eventSupported("submit");
|
1101 |
+
jQuery.support.changeBubbles = eventSupported("change");
|
1102 |
+
|
1103 |
+
// release memory in IE
|
1104 |
+
root = script = div = all = a = null;
|
1105 |
+
})();
|
1106 |
+
|
1107 |
+
|
1108 |
+
|
1109 |
+
var windowData = {},
|
1110 |
+
rbrace = /^(?:\{.*\}|\[.*\])$/;
|
1111 |
+
|
1112 |
+
jQuery.extend({
|
1113 |
+
cache: {},
|
1114 |
+
|
1115 |
+
// Please use with caution
|
1116 |
+
uuid: 0,
|
1117 |
+
|
1118 |
+
// Unique for each copy of jQuery on the page
|
1119 |
+
expando: "jQuery" + jQuery.now(),
|
1120 |
+
|
1121 |
+
// The following elements throw uncatchable exceptions if you
|
1122 |
+
// attempt to add expando properties to them.
|
1123 |
+
noData: {
|
1124 |
+
"embed": true,
|
1125 |
+
// Ban all objects except for Flash (which handle expandos)
|
1126 |
+
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
|
1127 |
+
"applet": true
|
1128 |
+
},
|
1129 |
+
|
1130 |
+
data: function( elem, name, data ) {
|
1131 |
+
if ( !jQuery.acceptData( elem ) ) {
|
1132 |
+
return;
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
elem = elem == window ?
|
1136 |
+
windowData :
|
1137 |
+
elem;
|
1138 |
+
|
1139 |
+
var isNode = elem.nodeType,
|
1140 |
+
id = isNode ? elem[ jQuery.expando ] : null,
|
1141 |
+
cache = jQuery.cache, thisCache;
|
1142 |
+
|
1143 |
+
if ( isNode && !id && typeof name === "string" && data === undefined ) {
|
1144 |
+
return;
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
// Get the data from the object directly
|
1148 |
+
if ( !isNode ) {
|
1149 |
+
cache = elem;
|
1150 |
+
|
1151 |
+
// Compute a unique ID for the element
|
1152 |
+
} else if ( !id ) {
|
1153 |
+
elem[ jQuery.expando ] = id = ++jQuery.uuid;
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
// Avoid generating a new cache unless none exists and we
|
1157 |
+
// want to manipulate it.
|
1158 |
+
if ( typeof name === "object" ) {
|
1159 |
+
if ( isNode ) {
|
1160 |
+
cache[ id ] = jQuery.extend(cache[ id ], name);
|
1161 |
+
|
1162 |
+
} else {
|
1163 |
+
jQuery.extend( cache, name );
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
} else if ( isNode && !cache[ id ] ) {
|
1167 |
+
cache[ id ] = {};
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
thisCache = isNode ? cache[ id ] : cache;
|
1171 |
+
|
1172 |
+
// Prevent overriding the named cache with undefined values
|
1173 |
+
if ( data !== undefined ) {
|
1174 |
+
thisCache[ name ] = data;
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
return typeof name === "string" ? thisCache[ name ] : thisCache;
|
1178 |
+
},
|
1179 |
+
|
1180 |
+
removeData: function( elem, name ) {
|
1181 |
+
if ( !jQuery.acceptData( elem ) ) {
|
1182 |
+
return;
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
elem = elem == window ?
|
1186 |
+
windowData :
|
1187 |
+
elem;
|
1188 |
+
|
1189 |
+
var isNode = elem.nodeType,
|
1190 |
+
id = isNode ? elem[ jQuery.expando ] : elem,
|
1191 |
+
cache = jQuery.cache,
|
1192 |
+
thisCache = isNode ? cache[ id ] : id;
|
1193 |
+
|
1194 |
+
// If we want to remove a specific section of the element's data
|
1195 |
+
if ( name ) {
|
1196 |
+
if ( thisCache ) {
|
1197 |
+
// Remove the section of cache data
|
1198 |
+
delete thisCache[ name ];
|
1199 |
+
|
1200 |
+
// If we've removed all the data, remove the element's cache
|
1201 |
+
if ( isNode && jQuery.isEmptyObject(thisCache) ) {
|
1202 |
+
jQuery.removeData( elem );
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
// Otherwise, we want to remove all of the element's data
|
1207 |
+
} else {
|
1208 |
+
if ( isNode && jQuery.support.deleteExpando ) {
|
1209 |
+
delete elem[ jQuery.expando ];
|
1210 |
+
|
1211 |
+
} else if ( elem.removeAttribute ) {
|
1212 |
+
elem.removeAttribute( jQuery.expando );
|
1213 |
+
|
1214 |
+
// Completely remove the data cache
|
1215 |
+
} else if ( isNode ) {
|
1216 |
+
delete cache[ id ];
|
1217 |
+
|
1218 |
+
// Remove all fields from the object
|
1219 |
+
} else {
|
1220 |
+
for ( var n in elem ) {
|
1221 |
+
delete elem[ n ];
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
}
|
1225 |
+
},
|
1226 |
+
|
1227 |
+
// A method for determining if a DOM node can handle the data expando
|
1228 |
+
acceptData: function( elem ) {
|
1229 |
+
if ( elem.nodeName ) {
|
1230 |
+
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
|
1231 |
+
|
1232 |
+
if ( match ) {
|
1233 |
+
return !(match === true || elem.getAttribute("classid") !== match);
|
1234 |
+
}
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
return true;
|
1238 |
+
}
|
1239 |
+
});
|
1240 |
+
|
1241 |
+
jQuery.fn.extend({
|
1242 |
+
data: function( key, value ) {
|
1243 |
+
var data = null;
|
1244 |
+
|
1245 |
+
if ( typeof key === "undefined" ) {
|
1246 |
+
if ( this.length ) {
|
1247 |
+
var attr = this[0].attributes, name;
|
1248 |
+
data = jQuery.data( this[0] );
|
1249 |
+
|
1250 |
+
for ( var i = 0, l = attr.length; i < l; i++ ) {
|
1251 |
+
name = attr[i].name;
|
1252 |
+
|
1253 |
+
if ( name.indexOf( "data-" ) === 0 ) {
|
1254 |
+
name = name.substr( 5 );
|
1255 |
+
dataAttr( this[0], name, data[ name ] );
|
1256 |
+
}
|
1257 |
+
}
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
return data;
|
1261 |
+
|
1262 |
+
} else if ( typeof key === "object" ) {
|
1263 |
+
return this.each(function() {
|
1264 |
+
jQuery.data( this, key );
|
1265 |
+
});
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
var parts = key.split(".");
|
1269 |
+
parts[1] = parts[1] ? "." + parts[1] : "";
|
1270 |
+
|
1271 |
+
if ( value === undefined ) {
|
1272 |
+
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
|
1273 |
+
|
1274 |
+
// Try to fetch any internally stored data first
|
1275 |
+
if ( data === undefined && this.length ) {
|
1276 |
+
data = jQuery.data( this[0], key );
|
1277 |
+
data = dataAttr( this[0], key, data );
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
return data === undefined && parts[1] ?
|
1281 |
+
this.data( parts[0] ) :
|
1282 |
+
data;
|
1283 |
+
|
1284 |
+
} else {
|
1285 |
+
return this.each(function() {
|
1286 |
+
var $this = jQuery( this ),
|
1287 |
+
args = [ parts[0], value ];
|
1288 |
+
|
1289 |
+
$this.triggerHandler( "setData" + parts[1] + "!", args );
|
1290 |
+
jQuery.data( this, key, value );
|
1291 |
+
$this.triggerHandler( "changeData" + parts[1] + "!", args );
|
1292 |
+
});
|
1293 |
+
}
|
1294 |
+
},
|
1295 |
+
|
1296 |
+
removeData: function( key ) {
|
1297 |
+
return this.each(function() {
|
1298 |
+
jQuery.removeData( this, key );
|
1299 |
+
});
|
1300 |
+
}
|
1301 |
+
});
|
1302 |
+
|
1303 |
+
function dataAttr( elem, key, data ) {
|
1304 |
+
// If nothing was found internally, try to fetch any
|
1305 |
+
// data from the HTML5 data-* attribute
|
1306 |
+
if ( data === undefined && elem.nodeType === 1 ) {
|
1307 |
+
data = elem.getAttribute( "data-" + key );
|
1308 |
+
|
1309 |
+
if ( typeof data === "string" ) {
|
1310 |
+
try {
|
1311 |
+
data = data === "true" ? true :
|
1312 |
+
data === "false" ? false :
|
1313 |
+
data === "null" ? null :
|
1314 |
+
!jQuery.isNaN( data ) ? parseFloat( data ) :
|
1315 |
+
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
1316 |
+
data;
|
1317 |
+
} catch( e ) {}
|
1318 |
+
|
1319 |
+
// Make sure we set the data so it isn't changed later
|
1320 |
+
jQuery.data( elem, key, data );
|
1321 |
+
|
1322 |
+
} else {
|
1323 |
+
data = undefined;
|
1324 |
+
}
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
return data;
|
1328 |
+
}
|
1329 |
+
|
1330 |
+
|
1331 |
+
|
1332 |
+
|
1333 |
+
jQuery.extend({
|
1334 |
+
queue: function( elem, type, data ) {
|
1335 |
+
if ( !elem ) {
|
1336 |
+
return;
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
type = (type || "fx") + "queue";
|
1340 |
+
var q = jQuery.data( elem, type );
|
1341 |
+
|
1342 |
+
// Speed up dequeue by getting out quickly if this is just a lookup
|
1343 |
+
if ( !data ) {
|
1344 |
+
return q || [];
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
if ( !q || jQuery.isArray(data) ) {
|
1348 |
+
q = jQuery.data( elem, type, jQuery.makeArray(data) );
|
1349 |
+
|
1350 |
+
} else {
|
1351 |
+
q.push( data );
|
1352 |
+
}
|
1353 |
+
|
1354 |
+
return q;
|
1355 |
+
},
|
1356 |
+
|
1357 |
+
dequeue: function( elem, type ) {
|
1358 |
+
type = type || "fx";
|
1359 |
+
|
1360 |
+
var queue = jQuery.queue( elem, type ),
|
1361 |
+
fn = queue.shift();
|
1362 |
+
|
1363 |
+
// If the fx queue is dequeued, always remove the progress sentinel
|
1364 |
+
if ( fn === "inprogress" ) {
|
1365 |
+
fn = queue.shift();
|
1366 |
+
}
|
1367 |
+
|
1368 |
+
if ( fn ) {
|
1369 |
+
// Add a progress sentinel to prevent the fx queue from being
|
1370 |
+
// automatically dequeued
|
1371 |
+
if ( type === "fx" ) {
|
1372 |
+
queue.unshift("inprogress");
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
fn.call(elem, function() {
|
1376 |
+
jQuery.dequeue(elem, type);
|
1377 |
+
});
|
1378 |
+
}
|
1379 |
+
}
|
1380 |
+
});
|
1381 |
+
|
1382 |
+
jQuery.fn.extend({
|
1383 |
+
queue: function( type, data ) {
|
1384 |
+
if ( typeof type !== "string" ) {
|
1385 |
+
data = type;
|
1386 |
+
type = "fx";
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
if ( data === undefined ) {
|
1390 |
+
return jQuery.queue( this[0], type );
|
1391 |
+
}
|
1392 |
+
return this.each(function( i ) {
|
1393 |
+
var queue = jQuery.queue( this, type, data );
|
1394 |
+
|
1395 |
+
if ( type === "fx" && queue[0] !== "inprogress" ) {
|
1396 |
+
jQuery.dequeue( this, type );
|
1397 |
+
}
|
1398 |
+
});
|
1399 |
+
},
|
1400 |
+
dequeue: function( type ) {
|
1401 |
+
return this.each(function() {
|
1402 |
+
jQuery.dequeue( this, type );
|
1403 |
+
});
|
1404 |
+
},
|
1405 |
+
|
1406 |
+
// Based off of the plugin by Clint Helfers, with permission.
|
1407 |
+
// http://blindsignals.com/index.php/2009/07/jquery-delay/
|
1408 |
+
delay: function( time, type ) {
|
1409 |
+
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
|
1410 |
+
type = type || "fx";
|
1411 |
+
|
1412 |
+
return this.queue( type, function() {
|
1413 |
+
var elem = this;
|
1414 |
+
setTimeout(function() {
|
1415 |
+
jQuery.dequeue( elem, type );
|
1416 |
+
}, time );
|
1417 |
+
});
|
1418 |
+
},
|
1419 |
+
|
1420 |
+
clearQueue: function( type ) {
|
1421 |
+
return this.queue( type || "fx", [] );
|
1422 |
+
}
|
1423 |
+
});
|
1424 |
+
|
1425 |
+
|
1426 |
+
|
1427 |
+
|
1428 |
+
var rclass = /[\n\t]/g,
|
1429 |
+
rspaces = /\s+/,
|
1430 |
+
rreturn = /\r/g,
|
1431 |
+
rspecialurl = /^(?:href|src|style)$/,
|
1432 |
+
rtype = /^(?:button|input)$/i,
|
1433 |
+
rfocusable = /^(?:button|input|object|select|textarea)$/i,
|
1434 |
+
rclickable = /^a(?:rea)?$/i,
|
1435 |
+
rradiocheck = /^(?:radio|checkbox)$/i;
|
1436 |
+
|
1437 |
+
jQuery.props = {
|
1438 |
+
"for": "htmlFor",
|
1439 |
+
"class": "className",
|
1440 |
+
readonly: "readOnly",
|
1441 |
+
maxlength: "maxLength",
|
1442 |
+
cellspacing: "cellSpacing",
|
1443 |
+
rowspan: "rowSpan",
|
1444 |
+
colspan: "colSpan",
|
1445 |
+
tabindex: "tabIndex",
|
1446 |
+
usemap: "useMap",
|
1447 |
+
frameborder: "frameBorder"
|
1448 |
+
};
|
1449 |
+
|
1450 |
+
jQuery.fn.extend({
|
1451 |
+
attr: function( name, value ) {
|
1452 |
+
return jQuery.access( this, name, value, true, jQuery.attr );
|
1453 |
+
},
|
1454 |
+
|
1455 |
+
removeAttr: function( name, fn ) {
|
1456 |
+
return this.each(function(){
|
1457 |
+
jQuery.attr( this, name, "" );
|
1458 |
+
if ( this.nodeType === 1 ) {
|
1459 |
+
this.removeAttribute( name );
|
1460 |
+
}
|
1461 |
+
});
|
1462 |
+
},
|
1463 |
+
|
1464 |
+
addClass: function( value ) {
|
1465 |
+
if ( jQuery.isFunction(value) ) {
|
1466 |
+
return this.each(function(i) {
|
1467 |
+
var self = jQuery(this);
|
1468 |
+
self.addClass( value.call(this, i, self.attr("class")) );
|
1469 |
+
});
|
1470 |
+
}
|
1471 |
+
|
1472 |
+
if ( value && typeof value === "string" ) {
|
1473 |
+
var classNames = (value || "").split( rspaces );
|
1474 |
+
|
1475 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
1476 |
+
var elem = this[i];
|
1477 |
+
|
1478 |
+
if ( elem.nodeType === 1 ) {
|
1479 |
+
if ( !elem.className ) {
|
1480 |
+
elem.className = value;
|
1481 |
+
|
1482 |
+
} else {
|
1483 |
+
var className = " " + elem.className + " ",
|
1484 |
+
setClass = elem.className;
|
1485 |
+
|
1486 |
+
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
|
1487 |
+
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
|
1488 |
+
setClass += " " + classNames[c];
|
1489 |
+
}
|
1490 |
+
}
|
1491 |
+
elem.className = jQuery.trim( setClass );
|
1492 |
+
}
|
1493 |
+
}
|
1494 |
+
}
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
return this;
|
1498 |
+
},
|
1499 |
+
|
1500 |
+
removeClass: function( value ) {
|
1501 |
+
if ( jQuery.isFunction(value) ) {
|
1502 |
+
return this.each(function(i) {
|
1503 |
+
var self = jQuery(this);
|
1504 |
+
self.removeClass( value.call(this, i, self.attr("class")) );
|
1505 |
+
});
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
if ( (value && typeof value === "string") || value === undefined ) {
|
1509 |
+
var classNames = (value || "").split( rspaces );
|
1510 |
+
|
1511 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
1512 |
+
var elem = this[i];
|
1513 |
+
|
1514 |
+
if ( elem.nodeType === 1 && elem.className ) {
|
1515 |
+
if ( value ) {
|
1516 |
+
var className = (" " + elem.className + " ").replace(rclass, " ");
|
1517 |
+
for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
|
1518 |
+
className = className.replace(" " + classNames[c] + " ", " ");
|
1519 |
+
}
|
1520 |
+
elem.className = jQuery.trim( className );
|
1521 |
+
|
1522 |
+
} else {
|
1523 |
+
elem.className = "";
|
1524 |
+
}
|
1525 |
+
}
|
1526 |
+
}
|
1527 |
+
}
|
1528 |
+
|
1529 |
+
return this;
|
1530 |
+
},
|
1531 |
+
|
1532 |
+
toggleClass: function( value, stateVal ) {
|
1533 |
+
var type = typeof value,
|
1534 |
+
isBool = typeof stateVal === "boolean";
|
1535 |
+
|
1536 |
+
if ( jQuery.isFunction( value ) ) {
|
1537 |
+
return this.each(function(i) {
|
1538 |
+
var self = jQuery(this);
|
1539 |
+
self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
|
1540 |
+
});
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
return this.each(function() {
|
1544 |
+
if ( type === "string" ) {
|
1545 |
+
// toggle individual class names
|
1546 |
+
var className,
|
1547 |
+
i = 0,
|
1548 |
+
self = jQuery( this ),
|
1549 |
+
state = stateVal,
|
1550 |
+
classNames = value.split( rspaces );
|
1551 |
+
|
1552 |
+
while ( (className = classNames[ i++ ]) ) {
|
1553 |
+
// check each className given, space seperated list
|
1554 |
+
state = isBool ? state : !self.hasClass( className );
|
1555 |
+
self[ state ? "addClass" : "removeClass" ]( className );
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
} else if ( type === "undefined" || type === "boolean" ) {
|
1559 |
+
if ( this.className ) {
|
1560 |
+
// store className if set
|
1561 |
+
jQuery.data( this, "__className__", this.className );
|
1562 |
+
}
|
1563 |
+
|
1564 |
+
// toggle whole className
|
1565 |
+
this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
|
1566 |
+
}
|
1567 |
+
});
|
1568 |
+
},
|
1569 |
+
|
1570 |
+
hasClass: function( selector ) {
|
1571 |
+
var className = " " + selector + " ";
|
1572 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
1573 |
+
if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
|
1574 |
+
return true;
|
1575 |
+
}
|
1576 |
+
}
|
1577 |
+
|
1578 |
+
return false;
|
1579 |
+
},
|
1580 |
+
|
1581 |
+
val: function( value ) {
|
1582 |
+
if ( !arguments.length ) {
|
1583 |
+
var elem = this[0];
|
1584 |
+
|
1585 |
+
if ( elem ) {
|
1586 |
+
if ( jQuery.nodeName( elem, "option" ) ) {
|
1587 |
+
// attributes.value is undefined in Blackberry 4.7 but
|
1588 |
+
// uses .value. See #6932
|
1589 |
+
var val = elem.attributes.value;
|
1590 |
+
return !val || val.specified ? elem.value : elem.text;
|
1591 |
+
}
|
1592 |
+
|
1593 |
+
// We need to handle select boxes special
|
1594 |
+
if ( jQuery.nodeName( elem, "select" ) ) {
|
1595 |
+
var index = elem.selectedIndex,
|
1596 |
+
values = [],
|
1597 |
+
options = elem.options,
|
1598 |
+
one = elem.type === "select-one";
|
1599 |
+
|
1600 |
+
// Nothing was selected
|
1601 |
+
if ( index < 0 ) {
|
1602 |
+
return null;
|
1603 |
+
}
|
1604 |
+
|
1605 |
+
// Loop through all the selected options
|
1606 |
+
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
|
1607 |
+
var option = options[ i ];
|
1608 |
+
|
1609 |
+
// Don't return options that are disabled or in a disabled optgroup
|
1610 |
+
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
|
1611 |
+
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
|
1612 |
+
|
1613 |
+
// Get the specific value for the option
|
1614 |
+
value = jQuery(option).val();
|
1615 |
+
|
1616 |
+
// We don't need an array for one selects
|
1617 |
+
if ( one ) {
|
1618 |
+
return value;
|
1619 |
+
}
|
1620 |
+
|
1621 |
+
// Multi-Selects return an array
|
1622 |
+
values.push( value );
|
1623 |
+
}
|
1624 |
+
}
|
1625 |
+
|
1626 |
+
return values;
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
|
1630 |
+
if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
|
1631 |
+
return elem.getAttribute("value") === null ? "on" : elem.value;
|
1632 |
+
}
|
1633 |
+
|
1634 |
+
|
1635 |
+
// Everything else, we just grab the value
|
1636 |
+
return (elem.value || "").replace(rreturn, "");
|
1637 |
+
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
return undefined;
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
var isFunction = jQuery.isFunction(value);
|
1644 |
+
|
1645 |
+
return this.each(function(i) {
|
1646 |
+
var self = jQuery(this), val = value;
|
1647 |
+
|
1648 |
+
if ( this.nodeType !== 1 ) {
|
1649 |
+
return;
|
1650 |
+
}
|
1651 |
+
|
1652 |
+
if ( isFunction ) {
|
1653 |
+
val = value.call(this, i, self.val());
|
1654 |
+
}
|
1655 |
+
|
1656 |
+
// Treat null/undefined as ""; convert numbers to string
|
1657 |
+
if ( val == null ) {
|
1658 |
+
val = "";
|
1659 |
+
} else if ( typeof val === "number" ) {
|
1660 |
+
val += "";
|
1661 |
+
} else if ( jQuery.isArray(val) ) {
|
1662 |
+
val = jQuery.map(val, function (value) {
|
1663 |
+
return value == null ? "" : value + "";
|
1664 |
+
});
|
1665 |
+
}
|
1666 |
+
|
1667 |
+
if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
|
1668 |
+
this.checked = jQuery.inArray( self.val(), val ) >= 0;
|
1669 |
+
|
1670 |
+
} else if ( jQuery.nodeName( this, "select" ) ) {
|
1671 |
+
var values = jQuery.makeArray(val);
|
1672 |
+
|
1673 |
+
jQuery( "option", this ).each(function() {
|
1674 |
+
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
|
1675 |
+
});
|
1676 |
+
|
1677 |
+
if ( !values.length ) {
|
1678 |
+
this.selectedIndex = -1;
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
} else {
|
1682 |
+
this.value = val;
|
1683 |
+
}
|
1684 |
+
});
|
1685 |
+
}
|
1686 |
+
});
|
1687 |
+
|
1688 |
+
jQuery.extend({
|
1689 |
+
attrFn: {
|
1690 |
+
val: true,
|
1691 |
+
css: true,
|
1692 |
+
html: true,
|
1693 |
+
text: true,
|
1694 |
+
data: true,
|
1695 |
+
width: true,
|
1696 |
+
height: true,
|
1697 |
+
offset: true
|
1698 |
+
},
|
1699 |
+
|
1700 |
+
attr: function( elem, name, value, pass ) {
|
1701 |
+
// don't set attributes on text and comment nodes
|
1702 |
+
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
|
1703 |
+
return undefined;
|
1704 |
+
}
|
1705 |
+
|
1706 |
+
if ( pass && name in jQuery.attrFn ) {
|
1707 |
+
return jQuery(elem)[name](value);
|
1708 |
+
}
|
1709 |
+
|
1710 |
+
var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
|
1711 |
+
// Whether we are setting (or getting)
|
1712 |
+
set = value !== undefined;
|
1713 |
+
|
1714 |
+
// Try to normalize/fix the name
|
1715 |
+
name = notxml && jQuery.props[ name ] || name;
|
1716 |
+
|
1717 |
+
// These attributes require special treatment
|
1718 |
+
var special = rspecialurl.test( name );
|
1719 |
+
|
1720 |
+
// Safari mis-reports the default selected property of an option
|
1721 |
+
// Accessing the parent's selectedIndex property fixes it
|
1722 |
+
if ( name === "selected" && !jQuery.support.optSelected ) {
|
1723 |
+
var parent = elem.parentNode;
|
1724 |
+
if ( parent ) {
|
1725 |
+
parent.selectedIndex;
|
1726 |
+
|
1727 |
+
// Make sure that it also works with optgroups, see #5701
|
1728 |
+
if ( parent.parentNode ) {
|
1729 |
+
parent.parentNode.selectedIndex;
|
1730 |
+
}
|
1731 |
+
}
|
1732 |
+
}
|
1733 |
+
|
1734 |
+
// If applicable, access the attribute via the DOM 0 way
|
1735 |
+
// 'in' checks fail in Blackberry 4.7 #6931
|
1736 |
+
if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
|
1737 |
+
if ( set ) {
|
1738 |
+
// We can't allow the type property to be changed (since it causes problems in IE)
|
1739 |
+
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
|
1740 |
+
jQuery.error( "type property can't be changed" );
|
1741 |
+
}
|
1742 |
+
|
1743 |
+
if ( value === null ) {
|
1744 |
+
if ( elem.nodeType === 1 ) {
|
1745 |
+
elem.removeAttribute( name );
|
1746 |
+
}
|
1747 |
+
|
1748 |
+
} else {
|
1749 |
+
elem[ name ] = value;
|
1750 |
+
}
|
1751 |
+
}
|
1752 |
+
|
1753 |
+
// browsers index elements by id/name on forms, give priority to attributes.
|
1754 |
+
if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
|
1755 |
+
return elem.getAttributeNode( name ).nodeValue;
|
1756 |
+
}
|
1757 |
+
|
1758 |
+
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
1759 |
+
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
1760 |
+
if ( name === "tabIndex" ) {
|
1761 |
+
var attributeNode = elem.getAttributeNode( "tabIndex" );
|
1762 |
+
|
1763 |
+
return attributeNode && attributeNode.specified ?
|
1764 |
+
attributeNode.value :
|
1765 |
+
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
1766 |
+
0 :
|
1767 |
+
undefined;
|
1768 |
+
}
|
1769 |
+
|
1770 |
+
return elem[ name ];
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
if ( !jQuery.support.style && notxml && name === "style" ) {
|
1774 |
+
if ( set ) {
|
1775 |
+
elem.style.cssText = "" + value;
|
1776 |
+
}
|
1777 |
+
|
1778 |
+
return elem.style.cssText;
|
1779 |
+
}
|
1780 |
+
|
1781 |
+
if ( set ) {
|
1782 |
+
// convert the value to a string (all browsers do this but IE) see #1070
|
1783 |
+
elem.setAttribute( name, "" + value );
|
1784 |
+
}
|
1785 |
+
|
1786 |
+
// Ensure that missing attributes return undefined
|
1787 |
+
// Blackberry 4.7 returns "" from getAttribute #6938
|
1788 |
+
if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
|
1789 |
+
return undefined;
|
1790 |
+
}
|
1791 |
+
|
1792 |
+
var attr = !jQuery.support.hrefNormalized && notxml && special ?
|
1793 |
+
// Some attributes require a special call on IE
|
1794 |
+
elem.getAttribute( name, 2 ) :
|
1795 |
+
elem.getAttribute( name );
|
1796 |
+
|
1797 |
+
// Non-existent attributes return null, we normalize to undefined
|
1798 |
+
return attr === null ? undefined : attr;
|
1799 |
+
}
|
1800 |
+
});
|
1801 |
+
|
1802 |
+
|
1803 |
+
|
1804 |
+
|
1805 |
+
var rnamespaces = /\.(.*)$/,
|
1806 |
+
rformElems = /^(?:textarea|input|select)$/i,
|
1807 |
+
rperiod = /\./g,
|
1808 |
+
rspace = / /g,
|
1809 |
+
rescape = /[^\w\s.|`]/g,
|
1810 |
+
fcleanup = function( nm ) {
|
1811 |
+
return nm.replace(rescape, "\\$&");
|
1812 |
+
},
|
1813 |
+
focusCounts = { focusin: 0, focusout: 0 };
|
1814 |
+
|
1815 |
+
/*
|
1816 |
+
* A number of helper functions used for managing events.
|
1817 |
+
* Many of the ideas behind this code originated from
|
1818 |
+
* Dean Edwards' addEvent library.
|
1819 |
+
*/
|
1820 |
+
jQuery.event = {
|
1821 |
+
|
1822 |
+
// Bind an event to an element
|
1823 |
+
// Original by Dean Edwards
|
1824 |
+
add: function( elem, types, handler, data ) {
|
1825 |
+
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
1826 |
+
return;
|
1827 |
+
}
|
1828 |
+
|
1829 |
+
// For whatever reason, IE has trouble passing the window object
|
1830 |
+
// around, causing it to be cloned in the process
|
1831 |
+
if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
|
1832 |
+
elem = window;
|
1833 |
+
}
|
1834 |
+
|
1835 |
+
if ( handler === false ) {
|
1836 |
+
handler = returnFalse;
|
1837 |
+
} else if ( !handler ) {
|
1838 |
+
// Fixes bug #7229. Fix recommended by jdalton
|
1839 |
+
return;
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
var handleObjIn, handleObj;
|
1843 |
+
|
1844 |
+
if ( handler.handler ) {
|
1845 |
+
handleObjIn = handler;
|
1846 |
+
handler = handleObjIn.handler;
|
1847 |
+
}
|
1848 |
+
|
1849 |
+
// Make sure that the function being executed has a unique ID
|
1850 |
+
if ( !handler.guid ) {
|
1851 |
+
handler.guid = jQuery.guid++;
|
1852 |
+
}
|
1853 |
+
|
1854 |
+
// Init the element's event structure
|
1855 |
+
var elemData = jQuery.data( elem );
|
1856 |
+
|
1857 |
+
// If no elemData is found then we must be trying to bind to one of the
|
1858 |
+
// banned noData elements
|
1859 |
+
if ( !elemData ) {
|
1860 |
+
return;
|
1861 |
+
}
|
1862 |
+
|
1863 |
+
// Use a key less likely to result in collisions for plain JS objects.
|
1864 |
+
// Fixes bug #7150.
|
1865 |
+
var eventKey = elem.nodeType ? "events" : "__events__",
|
1866 |
+
events = elemData[ eventKey ],
|
1867 |
+
eventHandle = elemData.handle;
|
1868 |
+
|
1869 |
+
if ( typeof events === "function" ) {
|
1870 |
+
// On plain objects events is a fn that holds the the data
|
1871 |
+
// which prevents this data from being JSON serialized
|
1872 |
+
// the function does not need to be called, it just contains the data
|
1873 |
+
eventHandle = events.handle;
|
1874 |
+
events = events.events;
|
1875 |
+
|
1876 |
+
} else if ( !events ) {
|
1877 |
+
if ( !elem.nodeType ) {
|
1878 |
+
// On plain objects, create a fn that acts as the holder
|
1879 |
+
// of the values to avoid JSON serialization of event data
|
1880 |
+
elemData[ eventKey ] = elemData = function(){};
|
1881 |
+
}
|
1882 |
+
|
1883 |
+
elemData.events = events = {};
|
1884 |
+
}
|
1885 |
+
|
1886 |
+
if ( !eventHandle ) {
|
1887 |
+
elemData.handle = eventHandle = function() {
|
1888 |
+
// Handle the second event of a trigger and when
|
1889 |
+
// an event is called after a page has unloaded
|
1890 |
+
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
|
1891 |
+
jQuery.event.handle.apply( eventHandle.elem, arguments ) :
|
1892 |
+
undefined;
|
1893 |
+
};
|
1894 |
+
}
|
1895 |
+
|
1896 |
+
// Add elem as a property of the handle function
|
1897 |
+
// This is to prevent a memory leak with non-native events in IE.
|
1898 |
+
eventHandle.elem = elem;
|
1899 |
+
|
1900 |
+
// Handle multiple events separated by a space
|
1901 |
+
// jQuery(...).bind("mouseover mouseout", fn);
|
1902 |
+
types = types.split(" ");
|
1903 |
+
|
1904 |
+
var type, i = 0, namespaces;
|
1905 |
+
|
1906 |
+
while ( (type = types[ i++ ]) ) {
|
1907 |
+
handleObj = handleObjIn ?
|
1908 |
+
jQuery.extend({}, handleObjIn) :
|
1909 |
+
{ handler: handler, data: data };
|
1910 |
+
|
1911 |
+
// Namespaced event handlers
|
1912 |
+
if ( type.indexOf(".") > -1 ) {
|
1913 |
+
namespaces = type.split(".");
|
1914 |
+
type = namespaces.shift();
|
1915 |
+
handleObj.namespace = namespaces.slice(0).sort().join(".");
|
1916 |
+
|
1917 |
+
} else {
|
1918 |
+
namespaces = [];
|
1919 |
+
handleObj.namespace = "";
|
1920 |
+
}
|
1921 |
+
|
1922 |
+
handleObj.type = type;
|
1923 |
+
if ( !handleObj.guid ) {
|
1924 |
+
handleObj.guid = handler.guid;
|
1925 |
+
}
|
1926 |
+
|
1927 |
+
// Get the current list of functions bound to this event
|
1928 |
+
var handlers = events[ type ],
|
1929 |
+
special = jQuery.event.special[ type ] || {};
|
1930 |
+
|
1931 |
+
// Init the event handler queue
|
1932 |
+
if ( !handlers ) {
|
1933 |
+
handlers = events[ type ] = [];
|
1934 |
+
|
1935 |
+
// Check for a special event handler
|
1936 |
+
// Only use addEventListener/attachEvent if the special
|
1937 |
+
// events handler returns false
|
1938 |
+
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
1939 |
+
// Bind the global event handler to the element
|
1940 |
+
if ( elem.addEventListener ) {
|
1941 |
+
elem.addEventListener( type, eventHandle, false );
|
1942 |
+
|
1943 |
+
} else if ( elem.attachEvent ) {
|
1944 |
+
elem.attachEvent( "on" + type, eventHandle );
|
1945 |
+
}
|
1946 |
+
}
|
1947 |
+
}
|
1948 |
+
|
1949 |
+
if ( special.add ) {
|
1950 |
+
special.add.call( elem, handleObj );
|
1951 |
+
|
1952 |
+
if ( !handleObj.handler.guid ) {
|
1953 |
+
handleObj.handler.guid = handler.guid;
|
1954 |
+
}
|
1955 |
+
}
|
1956 |
+
|
1957 |
+
// Add the function to the element's handler list
|
1958 |
+
handlers.push( handleObj );
|
1959 |
+
|
1960 |
+
// Keep track of which events have been used, for global triggering
|
1961 |
+
jQuery.event.global[ type ] = true;
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
// Nullify elem to prevent memory leaks in IE
|
1965 |
+
elem = null;
|
1966 |
+
},
|
1967 |
+
|
1968 |
+
global: {},
|
1969 |
+
|
1970 |
+
// Detach an event or set of events from an element
|
1971 |
+
remove: function( elem, types, handler, pos ) {
|
1972 |
+
// don't do events on text and comment nodes
|
1973 |
+
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
1974 |
+
return;
|
1975 |
+
}
|
1976 |
+
|
1977 |
+
if ( handler === false ) {
|
1978 |
+
handler = returnFalse;
|
1979 |
+
}
|
1980 |
+
|
1981 |
+
var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
|
1982 |
+
eventKey = elem.nodeType ? "events" : "__events__",
|
1983 |
+
elemData = jQuery.data( elem ),
|
1984 |
+
events = elemData && elemData[ eventKey ];
|
1985 |
+
|
1986 |
+
if ( !elemData || !events ) {
|
1987 |
+
return;
|
1988 |
+
}
|
1989 |
+
|
1990 |
+
if ( typeof events === "function" ) {
|
1991 |
+
elemData = events;
|
1992 |
+
events = events.events;
|
1993 |
+
}
|
1994 |
+
|
1995 |
+
// types is actually an event object here
|
1996 |
+
if ( types && types.type ) {
|
1997 |
+
handler = types.handler;
|
1998 |
+
types = types.type;
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
// Unbind all events for the element
|
2002 |
+
if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
|
2003 |
+
types = types || "";
|
2004 |
+
|
2005 |
+
for ( type in events ) {
|
2006 |
+
jQuery.event.remove( elem, type + types );
|
2007 |
+
}
|
2008 |
+
|
2009 |
+
return;
|
2010 |
+
}
|
2011 |
+
|
2012 |
+
// Handle multiple events separated by a space
|
2013 |
+
// jQuery(...).unbind("mouseover mouseout", fn);
|
2014 |
+
types = types.split(" ");
|
2015 |
+
|
2016 |
+
while ( (type = types[ i++ ]) ) {
|
2017 |
+
origType = type;
|
2018 |
+
handleObj = null;
|
2019 |
+
all = type.indexOf(".") < 0;
|
2020 |
+
namespaces = [];
|
2021 |
+
|
2022 |
+
if ( !all ) {
|
2023 |
+
// Namespaced event handlers
|
2024 |
+
namespaces = type.split(".");
|
2025 |
+
type = namespaces.shift();
|
2026 |
+
|
2027 |
+
namespace = new RegExp("(^|\\.)" +
|
2028 |
+
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
|
2029 |
+
}
|
2030 |
+
|
2031 |
+
eventType = events[ type ];
|
2032 |
+
|
2033 |
+
if ( !eventType ) {
|
2034 |
+
continue;
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
if ( !handler ) {
|
2038 |
+
for ( j = 0; j < eventType.length; j++ ) {
|
2039 |
+
handleObj = eventType[ j ];
|
2040 |
+
|
2041 |
+
if ( all || namespace.test( handleObj.namespace ) ) {
|
2042 |
+
jQuery.event.remove( elem, origType, handleObj.handler, j );
|
2043 |
+
eventType.splice( j--, 1 );
|
2044 |
+
}
|
2045 |
+
}
|
2046 |
+
|
2047 |
+
continue;
|
2048 |
+
}
|
2049 |
+
|
2050 |
+
special = jQuery.event.special[ type ] || {};
|
2051 |
+
|
2052 |
+
for ( j = pos || 0; j < eventType.length; j++ ) {
|
2053 |
+
handleObj = eventType[ j ];
|
2054 |
+
|
2055 |
+
if ( handler.guid === handleObj.guid ) {
|
2056 |
+
// remove the given handler for the given type
|
2057 |
+
if ( all || namespace.test( handleObj.namespace ) ) {
|
2058 |
+
if ( pos == null ) {
|
2059 |
+
eventType.splice( j--, 1 );
|
2060 |
+
}
|
2061 |
+
|
2062 |
+
if ( special.remove ) {
|
2063 |
+
special.remove.call( elem, handleObj );
|
2064 |
+
}
|
2065 |
+
}
|
2066 |
+
|
2067 |
+
if ( pos != null ) {
|
2068 |
+
break;
|
2069 |
+
}
|
2070 |
+
}
|
2071 |
+
}
|
2072 |
+
|
2073 |
+
// remove generic event handler if no more handlers exist
|
2074 |
+
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
|
2075 |
+
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
|
2076 |
+
jQuery.removeEvent( elem, type, elemData.handle );
|
2077 |
+
}
|
2078 |
+
|
2079 |
+
ret = null;
|
2080 |
+
delete events[ type ];
|
2081 |
+
}
|
2082 |
+
}
|
2083 |
+
|
2084 |
+
// Remove the expando if it's no longer used
|
2085 |
+
if ( jQuery.isEmptyObject( events ) ) {
|
2086 |
+
var handle = elemData.handle;
|
2087 |
+
if ( handle ) {
|
2088 |
+
handle.elem = null;
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
delete elemData.events;
|
2092 |
+
delete elemData.handle;
|
2093 |
+
|
2094 |
+
if ( typeof elemData === "function" ) {
|
2095 |
+
jQuery.removeData( elem, eventKey );
|
2096 |
+
|
2097 |
+
} else if ( jQuery.isEmptyObject( elemData ) ) {
|
2098 |
+
jQuery.removeData( elem );
|
2099 |
+
}
|
2100 |
+
}
|
2101 |
+
},
|
2102 |
+
|
2103 |
+
// bubbling is internal
|
2104 |
+
trigger: function( event, data, elem /*, bubbling */ ) {
|
2105 |
+
// Event object or event type
|
2106 |
+
var type = event.type || event,
|
2107 |
+
bubbling = arguments[3];
|
2108 |
+
|
2109 |
+
if ( !bubbling ) {
|
2110 |
+
event = typeof event === "object" ?
|
2111 |
+
// jQuery.Event object
|
2112 |
+
event[ jQuery.expando ] ? event :
|
2113 |
+
// Object literal
|
2114 |
+
jQuery.extend( jQuery.Event(type), event ) :
|
2115 |
+
// Just the event type (string)
|
2116 |
+
jQuery.Event(type);
|
2117 |
+
|
2118 |
+
if ( type.indexOf("!") >= 0 ) {
|
2119 |
+
event.type = type = type.slice(0, -1);
|
2120 |
+
event.exclusive = true;
|
2121 |
+
}
|
2122 |
+
|
2123 |
+
// Handle a global trigger
|
2124 |
+
if ( !elem ) {
|
2125 |
+
// Don't bubble custom events when global (to avoid too much overhead)
|
2126 |
+
event.stopPropagation();
|
2127 |
+
|
2128 |
+
// Only trigger if we've ever bound an event for it
|
2129 |
+
if ( jQuery.event.global[ type ] ) {
|
2130 |
+
jQuery.each( jQuery.cache, function() {
|
2131 |
+
if ( this.events && this.events[type] ) {
|
2132 |
+
jQuery.event.trigger( event, data, this.handle.elem );
|
2133 |
+
}
|
2134 |
+
});
|
2135 |
+
}
|
2136 |
+
}
|
2137 |
+
|
2138 |
+
// Handle triggering a single element
|
2139 |
+
|
2140 |
+
// don't do events on text and comment nodes
|
2141 |
+
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
|
2142 |
+
return undefined;
|
2143 |
+
}
|
2144 |
+
|
2145 |
+
// Clean up in case it is reused
|
2146 |
+
event.result = undefined;
|
2147 |
+
event.target = elem;
|
2148 |
+
|
2149 |
+
// Clone the incoming data, if any
|
2150 |
+
data = jQuery.makeArray( data );
|
2151 |
+
data.unshift( event );
|
2152 |
+
}
|
2153 |
+
|
2154 |
+
event.currentTarget = elem;
|
2155 |
+
|
2156 |
+
// Trigger the event, it is assumed that "handle" is a function
|
2157 |
+
var handle = elem.nodeType ?
|
2158 |
+
jQuery.data( elem, "handle" ) :
|
2159 |
+
(jQuery.data( elem, "__events__" ) || {}).handle;
|
2160 |
+
|
2161 |
+
if ( handle ) {
|
2162 |
+
handle.apply( elem, data );
|
2163 |
+
}
|
2164 |
+
|
2165 |
+
var parent = elem.parentNode || elem.ownerDocument;
|
2166 |
+
|
2167 |
+
// Trigger an inline bound script
|
2168 |
+
try {
|
2169 |
+
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
|
2170 |
+
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
|
2171 |
+
event.result = false;
|
2172 |
+
event.preventDefault();
|
2173 |
+
}
|
2174 |
+
}
|
2175 |
+
|
2176 |
+
// prevent IE from throwing an error for some elements with some event types, see #3533
|
2177 |
+
} catch (inlineError) {}
|
2178 |
+
|
2179 |
+
if ( !event.isPropagationStopped() && parent ) {
|
2180 |
+
jQuery.event.trigger( event, data, parent, true );
|
2181 |
+
|
2182 |
+
} else if ( !event.isDefaultPrevented() ) {
|
2183 |
+
var old,
|
2184 |
+
target = event.target,
|
2185 |
+
targetType = type.replace( rnamespaces, "" ),
|
2186 |
+
isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
|
2187 |
+
special = jQuery.event.special[ targetType ] || {};
|
2188 |
+
|
2189 |
+
if ( (!special._default || special._default.call( elem, event ) === false) &&
|
2190 |
+
!isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
|
2191 |
+
|
2192 |
+
try {
|
2193 |
+
if ( target[ targetType ] ) {
|
2194 |
+
// Make sure that we don't accidentally re-trigger the onFOO events
|
2195 |
+
old = target[ "on" + targetType ];
|
2196 |
+
|
2197 |
+
if ( old ) {
|
2198 |
+
target[ "on" + targetType ] = null;
|
2199 |
+
}
|
2200 |
+
|
2201 |
+
jQuery.event.triggered = true;
|
2202 |
+
target[ targetType ]();
|
2203 |
+
}
|
2204 |
+
|
2205 |
+
// prevent IE from throwing an error for some elements with some event types, see #3533
|
2206 |
+
} catch (triggerError) {}
|
2207 |
+
|
2208 |
+
if ( old ) {
|
2209 |
+
target[ "on" + targetType ] = old;
|
2210 |
+
}
|
2211 |
+
|
2212 |
+
jQuery.event.triggered = false;
|
2213 |
+
}
|
2214 |
+
}
|
2215 |
+
},
|
2216 |
+
|
2217 |
+
handle: function( event ) {
|
2218 |
+
var all, handlers, namespaces, namespace_re, events,
|
2219 |
+
namespace_sort = [],
|
2220 |
+
args = jQuery.makeArray( arguments );
|
2221 |
+
|
2222 |
+
event = args[0] = jQuery.event.fix( event || window.event );
|
2223 |
+
event.currentTarget = this;
|
2224 |
+
|
2225 |
+
// Namespaced event handlers
|
2226 |
+
all = event.type.indexOf(".") < 0 && !event.exclusive;
|
2227 |
+
|
2228 |
+
if ( !all ) {
|
2229 |
+
namespaces = event.type.split(".");
|
2230 |
+
event.type = namespaces.shift();
|
2231 |
+
namespace_sort = namespaces.slice(0).sort();
|
2232 |
+
namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
|
2233 |
+
}
|
2234 |
+
|
2235 |
+
event.namespace = event.namespace || namespace_sort.join(".");
|
2236 |
+
|
2237 |
+
events = jQuery.data(this, this.nodeType ? "events" : "__events__");
|
2238 |
+
|
2239 |
+
if ( typeof events === "function" ) {
|
2240 |
+
events = events.events;
|
2241 |
+
}
|
2242 |
+
|
2243 |
+
handlers = (events || {})[ event.type ];
|
2244 |
+
|
2245 |
+
if ( events && handlers ) {
|
2246 |
+
// Clone the handlers to prevent manipulation
|
2247 |
+
handlers = handlers.slice(0);
|
2248 |
+
|
2249 |
+
for ( var j = 0, l = handlers.length; j < l; j++ ) {
|
2250 |
+
var handleObj = handlers[ j ];
|
2251 |
+
|
2252 |
+
// Filter the functions by class
|
2253 |
+
if ( all || namespace_re.test( handleObj.namespace ) ) {
|
2254 |
+
// Pass in a reference to the handler function itself
|
2255 |
+
// So that we can later remove it
|
2256 |
+
event.handler = handleObj.handler;
|
2257 |
+
event.data = handleObj.data;
|
2258 |
+
event.handleObj = handleObj;
|
2259 |
+
|
2260 |
+
var ret = handleObj.handler.apply( this, args );
|
2261 |
+
|
2262 |
+
if ( ret !== undefined ) {
|
2263 |
+
event.result = ret;
|
2264 |
+
if ( ret === false ) {
|
2265 |
+
event.preventDefault();
|
2266 |
+
event.stopPropagation();
|
2267 |
+
}
|
2268 |
+
}
|
2269 |
+
|
2270 |
+
if ( event.isImmediatePropagationStopped() ) {
|
2271 |
+
break;
|
2272 |
+
}
|
2273 |
+
}
|
2274 |
+
}
|
2275 |
+
}
|
2276 |
+
|
2277 |
+
return event.result;
|
2278 |
+
},
|
2279 |
+
|
2280 |
+
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
|
2281 |
+
|
2282 |
+
fix: function( event ) {
|
2283 |
+
if ( event[ jQuery.expando ] ) {
|
2284 |
+
return event;
|
2285 |
+
}
|
2286 |
+
|
2287 |
+
// store a copy of the original event object
|
2288 |
+
// and "clone" to set read-only properties
|
2289 |
+
var originalEvent = event;
|
2290 |
+
event = jQuery.Event( originalEvent );
|
2291 |
+
|
2292 |
+
for ( var i = this.props.length, prop; i; ) {
|
2293 |
+
prop = this.props[ --i ];
|
2294 |
+
event[ prop ] = originalEvent[ prop ];
|
2295 |
+
}
|
2296 |
+
|
2297 |
+
// Fix target property, if necessary
|
2298 |
+
if ( !event.target ) {
|
2299 |
+
// Fixes #1925 where srcElement might not be defined either
|
2300 |
+
event.target = event.srcElement || document;
|
2301 |
+
}
|
2302 |
+
|
2303 |
+
// check if target is a textnode (safari)
|
2304 |
+
if ( event.target.nodeType === 3 ) {
|
2305 |
+
event.target = event.target.parentNode;
|
2306 |
+
}
|
2307 |
+
|
2308 |
+
// Add relatedTarget, if necessary
|
2309 |
+
if ( !event.relatedTarget && event.fromElement ) {
|
2310 |
+
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
|
2311 |
+
}
|
2312 |
+
|
2313 |
+
// Calculate pageX/Y if missing and clientX/Y available
|
2314 |
+
if ( event.pageX == null && event.clientX != null ) {
|
2315 |
+
var doc = document.documentElement,
|
2316 |
+
body = document.body;
|
2317 |
+
|
2318 |
+
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
|
2319 |
+
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
|
2320 |
+
}
|
2321 |
+
|
2322 |
+
// Add which for key events
|
2323 |
+
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
|
2324 |
+
event.which = event.charCode != null ? event.charCode : event.keyCode;
|
2325 |
+
}
|
2326 |
+
|
2327 |
+
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
|
2328 |
+
if ( !event.metaKey && event.ctrlKey ) {
|
2329 |
+
event.metaKey = event.ctrlKey;
|
2330 |
+
}
|
2331 |
+
|
2332 |
+
// Add which for click: 1 === left; 2 === middle; 3 === right
|
2333 |
+
// Note: button is not normalized, so don't use it
|
2334 |
+
if ( !event.which && event.button !== undefined ) {
|
2335 |
+
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
return event;
|
2339 |
+
},
|
2340 |
+
|
2341 |
+
// Deprecated, use jQuery.guid instead
|
2342 |
+
guid: 1E8,
|
2343 |
+
|
2344 |
+
// Deprecated, use jQuery.proxy instead
|
2345 |
+
proxy: jQuery.proxy,
|
2346 |
+
|
2347 |
+
special: {
|
2348 |
+
ready: {
|
2349 |
+
// Make sure the ready event is setup
|
2350 |
+
setup: jQuery.bindReady,
|
2351 |
+
teardown: jQuery.noop
|
2352 |
+
},
|
2353 |
+
|
2354 |
+
live: {
|
2355 |
+
add: function( handleObj ) {
|
2356 |
+
jQuery.event.add( this,
|
2357 |
+
liveConvert( handleObj.origType, handleObj.selector ),
|
2358 |
+
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
|
2359 |
+
},
|
2360 |
+
|
2361 |
+
remove: function( handleObj ) {
|
2362 |
+
jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
|
2363 |
+
}
|
2364 |
+
},
|
2365 |
+
|
2366 |
+
beforeunload: {
|
2367 |
+
setup: function( data, namespaces, eventHandle ) {
|
2368 |
+
// We only want to do this special case on windows
|
2369 |
+
if ( jQuery.isWindow( this ) ) {
|
2370 |
+
this.onbeforeunload = eventHandle;
|
2371 |
+
}
|
2372 |
+
},
|
2373 |
+
|
2374 |
+
teardown: function( namespaces, eventHandle ) {
|
2375 |
+
if ( this.onbeforeunload === eventHandle ) {
|
2376 |
+
this.onbeforeunload = null;
|
2377 |
+
}
|
2378 |
+
}
|
2379 |
+
}
|
2380 |
+
}
|
2381 |
+
};
|
2382 |
+
|
2383 |
+
jQuery.removeEvent = document.removeEventListener ?
|
2384 |
+
function( elem, type, handle ) {
|
2385 |
+
if ( elem.removeEventListener ) {
|
2386 |
+
elem.removeEventListener( type, handle, false );
|
2387 |
+
}
|
2388 |
+
} :
|
2389 |
+
function( elem, type, handle ) {
|
2390 |
+
if ( elem.detachEvent ) {
|
2391 |
+
elem.detachEvent( "on" + type, handle );
|
2392 |
+
}
|
2393 |
+
};
|
2394 |
+
|
2395 |
+
jQuery.Event = function( src ) {
|
2396 |
+
// Allow instantiation without the 'new' keyword
|
2397 |
+
if ( !this.preventDefault ) {
|
2398 |
+
return new jQuery.Event( src );
|
2399 |
+
}
|
2400 |
+
|
2401 |
+
// Event object
|
2402 |
+
if ( src && src.type ) {
|
2403 |
+
this.originalEvent = src;
|
2404 |
+
this.type = src.type;
|
2405 |
+
// Event type
|
2406 |
+
} else {
|
2407 |
+
this.type = src;
|
2408 |
+
}
|
2409 |
+
|
2410 |
+
// timeStamp is buggy for some events on Firefox(#3843)
|
2411 |
+
// So we won't rely on the native value
|
2412 |
+
this.timeStamp = jQuery.now();
|
2413 |
+
|
2414 |
+
// Mark it as fixed
|
2415 |
+
this[ jQuery.expando ] = true;
|
2416 |
+
};
|
2417 |
+
|
2418 |
+
function returnFalse() {
|
2419 |
+
return false;
|
2420 |
+
}
|
2421 |
+
function returnTrue() {
|
2422 |
+
return true;
|
2423 |
+
}
|
2424 |
+
|
2425 |
+
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
2426 |
+
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
2427 |
+
jQuery.Event.prototype = {
|
2428 |
+
preventDefault: function() {
|
2429 |
+
this.isDefaultPrevented = returnTrue;
|
2430 |
+
|
2431 |
+
var e = this.originalEvent;
|
2432 |
+
if ( !e ) {
|
2433 |
+
return;
|
2434 |
+
}
|
2435 |
+
|
2436 |
+
// if preventDefault exists run it on the original event
|
2437 |
+
if ( e.preventDefault ) {
|
2438 |
+
e.preventDefault();
|
2439 |
+
|
2440 |
+
// otherwise set the returnValue property of the original event to false (IE)
|
2441 |
+
} else {
|
2442 |
+
e.returnValue = false;
|
2443 |
+
}
|
2444 |
+
},
|
2445 |
+
stopPropagation: function() {
|
2446 |
+
this.isPropagationStopped = returnTrue;
|
2447 |
+
|
2448 |
+
var e = this.originalEvent;
|
2449 |
+
if ( !e ) {
|
2450 |
+
return;
|
2451 |
+
}
|
2452 |
+
// if stopPropagation exists run it on the original event
|
2453 |
+
if ( e.stopPropagation ) {
|
2454 |
+
e.stopPropagation();
|
2455 |
+
}
|
2456 |
+
// otherwise set the cancelBubble property of the original event to true (IE)
|
2457 |
+
e.cancelBubble = true;
|
2458 |
+
},
|
2459 |
+
stopImmediatePropagation: function() {
|
2460 |
+
this.isImmediatePropagationStopped = returnTrue;
|
2461 |
+
this.stopPropagation();
|
2462 |
+
},
|
2463 |
+
isDefaultPrevented: returnFalse,
|
2464 |
+
isPropagationStopped: returnFalse,
|
2465 |
+
isImmediatePropagationStopped: returnFalse
|
2466 |
+
};
|
2467 |
+
|
2468 |
+
// Checks if an event happened on an element within another element
|
2469 |
+
// Used in jQuery.event.special.mouseenter and mouseleave handlers
|
2470 |
+
var withinElement = function( event ) {
|
2471 |
+
// Check if mouse(over|out) are still within the same parent element
|
2472 |
+
var parent = event.relatedTarget;
|
2473 |
+
|
2474 |
+
// Firefox sometimes assigns relatedTarget a XUL element
|
2475 |
+
// which we cannot access the parentNode property of
|
2476 |
+
try {
|
2477 |
+
// Traverse up the tree
|
2478 |
+
while ( parent && parent !== this ) {
|
2479 |
+
parent = parent.parentNode;
|
2480 |
+
}
|
2481 |
+
|
2482 |
+
if ( parent !== this ) {
|
2483 |
+
// set the correct event type
|
2484 |
+
event.type = event.data;
|
2485 |
+
|
2486 |
+
// handle event if we actually just moused on to a non sub-element
|
2487 |
+
jQuery.event.handle.apply( this, arguments );
|
2488 |
+
}
|
2489 |
+
|
2490 |
+
// assuming we've left the element since we most likely mousedover a xul element
|
2491 |
+
} catch(e) { }
|
2492 |
+
},
|
2493 |
+
|
2494 |
+
// In case of event delegation, we only need to rename the event.type,
|
2495 |
+
// liveHandler will take care of the rest.
|
2496 |
+
delegate = function( event ) {
|
2497 |
+
event.type = event.data;
|
2498 |
+
jQuery.event.handle.apply( this, arguments );
|
2499 |
+
};
|
2500 |
+
|
2501 |
+
// Create mouseenter and mouseleave events
|
2502 |
+
jQuery.each({
|
2503 |
+
mouseenter: "mouseover",
|
2504 |
+
mouseleave: "mouseout"
|
2505 |
+
}, function( orig, fix ) {
|
2506 |
+
jQuery.event.special[ orig ] = {
|
2507 |
+
setup: function( data ) {
|
2508 |
+
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
|
2509 |
+
},
|
2510 |
+
teardown: function( data ) {
|
2511 |
+
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
|
2512 |
+
}
|
2513 |
+
};
|
2514 |
+
});
|
2515 |
+
|
2516 |
+
// submit delegation
|
2517 |
+
if ( !jQuery.support.submitBubbles ) {
|
2518 |
+
|
2519 |
+
jQuery.event.special.submit = {
|
2520 |
+
setup: function( data, namespaces ) {
|
2521 |
+
if ( this.nodeName.toLowerCase() !== "form" ) {
|
2522 |
+
jQuery.event.add(this, "click.specialSubmit", function( e ) {
|
2523 |
+
var elem = e.target,
|
2524 |
+
type = elem.type;
|
2525 |
+
|
2526 |
+
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
|
2527 |
+
e.liveFired = undefined;
|
2528 |
+
return trigger( "submit", this, arguments );
|
2529 |
+
}
|
2530 |
+
});
|
2531 |
+
|
2532 |
+
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
|
2533 |
+
var elem = e.target,
|
2534 |
+
type = elem.type;
|
2535 |
+
|
2536 |
+
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
|
2537 |
+
e.liveFired = undefined;
|
2538 |
+
return trigger( "submit", this, arguments );
|
2539 |
+
}
|
2540 |
+
});
|
2541 |
+
|
2542 |
+
} else {
|
2543 |
+
return false;
|
2544 |
+
}
|
2545 |
+
},
|
2546 |
+
|
2547 |
+
teardown: function( namespaces ) {
|
2548 |
+
jQuery.event.remove( this, ".specialSubmit" );
|
2549 |
+
}
|
2550 |
+
};
|
2551 |
+
|
2552 |
+
}
|
2553 |
+
|
2554 |
+
// change delegation, happens here so we have bind.
|
2555 |
+
if ( !jQuery.support.changeBubbles ) {
|
2556 |
+
|
2557 |
+
var changeFilters,
|
2558 |
+
|
2559 |
+
getVal = function( elem ) {
|
2560 |
+
var type = elem.type, val = elem.value;
|
2561 |
+
|
2562 |
+
if ( type === "radio" || type === "checkbox" ) {
|
2563 |
+
val = elem.checked;
|
2564 |
+
|
2565 |
+
} else if ( type === "select-multiple" ) {
|
2566 |
+
val = elem.selectedIndex > -1 ?
|
2567 |
+
jQuery.map( elem.options, function( elem ) {
|
2568 |
+
return elem.selected;
|
2569 |
+
}).join("-") :
|
2570 |
+
"";
|
2571 |
+
|
2572 |
+
} else if ( elem.nodeName.toLowerCase() === "select" ) {
|
2573 |
+
val = elem.selectedIndex;
|
2574 |
+
}
|
2575 |
+
|
2576 |
+
return val;
|
2577 |
+
},
|
2578 |
+
|
2579 |
+
testChange = function testChange( e ) {
|
2580 |
+
var elem = e.target, data, val;
|
2581 |
+
|
2582 |
+
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
|
2583 |
+
return;
|
2584 |
+
}
|
2585 |
+
|
2586 |
+
data = jQuery.data( elem, "_change_data" );
|
2587 |
+
val = getVal(elem);
|
2588 |
+
|
2589 |
+
// the current data will be also retrieved by beforeactivate
|
2590 |
+
if ( e.type !== "focusout" || elem.type !== "radio" ) {
|
2591 |
+
jQuery.data( elem, "_change_data", val );
|
2592 |
+
}
|
2593 |
+
|
2594 |
+
if ( data === undefined || val === data ) {
|
2595 |
+
return;
|
2596 |
+
}
|
2597 |
+
|
2598 |
+
if ( data != null || val ) {
|
2599 |
+
e.type = "change";
|
2600 |
+
e.liveFired = undefined;
|
2601 |
+
return jQuery.event.trigger( e, arguments[1], elem );
|
2602 |
+
}
|
2603 |
+
};
|
2604 |
+
|
2605 |
+
jQuery.event.special.change = {
|
2606 |
+
filters: {
|
2607 |
+
focusout: testChange,
|
2608 |
+
|
2609 |
+
beforedeactivate: testChange,
|
2610 |
+
|
2611 |
+
click: function( e ) {
|
2612 |
+
var elem = e.target, type = elem.type;
|
2613 |
+
|
2614 |
+
if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
|
2615 |
+
return testChange.call( this, e );
|
2616 |
+
}
|
2617 |
+
},
|
2618 |
+
|
2619 |
+
// Change has to be called before submit
|
2620 |
+
// Keydown will be called before keypress, which is used in submit-event delegation
|
2621 |
+
keydown: function( e ) {
|
2622 |
+
var elem = e.target, type = elem.type;
|
2623 |
+
|
2624 |
+
if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
|
2625 |
+
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
|
2626 |
+
type === "select-multiple" ) {
|
2627 |
+
return testChange.call( this, e );
|
2628 |
+
}
|
2629 |
+
},
|
2630 |
+
|
2631 |
+
// Beforeactivate happens also before the previous element is blurred
|
2632 |
+
// with this event you can't trigger a change event, but you can store
|
2633 |
+
// information
|
2634 |
+
beforeactivate: function( e ) {
|
2635 |
+
var elem = e.target;
|
2636 |
+
jQuery.data( elem, "_change_data", getVal(elem) );
|
2637 |
+
}
|
2638 |
+
},
|
2639 |
+
|
2640 |
+
setup: function( data, namespaces ) {
|
2641 |
+
if ( this.type === "file" ) {
|
2642 |
+
return false;
|
2643 |
+
}
|
2644 |
+
|
2645 |
+
for ( var type in changeFilters ) {
|
2646 |
+
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
|
2647 |
+
}
|
2648 |
+
|
2649 |
+
return rformElems.test( this.nodeName );
|
2650 |
+
},
|
2651 |
+
|
2652 |
+
teardown: function( namespaces ) {
|
2653 |
+
jQuery.event.remove( this, ".specialChange" );
|
2654 |
+
|
2655 |
+
return rformElems.test( this.nodeName );
|
2656 |
+
}
|
2657 |
+
};
|
2658 |
+
|
2659 |
+
changeFilters = jQuery.event.special.change.filters;
|
2660 |
+
|
2661 |
+
// Handle when the input is .focus()'d
|
2662 |
+
changeFilters.focus = changeFilters.beforeactivate;
|
2663 |
+
}
|
2664 |
+
|
2665 |
+
function trigger( type, elem, args ) {
|
2666 |
+
args[0].type = type;
|
2667 |
+
return jQuery.event.handle.apply( elem, args );
|
2668 |
+
}
|
2669 |
+
|
2670 |
+
// Create "bubbling" focus and blur events
|
2671 |
+
if ( document.addEventListener ) {
|
2672 |
+
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
2673 |
+
jQuery.event.special[ fix ] = {
|
2674 |
+
setup: function() {
|
2675 |
+
if ( focusCounts[fix]++ === 0 ) {
|
2676 |
+
document.addEventListener( orig, handler, true );
|
2677 |
+
}
|
2678 |
+
},
|
2679 |
+
teardown: function() {
|
2680 |
+
if ( --focusCounts[fix] === 0 ) {
|
2681 |
+
document.removeEventListener( orig, handler, true );
|
2682 |
+
}
|
2683 |
+
}
|
2684 |
+
};
|
2685 |
+
|
2686 |
+
function handler( e ) {
|
2687 |
+
e = jQuery.event.fix( e );
|
2688 |
+
e.type = fix;
|
2689 |
+
return jQuery.event.trigger( e, null, e.target );
|
2690 |
+
}
|
2691 |
+
});
|
2692 |
+
}
|
2693 |
+
|
2694 |
+
jQuery.each(["bind", "one"], function( i, name ) {
|
2695 |
+
jQuery.fn[ name ] = function( type, data, fn ) {
|
2696 |
+
// Handle object literals
|
2697 |
+
if ( typeof type === "object" ) {
|
2698 |
+
for ( var key in type ) {
|
2699 |
+
this[ name ](key, data, type[key], fn);
|
2700 |
+
}
|
2701 |
+
return this;
|
2702 |
+
}
|
2703 |
+
|
2704 |
+
if ( jQuery.isFunction( data ) || data === false ) {
|
2705 |
+
fn = data;
|
2706 |
+
data = undefined;
|
2707 |
+
}
|
2708 |
+
|
2709 |
+
var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
|
2710 |
+
jQuery( this ).unbind( event, handler );
|
2711 |
+
return fn.apply( this, arguments );
|
2712 |
+
}) : fn;
|
2713 |
+
|
2714 |
+
if ( type === "unload" && name !== "one" ) {
|
2715 |
+
this.one( type, data, fn );
|
2716 |
+
|
2717 |
+
} else {
|
2718 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
2719 |
+
jQuery.event.add( this[i], type, handler, data );
|
2720 |
+
}
|
2721 |
+
}
|
2722 |
+
|
2723 |
+
return this;
|
2724 |
+
};
|
2725 |
+
});
|
2726 |
+
|
2727 |
+
jQuery.fn.extend({
|
2728 |
+
unbind: function( type, fn ) {
|
2729 |
+
// Handle object literals
|
2730 |
+
if ( typeof type === "object" && !type.preventDefault ) {
|
2731 |
+
for ( var key in type ) {
|
2732 |
+
this.unbind(key, type[key]);
|
2733 |
+
}
|
2734 |
+
|
2735 |
+
} else {
|
2736 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
2737 |
+
jQuery.event.remove( this[i], type, fn );
|
2738 |
+
}
|
2739 |
+
}
|
2740 |
+
|
2741 |
+
return this;
|
2742 |
+
},
|
2743 |
+
|
2744 |
+
delegate: function( selector, types, data, fn ) {
|
2745 |
+
return this.live( types, data, fn, selector );
|
2746 |
+
},
|
2747 |
+
|
2748 |
+
undelegate: function( selector, types, fn ) {
|
2749 |
+
if ( arguments.length === 0 ) {
|
2750 |
+
return this.unbind( "live" );
|
2751 |
+
|
2752 |
+
} else {
|
2753 |
+
return this.die( types, null, fn, selector );
|
2754 |
+
}
|
2755 |
+
},
|
2756 |
+
|
2757 |
+
trigger: function( type, data ) {
|
2758 |
+
return this.each(function() {
|
2759 |
+
jQuery.event.trigger( type, data, this );
|
2760 |
+
});
|
2761 |
+
},
|
2762 |
+
|
2763 |
+
triggerHandler: function( type, data ) {
|
2764 |
+
if ( this[0] ) {
|
2765 |
+
var event = jQuery.Event( type );
|
2766 |
+
event.preventDefault();
|
2767 |
+
event.stopPropagation();
|
2768 |
+
jQuery.event.trigger( event, data, this[0] );
|
2769 |
+
return event.result;
|
2770 |
+
}
|
2771 |
+
},
|
2772 |
+
|
2773 |
+
toggle: function( fn ) {
|
2774 |
+
// Save reference to arguments for access in closure
|
2775 |
+
var args = arguments,
|
2776 |
+
i = 1;
|
2777 |
+
|
2778 |
+
// link all the functions, so any of them can unbind this click handler
|
2779 |
+
while ( i < args.length ) {
|
2780 |
+
jQuery.proxy( fn, args[ i++ ] );
|
2781 |
+
}
|
2782 |
+
|
2783 |
+
return this.click( jQuery.proxy( fn, function( event ) {
|
2784 |
+
// Figure out which function to execute
|
2785 |
+
var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
2786 |
+
jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
2787 |
+
|
2788 |
+
// Make sure that clicks stop
|
2789 |
+
event.preventDefault();
|
2790 |
+
|
2791 |
+
// and execute the function
|
2792 |
+
return args[ lastToggle ].apply( this, arguments ) || false;
|
2793 |
+
}));
|
2794 |
+
},
|
2795 |
+
|
2796 |
+
hover: function( fnOver, fnOut ) {
|
2797 |
+
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
|
2798 |
+
}
|
2799 |
+
});
|
2800 |
+
|
2801 |
+
var liveMap = {
|
2802 |
+
focus: "focusin",
|
2803 |
+
blur: "focusout",
|
2804 |
+
mouseenter: "mouseover",
|
2805 |
+
mouseleave: "mouseout"
|
2806 |
+
};
|
2807 |
+
|
2808 |
+
jQuery.each(["live", "die"], function( i, name ) {
|
2809 |
+
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
|
2810 |
+
var type, i = 0, match, namespaces, preType,
|
2811 |
+
selector = origSelector || this.selector,
|
2812 |
+
context = origSelector ? this : jQuery( this.context );
|
2813 |
+
|
2814 |
+
if ( typeof types === "object" && !types.preventDefault ) {
|
2815 |
+
for ( var key in types ) {
|
2816 |
+
context[ name ]( key, data, types[key], selector );
|
2817 |
+
}
|
2818 |
+
|
2819 |
+
return this;
|
2820 |
+
}
|
2821 |
+
|
2822 |
+
if ( jQuery.isFunction( data ) ) {
|
2823 |
+
fn = data;
|
2824 |
+
data = undefined;
|
2825 |
+
}
|
2826 |
+
|
2827 |
+
types = (types || "").split(" ");
|
2828 |
+
|
2829 |
+
while ( (type = types[ i++ ]) != null ) {
|
2830 |
+
match = rnamespaces.exec( type );
|
2831 |
+
namespaces = "";
|
2832 |
+
|
2833 |
+
if ( match ) {
|
2834 |
+
namespaces = match[0];
|
2835 |
+
type = type.replace( rnamespaces, "" );
|
2836 |
+
}
|
2837 |
+
|
2838 |
+
if ( type === "hover" ) {
|
2839 |
+
types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
|
2840 |
+
continue;
|
2841 |
+
}
|
2842 |
+
|
2843 |
+
preType = type;
|
2844 |
+
|
2845 |
+
if ( type === "focus" || type === "blur" ) {
|
2846 |
+
types.push( liveMap[ type ] + namespaces );
|
2847 |
+
type = type + namespaces;
|
2848 |
+
|
2849 |
+
} else {
|
2850 |
+
type = (liveMap[ type ] || type) + namespaces;
|
2851 |
+
}
|
2852 |
+
|
2853 |
+
if ( name === "live" ) {
|
2854 |
+
// bind live handler
|
2855 |
+
for ( var j = 0, l = context.length; j < l; j++ ) {
|
2856 |
+
jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
|
2857 |
+
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
|
2858 |
+
}
|
2859 |
+
|
2860 |
+
} else {
|
2861 |
+
// unbind live handler
|
2862 |
+
context.unbind( "live." + liveConvert( type, selector ), fn );
|
2863 |
+
}
|
2864 |
+
}
|
2865 |
+
|
2866 |
+
return this;
|
2867 |
+
};
|
2868 |
+
});
|
2869 |
+
|
2870 |
+
function liveHandler( event ) {
|
2871 |
+
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
|
2872 |
+
elems = [],
|
2873 |
+
selectors = [],
|
2874 |
+
events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
|
2875 |
+
|
2876 |
+
if ( typeof events === "function" ) {
|
2877 |
+
events = events.events;
|
2878 |
+
}
|
2879 |
+
|
2880 |
+
// Make sure we avoid non-left-click bubbling in Firefox (#3861)
|
2881 |
+
if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
|
2882 |
+
return;
|
2883 |
+
}
|
2884 |
+
|
2885 |
+
if ( event.namespace ) {
|
2886 |
+
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
|
2887 |
+
}
|
2888 |
+
|
2889 |
+
event.liveFired = this;
|
2890 |
+
|
2891 |
+
var live = events.live.slice(0);
|
2892 |
+
|
2893 |
+
for ( j = 0; j < live.length; j++ ) {
|
2894 |
+
handleObj = live[j];
|
2895 |
+
|
2896 |
+
if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
|
2897 |
+
selectors.push( handleObj.selector );
|
2898 |
+
|
2899 |
+
} else {
|
2900 |
+
live.splice( j--, 1 );
|
2901 |
+
}
|
2902 |
+
}
|
2903 |
+
|
2904 |
+
match = jQuery( event.target ).closest( selectors, event.currentTarget );
|
2905 |
+
|
2906 |
+
for ( i = 0, l = match.length; i < l; i++ ) {
|
2907 |
+
close = match[i];
|
2908 |
+
|
2909 |
+
for ( j = 0; j < live.length; j++ ) {
|
2910 |
+
handleObj = live[j];
|
2911 |
+
|
2912 |
+
if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
|
2913 |
+
elem = close.elem;
|
2914 |
+
related = null;
|
2915 |
+
|
2916 |
+
// Those two events require additional checking
|
2917 |
+
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
|
2918 |
+
event.type = handleObj.preType;
|
2919 |
+
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
|
2920 |
+
}
|
2921 |
+
|
2922 |
+
if ( !related || related !== elem ) {
|
2923 |
+
elems.push({ elem: elem, handleObj: handleObj, level: close.level });
|
2924 |
+
}
|
2925 |
+
}
|
2926 |
+
}
|
2927 |
+
}
|
2928 |
+
|
2929 |
+
for ( i = 0, l = elems.length; i < l; i++ ) {
|
2930 |
+
match = elems[i];
|
2931 |
+
|
2932 |
+
if ( maxLevel && match.level > maxLevel ) {
|
2933 |
+
break;
|
2934 |
+
}
|
2935 |
+
|
2936 |
+
event.currentTarget = match.elem;
|
2937 |
+
event.data = match.handleObj.data;
|
2938 |
+
event.handleObj = match.handleObj;
|
2939 |
+
|
2940 |
+
ret = match.handleObj.origHandler.apply( match.elem, arguments );
|
2941 |
+
|
2942 |
+
if ( ret === false || event.isPropagationStopped() ) {
|
2943 |
+
maxLevel = match.level;
|
2944 |
+
|
2945 |
+
if ( ret === false ) {
|
2946 |
+
stop = false;
|
2947 |
+
}
|
2948 |
+
if ( event.isImmediatePropagationStopped() ) {
|
2949 |
+
break;
|
2950 |
+
}
|
2951 |
+
}
|
2952 |
+
}
|
2953 |
+
|
2954 |
+
return stop;
|
2955 |
+
}
|
2956 |
+
|
2957 |
+
function liveConvert( type, selector ) {
|
2958 |
+
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
|
2959 |
+
}
|
2960 |
+
|
2961 |
+
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
|
2962 |
+
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
2963 |
+
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {
|
2964 |
+
|
2965 |
+
// Handle event binding
|
2966 |
+
jQuery.fn[ name ] = function( data, fn ) {
|
2967 |
+
if ( fn == null ) {
|
2968 |
+
fn = data;
|
2969 |
+
data = null;
|
2970 |
+
}
|
2971 |
+
|
2972 |
+
return arguments.length > 0 ?
|
2973 |
+
this.bind( name, data, fn ) :
|
2974 |
+
this.trigger( name );
|
2975 |
+
};
|
2976 |
+
|
2977 |
+
if ( jQuery.attrFn ) {
|
2978 |
+
jQuery.attrFn[ name ] = true;
|
2979 |
+
}
|
2980 |
+
});
|
2981 |
+
|
2982 |
+
// Prevent memory leaks in IE
|
2983 |
+
// Window isn't included so as not to unbind existing unload events
|
2984 |
+
// More info:
|
2985 |
+
// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
|
2986 |
+
if ( window.attachEvent && !window.addEventListener ) {
|
2987 |
+
jQuery(window).bind("unload", function() {
|
2988 |
+
for ( var id in jQuery.cache ) {
|
2989 |
+
if ( jQuery.cache[ id ].handle ) {
|
2990 |
+
// Try/Catch is to handle iframes being unloaded, see #4280
|
2991 |
+
try {
|
2992 |
+
jQuery.event.remove( jQuery.cache[ id ].handle.elem );
|
2993 |
+
} catch(e) {}
|
2994 |
+
}
|
2995 |
+
}
|
2996 |
+
});
|
2997 |
+
}
|
2998 |
+
|
2999 |
+
|
3000 |
+
/*!
|
3001 |
+
* Sizzle CSS Selector Engine - v1.0
|
3002 |
+
* Copyright 2009, The Dojo Foundation
|
3003 |
+
* Released under the MIT, BSD, and GPL Licenses.
|
3004 |
+
* More information: http://sizzlejs.com/
|
3005 |
+
*/
|
3006 |
+
(function(){
|
3007 |
+
|
3008 |
+
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
|
3009 |
+
done = 0,
|
3010 |
+
toString = Object.prototype.toString,
|
3011 |
+
hasDuplicate = false,
|
3012 |
+
baseHasDuplicate = true;
|
3013 |
+
|
3014 |
+
// Here we check if the JavaScript engine is using some sort of
|
3015 |
+
// optimization where it does not always call our comparision
|
3016 |
+
// function. If that is the case, discard the hasDuplicate value.
|
3017 |
+
// Thus far that includes Google Chrome.
|
3018 |
+
[0, 0].sort(function() {
|
3019 |
+
baseHasDuplicate = false;
|
3020 |
+
return 0;
|
3021 |
+
});
|
3022 |
+
|
3023 |
+
var Sizzle = function( selector, context, results, seed ) {
|
3024 |
+
results = results || [];
|
3025 |
+
context = context || document;
|
3026 |
+
|
3027 |
+
var origContext = context;
|
3028 |
+
|
3029 |
+
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
|
3030 |
+
return [];
|
3031 |
+
}
|
3032 |
+
|
3033 |
+
if ( !selector || typeof selector !== "string" ) {
|
3034 |
+
return results;
|
3035 |
+
}
|
3036 |
+
|
3037 |
+
var m, set, checkSet, extra, ret, cur, pop, i,
|
3038 |
+
prune = true,
|
3039 |
+
contextXML = Sizzle.isXML( context ),
|
3040 |
+
parts = [],
|
3041 |
+
soFar = selector;
|
3042 |
+
|
3043 |
+
// Reset the position of the chunker regexp (start from head)
|
3044 |
+
do {
|
3045 |
+
chunker.exec( "" );
|
3046 |
+
m = chunker.exec( soFar );
|
3047 |
+
|
3048 |
+
if ( m ) {
|
3049 |
+
soFar = m[3];
|
3050 |
+
|
3051 |
+
parts.push( m[1] );
|
3052 |
+
|
3053 |
+
if ( m[2] ) {
|
3054 |
+
extra = m[3];
|
3055 |
+
break;
|
3056 |
+
}
|
3057 |
+
}
|
3058 |
+
} while ( m );
|
3059 |
+
|
3060 |
+
if ( parts.length > 1 && origPOS.exec( selector ) ) {
|
3061 |
+
|
3062 |
+
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
|
3063 |
+
set = posProcess( parts[0] + parts[1], context );
|
3064 |
+
|
3065 |
+
} else {
|
3066 |
+
set = Expr.relative[ parts[0] ] ?
|
3067 |
+
[ context ] :
|
3068 |
+
Sizzle( parts.shift(), context );
|
3069 |
+
|
3070 |
+
while ( parts.length ) {
|
3071 |
+
selector = parts.shift();
|
3072 |
+
|
3073 |
+
if ( Expr.relative[ selector ] ) {
|
3074 |
+
selector += parts.shift();
|
3075 |
+
}
|
3076 |
+
|
3077 |
+
set = posProcess( selector, set );
|
3078 |
+
}
|
3079 |
+
}
|
3080 |
+
|
3081 |
+
} else {
|
3082 |
+
// Take a shortcut and set the context if the root selector is an ID
|
3083 |
+
// (but not if it'll be faster if the inner selector is an ID)
|
3084 |
+
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
|
3085 |
+
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
|
3086 |
+
|
3087 |
+
ret = Sizzle.find( parts.shift(), context, contextXML );
|
3088 |
+
context = ret.expr ?
|
3089 |
+
Sizzle.filter( ret.expr, ret.set )[0] :
|
3090 |
+
ret.set[0];
|
3091 |
+
}
|
3092 |
+
|
3093 |
+
if ( context ) {
|
3094 |
+
ret = seed ?
|
3095 |
+
{ expr: parts.pop(), set: makeArray(seed) } :
|
3096 |
+
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
|
3097 |
+
|
3098 |
+
set = ret.expr ?
|
3099 |
+
Sizzle.filter( ret.expr, ret.set ) :
|
3100 |
+
ret.set;
|
3101 |
+
|
3102 |
+
if ( parts.length > 0 ) {
|
3103 |
+
checkSet = makeArray( set );
|
3104 |
+
|
3105 |
+
} else {
|
3106 |
+
prune = false;
|
3107 |
+
}
|
3108 |
+
|
3109 |
+
while ( parts.length ) {
|
3110 |
+
cur = parts.pop();
|
3111 |
+
pop = cur;
|
3112 |
+
|
3113 |
+
if ( !Expr.relative[ cur ] ) {
|
3114 |
+
cur = "";
|
3115 |
+
} else {
|
3116 |
+
pop = parts.pop();
|
3117 |
+
}
|
3118 |
+
|
3119 |
+
if ( pop == null ) {
|
3120 |
+
pop = context;
|
3121 |
+
}
|
3122 |
+
|
3123 |
+
Expr.relative[ cur ]( checkSet, pop, contextXML );
|
3124 |
+
}
|
3125 |
+
|
3126 |
+
} else {
|
3127 |
+
checkSet = parts = [];
|
3128 |
+
}
|
3129 |
+
}
|
3130 |
+
|
3131 |
+
if ( !checkSet ) {
|
3132 |
+
checkSet = set;
|
3133 |
+
}
|
3134 |
+
|
3135 |
+
if ( !checkSet ) {
|
3136 |
+
Sizzle.error( cur || selector );
|
3137 |
+
}
|
3138 |
+
|
3139 |
+
if ( toString.call(checkSet) === "[object Array]" ) {
|
3140 |
+
if ( !prune ) {
|
3141 |
+
results.push.apply( results, checkSet );
|
3142 |
+
|
3143 |
+
} else if ( context && context.nodeType === 1 ) {
|
3144 |
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
3145 |
+
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
|
3146 |
+
results.push( set[i] );
|
3147 |
+
}
|
3148 |
+
}
|
3149 |
+
|
3150 |
+
} else {
|
3151 |
+
for ( i = 0; checkSet[i] != null; i++ ) {
|
3152 |
+
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
|
3153 |
+
results.push( set[i] );
|
3154 |
+
}
|
3155 |
+
}
|
3156 |
+
}
|
3157 |
+
|
3158 |
+
} else {
|
3159 |
+
makeArray( checkSet, results );
|
3160 |
+
}
|
3161 |
+
|
3162 |
+
if ( extra ) {
|
3163 |
+
Sizzle( extra, origContext, results, seed );
|
3164 |
+
Sizzle.uniqueSort( results );
|
3165 |
+
}
|
3166 |
+
|
3167 |
+
return results;
|
3168 |
+
};
|
3169 |
+
|
3170 |
+
Sizzle.uniqueSort = function( results ) {
|
3171 |
+
if ( sortOrder ) {
|
3172 |
+
hasDuplicate = baseHasDuplicate;
|
3173 |
+
results.sort( sortOrder );
|
3174 |
+
|
3175 |
+
if ( hasDuplicate ) {
|
3176 |
+
for ( var i = 1; i < results.length; i++ ) {
|
3177 |
+
if ( results[i] === results[ i - 1 ] ) {
|
3178 |
+
results.splice( i--, 1 );
|
3179 |
+
}
|
3180 |
+
}
|
3181 |
+
}
|
3182 |
+
}
|
3183 |
+
|
3184 |
+
return results;
|
3185 |
+
};
|
3186 |
+
|
3187 |
+
Sizzle.matches = function( expr, set ) {
|
3188 |
+
return Sizzle( expr, null, null, set );
|
3189 |
+
};
|
3190 |
+
|
3191 |
+
Sizzle.matchesSelector = function( node, expr ) {
|
3192 |
+
return Sizzle( expr, null, null, [node] ).length > 0;
|
3193 |
+
};
|
3194 |
+
|
3195 |
+
Sizzle.find = function( expr, context, isXML ) {
|
3196 |
+
var set;
|
3197 |
+
|
3198 |
+
if ( !expr ) {
|
3199 |
+
return [];
|
3200 |
+
}
|
3201 |
+
|
3202 |
+
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
|
3203 |
+
var match,
|
3204 |
+
type = Expr.order[i];
|
3205 |
+
|
3206 |
+
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
|
3207 |
+
var left = match[1];
|
3208 |
+
match.splice( 1, 1 );
|
3209 |
+
|
3210 |
+
if ( left.substr( left.length - 1 ) !== "\\" ) {
|
3211 |
+
match[1] = (match[1] || "").replace(/\\/g, "");
|
3212 |
+
set = Expr.find[ type ]( match, context, isXML );
|
3213 |
+
|
3214 |
+
if ( set != null ) {
|
3215 |
+
expr = expr.replace( Expr.match[ type ], "" );
|
3216 |
+
break;
|
3217 |
+
}
|
3218 |
+
}
|
3219 |
+
}
|
3220 |
+
}
|
3221 |
+
|
3222 |
+
if ( !set ) {
|
3223 |
+
set = context.getElementsByTagName( "*" );
|
3224 |
+
}
|
3225 |
+
|
3226 |
+
return { set: set, expr: expr };
|
3227 |
+
};
|
3228 |
+
|
3229 |
+
Sizzle.filter = function( expr, set, inplace, not ) {
|
3230 |
+
var match, anyFound,
|
3231 |
+
old = expr,
|
3232 |
+
result = [],
|
3233 |
+
curLoop = set,
|
3234 |
+
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
|
3235 |
+
|
3236 |
+
while ( expr && set.length ) {
|
3237 |
+
for ( var type in Expr.filter ) {
|
3238 |
+
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
|
3239 |
+
var found, item,
|
3240 |
+
filter = Expr.filter[ type ],
|
3241 |
+
left = match[1];
|
3242 |
+
|
3243 |
+
anyFound = false;
|
3244 |
+
|
3245 |
+
match.splice(1,1);
|
3246 |
+
|
3247 |
+
if ( left.substr( left.length - 1 ) === "\\" ) {
|
3248 |
+
continue;
|
3249 |
+
}
|
3250 |
+
|
3251 |
+
if ( curLoop === result ) {
|
3252 |
+
result = [];
|
3253 |
+
}
|
3254 |
+
|
3255 |
+
if ( Expr.preFilter[ type ] ) {
|
3256 |
+
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
|
3257 |
+
|
3258 |
+
if ( !match ) {
|
3259 |
+
anyFound = found = true;
|
3260 |
+
|
3261 |
+
} else if ( match === true ) {
|
3262 |
+
continue;
|
3263 |
+
}
|
3264 |
+
}
|
3265 |
+
|
3266 |
+
if ( match ) {
|
3267 |
+
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
|
3268 |
+
if ( item ) {
|
3269 |
+
found = filter( item, match, i, curLoop );
|
3270 |
+
var pass = not ^ !!found;
|
3271 |
+
|
3272 |
+
if ( inplace && found != null ) {
|
3273 |
+
if ( pass ) {
|
3274 |
+
anyFound = true;
|
3275 |
+
|
3276 |
+
} else {
|
3277 |
+
curLoop[i] = false;
|
3278 |
+
}
|
3279 |
+
|
3280 |
+
} else if ( pass ) {
|
3281 |
+
result.push( item );
|
3282 |
+
anyFound = true;
|
3283 |
+
}
|
3284 |
+
}
|
3285 |
+
}
|
3286 |
+
}
|
3287 |
+
|
3288 |
+
if ( found !== undefined ) {
|
3289 |
+
if ( !inplace ) {
|
3290 |
+
curLoop = result;
|
3291 |
+
}
|
3292 |
+
|
3293 |
+
expr = expr.replace( Expr.match[ type ], "" );
|
3294 |
+
|
3295 |
+
if ( !anyFound ) {
|
3296 |
+
return [];
|
3297 |
+
}
|
3298 |
+
|
3299 |
+
break;
|
3300 |
+
}
|
3301 |
+
}
|
3302 |
+
}
|
3303 |
+
|
3304 |
+
// Improper expression
|
3305 |
+
if ( expr === old ) {
|
3306 |
+
if ( anyFound == null ) {
|
3307 |
+
Sizzle.error( expr );
|
3308 |
+
|
3309 |
+
} else {
|
3310 |
+
break;
|
3311 |
+
}
|
3312 |
+
}
|
3313 |
+
|
3314 |
+
old = expr;
|
3315 |
+
}
|
3316 |
+
|
3317 |
+
return curLoop;
|
3318 |
+
};
|
3319 |
+
|
3320 |
+
Sizzle.error = function( msg ) {
|
3321 |
+
throw "Syntax error, unrecognized expression: " + msg;
|
3322 |
+
};
|
3323 |
+
|
3324 |
+
var Expr = Sizzle.selectors = {
|
3325 |
+
order: [ "ID", "NAME", "TAG" ],
|
3326 |
+
|
3327 |
+
match: {
|
3328 |
+
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
|
3329 |
+
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
|
3330 |
+
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
|
3331 |
+
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
|
3332 |
+
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
|
3333 |
+
CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
|
3334 |
+
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
|
3335 |
+
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
|
3336 |
+
},
|
3337 |
+
|
3338 |
+
leftMatch: {},
|
3339 |
+
|
3340 |
+
attrMap: {
|
3341 |
+
"class": "className",
|
3342 |
+
"for": "htmlFor"
|
3343 |
+
},
|
3344 |
+
|
3345 |
+
attrHandle: {
|
3346 |
+
href: function( elem ) {
|
3347 |
+
return elem.getAttribute( "href" );
|
3348 |
+
}
|
3349 |
+
},
|
3350 |
+
|
3351 |
+
relative: {
|
3352 |
+
"+": function(checkSet, part){
|
3353 |
+
var isPartStr = typeof part === "string",
|
3354 |
+
isTag = isPartStr && !/\W/.test( part ),
|
3355 |
+
isPartStrNotTag = isPartStr && !isTag;
|
3356 |
+
|
3357 |
+
if ( isTag ) {
|
3358 |
+
part = part.toLowerCase();
|
3359 |
+
}
|
3360 |
+
|
3361 |
+
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
|
3362 |
+
if ( (elem = checkSet[i]) ) {
|
3363 |
+
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
|
3364 |
+
|
3365 |
+
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
|
3366 |
+
elem || false :
|
3367 |
+
elem === part;
|
3368 |
+
}
|
3369 |
+
}
|
3370 |
+
|
3371 |
+
if ( isPartStrNotTag ) {
|
3372 |
+
Sizzle.filter( part, checkSet, true );
|
3373 |
+
}
|
3374 |
+
},
|
3375 |
+
|
3376 |
+
">": function( checkSet, part ) {
|
3377 |
+
var elem,
|
3378 |
+
isPartStr = typeof part === "string",
|
3379 |
+
i = 0,
|
3380 |
+
l = checkSet.length;
|
3381 |
+
|
3382 |
+
if ( isPartStr && !/\W/.test( part ) ) {
|
3383 |
+
part = part.toLowerCase();
|
3384 |
+
|
3385 |
+
for ( ; i < l; i++ ) {
|
3386 |
+
elem = checkSet[i];
|
3387 |
+
|
3388 |
+
if ( elem ) {
|
3389 |
+
var parent = elem.parentNode;
|
3390 |
+
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
|
3391 |
+
}
|
3392 |
+
}
|
3393 |
+
|
3394 |
+
} else {
|
3395 |
+
for ( ; i < l; i++ ) {
|
3396 |
+
elem = checkSet[i];
|
3397 |
+
|
3398 |
+
if ( elem ) {
|
3399 |
+
checkSet[i] = isPartStr ?
|
3400 |
+
elem.parentNode :
|
3401 |
+
elem.parentNode === part;
|
3402 |
+
}
|
3403 |
+
}
|
3404 |
+
|
3405 |
+
if ( isPartStr ) {
|
3406 |
+
Sizzle.filter( part, checkSet, true );
|
3407 |
+
}
|
3408 |
+
}
|
3409 |
+
},
|
3410 |
+
|
3411 |
+
"": function(checkSet, part, isXML){
|
3412 |
+
var nodeCheck,
|
3413 |
+
doneName = done++,
|
3414 |
+
checkFn = dirCheck;
|
3415 |
+
|
3416 |
+
if ( typeof part === "string" && !/\W/.test(part) ) {
|
3417 |
+
part = part.toLowerCase();
|
3418 |
+
nodeCheck = part;
|
3419 |
+
checkFn = dirNodeCheck;
|
3420 |
+
}
|
3421 |
+
|
3422 |
+
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
|
3423 |
+
},
|
3424 |
+
|
3425 |
+
"~": function( checkSet, part, isXML ) {
|
3426 |
+
var nodeCheck,
|
3427 |
+
doneName = done++,
|
3428 |
+
checkFn = dirCheck;
|
3429 |
+
|
3430 |
+
if ( typeof part === "string" && !/\W/.test( part ) ) {
|
3431 |
+
part = part.toLowerCase();
|
3432 |
+
nodeCheck = part;
|
3433 |
+
checkFn = dirNodeCheck;
|
3434 |
+
}
|
3435 |
+
|
3436 |
+
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
|
3437 |
+
}
|
3438 |
+
},
|
3439 |
+
|
3440 |
+
find: {
|
3441 |
+
ID: function( match, context, isXML ) {
|
3442 |
+
if ( typeof context.getElementById !== "undefined" && !isXML ) {
|
3443 |
+
var m = context.getElementById(match[1]);
|
3444 |
+
// Check parentNode to catch when Blackberry 4.6 returns
|
3445 |
+
// nodes that are no longer in the document #6963
|
3446 |
+
return m && m.parentNode ? [m] : [];
|
3447 |
+
}
|
3448 |
+
},
|
3449 |
+
|
3450 |
+
NAME: function( match, context ) {
|
3451 |
+
if ( typeof context.getElementsByName !== "undefined" ) {
|
3452 |
+
var ret = [],
|
3453 |
+
results = context.getElementsByName( match[1] );
|
3454 |
+
|
3455 |
+
for ( var i = 0, l = results.length; i < l; i++ ) {
|
3456 |
+
if ( results[i].getAttribute("name") === match[1] ) {
|
3457 |
+
ret.push( results[i] );
|
3458 |
+
}
|
3459 |
+
}
|
3460 |
+
|
3461 |
+
return ret.length === 0 ? null : ret;
|
3462 |
+
}
|
3463 |
+
},
|
3464 |
+
|
3465 |
+
TAG: function( match, context ) {
|
3466 |
+
return context.getElementsByTagName( match[1] );
|
3467 |
+
}
|
3468 |
+
},
|
3469 |
+
preFilter: {
|
3470 |
+
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
|
3471 |
+
match = " " + match[1].replace(/\\/g, "") + " ";
|
3472 |
+
|
3473 |
+
if ( isXML ) {
|
3474 |
+
return match;
|
3475 |
+
}
|
3476 |
+
|
3477 |
+
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
|
3478 |
+
if ( elem ) {
|
3479 |
+
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
|
3480 |
+
if ( !inplace ) {
|
3481 |
+
result.push( elem );
|
3482 |
+
}
|
3483 |
+
|
3484 |
+
} else if ( inplace ) {
|
3485 |
+
curLoop[i] = false;
|
3486 |
+
}
|
3487 |
+
}
|
3488 |
+
}
|
3489 |
+
|
3490 |
+
return false;
|
3491 |
+
},
|
3492 |
+
|
3493 |
+
ID: function( match ) {
|
3494 |
+
return match[1].replace(/\\/g, "");
|
3495 |
+
},
|
3496 |
+
|
3497 |
+
TAG: function( match, curLoop ) {
|
3498 |
+
return match[1].toLowerCase();
|
3499 |
+
},
|
3500 |
+
|
3501 |
+
CHILD: function( match ) {
|
3502 |
+
if ( match[1] === "nth" ) {
|
3503 |
+
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
|
3504 |
+
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
|
3505 |
+
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
|
3506 |
+
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
|
3507 |
+
|
3508 |
+
// calculate the numbers (first)n+(last) including if they are negative
|
3509 |
+
match[2] = (test[1] + (test[2] || 1)) - 0;
|
3510 |
+
match[3] = test[3] - 0;
|
3511 |
+
}
|
3512 |
+
|
3513 |
+
// TODO: Move to normal caching system
|
3514 |
+
match[0] = done++;
|
3515 |
+
|
3516 |
+
return match;
|
3517 |
+
},
|
3518 |
+
|
3519 |
+
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
|
3520 |
+
var name = match[1].replace(/\\/g, "");
|
3521 |
+
|
3522 |
+
if ( !isXML && Expr.attrMap[name] ) {
|
3523 |
+
match[1] = Expr.attrMap[name];
|
3524 |
+
}
|
3525 |
+
|
3526 |
+
if ( match[2] === "~=" ) {
|
3527 |
+
match[4] = " " + match[4] + " ";
|
3528 |
+
}
|
3529 |
+
|
3530 |
+
return match;
|
3531 |
+
},
|
3532 |
+
|
3533 |
+
PSEUDO: function( match, curLoop, inplace, result, not ) {
|
3534 |
+
if ( match[1] === "not" ) {
|
3535 |
+
// If we're dealing with a complex expression, or a simple one
|
3536 |
+
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
|
3537 |
+
match[3] = Sizzle(match[3], null, null, curLoop);
|
3538 |
+
|
3539 |
+
} else {
|
3540 |
+
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
|
3541 |
+
|
3542 |
+
if ( !inplace ) {
|
3543 |
+
result.push.apply( result, ret );
|
3544 |
+
}
|
3545 |
+
|
3546 |
+
return false;
|
3547 |
+
}
|
3548 |
+
|
3549 |
+
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
|
3550 |
+
return true;
|
3551 |
+
}
|
3552 |
+
|
3553 |
+
return match;
|
3554 |
+
},
|
3555 |
+
|
3556 |
+
POS: function( match ) {
|
3557 |
+
match.unshift( true );
|
3558 |
+
|
3559 |
+
return match;
|
3560 |
+
}
|
3561 |
+
},
|
3562 |
+
|
3563 |
+
filters: {
|
3564 |
+
enabled: function( elem ) {
|
3565 |
+
return elem.disabled === false && elem.type !== "hidden";
|
3566 |
+
},
|
3567 |
+
|
3568 |
+
disabled: function( elem ) {
|
3569 |
+
return elem.disabled === true;
|
3570 |
+
},
|
3571 |
+
|
3572 |
+
checked: function( elem ) {
|
3573 |
+
return elem.checked === true;
|
3574 |
+
},
|
3575 |
+
|
3576 |
+
selected: function( elem ) {
|
3577 |
+
// Accessing this property makes selected-by-default
|
3578 |
+
// options in Safari work properly
|
3579 |
+
elem.parentNode.selectedIndex;
|
3580 |
+
|
3581 |
+
return elem.selected === true;
|
3582 |
+
},
|
3583 |
+
|
3584 |
+
parent: function( elem ) {
|
3585 |
+
return !!elem.firstChild;
|
3586 |
+
},
|
3587 |
+
|
3588 |
+
empty: function( elem ) {
|
3589 |
+
return !elem.firstChild;
|
3590 |
+
},
|
3591 |
+
|
3592 |
+
has: function( elem, i, match ) {
|
3593 |
+
return !!Sizzle( match[3], elem ).length;
|
3594 |
+
},
|
3595 |
+
|
3596 |
+
header: function( elem ) {
|
3597 |
+
return (/h\d/i).test( elem.nodeName );
|
3598 |
+
},
|
3599 |
+
|
3600 |
+
text: function( elem ) {
|
3601 |
+
return "text" === elem.type;
|
3602 |
+
},
|
3603 |
+
radio: function( elem ) {
|
3604 |
+
return "radio" === elem.type;
|
3605 |
+
},
|
3606 |
+
|
3607 |
+
checkbox: function( elem ) {
|
3608 |
+
return "checkbox" === elem.type;
|
3609 |
+
},
|
3610 |
+
|
3611 |
+
file: function( elem ) {
|
3612 |
+
return "file" === elem.type;
|
3613 |
+
},
|
3614 |
+
password: function( elem ) {
|
3615 |
+
return "password" === elem.type;
|
3616 |
+
},
|
3617 |
+
|
3618 |
+
submit: function( elem ) {
|
3619 |
+
return "submit" === elem.type;
|
3620 |
+
},
|
3621 |
+
|
3622 |
+
image: function( elem ) {
|
3623 |
+
return "image" === elem.type;
|
3624 |
+
},
|
3625 |
+
|
3626 |
+
reset: function( elem ) {
|
3627 |
+
return "reset" === elem.type;
|
3628 |
+
},
|
3629 |
+
|
3630 |
+
button: function( elem ) {
|
3631 |
+
return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
|
3632 |
+
},
|
3633 |
+
|
3634 |
+
input: function( elem ) {
|
3635 |
+
return (/input|select|textarea|button/i).test( elem.nodeName );
|
3636 |
+
}
|
3637 |
+
},
|
3638 |
+
setFilters: {
|
3639 |
+
first: function( elem, i ) {
|
3640 |
+
return i === 0;
|
3641 |
+
},
|
3642 |
+
|
3643 |
+
last: function( elem, i, match, array ) {
|
3644 |
+
return i === array.length - 1;
|
3645 |
+
},
|
3646 |
+
|
3647 |
+
even: function( elem, i ) {
|
3648 |
+
return i % 2 === 0;
|
3649 |
+
},
|
3650 |
+
|
3651 |
+
odd: function( elem, i ) {
|
3652 |
+
return i % 2 === 1;
|
3653 |
+
},
|
3654 |
+
|
3655 |
+
lt: function( elem, i, match ) {
|
3656 |
+
return i < match[3] - 0;
|
3657 |
+
},
|
3658 |
+
|
3659 |
+
gt: function( elem, i, match ) {
|
3660 |
+
return i > match[3] - 0;
|
3661 |
+
},
|
3662 |
+
|
3663 |
+
nth: function( elem, i, match ) {
|
3664 |
+
return match[3] - 0 === i;
|
3665 |
+
},
|
3666 |
+
|
3667 |
+
eq: function( elem, i, match ) {
|
3668 |
+
return match[3] - 0 === i;
|
3669 |
+
}
|
3670 |
+
},
|
3671 |
+
filter: {
|
3672 |
+
PSEUDO: function( elem, match, i, array ) {
|
3673 |
+
var name = match[1],
|
3674 |
+
filter = Expr.filters[ name ];
|
3675 |
+
|
3676 |
+
if ( filter ) {
|
3677 |
+
return filter( elem, i, match, array );
|
3678 |
+
|
3679 |
+
} else if ( name === "contains" ) {
|
3680 |
+
return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
|
3681 |
+
|
3682 |
+
} else if ( name === "not" ) {
|
3683 |
+
var not = match[3];
|
3684 |
+
|
3685 |
+
for ( var j = 0, l = not.length; j < l; j++ ) {
|
3686 |
+
if ( not[j] === elem ) {
|
3687 |
+
return false;
|
3688 |
+
}
|
3689 |
+
}
|
3690 |
+
|
3691 |
+
return true;
|
3692 |
+
|
3693 |
+
} else {
|
3694 |
+
Sizzle.error( "Syntax error, unrecognized expression: " + name );
|
3695 |
+
}
|
3696 |
+
},
|
3697 |
+
|
3698 |
+
CHILD: function( elem, match ) {
|
3699 |
+
var type = match[1],
|
3700 |
+
node = elem;
|
3701 |
+
|
3702 |
+
switch ( type ) {
|
3703 |
+
case "only":
|
3704 |
+
case "first":
|
3705 |
+
while ( (node = node.previousSibling) ) {
|
3706 |
+
if ( node.nodeType === 1 ) {
|
3707 |
+
return false;
|
3708 |
+
}
|
3709 |
+
}
|
3710 |
+
|
3711 |
+
if ( type === "first" ) {
|
3712 |
+
return true;
|
3713 |
+
}
|
3714 |
+
|
3715 |
+
node = elem;
|
3716 |
+
|
3717 |
+
case "last":
|
3718 |
+
while ( (node = node.nextSibling) ) {
|
3719 |
+
if ( node.nodeType === 1 ) {
|
3720 |
+
return false;
|
3721 |
+
}
|
3722 |
+
}
|
3723 |
+
|
3724 |
+
return true;
|
3725 |
+
|
3726 |
+
case "nth":
|
3727 |
+
var first = match[2],
|
3728 |
+
last = match[3];
|
3729 |
+
|
3730 |
+
if ( first === 1 && last === 0 ) {
|
3731 |
+
return true;
|
3732 |
+
}
|
3733 |
+
|
3734 |
+
var doneName = match[0],
|
3735 |
+
parent = elem.parentNode;
|
3736 |
+
|
3737 |
+
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
|
3738 |
+
var count = 0;
|
3739 |
+
|
3740 |
+
for ( node = parent.firstChild; node; node = node.nextSibling ) {
|
3741 |
+
if ( node.nodeType === 1 ) {
|
3742 |
+
node.nodeIndex = ++count;
|
3743 |
+
}
|
3744 |
+
}
|
3745 |
+
|
3746 |
+
parent.sizcache = doneName;
|
3747 |
+
}
|
3748 |
+
|
3749 |
+
var diff = elem.nodeIndex - last;
|
3750 |
+
|
3751 |
+
if ( first === 0 ) {
|
3752 |
+
return diff === 0;
|
3753 |
+
|
3754 |
+
} else {
|
3755 |
+
return ( diff % first === 0 && diff / first >= 0 );
|
3756 |
+
}
|
3757 |
+
}
|
3758 |
+
},
|
3759 |
+
|
3760 |
+
ID: function( elem, match ) {
|
3761 |
+
return elem.nodeType === 1 && elem.getAttribute("id") === match;
|
3762 |
+
},
|
3763 |
+
|
3764 |
+
TAG: function( elem, match ) {
|
3765 |
+
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
|
3766 |
+
},
|
3767 |
+
|
3768 |
+
CLASS: function( elem, match ) {
|
3769 |
+
return (" " + (elem.className || elem.getAttribute("class")) + " ")
|
3770 |
+
.indexOf( match ) > -1;
|
3771 |
+
},
|
3772 |
+
|
3773 |
+
ATTR: function( elem, match ) {
|
3774 |
+
var name = match[1],
|
3775 |
+
result = Expr.attrHandle[ name ] ?
|
3776 |
+
Expr.attrHandle[ name ]( elem ) :
|
3777 |
+
elem[ name ] != null ?
|
3778 |
+
elem[ name ] :
|
3779 |
+
elem.getAttribute( name ),
|
3780 |
+
value = result + "",
|
3781 |
+
type = match[2],
|
3782 |
+
check = match[4];
|
3783 |
+
|
3784 |
+
return result == null ?
|
3785 |
+
type === "!=" :
|
3786 |
+
type === "=" ?
|
3787 |
+
value === check :
|
3788 |
+
type === "*=" ?
|
3789 |
+
value.indexOf(check) >= 0 :
|
3790 |
+
type === "~=" ?
|
3791 |
+
(" " + value + " ").indexOf(check) >= 0 :
|
3792 |
+
!check ?
|
3793 |
+
value && result !== false :
|
3794 |
+
type === "!=" ?
|
3795 |
+
value !== check :
|
3796 |
+
type === "^=" ?
|
3797 |
+
value.indexOf(check) === 0 :
|
3798 |
+
type === "$=" ?
|
3799 |
+
value.substr(value.length - check.length) === check :
|
3800 |
+
type === "|=" ?
|
3801 |
+
value === check || value.substr(0, check.length + 1) === check + "-" :
|
3802 |
+
false;
|
3803 |
+
},
|
3804 |
+
|
3805 |
+
POS: function( elem, match, i, array ) {
|
3806 |
+
var name = match[2],
|
3807 |
+
filter = Expr.setFilters[ name ];
|
3808 |
+
|
3809 |
+
if ( filter ) {
|
3810 |
+
return filter( elem, i, match, array );
|
3811 |
+
}
|
3812 |
+
}
|
3813 |
+
}
|
3814 |
+
};
|
3815 |
+
|
3816 |
+
var origPOS = Expr.match.POS,
|
3817 |
+
fescape = function(all, num){
|
3818 |
+
return "\\" + (num - 0 + 1);
|
3819 |
+
};
|
3820 |
+
|
3821 |
+
for ( var type in Expr.match ) {
|
3822 |
+
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
|
3823 |
+
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
|
3824 |
+
}
|
3825 |
+
|
3826 |
+
var makeArray = function( array, results ) {
|
3827 |
+
array = Array.prototype.slice.call( array, 0 );
|
3828 |
+
|
3829 |
+
if ( results ) {
|
3830 |
+
results.push.apply( results, array );
|
3831 |
+
return results;
|
3832 |
+
}
|
3833 |
+
|
3834 |
+
return array;
|
3835 |
+
};
|
3836 |
+
|
3837 |
+
// Perform a simple check to determine if the browser is capable of
|
3838 |
+
// converting a NodeList to an array using builtin methods.
|
3839 |
+
// Also verifies that the returned array holds DOM nodes
|
3840 |
+
// (which is not the case in the Blackberry browser)
|
3841 |
+
try {
|
3842 |
+
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
|
3843 |
+
|
3844 |
+
// Provide a fallback method if it does not work
|
3845 |
+
} catch( e ) {
|
3846 |
+
makeArray = function( array, results ) {
|
3847 |
+
var i = 0,
|
3848 |
+
ret = results || [];
|
3849 |
+
|
3850 |
+
if ( toString.call(array) === "[object Array]" ) {
|
3851 |
+
Array.prototype.push.apply( ret, array );
|
3852 |
+
|
3853 |
+
} else {
|
3854 |
+
if ( typeof array.length === "number" ) {
|
3855 |
+
for ( var l = array.length; i < l; i++ ) {
|
3856 |
+
ret.push( array[i] );
|
3857 |
+
}
|
3858 |
+
|
3859 |
+
} else {
|
3860 |
+
for ( ; array[i]; i++ ) {
|
3861 |
+
ret.push( array[i] );
|
3862 |
+
}
|
3863 |
+
}
|
3864 |
+
}
|
3865 |
+
|
3866 |
+
return ret;
|
3867 |
+
};
|
3868 |
+
}
|
3869 |
+
|
3870 |
+
var sortOrder, siblingCheck;
|
3871 |
+
|
3872 |
+
if ( document.documentElement.compareDocumentPosition ) {
|
3873 |
+
sortOrder = function( a, b ) {
|
3874 |
+
if ( a === b ) {
|
3875 |
+
hasDuplicate = true;
|
3876 |
+
return 0;
|
3877 |
+
}
|
3878 |
+
|
3879 |
+
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
|
3880 |
+
return a.compareDocumentPosition ? -1 : 1;
|
3881 |
+
}
|
3882 |
+
|
3883 |
+
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
|
3884 |
+
};
|
3885 |
+
|
3886 |
+
} else {
|
3887 |
+
sortOrder = function( a, b ) {
|
3888 |
+
var al, bl,
|
3889 |
+
ap = [],
|
3890 |
+
bp = [],
|
3891 |
+
aup = a.parentNode,
|
3892 |
+
bup = b.parentNode,
|
3893 |
+
cur = aup;
|
3894 |
+
|
3895 |
+
// The nodes are identical, we can exit early
|
3896 |
+
if ( a === b ) {
|
3897 |
+
hasDuplicate = true;
|
3898 |
+
return 0;
|
3899 |
+
|
3900 |
+
// If the nodes are siblings (or identical) we can do a quick check
|
3901 |
+
} else if ( aup === bup ) {
|
3902 |
+
return siblingCheck( a, b );
|
3903 |
+
|
3904 |
+
// If no parents were found then the nodes are disconnected
|
3905 |
+
} else if ( !aup ) {
|
3906 |
+
return -1;
|
3907 |
+
|
3908 |
+
} else if ( !bup ) {
|
3909 |
+
return 1;
|
3910 |
+
}
|
3911 |
+
|
3912 |
+
// Otherwise they're somewhere else in the tree so we need
|
3913 |
+
// to build up a full list of the parentNodes for comparison
|
3914 |
+
while ( cur ) {
|
3915 |
+
ap.unshift( cur );
|
3916 |
+
cur = cur.parentNode;
|
3917 |
+
}
|
3918 |
+
|
3919 |
+
cur = bup;
|
3920 |
+
|
3921 |
+
while ( cur ) {
|
3922 |
+
bp.unshift( cur );
|
3923 |
+
cur = cur.parentNode;
|
3924 |
+
}
|
3925 |
+
|
3926 |
+
al = ap.length;
|
3927 |
+
bl = bp.length;
|
3928 |
+
|
3929 |
+
// Start walking down the tree looking for a discrepancy
|
3930 |
+
for ( var i = 0; i < al && i < bl; i++ ) {
|
3931 |
+
if ( ap[i] !== bp[i] ) {
|
3932 |
+
return siblingCheck( ap[i], bp[i] );
|
3933 |
+
}
|
3934 |
+
}
|
3935 |
+
|
3936 |
+
// We ended someplace up the tree so do a sibling check
|
3937 |
+
return i === al ?
|
3938 |
+
siblingCheck( a, bp[i], -1 ) :
|
3939 |
+
siblingCheck( ap[i], b, 1 );
|
3940 |
+
};
|
3941 |
+
|
3942 |
+
siblingCheck = function( a, b, ret ) {
|
3943 |
+
if ( a === b ) {
|
3944 |
+
return ret;
|
3945 |
+
}
|
3946 |
+
|
3947 |
+
var cur = a.nextSibling;
|
3948 |
+
|
3949 |
+
while ( cur ) {
|
3950 |
+
if ( cur === b ) {
|
3951 |
+
return -1;
|
3952 |
+
}
|
3953 |
+
|
3954 |
+
cur = cur.nextSibling;
|
3955 |
+
}
|
3956 |
+
|
3957 |
+
return 1;
|
3958 |
+
};
|
3959 |
+
}
|
3960 |
+
|
3961 |
+
// Utility function for retreiving the text value of an array of DOM nodes
|
3962 |
+
Sizzle.getText = function( elems ) {
|
3963 |
+
var ret = "", elem;
|
3964 |
+
|
3965 |
+
for ( var i = 0; elems[i]; i++ ) {
|
3966 |
+
elem = elems[i];
|
3967 |
+
|
3968 |
+
// Get the text from text nodes and CDATA nodes
|
3969 |
+
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
|
3970 |
+
ret += elem.nodeValue;
|
3971 |
+
|
3972 |
+
// Traverse everything else, except comment nodes
|
3973 |
+
} else if ( elem.nodeType !== 8 ) {
|
3974 |
+
ret += Sizzle.getText( elem.childNodes );
|
3975 |
+
}
|
3976 |
+
}
|
3977 |
+
|
3978 |
+
return ret;
|
3979 |
+
};
|
3980 |
+
|
3981 |
+
// Check to see if the browser returns elements by name when
|
3982 |
+
// querying by getElementById (and provide a workaround)
|
3983 |
+
(function(){
|
3984 |
+
// We're going to inject a fake input element with a specified name
|
3985 |
+
var form = document.createElement("div"),
|
3986 |
+
id = "script" + (new Date()).getTime(),
|
3987 |
+
root = document.documentElement;
|
3988 |
+
|
3989 |
+
form.innerHTML = "<a name='" + id + "'/>";
|
3990 |
+
|
3991 |
+
// Inject it into the root element, check its status, and remove it quickly
|
3992 |
+
root.insertBefore( form, root.firstChild );
|
3993 |
+
|
3994 |
+
// The workaround has to do additional checks after a getElementById
|
3995 |
+
// Which slows things down for other browsers (hence the branching)
|
3996 |
+
if ( document.getElementById( id ) ) {
|
3997 |
+
Expr.find.ID = function( match, context, isXML ) {
|
3998 |
+
if ( typeof context.getElementById !== "undefined" && !isXML ) {
|
3999 |
+
var m = context.getElementById(match[1]);
|
4000 |
+
|
4001 |
+
return m ?
|
4002 |
+
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
|
4003 |
+
[m] :
|
4004 |
+
undefined :
|
4005 |
+
[];
|
4006 |
+
}
|
4007 |
+
};
|
4008 |
+
|
4009 |
+
Expr.filter.ID = function( elem, match ) {
|
4010 |
+
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
|
4011 |
+
|
4012 |
+
return elem.nodeType === 1 && node && node.nodeValue === match;
|
4013 |
+
};
|
4014 |
+
}
|
4015 |
+
|
4016 |
+
root.removeChild( form );
|
4017 |
+
|
4018 |
+
// release memory in IE
|
4019 |
+
root = form = null;
|
4020 |
+
})();
|
4021 |
+
|
4022 |
+
(function(){
|
4023 |
+
// Check to see if the browser returns only elements
|
4024 |
+
// when doing getElementsByTagName("*")
|
4025 |
+
|
4026 |
+
// Create a fake element
|
4027 |
+
var div = document.createElement("div");
|
4028 |
+
div.appendChild( document.createComment("") );
|
4029 |
+
|
4030 |
+
// Make sure no comments are found
|
4031 |
+
if ( div.getElementsByTagName("*").length > 0 ) {
|
4032 |
+
Expr.find.TAG = function( match, context ) {
|
4033 |
+
var results = context.getElementsByTagName( match[1] );
|
4034 |
+
|
4035 |
+
// Filter out possible comments
|
4036 |
+
if ( match[1] === "*" ) {
|
4037 |
+
var tmp = [];
|
4038 |
+
|
4039 |
+
for ( var i = 0; results[i]; i++ ) {
|
4040 |
+
if ( results[i].nodeType === 1 ) {
|
4041 |
+
tmp.push( results[i] );
|
4042 |
+
}
|
4043 |
+
}
|
4044 |
+
|
4045 |
+
results = tmp;
|
4046 |
+
}
|
4047 |
+
|
4048 |
+
return results;
|
4049 |
+
};
|
4050 |
+
}
|
4051 |
+
|
4052 |
+
// Check to see if an attribute returns normalized href attributes
|
4053 |
+
div.innerHTML = "<a href='#'></a>";
|
4054 |
+
|
4055 |
+
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
|
4056 |
+
div.firstChild.getAttribute("href") !== "#" ) {
|
4057 |
+
|
4058 |
+
Expr.attrHandle.href = function( elem ) {
|
4059 |
+
return elem.getAttribute( "href", 2 );
|
4060 |
+
};
|
4061 |
+
}
|
4062 |
+
|
4063 |
+
// release memory in IE
|
4064 |
+
div = null;
|
4065 |
+
})();
|
4066 |
+
|
4067 |
+
if ( document.querySelectorAll ) {
|
4068 |
+
(function(){
|
4069 |
+
var oldSizzle = Sizzle,
|
4070 |
+
div = document.createElement("div"),
|
4071 |
+
id = "__sizzle__";
|
4072 |
+
|
4073 |
+
div.innerHTML = "<p class='TEST'></p>";
|
4074 |
+
|
4075 |
+
// Safari can't handle uppercase or unicode characters when
|
4076 |
+
// in quirks mode.
|
4077 |
+
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
|
4078 |
+
return;
|
4079 |
+
}
|
4080 |
+
|
4081 |
+
Sizzle = function( query, context, extra, seed ) {
|
4082 |
+
context = context || document;
|
4083 |
+
|
4084 |
+
// Make sure that attribute selectors are quoted
|
4085 |
+
query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
|
4086 |
+
|
4087 |
+
// Only use querySelectorAll on non-XML documents
|
4088 |
+
// (ID selectors don't work in non-HTML documents)
|
4089 |
+
if ( !seed && !Sizzle.isXML(context) ) {
|
4090 |
+
if ( context.nodeType === 9 ) {
|
4091 |
+
try {
|
4092 |
+
return makeArray( context.querySelectorAll(query), extra );
|
4093 |
+
} catch(qsaError) {}
|
4094 |
+
|
4095 |
+
// qSA works strangely on Element-rooted queries
|
4096 |
+
// We can work around this by specifying an extra ID on the root
|
4097 |
+
// and working up from there (Thanks to Andrew Dupont for the technique)
|
4098 |
+
// IE 8 doesn't work on object elements
|
4099 |
+
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
|
4100 |
+
var old = context.getAttribute( "id" ),
|
4101 |
+
nid = old || id;
|
4102 |
+
|
4103 |
+
if ( !old ) {
|
4104 |
+
context.setAttribute( "id", nid );
|
4105 |
+
}
|
4106 |
+
|
4107 |
+
try {
|
4108 |
+
return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
|
4109 |
+
|
4110 |
+
} catch(pseudoError) {
|
4111 |
+
} finally {
|
4112 |
+
if ( !old ) {
|
4113 |
+
context.removeAttribute( "id" );
|
4114 |
+
}
|
4115 |
+
}
|
4116 |
+
}
|
4117 |
+
}
|
4118 |
+
|
4119 |
+
return oldSizzle(query, context, extra, seed);
|
4120 |
+
};
|
4121 |
+
|
4122 |
+
for ( var prop in oldSizzle ) {
|
4123 |
+
Sizzle[ prop ] = oldSizzle[ prop ];
|
4124 |
+
}
|
4125 |
+
|
4126 |
+
// release memory in IE
|
4127 |
+
div = null;
|
4128 |
+
})();
|
4129 |
+
}
|
4130 |
+
|
4131 |
+
(function(){
|
4132 |
+
var html = document.documentElement,
|
4133 |
+
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
|
4134 |
+
pseudoWorks = false;
|
4135 |
+
|
4136 |
+
try {
|
4137 |
+
// This should fail with an exception
|
4138 |
+
// Gecko does not error, returns false instead
|
4139 |
+
matches.call( document.documentElement, "[test!='']:sizzle" );
|
4140 |
+
|
4141 |
+
} catch( pseudoError ) {
|
4142 |
+
pseudoWorks = true;
|
4143 |
+
}
|
4144 |
+
|
4145 |
+
if ( matches ) {
|
4146 |
+
Sizzle.matchesSelector = function( node, expr ) {
|
4147 |
+
// Make sure that attribute selectors are quoted
|
4148 |
+
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
|
4149 |
+
|
4150 |
+
if ( !Sizzle.isXML( node ) ) {
|
4151 |
+
try {
|
4152 |
+
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
|
4153 |
+
return matches.call( node, expr );
|
4154 |
+
}
|
4155 |
+
} catch(e) {}
|
4156 |
+
}
|
4157 |
+
|
4158 |
+
return Sizzle(expr, null, null, [node]).length > 0;
|
4159 |
+
};
|
4160 |
+
}
|
4161 |
+
})();
|
4162 |
+
|
4163 |
+
(function(){
|
4164 |
+
var div = document.createElement("div");
|
4165 |
+
|
4166 |
+
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
|
4167 |
+
|
4168 |
+
// Opera can't find a second classname (in 9.6)
|
4169 |
+
// Also, make sure that getElementsByClassName actually exists
|
4170 |
+
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
|
4171 |
+
return;
|
4172 |
+
}
|
4173 |
+
|
4174 |
+
// Safari caches class attributes, doesn't catch changes (in 3.2)
|
4175 |
+
div.lastChild.className = "e";
|
4176 |
+
|
4177 |
+
if ( div.getElementsByClassName("e").length === 1 ) {
|
4178 |
+
return;
|
4179 |
+
}
|
4180 |
+
|
4181 |
+
Expr.order.splice(1, 0, "CLASS");
|
4182 |
+
Expr.find.CLASS = function( match, context, isXML ) {
|
4183 |
+
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
|
4184 |
+
return context.getElementsByClassName(match[1]);
|
4185 |
+
}
|
4186 |
+
};
|
4187 |
+
|
4188 |
+
// release memory in IE
|
4189 |
+
div = null;
|
4190 |
+
})();
|
4191 |
+
|
4192 |
+
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
|
4193 |
+
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
|
4194 |
+
var elem = checkSet[i];
|
4195 |
+
|
4196 |
+
if ( elem ) {
|
4197 |
+
var match = false;
|
4198 |
+
|
4199 |
+
elem = elem[dir];
|
4200 |
+
|
4201 |
+
while ( elem ) {
|
4202 |
+
if ( elem.sizcache === doneName ) {
|
4203 |
+
match = checkSet[elem.sizset];
|
4204 |
+
break;
|
4205 |
+
}
|
4206 |
+
|
4207 |
+
if ( elem.nodeType === 1 && !isXML ){
|
4208 |
+
elem.sizcache = doneName;
|
4209 |
+
elem.sizset = i;
|
4210 |
+
}
|
4211 |
+
|
4212 |
+
if ( elem.nodeName.toLowerCase() === cur ) {
|
4213 |
+
match = elem;
|
4214 |
+
break;
|
4215 |
+
}
|
4216 |
+
|
4217 |
+
elem = elem[dir];
|
4218 |
+
}
|
4219 |
+
|
4220 |
+
checkSet[i] = match;
|
4221 |
+
}
|
4222 |
+
}
|
4223 |
+
}
|
4224 |
+
|
4225 |
+
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
|
4226 |
+
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
|
4227 |
+
var elem = checkSet[i];
|
4228 |
+
|
4229 |
+
if ( elem ) {
|
4230 |
+
var match = false;
|
4231 |
+
|
4232 |
+
elem = elem[dir];
|
4233 |
+
|
4234 |
+
while ( elem ) {
|
4235 |
+
if ( elem.sizcache === doneName ) {
|
4236 |
+
match = checkSet[elem.sizset];
|
4237 |
+
break;
|
4238 |
+
}
|
4239 |
+
|
4240 |
+
if ( elem.nodeType === 1 ) {
|
4241 |
+
if ( !isXML ) {
|
4242 |
+
elem.sizcache = doneName;
|
4243 |
+
elem.sizset = i;
|
4244 |
+
}
|
4245 |
+
|
4246 |
+
if ( typeof cur !== "string" ) {
|
4247 |
+
if ( elem === cur ) {
|
4248 |
+
match = true;
|
4249 |
+
break;
|
4250 |
+
}
|
4251 |
+
|
4252 |
+
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
|
4253 |
+
match = elem;
|
4254 |
+
break;
|
4255 |
+
}
|
4256 |
+
}
|
4257 |
+
|
4258 |
+
elem = elem[dir];
|
4259 |
+
}
|
4260 |
+
|
4261 |
+
checkSet[i] = match;
|
4262 |
+
}
|
4263 |
+
}
|
4264 |
+
}
|
4265 |
+
|
4266 |
+
if ( document.documentElement.contains ) {
|
4267 |
+
Sizzle.contains = function( a, b ) {
|
4268 |
+
return a !== b && (a.contains ? a.contains(b) : true);
|
4269 |
+
};
|
4270 |
+
|
4271 |
+
} else if ( document.documentElement.compareDocumentPosition ) {
|
4272 |
+
Sizzle.contains = function( a, b ) {
|
4273 |
+
return !!(a.compareDocumentPosition(b) & 16);
|
4274 |
+
};
|
4275 |
+
|
4276 |
+
} else {
|
4277 |
+
Sizzle.contains = function() {
|
4278 |
+
return false;
|
4279 |
+
};
|
4280 |
+
}
|
4281 |
+
|
4282 |
+
Sizzle.isXML = function( elem ) {
|
4283 |
+
// documentElement is verified for cases where it doesn't yet exist
|
4284 |
+
// (such as loading iframes in IE - #4833)
|
4285 |
+
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
|
4286 |
+
|
4287 |
+
return documentElement ? documentElement.nodeName !== "HTML" : false;
|
4288 |
+
};
|
4289 |
+
|
4290 |
+
var posProcess = function( selector, context ) {
|
4291 |
+
var match,
|
4292 |
+
tmpSet = [],
|
4293 |
+
later = "",
|
4294 |
+
root = context.nodeType ? [context] : context;
|
4295 |
+
|
4296 |
+
// Position selectors must be done after the filter
|
4297 |
+
// And so must :not(positional) so we move all PSEUDOs to the end
|
4298 |
+
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
|
4299 |
+
later += match[0];
|
4300 |
+
selector = selector.replace( Expr.match.PSEUDO, "" );
|
4301 |
+
}
|
4302 |
+
|
4303 |
+
selector = Expr.relative[selector] ? selector + "*" : selector;
|
4304 |
+
|
4305 |
+
for ( var i = 0, l = root.length; i < l; i++ ) {
|
4306 |
+
Sizzle( selector, root[i], tmpSet );
|
4307 |
+
}
|
4308 |
+
|
4309 |
+
return Sizzle.filter( later, tmpSet );
|
4310 |
+
};
|
4311 |
+
|
4312 |
+
// EXPOSE
|
4313 |
+
jQuery.find = Sizzle;
|
4314 |
+
jQuery.expr = Sizzle.selectors;
|
4315 |
+
jQuery.expr[":"] = jQuery.expr.filters;
|
4316 |
+
jQuery.unique = Sizzle.uniqueSort;
|
4317 |
+
jQuery.text = Sizzle.getText;
|
4318 |
+
jQuery.isXMLDoc = Sizzle.isXML;
|
4319 |
+
jQuery.contains = Sizzle.contains;
|
4320 |
+
|
4321 |
+
|
4322 |
+
})();
|
4323 |
+
|
4324 |
+
|
4325 |
+
var runtil = /Until$/,
|
4326 |
+
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
|
4327 |
+
// Note: This RegExp should be improved, or likely pulled from Sizzle
|
4328 |
+
rmultiselector = /,/,
|
4329 |
+
isSimple = /^.[^:#\[\.,]*$/,
|
4330 |
+
slice = Array.prototype.slice,
|
4331 |
+
POS = jQuery.expr.match.POS;
|
4332 |
+
|
4333 |
+
jQuery.fn.extend({
|
4334 |
+
find: function( selector ) {
|
4335 |
+
var ret = this.pushStack( "", "find", selector ),
|
4336 |
+
length = 0;
|
4337 |
+
|
4338 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
4339 |
+
length = ret.length;
|
4340 |
+
jQuery.find( selector, this[i], ret );
|
4341 |
+
|
4342 |
+
if ( i > 0 ) {
|
4343 |
+
// Make sure that the results are unique
|
4344 |
+
for ( var n = length; n < ret.length; n++ ) {
|
4345 |
+
for ( var r = 0; r < length; r++ ) {
|
4346 |
+
if ( ret[r] === ret[n] ) {
|
4347 |
+
ret.splice(n--, 1);
|
4348 |
+
break;
|
4349 |
+
}
|
4350 |
+
}
|
4351 |
+
}
|
4352 |
+
}
|
4353 |
+
}
|
4354 |
+
|
4355 |
+
return ret;
|
4356 |
+
},
|
4357 |
+
|
4358 |
+
has: function( target ) {
|
4359 |
+
var targets = jQuery( target );
|
4360 |
+
return this.filter(function() {
|
4361 |
+
for ( var i = 0, l = targets.length; i < l; i++ ) {
|
4362 |
+
if ( jQuery.contains( this, targets[i] ) ) {
|
4363 |
+
return true;
|
4364 |
+
}
|
4365 |
+
}
|
4366 |
+
});
|
4367 |
+
},
|
4368 |
+
|
4369 |
+
not: function( selector ) {
|
4370 |
+
return this.pushStack( winnow(this, selector, false), "not", selector);
|
4371 |
+
},
|
4372 |
+
|
4373 |
+
filter: function( selector ) {
|
4374 |
+
return this.pushStack( winnow(this, selector, true), "filter", selector );
|
4375 |
+
},
|
4376 |
+
|
4377 |
+
is: function( selector ) {
|
4378 |
+
return !!selector && jQuery.filter( selector, this ).length > 0;
|
4379 |
+
},
|
4380 |
+
|
4381 |
+
closest: function( selectors, context ) {
|
4382 |
+
var ret = [], i, l, cur = this[0];
|
4383 |
+
|
4384 |
+
if ( jQuery.isArray( selectors ) ) {
|
4385 |
+
var match, selector,
|
4386 |
+
matches = {},
|
4387 |
+
level = 1;
|
4388 |
+
|
4389 |
+
if ( cur && selectors.length ) {
|
4390 |
+
for ( i = 0, l = selectors.length; i < l; i++ ) {
|
4391 |
+
selector = selectors[i];
|
4392 |
+
|
4393 |
+
if ( !matches[selector] ) {
|
4394 |
+
matches[selector] = jQuery.expr.match.POS.test( selector ) ?
|
4395 |
+
jQuery( selector, context || this.context ) :
|
4396 |
+
selector;
|
4397 |
+
}
|
4398 |
+
}
|
4399 |
+
|
4400 |
+
while ( cur && cur.ownerDocument && cur !== context ) {
|
4401 |
+
for ( selector in matches ) {
|
4402 |
+
match = matches[selector];
|
4403 |
+
|
4404 |
+
if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
|
4405 |
+
ret.push({ selector: selector, elem: cur, level: level });
|
4406 |
+
}
|
4407 |
+
}
|
4408 |
+
|
4409 |
+
cur = cur.parentNode;
|
4410 |
+
level++;
|
4411 |
+
}
|
4412 |
+
}
|
4413 |
+
|
4414 |
+
return ret;
|
4415 |
+
}
|
4416 |
+
|
4417 |
+
var pos = POS.test( selectors ) ?
|
4418 |
+
jQuery( selectors, context || this.context ) : null;
|
4419 |
+
|
4420 |
+
for ( i = 0, l = this.length; i < l; i++ ) {
|
4421 |
+
cur = this[i];
|
4422 |
+
|
4423 |
+
while ( cur ) {
|
4424 |
+
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
|
4425 |
+
ret.push( cur );
|
4426 |
+
break;
|
4427 |
+
|
4428 |
+
} else {
|
4429 |
+
cur = cur.parentNode;
|
4430 |
+
if ( !cur || !cur.ownerDocument || cur === context ) {
|
4431 |
+
break;
|
4432 |
+
}
|
4433 |
+
}
|
4434 |
+
}
|
4435 |
+
}
|
4436 |
+
|
4437 |
+
ret = ret.length > 1 ? jQuery.unique(ret) : ret;
|
4438 |
+
|
4439 |
+
return this.pushStack( ret, "closest", selectors );
|
4440 |
+
},
|
4441 |
+
|
4442 |
+
// Determine the position of an element within
|
4443 |
+
// the matched set of elements
|
4444 |
+
index: function( elem ) {
|
4445 |
+
if ( !elem || typeof elem === "string" ) {
|
4446 |
+
return jQuery.inArray( this[0],
|
4447 |
+
// If it receives a string, the selector is used
|
4448 |
+
// If it receives nothing, the siblings are used
|
4449 |
+
elem ? jQuery( elem ) : this.parent().children() );
|
4450 |
+
}
|
4451 |
+
// Locate the position of the desired element
|
4452 |
+
return jQuery.inArray(
|
4453 |
+
// If it receives a jQuery object, the first element is used
|
4454 |
+
elem.jquery ? elem[0] : elem, this );
|
4455 |
+
},
|
4456 |
+
|
4457 |
+
add: function( selector, context ) {
|
4458 |
+
var set = typeof selector === "string" ?
|
4459 |
+
jQuery( selector, context || this.context ) :
|
4460 |
+
jQuery.makeArray( selector ),
|
4461 |
+
all = jQuery.merge( this.get(), set );
|
4462 |
+
|
4463 |
+
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
|
4464 |
+
all :
|
4465 |
+
jQuery.unique( all ) );
|
4466 |
+
},
|
4467 |
+
|
4468 |
+
andSelf: function() {
|
4469 |
+
return this.add( this.prevObject );
|
4470 |
+
}
|
4471 |
+
});
|
4472 |
+
|
4473 |
+
// A painfully simple check to see if an element is disconnected
|
4474 |
+
// from a document (should be improved, where feasible).
|
4475 |
+
function isDisconnected( node ) {
|
4476 |
+
return !node || !node.parentNode || node.parentNode.nodeType === 11;
|
4477 |
+
}
|
4478 |
+
|
4479 |
+
jQuery.each({
|
4480 |
+
parent: function( elem ) {
|
4481 |
+
var parent = elem.parentNode;
|
4482 |
+
return parent && parent.nodeType !== 11 ? parent : null;
|
4483 |
+
},
|
4484 |
+
parents: function( elem ) {
|
4485 |
+
return jQuery.dir( elem, "parentNode" );
|
4486 |
+
},
|
4487 |
+
parentsUntil: function( elem, i, until ) {
|
4488 |
+
return jQuery.dir( elem, "parentNode", until );
|
4489 |
+
},
|
4490 |
+
next: function( elem ) {
|
4491 |
+
return jQuery.nth( elem, 2, "nextSibling" );
|
4492 |
+
},
|
4493 |
+
prev: function( elem ) {
|
4494 |
+
return jQuery.nth( elem, 2, "previousSibling" );
|
4495 |
+
},
|
4496 |
+
nextAll: function( elem ) {
|
4497 |
+
return jQuery.dir( elem, "nextSibling" );
|
4498 |
+
},
|
4499 |
+
prevAll: function( elem ) {
|
4500 |
+
return jQuery.dir( elem, "previousSibling" );
|
4501 |
+
},
|
4502 |
+
nextUntil: function( elem, i, until ) {
|
4503 |
+
return jQuery.dir( elem, "nextSibling", until );
|
4504 |
+
},
|
4505 |
+
prevUntil: function( elem, i, until ) {
|
4506 |
+
return jQuery.dir( elem, "previousSibling", until );
|
4507 |
+
},
|
4508 |
+
siblings: function( elem ) {
|
4509 |
+
return jQuery.sibling( elem.parentNode.firstChild, elem );
|
4510 |
+
},
|
4511 |
+
children: function( elem ) {
|
4512 |
+
return jQuery.sibling( elem.firstChild );
|
4513 |
+
},
|
4514 |
+
contents: function( elem ) {
|
4515 |
+
return jQuery.nodeName( elem, "iframe" ) ?
|
4516 |
+
elem.contentDocument || elem.contentWindow.document :
|
4517 |
+
jQuery.makeArray( elem.childNodes );
|
4518 |
+
}
|
4519 |
+
}, function( name, fn ) {
|
4520 |
+
jQuery.fn[ name ] = function( until, selector ) {
|
4521 |
+
var ret = jQuery.map( this, fn, until );
|
4522 |
+
|
4523 |
+
if ( !runtil.test( name ) ) {
|
4524 |
+
selector = until;
|
4525 |
+
}
|
4526 |
+
|
4527 |
+
if ( selector && typeof selector === "string" ) {
|
4528 |
+
ret = jQuery.filter( selector, ret );
|
4529 |
+
}
|
4530 |
+
|
4531 |
+
ret = this.length > 1 ? jQuery.unique( ret ) : ret;
|
4532 |
+
|
4533 |
+
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
|
4534 |
+
ret = ret.reverse();
|
4535 |
+
}
|
4536 |
+
|
4537 |
+
return this.pushStack( ret, name, slice.call(arguments).join(",") );
|
4538 |
+
};
|
4539 |
+
});
|
4540 |
+
|
4541 |
+
jQuery.extend({
|
4542 |
+
filter: function( expr, elems, not ) {
|
4543 |
+
if ( not ) {
|
4544 |
+
expr = ":not(" + expr + ")";
|
4545 |
+
}
|
4546 |
+
|
4547 |
+
return elems.length === 1 ?
|
4548 |
+
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
|
4549 |
+
jQuery.find.matches(expr, elems);
|
4550 |
+
},
|
4551 |
+
|
4552 |
+
dir: function( elem, dir, until ) {
|
4553 |
+
var matched = [],
|
4554 |
+
cur = elem[ dir ];
|
4555 |
+
|
4556 |
+
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
4557 |
+
if ( cur.nodeType === 1 ) {
|
4558 |
+
matched.push( cur );
|
4559 |
+
}
|
4560 |
+
cur = cur[dir];
|
4561 |
+
}
|
4562 |
+
return matched;
|
4563 |
+
},
|
4564 |
+
|
4565 |
+
nth: function( cur, result, dir, elem ) {
|
4566 |
+
result = result || 1;
|
4567 |
+
var num = 0;
|
4568 |
+
|
4569 |
+
for ( ; cur; cur = cur[dir] ) {
|
4570 |
+
if ( cur.nodeType === 1 && ++num === result ) {
|
4571 |
+
break;
|
4572 |
+
}
|
4573 |
+
}
|
4574 |
+
|
4575 |
+
return cur;
|
4576 |
+
},
|
4577 |
+
|
4578 |
+
sibling: function( n, elem ) {
|
4579 |
+
var r = [];
|
4580 |
+
|
4581 |
+
for ( ; n; n = n.nextSibling ) {
|
4582 |
+
if ( n.nodeType === 1 && n !== elem ) {
|
4583 |
+
r.push( n );
|
4584 |
+
}
|
4585 |
+
}
|
4586 |
+
|
4587 |
+
return r;
|
4588 |
+
}
|
4589 |
+
});
|
4590 |
+
|
4591 |
+
// Implement the identical functionality for filter and not
|
4592 |
+
function winnow( elements, qualifier, keep ) {
|
4593 |
+
if ( jQuery.isFunction( qualifier ) ) {
|
4594 |
+
return jQuery.grep(elements, function( elem, i ) {
|
4595 |
+
var retVal = !!qualifier.call( elem, i, elem );
|
4596 |
+
return retVal === keep;
|
4597 |
+
});
|
4598 |
+
|
4599 |
+
} else if ( qualifier.nodeType ) {
|
4600 |
+
return jQuery.grep(elements, function( elem, i ) {
|
4601 |
+
return (elem === qualifier) === keep;
|
4602 |
+
});
|
4603 |
+
|
4604 |
+
} else if ( typeof qualifier === "string" ) {
|
4605 |
+
var filtered = jQuery.grep(elements, function( elem ) {
|
4606 |
+
return elem.nodeType === 1;
|
4607 |
+
});
|
4608 |
+
|
4609 |
+
if ( isSimple.test( qualifier ) ) {
|
4610 |
+
return jQuery.filter(qualifier, filtered, !keep);
|
4611 |
+
} else {
|
4612 |
+
qualifier = jQuery.filter( qualifier, filtered );
|
4613 |
+
}
|
4614 |
+
}
|
4615 |
+
|
4616 |
+
return jQuery.grep(elements, function( elem, i ) {
|
4617 |
+
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
|
4618 |
+
});
|
4619 |
+
}
|
4620 |
+
|
4621 |
+
|
4622 |
+
|
4623 |
+
|
4624 |
+
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
|
4625 |
+
rleadingWhitespace = /^\s+/,
|
4626 |
+
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
|
4627 |
+
rtagName = /<([\w:]+)/,
|
4628 |
+
rtbody = /<tbody/i,
|
4629 |
+
rhtml = /<|&#?\w+;/,
|
4630 |
+
rnocache = /<(?:script|object|embed|option|style)/i,
|
4631 |
+
// checked="checked" or checked (html5)
|
4632 |
+
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
|
4633 |
+
raction = /\=([^="'>\s]+\/)>/g,
|
4634 |
+
wrapMap = {
|
4635 |
+
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
4636 |
+
legend: [ 1, "<fieldset>", "</fieldset>" ],
|
4637 |
+
thead: [ 1, "<table>", "</table>" ],
|
4638 |
+
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
4639 |
+
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
4640 |
+
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
|
4641 |
+
area: [ 1, "<map>", "</map>" ],
|
4642 |
+
_default: [ 0, "", "" ]
|
4643 |
+
};
|
4644 |
+
|
4645 |
+
wrapMap.optgroup = wrapMap.option;
|
4646 |
+
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
4647 |
+
wrapMap.th = wrapMap.td;
|
4648 |
+
|
4649 |
+
// IE can't serialize <link> and <script> tags normally
|
4650 |
+
if ( !jQuery.support.htmlSerialize ) {
|
4651 |
+
wrapMap._default = [ 1, "div<div>", "</div>" ];
|
4652 |
+
}
|
4653 |
+
|
4654 |
+
jQuery.fn.extend({
|
4655 |
+
text: function( text ) {
|
4656 |
+
if ( jQuery.isFunction(text) ) {
|
4657 |
+
return this.each(function(i) {
|
4658 |
+
var self = jQuery( this );
|
4659 |
+
|
4660 |
+
self.text( text.call(this, i, self.text()) );
|
4661 |
+
});
|
4662 |
+
}
|
4663 |
+
|
4664 |
+
if ( typeof text !== "object" && text !== undefined ) {
|
4665 |
+
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
|
4666 |
+
}
|
4667 |
+
|
4668 |
+
return jQuery.text( this );
|
4669 |
+
},
|
4670 |
+
|
4671 |
+
wrapAll: function( html ) {
|
4672 |
+
if ( jQuery.isFunction( html ) ) {
|
4673 |
+
return this.each(function(i) {
|
4674 |
+
jQuery(this).wrapAll( html.call(this, i) );
|
4675 |
+
});
|
4676 |
+
}
|
4677 |
+
|
4678 |
+
if ( this[0] ) {
|
4679 |
+
// The elements to wrap the target around
|
4680 |
+
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
|
4681 |
+
|
4682 |
+
if ( this[0].parentNode ) {
|
4683 |
+
wrap.insertBefore( this[0] );
|
4684 |
+
}
|
4685 |
+
|
4686 |
+
wrap.map(function() {
|
4687 |
+
var elem = this;
|
4688 |
+
|
4689 |
+
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
|
4690 |
+
elem = elem.firstChild;
|
4691 |
+
}
|
4692 |
+
|
4693 |
+
return elem;
|
4694 |
+
}).append(this);
|
4695 |
+
}
|
4696 |
+
|
4697 |
+
return this;
|
4698 |
+
},
|
4699 |
+
|
4700 |
+
wrapInner: function( html ) {
|
4701 |
+
if ( jQuery.isFunction( html ) ) {
|
4702 |
+
return this.each(function(i) {
|
4703 |
+
jQuery(this).wrapInner( html.call(this, i) );
|
4704 |
+
});
|
4705 |
+
}
|
4706 |
+
|
4707 |
+
return this.each(function() {
|
4708 |
+
var self = jQuery( this ),
|
4709 |
+
contents = self.contents();
|
4710 |
+
|
4711 |
+
if ( contents.length ) {
|
4712 |
+
contents.wrapAll( html );
|
4713 |
+
|
4714 |
+
} else {
|
4715 |
+
self.append( html );
|
4716 |
+
}
|
4717 |
+
});
|
4718 |
+
},
|
4719 |
+
|
4720 |
+
wrap: function( html ) {
|
4721 |
+
return this.each(function() {
|
4722 |
+
jQuery( this ).wrapAll( html );
|
4723 |
+
});
|
4724 |
+
},
|
4725 |
+
|
4726 |
+
unwrap: function() {
|
4727 |
+
return this.parent().each(function() {
|
4728 |
+
if ( !jQuery.nodeName( this, "body" ) ) {
|
4729 |
+
jQuery( this ).replaceWith( this.childNodes );
|
4730 |
+
}
|
4731 |
+
}).end();
|
4732 |
+
},
|
4733 |
+
|
4734 |
+
append: function() {
|
4735 |
+
return this.domManip(arguments, true, function( elem ) {
|
4736 |
+
if ( this.nodeType === 1 ) {
|
4737 |
+
this.appendChild( elem );
|
4738 |
+
}
|
4739 |
+
});
|
4740 |
+
},
|
4741 |
+
|
4742 |
+
prepend: function() {
|
4743 |
+
return this.domManip(arguments, true, function( elem ) {
|
4744 |
+
if ( this.nodeType === 1 ) {
|
4745 |
+
this.insertBefore( elem, this.firstChild );
|
4746 |
+
}
|
4747 |
+
});
|
4748 |
+
},
|
4749 |
+
|
4750 |
+
before: function() {
|
4751 |
+
if ( this[0] && this[0].parentNode ) {
|
4752 |
+
return this.domManip(arguments, false, function( elem ) {
|
4753 |
+
this.parentNode.insertBefore( elem, this );
|
4754 |
+
});
|
4755 |
+
} else if ( arguments.length ) {
|
4756 |
+
var set = jQuery(arguments[0]);
|
4757 |
+
set.push.apply( set, this.toArray() );
|
4758 |
+
return this.pushStack( set, "before", arguments );
|
4759 |
+
}
|
4760 |
+
},
|
4761 |
+
|
4762 |
+
after: function() {
|
4763 |
+
if ( this[0] && this[0].parentNode ) {
|
4764 |
+
return this.domManip(arguments, false, function( elem ) {
|
4765 |
+
this.parentNode.insertBefore( elem, this.nextSibling );
|
4766 |
+
});
|
4767 |
+
} else if ( arguments.length ) {
|
4768 |
+
var set = this.pushStack( this, "after", arguments );
|
4769 |
+
set.push.apply( set, jQuery(arguments[0]).toArray() );
|
4770 |
+
return set;
|
4771 |
+
}
|
4772 |
+
},
|
4773 |
+
|
4774 |
+
// keepData is for internal use only--do not document
|
4775 |
+
remove: function( selector, keepData ) {
|
4776 |
+
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
|
4777 |
+
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
|
4778 |
+
if ( !keepData && elem.nodeType === 1 ) {
|
4779 |
+
jQuery.cleanData( elem.getElementsByTagName("*") );
|
4780 |
+
jQuery.cleanData( [ elem ] );
|
4781 |
+
}
|
4782 |
+
|
4783 |
+
if ( elem.parentNode ) {
|
4784 |
+
elem.parentNode.removeChild( elem );
|
4785 |
+
}
|
4786 |
+
}
|
4787 |
+
}
|
4788 |
+
|
4789 |
+
return this;
|
4790 |
+
},
|
4791 |
+
|
4792 |
+
empty: function() {
|
4793 |
+
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
|
4794 |
+
// Remove element nodes and prevent memory leaks
|
4795 |
+
if ( elem.nodeType === 1 ) {
|
4796 |
+
jQuery.cleanData( elem.getElementsByTagName("*") );
|
4797 |
+
}
|
4798 |
+
|
4799 |
+
// Remove any remaining nodes
|
4800 |
+
while ( elem.firstChild ) {
|
4801 |
+
elem.removeChild( elem.firstChild );
|
4802 |
+
}
|
4803 |
+
}
|
4804 |
+
|
4805 |
+
return this;
|
4806 |
+
},
|
4807 |
+
|
4808 |
+
clone: function( events ) {
|
4809 |
+
// Do the clone
|
4810 |
+
var ret = this.map(function() {
|
4811 |
+
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
|
4812 |
+
// IE copies events bound via attachEvent when
|
4813 |
+
// using cloneNode. Calling detachEvent on the
|
4814 |
+
// clone will also remove the events from the orignal
|
4815 |
+
// In order to get around this, we use innerHTML.
|
4816 |
+
// Unfortunately, this means some modifications to
|
4817 |
+
// attributes in IE that are actually only stored
|
4818 |
+
// as properties will not be copied (such as the
|
4819 |
+
// the name attribute on an input).
|
4820 |
+
var html = this.outerHTML,
|
4821 |
+
ownerDocument = this.ownerDocument;
|
4822 |
+
|
4823 |
+
if ( !html ) {
|
4824 |
+
var div = ownerDocument.createElement("div");
|
4825 |
+
div.appendChild( this.cloneNode(true) );
|
4826 |
+
html = div.innerHTML;
|
4827 |
+
}
|
4828 |
+
|
4829 |
+
return jQuery.clean([html.replace(rinlinejQuery, "")
|
4830 |
+
// Handle the case in IE 8 where action=/test/> self-closes a tag
|
4831 |
+
.replace(raction, '="$1">')
|
4832 |
+
.replace(rleadingWhitespace, "")], ownerDocument)[0];
|
4833 |
+
} else {
|
4834 |
+
return this.cloneNode(true);
|
4835 |
+
}
|
4836 |
+
});
|
4837 |
+
|
4838 |
+
// Copy the events from the original to the clone
|
4839 |
+
if ( events === true ) {
|
4840 |
+
cloneCopyEvent( this, ret );
|
4841 |
+
cloneCopyEvent( this.find("*"), ret.find("*") );
|
4842 |
+
}
|
4843 |
+
|
4844 |
+
// Return the cloned set
|
4845 |
+
return ret;
|
4846 |
+
},
|
4847 |
+
|
4848 |
+
html: function( value ) {
|
4849 |
+
if ( value === undefined ) {
|
4850 |
+
return this[0] && this[0].nodeType === 1 ?
|
4851 |
+
this[0].innerHTML.replace(rinlinejQuery, "") :
|
4852 |
+
null;
|
4853 |
+
|
4854 |
+
// See if we can take a shortcut and just use innerHTML
|
4855 |
+
} else if ( typeof value === "string" && !rnocache.test( value ) &&
|
4856 |
+
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
|
4857 |
+
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
|
4858 |
+
|
4859 |
+
value = value.replace(rxhtmlTag, "<$1></$2>");
|
4860 |
+
|
4861 |
+
try {
|
4862 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
4863 |
+
// Remove element nodes and prevent memory leaks
|
4864 |
+
if ( this[i].nodeType === 1 ) {
|
4865 |
+
jQuery.cleanData( this[i].getElementsByTagName("*") );
|
4866 |
+
this[i].innerHTML = value;
|
4867 |
+
}
|
4868 |
+
}
|
4869 |
+
|
4870 |
+
// If using innerHTML throws an exception, use the fallback method
|
4871 |
+
} catch(e) {
|
4872 |
+
this.empty().append( value );
|
4873 |
+
}
|
4874 |
+
|
4875 |
+
} else if ( jQuery.isFunction( value ) ) {
|
4876 |
+
this.each(function(i){
|
4877 |
+
var self = jQuery( this );
|
4878 |
+
|
4879 |
+
self.html( value.call(this, i, self.html()) );
|
4880 |
+
});
|
4881 |
+
|
4882 |
+
} else {
|
4883 |
+
this.empty().append( value );
|
4884 |
+
}
|
4885 |
+
|
4886 |
+
return this;
|
4887 |
+
},
|
4888 |
+
|
4889 |
+
replaceWith: function( value ) {
|
4890 |
+
if ( this[0] && this[0].parentNode ) {
|
4891 |
+
// Make sure that the elements are removed from the DOM before they are inserted
|
4892 |
+
// this can help fix replacing a parent with child elements
|
4893 |
+
if ( jQuery.isFunction( value ) ) {
|
4894 |
+
return this.each(function(i) {
|
4895 |
+
var self = jQuery(this), old = self.html();
|
4896 |
+
self.replaceWith( value.call( this, i, old ) );
|
4897 |
+
});
|
4898 |
+
}
|
4899 |
+
|
4900 |
+
if ( typeof value !== "string" ) {
|
4901 |
+
value = jQuery( value ).detach();
|
4902 |
+
}
|
4903 |
+
|
4904 |
+
return this.each(function() {
|
4905 |
+
var next = this.nextSibling,
|
4906 |
+
parent = this.parentNode;
|
4907 |
+
|
4908 |
+
jQuery( this ).remove();
|
4909 |
+
|
4910 |
+
if ( next ) {
|
4911 |
+
jQuery(next).before( value );
|
4912 |
+
} else {
|
4913 |
+
jQuery(parent).append( value );
|
4914 |
+
}
|
4915 |
+
});
|
4916 |
+
} else {
|
4917 |
+
return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
|
4918 |
+
}
|
4919 |
+
},
|
4920 |
+
|
4921 |
+
detach: function( selector ) {
|
4922 |
+
return this.remove( selector, true );
|
4923 |
+
},
|
4924 |
+
|
4925 |
+
domManip: function( args, table, callback ) {
|
4926 |
+
var results, first, fragment, parent,
|
4927 |
+
value = args[0],
|
4928 |
+
scripts = [];
|
4929 |
+
|
4930 |
+
// We can't cloneNode fragments that contain checked, in WebKit
|
4931 |
+
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
|
4932 |
+
return this.each(function() {
|
4933 |
+
jQuery(this).domManip( args, table, callback, true );
|
4934 |
+
});
|
4935 |
+
}
|
4936 |
+
|
4937 |
+
if ( jQuery.isFunction(value) ) {
|
4938 |
+
return this.each(function(i) {
|
4939 |
+
var self = jQuery(this);
|
4940 |
+
args[0] = value.call(this, i, table ? self.html() : undefined);
|
4941 |
+
self.domManip( args, table, callback );
|
4942 |
+
});
|
4943 |
+
}
|
4944 |
+
|
4945 |
+
if ( this[0] ) {
|
4946 |
+
parent = value && value.parentNode;
|
4947 |
+
|
4948 |
+
// If we're in a fragment, just use that instead of building a new one
|
4949 |
+
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
|
4950 |
+
results = { fragment: parent };
|
4951 |
+
|
4952 |
+
} else {
|
4953 |
+
results = jQuery.buildFragment( args, this, scripts );
|
4954 |
+
}
|
4955 |
+
|
4956 |
+
fragment = results.fragment;
|
4957 |
+
|
4958 |
+
if ( fragment.childNodes.length === 1 ) {
|
4959 |
+
first = fragment = fragment.firstChild;
|
4960 |
+
} else {
|
4961 |
+
first = fragment.firstChild;
|
4962 |
+
}
|
4963 |
+
|
4964 |
+
if ( first ) {
|
4965 |
+
table = table && jQuery.nodeName( first, "tr" );
|
4966 |
+
|
4967 |
+
for ( var i = 0, l = this.length; i < l; i++ ) {
|
4968 |
+
callback.call(
|
4969 |
+
table ?
|
4970 |
+
root(this[i], first) :
|
4971 |
+
this[i],
|
4972 |
+
i > 0 || results.cacheable || this.length > 1 ?
|
4973 |
+
fragment.cloneNode(true) :
|
4974 |
+
fragment
|
4975 |
+
);
|
4976 |
+
}
|
4977 |
+
}
|
4978 |
+
|
4979 |
+
if ( scripts.length ) {
|
4980 |
+
jQuery.each( scripts, evalScript );
|
4981 |
+
}
|
4982 |
+
}
|
4983 |
+
|
4984 |
+
return this;
|
4985 |
+
}
|
4986 |
+
});
|
4987 |
+
|
4988 |
+
function root( elem, cur ) {
|
4989 |
+
return jQuery.nodeName(elem, "table") ?
|
4990 |
+
(elem.getElementsByTagName("tbody")[0] ||
|
4991 |
+
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
|
4992 |
+
elem;
|
4993 |
+
}
|
4994 |
+
|
4995 |
+
function cloneCopyEvent(orig, ret) {
|
4996 |
+
var i = 0;
|
4997 |
+
|
4998 |
+
ret.each(function() {
|
4999 |
+
if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
|
5000 |
+
return;
|
5001 |
+
}
|
5002 |
+
|
5003 |
+
var oldData = jQuery.data( orig[i++] ),
|
5004 |
+
curData = jQuery.data( this, oldData ),
|
5005 |
+
events = oldData && oldData.events;
|
5006 |
+
|
5007 |
+
if ( events ) {
|
5008 |
+
delete curData.handle;
|
5009 |
+
curData.events = {};
|
5010 |
+
|
5011 |
+
for ( var type in events ) {
|
5012 |
+
for ( var handler in events[ type ] ) {
|
5013 |
+
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
|
5014 |
+
}
|
5015 |
+
}
|
5016 |
+
}
|
5017 |
+
});
|
5018 |
+
}
|
5019 |
+
|
5020 |
+
jQuery.buildFragment = function( args, nodes, scripts ) {
|
5021 |
+
var fragment, cacheable, cacheresults,
|
5022 |
+
doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
|
5023 |
+
|
5024 |
+
// Only cache "small" (1/2 KB) strings that are associated with the main document
|
5025 |
+
// Cloning options loses the selected state, so don't cache them
|
5026 |
+
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
|
5027 |
+
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
|
5028 |
+
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
|
5029 |
+
!rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
|
5030 |
+
|
5031 |
+
cacheable = true;
|
5032 |
+
cacheresults = jQuery.fragments[ args[0] ];
|
5033 |
+
if ( cacheresults ) {
|
5034 |
+
if ( cacheresults !== 1 ) {
|
5035 |
+
fragment = cacheresults;
|
5036 |
+
}
|
5037 |
+
}
|
5038 |
+
}
|
5039 |
+
|
5040 |
+
if ( !fragment ) {
|
5041 |
+
fragment = doc.createDocumentFragment();
|
5042 |
+
jQuery.clean( args, doc, fragment, scripts );
|
5043 |
+
}
|
5044 |
+
|
5045 |
+
if ( cacheable ) {
|
5046 |
+
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
|
5047 |
+
}
|
5048 |
+
|
5049 |
+
return { fragment: fragment, cacheable: cacheable };
|
5050 |
+
};
|
5051 |
+
|
5052 |
+
jQuery.fragments = {};
|
5053 |
+
|
5054 |
+
jQuery.each({
|
5055 |
+
appendTo: "append",
|
5056 |
+
prependTo: "prepend",
|
5057 |
+
insertBefore: "before",
|
5058 |
+
insertAfter: "after",
|
5059 |
+
replaceAll: "replaceWith"
|
5060 |
+
}, function( name, original ) {
|
5061 |
+
jQuery.fn[ name ] = function( selector ) {
|
5062 |
+
var ret = [],
|
5063 |
+
insert = jQuery( selector ),
|
5064 |
+
parent = this.length === 1 && this[0].parentNode;
|
5065 |
+
|
5066 |
+
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
|
5067 |
+
insert[ original ]( this[0] );
|
5068 |
+
return this;
|
5069 |
+
|
5070 |
+
} else {
|
5071 |
+
for ( var i = 0, l = insert.length; i < l; i++ ) {
|
5072 |
+
var elems = (i > 0 ? this.clone(true) : this).get();
|
5073 |
+
jQuery( insert[i] )[ original ]( elems );
|
5074 |
+
ret = ret.concat( elems );
|
5075 |
+
}
|
5076 |
+
|
5077 |
+
return this.pushStack( ret, name, insert.selector );
|
5078 |
+
}
|
5079 |
+
};
|
5080 |
+
});
|
5081 |
+
|
5082 |
+
jQuery.extend({
|
5083 |
+
clean: function( elems, context, fragment, scripts ) {
|
5084 |
+
context = context || document;
|
5085 |
+
|
5086 |
+
// !context.createElement fails in IE with an error but returns typeof 'object'
|
5087 |
+
if ( typeof context.createElement === "undefined" ) {
|
5088 |
+
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
|
5089 |
+
}
|
5090 |
+
|
5091 |
+
var ret = [];
|
5092 |
+
|
5093 |
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
5094 |
+
if ( typeof elem === "number" ) {
|
5095 |
+
elem += "";
|
5096 |
+
}
|
5097 |
+
|
5098 |
+
if ( !elem ) {
|
5099 |
+
continue;
|
5100 |
+
}
|
5101 |
+
|
5102 |
+
// Convert html string into DOM nodes
|
5103 |
+
if ( typeof elem === "string" && !rhtml.test( elem ) ) {
|
5104 |
+
elem = context.createTextNode( elem );
|
5105 |
+
|
5106 |
+
} else if ( typeof elem === "string" ) {
|
5107 |
+
// Fix "XHTML"-style tags in all browsers
|
5108 |
+
elem = elem.replace(rxhtmlTag, "<$1></$2>");
|
5109 |
+
|
5110 |
+
// Trim whitespace, otherwise indexOf won't work as expected
|
5111 |
+
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
|
5112 |
+
wrap = wrapMap[ tag ] || wrapMap._default,
|
5113 |
+
depth = wrap[0],
|
5114 |
+
div = context.createElement("div");
|
5115 |
+
|
5116 |
+
// Go to html and back, then peel off extra wrappers
|
5117 |
+
div.innerHTML = wrap[1] + elem + wrap[2];
|
5118 |
+
|
5119 |
+
// Move to the right depth
|
5120 |
+
while ( depth-- ) {
|
5121 |
+
div = div.lastChild;
|
5122 |
+
}
|
5123 |
+
|
5124 |
+
// Remove IE's autoinserted <tbody> from table fragments
|
5125 |
+
if ( !jQuery.support.tbody ) {
|
5126 |
+
|
5127 |
+
// String was a <table>, *may* have spurious <tbody>
|
5128 |
+
var hasBody = rtbody.test(elem),
|
5129 |
+
tbody = tag === "table" && !hasBody ?
|
5130 |
+
div.firstChild && div.firstChild.childNodes :
|
5131 |
+
|
5132 |
+
// String was a bare <thead> or <tfoot>
|
5133 |
+
wrap[1] === "<table>" && !hasBody ?
|
5134 |
+
div.childNodes :
|
5135 |
+
[];
|
5136 |
+
|
5137 |
+
for ( var j = tbody.length - 1; j >= 0 ; --j ) {
|
5138 |
+
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
|
5139 |
+
tbody[ j ].parentNode.removeChild( tbody[ j ] );
|
5140 |
+
}
|
5141 |
+
}
|
5142 |
+
|
5143 |
+
}
|
5144 |
+
|
5145 |
+
// IE completely kills leading whitespace when innerHTML is used
|
5146 |
+
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
|
5147 |
+
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
|
5148 |
+
}
|
5149 |
+
|
5150 |
+
elem = div.childNodes;
|
5151 |
+
}
|
5152 |
+
|
5153 |
+
if ( elem.nodeType ) {
|
5154 |
+
ret.push( elem );
|
5155 |
+
} else {
|
5156 |
+
ret = jQuery.merge( ret, elem );
|
5157 |
+
}
|
5158 |
+
}
|
5159 |
+
|
5160 |
+
if ( fragment ) {
|
5161 |
+
for ( i = 0; ret[i]; i++ ) {
|
5162 |
+
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
|
5163 |
+
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
|
5164 |
+
|
5165 |
+
} else {
|
5166 |
+
if ( ret[i].nodeType === 1 ) {
|
5167 |
+
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
|
5168 |
+
}
|
5169 |
+
fragment.appendChild( ret[i] );
|
5170 |
+
}
|
5171 |
+
}
|
5172 |
+
}
|
5173 |
+
|
5174 |
+
return ret;
|
5175 |
+
},
|
5176 |
+
|
5177 |
+
cleanData: function( elems ) {
|
5178 |
+
var data, id, cache = jQuery.cache,
|
5179 |
+
special = jQuery.event.special,
|
5180 |
+
deleteExpando = jQuery.support.deleteExpando;
|
5181 |
+
|
5182 |
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
5183 |
+
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
|
5184 |
+
continue;
|
5185 |
+
}
|
5186 |
+
|
5187 |
+
id = elem[ jQuery.expando ];
|
5188 |
+
|
5189 |
+
if ( id ) {
|
5190 |
+
data = cache[ id ];
|
5191 |
+
|
5192 |
+
if ( data && data.events ) {
|
5193 |
+
for ( var type in data.events ) {
|
5194 |
+
if ( special[ type ] ) {
|
5195 |
+
jQuery.event.remove( elem, type );
|
5196 |
+
|
5197 |
+
} else {
|
5198 |
+
jQuery.removeEvent( elem, type, data.handle );
|
5199 |
+
}
|
5200 |
+
}
|
5201 |
+
}
|
5202 |
+
|
5203 |
+
if ( deleteExpando ) {
|
5204 |
+
delete elem[ jQuery.expando ];
|
5205 |
+
|
5206 |
+
} else if ( elem.removeAttribute ) {
|
5207 |
+
elem.removeAttribute( jQuery.expando );
|
5208 |
+
}
|
5209 |
+
|
5210 |
+
delete cache[ id ];
|
5211 |
+
}
|
5212 |
+
}
|
5213 |
+
}
|
5214 |
+
});
|
5215 |
+
|
5216 |
+
function evalScript( i, elem ) {
|
5217 |
+
if ( elem.src ) {
|
5218 |
+
jQuery.ajax({
|
5219 |
+
url: elem.src,
|
5220 |
+
async: false,
|
5221 |
+
dataType: "script"
|
5222 |
+
});
|
5223 |
+
} else {
|
5224 |
+
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
|
5225 |
+
}
|
5226 |
+
|
5227 |
+
if ( elem.parentNode ) {
|
5228 |
+
elem.parentNode.removeChild( elem );
|
5229 |
+
}
|
5230 |
+
}
|
5231 |
+
|
5232 |
+
|
5233 |
+
|
5234 |
+
|
5235 |
+
var ralpha = /alpha\([^)]*\)/i,
|
5236 |
+
ropacity = /opacity=([^)]*)/,
|
5237 |
+
rdashAlpha = /-([a-z])/ig,
|
5238 |
+
rupper = /([A-Z])/g,
|
5239 |
+
rnumpx = /^-?\d+(?:px)?$/i,
|
5240 |
+
rnum = /^-?\d/,
|
5241 |
+
|
5242 |
+
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
5243 |
+
cssWidth = [ "Left", "Right" ],
|
5244 |
+
cssHeight = [ "Top", "Bottom" ],
|
5245 |
+
curCSS,
|
5246 |
+
|
5247 |
+
getComputedStyle,
|
5248 |
+
currentStyle,
|
5249 |
+
|
5250 |
+
fcamelCase = function( all, letter ) {
|
5251 |
+
return letter.toUpperCase();
|
5252 |
+
};
|
5253 |
+
|
5254 |
+
jQuery.fn.css = function( name, value ) {
|
5255 |
+
// Setting 'undefined' is a no-op
|
5256 |
+
if ( arguments.length === 2 && value === undefined ) {
|
5257 |
+
return this;
|
5258 |
+
}
|
5259 |
+
|
5260 |
+
return jQuery.access( this, name, value, true, function( elem, name, value ) {
|
5261 |
+
return value !== undefined ?
|
5262 |
+
jQuery.style( elem, name, value ) :
|
5263 |
+
jQuery.css( elem, name );
|
5264 |
+
});
|
5265 |
+
};
|
5266 |
+
|
5267 |
+
jQuery.extend({
|
5268 |
+
// Add in style property hooks for overriding the default
|
5269 |
+
// behavior of getting and setting a style property
|
5270 |
+
cssHooks: {
|
5271 |
+
opacity: {
|
5272 |
+
get: function( elem, computed ) {
|
5273 |
+
if ( computed ) {
|
5274 |
+
// We should always get a number back from opacity
|
5275 |
+
var ret = curCSS( elem, "opacity", "opacity" );
|
5276 |
+
return ret === "" ? "1" : ret;
|
5277 |
+
|
5278 |
+
} else {
|
5279 |
+
return elem.style.opacity;
|
5280 |
+
}
|
5281 |
+
}
|
5282 |
+
}
|
5283 |
+
},
|
5284 |
+
|
5285 |
+
// Exclude the following css properties to add px
|
5286 |
+
cssNumber: {
|
5287 |
+
"zIndex": true,
|
5288 |
+
"fontWeight": true,
|
5289 |
+
"opacity": true,
|
5290 |
+
"zoom": true,
|
5291 |
+
"lineHeight": true
|
5292 |
+
},
|
5293 |
+
|
5294 |
+
// Add in properties whose names you wish to fix before
|
5295 |
+
// setting or getting the value
|
5296 |
+
cssProps: {
|
5297 |
+
// normalize float css property
|
5298 |
+
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
|
5299 |
+
},
|
5300 |
+
|
5301 |
+
// Get and set the style property on a DOM Node
|
5302 |
+
style: function( elem, name, value, extra ) {
|
5303 |
+
// Don't set styles on text and comment nodes
|
5304 |
+
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
|
5305 |
+
return;
|
5306 |
+
}
|
5307 |
+
|
5308 |
+
// Make sure that we're working with the right name
|
5309 |
+
var ret, origName = jQuery.camelCase( name ),
|
5310 |
+
style = elem.style, hooks = jQuery.cssHooks[ origName ];
|
5311 |
+
|
5312 |
+
name = jQuery.cssProps[ origName ] || origName;
|
5313 |
+
|
5314 |
+
// Check if we're setting a value
|
5315 |
+
if ( value !== undefined ) {
|
5316 |
+
// Make sure that NaN and null values aren't set. See: #7116
|
5317 |
+
if ( typeof value === "number" && isNaN( value ) || value == null ) {
|
5318 |
+
return;
|
5319 |
+
}
|
5320 |
+
|
5321 |
+
// If a number was passed in, add 'px' to the (except for certain CSS properties)
|
5322 |
+
if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
|
5323 |
+
value += "px";
|
5324 |
+
}
|
5325 |
+
|
5326 |
+
// If a hook was provided, use that value, otherwise just set the specified value
|
5327 |
+
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
|
5328 |
+
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
|
5329 |
+
// Fixes bug #5509
|
5330 |
+
try {
|
5331 |
+
style[ name ] = value;
|
5332 |
+
} catch(e) {}
|
5333 |
+
}
|
5334 |
+
|
5335 |
+
} else {
|
5336 |
+
// If a hook was provided get the non-computed value from there
|
5337 |
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
|
5338 |
+
return ret;
|
5339 |
+
}
|
5340 |
+
|
5341 |
+
// Otherwise just get the value from the style object
|
5342 |
+
return style[ name ];
|
5343 |
+
}
|
5344 |
+
},
|
5345 |
+
|
5346 |
+
css: function( elem, name, extra ) {
|
5347 |
+
// Make sure that we're working with the right name
|
5348 |
+
var ret, origName = jQuery.camelCase( name ),
|
5349 |
+
hooks = jQuery.cssHooks[ origName ];
|
5350 |
+
|
5351 |
+
name = jQuery.cssProps[ origName ] || origName;
|
5352 |
+
|
5353 |
+
// If a hook was provided get the computed value from there
|
5354 |
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
|
5355 |
+
return ret;
|
5356 |
+
|
5357 |
+
// Otherwise, if a way to get the computed value exists, use that
|
5358 |
+
} else if ( curCSS ) {
|
5359 |
+
return curCSS( elem, name, origName );
|
5360 |
+
}
|
5361 |
+
},
|
5362 |
+
|
5363 |
+
// A method for quickly swapping in/out CSS properties to get correct calculations
|
5364 |
+
swap: function( elem, options, callback ) {
|
5365 |
+
var old = {};
|
5366 |
+
|
5367 |
+
// Remember the old values, and insert the new ones
|
5368 |
+
for ( var name in options ) {
|
5369 |
+
old[ name ] = elem.style[ name ];
|
5370 |
+
elem.style[ name ] = options[ name ];
|
5371 |
+
}
|
5372 |
+
|
5373 |
+
callback.call( elem );
|
5374 |
+
|
5375 |
+
// Revert the old values
|
5376 |
+
for ( name in options ) {
|
5377 |
+
elem.style[ name ] = old[ name ];
|
5378 |
+
}
|
5379 |
+
},
|
5380 |
+
|
5381 |
+
camelCase: function( string ) {
|
5382 |
+
return string.replace( rdashAlpha, fcamelCase );
|
5383 |
+
}
|
5384 |
+
});
|
5385 |
+
|
5386 |
+
// DEPRECATED, Use jQuery.css() instead
|
5387 |
+
jQuery.curCSS = jQuery.css;
|
5388 |
+
|
5389 |
+
jQuery.each(["height", "width"], function( i, name ) {
|
5390 |
+
jQuery.cssHooks[ name ] = {
|
5391 |
+
get: function( elem, computed, extra ) {
|
5392 |
+
var val;
|
5393 |
+
|
5394 |
+
if ( computed ) {
|
5395 |
+
if ( elem.offsetWidth !== 0 ) {
|
5396 |
+
val = getWH( elem, name, extra );
|
5397 |
+
|
5398 |
+
} else {
|
5399 |
+
jQuery.swap( elem, cssShow, function() {
|
5400 |
+
val = getWH( elem, name, extra );
|
5401 |
+
});
|
5402 |
+
}
|
5403 |
+
|
5404 |
+
if ( val <= 0 ) {
|
5405 |
+
val = curCSS( elem, name, name );
|
5406 |
+
|
5407 |
+
if ( val === "0px" && currentStyle ) {
|
5408 |
+
val = currentStyle( elem, name, name );
|
5409 |
+
}
|
5410 |
+
|
5411 |
+
if ( val != null ) {
|
5412 |
+
// Should return "auto" instead of 0, use 0 for
|
5413 |
+
// temporary backwards-compat
|
5414 |
+
return val === "" || val === "auto" ? "0px" : val;
|
5415 |
+
}
|
5416 |
+
}
|
5417 |
+
|
5418 |
+
if ( val < 0 || val == null ) {
|
5419 |
+
val = elem.style[ name ];
|
5420 |
+
|
5421 |
+
// Should return "auto" instead of 0, use 0 for
|
5422 |
+
// temporary backwards-compat
|
5423 |
+
return val === "" || val === "auto" ? "0px" : val;
|
5424 |
+
}
|
5425 |
+
|
5426 |
+
return typeof val === "string" ? val : val + "px";
|
5427 |
+
}
|
5428 |
+
},
|
5429 |
+
|
5430 |
+
set: function( elem, value ) {
|
5431 |
+
if ( rnumpx.test( value ) ) {
|
5432 |
+
// ignore negative width and height values #1599
|
5433 |
+
value = parseFloat(value);
|
5434 |
+
|
5435 |
+
if ( value >= 0 ) {
|
5436 |
+
return value + "px";
|
5437 |
+
}
|
5438 |
+
|
5439 |
+
} else {
|
5440 |
+
return value;
|
5441 |
+
}
|
5442 |
+
}
|
5443 |
+
};
|
5444 |
+
});
|
5445 |
+
|
5446 |
+
if ( !jQuery.support.opacity ) {
|
5447 |
+
jQuery.cssHooks.opacity = {
|
5448 |
+
get: function( elem, computed ) {
|
5449 |
+
// IE uses filters for opacity
|
5450 |
+
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
|
5451 |
+
(parseFloat(RegExp.$1) / 100) + "" :
|
5452 |
+
computed ? "1" : "";
|
5453 |
+
},
|
5454 |
+
|
5455 |
+
set: function( elem, value ) {
|
5456 |
+
var style = elem.style;
|
5457 |
+
|
5458 |
+
// IE has trouble with opacity if it does not have layout
|
5459 |
+
// Force it by setting the zoom level
|
5460 |
+
style.zoom = 1;
|
5461 |
+
|
5462 |
+
// Set the alpha filter to set the opacity
|
5463 |
+
var opacity = jQuery.isNaN(value) ?
|
5464 |
+
"" :
|
5465 |
+
"alpha(opacity=" + value * 100 + ")",
|
5466 |
+
filter = style.filter || "";
|
5467 |
+
|
5468 |
+
style.filter = ralpha.test(filter) ?
|
5469 |
+
filter.replace(ralpha, opacity) :
|
5470 |
+
style.filter + ' ' + opacity;
|
5471 |
+
}
|
5472 |
+
};
|
5473 |
+
}
|
5474 |
+
|
5475 |
+
if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
5476 |
+
getComputedStyle = function( elem, newName, name ) {
|
5477 |
+
var ret, defaultView, computedStyle;
|
5478 |
+
|
5479 |
+
name = name.replace( rupper, "-$1" ).toLowerCase();
|
5480 |
+
|
5481 |
+
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
|
5482 |
+
return undefined;
|
5483 |
+
}
|
5484 |
+
|
5485 |
+
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
|
5486 |
+
ret = computedStyle.getPropertyValue( name );
|
5487 |
+
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
|
5488 |
+
ret = jQuery.style( elem, name );
|
5489 |
+
}
|
5490 |
+
}
|
5491 |
+
|
5492 |
+
return ret;
|
5493 |
+
};
|
5494 |
+
}
|
5495 |
+
|
5496 |
+
if ( document.documentElement.currentStyle ) {
|
5497 |
+
currentStyle = function( elem, name ) {
|
5498 |
+
var left, rsLeft,
|
5499 |
+
ret = elem.currentStyle && elem.currentStyle[ name ],
|
5500 |
+
style = elem.style;
|
5501 |
+
|
5502 |
+
// From the awesome hack by Dean Edwards
|
5503 |
+
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
5504 |
+
|
5505 |
+
// If we're not dealing with a regular pixel number
|
5506 |
+
// but a number that has a weird ending, we need to convert it to pixels
|
5507 |
+
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
|
5508 |
+
// Remember the original values
|
5509 |
+
left = style.left;
|
5510 |
+
rsLeft = elem.runtimeStyle.left;
|
5511 |
+
|
5512 |
+
// Put in the new values to get a computed value out
|
5513 |
+
elem.runtimeStyle.left = elem.currentStyle.left;
|
5514 |
+
style.left = name === "fontSize" ? "1em" : (ret || 0);
|
5515 |
+
ret = style.pixelLeft + "px";
|
5516 |
+
|
5517 |
+
// Revert the changed values
|
5518 |
+
style.left = left;
|
5519 |
+
elem.runtimeStyle.left = rsLeft;
|
5520 |
+
}
|
5521 |
+
|
5522 |
+
return ret === "" ? "auto" : ret;
|
5523 |
+
};
|
5524 |
+
}
|
5525 |
+
|
5526 |
+
curCSS = getComputedStyle || currentStyle;
|
5527 |
+
|
5528 |
+
function getWH( elem, name, extra ) {
|
5529 |
+
var which = name === "width" ? cssWidth : cssHeight,
|
5530 |
+
val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
|
5531 |
+
|
5532 |
+
if ( extra === "border" ) {
|
5533 |
+
return val;
|
5534 |
+
}
|
5535 |
+
|
5536 |
+
jQuery.each( which, function() {
|
5537 |
+
if ( !extra ) {
|
5538 |
+
val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
|
5539 |
+
}
|
5540 |
+
|
5541 |
+
if ( extra === "margin" ) {
|
5542 |
+
val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
|
5543 |
+
|
5544 |
+
} else {
|
5545 |
+
val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
|
5546 |
+
}
|
5547 |
+
});
|
5548 |
+
|
5549 |
+
return val;
|
5550 |
+
}
|
5551 |
+
|
5552 |
+
if ( jQuery.expr && jQuery.expr.filters ) {
|
5553 |
+
jQuery.expr.filters.hidden = function( elem ) {
|
5554 |
+
var width = elem.offsetWidth,
|
5555 |
+
height = elem.offsetHeight;
|
5556 |
+
|
5557 |
+
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
|
5558 |
+
};
|
5559 |
+
|
5560 |
+
jQuery.expr.filters.visible = function( elem ) {
|
5561 |
+
return !jQuery.expr.filters.hidden( elem );
|
5562 |
+
};
|
5563 |
+
}
|
5564 |
+
|
5565 |
+
|
5566 |
+
|
5567 |
+
|
5568 |
+
var jsc = jQuery.now(),
|
5569 |
+
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
5570 |
+
rselectTextarea = /^(?:select|textarea)/i,
|
5571 |
+
rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
|
5572 |
+
rnoContent = /^(?:GET|HEAD)$/,
|
5573 |
+
rbracket = /\[\]$/,
|
5574 |
+
jsre = /\=\?(&|$)/,
|
5575 |
+
rquery = /\?/,
|
5576 |
+
rts = /([?&])_=[^&]*/,
|
5577 |
+
rurl = /^(\w+:)?\/\/([^\/?#]+)/,
|
5578 |
+
r20 = /%20/g,
|
5579 |
+
rhash = /#.*$/,
|
5580 |
+
|
5581 |
+
// Keep a copy of the old load method
|
5582 |
+
_load = jQuery.fn.load;
|
5583 |
+
|
5584 |
+
jQuery.fn.extend({
|
5585 |
+
load: function( url, params, callback ) {
|
5586 |
+
if ( typeof url !== "string" && _load ) {
|
5587 |
+
return _load.apply( this, arguments );
|
5588 |
+
|
5589 |
+
// Don't do a request if no elements are being requested
|
5590 |
+
} else if ( !this.length ) {
|
5591 |
+
return this;
|
5592 |
+
}
|
5593 |
+
|
5594 |
+
var off = url.indexOf(" ");
|
5595 |
+
if ( off >= 0 ) {
|
5596 |
+
var selector = url.slice(off, url.length);
|
5597 |
+
url = url.slice(0, off);
|
5598 |
+
}
|
5599 |
+
|
5600 |
+
// Default to a GET request
|
5601 |
+
var type = "GET";
|
5602 |
+
|
5603 |
+
// If the second parameter was provided
|
5604 |
+
if ( params ) {
|
5605 |
+
// If it's a function
|
5606 |
+
if ( jQuery.isFunction( params ) ) {
|
5607 |
+
// We assume that it's the callback
|
5608 |
+
callback = params;
|
5609 |
+
params = null;
|
5610 |
+
|
5611 |
+
// Otherwise, build a param string
|
5612 |
+
} else if ( typeof params === "object" ) {
|
5613 |
+
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
|
5614 |
+
type = "POST";
|
5615 |
+
}
|
5616 |
+
}
|
5617 |
+
|
5618 |
+
var self = this;
|
5619 |
+
|
5620 |
+
// Request the remote document
|
5621 |
+
jQuery.ajax({
|
5622 |
+
url: url,
|
5623 |
+
type: type,
|
5624 |
+
dataType: "html",
|
5625 |
+
data: params,
|
5626 |
+
complete: function( res, status ) {
|
5627 |
+
// If successful, inject the HTML into all the matched elements
|
5628 |
+
if ( status === "success" || status === "notmodified" ) {
|
5629 |
+
// See if a selector was specified
|
5630 |
+
self.html( selector ?
|
5631 |
+
// Create a dummy div to hold the results
|
5632 |
+
jQuery("<div>")
|
5633 |
+
// inject the contents of the document in, removing the scripts
|
5634 |
+
// to avoid any 'Permission Denied' errors in IE
|
5635 |
+
.append(res.responseText.replace(rscript, ""))
|
5636 |
+
|
5637 |
+
// Locate the specified elements
|
5638 |
+
.find(selector) :
|
5639 |
+
|
5640 |
+
// If not, just inject the full result
|
5641 |
+
res.responseText );
|
5642 |
+
}
|
5643 |
+
|
5644 |
+
if ( callback ) {
|
5645 |
+
self.each( callback, [res.responseText, status, res] );
|
5646 |
+
}
|
5647 |
+
}
|
5648 |
+
});
|
5649 |
+
|
5650 |
+
return this;
|
5651 |
+
},
|
5652 |
+
|
5653 |
+
serialize: function() {
|
5654 |
+
return jQuery.param(this.serializeArray());
|
5655 |
+
},
|
5656 |
+
|
5657 |
+
serializeArray: function() {
|
5658 |
+
return this.map(function() {
|
5659 |
+
return this.elements ? jQuery.makeArray(this.elements) : this;
|
5660 |
+
})
|
5661 |
+
.filter(function() {
|
5662 |
+
return this.name && !this.disabled &&
|
5663 |
+
(this.checked || rselectTextarea.test(this.nodeName) ||
|
5664 |
+
rinput.test(this.type));
|
5665 |
+
})
|
5666 |
+
.map(function( i, elem ) {
|
5667 |
+
var val = jQuery(this).val();
|
5668 |
+
|
5669 |
+
return val == null ?
|
5670 |
+
null :
|
5671 |
+
jQuery.isArray(val) ?
|
5672 |
+
jQuery.map( val, function( val, i ) {
|
5673 |
+
return { name: elem.name, value: val };
|
5674 |
+
}) :
|
5675 |
+
{ name: elem.name, value: val };
|
5676 |
+
}).get();
|
5677 |
+
}
|
5678 |
+
});
|
5679 |
+
|
5680 |
+
// Attach a bunch of functions for handling common AJAX events
|
5681 |
+
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
|
5682 |
+
jQuery.fn[o] = function( f ) {
|
5683 |
+
return this.bind(o, f);
|
5684 |
+
};
|
5685 |
+
});
|
5686 |
+
|
5687 |
+
jQuery.extend({
|
5688 |
+
get: function( url, data, callback, type ) {
|
5689 |
+
// shift arguments if data argument was omited
|
5690 |
+
if ( jQuery.isFunction( data ) ) {
|
5691 |
+
type = type || callback;
|
5692 |
+
callback = data;
|
5693 |
+
data = null;
|
5694 |
+
}
|
5695 |
+
|
5696 |
+
return jQuery.ajax({
|
5697 |
+
type: "GET",
|
5698 |
+
url: url,
|
5699 |
+
data: data,
|
5700 |
+
success: callback,
|
5701 |
+
dataType: type
|
5702 |
+
});
|
5703 |
+
},
|
5704 |
+
|
5705 |
+
getScript: function( url, callback ) {
|
5706 |
+
return jQuery.get(url, null, callback, "script");
|
5707 |
+
},
|
5708 |
+
|
5709 |
+
getJSON: function( url, data, callback ) {
|
5710 |
+
return jQuery.get(url, data, callback, "json");
|
5711 |
+
},
|
5712 |
+
|
5713 |
+
post: function( url, data, callback, type ) {
|
5714 |
+
// shift arguments if data argument was omited
|
5715 |
+
if ( jQuery.isFunction( data ) ) {
|
5716 |
+
type = type || callback;
|
5717 |
+
callback = data;
|
5718 |
+
data = {};
|
5719 |
+
}
|
5720 |
+
|
5721 |
+
return jQuery.ajax({
|
5722 |
+
type: "POST",
|
5723 |
+
url: url,
|
5724 |
+
data: data,
|
5725 |
+
success: callback,
|
5726 |
+
dataType: type
|
5727 |
+
});
|
5728 |
+
},
|
5729 |
+
|
5730 |
+
ajaxSetup: function( settings ) {
|
5731 |
+
jQuery.extend( jQuery.ajaxSettings, settings );
|
5732 |
+
},
|
5733 |
+
|
5734 |
+
ajaxSettings: {
|
5735 |
+
url: location.href,
|
5736 |
+
global: true,
|
5737 |
+
type: "GET",
|
5738 |
+
contentType: "application/x-www-form-urlencoded",
|
5739 |
+
processData: true,
|
5740 |
+
async: true,
|
5741 |
+
/*
|
5742 |
+
timeout: 0,
|
5743 |
+
data: null,
|
5744 |
+
username: null,
|
5745 |
+
password: null,
|
5746 |
+
traditional: false,
|
5747 |
+
*/
|
5748 |
+
// This function can be overriden by calling jQuery.ajaxSetup
|
5749 |
+
xhr: function() {
|
5750 |
+
return new window.XMLHttpRequest();
|
5751 |
+
},
|
5752 |
+
accepts: {
|
5753 |
+
xml: "application/xml, text/xml",
|
5754 |
+
html: "text/html",
|
5755 |
+
script: "text/javascript, application/javascript",
|
5756 |
+
json: "application/json, text/javascript",
|
5757 |
+
text: "text/plain",
|
5758 |
+
_default: "*/*"
|
5759 |
+
}
|
5760 |
+
},
|
5761 |
+
|
5762 |
+
ajax: function( origSettings ) {
|
5763 |
+
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
|
5764 |
+
jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
|
5765 |
+
|
5766 |
+
s.url = s.url.replace( rhash, "" );
|
5767 |
+
|
5768 |
+
// Use original (not extended) context object if it was provided
|
5769 |
+
s.context = origSettings && origSettings.context != null ? origSettings.context : s;
|
5770 |
+
|
5771 |
+
// convert data if not already a string
|
5772 |
+
if ( s.data && s.processData && typeof s.data !== "string" ) {
|
5773 |
+
s.data = jQuery.param( s.data, s.traditional );
|
5774 |
+
}
|
5775 |
+
|
5776 |
+
// Handle JSONP Parameter Callbacks
|
5777 |
+
if ( s.dataType === "jsonp" ) {
|
5778 |
+
if ( type === "GET" ) {
|
5779 |
+
if ( !jsre.test( s.url ) ) {
|
5780 |
+
s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
|
5781 |
+
}
|
5782 |
+
} else if ( !s.data || !jsre.test(s.data) ) {
|
5783 |
+
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
|
5784 |
+
}
|
5785 |
+
s.dataType = "json";
|
5786 |
+
}
|
5787 |
+
|
5788 |
+
// Build temporary JSONP function
|
5789 |
+
if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
|
5790 |
+
jsonp = s.jsonpCallback || ("jsonp" + jsc++);
|
5791 |
+
|
5792 |
+
// Replace the =? sequence both in the query string and the data
|
5793 |
+
if ( s.data ) {
|
5794 |
+
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
|
5795 |
+
}
|
5796 |
+
|
5797 |
+
s.url = s.url.replace(jsre, "=" + jsonp + "$1");
|
5798 |
+
|
5799 |
+
// We need to make sure
|
5800 |
+
// that a JSONP style response is executed properly
|
5801 |
+
s.dataType = "script";
|
5802 |
+
|
5803 |
+
// Handle JSONP-style loading
|
5804 |
+
var customJsonp = window[ jsonp ];
|
5805 |
+
|
5806 |
+
window[ jsonp ] = function( tmp ) {
|
5807 |
+
if ( jQuery.isFunction( customJsonp ) ) {
|
5808 |
+
customJsonp( tmp );
|
5809 |
+
|
5810 |
+
} else {
|
5811 |
+
// Garbage collect
|
5812 |
+
window[ jsonp ] = undefined;
|
5813 |
+
|
5814 |
+
try {
|
5815 |
+
delete window[ jsonp ];
|
5816 |
+
} catch( jsonpError ) {}
|
5817 |
+
}
|
5818 |
+
|
5819 |
+
data = tmp;
|
5820 |
+
jQuery.handleSuccess( s, xhr, status, data );
|
5821 |
+
jQuery.handleComplete( s, xhr, status, data );
|
5822 |
+
|
5823 |
+
if ( head ) {
|
5824 |
+
head.removeChild( script );
|
5825 |
+
}
|
5826 |
+
};
|
5827 |
+
}
|
5828 |
+
|
5829 |
+
if ( s.dataType === "script" && s.cache === null ) {
|
5830 |
+
s.cache = false;
|
5831 |
+
}
|
5832 |
+
|
5833 |
+
if ( s.cache === false && noContent ) {
|
5834 |
+
var ts = jQuery.now();
|
5835 |
+
|
5836 |
+
// try replacing _= if it is there
|
5837 |
+
var ret = s.url.replace(rts, "$1_=" + ts);
|
5838 |
+
|
5839 |
+
// if nothing was replaced, add timestamp to the end
|
5840 |
+
s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
|
5841 |
+
}
|
5842 |
+
|
5843 |
+
// If data is available, append data to url for GET/HEAD requests
|
5844 |
+
if ( s.data && noContent ) {
|
5845 |
+
s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
|
5846 |
+
}
|
5847 |
+
|
5848 |
+
// Watch for a new set of requests
|
5849 |
+
if ( s.global && jQuery.active++ === 0 ) {
|
5850 |
+
jQuery.event.trigger( "ajaxStart" );
|
5851 |
+
}
|
5852 |
+
|
5853 |
+
// Matches an absolute URL, and saves the domain
|
5854 |
+
var parts = rurl.exec( s.url ),
|
5855 |
+
remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
|
5856 |
+
|
5857 |
+
// If we're requesting a remote document
|
5858 |
+
// and trying to load JSON or Script with a GET
|
5859 |
+
if ( s.dataType === "script" && type === "GET" && remote ) {
|
5860 |
+
var head = document.getElementsByTagName("head")[0] || document.documentElement;
|
5861 |
+
var script = document.createElement("script");
|
5862 |
+
if ( s.scriptCharset ) {
|
5863 |
+
script.charset = s.scriptCharset;
|
5864 |
+
}
|
5865 |
+
script.src = s.url;
|
5866 |
+
|
5867 |
+
// Handle Script loading
|
5868 |
+
if ( !jsonp ) {
|
5869 |
+
var done = false;
|
5870 |
+
|
5871 |
+
// Attach handlers for all browsers
|
5872 |
+
script.onload = script.onreadystatechange = function() {
|
5873 |
+
if ( !done && (!this.readyState ||
|
5874 |
+
this.readyState === "loaded" || this.readyState === "complete") ) {
|
5875 |
+
done = true;
|
5876 |
+
jQuery.handleSuccess( s, xhr, status, data );
|
5877 |
+
jQuery.handleComplete( s, xhr, status, data );
|
5878 |
+
|
5879 |
+
// Handle memory leak in IE
|
5880 |
+
script.onload = script.onreadystatechange = null;
|
5881 |
+
if ( head && script.parentNode ) {
|
5882 |
+
head.removeChild( script );
|
5883 |
+
}
|
5884 |
+
}
|
5885 |
+
};
|
5886 |
+
}
|
5887 |
+
|
5888 |
+
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
5889 |
+
// This arises when a base node is used (#2709 and #4378).
|
5890 |
+
head.insertBefore( script, head.firstChild );
|
5891 |
+
|
5892 |
+
// We handle everything using the script element injection
|
5893 |
+
return undefined;
|
5894 |
+
}
|
5895 |
+
|
5896 |
+
var requestDone = false;
|
5897 |
+
|
5898 |
+
// Create the request object
|
5899 |
+
var xhr = s.xhr();
|
5900 |
+
|
5901 |
+
if ( !xhr ) {
|
5902 |
+
return;
|
5903 |
+
}
|
5904 |
+
|
5905 |
+
// Open the socket
|
5906 |
+
// Passing null username, generates a login popup on Opera (#2865)
|
5907 |
+
if ( s.username ) {
|
5908 |
+
xhr.open(type, s.url, s.async, s.username, s.password);
|
5909 |
+
} else {
|
5910 |
+
xhr.open(type, s.url, s.async);
|
5911 |
+
}
|
5912 |
+
|
5913 |
+
// Need an extra try/catch for cross domain requests in Firefox 3
|
5914 |
+
try {
|
5915 |
+
// Set content-type if data specified and content-body is valid for this type
|
5916 |
+
if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
|
5917 |
+
xhr.setRequestHeader("Content-Type", s.contentType);
|
5918 |
+
}
|
5919 |
+
|
5920 |
+
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
5921 |
+
if ( s.ifModified ) {
|
5922 |
+
if ( jQuery.lastModified[s.url] ) {
|
5923 |
+
xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
|
5924 |
+
}
|
5925 |
+
|
5926 |
+
if ( jQuery.etag[s.url] ) {
|
5927 |
+
xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
|
5928 |
+
}
|
5929 |
+
}
|
5930 |
+
|
5931 |
+
// Set header so the called script knows that it's an XMLHttpRequest
|
5932 |
+
// Only send the header if it's not a remote XHR
|
5933 |
+
if ( !remote ) {
|
5934 |
+
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
5935 |
+
}
|
5936 |
+
|
5937 |
+
// Set the Accepts header for the server, depending on the dataType
|
5938 |
+
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
|
5939 |
+
s.accepts[ s.dataType ] + ", */*; q=0.01" :
|
5940 |
+
s.accepts._default );
|
5941 |
+
} catch( headerError ) {}
|
5942 |
+
|
5943 |
+
// Allow custom headers/mimetypes and early abort
|
5944 |
+
if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
|
5945 |
+
// Handle the global AJAX counter
|
5946 |
+
if ( s.global && jQuery.active-- === 1 ) {
|
5947 |
+
jQuery.event.trigger( "ajaxStop" );
|
5948 |
+
}
|
5949 |
+
|
5950 |
+
// close opended socket
|
5951 |
+
xhr.abort();
|
5952 |
+
return false;
|
5953 |
+
}
|
5954 |
+
|
5955 |
+
if ( s.global ) {
|
5956 |
+
jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
|
5957 |
+
}
|
5958 |
+
|
5959 |
+
// Wait for a response to come back
|
5960 |
+
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
|
5961 |
+
// The request was aborted
|
5962 |
+
if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
|
5963 |
+
// Opera doesn't call onreadystatechange before this point
|
5964 |
+
// so we simulate the call
|
5965 |
+
if ( !requestDone ) {
|
5966 |
+
jQuery.handleComplete( s, xhr, status, data );
|
5967 |
+
}
|
5968 |
+
|
5969 |
+
requestDone = true;
|
5970 |
+
if ( xhr ) {
|
5971 |
+
xhr.onreadystatechange = jQuery.noop;
|
5972 |
+
}
|
5973 |
+
|
5974 |
+
// The transfer is complete and the data is available, or the request timed out
|
5975 |
+
} else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
|
5976 |
+
requestDone = true;
|
5977 |
+
xhr.onreadystatechange = jQuery.noop;
|
5978 |
+
|
5979 |
+
status = isTimeout === "timeout" ?
|
5980 |
+
"timeout" :
|
5981 |
+
!jQuery.httpSuccess( xhr ) ?
|
5982 |
+
"error" :
|
5983 |
+
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
|
5984 |
+
"notmodified" :
|
5985 |
+
"success";
|
5986 |
+
|
5987 |
+
var errMsg;
|
5988 |
+
|
5989 |
+
if ( status === "success" ) {
|
5990 |
+
// Watch for, and catch, XML document parse errors
|
5991 |
+
try {
|
5992 |
+
// process the data (runs the xml through httpData regardless of callback)
|
5993 |
+
data = jQuery.httpData( xhr, s.dataType, s );
|
5994 |
+
} catch( parserError ) {
|
5995 |
+
status = "parsererror";
|
5996 |
+
errMsg = parserError;
|
5997 |
+
}
|
5998 |
+
}
|
5999 |
+
|
6000 |
+
// Make sure that the request was successful or notmodified
|
6001 |
+
if ( status === "success" || status === "notmodified" ) {
|
6002 |
+
// JSONP handles its own success callback
|
6003 |
+
if ( !jsonp ) {
|
6004 |
+
jQuery.handleSuccess( s, xhr, status, data );
|
6005 |
+
}
|
6006 |
+
} else {
|
6007 |
+
jQuery.handleError( s, xhr, status, errMsg );
|
6008 |
+
}
|
6009 |
+
|
6010 |
+
// Fire the complete handlers
|
6011 |
+
if ( !jsonp ) {
|
6012 |
+
jQuery.handleComplete( s, xhr, status, data );
|
6013 |
+
}
|
6014 |
+
|
6015 |
+
if ( isTimeout === "timeout" ) {
|
6016 |
+
xhr.abort();
|
6017 |
+
}
|
6018 |
+
|
6019 |
+
// Stop memory leaks
|
6020 |
+
if ( s.async ) {
|
6021 |
+
xhr = null;
|
6022 |
+
}
|
6023 |
+
}
|
6024 |
+
};
|
6025 |
+
|
6026 |
+
// Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
|
6027 |
+
// Opera doesn't fire onreadystatechange at all on abort
|
6028 |
+
try {
|
6029 |
+
var oldAbort = xhr.abort;
|
6030 |
+
xhr.abort = function() {
|
6031 |
+
if ( xhr ) {
|
6032 |
+
// oldAbort has no call property in IE7 so
|
6033 |
+
// just do it this way, which works in all
|
6034 |
+
// browsers
|
6035 |
+
Function.prototype.call.call( oldAbort, xhr );
|
6036 |
+
}
|
6037 |
+
|
6038 |
+
onreadystatechange( "abort" );
|
6039 |
+
};
|
6040 |
+
} catch( abortError ) {}
|
6041 |
+
|
6042 |
+
// Timeout checker
|
6043 |
+
if ( s.async && s.timeout > 0 ) {
|
6044 |
+
setTimeout(function() {
|
6045 |
+
// Check to see if the request is still happening
|
6046 |
+
if ( xhr && !requestDone ) {
|
6047 |
+
onreadystatechange( "timeout" );
|
6048 |
+
}
|
6049 |
+
}, s.timeout);
|
6050 |
+
}
|
6051 |
+
|
6052 |
+
// Send the data
|
6053 |
+
try {
|
6054 |
+
xhr.send( noContent || s.data == null ? null : s.data );
|
6055 |
+
|
6056 |
+
} catch( sendError ) {
|
6057 |
+
jQuery.handleError( s, xhr, null, sendError );
|
6058 |
+
|
6059 |
+
// Fire the complete handlers
|
6060 |
+
jQuery.handleComplete( s, xhr, status, data );
|
6061 |
+
}
|
6062 |
+
|
6063 |
+
// firefox 1.5 doesn't fire statechange for sync requests
|
6064 |
+
if ( !s.async ) {
|
6065 |
+
onreadystatechange();
|
6066 |
+
}
|
6067 |
+
|
6068 |
+
// return XMLHttpRequest to allow aborting the request etc.
|
6069 |
+
return xhr;
|
6070 |
+
},
|
6071 |
+
|
6072 |
+
// Serialize an array of form elements or a set of
|
6073 |
+
// key/values into a query string
|
6074 |
+
param: function( a, traditional ) {
|
6075 |
+
var s = [],
|
6076 |
+
add = function( key, value ) {
|
6077 |
+
// If value is a function, invoke it and return its value
|
6078 |
+
value = jQuery.isFunction(value) ? value() : value;
|
6079 |
+
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
6080 |
+
};
|
6081 |
+
|
6082 |
+
// Set traditional to true for jQuery <= 1.3.2 behavior.
|
6083 |
+
if ( traditional === undefined ) {
|
6084 |
+
traditional = jQuery.ajaxSettings.traditional;
|
6085 |
+
}
|
6086 |
+
|
6087 |
+
// If an array was passed in, assume that it is an array of form elements.
|
6088 |
+
if ( jQuery.isArray(a) || a.jquery ) {
|
6089 |
+
// Serialize the form elements
|
6090 |
+
jQuery.each( a, function() {
|
6091 |
+
add( this.name, this.value );
|
6092 |
+
});
|
6093 |
+
|
6094 |
+
} else {
|
6095 |
+
// If traditional, encode the "old" way (the way 1.3.2 or older
|
6096 |
+
// did it), otherwise encode params recursively.
|
6097 |
+
for ( var prefix in a ) {
|
6098 |
+
buildParams( prefix, a[prefix], traditional, add );
|
6099 |
+
}
|
6100 |
+
}
|
6101 |
+
|
6102 |
+
// Return the resulting serialization
|
6103 |
+
return s.join("&").replace(r20, "+");
|
6104 |
+
}
|
6105 |
+
});
|
6106 |
+
|
6107 |
+
function buildParams( prefix, obj, traditional, add ) {
|
6108 |
+
if ( jQuery.isArray(obj) && obj.length ) {
|
6109 |
+
// Serialize array item.
|
6110 |
+
jQuery.each( obj, function( i, v ) {
|
6111 |
+
if ( traditional || rbracket.test( prefix ) ) {
|
6112 |
+
// Treat each array item as a scalar.
|
6113 |
+
add( prefix, v );
|
6114 |
+
|
6115 |
+
} else {
|
6116 |
+
// If array item is non-scalar (array or object), encode its
|
6117 |
+
// numeric index to resolve deserialization ambiguity issues.
|
6118 |
+
// Note that rack (as of 1.0.0) can't currently deserialize
|
6119 |
+
// nested arrays properly, and attempting to do so may cause
|
6120 |
+
// a server error. Possible fixes are to modify rack's
|
6121 |
+
// deserialization algorithm or to provide an option or flag
|
6122 |
+
// to force array serialization to be shallow.
|
6123 |
+
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
|
6124 |
+
}
|
6125 |
+
});
|
6126 |
+
|
6127 |
+
} else if ( !traditional && obj != null && typeof obj === "object" ) {
|
6128 |
+
if ( jQuery.isEmptyObject( obj ) ) {
|
6129 |
+
add( prefix, "" );
|
6130 |
+
|
6131 |
+
// Serialize object item.
|
6132 |
+
} else {
|
6133 |
+
jQuery.each( obj, function( k, v ) {
|
6134 |
+
buildParams( prefix + "[" + k + "]", v, traditional, add );
|
6135 |
+
});
|
6136 |
+
}
|
6137 |
+
|
6138 |
+
} else {
|
6139 |
+
// Serialize scalar item.
|
6140 |
+
add( prefix, obj );
|
6141 |
+
}
|
6142 |
+
}
|
6143 |
+
|
6144 |
+
// This is still on the jQuery object... for now
|
6145 |
+
// Want to move this to jQuery.ajax some day
|
6146 |
+
jQuery.extend({
|
6147 |
+
|
6148 |
+
// Counter for holding the number of active queries
|
6149 |
+
active: 0,
|
6150 |
+
|
6151 |
+
// Last-Modified header cache for next request
|
6152 |
+
lastModified: {},
|
6153 |
+
etag: {},
|
6154 |
+
|
6155 |
+
handleError: function( s, xhr, status, e ) {
|
6156 |
+
// If a local callback was specified, fire it
|
6157 |
+
if ( s.error ) {
|
6158 |
+
s.error.call( s.context, xhr, status, e );
|
6159 |
+
}
|
6160 |
+
|
6161 |
+
// Fire the global callback
|
6162 |
+
if ( s.global ) {
|
6163 |
+
jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
|
6164 |
+
}
|
6165 |
+
},
|
6166 |
+
|
6167 |
+
handleSuccess: function( s, xhr, status, data ) {
|
6168 |
+
// If a local callback was specified, fire it and pass it the data
|
6169 |
+
if ( s.success ) {
|
6170 |
+
s.success.call( s.context, data, status, xhr );
|
6171 |
+
}
|
6172 |
+
|
6173 |
+
// Fire the global callback
|
6174 |
+
if ( s.global ) {
|
6175 |
+
jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
|
6176 |
+
}
|
6177 |
+
},
|
6178 |
+
|
6179 |
+
handleComplete: function( s, xhr, status ) {
|
6180 |
+
// Process result
|
6181 |
+
if ( s.complete ) {
|
6182 |
+
s.complete.call( s.context, xhr, status );
|
6183 |
+
}
|
6184 |
+
|
6185 |
+
// The request was completed
|
6186 |
+
if ( s.global ) {
|
6187 |
+
jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
|
6188 |
+
}
|
6189 |
+
|
6190 |
+
// Handle the global AJAX counter
|
6191 |
+
if ( s.global && jQuery.active-- === 1 ) {
|
6192 |
+
jQuery.event.trigger( "ajaxStop" );
|
6193 |
+
}
|
6194 |
+
},
|
6195 |
+
|
6196 |
+
triggerGlobal: function( s, type, args ) {
|
6197 |
+
(s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
|
6198 |
+
},
|
6199 |
+
|
6200 |
+
// Determines if an XMLHttpRequest was successful or not
|
6201 |
+
httpSuccess: function( xhr ) {
|
6202 |
+
try {
|
6203 |
+
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
|
6204 |
+
return !xhr.status && location.protocol === "file:" ||
|
6205 |
+
xhr.status >= 200 && xhr.status < 300 ||
|
6206 |
+
xhr.status === 304 || xhr.status === 1223;
|
6207 |
+
} catch(e) {}
|
6208 |
+
|
6209 |
+
return false;
|
6210 |
+
},
|
6211 |
+
|
6212 |
+
// Determines if an XMLHttpRequest returns NotModified
|
6213 |
+
httpNotModified: function( xhr, url ) {
|
6214 |
+
var lastModified = xhr.getResponseHeader("Last-Modified"),
|
6215 |
+
etag = xhr.getResponseHeader("Etag");
|
6216 |
+
|
6217 |
+
if ( lastModified ) {
|
6218 |
+
jQuery.lastModified[url] = lastModified;
|
6219 |
+
}
|
6220 |
+
|
6221 |
+
if ( etag ) {
|
6222 |
+
jQuery.etag[url] = etag;
|
6223 |
+
}
|
6224 |
+
|
6225 |
+
return xhr.status === 304;
|
6226 |
+
},
|
6227 |
+
|
6228 |
+
httpData: function( xhr, type, s ) {
|
6229 |
+
var ct = xhr.getResponseHeader("content-type") || "",
|
6230 |
+
xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
|
6231 |
+
data = xml ? xhr.responseXML : xhr.responseText;
|
6232 |
+
|
6233 |
+
if ( xml && data.documentElement.nodeName === "parsererror" ) {
|
6234 |
+
jQuery.error( "parsererror" );
|
6235 |
+
}
|
6236 |
+
|
6237 |
+
// Allow a pre-filtering function to sanitize the response
|
6238 |
+
// s is checked to keep backwards compatibility
|
6239 |
+
if ( s && s.dataFilter ) {
|
6240 |
+
data = s.dataFilter( data, type );
|
6241 |
+
}
|
6242 |
+
|
6243 |
+
// The filter can actually parse the response
|
6244 |
+
if ( typeof data === "string" ) {
|
6245 |
+
// Get the JavaScript object, if JSON is used.
|
6246 |
+
if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
|
6247 |
+
data = jQuery.parseJSON( data );
|
6248 |
+
|
6249 |
+
// If the type is "script", eval it in global context
|
6250 |
+
} else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
|
6251 |
+
jQuery.globalEval( data );
|
6252 |
+
}
|
6253 |
+
}
|
6254 |
+
|
6255 |
+
return data;
|
6256 |
+
}
|
6257 |
+
|
6258 |
+
});
|
6259 |
+
|
6260 |
+
/*
|
6261 |
+
* Create the request object; Microsoft failed to properly
|
6262 |
+
* implement the XMLHttpRequest in IE7 (can't request local files),
|
6263 |
+
* so we use the ActiveXObject when it is available
|
6264 |
+
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
|
6265 |
+
* we need a fallback.
|
6266 |
+
*/
|
6267 |
+
if ( window.ActiveXObject ) {
|
6268 |
+
jQuery.ajaxSettings.xhr = function() {
|
6269 |
+
if ( window.location.protocol !== "file:" ) {
|
6270 |
+
try {
|
6271 |
+
return new window.XMLHttpRequest();
|
6272 |
+
} catch(xhrError) {}
|
6273 |
+
}
|
6274 |
+
|
6275 |
+
try {
|
6276 |
+
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
6277 |
+
} catch(activeError) {}
|
6278 |
+
};
|
6279 |
+
}
|
6280 |
+
|
6281 |
+
// Does this browser support XHR requests?
|
6282 |
+
jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
|
6283 |
+
|
6284 |
+
|
6285 |
+
|
6286 |
+
|
6287 |
+
var elemdisplay = {},
|
6288 |
+
rfxtypes = /^(?:toggle|show|hide)$/,
|
6289 |
+
rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
|
6290 |
+
timerId,
|
6291 |
+
fxAttrs = [
|
6292 |
+
// height animations
|
6293 |
+
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
|
6294 |
+
// width animations
|
6295 |
+
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
|
6296 |
+
// opacity animations
|
6297 |
+
[ "opacity" ]
|
6298 |
+
];
|
6299 |
+
|
6300 |
+
jQuery.fn.extend({
|
6301 |
+
show: function( speed, easing, callback ) {
|
6302 |
+
var elem, display;
|
6303 |
+
|
6304 |
+
if ( speed || speed === 0 ) {
|
6305 |
+
return this.animate( genFx("show", 3), speed, easing, callback);
|
6306 |
+
|
6307 |
+
} else {
|
6308 |
+
for ( var i = 0, j = this.length; i < j; i++ ) {
|
6309 |
+
elem = this[i];
|
6310 |
+
display = elem.style.display;
|
6311 |
+
|
6312 |
+
// Reset the inline display of this element to learn if it is
|
6313 |
+
// being hidden by cascaded rules or not
|
6314 |
+
if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
|
6315 |
+
display = elem.style.display = "";
|
6316 |
+
}
|
6317 |
+
|
6318 |
+
// Set elements which have been overridden with display: none
|
6319 |
+
// in a stylesheet to whatever the default browser style is
|
6320 |
+
// for such an element
|
6321 |
+
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
|
6322 |
+
jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
|
6323 |
+
}
|
6324 |
+
}
|
6325 |
+
|
6326 |
+
// Set the display of most of the elements in a second loop
|
6327 |
+
// to avoid the constant reflow
|
6328 |
+
for ( i = 0; i < j; i++ ) {
|
6329 |
+
elem = this[i];
|
6330 |
+
display = elem.style.display;
|
6331 |
+
|
6332 |
+
if ( display === "" || display === "none" ) {
|
6333 |
+
elem.style.display = jQuery.data(elem, "olddisplay") || "";
|
6334 |
+
}
|
6335 |
+
}
|
6336 |
+
|
6337 |
+
return this;
|
6338 |
+
}
|
6339 |
+
},
|
6340 |
+
|
6341 |
+
hide: function( speed, easing, callback ) {
|
6342 |
+
if ( speed || speed === 0 ) {
|
6343 |
+
return this.animate( genFx("hide", 3), speed, easing, callback);
|
6344 |
+
|
6345 |
+
} else {
|
6346 |
+
for ( var i = 0, j = this.length; i < j; i++ ) {
|
6347 |
+
var display = jQuery.css( this[i], "display" );
|
6348 |
+
|
6349 |
+
if ( display !== "none" ) {
|
6350 |
+
jQuery.data( this[i], "olddisplay", display );
|
6351 |
+
}
|
6352 |
+
}
|
6353 |
+
|
6354 |
+
// Set the display of the elements in a second loop
|
6355 |
+
// to avoid the constant reflow
|
6356 |
+
for ( i = 0; i < j; i++ ) {
|
6357 |
+
this[i].style.display = "none";
|
6358 |
+
}
|
6359 |
+
|
6360 |
+
return this;
|
6361 |
+
}
|
6362 |
+
},
|
6363 |
+
|
6364 |
+
// Save the old toggle function
|
6365 |
+
_toggle: jQuery.fn.toggle,
|
6366 |
+
|
6367 |
+
toggle: function( fn, fn2, callback ) {
|
6368 |
+
var bool = typeof fn === "boolean";
|
6369 |
+
|
6370 |
+
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
|
6371 |
+
this._toggle.apply( this, arguments );
|
6372 |
+
|
6373 |
+
} else if ( fn == null || bool ) {
|
6374 |
+
this.each(function() {
|
6375 |
+
var state = bool ? fn : jQuery(this).is(":hidden");
|
6376 |
+
jQuery(this)[ state ? "show" : "hide" ]();
|
6377 |
+
});
|
6378 |
+
|
6379 |
+
} else {
|
6380 |
+
this.animate(genFx("toggle", 3), fn, fn2, callback);
|
6381 |
+
}
|
6382 |
+
|
6383 |
+
return this;
|
6384 |
+
},
|
6385 |
+
|
6386 |
+
fadeTo: function( speed, to, easing, callback ) {
|
6387 |
+
return this.filter(":hidden").css("opacity", 0).show().end()
|
6388 |
+
.animate({opacity: to}, speed, easing, callback);
|
6389 |
+
},
|
6390 |
+
|
6391 |
+
animate: function( prop, speed, easing, callback ) {
|
6392 |
+
var optall = jQuery.speed(speed, easing, callback);
|
6393 |
+
|
6394 |
+
if ( jQuery.isEmptyObject( prop ) ) {
|
6395 |
+
return this.each( optall.complete );
|
6396 |
+
}
|
6397 |
+
|
6398 |
+
return this[ optall.queue === false ? "each" : "queue" ](function() {
|
6399 |
+
// XXX 'this' does not always have a nodeName when running the
|
6400 |
+
// test suite
|
6401 |
+
|
6402 |
+
var opt = jQuery.extend({}, optall), p,
|
6403 |
+
isElement = this.nodeType === 1,
|
6404 |
+
hidden = isElement && jQuery(this).is(":hidden"),
|
6405 |
+
self = this;
|
6406 |
+
|
6407 |
+
for ( p in prop ) {
|
6408 |
+
var name = jQuery.camelCase( p );
|
6409 |
+
|
6410 |
+
if ( p !== name ) {
|
6411 |
+
prop[ name ] = prop[ p ];
|
6412 |
+
delete prop[ p ];
|
6413 |
+
p = name;
|
6414 |
+
}
|
6415 |
+
|
6416 |
+
if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
|
6417 |
+
return opt.complete.call(this);
|
6418 |
+
}
|
6419 |
+
|
6420 |
+
if ( isElement && ( p === "height" || p === "width" ) ) {
|
6421 |
+
// Make sure that nothing sneaks out
|
6422 |
+
// Record all 3 overflow attributes because IE does not
|
6423 |
+
// change the overflow attribute when overflowX and
|
6424 |
+
// overflowY are set to the same value
|
6425 |
+
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
|
6426 |
+
|
6427 |
+
// Set display property to inline-block for height/width
|
6428 |
+
// animations on inline elements that are having width/height
|
6429 |
+
// animated
|
6430 |
+
if ( jQuery.css( this, "display" ) === "inline" &&
|
6431 |
+
jQuery.css( this, "float" ) === "none" ) {
|
6432 |
+
if ( !jQuery.support.inlineBlockNeedsLayout ) {
|
6433 |
+
this.style.display = "inline-block";
|
6434 |
+
|
6435 |
+
} else {
|
6436 |
+
var display = defaultDisplay(this.nodeName);
|
6437 |
+
|
6438 |
+
// inline-level elements accept inline-block;
|
6439 |
+
// block-level elements need to be inline with layout
|
6440 |
+
if ( display === "inline" ) {
|
6441 |
+
this.style.display = "inline-block";
|
6442 |
+
|
6443 |
+
} else {
|
6444 |
+
this.style.display = "inline";
|
6445 |
+
this.style.zoom = 1;
|
6446 |
+
}
|
6447 |
+
}
|
6448 |
+
}
|
6449 |
+
}
|
6450 |
+
|
6451 |
+
if ( jQuery.isArray( prop[p] ) ) {
|
6452 |
+
// Create (if needed) and add to specialEasing
|
6453 |
+
(opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
|
6454 |
+
prop[p] = prop[p][0];
|
6455 |
+
}
|
6456 |
+
}
|
6457 |
+
|
6458 |
+
if ( opt.overflow != null ) {
|
6459 |
+
this.style.overflow = "hidden";
|
6460 |
+
}
|
6461 |
+
|
6462 |
+
opt.curAnim = jQuery.extend({}, prop);
|
6463 |
+
|
6464 |
+
jQuery.each( prop, function( name, val ) {
|
6465 |
+
var e = new jQuery.fx( self, opt, name );
|
6466 |
+
|
6467 |
+
if ( rfxtypes.test(val) ) {
|
6468 |
+
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
|
6469 |
+
|
6470 |
+
} else {
|
6471 |
+
var parts = rfxnum.exec(val),
|
6472 |
+
start = e.cur() || 0;
|
6473 |
+
|
6474 |
+
if ( parts ) {
|
6475 |
+
var end = parseFloat( parts[2] ),
|
6476 |
+
unit = parts[3] || "px";
|
6477 |
+
|
6478 |
+
// We need to compute starting value
|
6479 |
+
if ( unit !== "px" ) {
|
6480 |
+
jQuery.style( self, name, (end || 1) + unit);
|
6481 |
+
start = ((end || 1) / e.cur()) * start;
|
6482 |
+
jQuery.style( self, name, start + unit);
|
6483 |
+
}
|
6484 |
+
|
6485 |
+
// If a +=/-= token was provided, we're doing a relative animation
|
6486 |
+
if ( parts[1] ) {
|
6487 |
+
end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
|
6488 |
+
}
|
6489 |
+
|
6490 |
+
e.custom( start, end, unit );
|
6491 |
+
|
6492 |
+
} else {
|
6493 |
+
e.custom( start, val, "" );
|
6494 |
+
}
|
6495 |
+
}
|
6496 |
+
});
|
6497 |
+
|
6498 |
+
// For JS strict compliance
|
6499 |
+
return true;
|
6500 |
+
});
|
6501 |
+
},
|
6502 |
+
|
6503 |
+
stop: function( clearQueue, gotoEnd ) {
|
6504 |
+
var timers = jQuery.timers;
|
6505 |
+
|
6506 |
+
if ( clearQueue ) {
|
6507 |
+
this.queue([]);
|
6508 |
+
}
|
6509 |
+
|
6510 |
+
this.each(function() {
|
6511 |
+
// go in reverse order so anything added to the queue during the loop is ignored
|
6512 |
+
for ( var i = timers.length - 1; i >= 0; i-- ) {
|
6513 |
+
if ( timers[i].elem === this ) {
|
6514 |
+
if (gotoEnd) {
|
6515 |
+
// force the next step to be the last
|
6516 |
+
timers[i](true);
|
6517 |
+
}
|
6518 |
+
|
6519 |
+
timers.splice(i, 1);
|
6520 |
+
}
|
6521 |
+
}
|
6522 |
+
});
|
6523 |
+
|
6524 |
+
// start the next in the queue if the last step wasn't forced
|
6525 |
+
if ( !gotoEnd ) {
|
6526 |
+
this.dequeue();
|
6527 |
+
}
|
6528 |
+
|
6529 |
+
return this;
|
6530 |
+
}
|
6531 |
+
|
6532 |
+
});
|
6533 |
+
|
6534 |
+
function genFx( type, num ) {
|
6535 |
+
var obj = {};
|
6536 |
+
|
6537 |
+
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
|
6538 |
+
obj[ this ] = type;
|
6539 |
+
});
|
6540 |
+
|
6541 |
+
return obj;
|
6542 |
+
}
|
6543 |
+
|
6544 |
+
// Generate shortcuts for custom animations
|
6545 |
+
jQuery.each({
|
6546 |
+
slideDown: genFx("show", 1),
|
6547 |
+
slideUp: genFx("hide", 1),
|
6548 |
+
slideToggle: genFx("toggle", 1),
|
6549 |
+
fadeIn: { opacity: "show" },
|
6550 |
+
fadeOut: { opacity: "hide" },
|
6551 |
+
fadeToggle: { opacity: "toggle" }
|
6552 |
+
}, function( name, props ) {
|
6553 |
+
jQuery.fn[ name ] = function( speed, easing, callback ) {
|
6554 |
+
return this.animate( props, speed, easing, callback );
|
6555 |
+
};
|
6556 |
+
});
|
6557 |
+
|
6558 |
+
jQuery.extend({
|
6559 |
+
speed: function( speed, easing, fn ) {
|
6560 |
+
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
|
6561 |
+
complete: fn || !fn && easing ||
|
6562 |
+
jQuery.isFunction( speed ) && speed,
|
6563 |
+
duration: speed,
|
6564 |
+
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
|
6565 |
+
};
|
6566 |
+
|
6567 |
+
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
|
6568 |
+
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
|
6569 |
+
|
6570 |
+
// Queueing
|
6571 |
+
opt.old = opt.complete;
|
6572 |
+
opt.complete = function() {
|
6573 |
+
if ( opt.queue !== false ) {
|
6574 |
+
jQuery(this).dequeue();
|
6575 |
+
}
|
6576 |
+
if ( jQuery.isFunction( opt.old ) ) {
|
6577 |
+
opt.old.call( this );
|
6578 |
+
}
|
6579 |
+
};
|
6580 |
+
|
6581 |
+
return opt;
|
6582 |
+
},
|
6583 |
+
|
6584 |
+
easing: {
|
6585 |
+
linear: function( p, n, firstNum, diff ) {
|
6586 |
+
return firstNum + diff * p;
|
6587 |
+
},
|
6588 |
+
swing: function( p, n, firstNum, diff ) {
|
6589 |
+
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
|
6590 |
+
}
|
6591 |
+
},
|
6592 |
+
|
6593 |
+
timers: [],
|
6594 |
+
|
6595 |
+
fx: function( elem, options, prop ) {
|
6596 |
+
this.options = options;
|
6597 |
+
this.elem = elem;
|
6598 |
+
this.prop = prop;
|
6599 |
+
|
6600 |
+
if ( !options.orig ) {
|
6601 |
+
options.orig = {};
|
6602 |
+
}
|
6603 |
+
}
|
6604 |
+
|
6605 |
+
});
|
6606 |
+
|
6607 |
+
jQuery.fx.prototype = {
|
6608 |
+
// Simple function for setting a style value
|
6609 |
+
update: function() {
|
6610 |
+
if ( this.options.step ) {
|
6611 |
+
this.options.step.call( this.elem, this.now, this );
|
6612 |
+
}
|
6613 |
+
|
6614 |
+
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
|
6615 |
+
},
|
6616 |
+
|
6617 |
+
// Get the current size
|
6618 |
+
cur: function() {
|
6619 |
+
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
|
6620 |
+
return this.elem[ this.prop ];
|
6621 |
+
}
|
6622 |
+
|
6623 |
+
var r = parseFloat( jQuery.css( this.elem, this.prop ) );
|
6624 |
+
return r && r > -10000 ? r : 0;
|
6625 |
+
},
|
6626 |
+
|
6627 |
+
// Start an animation from one number to another
|
6628 |
+
custom: function( from, to, unit ) {
|
6629 |
+
var self = this,
|
6630 |
+
fx = jQuery.fx;
|
6631 |
+
|
6632 |
+
this.startTime = jQuery.now();
|
6633 |
+
this.start = from;
|
6634 |
+
this.end = to;
|
6635 |
+
this.unit = unit || this.unit || "px";
|
6636 |
+
this.now = this.start;
|
6637 |
+
this.pos = this.state = 0;
|
6638 |
+
|
6639 |
+
function t( gotoEnd ) {
|
6640 |
+
return self.step(gotoEnd);
|
6641 |
+
}
|
6642 |
+
|
6643 |
+
t.elem = this.elem;
|
6644 |
+
|
6645 |
+
if ( t() && jQuery.timers.push(t) && !timerId ) {
|
6646 |
+
timerId = setInterval(fx.tick, fx.interval);
|
6647 |
+
}
|
6648 |
+
},
|
6649 |
+
|
6650 |
+
// Simple 'show' function
|
6651 |
+
show: function() {
|
6652 |
+
// Remember where we started, so that we can go back to it later
|
6653 |
+
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
|
6654 |
+
this.options.show = true;
|
6655 |
+
|
6656 |
+
// Begin the animation
|
6657 |
+
// Make sure that we start at a small width/height to avoid any
|
6658 |
+
// flash of content
|
6659 |
+
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
|
6660 |
+
|
6661 |
+
// Start by showing the element
|
6662 |
+
jQuery( this.elem ).show();
|
6663 |
+
},
|
6664 |
+
|
6665 |
+
// Simple 'hide' function
|
6666 |
+
hide: function() {
|
6667 |
+
// Remember where we started, so that we can go back to it later
|
6668 |
+
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
|
6669 |
+
this.options.hide = true;
|
6670 |
+
|
6671 |
+
// Begin the animation
|
6672 |
+
this.custom(this.cur(), 0);
|
6673 |
+
},
|
6674 |
+
|
6675 |
+
// Each step of an animation
|
6676 |
+
step: function( gotoEnd ) {
|
6677 |
+
var t = jQuery.now(), done = true;
|
6678 |
+
|
6679 |
+
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
|
6680 |
+
this.now = this.end;
|
6681 |
+
this.pos = this.state = 1;
|
6682 |
+
this.update();
|
6683 |
+
|
6684 |
+
this.options.curAnim[ this.prop ] = true;
|
6685 |
+
|
6686 |
+
for ( var i in this.options.curAnim ) {
|
6687 |
+
if ( this.options.curAnim[i] !== true ) {
|
6688 |
+
done = false;
|
6689 |
+
}
|
6690 |
+
}
|
6691 |
+
|
6692 |
+
if ( done ) {
|
6693 |
+
// Reset the overflow
|
6694 |
+
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
|
6695 |
+
var elem = this.elem,
|
6696 |
+
options = this.options;
|
6697 |
+
|
6698 |
+
jQuery.each( [ "", "X", "Y" ], function (index, value) {
|
6699 |
+
elem.style[ "overflow" + value ] = options.overflow[index];
|
6700 |
+
} );
|
6701 |
+
}
|
6702 |
+
|
6703 |
+
// Hide the element if the "hide" operation was done
|
6704 |
+
if ( this.options.hide ) {
|
6705 |
+
jQuery(this.elem).hide();
|
6706 |
+
}
|
6707 |
+
|
6708 |
+
// Reset the properties, if the item has been hidden or shown
|
6709 |
+
if ( this.options.hide || this.options.show ) {
|
6710 |
+
for ( var p in this.options.curAnim ) {
|
6711 |
+
jQuery.style( this.elem, p, this.options.orig[p] );
|
6712 |
+
}
|
6713 |
+
}
|
6714 |
+
|
6715 |
+
// Execute the complete function
|
6716 |
+
this.options.complete.call( this.elem );
|
6717 |
+
}
|
6718 |
+
|
6719 |
+
return false;
|
6720 |
+
|
6721 |
+
} else {
|
6722 |
+
var n = t - this.startTime;
|
6723 |
+
this.state = n / this.options.duration;
|
6724 |
+
|
6725 |
+
// Perform the easing function, defaults to swing
|
6726 |
+
var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
|
6727 |
+
var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
|
6728 |
+
this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
|
6729 |
+
this.now = this.start + ((this.end - this.start) * this.pos);
|
6730 |
+
|
6731 |
+
// Perform the next step of the animation
|
6732 |
+
this.update();
|
6733 |
+
}
|
6734 |
+
|
6735 |
+
return true;
|
6736 |
+
}
|
6737 |
+
};
|
6738 |
+
|
6739 |
+
jQuery.extend( jQuery.fx, {
|
6740 |
+
tick: function() {
|
6741 |
+
var timers = jQuery.timers;
|
6742 |
+
|
6743 |
+
for ( var i = 0; i < timers.length; i++ ) {
|
6744 |
+
if ( !timers[i]() ) {
|
6745 |
+
timers.splice(i--, 1);
|
6746 |
+
}
|
6747 |
+
}
|
6748 |
+
|
6749 |
+
if ( !timers.length ) {
|
6750 |
+
jQuery.fx.stop();
|
6751 |
+
}
|
6752 |
+
},
|
6753 |
+
|
6754 |
+
interval: 13,
|
6755 |
+
|
6756 |
+
stop: function() {
|
6757 |
+
clearInterval( timerId );
|
6758 |
+
timerId = null;
|
6759 |
+
},
|
6760 |
+
|
6761 |
+
speeds: {
|
6762 |
+
slow: 600,
|
6763 |
+
fast: 200,
|
6764 |
+
// Default speed
|
6765 |
+
_default: 400
|
6766 |
+
},
|
6767 |
+
|
6768 |
+
step: {
|
6769 |
+
opacity: function( fx ) {
|
6770 |
+
jQuery.style( fx.elem, "opacity", fx.now );
|
6771 |
+
},
|
6772 |
+
|
6773 |
+
_default: function( fx ) {
|
6774 |
+
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
|
6775 |
+
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
|
6776 |
+
} else {
|
6777 |
+
fx.elem[ fx.prop ] = fx.now;
|
6778 |
+
}
|
6779 |
+
}
|
6780 |
+
}
|
6781 |
+
});
|
6782 |
+
|
6783 |
+
if ( jQuery.expr && jQuery.expr.filters ) {
|
6784 |
+
jQuery.expr.filters.animated = function( elem ) {
|
6785 |
+
return jQuery.grep(jQuery.timers, function( fn ) {
|
6786 |
+
return elem === fn.elem;
|
6787 |
+
}).length;
|
6788 |
+
};
|
6789 |
+
}
|
6790 |
+
|
6791 |
+
function defaultDisplay( nodeName ) {
|
6792 |
+
if ( !elemdisplay[ nodeName ] ) {
|
6793 |
+
var elem = jQuery("<" + nodeName + ">").appendTo("body"),
|
6794 |
+
display = elem.css("display");
|
6795 |
+
|
6796 |
+
elem.remove();
|
6797 |
+
|
6798 |
+
if ( display === "none" || display === "" ) {
|
6799 |
+
display = "block";
|
6800 |
+
}
|
6801 |
+
|
6802 |
+
elemdisplay[ nodeName ] = display;
|
6803 |
+
}
|
6804 |
+
|
6805 |
+
return elemdisplay[ nodeName ];
|
6806 |
+
}
|
6807 |
+
|
6808 |
+
|
6809 |
+
|
6810 |
+
|
6811 |
+
var rtable = /^t(?:able|d|h)$/i,
|
6812 |
+
rroot = /^(?:body|html)$/i;
|
6813 |
+
|
6814 |
+
if ( "getBoundingClientRect" in document.documentElement ) {
|
6815 |
+
jQuery.fn.offset = function( options ) {
|
6816 |
+
var elem = this[0], box;
|
6817 |
+
|
6818 |
+
if ( options ) {
|
6819 |
+
return this.each(function( i ) {
|
6820 |
+
jQuery.offset.setOffset( this, options, i );
|
6821 |
+
});
|
6822 |
+
}
|
6823 |
+
|
6824 |
+
if ( !elem || !elem.ownerDocument ) {
|
6825 |
+
return null;
|
6826 |
+
}
|
6827 |
+
|
6828 |
+
if ( elem === elem.ownerDocument.body ) {
|
6829 |
+
return jQuery.offset.bodyOffset( elem );
|
6830 |
+
}
|
6831 |
+
|
6832 |
+
try {
|
6833 |
+
box = elem.getBoundingClientRect();
|
6834 |
+
} catch(e) {}
|
6835 |
+
|
6836 |
+
var doc = elem.ownerDocument,
|
6837 |
+
docElem = doc.documentElement;
|
6838 |
+
|
6839 |
+
// Make sure we're not dealing with a disconnected DOM node
|
6840 |
+
if ( !box || !jQuery.contains( docElem, elem ) ) {
|
6841 |
+
return box || { top: 0, left: 0 };
|
6842 |
+
}
|
6843 |
+
|
6844 |
+
var body = doc.body,
|
6845 |
+
win = getWindow(doc),
|
6846 |
+
clientTop = docElem.clientTop || body.clientTop || 0,
|
6847 |
+
clientLeft = docElem.clientLeft || body.clientLeft || 0,
|
6848 |
+
scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
|
6849 |
+
scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
|
6850 |
+
top = box.top + scrollTop - clientTop,
|
6851 |
+
left = box.left + scrollLeft - clientLeft;
|
6852 |
+
|
6853 |
+
return { top: top, left: left };
|
6854 |
+
};
|
6855 |
+
|
6856 |
+
} else {
|
6857 |
+
jQuery.fn.offset = function( options ) {
|
6858 |
+
var elem = this[0];
|
6859 |
+
|
6860 |
+
if ( options ) {
|
6861 |
+
return this.each(function( i ) {
|
6862 |
+
jQuery.offset.setOffset( this, options, i );
|
6863 |
+
});
|
6864 |
+
}
|
6865 |
+
|
6866 |
+
if ( !elem || !elem.ownerDocument ) {
|
6867 |
+
return null;
|
6868 |
+
}
|
6869 |
+
|
6870 |
+
if ( elem === elem.ownerDocument.body ) {
|
6871 |
+
return jQuery.offset.bodyOffset( elem );
|
6872 |
+
}
|
6873 |
+
|
6874 |
+
jQuery.offset.initialize();
|
6875 |
+
|
6876 |
+
var computedStyle,
|
6877 |
+
offsetParent = elem.offsetParent,
|
6878 |
+
prevOffsetParent = elem,
|
6879 |
+
doc = elem.ownerDocument,
|
6880 |
+
docElem = doc.documentElement,
|
6881 |
+
body = doc.body,
|
6882 |
+
defaultView = doc.defaultView,
|
6883 |
+
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
|
6884 |
+
top = elem.offsetTop,
|
6885 |
+
left = elem.offsetLeft;
|
6886 |
+
|
6887 |
+
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
|
6888 |
+
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
|
6889 |
+
break;
|
6890 |
+
}
|
6891 |
+
|
6892 |
+
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
|
6893 |
+
top -= elem.scrollTop;
|
6894 |
+
left -= elem.scrollLeft;
|
6895 |
+
|
6896 |
+
if ( elem === offsetParent ) {
|
6897 |
+
top += elem.offsetTop;
|
6898 |
+
left += elem.offsetLeft;
|
6899 |
+
|
6900 |
+
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
|
6901 |
+
top += parseFloat( computedStyle.borderTopWidth ) || 0;
|
6902 |
+
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
|
6903 |
+
}
|
6904 |
+
|
6905 |
+
prevOffsetParent = offsetParent;
|
6906 |
+
offsetParent = elem.offsetParent;
|
6907 |
+
}
|
6908 |
+
|
6909 |
+
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
|
6910 |
+
top += parseFloat( computedStyle.borderTopWidth ) || 0;
|
6911 |
+
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
|
6912 |
+
}
|
6913 |
+
|
6914 |
+
prevComputedStyle = computedStyle;
|
6915 |
+
}
|
6916 |
+
|
6917 |
+
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
|
6918 |
+
top += body.offsetTop;
|
6919 |
+
left += body.offsetLeft;
|
6920 |
+
}
|
6921 |
+
|
6922 |
+
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
|
6923 |
+
top += Math.max( docElem.scrollTop, body.scrollTop );
|
6924 |
+
left += Math.max( docElem.scrollLeft, body.scrollLeft );
|
6925 |
+
}
|
6926 |
+
|
6927 |
+
return { top: top, left: left };
|
6928 |
+
};
|
6929 |
+
}
|
6930 |
+
|
6931 |
+
jQuery.offset = {
|
6932 |
+
initialize: function() {
|
6933 |
+
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
|
6934 |
+
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
|
6935 |
+
|
6936 |
+
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
|
6937 |
+
|
6938 |
+
container.innerHTML = html;
|
6939 |
+
body.insertBefore( container, body.firstChild );
|
6940 |
+
innerDiv = container.firstChild;
|
6941 |
+
checkDiv = innerDiv.firstChild;
|
6942 |
+
td = innerDiv.nextSibling.firstChild.firstChild;
|
6943 |
+
|
6944 |
+
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
|
6945 |
+
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
|
6946 |
+
|
6947 |
+
checkDiv.style.position = "fixed";
|
6948 |
+
checkDiv.style.top = "20px";
|
6949 |
+
|
6950 |
+
// safari subtracts parent border width here which is 5px
|
6951 |
+
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
|
6952 |
+
checkDiv.style.position = checkDiv.style.top = "";
|
6953 |
+
|
6954 |
+
innerDiv.style.overflow = "hidden";
|
6955 |
+
innerDiv.style.position = "relative";
|
6956 |
+
|
6957 |
+
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
|
6958 |
+
|
6959 |
+
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
|
6960 |
+
|
6961 |
+
body.removeChild( container );
|
6962 |
+
body = container = innerDiv = checkDiv = table = td = null;
|
6963 |
+
jQuery.offset.initialize = jQuery.noop;
|
6964 |
+
},
|
6965 |
+
|
6966 |
+
bodyOffset: function( body ) {
|
6967 |
+
var top = body.offsetTop,
|
6968 |
+
left = body.offsetLeft;
|
6969 |
+
|
6970 |
+
jQuery.offset.initialize();
|
6971 |
+
|
6972 |
+
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
|
6973 |
+
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
|
6974 |
+
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
|
6975 |
+
}
|
6976 |
+
|
6977 |
+
return { top: top, left: left };
|
6978 |
+
},
|
6979 |
+
|
6980 |
+
setOffset: function( elem, options, i ) {
|
6981 |
+
var position = jQuery.css( elem, "position" );
|
6982 |
+
|
6983 |
+
// set position first, in-case top/left are set even on static elem
|
6984 |
+
if ( position === "static" ) {
|
6985 |
+
elem.style.position = "relative";
|
6986 |
+
}
|
6987 |
+
|
6988 |
+
var curElem = jQuery( elem ),
|
6989 |
+
curOffset = curElem.offset(),
|
6990 |
+
curCSSTop = jQuery.css( elem, "top" ),
|
6991 |
+
curCSSLeft = jQuery.css( elem, "left" ),
|
6992 |
+
calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
|
6993 |
+
props = {}, curPosition = {}, curTop, curLeft;
|
6994 |
+
|
6995 |
+
// need to be able to calculate position if either top or left is auto and position is absolute
|
6996 |
+
if ( calculatePosition ) {
|
6997 |
+
curPosition = curElem.position();
|
6998 |
+
}
|
6999 |
+
|
7000 |
+
curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
|
7001 |
+
curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
|
7002 |
+
|
7003 |
+
if ( jQuery.isFunction( options ) ) {
|
7004 |
+
options = options.call( elem, i, curOffset );
|
7005 |
+
}
|
7006 |
+
|
7007 |
+
if (options.top != null) {
|
7008 |
+
props.top = (options.top - curOffset.top) + curTop;
|
7009 |
+
}
|
7010 |
+
if (options.left != null) {
|
7011 |
+
props.left = (options.left - curOffset.left) + curLeft;
|
7012 |
+
}
|
7013 |
+
|
7014 |
+
if ( "using" in options ) {
|
7015 |
+
options.using.call( elem, props );
|
7016 |
+
} else {
|
7017 |
+
curElem.css( props );
|
7018 |
+
}
|
7019 |
+
}
|
7020 |
+
};
|
7021 |
+
|
7022 |
+
|
7023 |
+
jQuery.fn.extend({
|
7024 |
+
position: function() {
|
7025 |
+
if ( !this[0] ) {
|
7026 |
+
return null;
|
7027 |
+
}
|
7028 |
+
|
7029 |
+
var elem = this[0],
|
7030 |
+
|
7031 |
+
// Get *real* offsetParent
|
7032 |
+
offsetParent = this.offsetParent(),
|
7033 |
+
|
7034 |
+
// Get correct offsets
|
7035 |
+
offset = this.offset(),
|
7036 |
+
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
|
7037 |
+
|
7038 |
+
// Subtract element margins
|
7039 |
+
// note: when an element has margin: auto the offsetLeft and marginLeft
|
7040 |
+
// are the same in Safari causing offset.left to incorrectly be 0
|
7041 |
+
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
|
7042 |
+
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
|
7043 |
+
|
7044 |
+
// Add offsetParent borders
|
7045 |
+
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
|
7046 |
+
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
|
7047 |
+
|
7048 |
+
// Subtract the two offsets
|
7049 |
+
return {
|
7050 |
+
top: offset.top - parentOffset.top,
|
7051 |
+
left: offset.left - parentOffset.left
|
7052 |
+
};
|
7053 |
+
},
|
7054 |
+
|
7055 |
+
offsetParent: function() {
|
7056 |
+
return this.map(function() {
|
7057 |
+
var offsetParent = this.offsetParent || document.body;
|
7058 |
+
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
|
7059 |
+
offsetParent = offsetParent.offsetParent;
|
7060 |
+
}
|
7061 |
+
return offsetParent;
|
7062 |
+
});
|
7063 |
+
}
|
7064 |
+
});
|
7065 |
+
|
7066 |
+
|
7067 |
+
// Create scrollLeft and scrollTop methods
|
7068 |
+
jQuery.each( ["Left", "Top"], function( i, name ) {
|
7069 |
+
var method = "scroll" + name;
|
7070 |
+
|
7071 |
+
jQuery.fn[ method ] = function(val) {
|
7072 |
+
var elem = this[0], win;
|
7073 |
+
|
7074 |
+
if ( !elem ) {
|
7075 |
+
return null;
|
7076 |
+
}
|
7077 |
+
|
7078 |
+
if ( val !== undefined ) {
|
7079 |
+
// Set the scroll offset
|
7080 |
+
return this.each(function() {
|
7081 |
+
win = getWindow( this );
|
7082 |
+
|
7083 |
+
if ( win ) {
|
7084 |
+
win.scrollTo(
|
7085 |
+
!i ? val : jQuery(win).scrollLeft(),
|
7086 |
+
i ? val : jQuery(win).scrollTop()
|
7087 |
+
);
|
7088 |
+
|
7089 |
+
} else {
|
7090 |
+
this[ method ] = val;
|
7091 |
+
}
|
7092 |
+
});
|
7093 |
+
} else {
|
7094 |
+
win = getWindow( elem );
|
7095 |
+
|
7096 |
+
// Return the scroll offset
|
7097 |
+
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
|
7098 |
+
jQuery.support.boxModel && win.document.documentElement[ method ] ||
|
7099 |
+
win.document.body[ method ] :
|
7100 |
+
elem[ method ];
|
7101 |
+
}
|
7102 |
+
};
|
7103 |
+
});
|
7104 |
+
|
7105 |
+
function getWindow( elem ) {
|
7106 |
+
return jQuery.isWindow( elem ) ?
|
7107 |
+
elem :
|
7108 |
+
elem.nodeType === 9 ?
|
7109 |
+
elem.defaultView || elem.parentWindow :
|
7110 |
+
false;
|
7111 |
+
}
|
7112 |
+
|
7113 |
+
|
7114 |
+
|
7115 |
+
|
7116 |
+
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
|
7117 |
+
jQuery.each([ "Height", "Width" ], function( i, name ) {
|
7118 |
+
|
7119 |
+
var type = name.toLowerCase();
|
7120 |
+
|
7121 |
+
// innerHeight and innerWidth
|
7122 |
+
jQuery.fn["inner" + name] = function() {
|
7123 |
+
return this[0] ?
|
7124 |
+
parseFloat( jQuery.css( this[0], type, "padding" ) ) :
|
7125 |
+
null;
|
7126 |
+
};
|
7127 |
+
|
7128 |
+
// outerHeight and outerWidth
|
7129 |
+
jQuery.fn["outer" + name] = function( margin ) {
|
7130 |
+
return this[0] ?
|
7131 |
+
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
|
7132 |
+
null;
|
7133 |
+
};
|
7134 |
+
|
7135 |
+
jQuery.fn[ type ] = function( size ) {
|
7136 |
+
// Get window width or height
|
7137 |
+
var elem = this[0];
|
7138 |
+
if ( !elem ) {
|
7139 |
+
return size == null ? null : this;
|
7140 |
+
}
|
7141 |
+
|
7142 |
+
if ( jQuery.isFunction( size ) ) {
|
7143 |
+
return this.each(function( i ) {
|
7144 |
+
var self = jQuery( this );
|
7145 |
+
self[ type ]( size.call( this, i, self[ type ]() ) );
|
7146 |
+
});
|
7147 |
+
}
|
7148 |
+
|
7149 |
+
if ( jQuery.isWindow( elem ) ) {
|
7150 |
+
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
|
7151 |
+
return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
|
7152 |
+
elem.document.body[ "client" + name ];
|
7153 |
+
|
7154 |
+
// Get document width or height
|
7155 |
+
} else if ( elem.nodeType === 9 ) {
|
7156 |
+
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
|
7157 |
+
return Math.max(
|
7158 |
+
elem.documentElement["client" + name],
|
7159 |
+
elem.body["scroll" + name], elem.documentElement["scroll" + name],
|
7160 |
+
elem.body["offset" + name], elem.documentElement["offset" + name]
|
7161 |
+
);
|
7162 |
+
|
7163 |
+
// Get or set width or height on the element
|
7164 |
+
} else if ( size === undefined ) {
|
7165 |
+
var orig = jQuery.css( elem, type ),
|
7166 |
+
ret = parseFloat( orig );
|
7167 |
+
|
7168 |
+
return jQuery.isNaN( ret ) ? orig : ret;
|
7169 |
+
|
7170 |
+
// Set the width or height on the element (default to pixels if value is unitless)
|
7171 |
+
} else {
|
7172 |
+
return this.css( type, typeof size === "string" ? size : size + "px" );
|
7173 |
+
}
|
7174 |
+
};
|
7175 |
+
|
7176 |
+
});
|
7177 |
+
|
7178 |
+
|
7179 |
+
})(window);
|
7180 |
+
jQuery.noConflict();
|
js/officience/news/jquery-1.7.1-min.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery v1.7.1 jquery.com | jquery.org/license */
|
2 |
+
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
|
3 |
+
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
|
4 |
+
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
|
5 |
+
|
6 |
+
jQuery.noConflict();
|
js/officience/news/noconflict.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
jQuery.noConflict();
|
2 |
+
var CommerceLab = {};
|
package.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Officience_News</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This free Magento News Extenion allows you to manage news on your website by store view</summary>
|
10 |
+
<description>This free Magento News Extenion allows you to manage news on your website by store view. The extension can help you make your posts, categories and comments easily. It also organize by category/sub-category. Specially, It supports URL friendly and META tags to increase SEO and multi languages.</description>
|
11 |
+
<notes> Version number: 0.1.0
|
12 |
+
Stability: Stable
|
13 |
+
Compatibility: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7, 1.8
|
14 |
+
</notes>
|
15 |
+
<authors><author><name>khanh trieu nguyen le</name><user>khanhtrieu</user><email>trieu181989@gmail.com</email></author></authors>
|
16 |
+
<date>2014-01-20</date>
|
17 |
+
<time>07:54:04</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Officience"><dir name="News"><dir name="Block"><file name="Abstract.php" hash="dc0be92021f001832f5ccaa2f69ac014"/><dir name="Adminhtml"><dir name="Category"><dir name="Edit"><file name="Form.php" hash="c065af7f04ed40132588ce2852768f2a"/><dir name="Tab"><file name="Additional.php" hash="c9ab8b08e7f84bf4260db0c4e44585d8"/><file name="Form.php" hash="e16f8e7a9eab54b3eeef50e92350a513"/></dir><file name="Tabs.php" hash="7fa0d0e51176fb455bd4c3398927410c"/></dir><file name="Edit.php" hash="70e88e48d1f02b6276c451e9fafcaf18"/><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Action.php" hash="cd361d72ab34f4fcfceac9dc876aec46"/><file name="SubCategories.php" hash="84ac8b715d81312b6219005b5e5fbb40"/></dir></dir></dir><file name="Grid.php" hash="c78c5a4b067f3bdfca3790f96d6639e6"/></dir><file name="Category.php" hash="3e1b8159aedc56705973848bb16c8403"/><dir name="Comment"><dir name="Edit"><file name="Form.php" hash="5d4d1d9601407b7208bec9d30a229b61"/></dir><file name="Edit.php" hash="38737d5fabe75d4f8919ae8197a7deee"/><file name="Grid.php" hash="562a13f94c4ae6af1857cf5ae934c01f"/></dir><file name="Comment.php" hash="6a97c5c613d5d276c7f47465e62419f0"/><dir name="News"><dir name="Edit"><file name="Form.php" hash="8390c0d4ac2bae197c92bffbea3b9221"/><dir name="Tab"><file name="Additional.php" hash="e8a8093a47f218884ce1ad626fc2fa7f"/><file name="Category.php" hash="3ccb7e58f9e9e2b0503e93d9d3bbca31"/><file name="Info.php" hash="0054566f8a59fc6f33fdf2dd291602e4"/></dir><file name="Tabs.php" hash="1220094fc1fd17cf1c59cf10ede00d59"/></dir><file name="Edit.php" hash="abb586208da74f8d978e35a99fa50384"/><file name="Grid.php" hash="e3e3109f9dd6885864818dc3fb1b9db2"/></dir><file name="News.php" hash="54fdc0304e1abf4610d0b073007d2b27"/></dir><file name="Category.php" hash="c8a6153334d2f5250c260d5d157b2ee0"/><file name="Menu.php" hash="adab01c06aec792038b22c0e113c8d6a"/><file name="Newspost.php" hash="afd5ca8b36267a2d6f999be7a9322ac2"/><file name="Rss.php" hash="e9a1ab22f44c2a973542dd9ced921fc6"/><file name="Tags.php" hash="2a6a2eeac10605293ab208762ff0f7a5"/></dir><dir name="Controller"><file name="Router.php" hash="6d9e5e485a197d4fafd3a6ee390f0d38"/></dir><dir name="Helper"><file name="Cat.php" hash="ea6d51a49fb720df630b72f985392e83"/><file name="Data.php" hash="68b0021f850f75946393cdd8421aa5fd"/><file name="Versions.php" hash="b69b685f4582a9ed04bbce2a6cccb22d"/></dir><dir name="Model"><file name="Category.php" hash="6b0cbc2499df7306f0fcf302c75cbc3b"/><file name="CategoryStore.php" hash="555f974e41f563d224c4108bf3d0ca16"/><file name="Check.php" hash="fca21db3cd45d70260ef93eb9d162c45"/><file name="Comment.php" hash="da7934feaa9ffa668a7077556b930c16"/><dir name="Config"><dir name="Source"><file name="Dateformat.php" hash="59cb810a297d924f64b697c316561732"/><file name="Parentcat.php" hash="aa66fdd2ac5a9ad8aa4061846062b43f"/><file name="Timeformat.php" hash="0a5c96525ed70c6d432a61c7bd992877"/><file name="Urloption.php" hash="d5b2683ebf79851ca9adb36c9c41f2d5"/></dir></dir><dir name="Mysql4"><dir name="Category"><file name="Collection.php" hash="f30b55eb04a0ec7ab1d92d00729fb96a"/></dir><file name="Category.php" hash="1bf7f0d833d797b9693ec0dfa67cbe2f"/><dir name="CategoryStore"><file name="Collection.php" hash="47530ea43ca51bd9cd12a0103d693554"/></dir><file name="CategoryStore.php" hash="4d677f70d5c15aaa4c930fc3e8a26e2d"/><dir name="Comment"><file name="Collection.php" hash="b8acbfc5c2c8026f747907a73cb41247"/></dir><file name="Comment.php" hash="5b15f3ae9e9b50580762a8fd376b3bef"/><dir name="News"><file name="Collection.php" hash="99d196ac1da664032b0a3061a982819a"/></dir><file name="News.php" hash="d146edad9e3ea9a028b751868f33a5f7"/><dir name="NewsStore"><file name="Collection.php" hash="2025fb14d855e565c55b62ef43658f73"/></dir><file name="NewsStore.php" hash="2fc593c6f5b1f7fdcfcf9a8d190afa78"/></dir><file name="News.php" hash="e158fba3b7524c44700ae1e7c15c0a0e"/><file name="NewsStore.php" hash="e9bf77fe21d5425d9525000069a385e7"/><dir name="Wysiwyg"><file name="Config.php" hash="0ce818b28a332fed7a64453fd4f7ca31"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryController.php" hash="1d2642c99b4d23f04e94cf021998a5c0"/><file name="CommentController.php" hash="6f6163220aa2c588453d0ccaa7c84058"/><file name="NewsController.php" hash="6bd87b2801ea3ac03c80c23062678885"/></dir><file name="IndexController.php" hash="0a1672f74f0457d110984a63d3148113"/><file name="NewspostController.php" hash="9485fa637328a54ee858520011a716ef"/><file name="RssController.php" hash="c62dbe0145a9699d2d254984cbc5923f"/></dir><dir name="etc"><file name="config.xml" hash="db3958dce17e149ccbabb78d11953755"/><file name="system.xml" hash="e9539a9f25515e121a588e8c62848d4e"/></dir><dir name="sql"><dir name="offinews_setup"><file name="mysql4-install-0.1.0.php" hash="5a4cf0bdf4cefd2c5aaaf2122dcaac8a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="officience_news.xml" hash="50d6ac5f1441b043061879d220e2deae"/></dir><dir name="template"><dir name="officience"><dir name="news"><file name="listCategory.phtml" hash="7ab8ed059cec4a526164a63b3214c01d"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="officience_news.xml" hash="5a00d6df22681843223c34908e922bb5"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir><dir name="officience"><dir name="news"><file name="list.phtml" hash="a2149c23cec7956d91bc623ce75b8586"/><file name="menu.phtml" hash="6dbd76d05133c0130623b9439ecf992f"/><file name="newspost.phtml" hash="a112990cc66dd303e9250641d1512a0c"/><file name="print.phtml" hash="c9ccf78f0b3670abbbb07584adc52000"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Officience_News.xml" hash="5b7ef45d00a284adf7a6cbc9b8d000a8"/></dir></target><target name="mage"><dir name="js"><dir name="officience"><dir name="news"><dir name="css"><dir name="images"><file name="folder.gif" hash="03eb26c42137ac792609822862ef4d0f"/></dir><file name="newscat.css" hash="71eb51604cb34ae50a513b60a4c2f412"/></dir><file name="jquery-1.4.4.js" hash="1e2ef16563c5939f247626c6147045aa"/><file name="jquery-1.7.1-min.js" hash="de56dbfca517764d9d056e82068f8d39"/><file name="noconflict.js" hash="22e97cd4bf445c956c7ccee56fa433c2"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="officience"><dir name="news"><dir name="images"><file name="arr_t.png" hash="3d633e87fdda01e606434ce7456a8145"/><file name="i_print.gif" hash="0aed138181495642e9ab29e55d194d40"/><file name="news-ct.png" hash="53fb02a52ae711d86d4e6786971b35e3"/><file name="rss.gif" hash="d17678b5dab15949ed62bea2b602090f"/></dir><file name="style.css" hash="d5b75c112ef55d4fbb2b5b8fb53383dc"/></dir></dir></dir></dir></dir></dir></target></contents>
|
19 |
+
<compatible/>
|
20 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
21 |
+
</package>
|
skin/frontend/default/default/css/officience/news/images/arr_t.png
ADDED
Binary file
|
skin/frontend/default/default/css/officience/news/images/i_print.gif
ADDED
Binary file
|
skin/frontend/default/default/css/officience/news/images/news-ct.png
ADDED
Binary file
|
skin/frontend/default/default/css/officience/news/images/rss.gif
ADDED
Binary file
|
skin/frontend/default/default/css/officience/news/style.css
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.post-list{
|
2 |
+
clear:both;
|
3 |
+
padding-bottom:20px;
|
4 |
+
}
|
5 |
+
.post-listing .post-item {
|
6 |
+
float: left;
|
7 |
+
margin-bottom: 20px;
|
8 |
+
margin-right: 27px;
|
9 |
+
width: 46%;
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
.post-listing .post-item .post-desc p {
|
14 |
+
margin: 0 0 5px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.post-listing .post-item img,.post-listing li img {
|
18 |
+
height: 169px;
|
19 |
+
margin-bottom: 10px;
|
20 |
+
width: 330px;
|
21 |
+
}
|
22 |
+
.post-listing img {
|
23 |
+
border: 3px solid #FFFFFF;
|
24 |
+
box-shadow: 2px 2px 3px #E1EBEE;
|
25 |
+
}
|
26 |
+
.post-item-top span{
|
27 |
+
float:left;
|
28 |
+
margin-right: 20px;
|
29 |
+
}
|
30 |
+
|
31 |
+
.post-listing .post-item .post-title{
|
32 |
+
clear: both;
|
33 |
+
}
|
34 |
+
|
35 |
+
.copyright {
|
36 |
+
clear: both;
|
37 |
+
}
|
38 |
+
|
39 |
+
.comment-item {
|
40 |
+
margin:10px 0 0 0;
|
41 |
+
}
|
42 |
+
|
43 |
+
.comment-item .username {
|
44 |
+
font-size:12px;
|
45 |
+
margin:0px;
|
46 |
+
color:#1E7EC8;
|
47 |
+
display:inline;
|
48 |
+
}
|
49 |
+
#comment_block .comment-item div {
|
50 |
+
padding-left:10px;
|
51 |
+
}
|
52 |
+
|
53 |
+
#postComment label {
|
54 |
+
float:left;
|
55 |
+
width:80px;
|
56 |
+
}
|
57 |
+
#postComment .input-box {
|
58 |
+
padding-bottom:9px;
|
59 |
+
}
|
60 |
+
#postComment input[type="text"] {
|
61 |
+
width:200px;
|
62 |
+
}
|
63 |
+
.post-page-break{
|
64 |
+
clear:both;
|
65 |
+
}
|
66 |
+
|
67 |
+
.post-listing li {
|
68 |
+
float: left;
|
69 |
+
height: 169px;
|
70 |
+
margin-bottom: 25px;
|
71 |
+
margin-right: 8px;
|
72 |
+
position: relative;
|
73 |
+
width: 48%;
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
.post-listing li span {
|
79 |
+
background: none repeat scroll 0 0 #FFFFFF;
|
80 |
+
bottom: -3px;
|
81 |
+
display: block;
|
82 |
+
height: 43px;
|
83 |
+
left: 3px;
|
84 |
+
opacity: 0.85;
|
85 |
+
position: absolute;
|
86 |
+
width: 334px;
|
87 |
+
}
|
88 |
+
|
89 |
+
.post-listing li h2 {
|
90 |
+
background: url("images/arr_t.png") no-repeat scroll left top rgba(0, 0, 0, 0);
|
91 |
+
bottom: 5px;
|
92 |
+
left: 10px;
|
93 |
+
margin: 0;
|
94 |
+
padding-top: 16px;
|
95 |
+
position: absolute;
|
96 |
+
}
|
97 |
+
|
98 |
+
.post-listing li a {
|
99 |
+
color: #1E7EC8;
|
100 |
+
text-decoration: none;
|
101 |
+
}
|
102 |
+
|
103 |
+
.post-listing li h2 a:hover {
|
104 |
+
background: url("images/news-ct.png") no-repeat scroll left -25px rgba(0, 0, 0, 0);
|
105 |
+
color: #3A7695;
|
106 |
+
}
|
107 |
+
.post-listing li h2 a {
|
108 |
+
background: url("images/news-ct.png") no-repeat scroll left top rgba(0, 0, 0, 0);
|
109 |
+
color: #3B3B3B;
|
110 |
+
display: inline-block;
|
111 |
+
font-size: 1em;
|
112 |
+
font-weight: bold;
|
113 |
+
height: 22px;
|
114 |
+
line-height: 24px;
|
115 |
+
margin-left: 7px;
|
116 |
+
padding-left: 29px;
|
117 |
+
text-transform: uppercase;
|
118 |
+
}
|