Attached Files |
inline_group_selector_core.patch [^] (4,915 bytes) 2010-05-19 10:58
[Show Content]
Index: admin_templates/categories/categories_edit_permissions.tpl
===================================================================
--- admin_templates/categories/categories_edit_permissions.tpl (revision 13571)
+++ admin_templates/categories/categories_edit_permissions.tpl (working copy)
@@ -17,22 +17,15 @@
Request.progressText = '<inp2:m_phrase name="la_title_Loading" no_editing="1" escape="1"/>';
Catalog.prototype.AfterInit = function () {
- Grids['g'].SelectFirst();
+ $('#current_group_id').change();
}
Catalog.prototype.go_to_group = function($group_id) {
- if (!isset($group_id)) {
- $group_id = 0; // gets current group
- }
- else {
- set_hidden_field('current_group_id', $group_id);
- }
-
this.switchTab(); // refresh current item tab
}
Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
- var $group_id = get_hidden_field('current_group_id');
+ var $group_id = $('#current_group_id').val();
// alert('refreshTab. GroupID: '+$group_id);
var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
if ($group_id != $tab_group_id || $force) {
@@ -121,9 +114,32 @@
</table>
<inp2:c_SaveWarning name="grid_save_warning"/>
-<inp2:m_RenderElement name="grid" PrefixSpecial="g" IdField="GroupId" per_page="-1" grid="Radio" header_block="grid_column_title_no_sorting" grid_height="220" grid_status="0"/>
-<br />
+<div id="scroll_container" mode="minimal">
+ <table class="edit-form" style="border-bottom: 1px solid black;">
+ <inp2:m_RenderElement name="subsection" title="la_section_General"/>
+ <tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
+ <td class="label-cell">
+ <inp2:m_Phrase name="la_fld_Group"/>:
+ </td>
+ <td class="control-mid"> </td>
+ <td class="control-cell">
+ <select name="current_group_id" id="current_group_id">
+ <inp2:m_DefineElement name="group_element">
+ <option value="<inp2:Field name='GroupId'/>"><inp2:Field name="Name"/></option>
+ </inp2:m_DefineElement>
+
+ <inp2:g_PrintList render_as="group_element" per_page="-1"/>
+ </select>
+ </td>
+ </tr>
+
+ <inp2:m_RenderElement name="inp_edit_filler"/>
+ </table>
+</div>
+
+<br/>
+
<!-- item tabs: begin -->
<inp2:m_DefineElement name="item_tab" title="" special="">
<td class="tab-spacer"><img src="img/spacer.gif" width="3" height="1"/></td>
@@ -147,23 +163,8 @@
<inp2:m_include t="incs/footer"/>
<script type="text/javascript">
- Grids['g'].OnSelect = function ($id) {
- $PermManager.go_to_group($id);
- }
+ var $last_group_id = false;
- Grids['g'].OnUnSelect = function ($id) {
- set_hidden_field('group_id', $id);
- set_hidden_field('item_prefix', $PermManager.ActivePrefix);
- $PermManager.submit_event('c', 'OnPreSave', 'categories/permissions_tab');
- }
-
- Grids['g'].SelectFirst = function () {
- for (var $i in this.Items) {
- this.Items[$i].Select();
- break;
- }
- }
-
function update_light(perm_name, value)
{
document.getElementById('light_'+perm_name).src = 'img/perm_' + (value ? 'green' : 'red') + '.gif';
@@ -183,6 +184,28 @@
$(document).ready(
function() {
+ // last selected group
+ set_hidden_field('group_id', $('#current_group_id').val());
+
+ $('#current_group_id').change(
+ function ($e) {
+ var $group_id = $(this).val();
+
+ if ($last_group_id !== false) {
+ // save permissions from previous selected group
+ set_hidden_field('group_id', $last_group_id);
+ set_hidden_field('item_prefix', $PermManager.ActivePrefix);
+ $PermManager.submit_event('c', 'OnPreSave', 'categories/permissions_tab');
+ }
+
+ // get permissions from new group
+ $PermManager.go_to_group($group_id);
+
+ // remember previous selected group
+ $last_group_id = $group_id;
+ }
+ );
+
$PermManager.Init(false);
}
);
Index: units/permissions/permissions_event_handler.php
===================================================================
--- units/permissions/permissions_event_handler.php (revision 13571)
+++ units/permissions/permissions_event_handler.php (working copy)
@@ -36,7 +36,7 @@
*/
function OnCategorySavePermissions(&$event)
{
- $group_id = $this->Application->GetVar('current_group_id');
+ $group_id = $this->Application->GetVar('group_id');
$category_id = $this->Application->GetVar('c_id');
$permissions = $this->Application->GetVar($event->getPrefixSpecial(true));
if (isset($permissions[$group_id])) {
@@ -89,7 +89,7 @@
}
$event->MasterEvent->SetRedirectParam('item_prefix', $this->Application->GetVar('item_prefix'));
- $event->MasterEvent->SetRedirectParam('group_id', $this->Application->GetVar('group_id'));
+ $event->MasterEvent->SetRedirectParam('group_id', $this->Application->GetVar('current_group_id'));
}
/**
inline_group_selector_modules.patch [^] (4,132 bytes) 2010-05-19 10:58
[Show Content]
Index: admin_templates/products/products_pricing.tpl
===================================================================
--- admin_templates/products/products_pricing.tpl (revision 13571)
+++ admin_templates/products/products_pricing.tpl (working copy)
@@ -13,24 +13,19 @@
<script type="text/javascript">
Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
- var defaultGroup = <inp2:conf_ConfigValue name="User_LoggedInGroup"/>;
+ Catalog.prototype.AfterInit = function () {
+ var $default_group = <inp2:conf_ConfigValue name="User_LoggedInGroup"/>;
- Catalog.prototype.AfterInit = function () {
- Grids['g'].SelectDefault(defaultGroup);
+ set_hidden_field('group_id', $default_group);
+ $('#current_group_id').val($default_group).change();
}
Catalog.prototype.go_to_group = function($group_id) {
- if (!isset($group_id)) {
- $group_id = 0; // gets current group
- }
- else {
- set_hidden_field('current_group_id', $group_id);
- }
this.refreshTab('pr.tang', 'pr.tang_div');
}
Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
- var $group_id = get_hidden_field('current_group_id');
+ var $group_id = $('#current_group_id').val();
var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
if ($group_id != $tab_group_id || $force) {
// query tab content only in case if not queried or category don't match
@@ -183,37 +178,58 @@
<inp2:pr.tang_SaveWarning name="grid_save_warning"/>
-<inp2:m_RenderElement name="grid" PrefixSpecial="g" IdField="GroupId" per_page="-1" grid="Radio" header_block="grid_column_title_no_sorting" grid_height="220" grid_status="0"/>
+<div id="scroll_container" mode="minimal">
+ <table class="edit-form" style="border-bottom: 1px solid black;">
+ <inp2:m_RenderElement name="subsection" title="la_section_General"/>
+ <tr class="<inp2:m_odd_even odd='edit-form-odd' even='edit-form-even'/>">
+ <td class="label-cell">
+ <inp2:m_Phrase name="la_fld_Group"/>:
+ </td>
+ <td class="control-mid"> </td>
+ <td class="control-cell">
+ <select name="current_group_id" id="current_group_id">
+ <inp2:m_DefineElement name="group_element">
+ <option value="<inp2:Field name='GroupId'/>"><inp2:Field name="Name"/></option>
+ </inp2:m_DefineElement>
+ <inp2:g_PrintList render_as="group_element" per_page="-1"/>
+ </select>
+ </td>
+ </tr>
+
+ <inp2:m_RenderElement name="inp_edit_filler"/>
+ </table>
+</div>
+
<inp2:m_include t="in-commerce/products/products_pricing_grid" tab_init="1" item_prefix="pr.tang"/>
<inp2:m_include t="incs/footer"/>
<script type="text/javascript">
- Grids['g'].OnSelect = function ($id) {
- set_hidden_field('group_id', $id);
- $BracketManager.go_to_group($id);
+ var $last_group_id = false;
- }
+ $(document).ready(
+ function() {
+ $('#current_group_id').change(
+ function ($e) {
+ var $group_id = $(this).val();
- Grids['g'].OnUnSelect = function ($id) {
- set_hidden_field('group_id', $id);
- set_hidden_field('item_prefix', $BracketManager.ActivePrefix);
- $BracketManager.submit_event('pr.tang', 'OnArrange', 'in-commerce/products/products_pricing_grid', false);
+ if ($last_group_id !== false) {
+ // save pricings from previous selected group
+ set_hidden_field('group_id', $last_group_id);
+ set_hidden_field('item_prefix', $BracketManager.ActivePrefix);
+ $BracketManager.submit_event('pr.tang', 'OnArrange', 'in-commerce/products/products_pricing_grid', false);
+ }
- }
+ // get prices from new group
+ set_hidden_field('group_id', $group_id);
+ $BracketManager.go_to_group($group_id);
- Grids['g'].SelectDefault = function (group_id) {
- for (var $i in this.Items) {
- if (this.Items[$i].ItemId == group_id){
- this.Items[$i].Select();
- break;
- }
- }
- }
+ // remember previous selected group
+ $last_group_id = $group_id;
+ }
+ );
- $(document).ready(
- function() {
$BracketManager.Init(false);
}
);
|