Browse files

Allow dynamic Application parameters to be used with the DataTable (f…

…ixes

multiple page set levels within the same Application (ie, Countries->Zones))

original commit hpdl: 6caf922

Signed-off-by: Gergely <t-gely@freemail.hu>
  • Loading branch information...
1 parent cb55bd9 commit 94c901cef562688a366200ae95900688d87ad91a @tgely committed Aug 6, 2010
Showing with 93 additions and 104 deletions.
  1. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Administrators/pages/main.php
  2. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/entries.php
  3. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/main.php
  4. +6 −7 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/main.php
  5. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones.php
  6. +5 −6 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/main.php
  7. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/main.php
  8. +5 −6 osCommerce/OM/Core/Site/Admin/Application/ErrorLog/pages/main.php
  9. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/definitions.php
  10. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/groups.php
  11. +5 −6 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/main.php
  12. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Controller.php
  13. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/PaymentModules.php
  14. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/RPC.php
  15. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/edit.php
  16. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/install.php
  17. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/main.php
  18. +1 −1 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/uninstall.php
  19. +5 −6 osCommerce/OM/Core/Site/Admin/Application/TaxClasses/pages/entries.php
  20. +5 −6 osCommerce/OM/Core/Site/Admin/Application/TaxClasses/pages/main.php
  21. +5 −6 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries.php
  22. +5 −6 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/main.php
  23. +10 −6 public/sites/Admin/javascript/datatable.js
