Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Thu, Nov 20, 9:20 PM

in-portal

Index: trunk/kernel/units/permissions/permissions_tag_processor.php
===================================================================
--- trunk/kernel/units/permissions/permissions_tag_processor.php (revision 5318)
+++ trunk/kernel/units/permissions/permissions_tag_processor.php (revision 5319)
@@ -1,100 +1,144 @@
<?php
class PermissionsTagProcessor extends kDBTagProcessor {
function HasPermission($params)
{
$section_name = $params['section_name'];
$sections_helper =& $this->Application->recallObject('SectionsHelper');
$section_data =& $sections_helper->getSectionData($section_name);
return array_search($params['perm_name'], $section_data['permissions']) !== false;
}
function HasAdvancedPermissions($params)
{
$section_name = $params['section_name'];
$sections_helper =& $this->Application->recallObject('SectionsHelper');
$section_data =& $sections_helper->getSectionData($section_name);
$ret = false;
foreach ($section_data['permissions'] as $perm_name) {
if (preg_match('/^advanced:(.*)/', $perm_name)) {
$ret = true;
break;
}
}
return $ret;
}
function PermissionValue($params)
{
$section_name = $params['section_name'];
$sections_helper =& $this->Application->recallObject('SectionsHelper');
$section_data =& $sections_helper->getSectionData($section_name);
$perm_name = $params['perm_name'];
$permissions_helper =& $this->Application->recallObject('PermissionsHelper');
if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
$perm_name = $section_name.'.'.$perm_name;
}
return $permissions_helper->getPermissionValue($perm_name);
}
function LoadPermissions($params)
{
$permissions_helper =& $this->Application->recallObject('PermissionsHelper');
$prefix_parts = explode('-', $this->Prefix, 2);
$permissions_helper->LoadPermissions($prefix_parts[0]);
}
function LevelIndicator($params)
{
return $params['level'] * $params['multiply'];
}
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);
$ret = '';
$block_params = Array('name' => $params['render_as']);
foreach ($permissions as $perm_record) {
$block_params = array_merge_recursive2($block_params, $perm_record);
$ret .= $this->Application->ParseBlock($block_params);
}
return $ret;
}
/**
* Print module tab for each module
*
* @param Array $params
* @return string
*/
function PrintTabs($params)
{
$ret = '';
$block_params = $params;
foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
$params['item_prefix'] = $module_data['Var'];
$ret .= $this->Application->ProcessParsedTag('m', 'MyInclude', $params);
}
return $ret;
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/permissions/permissions_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl
===================================================================
--- trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl (revision 5318)
+++ trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl (revision 5319)
@@ -1,182 +1,182 @@
<inp2:m_RequireLogin permissions="CATEGORY.VIEW"/>
<inp2:m_include t="incs/header" nobody="yes"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF" onload="$PermManager.Init();">
<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" module="in-portal" title="la_title_Categories"/>
<inp2:m_include t="categories/categories_tabs"/>
<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="categories_permissions" module="in-portal" icon="icon46_catalog"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript" src="incs/ajax.js"></script>
<script type="text/javascript" src="incs/catalog.js"></script>
<script type="text/javascript">
Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
Catalog.prototype.Init = function () {
var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 0) {
// ActivePrefix not set or has non-existing prefix value
this.ActivePrefix = this.TabRegistry[0]['prefix'];
}
Grids['g'].SelectFirst();
}
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) {
var $group_id = get_hidden_field('current_group_id');
// alert('refreshTab. GroupID: '+$group_id);
var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
if ($group_id != $tab_group_id) {
// query tab content only in case if not queried or category don't match
var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#GROUP_ID#', $group_id);
this.BusyRequest[$prefix] = false;
Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id, this);
}
/*else {
alert('refresh disabled = {tab: '+this.ActivePrefix+'; group_id: '+$group_id+'}');
}*/
}
// adds information about tab to tab_registry
Catalog.prototype.registerTab = function($tab_id) {
var $tab = document.getElementById($tab_id + '_div');
var $index = this.TabRegistry.length;
this.TabRegistry[$index] = new Array();
this.TabRegistry[$index]['tab_id'] = $tab_id;
this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix');
this.TabRegistry[$index]['dep_buttons'] = new Array();
this.TabRegistry[$index]['index'] = $index;
}
Catalog.prototype.submit_event = function($prefix_special, $event, $t) {
if (isset($event)) set_hidden_field('events[' + $prefix_special + ']', $event);
if (isset($t)) set_hidden_field('t', $t);
var $tab_id = this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id');
this.submit_kernel_form($tab_id);
}
- var $PermManager = new Catalog('<inp2:m_Link template="categories/permissions_tab" item_prefix="#ITEM_PREFIX#" group_id="#GROUP_ID#" no_amp="1"/>', 'permmanager_');
+ var $PermManager = new Catalog('<inp2:m_Link template="categories/permissions_tab" item_prefix="#ITEM_PREFIX#" group_id="#GROUP_ID#" no_amp="1" pass="m,c"/>', 'permmanager_');
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
submit_event('c','<inp2:c_SaveEvent/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
submit_event('c','OnCancelEdit');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
go_to_id('c', '<inp2:c_PrevId/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
go_to_id('c', '<inp2:c_NextId/>');
}
) );
function edit(){ }
function ReflectPermissions($prefix, $group_id) {
// process only this prefix & group checkboxes
}
a_toolbar.Render();
<inp2:m_if check="c_IsSingle">
a_toolbar.HideButton('prev');
a_toolbar.HideButton('next');
a_toolbar.HideButton('sep1');
<inp2:m_else/>
<inp2:m_if check="c_IsLast">
a_toolbar.DisableButton('next');
</inp2:m_if>
<inp2:m_if check="c_IsFirst">
a_toolbar.DisableButton('prev');
</inp2:m_if>
</inp2:m_if>
</script>
</td>
</tr>
</tbody>
</table>
<inp2:m_ParseBlock name="grid" PrefixSpecial="g" IdField="GroupId" per_page="-1" grid="Radio" header_block="grid_column_title_no_sorting"/>
<br />
<!-- item tabs: begin -->
<table cellpadding="0" cellspacing="0">
<tr>
<inp2:m_DefineElement name="item_tab" title="">
<td nowrap="nowrap" width="140">
<table id="<inp2:m_param name="prefix"/>_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$PermManager.switchTab('<inp2:m_param name="prefix"/>');">
<tr>
<td class="catalog-tab-left">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td class="catalog-tab-middle" width="100%" valign="middle" nowrap="nowrap">
<inp2:m_param name="title"/>
</td>
<td class="catalog-tab-right">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td style="background-color: #FFFFFF;">
<img src="img/spacer.gif" height="1" width="5" />
</td>
</tr>
</table>
</td>
</inp2:m_DefineElement>
<inp2:adm_ListCatalogTabs render_as="item_tab" title_property="PermTabText"/>
</tr>
</table>
<!-- item tabs: end -->
<inp2:c-perm_PrintTabs template="categories/permissions_tab" tab_init="1"/>
<inp2:m_include t="incs/footer"/>
<script type="text/javascript">
Grids['g'].OnSelect = function ($id) {
$PermManager.go_to_group($id);
}
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;
}
}
Grids['g'].RadioMode = true;
</script>
\ No newline at end of file
Property changes on: trunk/kernel/admin_templates/categories/categories_edit_permissions.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/kernel/admin_templates/categories/images_edit.tpl
===================================================================
--- trunk/kernel/admin_templates/categories/images_edit.tpl (nonexistent)
+++ trunk/kernel/admin_templates/categories/images_edit.tpl (revision 5319)
@@ -0,0 +1,59 @@
+<inp2:m_RequireLogin permissions="LINK.VIEW"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<inp2:m_include t="incs/image_blocks"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+<inp2:m_ParseBlock name="section_header" prefix="l" icon="icon46_links" title="!la_Text_Links!"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="l" title_preset="images_edit" module="in-link" icon="icon46_links"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('l-img','<inp2:l-img_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('l-img','OnCancel');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <inp2:m_ParseBlock name="subsection" title="!la_section_Image!"/>
+ <inp2:m_ParseBlock name="inp_edit_hidden" prefix="l-img" field="ResourceId"/>
+ <inp2:m_ParseBlock name="inp_label" prefix="l-img" field="ImageId" title="!la_fld_ImageId!"/>
+
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="l-img" field="Name" title="!la_fld_Name!" size="40"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="l-img" field="AltName" title="!la_fld_AltValue!" size="40"/>
+
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="l-img" field="Enabled" title="!la_fld_Enabled!" onchange="check_primary()" />
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="l-img" field="DefaultImg" title="!la_fld_Primary!" onchange="check_status()" />
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="l-img" field="Priority" title="!la_fld_Priority!" size="5"/>
+
+ <inp2:m_ParseBlock name="subsection" title="!la_section_ThumbnailImage!"/>
+ <inp2:m_ParseBlock name="thumbnail_section" prefix="l-img"/>
+
+ <inp2:m_ParseBlock name="subsection" title="!la_section_FullSizeImage!"/>
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="l-img" field="SameImages" title="!la_fld_SameAsThumb!" onchange="toggle_fullsize()"/>
+ <inp2:m_ParseBlock name="fullsize_section" prefix="l-img"/>
+</table>
+
+<script type="text/javascript">
+ <inp2:m_RenderElement name="images_edit_js" prefix="l-img"/>
+ toggle_fullsize();
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: trunk/kernel/admin_templates/categories/images_edit.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/kernel/admin_templates/categories/categories_edit_images.tpl
===================================================================
--- trunk/kernel/admin_templates/categories/categories_edit_images.tpl (nonexistent)
+++ trunk/kernel/admin_templates/categories/categories_edit_images.tpl (revision 5319)
@@ -0,0 +1,110 @@
+<inp2:m_RequireLogin permissions="CATEGORY.VIEW"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<inp2:m_include t="incs/image_blocks"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" title="!la_title_Categories!"/>
+
+<inp2:m_include t="categories/categories_tabs"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="categories_images" module="in-portal" icon="icon46_catalog"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+
+ function edit()
+ {
+ std_edit_temp_item('c-img', 'in-link/links/images_edit');
+ }
+
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('c','<inp2:c_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('c','OnCancelEdit');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_PrevId/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_NextId/>');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
+
+
+ a_toolbar.AddButton( new ToolBarButton('new_image', '<inp2:m_phrase label="la_ToolTip_New_Images" escape="1"/>',
+ function() {
+ std_new_item('c-img', 'categories/images_edit')
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
+ a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
+ function() {
+ std_delete_items('c-img')
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep3') );
+
+ a_toolbar.AddButton( new ToolBarButton('move_up', '<inp2:m_phrase label="la_ToolTip_MoveUp" escape="1"/>', function() {
+ submit_event('c-img','OnMassMoveUp');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('move_down', '<inp2:m_phrase label="la_ToolTip_MoveDown" escape="1"/>', function() {
+ submit_event('c-img','OnMassMoveDown');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('primary_image', '<inp2:m_phrase label="la_ToolTip_SetPrimary" escape="1"/>', function() {
+ submit_event('c-img','OnSetPrimary');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep4') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar,'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+
+ <inp2:m_if prefix="c" function="IsSingle"/>
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ <inp2:m_else/>
+ <inp2:m_if prefix="c" function="IsLast"/>
+ a_toolbar.DisableButton('next');
+ <inp2:m_endif/>
+ <inp2:m_if prefix="c" function="IsFirst"/>
+ a_toolbar.DisableButton('prev');
+ <inp2:m_endif/>
+ <inp2:m_endif/>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_ParseBlock name="grid" PrefixSpecial="c-img" IdField="ImageId" grid="Default" menu_filters="yes"/>
+<script type="text/javascript">
+ Grids['c-img'].SetDependantToolbarButtons( new Array('edit','delete','move_up','move_down','primary_image') );
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: trunk/kernel/admin_templates/categories/categories_edit_images.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/kernel/admin_templates/incs/image_blocks.tpl
===================================================================
--- trunk/kernel/admin_templates/incs/image_blocks.tpl (revision 5318)
+++ trunk/kernel/admin_templates/incs/image_blocks.tpl (revision 5319)
@@ -1,5 +1,152 @@
-<inp2:m_block name="image_block"/>
- <img src="<inp2:m_param name="img_path" />" <inp2:m_param name="img_size" /> border="0" /><br>
+<inp2:m_DefineElement name="image_block">
+ <img src="<inp2:m_param name="img_path" />" <inp2:m_param name="img_size"/> border="0" /><br />
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="thumbnail_section" prefix="">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
+ <td class="text">
+ <inp2:m_phrase label="la_fld_Location"/><br>
+ <span class="error"><inp2:$prefix_Error field="ThumbPath"/><inp2:$prefix_Error field="ThumbUrl"/></span>&nbsp;
+ </td>
+ <td>
+ <table border="0">
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalThumb" value="1">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalThumb"/>" id="<inp2:$prefix_InputName field="LocalThumb"/>_1" value="1">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_Upload"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="file" name="<inp2:$prefix_InputName field="ThumbPath"/>" id="<inp2:$prefix_InputName field="ThumbPath"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_Field field="ImageId"/>][LocalThumb]_1').checked = true">
+ <input type="hidden" name="<inp2:$prefix_InputName field="ThumbPath"/>[upload]" id="<inp2:$prefix_InputName field="ThumbPath"/>[upload]" value="<inp2:$prefix_Field field="ThumbPath"/>">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalThumb" value="0">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalThumb"/>" id="<inp2:$prefix_InputName field="LocalThumb"/>_0" value="0">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_RemoteUrl"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="text" name="<inp2:$prefix_InputName field="ThumbUrl"/>" id="<inp2:$prefix_InputName field="ThumbUrl"/>" value="<inp2:$prefix_Field field="ThumbUrl"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_Field field="ImageId"/>][LocalThumb]_0').checked = true">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <inp2:$prefix_Image block="image_block" Thumbnail="1" DefaultImage="../../kernel/images/noimage.gif"/>
+ </td>
+ </tr>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="fullsize_section" prefix="">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
+ <td class="text">
+ <inp2:m_phrase label="la_fld_Location"/><br>
+ <span class="error"><inp2:$prefix_Error field="LocalPath"/><inp2:$prefix_Error field="Url"/></span>&nbsp;
+ </td>
+ <td>
+ <table border="0">
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalImage" value="1">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalImage"/>" id="<inp2:$prefix_InputName field="LocalImage"/>_1" value="1">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_Upload"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="file" name="<inp2:$prefix_InputName field="LocalPath"/>" id="<inp2:$prefix_InputName field="LocalPath"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_field field="ImageId"/>][LocalImage]_1').checked = true">
+ <input type="hidden" name="<inp2:$prefix_InputName field="LocalPath"/>[upload]" id="<inp2:$prefix_InputName field="LocalPath"/>[upload]" value="<inp2:$prefix_Field field="LocalPath"/>">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalImage" value="0">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalImage"/>" id="<inp2:$prefix_InputName field="LocalImage"/>_0" value="0">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_RemoteUrl"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="text" name="<inp2:$prefix_InputName field="Url"/>" id="<inp2:$prefix_InputName field="Url"/>" value="<inp2:$prefix_Field field="Url"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_Field field="ImageId"/>][LocalImage]_0').checked = true">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <inp2:$prefix_Image block="image_block" DefaultImage="../../kernel/images/noimage.gif"/>
+ </td>
+ </tr>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="images_edit_js">
+ function FieldID($field_name) {
+ var $field_mask = '<inp2:$prefix_InputName field="#FIELD#"/>';
+ 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;
+ }
+ }
+</inp2:m_DefineElement>
+
+<inp2:m_block name="image_caption_td" />
+ <td valign="top" class="text">
+ <input type="checkbox" name="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>" id="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>">
+ <img src="<inp2:ModulePath module="In-Portal"/>img/itemicons/<inp2:$PrefixSpecial_ItemIcon grid="$grid"/>">
+ <inp2:Field field="$field" grid="$grid"/><span class="priority"><inp2:m_if prefix="$PrefixSpecial" function="fieldequals" field="Priority" value="0"/><inp2:m_else/><sup><inp2:$PrefixSpecial_field field="Priority"/></sup><inp2:m_endif/></span>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_block name="image_preview_td"/>
+ <td>
+ <inp2:Image block="image_block" Thumbnail="1" DefaultImage="../../kernel/images/noimage.gif" MaxWidth="120" MaxHeight="120"/>
+ </td>
+<inp2:m_blockend/>
+
+<inp2:m_block name="image_url_td"/>
+ <td valign="top" class="text">
+ <inp2:img_ImageUrl local_phrase="!la_LocalImage!"/>
+ </td>
<inp2:m_blockend/>
Property changes on: trunk/kernel/admin_templates/incs/image_blocks.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property
Index: trunk/core/units/permissions/permissions_tag_processor.php
===================================================================
--- trunk/core/units/permissions/permissions_tag_processor.php (revision 5318)
+++ trunk/core/units/permissions/permissions_tag_processor.php (revision 5319)
@@ -1,100 +1,144 @@
<?php
class PermissionsTagProcessor extends kDBTagProcessor {
function HasPermission($params)
{
$section_name = $params['section_name'];
$sections_helper =& $this->Application->recallObject('SectionsHelper');
$section_data =& $sections_helper->getSectionData($section_name);
return array_search($params['perm_name'], $section_data['permissions']) !== false;
}
function HasAdvancedPermissions($params)
{
$section_name = $params['section_name'];
$sections_helper =& $this->Application->recallObject('SectionsHelper');
$section_data =& $sections_helper->getSectionData($section_name);
$ret = false;
foreach ($section_data['permissions'] as $perm_name) {
if (preg_match('/^advanced:(.*)/', $perm_name)) {
$ret = true;
break;
}
}
return $ret;
}
function PermissionValue($params)
{
$section_name = $params['section_name'];
$sections_helper =& $this->Application->recallObject('SectionsHelper');
$section_data =& $sections_helper->getSectionData($section_name);
$perm_name = $params['perm_name'];
$permissions_helper =& $this->Application->recallObject('PermissionsHelper');
if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
$perm_name = $section_name.'.'.$perm_name;
}
return $permissions_helper->getPermissionValue($perm_name);
}
function LoadPermissions($params)
{
$permissions_helper =& $this->Application->recallObject('PermissionsHelper');
$prefix_parts = explode('-', $this->Prefix, 2);
$permissions_helper->LoadPermissions($prefix_parts[0]);
}
function LevelIndicator($params)
{
return $params['level'] * $params['multiply'];
}
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);
$ret = '';
$block_params = Array('name' => $params['render_as']);
foreach ($permissions as $perm_record) {
$block_params = array_merge_recursive2($block_params, $perm_record);
$ret .= $this->Application->ParseBlock($block_params);
}
return $ret;
}
/**
* Print module tab for each module
*
* @param Array $params
* @return string
*/
function PrintTabs($params)
{
$ret = '';
$block_params = $params;
foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
$params['item_prefix'] = $module_data['Var'];
$ret .= $this->Application->ProcessParsedTag('m', 'MyInclude', $params);
}
return $ret;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/permissions/permissions_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/core/admin_templates/categories/categories_edit_permissions.tpl
===================================================================
--- trunk/core/admin_templates/categories/categories_edit_permissions.tpl (revision 5318)
+++ trunk/core/admin_templates/categories/categories_edit_permissions.tpl (revision 5319)
@@ -1,182 +1,182 @@
<inp2:m_RequireLogin permissions="CATEGORY.VIEW"/>
<inp2:m_include t="incs/header" nobody="yes"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF" onload="$PermManager.Init();">
<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" module="in-portal" title="la_title_Categories"/>
<inp2:m_include t="categories/categories_tabs"/>
<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="categories_permissions" module="in-portal" icon="icon46_catalog"/>
<!-- ToolBar --->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript" src="incs/ajax.js"></script>
<script type="text/javascript" src="incs/catalog.js"></script>
<script type="text/javascript">
Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
Catalog.prototype.Init = function () {
var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 0) {
// ActivePrefix not set or has non-existing prefix value
this.ActivePrefix = this.TabRegistry[0]['prefix'];
}
Grids['g'].SelectFirst();
}
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) {
var $group_id = get_hidden_field('current_group_id');
// alert('refreshTab. GroupID: '+$group_id);
var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
if ($group_id != $tab_group_id) {
// query tab content only in case if not queried or category don't match
var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#GROUP_ID#', $group_id);
this.BusyRequest[$prefix] = false;
Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id, this);
}
/*else {
alert('refresh disabled = {tab: '+this.ActivePrefix+'; group_id: '+$group_id+'}');
}*/
}
// adds information about tab to tab_registry
Catalog.prototype.registerTab = function($tab_id) {
var $tab = document.getElementById($tab_id + '_div');
var $index = this.TabRegistry.length;
this.TabRegistry[$index] = new Array();
this.TabRegistry[$index]['tab_id'] = $tab_id;
this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix');
this.TabRegistry[$index]['dep_buttons'] = new Array();
this.TabRegistry[$index]['index'] = $index;
}
Catalog.prototype.submit_event = function($prefix_special, $event, $t) {
if (isset($event)) set_hidden_field('events[' + $prefix_special + ']', $event);
if (isset($t)) set_hidden_field('t', $t);
var $tab_id = this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id');
this.submit_kernel_form($tab_id);
}
- var $PermManager = new Catalog('<inp2:m_Link template="categories/permissions_tab" item_prefix="#ITEM_PREFIX#" group_id="#GROUP_ID#" no_amp="1"/>', 'permmanager_');
+ var $PermManager = new Catalog('<inp2:m_Link template="categories/permissions_tab" item_prefix="#ITEM_PREFIX#" group_id="#GROUP_ID#" no_amp="1" pass="m,c"/>', 'permmanager_');
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
submit_event('c','<inp2:c_SaveEvent/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
submit_event('c','OnCancelEdit');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
go_to_id('c', '<inp2:c_PrevId/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
go_to_id('c', '<inp2:c_NextId/>');
}
) );
function edit(){ }
function ReflectPermissions($prefix, $group_id) {
// process only this prefix & group checkboxes
}
a_toolbar.Render();
<inp2:m_if check="c_IsSingle">
a_toolbar.HideButton('prev');
a_toolbar.HideButton('next');
a_toolbar.HideButton('sep1');
<inp2:m_else/>
<inp2:m_if check="c_IsLast">
a_toolbar.DisableButton('next');
</inp2:m_if>
<inp2:m_if check="c_IsFirst">
a_toolbar.DisableButton('prev');
</inp2:m_if>
</inp2:m_if>
</script>
</td>
</tr>
</tbody>
</table>
<inp2:m_ParseBlock name="grid" PrefixSpecial="g" IdField="GroupId" per_page="-1" grid="Radio" header_block="grid_column_title_no_sorting"/>
<br />
<!-- item tabs: begin -->
<table cellpadding="0" cellspacing="0">
<tr>
<inp2:m_DefineElement name="item_tab" title="">
<td nowrap="nowrap" width="140">
<table id="<inp2:m_param name="prefix"/>_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$PermManager.switchTab('<inp2:m_param name="prefix"/>');">
<tr>
<td class="catalog-tab-left">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td class="catalog-tab-middle" width="100%" valign="middle" nowrap="nowrap">
<inp2:m_param name="title"/>
</td>
<td class="catalog-tab-right">
<img src="img/spacer.gif" height="22" width="9" />
</td>
<td style="background-color: #FFFFFF;">
<img src="img/spacer.gif" height="1" width="5" />
</td>
</tr>
</table>
</td>
</inp2:m_DefineElement>
<inp2:adm_ListCatalogTabs render_as="item_tab" title_property="PermTabText"/>
</tr>
</table>
<!-- item tabs: end -->
<inp2:c-perm_PrintTabs template="categories/permissions_tab" tab_init="1"/>
<inp2:m_include t="incs/footer"/>
<script type="text/javascript">
Grids['g'].OnSelect = function ($id) {
$PermManager.go_to_group($id);
}
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;
}
}
Grids['g'].RadioMode = true;
</script>
\ No newline at end of file
Property changes on: trunk/core/admin_templates/categories/categories_edit_permissions.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/core/admin_templates/categories/images_edit.tpl
===================================================================
--- trunk/core/admin_templates/categories/images_edit.tpl (nonexistent)
+++ trunk/core/admin_templates/categories/images_edit.tpl (revision 5319)
@@ -0,0 +1,59 @@
+<inp2:m_RequireLogin permissions="LINK.VIEW"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<inp2:m_include t="incs/image_blocks"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+<inp2:m_ParseBlock name="section_header" prefix="l" icon="icon46_links" title="!la_Text_Links!"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="l" title_preset="images_edit" module="in-link" icon="icon46_links"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('l-img','<inp2:l-img_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('l-img','OnCancel');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <inp2:m_ParseBlock name="subsection" title="!la_section_Image!"/>
+ <inp2:m_ParseBlock name="inp_edit_hidden" prefix="l-img" field="ResourceId"/>
+ <inp2:m_ParseBlock name="inp_label" prefix="l-img" field="ImageId" title="!la_fld_ImageId!"/>
+
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="l-img" field="Name" title="!la_fld_Name!" size="40"/>
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="l-img" field="AltName" title="!la_fld_AltValue!" size="40"/>
+
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="l-img" field="Enabled" title="!la_fld_Enabled!" onchange="check_primary()" />
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="l-img" field="DefaultImg" title="!la_fld_Primary!" onchange="check_status()" />
+ <inp2:m_ParseBlock name="inp_edit_box" prefix="l-img" field="Priority" title="!la_fld_Priority!" size="5"/>
+
+ <inp2:m_ParseBlock name="subsection" title="!la_section_ThumbnailImage!"/>
+ <inp2:m_ParseBlock name="thumbnail_section" prefix="l-img"/>
+
+ <inp2:m_ParseBlock name="subsection" title="!la_section_FullSizeImage!"/>
+ <inp2:m_ParseBlock name="inp_edit_checkbox" prefix="l-img" field="SameImages" title="!la_fld_SameAsThumb!" onchange="toggle_fullsize()"/>
+ <inp2:m_ParseBlock name="fullsize_section" prefix="l-img"/>
+</table>
+
+<script type="text/javascript">
+ <inp2:m_RenderElement name="images_edit_js" prefix="l-img"/>
+ toggle_fullsize();
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: trunk/core/admin_templates/categories/images_edit.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/core/admin_templates/categories/categories_edit_images.tpl
===================================================================
--- trunk/core/admin_templates/categories/categories_edit_images.tpl (nonexistent)
+++ trunk/core/admin_templates/categories/categories_edit_images.tpl (revision 5319)
@@ -0,0 +1,110 @@
+<inp2:m_RequireLogin permissions="CATEGORY.VIEW"/>
+<inp2:m_include t="incs/header" nobody="yes"/>
+
+<inp2:m_include t="incs/image_blocks"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+<inp2:m_ParseBlock name="section_header" prefix="c" icon="icon46_catalog" title="!la_title_Categories!"/>
+
+<inp2:m_include t="categories/categories_tabs"/>
+
+<inp2:m_ParseBlock name="blue_bar" prefix="c" title_preset="categories_images" module="in-portal" icon="icon46_catalog"/>
+
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+
+ function edit()
+ {
+ std_edit_temp_item('c-img', 'in-link/links/images_edit');
+ }
+
+ a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('c','<inp2:c_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('c','OnCancelEdit');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_PrevId/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
+ go_to_id('c', '<inp2:c_NextId/>');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
+
+
+ a_toolbar.AddButton( new ToolBarButton('new_image', '<inp2:m_phrase label="la_ToolTip_New_Images" escape="1"/>',
+ function() {
+ std_new_item('c-img', 'categories/images_edit')
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
+ a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
+ function() {
+ std_delete_items('c-img')
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep3') );
+
+ a_toolbar.AddButton( new ToolBarButton('move_up', '<inp2:m_phrase label="la_ToolTip_MoveUp" escape="1"/>', function() {
+ submit_event('c-img','OnMassMoveUp');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('move_down', '<inp2:m_phrase label="la_ToolTip_MoveDown" escape="1"/>', function() {
+ submit_event('c-img','OnMassMoveDown');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('primary_image', '<inp2:m_phrase label="la_ToolTip_SetPrimary" escape="1"/>', function() {
+ submit_event('c-img','OnSetPrimary');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep4') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar,'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+
+ <inp2:m_if prefix="c" function="IsSingle"/>
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ <inp2:m_else/>
+ <inp2:m_if prefix="c" function="IsLast"/>
+ a_toolbar.DisableButton('next');
+ <inp2:m_endif/>
+ <inp2:m_if prefix="c" function="IsFirst"/>
+ a_toolbar.DisableButton('prev');
+ <inp2:m_endif/>
+ <inp2:m_endif/>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_ParseBlock name="grid" PrefixSpecial="c-img" IdField="ImageId" grid="Default" menu_filters="yes"/>
+<script type="text/javascript">
+ Grids['c-img'].SetDependantToolbarButtons( new Array('edit','delete','move_up','move_down','primary_image') );
+</script>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: trunk/core/admin_templates/categories/categories_edit_images.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: trunk/core/admin_templates/incs/image_blocks.tpl
===================================================================
--- trunk/core/admin_templates/incs/image_blocks.tpl (revision 5318)
+++ trunk/core/admin_templates/incs/image_blocks.tpl (revision 5319)
@@ -1,5 +1,152 @@
-<inp2:m_block name="image_block"/>
- <img src="<inp2:m_param name="img_path" />" <inp2:m_param name="img_size" /> border="0" /><br>
+<inp2:m_DefineElement name="image_block">
+ <img src="<inp2:m_param name="img_path" />" <inp2:m_param name="img_size"/> border="0" /><br />
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="thumbnail_section" prefix="">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
+ <td class="text">
+ <inp2:m_phrase label="la_fld_Location"/><br>
+ <span class="error"><inp2:$prefix_Error field="ThumbPath"/><inp2:$prefix_Error field="ThumbUrl"/></span>&nbsp;
+ </td>
+ <td>
+ <table border="0">
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalThumb" value="1">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalThumb"/>" id="<inp2:$prefix_InputName field="LocalThumb"/>_1" value="1">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_Upload"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="file" name="<inp2:$prefix_InputName field="ThumbPath"/>" id="<inp2:$prefix_InputName field="ThumbPath"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_Field field="ImageId"/>][LocalThumb]_1').checked = true">
+ <input type="hidden" name="<inp2:$prefix_InputName field="ThumbPath"/>[upload]" id="<inp2:$prefix_InputName field="ThumbPath"/>[upload]" value="<inp2:$prefix_Field field="ThumbPath"/>">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalThumb" value="0">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalThumb"/>" id="<inp2:$prefix_InputName field="LocalThumb"/>_0" value="0">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_RemoteUrl"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="text" name="<inp2:$prefix_InputName field="ThumbUrl"/>" id="<inp2:$prefix_InputName field="ThumbUrl"/>" value="<inp2:$prefix_Field field="ThumbUrl"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_Field field="ImageId"/>][LocalThumb]_0').checked = true">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <inp2:$prefix_Image block="image_block" Thumbnail="1" DefaultImage="../../kernel/images/noimage.gif"/>
+ </td>
+ </tr>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="fullsize_section" prefix="">
+ <tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
+ <td class="text">
+ <inp2:m_phrase label="la_fld_Location"/><br>
+ <span class="error"><inp2:$prefix_Error field="LocalPath"/><inp2:$prefix_Error field="Url"/></span>&nbsp;
+ </td>
+ <td>
+ <table border="0">
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalImage" value="1">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalImage"/>" id="<inp2:$prefix_InputName field="LocalImage"/>_1" value="1">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_Upload"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="file" name="<inp2:$prefix_InputName field="LocalPath"/>" id="<inp2:$prefix_InputName field="LocalPath"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_field field="ImageId"/>][LocalImage]_1').checked = true">
+ <input type="hidden" name="<inp2:$prefix_InputName field="LocalPath"/>[upload]" id="<inp2:$prefix_InputName field="LocalPath"/>[upload]" value="<inp2:$prefix_Field field="LocalPath"/>">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="radio" <inp2:m_if check="{$prefix}_FieldEquals" field="LocalImage" value="0">checked</inp2:m_if> name="<inp2:$prefix_InputName field="LocalImage"/>" id="<inp2:$prefix_InputName field="LocalImage"/>_0" value="0">
+ </td>
+ <td>
+ <inp2:m_phrase label="la_fld_RemoteUrl"/>:
+ </td>
+ <td>
+ <inp2:m_inc param="tab_index" by="1"/>
+ <input type="text" name="<inp2:$prefix_InputName field="Url"/>" id="<inp2:$prefix_InputName field="Url"/>" value="<inp2:$prefix_Field field="Url"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onclick="document.getElementById('<inp2:m_param name="prefix"/>[<inp2:$prefix_Field field="ImageId"/>][LocalImage]_0').checked = true">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <inp2:$prefix_Image block="image_block" DefaultImage="../../kernel/images/noimage.gif"/>
+ </td>
+ </tr>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="images_edit_js">
+ function FieldID($field_name) {
+ var $field_mask = '<inp2:$prefix_InputName field="#FIELD#"/>';
+ 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;
+ }
+ }
+</inp2:m_DefineElement>
+
+<inp2:m_block name="image_caption_td" />
+ <td valign="top" class="text">
+ <input type="checkbox" name="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>" id="<inp2:$PrefixSpecial_InputName field="$IdField" IdField="$IdField"/>">
+ <img src="<inp2:ModulePath module="In-Portal"/>img/itemicons/<inp2:$PrefixSpecial_ItemIcon grid="$grid"/>">
+ <inp2:Field field="$field" grid="$grid"/><span class="priority"><inp2:m_if prefix="$PrefixSpecial" function="fieldequals" field="Priority" value="0"/><inp2:m_else/><sup><inp2:$PrefixSpecial_field field="Priority"/></sup><inp2:m_endif/></span>
+ </td>
+<inp2:m_blockend />
+
+<inp2:m_block name="image_preview_td"/>
+ <td>
+ <inp2:Image block="image_block" Thumbnail="1" DefaultImage="../../kernel/images/noimage.gif" MaxWidth="120" MaxHeight="120"/>
+ </td>
+<inp2:m_blockend/>
+
+<inp2:m_block name="image_url_td"/>
+ <td valign="top" class="text">
+ <inp2:img_ImageUrl local_phrase="!la_LocalImage!"/>
+ </td>
<inp2:m_blockend/>
Property changes on: trunk/core/admin_templates/incs/image_blocks.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.3
\ No newline at end of property

Event Timeline