Version Notes
Download this release
Release Info
Developer | Jay El-Kaake |
Extension | TBT_Enhancedgrid |
Version | 1.3.4.3 |
Comparing to | |
See all releases |
Code changes from version 1.3.4.2 to 1.3.4.3
- app/code/community/TBT/Enhancedgrid/Block/Widget/Loyalty.php +6 -6
- app/code/community/TBT/Enhancedgrid/etc/config.xml +1 -1
- app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product.phtml +45 -0
- app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product/grid.phtml +192 -0
- js/tbt/enhancedgrid/customfunctions/catalog_products.js +112 -0
- js/tbt/enhancedgrid/egsupplemental.js +78 -0
- js/tbt/enhancedgrid/enhancedgrid.js +391 -0
- js/tbt/enhancedgrid/resources/css/enhancedgrid.css +2 -0
- package.xml +5 -5
app/code/community/TBT/Enhancedgrid/Block/Widget/Loyalty.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* This class passes information about current version of Enhancedgrid being run to the
|
5 |
* All information is confidential and never distributed to any third priorities.
|
6 |
*
|
7 |
-
* @category
|
8 |
-
*
|
|
|
9 |
*/
|
10 |
class TBT_Enhancedgrid_Block_Widget_Loyalty extends Mage_Adminhtml_Block_Template
|
11 |
{
|
12 |
public function _toHtml()
|
13 |
{
|
14 |
$html = <<<FEED
|
15 |
-
|
16 |
-
<!-- See https://github.com/jayelkaake/enhancedgrid for more info. -->
|
17 |
<iframe src="{$this->_getLoyaltyUrl()}" marginwidth="0" marginheight="0"
|
18 |
align="middle" frameborder="0"
|
19 |
scrolling="no" style="width: 500px; float: left; height: 22px;">
|
@@ -48,7 +48,7 @@ FEED;
|
|
48 |
|
49 |
protected function _getBaseLoyaltyUrl()
|
50 |
{
|
51 |
-
$url = 'https://www.
|
52 |
|
53 |
//@nelkaake: If the page is supposed to be HTTPS and the AJAX call is not HTTPS, add HTTPS
|
54 |
// if it's HTTP and the url returned HTTPS, remove HTTPS
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* This class passes information about current version of Enhancedgrid being run to the Sweet Tooth server.
|
5 |
* All information is confidential and never distributed to any third priorities.
|
6 |
*
|
7 |
+
* @category TBT
|
8 |
+
*
|
9 |
+
* @author Sweet Tooth Team <contact@sweettoothrewards.com>
|
10 |
*/
|
11 |
class TBT_Enhancedgrid_Block_Widget_Loyalty extends Mage_Adminhtml_Block_Template
|
12 |
{
|
13 |
public function _toHtml()
|
14 |
{
|
15 |
$html = <<<FEED
|
16 |
+
<!-- Visit https://www.wdca.ca/m for information about this frame. You can remove it if you want. -->
|
|
|
17 |
<iframe src="{$this->_getLoyaltyUrl()}" marginwidth="0" marginheight="0"
|
18 |
align="middle" frameborder="0"
|
19 |
scrolling="no" style="width: 500px; float: left; height: 22px;">
|
48 |
|
49 |
protected function _getBaseLoyaltyUrl()
|
50 |
{
|
51 |
+
$url = 'https://www.wdca.ca/m';
|
52 |
|
53 |
//@nelkaake: If the page is supposed to be HTTPS and the AJAX call is not HTTPS, add HTTPS
|
54 |
// if it's HTTP and the url returned HTTPS, remove HTTPS
|
app/code/community/TBT/Enhancedgrid/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<TBT_Enhancedgrid>
|
5 |
-
<version>1.3.4.
|
6 |
</TBT_Enhancedgrid>
|
7 |
</modules>
|
8 |
<admin>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<TBT_Enhancedgrid>
|
5 |
+
<version>1.3.4.3</version>
|
6 |
</TBT_Enhancedgrid>
|
7 |
</modules>
|
8 |
<admin>
|
app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product.phtml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design_default
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="content-header">
|
28 |
+
<table cellspacing="0">
|
29 |
+
<tr>
|
30 |
+
<td style="width:50%;"><h3 class="icon-head head-products"><?php echo $this->_headerText ?></h3></td>
|
31 |
+
<td class="a-right">
|
32 |
+
<?php echo Mage::getBlockSingleton('enhancedgrid/widget_loyalty')->toHtml(); ?>
|
33 |
+
<?php echo $this->getAddNewButtonHtml() ?>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
</table>
|
37 |
+
</div>
|
38 |
+
<?php echo $this->getStoreSwitcherHtml() ?>
|
39 |
+
<?php /* @nelkaake -a 16/11/10: for MAGE 1.3.2 and up */ ?>
|
40 |
+
<?php if( !$this->isSingleStoreMode() ): ?>
|
41 |
+
<?php echo $this->getChildHtml('store_switcher');?>
|
42 |
+
<?php endif;?>
|
43 |
+
<div>
|
44 |
+
<?php echo $this->getGridHtml() ?>
|
45 |
+
</div>
|
app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product/grid.phtml
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design_default
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Template for Mage_Adminhtml_Block_Widget_Grid
|
30 |
+
*
|
31 |
+
* getId()
|
32 |
+
* getCollection()
|
33 |
+
* getColumns()
|
34 |
+
* getPagerVisibility()
|
35 |
+
* getVarNamePage()
|
36 |
+
*/
|
37 |
+
$numColumns = sizeof($this->getColumns());
|
38 |
+
?>
|
39 |
+
<?php if($this->getCollection()): ?>
|
40 |
+
<?php if($this->canDisplayContainer()): ?>
|
41 |
+
<?php if($this->getGridHeader()): ?>
|
42 |
+
<div class="content-header">
|
43 |
+
<table cellspacing="0">
|
44 |
+
<tr>
|
45 |
+
<td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
|
46 |
+
</tr>
|
47 |
+
</table>
|
48 |
+
</div>
|
49 |
+
<?php endif ?>
|
50 |
+
|
51 |
+
<div id="<?php echo $this->getId() ?>">
|
52 |
+
<?php else: ?>
|
53 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
54 |
+
<?php endif; ?>
|
55 |
+
<?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
|
56 |
+
<table cellspacing="0" class="actions">
|
57 |
+
<tr>
|
58 |
+
<?php if($this->getPagerVisibility()): ?>
|
59 |
+
<td class="pager">
|
60 |
+
<?php echo $this->__('Page') ?>
|
61 |
+
|
62 |
+
<?php $_curPage = $this->getCollection()->getCurPage() ?>
|
63 |
+
<?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
|
64 |
+
<?php if($_curPage>1): ?>
|
65 |
+
<a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
|
66 |
+
<?php else: ?>
|
67 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
68 |
+
<?php endif; ?>
|
69 |
+
|
70 |
+
<input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getId() ?>JsObject.inputPage(event, '<?php echo $_lastPage ?>')"/>
|
71 |
+
|
72 |
+
<?php if($_curPage < $_lastPage): ?>
|
73 |
+
<a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
|
74 |
+
<?php else: ?>
|
75 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
76 |
+
<?php endif; ?>
|
77 |
+
|
78 |
+
<?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
|
79 |
+
<span class="separator">|</span>
|
80 |
+
<?php echo $this->__('View') ?>
|
81 |
+
<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getId() ?>JsObject.loadByElement(this)">
|
82 |
+
<option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
|
83 |
+
<option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
|
84 |
+
<option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
|
85 |
+
<option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
|
86 |
+
<option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
|
87 |
+
</select>
|
88 |
+
<?php echo $this->__('per page') ?><span class="separator">|</span>
|
89 |
+
<?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
|
90 |
+
<span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
|
91 |
+
<?php if($this->getRssLists()): ?>
|
92 |
+
<?php foreach ($this->getRssLists() as $_rss): ?>
|
93 |
+
<span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
|
94 |
+
<?php endforeach ?>
|
95 |
+
<?php endif; ?>
|
96 |
+
</td>
|
97 |
+
<?php endif ?>
|
98 |
+
<?php if($this->getExportTypes()): ?>
|
99 |
+
<td class="export a-right">
|
100 |
+
<img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/> <?php echo $this->__('Export to:') ?>
|
101 |
+
<select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
|
102 |
+
<?php foreach ($this->getExportTypes() as $_type): ?>
|
103 |
+
<option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
|
104 |
+
<?php endforeach; ?>
|
105 |
+
</select>
|
106 |
+
<?php echo $this->getExportButtonHtml() ?>
|
107 |
+
</td>
|
108 |
+
<?php endif; ?>
|
109 |
+
<td class="filter-actions a-right">
|
110 |
+
<input type="text" value="<?php echo $this->getQueryStr(); ?>" id="enhancedGridSearchQry" onkeypress="if(keyWasPressed(event, 13)) { productGridJsObject.doFilter(); }">
|
111 |
+
<?php echo $this->getMainButtonsHtml() ?>
|
112 |
+
</td>
|
113 |
+
</tr>
|
114 |
+
</table>
|
115 |
+
<?php endif; ?>
|
116 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
117 |
+
<?php echo $this->getMassactionBlockHtml() ?>
|
118 |
+
<?php endif ?>
|
119 |
+
<div class="grid">
|
120 |
+
<div class="hor-scroll">
|
121 |
+
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
|
122 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
123 |
+
<col <?php echo $_column->getHtmlProperty() ?> />
|
124 |
+
<?php endforeach; ?>
|
125 |
+
<?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
|
126 |
+
<thead>
|
127 |
+
<?php if ($this->getHeadersVisibility()): ?>
|
128 |
+
<tr class="headings">
|
129 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
130 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
|
131 |
+
<?php endforeach; ?>
|
132 |
+
</tr>
|
133 |
+
<?php endif; ?>
|
134 |
+
<?php if ($this->getFilterVisibility()): ?>
|
135 |
+
<tr class="filter">
|
136 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
137 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
|
138 |
+
<?php endforeach; ?>
|
139 |
+
</tr>
|
140 |
+
<?php endif ?>
|
141 |
+
</thead>
|
142 |
+
<?php endif; ?>
|
143 |
+
<?php if ($this->getCountTotals()): ?>
|
144 |
+
<tfoot>
|
145 |
+
<tr>
|
146 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
147 |
+
<th class="<?php echo $_column->getCssProperty() ?>"><?php echo $_column->getRowField($_column->getGrid()->getTotals()) ?> </th>
|
148 |
+
<?php endforeach; ?>
|
149 |
+
</tr>
|
150 |
+
</tfoot>
|
151 |
+
<?php endif; ?>
|
152 |
+
<tbody>
|
153 |
+
<?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
|
154 |
+
<?php foreach ($this->getCollection() as $_index=>$_item): ?>
|
155 |
+
<tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
|
156 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
157 |
+
<td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>"><?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td>
|
158 |
+
<?php endforeach; ?>
|
159 |
+
</tr>
|
160 |
+
<?php endforeach; ?>
|
161 |
+
<?php elseif ($this->getEmptyText()): ?>
|
162 |
+
<tr>
|
163 |
+
<td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td>
|
164 |
+
</tr>
|
165 |
+
<?php endif; ?>
|
166 |
+
</tbody>
|
167 |
+
</table>
|
168 |
+
</div>
|
169 |
+
</div>
|
170 |
+
<?php if($this->canDisplayContainer()): ?>
|
171 |
+
</div>
|
172 |
+
<script type="text/javascript">
|
173 |
+
//<![CDATA[
|
174 |
+
<?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
|
175 |
+
<?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
|
176 |
+
<?php if($this->getRowClickCallback()): ?>
|
177 |
+
<?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
|
178 |
+
<?php endif; ?>
|
179 |
+
<?php if($this->getCheckboxCheckCallback()): ?>
|
180 |
+
<?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
|
181 |
+
<?php endif; ?>
|
182 |
+
<?php if($this->getRowInitCallback()): ?>
|
183 |
+
<?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
|
184 |
+
<?php echo $this->getJsObjectName() ?>.rows.each(function(row){<?php echo $this->getRowInitCallback() ?>(<?php echo $this->getJsObjectName() ?>, row)});
|
185 |
+
<?php endif; ?>
|
186 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
187 |
+
<?php echo $this->getMassactionBlock()->getJavaScript() ?>
|
188 |
+
<?php endif ?>
|
189 |
+
//]]>
|
190 |
+
</script>
|
191 |
+
<?php endif; ?>
|
192 |
+
<?php endif ?>
|
js/tbt/enhancedgrid/customfunctions/catalog_products.js
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Sweet Tooth.
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
+
* versions in the future. If you wish to customize Magento for your
|
18 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
+
*
|
20 |
+
* @category Sweet Tooth
|
21 |
+
*
|
22 |
+
* @copyright Copyright (c) 2008-2011 Sweet Tooth (http://www.sweettoothrewards.com)
|
23 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
+
*/
|
25 |
+
function chooseWhatToRelateTo() {
|
26 |
+
var productids = window.prompt("Enter the id's for products you'd like to relate the currently selected products to.\n" + "For example: Suppose you selected X, Y and Z. If you enter 'A,B' here, X will be\n" + "related to A and B, Y will be related to A and B, etc.\n" + "Separate multiple product ids by a comma as shown in the example above.", "<Enter product IDs (NOT SKUs!)>");
|
27 |
+
if (productids == "" || productids == null) {
|
28 |
+
return null
|
29 |
+
}
|
30 |
+
if (!window.confirm("Are you sure you'd like to one-way relate selected grid products to products (" + productids + ")")) {
|
31 |
+
return null
|
32 |
+
}
|
33 |
+
return productids;
|
34 |
+
}
|
35 |
+
|
36 |
+
function chooseWhatToCrossSellTo() {
|
37 |
+
var productids = window.prompt("Enter the id's for products you'd like to add as cross-sell to the currently selected products.\n" + "For example: Suppose you selected X, Y and Z. If you enter 'A,B' here, X will be\n" + "cross-sold to A and B, Y will be cross-sold with A and with B, etc.\n" + "Separate multiple product ids by a comma as shown in the example above.", "<Enter product IDs (NOT SKUs!)>");
|
38 |
+
if (productids == "" || productids == null) {
|
39 |
+
return null
|
40 |
+
}
|
41 |
+
if (!window.confirm("Are you sure you'd like to one-way cross-sell products (" + productids + ") to selected grid products?")) {
|
42 |
+
return null
|
43 |
+
}
|
44 |
+
return productids;
|
45 |
+
}
|
46 |
+
|
47 |
+
function chooseWhatToUpSellTo() {
|
48 |
+
var productids = window.prompt("Enter the id's for products you'd like to add as up-sells to the currently selected products.\n" + "For example: Suppose you selected X, Y and Z. If you enter 'A,B' here, A and B will be\n" + "up-sells of X , A and B will be up-sells of Y, etc.\n" + "Separate multiple product ids by a comma as shown in the example above.", "<Enter product IDs (NOT SKUs!)>");
|
49 |
+
if (productids == "" || productids == null) {
|
50 |
+
return null
|
51 |
+
}
|
52 |
+
if (!window.confirm("Are you sure you'd like add products (" + productids + ") to selected grid products up-sell?")) {
|
53 |
+
return null
|
54 |
+
}
|
55 |
+
return productids;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
function showSelectedImages(gridObj, checkedValues, imgTemplate) {
|
61 |
+
var matchCounter = 0;
|
62 |
+
gridObj.walkSelectedRows(function(ie) {
|
63 |
+
ie.getElementsBySelector('a').each(function(a) {
|
64 |
+
if (a.id == "imageurl") {
|
65 |
+
matchCounter++;
|
66 |
+
a.innerHTML = imgTemplate.replace("{imgurl}", a.getAttribute('url'));
|
67 |
+
}
|
68 |
+
});
|
69 |
+
});
|
70 |
+
if (matchCounter == 0) {
|
71 |
+
alert("Either there was no image column, or the image column could not be found");
|
72 |
+
}
|
73 |
+
return null;
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
function hideSelectedImages(gridObj, checkedValues) {
|
78 |
+
var matchCounter = 0;
|
79 |
+
gridObj.walkSelectedRows(function(ie) {
|
80 |
+
ie.getElementsBySelector('a').each(function(a) {
|
81 |
+
if (a.id == "imageurl") {
|
82 |
+
matchCounter++;
|
83 |
+
a.innerHTML = "@";
|
84 |
+
}
|
85 |
+
});
|
86 |
+
});
|
87 |
+
if (matchCounter == 0) {
|
88 |
+
alert("Either there was no image column, or the image column could not be found");
|
89 |
+
}
|
90 |
+
return null;
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
function openAllImages(gridObj, checkedValues) {
|
95 |
+
gridObj.walkSelectedRows(function(ie) {
|
96 |
+
ie.getElementsBySelector('a').each(function(a) {
|
97 |
+
if (a.id == "imageurl") {
|
98 |
+
window.open(a.getAttribute('url'));
|
99 |
+
}
|
100 |
+
});
|
101 |
+
}, 30);
|
102 |
+
return null;
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
function openAll(gridObj, checkedValues) {
|
107 |
+
gridObj.walkSelectedRows(function(ie) {
|
108 |
+
window.open(ie.id);
|
109 |
+
}, 20);
|
110 |
+
return null;
|
111 |
+
|
112 |
+
}
|
js/tbt/enhancedgrid/egsupplemental.js
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Sweet Tooth.
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
+
* versions in the future. If you wish to customize Magento for your
|
18 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
+
*
|
20 |
+
* @category Sweet Tooth
|
21 |
+
*
|
22 |
+
* @copyright Copyright (c) 2008-2011 Sweet Tooth (http://www.sweettoothrewards.com)
|
23 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
+
*/
|
25 |
+
|
26 |
+
//form tags to omit in NS6+:
|
27 |
+
var omitformtags = ["input", "textarea", "select"]
|
28 |
+
|
29 |
+
omitformtags = omitformtags.join("|")
|
30 |
+
|
31 |
+
function disableselect(e) {
|
32 |
+
if (omitformtags.indexOf(e.target.tagName.toLowerCase()) == -1)
|
33 |
+
return false
|
34 |
+
}
|
35 |
+
|
36 |
+
function reEnable() {
|
37 |
+
return true
|
38 |
+
}
|
39 |
+
|
40 |
+
var originalHighlighting = false;
|
41 |
+
|
42 |
+
function disableHighlighting() {
|
43 |
+
if (typeof document.onselectstart != "undefined") {
|
44 |
+
originalHighlighting = document.onselectstart;
|
45 |
+
document.onselectstart = new Function("return false")
|
46 |
+
} else {
|
47 |
+
originalHighlighting = {
|
48 |
+
down: document.onmousedown,
|
49 |
+
up: document.onmouseup
|
50 |
+
}
|
51 |
+
document.onmousedown = disableselect
|
52 |
+
document.onmouseup = reEnable
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
function enableHighlighting() {
|
57 |
+
if (typeof document.onselectstart != "undefined") {
|
58 |
+
document.onselectstart = originalHighlighting;
|
59 |
+
} else {
|
60 |
+
document.onmousedown = originalHighlighting.down;
|
61 |
+
document.onmouseup = originalHighlighting.up;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
function keyWasPressed(e, targetKeyNum) {
|
66 |
+
var keychar;
|
67 |
+
var numcheck;
|
68 |
+
|
69 |
+
if (window.event) // IE
|
70 |
+
{
|
71 |
+
keynum = e.keyCode;
|
72 |
+
} else if (e.which) // Netscape/Firefox/Opera
|
73 |
+
{
|
74 |
+
keynum = e.which;
|
75 |
+
}
|
76 |
+
if (keynum == targetKeyNum) return true;
|
77 |
+
return false;
|
78 |
+
}
|
js/tbt/enhancedgrid/enhancedgrid.js
ADDED
@@ -0,0 +1,391 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Sweet Tooth.
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* DISCLAIMER
|
15 |
+
*
|
16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
+
* versions in the future. If you wish to customize Magento for your
|
18 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
+
*
|
20 |
+
* @category Sweet Tooth
|
21 |
+
*
|
22 |
+
* @copyright Copyright (c) 2008-2011 Sweet Tooth (http://www.sweettoothrewards.com)
|
23 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
+
*/
|
25 |
+
|
26 |
+
varienGrid.prototype.initialize = function(containerId, url, pageVar, sortVar, dirVar, filterVar) {
|
27 |
+
this.containerId = containerId;
|
28 |
+
this.url = url;
|
29 |
+
this.pageVar = pageVar || false;
|
30 |
+
this.sortVar = sortVar || false;
|
31 |
+
this.dirVar = dirVar || false;
|
32 |
+
this.filterVar = filterVar || false;
|
33 |
+
this.tableSufix = '_table';
|
34 |
+
this.useAjax = false;
|
35 |
+
this.rowClickCallback = false;
|
36 |
+
this.checkboxCheckCallback = false;
|
37 |
+
this.preInitCallback = false;
|
38 |
+
this.initCallback = false;
|
39 |
+
this.initRowCallback = false;
|
40 |
+
this.doFilterCallback = false;
|
41 |
+
|
42 |
+
// muliselect row
|
43 |
+
this.selectedRowEvents = {};
|
44 |
+
this.doMultiSelect = false;
|
45 |
+
this.multiSelectFunction = function(events) {
|
46 |
+
this.onMultiSelect(events);
|
47 |
+
};
|
48 |
+
|
49 |
+
|
50 |
+
this.reloadParams = false;
|
51 |
+
|
52 |
+
this.trOnMouseOver = this.rowMouseOver.bindAsEventListener(this);
|
53 |
+
this.trOnMouseOut = this.rowMouseOut.bindAsEventListener(this);
|
54 |
+
this.trOnMouseUp = this.rowMouseUp.bindAsEventListener(this);
|
55 |
+
this.trOnMouseDown = this.rowMouseDown.bindAsEventListener(this);
|
56 |
+
this.trOnMouseMove = this.rowMouseMove.bindAsEventListener(this);
|
57 |
+
this.trOnClick = this.rowMouseClick.bindAsEventListener(this);
|
58 |
+
this.trOnDblClick = this.rowMouseDblClick.bindAsEventListener(this);
|
59 |
+
this.trOnKeyPress = this.keyPress.bindAsEventListener(this);
|
60 |
+
|
61 |
+
this.thLinkOnClick = this.doSort.bindAsEventListener(this);
|
62 |
+
this.initGrid();
|
63 |
+
};
|
64 |
+
|
65 |
+
|
66 |
+
varienGrid.prototype.initGrid = function() {
|
67 |
+
if (this.preInitCallback) {
|
68 |
+
this.preInitCallback(this);
|
69 |
+
}
|
70 |
+
if ($(this.containerId + this.tableSufix)) {
|
71 |
+
this.rows = $$('#' + this.containerId + this.tableSufix + ' tbody tr');
|
72 |
+
for (var row = 0; row < this.rows.length; row++) {
|
73 |
+
if (row % 2 == 0) {
|
74 |
+
Element.addClassName(this.rows[row], 'even');
|
75 |
+
}
|
76 |
+
Event.observe(this.rows[row], 'mouseover', this.trOnMouseOver);
|
77 |
+
Event.observe(this.rows[row], 'mouseout', this.trOnMouseOut);
|
78 |
+
Event.observe(this.rows[row], 'click', this.trOnClick);
|
79 |
+
Event.observe(this.rows[row], 'dblclick', this.trOnDblClick);
|
80 |
+
Event.observe(this.rows[row], 'mouseup', this.trOnMouseUp);
|
81 |
+
Event.observe(this.rows[row], 'mousedown', this.trOnMouseDown);
|
82 |
+
Event.observe(this.rows[row], 'mousemove', this.trOnMouseMove);
|
83 |
+
|
84 |
+
if (this.initRowCallback) {
|
85 |
+
try {
|
86 |
+
this.initRowCallback(this, this.rows[row]);
|
87 |
+
} catch (e) {
|
88 |
+
if (console) {
|
89 |
+
console.log(e);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
95 |
+
if (this.sortVar && this.dirVar) {
|
96 |
+
var columns = $$('#' + this.containerId + this.tableSufix + ' thead a');
|
97 |
+
|
98 |
+
for (var col = 0; col < columns.length; col++) {
|
99 |
+
Event.observe(columns[col], 'click', this.thLinkOnClick);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
this.bindFilterFields();
|
103 |
+
this.bindFieldsChange();
|
104 |
+
if (this.initCallback) {
|
105 |
+
try {
|
106 |
+
this.initCallback(this);
|
107 |
+
} catch (e) {
|
108 |
+
if (console) {
|
109 |
+
console.log(e);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
};
|
114 |
+
varienGrid.prototype.rowMouseOver = function(event) {
|
115 |
+
var element = Event.findElement(event, 'tr');
|
116 |
+
Element.addClassName(element, 'on-mouse');
|
117 |
+
|
118 |
+
if (!Element.hasClassName('pointer') && (this.rowClickCallback !== openGridRow || element.id)) {
|
119 |
+
Element.addClassName(element, 'pointer');
|
120 |
+
}
|
121 |
+
if (this.doMultiSelect) {
|
122 |
+
if (this.addMultiSelectedRow(event, element)) {
|
123 |
+
// row is already selected...
|
124 |
+
} else {
|
125 |
+
Element.addClassName(element, 'multiselect')
|
126 |
+
}
|
127 |
+
}
|
128 |
+
};
|
129 |
+
varienGrid.prototype.rowMouseMove = function(event) {};
|
130 |
+
varienGrid.prototype.addMultiSelectedRow = function(event, rowElement) {
|
131 |
+
var checkbox = this.findCheckbox(event);
|
132 |
+
var newId = checkbox.value;
|
133 |
+
if (this.selectedRowEvents[newId] != null) {
|
134 |
+
return false;
|
135 |
+
}
|
136 |
+
this.selectedRowEvents[newId] = {
|
137 |
+
event: event,
|
138 |
+
rowElement: rowElement,
|
139 |
+
checkbox: checkbox
|
140 |
+
};
|
141 |
+
};
|
142 |
+
varienGrid.prototype.findCheckbox = function(evt) {
|
143 |
+
if (['a', 'input', 'select'].indexOf(Event.element(evt).tagName.toLowerCase()) !== -1) {
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
checkbox = false;
|
147 |
+
Event.findElement(evt, 'tr').getElementsBySelector('input[type=checkbox]').each(function(element) {
|
148 |
+
checkbox = element;
|
149 |
+
}.bind(this));
|
150 |
+
return checkbox;
|
151 |
+
};
|
152 |
+
varienGrid.prototype.removeMultiSelectedRow = function(event, rowElement) {
|
153 |
+
if (this.selectedRowEvents[rowElement.id] != null) {
|
154 |
+
this.selectedRowEvents[rowElement.id] = null;
|
155 |
+
}
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
varienGrid.prototype.rowMouseUp = function(event) {
|
159 |
+
if (this.doMultiSelect) {
|
160 |
+
enableHighlighting();
|
161 |
+
this.doMultiSelect = false;
|
162 |
+
this.multiSelectFunction(this.selectedRowEvents);
|
163 |
+
}
|
164 |
+
};
|
165 |
+
varienGrid.prototype.rowMouseDown = function(event) {
|
166 |
+
if (event.ctrlKey) {
|
167 |
+
if (['a', 'input', 'select'].indexOf(Event.element(event).tagName.toLowerCase()) !== -1) {
|
168 |
+
return false;
|
169 |
+
}
|
170 |
+
disableHighlighting();
|
171 |
+
this.doMultiSelect = true;
|
172 |
+
this.selectedRowEvents = {};
|
173 |
+
// Add the row we just clicked on
|
174 |
+
var element = Event.findElement(event, 'tr');
|
175 |
+
this.addMultiSelectedRow(event, element);
|
176 |
+
Element.addClassName(element, 'multiselect')
|
177 |
+
}
|
178 |
+
}
|
179 |
+
varienGrid.prototype.rowMouseClick = function(event) {
|
180 |
+
if (this.doMultiSelect) {
|
181 |
+
this.doMultiSelect = false;
|
182 |
+
return;
|
183 |
+
}
|
184 |
+
if (event.ctrlKey) return;
|
185 |
+
|
186 |
+
if (this.rowClickCallback) {
|
187 |
+
try {
|
188 |
+
this.rowClickCallback(this, event);
|
189 |
+
} catch (e) {}
|
190 |
+
}
|
191 |
+
varienGlobalEvents.fireEvent('gridRowClick', event);
|
192 |
+
};
|
193 |
+
// Multiselect
|
194 |
+
varienGrid.prototype.onMultiSelect = function(events) {
|
195 |
+
for (rowid in events) {
|
196 |
+
var multiRowEvent = events[rowid];
|
197 |
+
var checkbox = multiRowEvent.checkbox;
|
198 |
+
this.setCheckboxChecked(checkbox, checkbox.checked ? false : true);
|
199 |
+
multiRowEvent.rowElement.blur();
|
200 |
+
Element.removeClassName(multiRowEvent.rowElement, 'multiselect');
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
|
205 |
+
varienGridMassaction.prototype.initialize = function(containerId, grid, checkedValues, formFieldNameInternal, formFieldName) {
|
206 |
+
// MAGE -- begin
|
207 |
+
this.setOldCallback('row_click', grid.rowClickCallback);
|
208 |
+
this.setOldCallback('init', grid.initCallback);
|
209 |
+
this.setOldCallback('init_row', grid.initRowCallback);
|
210 |
+
this.setOldCallback('pre_init', grid.preInitCallback);
|
211 |
+
|
212 |
+
this.useAjax = false;
|
213 |
+
this.grid = grid;
|
214 |
+
this.containerId = containerId;
|
215 |
+
this.initMassactionElements();
|
216 |
+
|
217 |
+
this.checkedString = checkedValues;
|
218 |
+
this.formFieldName = formFieldName;
|
219 |
+
this.formFieldNameInternal = formFieldNameInternal;
|
220 |
+
|
221 |
+
this.grid.initCallback = this.onGridInit.bind(this);
|
222 |
+
this.grid.preInitCallback = this.onGridPreInit.bind(this);
|
223 |
+
this.grid.initRowCallback = this.onGridRowInit.bind(this);
|
224 |
+
this.grid.rowClickCallback = this.onGridRowClick.bind(this);
|
225 |
+
this.initCheckboxes();
|
226 |
+
this.checkCheckboxes();
|
227 |
+
// MAGE -- end
|
228 |
+
|
229 |
+
// Magento ver < 1.16
|
230 |
+
if (typeof(varienStringArray) == 'undefined') {
|
231 |
+
this.mageIsLessThan116 = true;
|
232 |
+
}
|
233 |
+
|
234 |
+
// TBT -- enhanced grid -- begin
|
235 |
+
this.grid.multiSelectFunction = this.onMultiSelect.bind(this);
|
236 |
+
//this.selectedRows = false;
|
237 |
+
|
238 |
+
if (checkedValues != "") {
|
239 |
+
checkedValues.each(function(item) {
|
240 |
+
this.checkedValues[item] = item;
|
241 |
+
}.bind(this));
|
242 |
+
}
|
243 |
+
};
|
244 |
+
// Multiselect
|
245 |
+
varienGridMassaction.prototype.onMultiSelect = function(events) {
|
246 |
+
this.grid.onMultiSelect(events);
|
247 |
+
var checkValues = new Array();
|
248 |
+
var uncheckValues = new Array();
|
249 |
+
for (rowid in events) {
|
250 |
+
var checkVal = events[rowid].checkbox.value;
|
251 |
+
if (events[rowid].checkbox.checked) {
|
252 |
+
checkValues.push(checkVal);
|
253 |
+
if (!this.mageIsLessThan116)
|
254 |
+
this.checkedString = varienStringArray.add(checkVal, this.checkedString);
|
255 |
+
} else {
|
256 |
+
uncheckValues.push(checkVal);
|
257 |
+
if (!this.mageIsLessThan116)
|
258 |
+
this.checkedString = varienStringArray.remove(checkVal, this.checkedString);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
if (this.mageIsLessThan116) {
|
263 |
+
this.addCheckedValues(checkValues);
|
264 |
+
this.unsetCheckedValues(uncheckValues);
|
265 |
+
}
|
266 |
+
this.updateCount();
|
267 |
+
};
|
268 |
+
varienGridMassaction.prototype.apply = function() {
|
269 |
+
var item = this.getSelectedItem();
|
270 |
+
if (!item) {
|
271 |
+
this.validator.validate();
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
this.currentItem = item;
|
275 |
+
|
276 |
+
var fieldName = "";
|
277 |
+
if (item.field == undefined) {
|
278 |
+
fieldName = this.formFieldName
|
279 |
+
}
|
280 |
+
fieldName += '[]';
|
281 |
+
|
282 |
+
var fieldsHtml = '';
|
283 |
+
var callbackVal = null;
|
284 |
+
var multiFields = item.fields;
|
285 |
+
|
286 |
+
if (this.currentItem.callback) {
|
287 |
+
callbackVal = eval(this.currentItem.callback.replace("{checkedValues}", "'" + this.getCheckedValues() + "'"));
|
288 |
+
if (callbackVal == null) {
|
289 |
+
return;
|
290 |
+
}
|
291 |
+
|
292 |
+
var formCallbackVal = document.createElement('input');
|
293 |
+
formCallbackVal.type = "hidden";
|
294 |
+
formCallbackVal.value = callbackVal;
|
295 |
+
formCallbackVal.name = "callbackval";
|
296 |
+
this.form.appendChild(formCallbackVal);
|
297 |
+
}
|
298 |
+
|
299 |
+
if (this.currentItem.confirm && !window.confirm(this.currentItem.confirm)) {
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
|
303 |
+
/* Maybe in future
|
304 |
+
this.getOnlyExistsCheckedValues().each(function(item){
|
305 |
+
fieldsHtml += this.fieldTemplate.evaluate({name: fieldName, value: item});
|
306 |
+
}.bind(this)); */
|
307 |
+
|
308 |
+
// ENHANCED GRID BEGIN (MAGE END)
|
309 |
+
var itArray;
|
310 |
+
if (this.mageIsLessThan116) {
|
311 |
+
itArray = this.getCheckedValues();
|
312 |
+
} else {
|
313 |
+
itArray = this.getCheckedValues().split(",");
|
314 |
+
}
|
315 |
+
|
316 |
+
itArray.each(function(item) {
|
317 |
+
if (multiFields != null) {
|
318 |
+
for (var i = 0; i < multiFields.length; i++) {
|
319 |
+
fieldsHtml += this.fieldTemplate.evaluate({
|
320 |
+
name: multiFields[i] + '[]',
|
321 |
+
value: item
|
322 |
+
});
|
323 |
+
}
|
324 |
+
} else {
|
325 |
+
fieldsHtml += this.fieldTemplate.evaluate({
|
326 |
+
name: fieldName,
|
327 |
+
value: item
|
328 |
+
});
|
329 |
+
}
|
330 |
+
}.bind(this));
|
331 |
+
this.formHiddens.update(fieldsHtml);
|
332 |
+
|
333 |
+
// ENHANCED GRID END (MAGE BEGIN)
|
334 |
+
if (!this.validator.validate()) {
|
335 |
+
return;
|
336 |
+
}
|
337 |
+
|
338 |
+
|
339 |
+
if (this.useAjax && item.url) {
|
340 |
+
new Ajax.Request(item.url, {
|
341 |
+
'method': 'post',
|
342 |
+
'parameters': this.form.serialize(true),
|
343 |
+
'onComplete': this.onMassactionComplete.bind(this)
|
344 |
+
});
|
345 |
+
} else if (item.url) {
|
346 |
+
this.form.action = item.url;
|
347 |
+
this.form.submit();
|
348 |
+
}
|
349 |
+
};
|
350 |
+
varienGridMassaction.prototype.walkSelectedRows = function(walkFunction, warningLimit) {
|
351 |
+
if (warningLimit == undefined) warningLimit = 100;
|
352 |
+
var selectedRowCount = 0;
|
353 |
+
var abort = false;
|
354 |
+
this.grid.rows.each(function(ie) {
|
355 |
+
var rcheckboxs = ie.getElementsBySelector('input[type=checkbox]').each(function(chk) {
|
356 |
+
if (chk.checked) {
|
357 |
+
if (abort) return;
|
358 |
+
walkFunction(ie); //user function
|
359 |
+
|
360 |
+
// checks for abort.
|
361 |
+
selectedRowCount++;
|
362 |
+
if (selectedRowCount == warningLimit) {
|
363 |
+
if (!window.confirm("There are over 100 rows processing, should the script continue?")) {
|
364 |
+
abort = true;
|
365 |
+
}
|
366 |
+
}
|
367 |
+
}
|
368 |
+
});
|
369 |
+
});
|
370 |
+
}
|
371 |
+
varienGrid.prototype.doFilter = function() {
|
372 |
+
var filters = $$('#' + this.containerId + ' .filter input', '#' + this.containerId + ' .filter select');
|
373 |
+
var searchQry = $$('#' + this.containerId + ' .filter input', '#' + this.containerId + ' .filter select');
|
374 |
+
var elements = [];
|
375 |
+
for (var i in filters) {
|
376 |
+
if (filters[i].value && filters[i].value.length) elements.push(filters[i]);
|
377 |
+
}
|
378 |
+
if (!this.doFilterCallback || (this.doFilterCallback && this.doFilterCallback())) {
|
379 |
+
if ($$('input#enhancedGridSearchQry')[0] != undefined) {
|
380 |
+
this.addVarToUrl('q', $$('input#enhancedGridSearchQry')[0].value);
|
381 |
+
}
|
382 |
+
this.reload(this.addVarToUrl(this.filterVar, encode_base64(Form.serializeElements(elements))));
|
383 |
+
}
|
384 |
+
}
|
385 |
+
varienGrid.prototype.resetFilter = function() {
|
386 |
+
if ($$('input#enhancedGridSearchQry')[0] != undefined) {
|
387 |
+
this.addVarToUrl('q', '')
|
388 |
+
}
|
389 |
+
this.addVarToUrl(this.filterVar, '')
|
390 |
+
this.reload();
|
391 |
+
}
|
js/tbt/enhancedgrid/resources/css/enhancedgrid.css
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
|
2 |
+
.grid tr.multiselect, .grid tr.multiselect tr { background:#CCF0F0 !important; }
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TBT_Enhancedgrid</name>
|
4 |
-
<version>1.3.4.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.html"></license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,10 @@
|
|
9 |
<summary>Enhanced admin product grid with images, custom attributes and more.</summary>
|
10 |
<description>Improves the existing Magento admin product management grid. It adds some useful, customizable features to the admin product management grid including new columns and tools.</description>
|
11 |
<notes></notes>
|
12 |
-
<authors><author><name>Jay El-Kaake
|
13 |
-
<date>2015-11-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="TBT"><dir name="Enhancedgrid"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="Grid"><file name="Columns.php" hash="ce407ff5715c837d02b1aba7975bf512"/></dir><file name="Grid.php" hash="031bab0c15554ea1f7d332f7d35b612d"/></dir><file name="Product.php" hash="8e09794fe183ea3c3aeaa1f35962ce1d"/></dir><dir name="System"><file name="Html.php" hash="562392e86f9af01823bbd70c293fc21a"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Category.php" hash="0527c1d7ebdf57b934f714240ac5709a"/><file name="Image.php" hash="a8f34ac1a6734f351ef3654c48b0ac8e"/></dir><dir name="Renderer"><file name="Action.php" hash="f4986db21849c7413061e2906414fd37"/><file name="Category.php" hash="fe638de59898f21a6e4f60f81a03b050"/><file name="Image.php" hash="04662f3ad0b553c88fed6428e10673ec"/></dir></dir><file name="Column.php" hash="4b32c0942170f7b4028c7210de7da6aa"/></dir><file name="Loyalty.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>5.6.13</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TBT_Enhancedgrid</name>
|
4 |
+
<version>1.3.4.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.html"></license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Enhanced admin product grid with images, custom attributes and more.</summary>
|
10 |
<description>Improves the existing Magento admin product management grid. It adds some useful, customizable features to the admin product management grid including new columns and tools.</description>
|
11 |
<notes></notes>
|
12 |
+
<authors><author><name>Jay El-Kaake</name><user>jay</user><email>jay@sweettoothhq.com</email></author></authors>
|
13 |
+
<date>2015-11-25</date>
|
14 |
+
<time>18:07:05</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="TBT"><dir name="Enhancedgrid"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="Grid"><file name="Columns.php" hash="ce407ff5715c837d02b1aba7975bf512"/></dir><file name="Grid.php" hash="031bab0c15554ea1f7d332f7d35b612d"/></dir><file name="Product.php" hash="8e09794fe183ea3c3aeaa1f35962ce1d"/></dir><dir name="System"><file name="Html.php" hash="562392e86f9af01823bbd70c293fc21a"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Category.php" hash="0527c1d7ebdf57b934f714240ac5709a"/><file name="Image.php" hash="a8f34ac1a6734f351ef3654c48b0ac8e"/></dir><dir name="Renderer"><file name="Action.php" hash="f4986db21849c7413061e2906414fd37"/><file name="Category.php" hash="fe638de59898f21a6e4f60f81a03b050"/><file name="Image.php" hash="04662f3ad0b553c88fed6428e10673ec"/></dir></dir><file name="Column.php" hash="4b32c0942170f7b4028c7210de7da6aa"/></dir><file name="Loyalty.php" hash="550c3cc5822abc1d2ea67f69adc3893a"/></dir></dir><dir name="Helper"><file name="Data.php" hash="d0c2fb1491c4de5e1fc686f98ca8b632"/><file name="Version.php" hash="6300cd38e05192ca25cc72492f4060ea"/></dir><dir name="Model"><dir name="Collection"><dir name="Decorator"><file name="Abstract.php" hash="6222cd8d27550353ca7da2b5292d3c03"/></dir></dir><dir name="Product"><dir name="Collection"><dir name="Category"><file name="Decorator.php" hash="4fd5bfec3c35664329877e319d4516c5"/></dir></dir><dir name="Grid"><dir name="Settings"><file name="Columns.php" hash="52ab0edb646f9ccfd7ff4627faf28bce"/></dir></dir></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><file name="Collection.php" hash="167d3a637aee53e9ee65cd31ee638b7e"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Columns"><file name="Show.php" hash="b6fa3ef200816786cf03a856986d509a"/></dir><dir name="Sort"><file name="Direction.php" hash="a1e597d932df920bf86a437c5f74de83"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="5470da467d5e0fb369bc814066f5d4ea"/></dir></dir><dir name="etc"><file name="config.xml" hash="68e9eba03af198a4e2cc8e7edacf802d"/><file name="system.xml" hash="2d9d79616916912106a710c9237c0c9c"/></dir><dir name="sql"><dir name="enhancedgrid_setup"><file name="mysql4-install-1.0.0.0.php" hash="491b395307ec3951309a78262336e228"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TBT_Enhancedgrid.xml" hash="0654733936d12ab0c7532fcb5492a2dd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tbt_enhancedgrid.xml" hash="9a52b17e99764d9ab8336f5155eabf59"/></dir><dir name="template"><dir name="tbt"><dir name="enhancedgrid"><dir name="catalog"><dir name="product"><file name="grid.phtml" hash="8e39bb3abd59ef4ba12fdf4d725dda90"/></dir><file name="product.phtml" hash="70be6a474d09784b4b652f1dc2acac49"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="tbt"><dir name="enhancedgrid"><dir name="customfunctions"><file name="catalog_products.js" hash="d3079b19aa4382e674f68412c6150a6d"/></dir><file name="egsupplemental.js" hash="52e609cbc614051b0d00a97e54b12ca4"/><file name="enhancedgrid.js" hash="aca8060c0fcc1648763a510e80bb5376"/><dir name="resources"><dir name="css"><file name="enhancedgrid.css" hash="a219b0e656329f2407835dbe346f81d3"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.3.0</min><max>5.6.13</max></php></required></dependencies>
|
18 |
</package>
|