Index: trunk/core/admin_templates/categories/images_edit.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/categories/images_edit.tpl (revision 0) +++ trunk/core/admin_templates/categories/images_edit.tpl (revision 5319) @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + +
+ + + + \ No newline at end of file Index: trunk/core/admin_templates/categories/categories_edit_permissions.tpl =================================================================== diff -u -N -r5304 -r5319 --- trunk/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5304) +++ trunk/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5319) @@ -73,7 +73,7 @@ this.submit_kernel_form($tab_id); } - var $PermManager = new Catalog('', 'permmanager_'); + var $PermManager = new Catalog('', 'permmanager_'); a_toolbar = new ToolBar(); a_toolbar.AddButton( new ToolBarButton('select', '', function() { Index: trunk/kernel/admin_templates/incs/image_blocks.tpl =================================================================== diff -u -N -r1566 -r5319 --- trunk/kernel/admin_templates/incs/image_blocks.tpl (.../image_blocks.tpl) (revision 1566) +++ trunk/kernel/admin_templates/incs/image_blocks.tpl (.../image_blocks.tpl) (revision 5319) @@ -1,5 +1,152 @@ - - " border="0" />
+ + " border="0" />
+
+ + + "> + +
+   + + + + + + + + + + + + + +
+ + checked name="" id="_1" value="1"> + + : + + + " id="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalThumb]_1').checked = true"> + [upload]" id="[upload]" value=""> +
+ + checked name="" id="_0" value="0"> + + : + + + " id="" value="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalThumb]_0').checked = true"> +
+ + + + + +
+ + + "> + +
+   + + + + + + + + + + + + + +
+ + checked name="" id="_1" value="1"> + + : + + + " id="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalImage]_1').checked = true"> + [upload]" id="[upload]" value=""> +
+ + checked name="" id="_0" value="0"> + + : + + + " id="" value="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalImage]_0').checked = true"> +
+ + + + + +
+ + + function FieldID($field_name) { + var $field_mask = ''; + return $field_mask.replace('#FIELD#', $field_name); + } + + function toggle_fullsize() { + if (document.getElementById('_cb_' + FieldID('SameImages')).checked) { + document.getElementById(FieldID('LocalImage') + '_0').disabled = true; + document.getElementById(FieldID('LocalImage') + '_1').disabled = true; + document.getElementById(FieldID('LocalPath')).disabled = true; + document.getElementById(FieldID('Url')).disabled = true; + } + else { + document.getElementById(FieldID('LocalImage') + '_0').disabled = false; + document.getElementById(FieldID('LocalImage') + '_1').disabled = false; + document.getElementById(FieldID('LocalPath')).disabled = false; + document.getElementById(FieldID('Url')).disabled = false; + } + } + + if (document.getElementById('_cb_' + FieldID('DefaultImg')).checked) { + document.getElementById('_cb_' + FieldID('DefaultImg')).disabled = true; + document.getElementById('_cb_' + FieldID('Enabled')).disabled = true; + } + + function check_status() { + if (document.getElementById('_cb_' + FieldID('DefaultImg')).checked) { + document.getElementById('_cb_' + FieldID('Enabled')).checked = true; + document.getElementById(FieldID('Enabled')).value = 1; + } + } + + function check_primary() { + if (!document.getElementById('_cb_' + FieldID('Enabled')).checked) { + document.getElementById('_cb_' + FieldID('DefaultImg')).checked = false; + document.getElementById(FieldID('DefaultImg')).value = 0; + } + } + + + + + " id=""> + img/itemicons/"> + + + + + + + + + + + + + + Index: trunk/kernel/admin_templates/categories/images_edit.tpl =================================================================== diff -u -N --- trunk/kernel/admin_templates/categories/images_edit.tpl (revision 0) +++ trunk/kernel/admin_templates/categories/images_edit.tpl (revision 5319) @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + +
+ + + + \ No newline at end of file Index: trunk/kernel/units/permissions/permissions_tag_processor.php =================================================================== diff -u -N -r5304 -r5319 --- trunk/kernel/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 5304) +++ trunk/kernel/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 5319) @@ -59,13 +59,57 @@ function PrintPermissions($params) { + $category =& $this->Application->recallObject('c'); + $group_id = $this->Application->GetVar('group_id'); $prefix = $this->Application->GetVar('item_prefix'); - $module = $this->Application->findModule('Var', $prefix, 'Name'); - $sql = 'SELECT * - FROM '.TABLE_PREFIX.'PermissionConfig + $perm_live_table = $this->Application->getUnitOption('c-perm', 'TableName'); + $perm_temp_table = $this->Application->GetTempName($perm_live_table); + + $categories = explode('|', substr($category->GetDBField('ParentPath'), 1, -1)); + + // get permission name + category position in parent path that has value set for that permission + $case = 'MAX(CASE c.CategoryId'; + foreach ($categories as $pos => $cat_id) { + $case .= ' WHEN '.$cat_id.' THEN '.$pos; + } + $case .= ' END) AS InheritedPosition'; + $sql = 'SELECT '.$case.', IF(tmp_p.Permission IS NOT NULL, tmp_p.Permission, p.Permission) AS Perm + FROM '.TABLE_PREFIX.'Category c + LEFT JOIN '.$perm_live_table.' p ON p.CatId = c.CategoryId + LEFT JOIN '.TABLE_PREFIX.'PermissionConfig pc ON pc.PermissionName = p.Permission + LEFT JOIN '.$perm_temp_table.' tmp_p ON tmp_p.CatId = c.CategoryId + WHERE + CategoryId IN ('.implode(',', $categories).') AND + ModuleId = "'.$module.'" AND + ( + (p.GroupId = '.$group_id.' AND p.Type = 0) + OR + (tmp_p.GroupId = '.$group_id.' AND tmp_p.Type = 0) + ) + GROUP BY Perm'; + $perm_positions = $this->Conn->GetCol($sql, 'Perm'); + + $pos_sql = ''; + foreach ($perm_positions as $perm_name => $category_pos) { + $pos_sql .= '(#TABLE_PREFIX#.Permission = "'.$perm_name.'" AND #TABLE_PREFIX#.CatId = '.$categories[$category_pos].') OR '; + } + $pos_sql = preg_replace('/(.*) OR $/', '\\1', $pos_sql); + + // get all permissions list with iheritence status, inherited category id and permission value + $sql = 'SELECT pc.PermissionName, + pc.Description, + IF (tmp_p.PermissionValue IS NULL AND p.PermissionValue IS NULL, + 0, + IF (tmp_p.PermissionValue IS NOT NULL, tmp_p.PermissionValue, p.PermissionValue) + ) AS Value, + IF (tmp_p.CatId IS NOT NULL, tmp_p.CatId, IF(p.CatId IS NOT NULL, p.CatId, 0) ) AS InheritedFrom, + IF(tmp_p.CatId = '.$category->GetID().', 0, 1) AS Inherited + FROM '.TABLE_PREFIX.'PermissionConfig pc + LEFT JOIN '.$perm_live_table.' p ON (p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'p', $pos_sql).') AND (p.GroupId = '.$group_id.') + LEFT JOIN '.$perm_temp_table.' tmp_p ON (tmp_p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'tmp_p', $pos_sql).') AND (tmp_p.GroupId = '.$group_id.') WHERE ModuleId = "'.$module.'"'; $permissions = $this->Conn->Query($sql); Index: trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl =================================================================== diff -u -N -r5304 -r5319 --- trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5304) +++ trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5319) @@ -73,7 +73,7 @@ this.submit_kernel_form($tab_id); } - var $PermManager = new Catalog('', 'permmanager_'); + var $PermManager = new Catalog('', 'permmanager_'); a_toolbar = new ToolBar(); a_toolbar.AddButton( new ToolBarButton('select', '', function() { Index: trunk/core/admin_templates/incs/image_blocks.tpl =================================================================== diff -u -N -r1566 -r5319 --- trunk/core/admin_templates/incs/image_blocks.tpl (.../image_blocks.tpl) (revision 1566) +++ trunk/core/admin_templates/incs/image_blocks.tpl (.../image_blocks.tpl) (revision 5319) @@ -1,5 +1,152 @@ - - " border="0" />
+ + " border="0" />
+
+ + + "> + +
+   + + + + + + + + + + + + + +
+ + checked name="" id="_1" value="1"> + + : + + + " id="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalThumb]_1').checked = true"> + [upload]" id="[upload]" value=""> +
+ + checked name="" id="_0" value="0"> + + : + + + " id="" value="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalThumb]_0').checked = true"> +
+ + + + + +
+ + + "> + +
+   + + + + + + + + + + + + + +
+ + checked name="" id="_1" value="1"> + + : + + + " id="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalImage]_1').checked = true"> + [upload]" id="[upload]" value=""> +
+ + checked name="" id="_0" value="0"> + + : + + + " id="" value="" tabindex="" size="" class="" onclick="document.getElementById('[][LocalImage]_0').checked = true"> +
+ + + + + +
+ + + function FieldID($field_name) { + var $field_mask = ''; + return $field_mask.replace('#FIELD#', $field_name); + } + + function toggle_fullsize() { + if (document.getElementById('_cb_' + FieldID('SameImages')).checked) { + document.getElementById(FieldID('LocalImage') + '_0').disabled = true; + document.getElementById(FieldID('LocalImage') + '_1').disabled = true; + document.getElementById(FieldID('LocalPath')).disabled = true; + document.getElementById(FieldID('Url')).disabled = true; + } + else { + document.getElementById(FieldID('LocalImage') + '_0').disabled = false; + document.getElementById(FieldID('LocalImage') + '_1').disabled = false; + document.getElementById(FieldID('LocalPath')).disabled = false; + document.getElementById(FieldID('Url')).disabled = false; + } + } + + if (document.getElementById('_cb_' + FieldID('DefaultImg')).checked) { + document.getElementById('_cb_' + FieldID('DefaultImg')).disabled = true; + document.getElementById('_cb_' + FieldID('Enabled')).disabled = true; + } + + function check_status() { + if (document.getElementById('_cb_' + FieldID('DefaultImg')).checked) { + document.getElementById('_cb_' + FieldID('Enabled')).checked = true; + document.getElementById(FieldID('Enabled')).value = 1; + } + } + + function check_primary() { + if (!document.getElementById('_cb_' + FieldID('Enabled')).checked) { + document.getElementById('_cb_' + FieldID('DefaultImg')).checked = false; + document.getElementById(FieldID('DefaultImg')).value = 0; + } + } + + + + + " id=""> + img/itemicons/"> + + + + + + + + + + + + + + Index: trunk/core/units/permissions/permissions_tag_processor.php =================================================================== diff -u -N -r5304 -r5319 --- trunk/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 5304) +++ trunk/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 5319) @@ -59,13 +59,57 @@ function PrintPermissions($params) { + $category =& $this->Application->recallObject('c'); + $group_id = $this->Application->GetVar('group_id'); $prefix = $this->Application->GetVar('item_prefix'); - $module = $this->Application->findModule('Var', $prefix, 'Name'); - $sql = 'SELECT * - FROM '.TABLE_PREFIX.'PermissionConfig + $perm_live_table = $this->Application->getUnitOption('c-perm', 'TableName'); + $perm_temp_table = $this->Application->GetTempName($perm_live_table); + + $categories = explode('|', substr($category->GetDBField('ParentPath'), 1, -1)); + + // get permission name + category position in parent path that has value set for that permission + $case = 'MAX(CASE c.CategoryId'; + foreach ($categories as $pos => $cat_id) { + $case .= ' WHEN '.$cat_id.' THEN '.$pos; + } + $case .= ' END) AS InheritedPosition'; + $sql = 'SELECT '.$case.', IF(tmp_p.Permission IS NOT NULL, tmp_p.Permission, p.Permission) AS Perm + FROM '.TABLE_PREFIX.'Category c + LEFT JOIN '.$perm_live_table.' p ON p.CatId = c.CategoryId + LEFT JOIN '.TABLE_PREFIX.'PermissionConfig pc ON pc.PermissionName = p.Permission + LEFT JOIN '.$perm_temp_table.' tmp_p ON tmp_p.CatId = c.CategoryId + WHERE + CategoryId IN ('.implode(',', $categories).') AND + ModuleId = "'.$module.'" AND + ( + (p.GroupId = '.$group_id.' AND p.Type = 0) + OR + (tmp_p.GroupId = '.$group_id.' AND tmp_p.Type = 0) + ) + GROUP BY Perm'; + $perm_positions = $this->Conn->GetCol($sql, 'Perm'); + + $pos_sql = ''; + foreach ($perm_positions as $perm_name => $category_pos) { + $pos_sql .= '(#TABLE_PREFIX#.Permission = "'.$perm_name.'" AND #TABLE_PREFIX#.CatId = '.$categories[$category_pos].') OR '; + } + $pos_sql = preg_replace('/(.*) OR $/', '\\1', $pos_sql); + + // get all permissions list with iheritence status, inherited category id and permission value + $sql = 'SELECT pc.PermissionName, + pc.Description, + IF (tmp_p.PermissionValue IS NULL AND p.PermissionValue IS NULL, + 0, + IF (tmp_p.PermissionValue IS NOT NULL, tmp_p.PermissionValue, p.PermissionValue) + ) AS Value, + IF (tmp_p.CatId IS NOT NULL, tmp_p.CatId, IF(p.CatId IS NOT NULL, p.CatId, 0) ) AS InheritedFrom, + IF(tmp_p.CatId = '.$category->GetID().', 0, 1) AS Inherited + FROM '.TABLE_PREFIX.'PermissionConfig pc + LEFT JOIN '.$perm_live_table.' p ON (p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'p', $pos_sql).') AND (p.GroupId = '.$group_id.') + LEFT JOIN '.$perm_temp_table.' tmp_p ON (tmp_p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'tmp_p', $pos_sql).') AND (tmp_p.GroupId = '.$group_id.') WHERE ModuleId = "'.$module.'"'; $permissions = $this->Conn->Query($sql); Index: trunk/kernel/admin_templates/categories/categories_edit_images.tpl =================================================================== diff -u -N --- trunk/kernel/admin_templates/categories/categories_edit_images.tpl (revision 0) +++ trunk/kernel/admin_templates/categories/categories_edit_images.tpl (revision 5319) @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + \ No newline at end of file Index: trunk/core/admin_templates/categories/categories_edit_images.tpl =================================================================== diff -u -N --- trunk/core/admin_templates/categories/categories_edit_images.tpl (revision 0) +++ trunk/core/admin_templates/categories/categories_edit_images.tpl (revision 5319) @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + \ No newline at end of file