View
11 osCommerce/OM/Core/Site/Admin/Application/Administrators/pages/main.php
@@ -58,16 +58,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'administratorsDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/entries.php
@@ -59,16 +59,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'entries_page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'configurationDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/Configuration/pages/main.php
@@ -53,16 +53,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'configurationDataTable';
View
13 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/main.php
@@ -60,16 +60,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'countryDataTable';
@@ -108,7 +107,7 @@ function feedDataTable(data) {
newCell.innerHTML = countryLinkIcon + '&nbsp;<a href="' + countryLink.replace('COUNTRYID', parseInt(record.countries_id)) + '" class="parent">' + htmlSpecialChars(record.countries_name) + '</a><span style="float: right;">(' + parseInt(record.total_zones) + ')</span>';
newCell = newRow.insertCell(1);
- newCell.innerHTML = countryFlag.replace('COUNTRYISOCODE2', htmlSpecialChars(record.countries_iso_code_2).toLowerCase()).replace('COUNTRYNAME', htmlSpecialChars(record.countries_name)).replace('COUNTRYNAME', htmlSpecialChars(record.countries_name));
+ newCell.innerHTML = countryFlag.replace('COUNTRYISOCODE2', htmlSpecialChars(record.countries_iso_code_2.toLowerCase())).replace('COUNTRYNAME', htmlSpecialChars(record.countries_name)).replace('COUNTRYNAME', htmlSpecialChars(record.countries_name));
newCell = newRow.insertCell(2);
newCell.innerHTML = htmlSpecialChars(record.countries_iso_code_2) + '&nbsp;&nbsp;&nbsp;&nbsp;' + htmlSpecialChars(record.countries_iso_code_3);
View
11 osCommerce/OM/Core/Site/Admin/Application/Countries/pages/zones.php
@@ -59,16 +59,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule + '_zones';
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'zones_page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'countryZonesDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/CreditCards/pages/main.php
@@ -59,16 +59,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'ccDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/Currencies/pages/main.php
@@ -60,16 +60,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'currenciesDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/ErrorLog/pages/main.php
@@ -52,16 +52,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'errorLogDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/definitions.php
@@ -59,16 +59,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule + '_definitions';
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'definitions_page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'defsDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/groups.php
@@ -52,16 +52,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule + '_groups';
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'groups_page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'langDefGroupDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/Languages/pages/main.php
@@ -60,16 +60,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'langDataTable';
View
2 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/Controller.php
@@ -25,4 +25,4 @@ protected function process() {
$this->_page_title = OSCOM::getDef('heading_title');
}
}
-?>
+?>
View
2 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/PaymentModules.php
@@ -212,4 +212,4 @@ public static function uninstall($module) {
return false;
}
}
-?>
+?>
View
2 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/RPC.php
@@ -45,4 +45,4 @@ public static function getUninstalled() {
echo json_encode($result);
}
}
-?>
+?>
View
2 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/edit.php
@@ -59,4 +59,4 @@
<p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'check', 'title' => OSCOM::getDef('button_save'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
-</div>
+</div>
View
2 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/install.php
@@ -97,4 +97,4 @@ function feedDataTable(data) {
rowCounter++;
}
}
-</script>
+</script>
View
2 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/main.php
@@ -108,4 +108,4 @@ function feedDataTable(data) {
rowCounter++;
}
}
-</script>
+</script>
View
2 osCommerce/OM/Core/Site/Admin/Application/PaymentModules/pages/uninstall.php
@@ -35,4 +35,4 @@
<p><?php echo osc_draw_button(array('priority' => 'primary', 'icon' => 'trash', 'title' => OSCOM::getDef('button_uninstall'))) . ' ' . osc_draw_button(array('href' => OSCOM::getLink(), 'priority' => 'secondary', 'icon' => 'close', 'title' => OSCOM::getDef('button_cancel'))); ?></p>
</form>
-</div>
+</div>
View
11 osCommerce/OM/Core/Site/Admin/Application/TaxClasses/pages/entries.php
@@ -60,16 +60,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'entries_page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'taxClassEntriesDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/TaxClasses/pages/main.php
@@ -58,16 +58,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'taxClassDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries.php
@@ -59,16 +59,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'entries_page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'zoneGroupEntriesDataTable';
View
11 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/main.php
@@ -58,16 +58,15 @@
</div>
<script type="text/javascript">
- var moduleParamsCookieName = 'oscadmin_module_' + pageModule;
+ var moduleParamsCookieName = 'oscom_admin_' + pageModule;
+ var dataTablePageSetName = 'page';
var moduleParams = new Object();
- moduleParams.page = 1;
- moduleParams.search = '';
+ moduleParams[dataTablePageSetName] = 1;
+ moduleParams['search'] = '';
if ( $.cookie(moduleParamsCookieName) != null ) {
- var p = $.secureEvalJSON($.cookie(moduleParamsCookieName));
- moduleParams.page = parseInt(p.page);
- moduleParams.search = String(p.search);
+ moduleParams = $.secureEvalJSON($.cookie(moduleParamsCookieName));
}
var dataTableName = 'zoneGroupsDataTable';
View
16 public/sites/Admin/javascript/datatable.js
@@ -13,7 +13,11 @@ var batchPages = 1;
var osC_DataTable = function() {
var initialized = false;
- batchCurrentPage = moduleParams.page;
+ if ( moduleParams[dataTablePageSetName] == null ) {
+ moduleParams[dataTablePageSetName] = 1;
+ }
+
+ batchCurrentPage = moduleParams[dataTablePageSetName];
var batchTotalRecords = 0;
var batchFrom = 0;
var batchTo = 0;
@@ -24,7 +28,7 @@ var osC_DataTable = function() {
$('#batchPageLinks').html(batchIconNavigationBackGrey + '&nbsp;' + batchIconNavigationForwardGrey);
$('#batchPullDownMenu').html(batchCurrentPageset.sprintf(1, 1));
- $('#liveSearchField').val(moduleParams.search);
+ $('#liveSearchField').val(moduleParams['search']);
$('#liveSearchField').keyup( function(e) {
var t = this;
@@ -63,19 +67,19 @@ var osC_DataTable = function() {
}
if (page == undefined) {
- page = moduleParams.page;
+ page = moduleParams[dataTablePageSetName];
}
if (search == undefined) {
- search = moduleParams.search;
+ search = moduleParams['search'];
}
page = parseInt(page);
search = String(search);
- moduleParams.page = page;
+ moduleParams[dataTablePageSetName] = page;
batchCurrentPage = page;
- moduleParams.search = search;
+ moduleParams['search'] = search;
$('#batchTotalPages').html(batchIconProgress + '&nbsp;Loading...');

0 comments on commit 94c901c

Please sign in to comment.