Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F847752
D97.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 19, 5:32 PM
Size
9 KB
Mime Type
text/x-diff
Expires
Sun, Apr 20, 5:32 PM (3 m, 53 s)
Engine
blob
Format
Raw Data
Handle
602547
Attached To
D97: INP-1448 Allow to set pass_through value in adm:SelectorLink tag as parameter
D97.diff
View Options
Index: branches/5.3.x/core/admin_templates/catalog/advanced_view.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/catalog/advanced_view.tpl
+++ branches/5.3.x/core/admin_templates/catalog/advanced_view.tpl
@@ -38,7 +38,7 @@
this.switchTab();
}
- var $Catalog = new Catalog('<inp2:m_Link template="#TEMPLATE_NAME#" pass_through="ts,td" ts="showall" td="no" m_cat_id="#CATEGORY_ID#" no_amp="1" js_escape="1"/>', 'advanced_view_', 'AdvancedView');
+ var $Catalog = new Catalog('<inp2:adm_SelectorLink template="#TEMPLATE_NAME#" pass="m" pass_through="ts,td" ts="showall" td="no" m_cat_id="#CATEGORY_ID#" no_amp="1" js_escape="1"/>', 'advanced_view_', 'AdvancedView');
var a_toolbar = new ToolBar();
<inp2:m_set ts="showall" td="no"/>
@@ -146,4 +146,4 @@
);
</script>
-<inp2:m_include t="incs/footer" noform="yes"/>
\ No newline at end of file
+<inp2:m_include t="incs/footer" noform="yes"/>
Index: branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl
+++ branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl
@@ -21,7 +21,7 @@
this.switchTab();
}
- var $Catalog = new Catalog('<inp2:m_Link template="#TEMPLATE_NAME#" pass_through="ts,td,tm,type" type="item_selector" ts="showall" td="no" m_cat_id="#CATEGORY_ID#" no_amp="1" js_escape="1"/>', 'is_advanced_view_', 'ItemSelectorAdvancedView');
+ var $Catalog = new Catalog('<inp2:adm_SelectorLink template="#TEMPLATE_NAME#" pass="m" pass_through="ts,td,tm,type" type="item_selector" ts="showall" td="no" m_cat_id="#CATEGORY_ID#" no_amp="1" js_escape="1"/>', 'is_advanced_view_', 'ItemSelectorAdvancedView');
</script>
</td>
@@ -51,4 +51,4 @@
);
</script>
-<inp2:m_include t="incs/footer" noform="yes"/>
\ No newline at end of file
+<inp2:m_include t="incs/footer" noform="yes"/>
Index: branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl
+++ branches/5.3.x/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl
@@ -15,7 +15,7 @@
<input type="hidden" name="m_cat_id" value="<inp2:m_get name="m_cat_id"/>"/>
<inp2:m_include t="catalog/item_selector/item_selector_toolbar" is_catalog="1"/>
<script type="text/javascript">
- var $Catalog = new Catalog('<inp2:m_Link template="#TEMPLATE_NAME#" pass_through="type" type="item_selector" m_cat_id="#CATEGORY_ID#" no_amp="1" js_escape="1"/>', 'is_catalog_', 'ItemSelectorCatalog');
+ var $Catalog = new Catalog('<inp2:adm_SelectorLink template="#TEMPLATE_NAME#" pass="m" pass_through="type" type="item_selector" m_cat_id="#CATEGORY_ID#" no_amp="1" js_escape="1"/>', 'is_catalog_', 'ItemSelectorCatalog');
</script>
</td>
@@ -41,4 +41,4 @@
);
</script>
-<inp2:m_include t="incs/footer" noform="yes"/>
\ No newline at end of file
+<inp2:m_include t="incs/footer" noform="yes"/>
Index: branches/5.3.x/core/admin_templates/reviews/reviews.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/reviews/reviews.tpl
+++ branches/5.3.x/core/admin_templates/reviews/reviews.tpl
@@ -41,7 +41,7 @@
}
}
- var $Catalog = new Catalog('<inp2:m_Link template="reviews/reviews_tab" item_prefix="#ITEM_PREFIX#" tab_name="#TAB_NAME#" pass_through="td,item_prefix,tab_name" td="no" m_cat_id="-1" no_amp="1" js_escape="1"/>', 'reviews_', 'Reviews');
+ var $Catalog = new Catalog('<inp2:adm_SelectorLink template="reviews/reviews_tab" item_prefix="#ITEM_PREFIX#" tab_name="#TAB_NAME#" pass="m" pass_through="td,item_prefix,tab_name" td="no" m_cat_id="-1" no_amp="1" js_escape="1"/>', 'reviews_', 'Reviews');
var a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
@@ -84,7 +84,7 @@
var $kf = document.getElementById($form_name);
var $prev_action = $kf.action;
- $kf.action = '<inp2:m_t pass="all" pass_through="item_prefix" item_prefix="#PREFIX#" no_amp="1" js_escape="1"/>' . replace('#PREFIX#', $Catalog.ActivePrefix);
+ $kf.action = '<inp2:adm_SelectorLink pass="all" pass_through="item_prefix" item_prefix="#PREFIX#" no_amp="1" js_escape="1"/>' . replace('#PREFIX#', $Catalog.ActivePrefix);
std_edit_temp_item(
$Catalog.ActivePrefix, 'reviews/review_direct_edit',
@@ -120,4 +120,4 @@
);
</script>
-<inp2:m_include t="incs/footer" noform="yes"/>
\ No newline at end of file
+<inp2:m_include t="incs/footer" noform="yes"/>
Index: branches/5.3.x/core/admin_templates/users/user_edit_items.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/users/user_edit_items.tpl
+++ branches/5.3.x/core/admin_templates/users/user_edit_items.tpl
@@ -42,7 +42,7 @@
}
}*/
- var $Catalog = new Catalog('<inp2:m_Link template="#TEMPLATE_NAME#" pass_through="ts" ts="user" pass="m,u" no_amp="1" js_escape="1"/>', 'useritems_', 'UserItemEditor');
+ var $Catalog = new Catalog('<inp2:adm_SelectorLink template="#TEMPLATE_NAME#" pass_through="ts" ts="user" pass="m,u" no_amp="1" js_escape="1"/>', 'useritems_', 'UserItemEditor');
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
@@ -167,4 +167,4 @@
);
</script>
-<inp2:m_include t="incs/footer" noform="yes"/>
\ No newline at end of file
+<inp2:m_include t="incs/footer" noform="yes"/>
Index: branches/5.3.x/core/units/admin/admin_tag_processor.php
===================================================================
--- branches/5.3.x/core/units/admin/admin_tag_processor.php
+++ branches/5.3.x/core/units/admin/admin_tag_processor.php
@@ -457,51 +457,77 @@
}
/**
- * Allows to construct link for opening any type of catalog item selector
+ * Allows to construct link for opening any type of catalog item selector.
+ *
+ * @param array $params Tag params.
*
- * @param Array $params
* @return string
*/
function SelectorLink($params)
{
- $mode = 'catalog';
- if (isset($params['mode'])) { // {catalog, advanced_view}
- $mode = $params['mode'];
- unset($params['mode']);
+ $template = $this->SelectParam($params, 't,template');
+
+ if ( !$template ) {
+ $mode = 'catalog';
+
+ // {catalog, advanced_view}
+ if ( isset($params['mode']) ) {
+ $mode = $params['mode'];
+ unset($params['mode']);
+ }
+
+ $params['t'] = 'catalog/item_selector/item_selector_' . $mode;
}
- $params['t'] = 'catalog/item_selector/item_selector_'.$mode;
- $params['m_cat_id'] = $this->Application->getBaseCategory();
+ if ( !isset($params['m_cat_id']) ) {
+ $params['m_cat_id'] = $this->Application->getBaseCategory();
+ }
+
+ $default_params = array('pass' => 'all');
+
+ if ( isset($params['prefix']) && $params['prefix'] ) {
+ $default_params['pass'] .= ',' . $params['prefix'];
+ unset($params['prefix']);
+ }
+
+ $pass_through = $this->Application->GetVar('pass_through', '');
+
+ if ( isset($params['pass_through']) && $params['pass_through'] ) {
+ $pass_through .= ',' . $params['pass_through'];
+ }
- $default_params = Array('pass' => 'all,'.$params['prefix']);
- unset($params['prefix']);
+ $pass_through = array_filter(explode(',', $pass_through));
- $pass_through = Array();
- if (isset($params['tabs_dependant'])) { // {yes, no}
- $pass_through['td'] = $params['tabs_dependant'];
+ // {yes, no}
+ if ( isset($params['tabs_dependant']) ) {
+ $params['td'] = $params['tabs_dependant'];
+ $pass_through[] = 'td';
unset($params['tabs_dependant']);
}
- if (isset($params['selection_mode'])) { // {single, multi}
- $pass_through['tm'] = $params['selection_mode'];
+ // {single, multi}
+ if ( isset($params['selection_mode']) ) {
+ $params['tm'] = $params['selection_mode'];
+ $pass_through[] = 'tm';
unset($params['selection_mode']);
}
- if (isset($params['tab_prefixes'])) { // {all, none, <comma separated prefix list>}
- $pass_through['tp'] = $params['tab_prefixes'];
+ // {all, none, <comma separated prefix list>}
+ if ( isset($params['tab_prefixes']) ) {
+ $params['tp'] = $params['tab_prefixes'];
+ $pass_through[] = 'tp';
unset($params['tab_prefixes']);
}
- if ($pass_through) {
- // add pass_through to selector url if any
- $params['pass_through'] = implode(',', array_keys($pass_through));
- $params = array_merge($params, $pass_through);
+ if ( $pass_through ) {
+ // Add pass_through to selector url if any.
+ $params['pass_through'] = implode(',', array_unique($pass_through));
}
// user can override default parameters (except pass_through of course)
$params = array_merge($default_params, $params);
- return $this->Application->ProcessParsedTag('m', 'T', $params);
+ return $this->Application->ProcessParsedTag('m', 'T', $params);
}
function TimeFrame($params)
@@ -1193,4 +1219,4 @@
return $this->Application->ParseBlock($block_params);
}
- }
\ No newline at end of file
+ }
Event Timeline
Log In to Comment