Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Wed, Jun 25, 6:41 AM

in-portal

This file is larger than 256 KB, so syntax highlighting was skipped.
Index: branches/RC/kernel/units/reviews/reviews_config.php
===================================================================
--- branches/RC/kernel/units/reviews/reviews_config.php (revision 10454)
+++ branches/RC/kernel/units/reviews/reviews_config.php (revision 10455)
@@ -1,190 +1,196 @@
<?php
$config = Array (
'Prefix' => 'rev',
'Clones' => Array (
'l-rev' => Array(
'ParentPrefix' => 'l',
'ConfigMapping' => Array (
'PerPage' => 'Perpage_LinkReviews',
'ShortListPerPage' => 'Perpage_LinkReviews_Short',
'DefaultSorting1Field' => 'Link_ReviewsSort',
'DefaultSorting2Field' => 'Link_ReviewsSort2',
'DefaultSorting1Dir' => 'Link_ReviewsOrder',
'DefaultSorting2Dir' => 'Link_ReviewsOrder2',
'ReviewDelayInterval' => 'link_ReviewDelay_Interval',
'ReviewDelayValue' => 'link_ReviewDelay_Value',
),
),
'n-rev' => Array (
'ParentPrefix' => 'n',
'ConfigMapping' => Array (
'PerPage' => 'Perpage_NewsReviews',
'ShortListPerPage' => 'Perpage_NewsReviews_Short',
'DefaultSorting1Field' => 'News_SortReviews',
'DefaultSorting2Field' => 'News_SortReviews2',
'DefaultSorting1Dir' => 'News_SortReviewsOrder',
'DefaultSorting2Dir' => 'News_SortReviewsOrder2',
'ReviewDelayInterval' => 'News_ReviewDelay_Interval',
'ReviewDelayValue' => 'News_ReviewDelay_Value',
),
),
'bb-rev' => Array (
'ParentPrefix' => 'bb',
'ConfigMapping' => Array (
'PerPage' => 'Perpage_TopicReviews',
'ReviewDelayInterval' => 'topic_ReviewDelay_Interval',
'ReviewDelayValue' => 'topic_ReviewDelay_Value',
),
),
'p-rev' => Array (
'ParentPrefix' => 'p',
'ConfigMapping' => Array (
'PerPage' => 'Comm_Perpage_Reviews',
'ReviewDelayInterval' => 'product_ReviewDelay_Value',
'ReviewDelayValue' => 'product_ReviewDelay_Interval',
),
),
),
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ReviewsEventHandler','file'=>'reviews_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'event',
4 => 'mode',
),
'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too
'ConfigMapping' => Array (
'PerPage' => 'Comm_Perpage_Reviews',
'ReviewDelayInterval' => 'product_ReviewDelay_Value',
'ReviewDelayValue' => 'product_ReviewDelay_Interval',
),
'IDField' => 'ReviewId',
'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events
'TableName' => TABLE_PREFIX.'ItemReview',
'ParentTableKey' => 'ResourceId', // linked field in master table
'ForeignKey' => 'ItemId', // linked field in subtable
'AutoDelete' => true,
'AutoClone' => true,
'TitlePresets' => Array (
'reviews_edit' => Array('format' => "!la_title_Editing_Review!"),
),
'FilterMenu' => Array (
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER),
),
'Filters' => Array(
'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => '%1$s.Status != 1' ),
'show_pending' => Array('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => '%1$s.Status != 2' ),
'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ),
)
),
'CalculatedFields' => Array (
'' => Array (
'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )',
),
'products' => Array (
'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )',
'ItemName' => 'pr.l1_Name',
'ProductId' => 'pr.ProductId',
),
'product' => Array (
'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )',
'ItemName' => 'pr.l1_Name',
'ProductId' => 'pr.ProductId',
),
),
// key - special, value - list select sql
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById',
'products' => ' SELECT %1$s.* %2$s
- FROM %1$s
+ FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Products pr ON pr.ResourceId = %1$s.ItemId
LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById',
'product' => ' SELECT %1$s.* %2$s
- FROM %1$s
+ FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Products pr ON pr.ResourceId = %1$s.ItemId
LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById',
),
'ItemSQLs' => Array ('' => 'SELECT * FROM %s'),
'ListSortings' => Array (
'' => Array(
'ForcedSorting' => Array('Priority' => 'desc'),
'Sorting' => Array('CreatedOn' => 'desc'),
)
),
'Fields' => Array (
'ReviewId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'CreatedOn' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'default'=>'#NOW#'),
'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''),
'Rating' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'lu_None', 1 => 'lu_Rating_1', 2 => 'lu_Rating_2', 3 => 'lu_Rating_3', 4 => 'lu_Rating_4', 5 => 'lu_Rating_5'), 'use_phrases' => 1, 'min_value_inc' => 0, 'max_value_inc' => 5, 'default' => 0),
'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''),
'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0),
'CreatedById' => Array('type' => 'int', 'formatter'=>'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId','left_title_field'=>'Login','required'=>1,'not_null'=>1,'default'=>-1),
'ItemType' => Array('type'=>'int','not_null'=>1,'default'=>0),
'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0),
'Status' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array(1=>'la_Active',2=>'la_Pending',0=>'la_Disabled'),'not_null'=>1,'default'=>2 ),
'TextFormat' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_text', 1 => 'la_html'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'Module' => Array('type'=>'string','not_null'=>1,'default'=>''),
),
'VirtualFields' => Array (
'ReviewedBy' => Array('type' => 'string', 'default' => ''),
+
+ 'CatalogItemName' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
+ 'CatalogItemId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array ('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'),
'Fields' => Array (
- 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'reviewtext_checkbox_td'),
+ 'ReviewId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td'),
+ 'ReviewText' => Array( 'title'=>'la_col_ReviewText',),
'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ),
'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ),
'Status' => Array( 'title'=>'la_col_Status' ),
'Rating' => Array( 'title'=>'la_col_Rating' ),
),
),
'ReviewsSection' => Array (
'Icons' => Array ('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'),
'Fields' => Array (
- 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'grid_checkbox_namelink_td'),
+ 'ReviewId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td'),
+ 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'grid_reviewtext_td'),
'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ),
'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ),
'Status' => Array( 'title'=>'la_col_Status' ),
+ 'Rating' => Array( 'title'=>'la_col_Rating' ),
),
),
),
);
?>
\ No newline at end of file
Property changes on: branches/RC/kernel/units/reviews/reviews_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14.2.1
\ No newline at end of property
+1.14.2.2
\ No newline at end of property
Index: branches/RC/kernel/units/reviews/reviews_tag_processor.php
===================================================================
--- branches/RC/kernel/units/reviews/reviews_tag_processor.php (revision 10454)
+++ branches/RC/kernel/units/reviews/reviews_tag_processor.php (revision 10455)
@@ -1,97 +1,138 @@
<?php
class ReviewsTagProcessor extends kDBTagProcessor
{
/**
* Returns a link for editing product
*
* @param Array $params
* @return string
*/
function ItemEditLink($params)
{
- $item_prefix = $params['item_prefix'];
- $id_field = $this->Application->getUnitOption($item_prefix,'IDField');
+ $object =& $this->getObject();
+ /* @var $object kDBList */
- $object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
- $item_id = $object->GetDBField($id_field);
+ $item_prefix = $this->Application->findModule('Name', $object->GetDBField('Module'), 'Var');
+ $edit_template = $this->Application->getUnitOption($item_prefix, 'AdminTemplatePath') . '/' . $this->Application->getUnitOption($item_prefix, 'AdminTemplatePrefix') . 'edit';
+
+ $url_params = Array (
+ 'm_opener' => 'd',
+ $item_prefix.'_mode' => 't',
+ $item_prefix.'_event' => 'OnEdit',
+ $item_prefix.'_id' => $object->GetDBField('CatalogItemId'),
+ 'pass' => 'all,'.$item_prefix
+ );
- return $this->Application->HREF($params['edit_template'],'', Array(
- 'm_opener' => 'd',
- $item_prefix.'_mode' => 't',
- $item_prefix.'_event' => 'OnEdit',
- $item_prefix.'_id' => $item_id,
- 'pass' => 'all,'.$item_prefix
- ), 'index.php');
+ return $this->Application->HREF($edit_template,'', $url_params);
}
/**
* Get's reuested field value
*
* @param Array $params
* @return string
* @access public
*/
function Field($params)
{
$field = $this->SelectParam($params, 'name,field');
$object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
if ($field == 'ReviewText') {
if ($object->GetDBField('TextFormat') == 1) {
$params['no_special'] = 'no_special';
}
else {
unset($params['no_special']);
}
}
return parent::Field($params);
}
function AlreadyReviewed($params)
{
$parent_prefix = $this->Application->getUnitOption($this->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
$spam_helper->InitHelper($main_object->GetDBField('ResourceId'), 'Review', 0);
return $spam_helper->InSpamControl();
}
function HasError($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
if (method_exists($object, 'GetErrorMsg')) {
return parent::HasError($params);
}
else {
return 0;
}
}
/**
* Preserve main item id in subitem pagination url
*
* @param Array $params
* @return string
*/
function PageLink($params)
{
$object =& $this->getObject($params);
/* @var kDBList */
$parent_info = $object->getLinkedInfo();
if ($parent_info['ParentId'] > 0) {
$params['pass'] = 'm,'.$this->getPrefixSpecial().','.$parent_info['ParentPrefix'];
}
return parent::PageLink($params);
}
+
+ function InitCatalogTab($params)
+ {
+ $tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
+ $tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
+ $tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
+
+ // set default params (same as in catalog)
+ if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
+ if ($tab_params['special'] === false) $tab_params['special'] = '';
+ if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
+
+ // pass params to block with tab content
+ $params['name'] = $params['render_as'];
+ $params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+
+ $params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['tab_mode'] = $tab_params['mode'];
+ $params['tab_dependant'] = $tab_params['dependant'];
+ $params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
+ $params['tab_name'] = $this->Application->GetVar('tab_name');
+
+ return $this->Application->ParseBlock($params, 1);
+ }
+
+ /**
+ * Returns reviews count for each item type (in "Reviews" section)
+ *
+ * @param Array $params
+ * @return string
+ */
+ function CatalogItemCount($params)
+ {
+ $object =& $this->GetList($params);
+ if (!$object->Counted) {
+ $object->CountRecs();
+ }
+ return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
+ }
}
?>
\ No newline at end of file
Property changes on: branches/RC/kernel/units/reviews/reviews_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.9.2.1
\ No newline at end of property
Index: branches/RC/kernel/units/reviews/reviews_event_handler.php
===================================================================
--- branches/RC/kernel/units/reviews/reviews_event_handler.php (revision 10454)
+++ branches/RC/kernel/units/reviews/reviews_event_handler.php (revision 10455)
@@ -1,346 +1,474 @@
<?php
class ReviewsEventHandler extends kDBEventHandler
{
/**
* Get's special of main item for linking with subitem
*
* @param kEvent $event
* @return string
*/
function getMainSpecial(&$event)
{
if ($event->Special == 'product' && !$this->Application->IsAdmin()) {
// rev.product should auto-link
return '';
}
return parent::getMainSpecial($event);
}
/**
* Checks REVIEW/REVIEW.PENDING permission by main object primary category (not current category)
*
* @param kEvent $event
*/
function CheckPermission(&$event)
{
if ($event->Name == 'OnAddReview' || $event->Name == 'OnCreate') {
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
$perm_name = $this->getPermPrefix($event).'.REVIEW';
$res = $this->Application->CheckPermission($perm_name, 0, $main_object->GetDBField('CategoryId')) ||
$this->Application->CheckPermission($perm_name.'.PENDING', 0, $main_object->GetDBField('CategoryId'));
if (!$res) {
$event->status = erPERM_FAIL;
}
return $res;
}
+ $check_events = Array (
+ 'OnItemBuild', 'OnUpdate', /*'OnMassApprove', 'OnMassDecline'*/
+ );
+
+ $perm_category = $this->_getReviewCategory($event);
+
+ if (in_array($event->Name, $check_events)) {
+ // check for PRODUCT.VIEW permission
+
+ $perm_helper =& $this->Application->recallObject('PermissionsHelper');
+ /* @var $perm_helper kPermissionsHelper */
+
+ $perm_prefix = $this->getPermPrefix($event);
+
+ if ($perm_category === false) {
+ // no item id present -> allow
+ return true;
+ }
+
+ switch ($event->Name) {
+ case 'OnItemBuild':
+ $res = $this->Application->CheckPermission($perm_prefix . '.VIEW', 0, $perm_category);
+ break;
+
+ case 'OnUpdate':
+ case 'OnMassApprove':
+ case 'OnMassDecline':
+ $res = $this->Application->CheckPermission($perm_prefix . '.ADD', 0, $perm_category) ||
+ $this->Application->CheckPermission($perm_prefix . '.MODIFY', 0, $perm_category);
+ break;
+ }
+
+ if (!$res) {
+ $event->status = erPERM_FAIL;
+ }
+
+ return $res;
+
+ }
+
return parent::CheckPermission($event);
}
/**
+ * Returns primary category of review's main item
+ *
+ * @param kEvent $event
+ * @return int
+ */
+ function _getReviewCategory(&$event)
+ {
+ $items_info = $this->Application->GetVar($event->getPrefixSpecial());
+ list ($review_id, ) = each($items_info);
+
+ if (!$review_id) {
+ return false;
+ }
+
+ // 1. get main item resource id
+ $sql = 'SELECT ItemId
+ FROM ' . $this->Application->getUnitOption($event->Prefix, 'TableName') . '
+ WHERE ' . $this->Application->getUnitOption($event->Prefix, 'IDField') . ' = ' . $review_id;
+ $resource_id = $this->Conn->GetOne($sql);
+
+ // 2. set main item id (for permission checks)
+ $parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
+ $sql = 'SELECT ' . $this->Application->getUnitOption($parent_prefix, 'IDField') .'
+ FROM ' . $this->Application->getUnitOption($parent_prefix, 'TableName') .'
+ WHERE ResourceId = ' . $resource_id;
+ $this->Application->SetVar($parent_prefix . '_id', $this->Conn->GetOne($sql));
+
+ // 3. get main item category
+ $sql = 'SELECT CategoryId
+ FROM ' . $this->Application->getUnitOption('ci', 'TableName') .'
+ WHERE ItemResourceId = ' . $resource_id .' AND PrimaryCat = 1';
+ return $this->Conn->GetOne($sql);
+ }
+
+ /**
* Returns prefix for permissions
*
* @param kEvent $event
*/
function getPermPrefix(&$event)
{
- $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix);
+ $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix, true);
// this will return LINK for l, ARTICLE for n, TOPIC for bb, PRODUCT for p
$item_prefix = $this->Application->getUnitOption($main_prefix, 'PermItemPrefix');
return $item_prefix;
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @access protected
* @see OnListBuild
*/
function SetCustomQuery(&$event)
{
$object =& $event->getObject();
/* @var $object kDBList */
if (!$this->Application->IsAdmin()) {
$object->addFilter('active', '%1$s.Status = '.STATUS_ACTIVE);
}
switch ($event->Special)
{
case 'showall':
$object->clearFilters();
break;
case 'item': // used ?
$object->clearFilters();
$info = $object->getLinkedInfo();
$this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true);
$parent =& $this->Application->recallObject($info['ParentPrefix']);
$object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId'));
break;
case 'products': // used in In-Portal (Sturcture & Data -> Reviews section)
$object->removeFilter('parent_filter'); // this is important
$object->addFilter('product_reviews', 'pr.ResourceId IS NOT NULL');
break;
/*case 'product':
$object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); // for LEFT JOIN
break;*/
}
+ if (preg_match('/(.*)-rev/', $event->Prefix, $regs)) {
+ // "Structure & Data" -> "Reviews" (section in K4)
+ $item_type = $this->Application->getUnitOption($regs[1], 'ItemType');
+ $object->addFilter('itemtype_filter', '%1$s.ItemType = ' . $item_type);
+ }
+
if ($event->getEventParam('type') == 'current_user') {
// $object->removeFilter('active');
$object->addFilter('current_user', '%1$s.CreatedById = '.$this->Application->RecallVar('user_id'));
$object->addFilter('current_ip', '%1$s.IPAddress = "'.$_SERVER['REMOTE_ADDR'].'"');
}
}
/**
* Adds review from front in case if user is logged in
*
* @param kEvent $event
*/
function OnAddReview(&$event)
{
$event->CallSubEvent('OnCreate');
}
/**
* Get new review status on user review permission
*
* @param kEvent $event
* @return int
*/
function getReviewStatus(&$event)
{
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
$ret = STATUS_DISABLED;
$perm_name = $this->getPermPrefix($event).'.REVIEW';
if ($this->Application->CheckPermission($perm_name, 0, $main_object->GetDBField('CategoryId'))) {
$ret = STATUS_ACTIVE;
}
else if ($this->Application->CheckPermission($perm_name.'.PENDING', 0, $main_object->GetDBField('CategoryId'))) {
$ret = STATUS_PENDING;
}
return $ret;
}
/**
* Prefills all fields on front-end
*
* @param kEvent $event
*/
function OnBeforeItemCreate(&$event)
{
$object =& $event->getObject();
/* @var $object kDBItem */
$parent_info = $object->getLinkedInfo();
$item_type = $this->Application->getUnitOption($parent_info['ParentPrefix'], 'ItemType');
$object->SetDBField('IPAddress', $_SERVER['REMOTE_ADDR']);
$object->SetDBField('ItemType', $item_type);
$object->SetDBField('Module', $this->Application->findModule('Var', $parent_info['ParentPrefix'], 'Name'));
if ($this->Application->IsAdmin()) {
return ;
}
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
$spam_helper->InitHelper($parent_info['ParentId'], 'Review', 0);
if ($spam_helper->InSpamControl()) {
$event->status = erFAIL;
$object->SetError('ReviewText', 'too_frequent', 'lu_ferror_review_duplicate');
return ;
}
$rating = $object->GetDBField('Rating');
if ($rating < 1 || $rating > 5) {
$object->SetDBField('Rating', null);
}
$object->SetDBField('ItemId', $parent_info['ParentId']); // ResourceId
$object->SetDBField('CreatedById', $this->Application->RecallVar('user_id'));
$object->SetDBField('Status', $this->getReviewStatus($event));
$object->SetDBField('TextFormat', 0); // set plain text format directly
}
/**
* Sets correct rating value
*
* @param kEvent $event
*/
function OnBeforeItemUpdate(&$event)
{
$object =& $event->getObject();
$rating = $object->GetDBField('Rating');
if (!$rating) {
$object->SetDBField('Rating', null);
}
}
/**
* Updates item review counter
*
* @param kEvent $event
*/
function OnAfterItemCreate(&$event)
{
$this->updateSubitemCounters($event);
if (!$this->Application->IsAdmin()) {
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
$object =& $event->getObject();
$parent_info = $object->getLinkedInfo();
$config_mapping = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping');
$review_settings = $config_mapping['ReviewDelayValue'].':'.$config_mapping['ReviewDelayInterval'];
$spam_helper->InitHelper($parent_info['ParentId'], 'Review', $review_settings);
$spam_helper->AddToSpamControl();
}
}
/**
* Updates item review counter
*
* @param kEvent $event
*/
function OnAfterItemUpdate(&$event)
{
$this->updateSubitemCounters($event);
}
/**
* Updates total review counter, cached rating, votes count
*
* @param kEvent $event
*/
function updateSubitemCounters(&$event)
{
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix, null, Array ('raise_warnings' => 0));
/* @var $main_object kCatDBItem */
if (!$main_object->isLoaded()) {
// deleting main item / cloning main item
return ;
}
$object =& $event->getObject(); // for temp tables
/* @var $object kDBItem */
// 1. update review counter
$sql = 'SELECT COUNT(ReviewId)
FROM '.$object->TableName.'
WHERE ItemId = '.$main_object->GetDBField('ResourceId');
$review_count = $this->Conn->GetOne($sql);
$main_object->SetDBField('CachedReviewsQty', $review_count);
// 2. update votes counter + rating
$rating = $object->GetDBField('Rating');
$avg_rating = $main_object->GetDBField('CachedRating');
$votes_count = $main_object->GetDBField('CachedVotesQty');
switch ($event->Name) {
case 'OnAfterItemCreate': // adding new review with rating
$this->changeRating($avg_rating, $votes_count, $rating, '+');
break;
case 'OnAfterItemDelete':
$this->changeRating($avg_rating, $votes_count, $rating, '-');
break;
case 'OnAfterItemUpdate':
$this->changeRating($avg_rating, $votes_count, $object->GetOriginalField('Rating'), '-');
$this->changeRating($avg_rating, $votes_count, $rating, '+');
break;
}
$main_object->SetDBField('CachedRating', $avg_rating);
$main_object->SetDBField('CachedVotesQty', $votes_count);
$main_object->Update();
}
/**
* Changes average rating and votes count based on requested operation
*
* @param float $avg_rating average rating before new vote
* @param int $votes_count votes count before new vote
* @param int $rating new vote (from 1 to 5)
* @param string $operation requested operation (+ / -)
*/
function changeRating(&$avg_rating, &$votes_count, $rating, $operation)
{
if ($rating < 1 || $rating > 5) {
return ;
}
if ($operation == '+') {
$avg_rating = (($avg_rating * $votes_count) + $rating) / ($votes_count + 1);
++$votes_count;
}
else {
$avg_rating = (($avg_rating * $votes_count) - $rating) / ($votes_count - 1);
--$votes_count;
}
}
/**
* Updates main item cached review counter
*
* @param kEvent $event
*/
function OnAfterItemDelete(&$event)
{
$this->updateSubitemCounters($event);
}
/**
* Creates review & redirect to confirmation template
*
* @param kEvent $event
*/
function OnCreate(&$event)
{
parent::OnCreate($event);
if ($event->status != erSUCCESS || $this->Application->IsAdmin()) {
return ;
}
$object =& $event->getObject();
$next_template = $object->GetDBField('Status') == STATUS_ACTIVE ? 'success_template' : 'success_pending_template';
$event->redirect = $this->Application->GetVar($next_template);
$event->SetRedirectParam('opener', 's');
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$event->SetRedirectParam('pass', 'm,'.$parent_prefix);
}
+
+ /**
+ * Makes left join to item's table, when in separate grid
+ *
+ * @param kEvent $event
+ */
+ function OnAfterConfigRead(&$event)
+ {
+ parent::OnAfterConfigRead($event);
+
+ if (preg_match('/(.*)-rev/', $event->Prefix, $regs)) {
+ // "Structure & Data" -> "Reviews" (section in K4)
+
+ // 1. add join to items table (for "Structure & Data" -> "Reviews" section)
+ $item_table = $this->Application->getUnitOption($regs[1], 'TableName');
+
+ $list_sqls = $this->Application->getUnitOption($event->Prefix, 'ListSQLs');
+ $list_sqls[''] .= ' LEFT JOIN '.$item_table.' item_table ON item_table.ResourceId = %1$s.ItemId';
+ $this->Application->setUnitOption($event->Prefix, 'ListSQLs', $list_sqls);
+
+ // 2. add calculated field
+ $calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields');
+ $calculated_fields['']['CatalogItemName'] = 'item_table.' . $this->getTitleField($regs[1]);
+ $calculated_fields['']['CatalogItemId'] = 'item_table.' . $this->Application->getUnitOption($regs[1], 'IDField');
+ $this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields);
+ }
+ }
+
+ /**
+ * Convert TitleField field of kMultiLanguage formatter used for it
+ *
+ * @param string $prefix
+ * @return string
+ */
+ function getTitleField($prefix)
+ {
+ $lang_prefix = 'l'.$this->Application->GetVar('m_lang').'_';
+
+ $title_field = $this->Application->getUnitOption($prefix, 'TitleField');
+ $field_options = $this->Application->getUnitOption($prefix.'.'.$title_field, 'Fields');
+
+ $formatter_class = isset($field_options['formatter']) ? $field_options['formatter'] : '';
+ if ($formatter_class == 'kMultiLanguage' && !isset($field_options['master_field'])) {
+ $title_field = $lang_prefix.$title_field;
+ }
+ return $title_field;
+ }
}
?>
\ No newline at end of file
Property changes on: branches/RC/kernel/units/reviews/reviews_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14.2.2
\ No newline at end of property
+1.14.2.3
\ No newline at end of property
Index: branches/RC/kernel/units/sections/sections_config.php
===================================================================
--- branches/RC/kernel/units/sections/sections_config.php (revision 10454)
+++ branches/RC/kernel/units/sections/sections_config.php (revision 10455)
@@ -1,342 +1,342 @@
<?php
- $config = Array(
- 'Prefix' => 'inportal-sections',
- 'EventHandlerClass' => Array('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
- 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
-
-// 'SectionPrefix' => 'u',
- 'Sections' => Array(
- 'in-portal:root' => Array(
- 'parent' => null,
- 'icon' => 'in-portal:site',
- 'label' => $this->Application->ConfigValue('Site_Name'),
- 'url' => Array('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1),
- 'permissions' => Array('advanced:admin_login', 'advanced:front_login'),
- 'priority' => 0,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:site' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:struct',
- 'label' => 'la_tab_Site_Structure',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 1,
- 'type' => stTREE,
- 'SectionPrefix' => 'c',
- ),
-
- 'in-portal:browse' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:catalog',
- 'label' => 'la_tab_Browse',
- 'url' => Array('t' => 'in-portal/catalog', 'pass' => 'm'),
- 'late_load' => Array('t' => 'in-portal/xml/tree_categories', 'pass' => 'm', 'm_cat_id' => 0),
- 'onclick' => 'checkCatalog(0)',
- 'permissions' => Array('view'),
- 'priority' => 0.1,
- 'type' => stTREE,
- ),
- 'in-portal:advanced_view' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:advanced_view',
- 'label' => 'la_tab_AdvancedView',
- 'url' => Array('t' => 'in-portal/advanced_view', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 0.2,
- 'type' => stTREE,
- ),
-
- 'in-portal:reviews' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:reviews',
- 'label' => 'la_tab_Reviews',
- 'url' => Array('index_file' => 'reviews.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:configure_categories' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:cat_settings',
- 'label' => 'la_tab_Settings',
- 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:configuration_search' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:settings_search',
- 'label' => 'la_tab_ConfigSearch',
- 'url' => Array('t' => 'in-portal/config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- 'in-portal:configuration_email' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:settings_email',
- 'label' => 'la_tab_ConfigE-mail',
- 'url' => Array('t' => 'in-portal/config/config_email', 'module' => 'In-Portal:Category', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 6,
- 'type' => stTREE,
- ),
-
- 'in-portal:configuration_custom' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:settings_custom',
- 'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 7,
- 'type' => stTREE,
- ),
-
-
- 'in-portal:users' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:community',
- 'label' => 'la_tab_Community',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 2,
- 'type' => stTREE,
- 'SectionPrefix' => 'u',
- ),
-
- 'in-portal:user_list' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:users',
- 'label' => 'la_tab_User_List',
- 'url' => Array('t' => 'in-portal/users/users_list', 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
- 'priority' => 1,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_groups' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:usergroups',
- 'label' => 'la_tab_User_Groups',
- 'url' => Array('t' => 'in-portal/groups/groups_list', 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:send_email', 'advanced:manage_permissions'),
- 'priority' => 2,
- 'type' => stTREE,
- ),
-
- 'in-portal:configure_users' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:users_settings',
- 'label' => 'la_tab_ConfigSettings',
- 'url' => Array('t' => 'config/config_universal', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_email' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:settings_email',
- 'label' => 'la_tab_ConfigE-mail',
- 'url' => Array('t' => 'config/config_email', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_custom' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:settings_custom',
- 'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_banlist' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:banlist',
- 'label' => 'la_tab_BanList',
- 'url' => Array('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 6,
- 'type' => stTREE,
- ),
-
- // "Help" section
- 'in-portal:help' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:help',
- 'label' => 'la_tab_Help',
- 'url' => Array('index_file' => 'help/manual.pdf', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 7,
- 'type' => stTREE,
- ),
-
- // "Summary & Logs" section
- 'in-portal:reports' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:summary_logs',
- 'label' => 'la_tab_Reports',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 4,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:log_summary' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:summary',
- 'label' => 'la_tab_Summary',
- 'url' => Array('index_file' => 'logs/summary.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 1,
- 'type' => stTREE,
- ),
-
- 'in-portal:searchlog' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:search_log',
- 'label' => 'la_tab_SearchLog',
- 'url' => Array('index_file' => 'logs/searchlog.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 2,
- 'type' => stTREE,
- ),
-
- 'in-portal:sessionlog' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:sessions_log',
- 'label' => 'la_tab_SessionLog',
- 'url' => Array('index_file' => 'logs/session_list.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:emaillog' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:email_log',
- 'label' => 'la_tab_EmailLog',
- 'url' => Array('index_file' => 'logs/email_log.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:visits' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:visits',
- 'label' => 'la_tab_Visits',
- 'url' => Array('t' => 'in-portal/visits/visits_list', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- // "Configuration" section
- 'in-portal:system' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:conf',
- 'label' => 'la_tab_Sys_Config',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 5,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:configure_general' => Array(
- 'parent' => 'in-portal:system',
- 'icon' => 'in-portal:conf_general',
- 'label' => 'la_tab_General',
- 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'module' => 'In-Portal', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 1,
- 'type' => stTREE,
- ),
-
- 'in-portal:configure_themes' => Array(
- 'parent' => 'in-portal:system',
- 'icon' => 'in-portal:conf_themes',
- 'label' => 'la_tab_Themes',
- 'url' => Array('index_file' => 'config/config_theme.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- // "Tools" section
- 'in-portal:tools' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:tools',
- 'label' => 'la_tab_Tools',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 6,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:backup' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_backup',
- 'label' => 'la_tab_Backup',
- 'url' => Array('index_file' => 'backup/backup1.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 2,
- 'type' => stTREE,
- ),
-
- 'in-portal:restore' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_restore',
- 'label' => 'la_tab_Restore',
- 'url' => Array('index_file' => 'backup/restore1.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:main_import' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_import',
- 'label' => 'la_tab_ImportData',
- 'url' => Array('index_file' => 'import/step1.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:sql_query' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_import',
- 'label' => 'la_tab_QueryDB',
- 'url' => Array('index_file' => 'tools/sql_query.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- 'in-portal:server_info' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:server_info',
- 'label' => 'la_tab_ServerInfo',
- 'url' => Array('index_file' => 'tools/server_info.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 6,
- 'type' => stTREE,
- ),
- ),
+ $config = Array (
+ 'Prefix' => 'inportal-sections',
+ 'EventHandlerClass' => Array ('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'),
+
+// 'SectionPrefix' => 'u',
+ 'Sections' => Array (
+ 'in-portal:root' => Array (
+ 'parent' => null,
+ 'icon' => 'in-portal:site',
+ 'label' => $this->Application->ConfigValue('Site_Name'),
+ 'url' => Array ('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1),
+ 'permissions' => Array ('advanced:admin_login', 'advanced:front_login'),
+ 'priority' => 0,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:site' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:struct',
+ 'label' => 'la_tab_Site_Structure',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'c',
+ ),
+
+ 'in-portal:browse' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:catalog',
+ 'label' => 'la_tab_Browse',
+ 'url' => Array ('t' => 'in-portal/catalog', 'pass' => 'm'),
+ 'late_load' => Array ('t' => 'in-portal/xml/tree_categories', 'pass' => 'm', 'm_cat_id' => 0),
+ 'onclick' => 'checkCatalog(0)',
+ 'permissions' => Array ('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+ 'in-portal:advanced_view' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:advanced_view',
+ 'label' => 'la_tab_AdvancedView',
+ 'url' => Array ('t' => 'in-portal/advanced_view', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:reviews' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:reviews',
+ 'label' => 'la_tab_Reviews',
+ 'url' => Array ('t' => 'in-portal/reviews', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_categories' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:cat_settings',
+ 'label' => 'la_tab_Settings',
+ 'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_search' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_search',
+ 'label' => 'la_tab_ConfigSearch',
+ 'url' => Array ('t' => 'in-portal/config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_email' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array ('t' => 'in-portal/config/config_email', 'module' => 'In-Portal:Category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_custom' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+
+ 'in-portal:users' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:community',
+ 'label' => 'la_tab_Community',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'u',
+ ),
+
+ 'in-portal:user_list' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users',
+ 'label' => 'la_tab_User_List',
+ 'url' => Array ('t' => 'in-portal/users/users_list', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_groups' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:usergroups',
+ 'label' => 'la_tab_User_Groups',
+ 'url' => Array ('t' => 'in-portal/groups/groups_list', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete', 'advanced:send_email', 'advanced:manage_permissions'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_users' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users_settings',
+ 'label' => 'la_tab_ConfigSettings',
+ 'url' => Array ('t' => 'config/config_universal', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_email' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array ('t' => 'config/config_email', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_custom' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_banlist' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:banlist',
+ 'label' => 'la_tab_BanList',
+ 'url' => Array ('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ // "Help" section
+ 'in-portal:help' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:help',
+ 'label' => 'la_tab_Help',
+ 'url' => Array ('index_file' => 'help/manual.pdf', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+ // "Summary & Logs" section
+ 'in-portal:reports' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:summary_logs',
+ 'label' => 'la_tab_Reports',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:log_summary' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:summary',
+ 'label' => 'la_tab_Summary',
+ 'url' => Array ('index_file' => 'logs/summary.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:searchlog' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:search_log',
+ 'label' => 'la_tab_SearchLog',
+ 'url' => Array ('index_file' => 'logs/searchlog.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sessionlog' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:sessions_log',
+ 'label' => 'la_tab_SessionLog',
+ 'url' => Array ('index_file' => 'logs/session_list.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:emaillog' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:email_log',
+ 'label' => 'la_tab_EmailLog',
+ 'url' => Array ('index_file' => 'logs/email_log.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:visits' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:visits',
+ 'label' => 'la_tab_Visits',
+ 'url' => Array ('t' => 'in-portal/visits/visits_list', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ // "Configuration" section
+ 'in-portal:system' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:conf',
+ 'label' => 'la_tab_Sys_Config',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:configure_general' => Array (
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_general',
+ 'label' => 'la_tab_General',
+ 'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'module' => 'In-Portal', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_themes' => Array (
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_themes',
+ 'label' => 'la_tab_Themes',
+ 'url' => Array ('index_file' => 'config/config_theme.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ // "Tools" section
+ 'in-portal:tools' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:tools',
+ 'label' => 'la_tab_Tools',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:backup' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_backup',
+ 'label' => 'la_tab_Backup',
+ 'url' => Array ('index_file' => 'backup/backup1.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:restore' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_restore',
+ 'label' => 'la_tab_Restore',
+ 'url' => Array ('index_file' => 'backup/restore1.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:main_import' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_ImportData',
+ 'url' => Array ('index_file' => 'import/step1.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sql_query' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_QueryDB',
+ 'url' => Array ('index_file' => 'tools/sql_query.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:server_info' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:server_info',
+ 'label' => 'la_tab_ServerInfo',
+ 'url' => Array ('index_file' => 'tools/server_info.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+ ),
);
\ No newline at end of file
Property changes on: branches/RC/kernel/units/sections/sections_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5.2.1
\ No newline at end of property
+1.5.2.2
\ No newline at end of property
Index: branches/RC/kernel/admin_templates/reviews.tpl
===================================================================
--- branches/RC/kernel/admin_templates/reviews.tpl (nonexistent)
+++ branches/RC/kernel/admin_templates/reviews.tpl (revision 10455)
@@ -0,0 +1,146 @@
+<inp2:m_include t="incs/header" nobody="yes" noform="yes"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+
+<inp2:m_RenderElement name="combined_header" section="in-portal:reviews" prefix="c" module="in-portal" title_preset="reviews"/>
+
+<!-- main kernel_form: begin -->
+<inp2:m_RenderElement name="kernel_form"/>
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <input type="hidden" name="m_cat_id" value="<inp2:m_get name="m_cat_id"/>"/>
+ <link rel="stylesheet" rev="stylesheet" href="incs/nlsmenu.css" type="text/css" />
+ <script type="text/javascript" src="js/nlsmenu.js"></script>
+ <script type="text/javascript" src="js/nlsmenueffect_1_2_1.js"></script>
+ <script type="text/javascript" src="js/ajax.js"></script>
+ <script type="text/javascript" src="<inp2:m_TemplatesBase module='in-portal'/>/incs/catalog.js"></script>
+ <script type="text/javascript">
+ var menuMgr = new NlsMenuManager("mgr");
+ menuMgr.timeout = 500;
+ menuMgr.flowOverFormElement = true;
+
+ Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
+
+ Catalog.prototype.AfterInit = function() {
+ this.switchTab();
+ }
+
+ Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
+ var $cat_id = get_hidden_field('m_cat_id');
+ var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id');
+ if ($cat_id != $tab_cat_id || $force) {
+ // query tab content only in case if not queried or category don't match
+ var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#TAB_NAME#', this.queryTabRegistry('prefix', $prefix, 'tab_id'));
+ this.BusyRequest[$prefix] = false;
+
+ Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id, this);
+ }
+ }
+
+ var $Catalog = new Catalog('<inp2:m_Link template="in-portal/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"/>', 'reviews_', 0);
+ var a_toolbar = new ToolBar();
+
+ 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() {
+ var $template = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'view_template');
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ std_delete_items($Catalog.ActivePrefix, $template, 1);
+ } ) );
+
+
+ <inp2:m_ModuleInclude template="catalog_buttons" main_template="reviews" skip_prefixes="m,cms"/>
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
+ a_toolbar.AddButton( new ToolBarButton('approve', '<inp2:m_phrase label="la_ToolTip_Approve" escape="1"/>', function() {
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ $Catalog.submit_event($Catalog.ActivePrefix, 'OnMassApprove');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('decline', '<inp2:m_phrase label="la_ToolTip_Decline" escape="1"/>', function() {
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ $Catalog.submit_event($Catalog.ActivePrefix, 'OnMassDecline');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep3') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar, 'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+
+ function edit()
+ {
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ 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"/>' . replace('#PREFIX#', $Catalog.ActivePrefix);
+
+ std_edit_temp_item($Catalog.ActivePrefix, 'in-portal/reviews/review_direct_edit');
+
+ $kf.action = $prev_action;
+ }
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+<inp2:m_RenderElement name="kernel_form_end"/>
+<!-- main kernel_form: end -->
+
+<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"/>-rev_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$Catalog.switchTab('<inp2:m_param name="prefix"/>-rev');">
+ <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_phrase name="$title"/> <span class="cats_stats">(<span id="<inp2:m_param name="prefix"/>-rev_item_count">?</span>)</span>
+ </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="ViewMenuPhrase" skip_prefixes="m,cms"/>
+ </tr>
+</table>
+<!-- item tabs: end -->
+<inp2:m_set prefix_append="-rev" td="no"/>
+<inp2:m_ModuleInclude template="catalog_tab" tab_init="2" skip_prefixes="m,cms"/>
+
+<inp2:m_if check="m_get" var="SetTab">
+<script type="text/javascript">
+ $Catalog.switchTab('<inp2:m_get var="SetTab"/>-rev');
+</script>
+</inp2:m_if>
+
+<script type="text/javascript">
+ addLoadEvent(
+ function() {
+ $Catalog.Init();
+ }
+ );
+</script>
+
+<inp2:m_include t="incs/footer" noform="yes"/>
\ No newline at end of file
Property changes on: branches/RC/kernel/admin_templates/reviews.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Index: branches/RC/kernel/admin_templates/reviews/reviews_tab.tpl
===================================================================
--- branches/RC/kernel/admin_templates/reviews/reviews_tab.tpl (nonexistent)
+++ branches/RC/kernel/admin_templates/reviews/reviews_tab.tpl (revision 10455)
@@ -0,0 +1,46 @@
+<inp2:m_DefineElement name="catalog_tab">
+ <inp2:m_if check="m_ParamEquals" name="tab_init" value="">
+ <inp2:lang.current_Field name="Charset" result_to_var="charset"/>
+ <inp2:m_Header data="Content-type: text/plain; charset=$charset"/>
+ <inp2:m_include t="incs/blocks"/>
+ <inp2:m_include t="incs/grid_blocks"/>
+
+ $Catalog.setItemCount('<inp2:m_param name="prefix"/>', '<inp2:{$prefix}_CatalogItemCount/>');
+ $Catalog.setCurrentCategory('<inp2:m_param name="prefix"/>', 0);
+
+ <inp2:m_RenderElement name="grid_js" selected_class="selected_div" tag_name="tr" PrefixSpecial="$prefix" IdField="ReviewId" grid="ReviewsSection" menu_filters="yes"/>
+ <inp2:m_RenderElement name="grid_search_buttons" PrefixSpecial="$prefix" grid="Default" ajax="1"/>
+ <inp2:m_if check="m_ParamEquals" name="tab_dependant" value="yes">
+ Grids['<inp2:m_param name="prefix"/>'].AddAlternativeGrid('<inp2:m_param name="cat_prefix"/>', true);
+ </inp2:m_if>
+ Grids['<inp2:m_param name="prefix"/>'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));
+ $Catalog.reflectPasteButton(<inp2:c_HasClipboard/>);
+ $Catalog.setViewMenu('<inp2:m_param name="prefix"/>');
+ <inp2:m_if check="m_ParamEquals" name="tab_mode" value="single">
+ Grids['<inp2:m_param name="prefix"/>'].EnableRadioMode();
+ Grids['<inp2:m_param name="prefix"/>'].DblClick = function() {return false};
+ </inp2:m_if>
+ #separator#
+ <!-- products tab: begin -->
+ <inp2:m_RenderElement name="kernel_form" form_name="{$tab_name}_form"/>
+
+ <inp2:m_DefineElement name="grid_reviewtext_td">
+ <td valign="top" class="text">
+ <inp2:Field field="$field" cut_first="100"/>
+ <br />
+ <span class="cats_stats">
+ <a href="<inp2:ItemEditLink/>"><inp2:Field field="CatalogItemName"/></a>
+ </span>
+ </td>
+ </inp2:m_DefineElement>
+
+
+ <inp2:m_RenderElement name="grid" ajax="1" PrefixSpecial="$prefix" IdField="ReviewId" grid="ReviewsSection" no_toolbar="no_toolbar" menu_filters="yes"/>
+
+ <inp2:m_RenderElement name="kernel_form_end"/>
+ <!-- products tab: end -->
+ </inp2:m_if>
+</inp2:m_DefineElement>
+
+<inp2:m_Get name="item_prefix" result_to_var="prefix"/>
+<inp2:{$prefix}_InitCatalogTab render_as="catalog_tab"/>
\ No newline at end of file
Property changes on: branches/RC/kernel/admin_templates/reviews/reviews_tab.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Index: branches/RC/kernel/admin_templates/reviews/review_direct_edit.tpl
===================================================================
--- branches/RC/kernel/admin_templates/reviews/review_direct_edit.tpl (nonexistent)
+++ branches/RC/kernel/admin_templates/reviews/review_direct_edit.tpl (revision 10455)
@@ -0,0 +1,43 @@
+<inp2:m_include t="incs/header" nobody="yes"/>
+<inp2:m_Get name="item_prefix" result_to_var="prefix"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+
+<inp2:m_RenderElement name="combined_header" section="in-portal:reviews" prefix="c" module="in-portal" title_preset="review_edit"/>
+
+<!-- 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('<inp2:m_Param name="prefix"/>','<inp2:{$prefix}_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('<inp2:m_Param name="prefix"/>','OnCancel');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <inp2:m_RenderElement name="subsection" title="!la_Text_Review!"/>
+ <inp2:m_RenderElement name="inp_edit_hidden" prefix="$prefix" field="ItemId"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox_allow_html" prefix="$prefix" field="TextFormat"/>
+ <inp2:m_RenderElement name="inp_label" prefix="$prefix" field="ReviewId" title="!la_fld_ReviewId!"/>
+ <inp2:m_RenderElement name="inp_edit_user" prefix="$prefix" field="CreatedById" title="!la_fld_CreatedById!" class="text"/>
+ <inp2:m_RenderElement name="inp_edit_textarea" prefix="$prefix" field="ReviewText" title="!la_fld_ReviewText!" cols="70" rows="8"/>
+ <inp2:m_RenderElement name="subsection" title="!la_Text_General!"/>
+ <inp2:m_RenderElement name="inp_edit_radio" prefix="$prefix" field="Status" title="!la_fld_Status!"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="$prefix" field="Priority" title="!la_fld_Priority!" size="3" class="text"/>
+ <inp2:m_RenderElement name="inp_edit_date_time" prefix="$prefix" field="CreatedOn" title="!la_fld_CreatedOn!" size="20" class="text"/>
+</table>
+<inp2:m_include t="incs/footer"/>
Property changes on: branches/RC/kernel/admin_templates/reviews/review_direct_edit.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Index: branches/RC/kernel/admin_templates/img/icons/icon46_reviews.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: branches/RC/kernel/admin_templates/img/icons/icon46_reviews.gif
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: branches/RC/core/kernel/db/db_event_handler.php
===================================================================
--- branches/RC/core/kernel/db/db_event_handler.php (revision 10454)
+++ branches/RC/core/kernel/db/db_event_handler.php (revision 10455)
@@ -1,2316 +1,2316 @@
<?php
define('EH_CUSTOM_PROCESSING_BEFORE',1);
define('EH_CUSTOM_PROCESSING_AFTER',2);
/**
* Note:
* 1. When adressing variables from submit containing
* Prefix_Special as part of their name use
* $event->getPrefixSpecial(true) instead of
* $event->Prefix_Special as usual. This is due PHP
* is converting "." symbols in variable names during
* submit info "_". $event->getPrefixSpecial optional
* 1st parameter returns correct corrent Prefix_Special
* for variables beeing submitted such way (e.g. variable
* name that will be converted by PHP: "users.read_only_id"
* will be submitted as "users_read_only_id".
*
* 2. When using $this->Application-LinkVar on variables submitted
* from form which contain $Prefix_Special then note 1st item. Example:
* LinkVar($event->getPrefixSpecial(true).'_varname',$event->Prefix_Special.'_varname')
*
*/
/**
* EventHandler that is used to process
* any database related events
*
*/
class kDBEventHandler extends kEventHandler {
/**
* Description
*
* @var kDBConnection
* @access public
*/
var $Conn;
/**
* Adds ability to address db connection
*
* @return kDBEventHandler
* @access public
*/
function kDBEventHandler()
{
parent::kBase();
$this->Conn =& $this->Application->GetADODBConnection();
}
/**
* Checks permissions of user
*
* @param kEvent $event
*/
function CheckPermission(&$event)
{
if (!$this->Application->IsAdmin()) {
$allow_events = Array('OnSearch', 'OnSearchReset', 'OnNew');
if (in_array($event->Name, $allow_events)) {
// allow search on front
return true;
}
}
$section = $event->getSection();
if (!preg_match('/^CATEGORY:(.*)/', $section)) {
// only if not category item events
if ((substr($event->Name, 0, 9) == 'OnPreSave') || ($event->Name == 'OnSave')) {
if ($this->isNewItemCreate($event)) {
return $this->Application->CheckPermission($section.'.add', 1);
}
else {
return $this->Application->CheckPermission($section.'.add', 1) || $this->Application->CheckPermission($section.'.edit', 1);
}
}
}
if ($event->Name == 'OnPreCreate') {
// save category_id before item create (for item category selector not to destroy permission checking category)
$this->Application->LinkVar('m_cat_id');
}
return parent::CheckPermission($event);
}
/**
* Allows to override standart permission mapping
*
*/
function mapPermissions()
{
parent::mapPermissions();
$permissions = Array(
'OnLoad' => Array('self' => 'view', 'subitem' => 'view'),
'OnItemBuild' => Array('self' => 'view', 'subitem' => 'view'),
'OnBuild' => Array('self' => true),
'OnNew' => Array('self' => 'add', 'subitem' => 'add|edit'),
'OnCreate' => Array('self' => 'add', 'subitem' => 'add|edit'),
'OnUpdate' => Array('self' => 'edit', 'subitem' => 'add|edit'),
'OnSetPrimary' => Array('self' => 'add|edit', 'subitem' => 'add|edit'),
'OnDelete' => Array('self' => 'delete', 'subitem' => 'add|edit'),
'OnMassDelete' => Array('self' => 'delete', 'subitem' => 'add|edit'),
'OnMassClone' => Array('self' => 'add', 'subitem' => 'add|edit'),
'OnCut' => array('self'=>'edit', 'subitem' => 'edit'),
'OnCopy' => array('self'=>'edit', 'subitem' => 'edit'),
'OnPaste' => array('self'=>'edit', 'subitem' => 'edit'),
'OnSelectItems' => Array('self' => 'add|edit', 'subitem' => 'add|edit'),
'OnProcessSelected' => Array('self' => 'add|edit', 'subitem' => 'add|edit'),
'OnSelectUser' => Array('self' => 'add|edit', 'subitem' => 'add|edit'),
'OnMassApprove' => Array('self' => 'advanced:approve|edit', 'subitem' => 'advanced:approve|add|edit'),
'OnMassDecline' => Array('self' => 'advanced:decline|edit', 'subitem' => 'advanced:decline|add|edit'),
'OnMassMoveUp' => Array('self' => 'advanced:move_up|edit', 'subitem' => 'advanced:move_up|add|edit'),
'OnMassMoveDown' => Array('self' => 'advanced:move_down|edit', 'subitem' => 'advanced:move_down|add|edit'),
'OnPreCreate' => Array('self' => 'add|add.pending', 'subitem' => 'edit|edit.pending'),
'OnEdit' => Array('self' => 'edit|edit.pending', 'subitem' => 'edit|edit.pending'),
'OnExport' => Array('self' => 'view|advanced:export'),
'OnExportBegin' => Array('self' => 'view|advanced:export'),
'OnExportProgress' => Array('self' => 'view|advanced:export'),
- 'OnSetAutoRefreshInterval' => Array ('self' => 'view', 'subitem' => 'view'),
- 'OnAutoRefreshToggle' => Array ('self' => 'view', 'subitem' => 'view'),
+ 'OnSetAutoRefreshInterval' => Array ('self' => true, 'subitem' => true),
+ 'OnAutoRefreshToggle' => Array ('self' => true, 'subitem' => true),
// theese event do not harm, but just in case check them too :)
'OnCancelEdit' => Array('self' => true, 'subitem' => true),
'OnCancel' => Array('self' => true, 'subitem' => true),
'OnReset' => Array('self' => true, 'subitem' => true),
'OnSetSorting' => Array('self' => true, 'subitem' => true),
'OnSetSortingDirect' => Array('self' => true, 'subitem' => true),
'OnSetFilter' => Array('self' => true, 'subitem' => true),
'OnApplyFilters' => Array('self' => true, 'subitem' => true),
'OnRemoveFilters' => Array('self' => true, 'subitem' => true),
'OnSetFilterPattern' => Array('self' => true, 'subitem' => true),
'OnSetPerPage' => Array('self' => true, 'subitem' => true),
'OnSearch' => Array('self' => true, 'subitem' => true),
'OnSearchReset' => Array('self' => true, 'subitem' => true),
'OnGoBack' => Array('self' => true, 'subitem' => true),
// it checks permission itself since flash uploader does not send cookies
'OnUploadFile' => Array('self'=>true, 'subitem'=>true),
'OnViewFile' => Array('self'=>true, 'subitem'=>true),
'OnSaveWidths' => Array('self'=>true, 'subitem'=>true),
'OnValidateMInputFields' => Array('self'=>'view'),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
function mapEvents()
{
$events_map = Array(
'OnRemoveFilters' => 'FilterAction',
'OnApplyFilters' => 'FilterAction',
'OnMassApprove'=>'iterateItems',
'OnMassDecline'=>'iterateItems',
'OnMassMoveUp'=>'iterateItems',
'OnMassMoveDown'=>'iterateItems',
);
$this->eventMethods = array_merge($this->eventMethods, $events_map);
}
/**
* Returns ID of current item to be edited
* by checking ID passed in get/post as prefix_id
* or by looking at first from selected ids, stored.
* Returned id is also stored in Session in case
* it was explicitly passed as get/post
*
* @param kEvent $event
* @return int
*/
function getPassedID(&$event)
{
if ($event->getEventParam('raise_warnings') === false) {
$event->setEventParam('raise_warnings', 1);
}
if (preg_match('/^auto-(.*)/', $event->Special, $regs) && $this->Application->prefixRegistred($regs[1])) {
// <inp2:lang.auto-phrase_Field name="DateFormat"/> - returns field DateFormat value from language (LanguageId is extracted from current phrase object)
$main_object =& $this->Application->recallObject($regs[1]);
/* @var $main_object kDBItem */
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');
return $main_object->GetDBField($id_field);
}
// 1. get id from post (used in admin)
$ret = $this->Application->GetVar($event->getPrefixSpecial(true).'_id');
if ($ret) {
return $ret;
}
// 2. get id from env (used in front)
$ret = $this->Application->GetVar($event->getPrefixSpecial().'_id');
if ($ret) {
return $ret;
}
// recall selected ids array and use the first one
$ids = $this->Application->GetVar($event->getPrefixSpecial().'_selected_ids');
if ($ids != '') {
$ids = explode(',',$ids);
if ($ids) {
$ret = array_shift($ids);
}
}
else { // if selected ids are not yet stored
$this->StoreSelectedIDs($event);
return $this->Application->GetVar($event->getPrefixSpecial(true).'_id'); // StoreSelectedIDs sets this variable
}
return $ret;
}
/**
* Prepares and stores selected_ids string
* in Session and Application Variables
* by getting all checked ids from grid plus
* id passed in get/post as prefix_id
*
* @param kEvent $event
* @param Array $ids
*
* @return Array ids stored
*/
function StoreSelectedIDs(&$event, $ids = null)
{
$wid = $this->Application->GetTopmostWid($event->Prefix);
$session_name = rtrim($event->getPrefixSpecial().'_selected_ids_'.$wid, '_');
if (isset($ids)) {
// save ids directly if they given
$this->Application->StoreVar($session_name, implode(',', $ids));
return $ids;
}
$ret = Array();
// May be we don't need this part: ?
$passed = $this->Application->GetVar($event->getPrefixSpecial(true).'_id');
if($passed !== false && $passed != '')
{
array_push($ret, $passed);
}
$ids = Array();
// get selected ids from post & save them to session
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if($items_info)
{
$id_field = $this->Application->getUnitOption($event->Prefix,'IDField');
foreach($items_info as $id => $field_values)
{
if( getArrayValue($field_values,$id_field) ) array_push($ids,$id);
}
//$ids=array_keys($items_info);
}
$ret = array_unique(array_merge($ret, $ids));
$this->Application->SetVar($event->getPrefixSpecial().'_selected_ids', implode(',',$ret));
$this->Application->LinkVar($event->getPrefixSpecial().'_selected_ids', $session_name);
// This is critical - otherwise getPassedID will return last ID stored in session! (not exactly true)
// this smells... needs to be refactored
$first_id = getArrayValue($ret,0);
if (($first_id === false) && ($event->getEventParam('raise_warnings') == 1)) {
if ($this->Application->isDebugMode()) {
$this->Application->Debugger->appendTrace();
}
trigger_error('Requested ID for prefix <b>'.$event->getPrefixSpecial().'</b> <span class="debug_error">not passed</span>',E_USER_NOTICE);
}
$this->Application->SetVar($event->getPrefixSpecial(true).'_id', $first_id);
return $ret;
}
/**
* Returns stored selected ids as an array
*
* @param kEvent $event
* @param bool $from_session return ids from session (written, when editing was started)
* @return array
*/
function getSelectedIDs(&$event, $from_session = false)
{
if ($from_session) {
$wid = $this->Application->GetTopmostWid($event->Prefix);
$var_name = rtrim($event->getPrefixSpecial().'_selected_ids_'.$wid, '_');
$ret = $this->Application->RecallVar($var_name);
}
else {
$ret = $this->Application->GetVar($event->getPrefixSpecial().'_selected_ids');
}
return explode(',', $ret);
}
/**
* Returs associative array of submitted fields for current item
* Could be used while creating/editing single item -
* meaning on any edit form, except grid edit
*
* @param kEvent $event
*/
function getSubmittedFields(&$event)
{
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
$field_values = $items_info ? array_shift($items_info) : Array();
return $field_values;
}
/**
* Removes any information about current/selected ids
* from Application variables and Session
*
* @param kEvent $event
*/
function clearSelectedIDs(&$event)
{
$prefix_special = $event->getPrefixSpecial();
$ids = implode(',', $this->getSelectedIDs($event, true));
$event->setEventParam('ids', $ids);
$wid = $this->Application->GetTopmostWid($event->Prefix);
$session_name = rtrim($prefix_special.'_selected_ids_'.$wid, '_');
$this->Application->RemoveVar($session_name);
$this->Application->SetVar($prefix_special.'_selected_ids', '');
$this->Application->SetVar($prefix_special.'_id', ''); // $event->getPrefixSpecial(true).'_id' too may be
}
/*function SetSaveEvent(&$event)
{
$this->Application->SetVar($event->Prefix_Special.'_SaveEvent','OnUpdate');
$this->Application->LinkVar($event->Prefix_Special.'_SaveEvent');
}*/
/**
* Common builder part for Item & List
*
* @param kDBBase $object
* @param kEvent $event
* @access private
*/
function dbBuild(&$object, &$event)
{
$object->Configure( $event->getEventParam('populate_ml_fields') || $this->Application->getUnitOption($event->Prefix, 'PopulateMlFields') );
$this->PrepareObject($object, $event);
// force live table if specified or is original item
$live_table = $event->getEventParam('live_table') || $event->Special == 'original';
if( $this->UseTempTables($event) && !$live_table )
{
$object->SwitchToTemp();
}
// This strange constuction creates hidden field for storing event name in form submit
// It pass SaveEvent to next screen, otherwise after unsuccsefull create it will try to update rather than create
$current_event = $this->Application->GetVar($event->Prefix_Special.'_event');
// $this->Application->setEvent($event->Prefix_Special, $current_event);
$this->Application->setEvent($event->Prefix_Special, '');
$save_event = $this->UseTempTables($event) && $this->Application->GetTopmostPrefix($event->Prefix) == $event->Prefix ? 'OnSave' : 'OnUpdate';
$this->Application->SetVar($event->Prefix_Special.'_SaveEvent',$save_event);
}
/**
* Checks, that currently loaded item is allowed for viewing (non permission-based)
*
* @param kEvent $event
* @return bool
*/
function checkItemStatus(&$event)
{
$status_fields = $this->Application->getUnitOption($event->Prefix,'StatusField');
if (!$status_fields) {
return true;
}
$status_field = array_shift($status_fields);
if ($status_field == 'Status' || $status_field == 'Enabled') {
$object =& $event->getObject();
if (!$object->isLoaded()) {
return true;
}
return $object->GetDBField($status_field) == STATUS_ACTIVE;
}
return true;
}
/**
* Builds item (loads if needed)
*
* @param kEvent $event
* @access protected
*/
function OnItemBuild(&$event)
{
$object =& $event->getObject();
$this->dbBuild($object,$event);
$sql = $this->ItemPrepareQuery($event);
$sql = $this->Application->ReplaceLanguageTags($sql);
$object->setSelectSQL($sql);
// 2. loads if allowed
$auto_load = $this->Application->getUnitOption($event->Prefix,'AutoLoad');
$skip_autload = $event->getEventParam('skip_autoload');
if ($auto_load && !$skip_autload) {
$perm_status = true;
$user_id = $this->Application->RecallVar('user_id');
$event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true));
$status_checked = false;
if ($user_id == -1 || $this->CheckPermission($event)) {
// don't autoload item, when user doesn't have view permission
$this->LoadItem($event);
$status_checked = true;
if ($user_id != -1 && !$this->Application->IsAdmin() && !$this->checkItemStatus($event)) {
$perm_status = false;
}
}
else {
$perm_status = false;
}
if (!$perm_status) {
// when no permission to view item -> redirect to no pemrission template
if ($this->Application->isDebugMode()) {
$this->Application->Debugger->appendTrace();
}
trigger_error('ItemLoad Permission Failed for prefix ['.$event->getPrefixSpecial().'] in <strong>'.($status_checked ? 'checkItemStatus' : 'CheckPermission').'</strong>', E_USER_WARNING);
$next_template = $this->Application->IsAdmin() ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate');
$this->Application->Redirect($next_template, Array('next_template' => $this->Application->GetVar('t')));
}
}
$actions =& $this->Application->recallObject('kActions');
$actions->Set($event->Prefix_Special.'_GoTab', '');
$actions->Set($event->Prefix_Special.'_GoId', '');
}
/**
* Build subtables array from configs
*
* @param kEvent $event
*/
function OnTempHandlerBuild(&$event)
{
$object =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
/* @var $object kTempTablesHandler */
$object->BuildTables( $event->Prefix, $this->getSelectedIDs($event) );
}
/**
* Enter description here...
*
* @param kEvent $event
* @return unknown
*/
function UseTempTables(&$event)
{
$object = &$event->getObject();
$top_prefix = $this->Application->GetTopmostPrefix($event->Prefix);
$var_names = Array (
$top_prefix,
rtrim($top_prefix.'_'.$event->Special, '_'),
rtrim($top_prefix.'.'.$event->Special, '.'),
);
$var_names = array_unique($var_names);
$temp_mode = false;
foreach ($var_names as $var_name) {
$value = $this->Application->GetVar($var_name.'_mode');
if (substr($value, 0, 1) == 't') {
$temp_mode = true;
break;
}
}
return $temp_mode;
}
/**
* Returns table prefix from event (temp or live)
*
* @param kEvent $event
* @return string
* @todo Needed? Should be refactored (by Alex)
*/
function TablePrefix(&$event)
{
return $this->UseTempTables($event) ? $this->Application->GetTempTablePrefix('prefix:'.$event->Prefix).TABLE_PREFIX : TABLE_PREFIX;
}
/**
* Load item if id is available
*
* @param kEvent $event
*/
function LoadItem(&$event)
{
$object =& $event->getObject();
$id = $this->getPassedID($event);
if ($object->Load($id)) {
$actions =& $this->Application->recallObject('kActions');
$actions->Set($event->Prefix_Special.'_id', $object->GetID() );
}
else {
$object->setID($id);
}
}
/**
* Builds list
*
* @param kEvent $event
* @access protected
*/
function OnListBuild(&$event)
{
$object =& $event->getObject();
/* @var $object kDBList */
$this->dbBuild($object,$event);
$sql = $this->ListPrepareQuery($event);
$sql = $this->Application->ReplaceLanguageTags($sql);
$object->setSelectSQL($sql);
$object->Counted = false; // when requery="1" should re-count records too!
$object->ClearOrderFields(); // prevents duplicate order fields, when using requery="1"
$object->linkToParent( $this->getMainSpecial($event) );
$this->AddFilters($event);
$this->SetCustomQuery($event); // new!, use this for dynamic queries based on specials for ex.
$this->SetPagination($event);
$this->SetSorting($event);
// $object->CalculateTotals(); // Now called in getTotals to avoid extra query
$actions =& $this->Application->recallObject('kActions');
$actions->Set('remove_specials['.$event->Prefix_Special.']', '0');
$actions->Set($event->Prefix_Special.'_GoTab', '');
}
/**
* Get's special of main item for linking with subitem
*
* @param kEvent $event
* @return string
*/
function getMainSpecial(&$event)
{
$special = $event->getEventParam('main_special');
if($special === false || $special == '$main_special')
{
$special = $event->Special;
}
return $special;
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @access protected
* @see OnListBuild
*/
function SetCustomQuery(&$event)
{
}
/**
* Set's new perpage for grid
*
* @param kEvent $event
*/
function OnSetPerPage(&$event)
{
$per_page = $this->Application->GetVar($event->getPrefixSpecial(true).'_PerPage');
$this->Application->StoreVar($event->getPrefixSpecial().'_PerPage', $per_page);
$view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view');
$this->Application->StorePersistentVar($event->getPrefixSpecial().'_PerPage.'.$view_name, $per_page);
}
/**
* Set's correct page for list
* based on data provided with event
*
* @param kEvent $event
* @access private
* @see OnListBuild
*/
function SetPagination(&$event)
{
// get PerPage (forced -> session -> config -> 10)
$per_page = $this->getPerPage($event);
$object =& $event->getObject();
$object->SetPerPage($per_page);
$this->Application->StoreVarDefault($event->getPrefixSpecial().'_Page', 1);
$page = $this->Application->GetVar($event->getPrefixSpecial().'_Page');
if (!$page) {
$page = $this->Application->GetVar($event->getPrefixSpecial(true).'_Page');
}
if (!$page) {
$page = $this->Application->RecallVar($event->getPrefixSpecial().'_Page');
}
else {
$this->Application->StoreVar($event->getPrefixSpecial().'_Page', $page);
}
if( !$event->getEventParam('skip_counting') )
{
$pages = $object->GetTotalPages();
if($page > $pages)
{
$this->Application->StoreVar($event->getPrefixSpecial().'_Page', 1);
$page = 1;
}
}
/*$per_page = $event->getEventParam('per_page');
if ($per_page == 'list_next') {
$cur_page = $page;
$cur_per_page = $per_page;
$object->SetPerPage(1);
$object =& $this->Application->recallObject($event->Prefix);
$cur_item_index = $object->CurrentIndex;
$page = ($cur_page-1) * $cur_per_page + $cur_item_index + 1;
$object->SetPerPage(1);
}*/
$object->SetPage($page);
}
/**
* Returns current per-page setting for list
*
* @param kEvent $event
* @return int
*/
function getPerPage(&$event)
{
// 1. per-page is passed as tag parameter to PrintList, InitList, etc.
$per_page = $event->getEventParam('per_page');
/*if ($per_page == 'list_next') {
$per_page = '';
}*/
// 2. per-page variable name is store into config variable
$config_mapping = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping');
if ($config_mapping) {
switch ( $per_page ){
case 'short_list' :
$per_page = $this->Application->ConfigValue($config_mapping['ShortListPerPage']);
break;
case 'default' :
$per_page = $this->Application->ConfigValue($config_mapping['PerPage']);
break;
}
}
if (!$per_page) {
// per-page is stored to persistent session
$view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view');
$storage_prefix = $event->getEventParam('same_special') ? $event->Prefix : $event->getPrefixSpecial();
$per_page = $this->Application->RecallPersistentVar($storage_prefix.'_PerPage.'.$view_name, '_USE_DEFAULT_USER_DATA_');
if (!$per_page) {
// per-page is stored to current session
$per_page = $this->Application->RecallVar($storage_prefix.'_PerPage');
}
if (!$per_page) {
if ($config_mapping) {
if (!isset($config_mapping['PerPage'])) {
trigger_error('Incorrect mapping of <span class="debug_error">PerPage</span> key in config for prefix <b>'.$event->Prefix.'</b>', E_USER_WARNING);
}
$per_page = $this->Application->ConfigValue($config_mapping['PerPage']);
}
if (!$per_page) {
// none of checked above per-page locations are useful, then try default value
$per_page = 10;
}
}
}
return $per_page;
}
/**
* Set's correct sorting for list
* based on data provided with event
*
* @param kEvent $event
* @access private
* @see OnListBuild
*/
function SetSorting(&$event)
{
$event->setPseudoClass('_List');
$object =& $event->getObject();
$storage_prefix = $event->getEventParam('same_special') ? $event->Prefix : $event->Prefix_Special;
$cur_sort1 = $this->Application->RecallVar($storage_prefix.'_Sort1');
$cur_sort1_dir = $this->Application->RecallVar($storage_prefix.'_Sort1_Dir');
$cur_sort2 = $this->Application->RecallVar($storage_prefix.'_Sort2');
$cur_sort2_dir = $this->Application->RecallVar($storage_prefix.'_Sort2_Dir');
$sorting_configs = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping');
$list_sortings = $this->Application->getUnitOption($event->Prefix, 'ListSortings');
$sorting_prefix = getArrayValue($list_sortings, $event->Special) ? $event->Special : '';
$tag_sort_by = $event->getEventParam('sort_by');
if ($tag_sort_by) {
if ($tag_sort_by == 'random') {
$by = 'RAND()';
$dir = '';
}
else {
list($by, $dir) = explode(',', $tag_sort_by);
}
$object->AddOrderField($by, $dir);
}
if ($sorting_configs && isset ($sorting_configs['DefaultSorting1Field'])){
$list_sortings[$sorting_prefix]['Sorting'] = Array(
$this->Application->ConfigValue($sorting_configs['DefaultSorting1Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting1Dir']),
$this->Application->ConfigValue($sorting_configs['DefaultSorting2Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting2Dir']),
);
}
// Use default if not specified
if ( !$cur_sort1 || !$cur_sort1_dir)
{
if ( $sorting = getArrayValue($list_sortings, $sorting_prefix, 'Sorting') ) {
reset($sorting);
$cur_sort1 = key($sorting);
$cur_sort1_dir = current($sorting);
if (next($sorting)) {
$cur_sort2 = key($sorting);
$cur_sort2_dir = current($sorting);
}
}
}
if ( $forced_sorting = getArrayValue($list_sortings, $sorting_prefix, 'ForcedSorting') ) {
foreach ($forced_sorting as $field => $dir) {
$object->AddOrderField($field, $dir);
}
}
if($cur_sort1 != '' && $cur_sort1_dir != '')
{
$object->AddOrderField($cur_sort1, $cur_sort1_dir);
}
if($cur_sort2 != '' && $cur_sort2_dir != '')
{
$object->AddOrderField($cur_sort2, $cur_sort2_dir);
}
}
/**
* Add filters found in session
*
* @param kEvent $event
*/
function AddFilters(&$event)
{
$object =& $event->getObject();
$edit_mark = rtrim($this->Application->GetSID().'_'.$this->Application->GetTopmostWid($event->Prefix), '_');
// add search filter
$filter_data = $this->Application->RecallVar($event->getPrefixSpecial().'_search_filter');
if ($filter_data) {
$filter_data = unserialize($filter_data);
foreach ($filter_data as $filter_field => $filter_params) {
$filter_type = ($filter_params['type'] == 'having') ? HAVING_FILTER : WHERE_FILTER;
$filter_value = str_replace(EDIT_MARK, $edit_mark, $filter_params['value']);
$object->addFilter($filter_field, $filter_value, $filter_type, FLT_SEARCH);
}
}
// add custom filter
$view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view');
$custom_filters = $this->Application->RecallPersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name);
if ($custom_filters) {
$grid_name = $event->getEventParam('grid');
$custom_filters = unserialize($custom_filters);
if (isset($custom_filters[$grid_name])) {
foreach ($custom_filters[$grid_name] as $field_name => $field_options) {
list ($filter_type, $field_options) = each($field_options);
if (isset($field_options['value']) && $field_options['value']) {
$filter_type = ($field_options['sql_filter_type'] == 'having') ? HAVING_FILTER : WHERE_FILTER;
$filter_value = str_replace(EDIT_MARK, $edit_mark, $field_options['value']);
$object->addFilter($field_name, $filter_value, $filter_type, FLT_CUSTOM);
}
}
}
}
$view_filter = $this->Application->RecallVar($event->getPrefixSpecial().'_view_filter');
if($view_filter)
{
$view_filter = unserialize($view_filter);
$temp_filter =& $this->Application->makeClass('kMultipleFilter');
$filter_menu = $this->Application->getUnitOption($event->Prefix,'FilterMenu');
$group_key = 0; $group_count = count($filter_menu['Groups']);
while($group_key < $group_count)
{
$group_info = $filter_menu['Groups'][$group_key];
$temp_filter->setType( constant('FLT_TYPE_'.$group_info['mode']) );
$temp_filter->clearFilters();
foreach ($group_info['filters'] as $flt_id)
{
$sql_key = getArrayValue($view_filter,$flt_id) ? 'on_sql' : 'off_sql';
if ($filter_menu['Filters'][$flt_id][$sql_key] != '')
{
$temp_filter->addFilter('view_filter_'.$flt_id, $filter_menu['Filters'][$flt_id][$sql_key]);
}
}
$object->addFilter('view_group_'.$group_key, $temp_filter, $group_info['type'] , FLT_VIEW);
$group_key++;
}
}
}
/**
* Set's new sorting for list
*
* @param kEvent $event
* @access protected
*/
function OnSetSorting(&$event)
{
$cur_sort1 = $this->Application->RecallVar($event->Prefix_Special.'_Sort1');
$cur_sort1_dir = $this->Application->RecallVar($event->Prefix_Special.'_Sort1_Dir');
$use_double_sorting = $this->Application->ConfigValue('UseDoubleSorting') !== false ? $this->Application->ConfigValue('UseDoubleSorting') : true;
if ($use_double_sorting) {
$cur_sort2 = $this->Application->RecallVar($event->Prefix_Special.'_Sort2');
$cur_sort2_dir = $this->Application->RecallVar($event->Prefix_Special.'_Sort2_Dir');
}
$passed_sort1 = $this->Application->GetVar($event->getPrefixSpecial(true).'_Sort1');
if ($cur_sort1 == $passed_sort1) {
$cur_sort1_dir = $cur_sort1_dir == 'asc' ? 'desc' : 'asc';
}
else {
if ($use_double_sorting) {
$cur_sort2 = $cur_sort1;
$cur_sort2_dir = $cur_sort1_dir;
}
$cur_sort1 = $passed_sort1;
$cur_sort1_dir = 'asc';
}
$this->Application->StoreVar($event->Prefix_Special.'_Sort1', $cur_sort1);
$this->Application->StoreVar($event->Prefix_Special.'_Sort1_Dir', $cur_sort1_dir);
if ($use_double_sorting) {
$this->Application->StoreVar($event->Prefix_Special.'_Sort2', $cur_sort2);
$this->Application->StoreVar($event->Prefix_Special.'_Sort2_Dir', $cur_sort2_dir);
}
}
/**
* Set sorting directly to session (used for category item sorting (front-end), grid sorting (admin, view menu)
*
* @param kEvent $event
*/
function OnSetSortingDirect(&$event)
{
$combined = $this->Application->GetVar($event->Prefix.'_CombinedSorting');
if ($combined) {
list($field, $dir) = explode('|', $combined);
$this->Application->StoreVar($event->Prefix.'_Sort1', $field);
$this->Application->StoreVar($event->Prefix.'_Sort1_Dir', $dir);
return ;
}
$field_pos = $this->Application->GetVar($event->Prefix.'_SortPos');
$this->Application->LinkVar($event->Prefix.'_Sort'.$field_pos, $event->Prefix.'_Sort'.$field_pos);
$this->Application->LinkVar($event->Prefix.'_Sort'.$field_pos.'_Dir', $event->Prefix.'_Sort'.$field_pos.'_Dir');
}
/**
* Reset grid sorting to default (from config)
*
* @param kEvent $event
*/
function OnResetSorting(&$event)
{
$this->Application->RemoveVar($event->Prefix_Special.'_Sort1');
$this->Application->RemoveVar($event->Prefix_Special.'_Sort1_Dir');
$this->Application->RemoveVar($event->Prefix_Special.'_Sort2');
$this->Application->RemoveVar($event->Prefix_Special.'_Sort2_Dir');
}
/**
* Sets grid refresh interval
*
* @param kEvent $event
*/
function OnSetAutoRefreshInterval(&$event)
{
$refresh_interval = $this->Application->GetVar('refresh_interval');
$view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view');
$this->Application->StorePersistentVar($event->getPrefixSpecial().'_refresh_interval.'.$view_name, $refresh_interval);
}
/**
* Changes auto-refresh state for grid
*
* @param kEvent $event
*/
function OnAutoRefreshToggle(&$event)
{
$refresh_intervals = $this->Application->ConfigValue('AutoRefreshIntervals');
if (!$refresh_intervals) {
return ;
}
$view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view');
$auto_refresh = $this->Application->RecallPersistentVar($event->getPrefixSpecial().'_auto_refresh.'.$view_name);
if ($auto_refresh === false) {
$refresh_intervals = explode(',', $refresh_intervals);
$this->Application->StorePersistentVar($event->getPrefixSpecial().'_refresh_interval.'.$view_name, $refresh_intervals[0]);
}
$this->Application->StorePersistentVar($event->getPrefixSpecial().'_auto_refresh.'.$view_name, $auto_refresh ? 0 : 1);
}
/**
* Creates needed sql query to load item,
* if no query is defined in config for
* special requested, then use default
* query
*
* @param kEvent $event
* @access protected
*/
function ItemPrepareQuery(&$event)
{
$sqls = $this->Application->getUnitOption($event->Prefix, 'ItemSQLs', Array ());
$special = array_key_exists($event->Special, $sqls) ? $event->Special : '';
if (!array_key_exists($special, $sqls)) {
// preferred special not found in ItemSQLs -> use analog from ListSQLs
return $this->ListPrepareQuery($event);
}
return $sqls[$special];
}
/**
* Creates needed sql query to load list,
* if no query is defined in config for
* special requested, then use default
* query
*
* @param kEvent $event
* @access protected
*/
function ListPrepareQuery(&$event)
{
$sqls = $this->Application->getUnitOption($event->Prefix, 'ListSQLs', Array ());
return $sqls[ array_key_exists($event->Special, $sqls) ? $event->Special : '' ];
}
/**
* Apply custom processing to item
*
* @param kEvent $event
*/
function customProcessing(&$event, $type)
{
}
/* Edit Events mostly used in Admin */
/**
* Creates new kDBItem
*
* @param kEvent $event
* @access protected
*/
function OnCreate(&$event)
{
$object =& $event->getObject( Array('skip_autoload' => true) );
/* @var $object kDBItem */
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if ($items_info) {
list($id,$field_values) = each($items_info);
$object->SetFieldsFromHash($field_values);
}
$this->customProcessing($event,'before');
//look at kDBItem' Create for ForceCreateId description, it's rarely used and is NOT set by default
if( $object->Create($event->getEventParam('ForceCreateId')) )
{
if( $object->IsTempTable() ) $object->setTempID();
$this->customProcessing($event,'after');
$event->status=erSUCCESS;
$event->redirect_params = Array('opener'=>'u');
}
else
{
$event->status = erFAIL;
$event->redirect = false;
$this->Application->SetVar($event->Prefix_Special.'_SaveEvent','OnCreate');
$object->setID($id);
}
}
/**
* Updates kDBItem
*
* @param kEvent $event
* @access protected
*/
function OnUpdate(&$event)
{
$object =& $event->getObject( Array('skip_autoload' => true) );
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if($items_info)
{
foreach($items_info as $id => $field_values)
{
$object->Load($id);
$object->SetFieldsFromHash($field_values);
$this->customProcessing($event, 'before');
if( $object->Update($id) )
{
$this->customProcessing($event, 'after');
$event->status=erSUCCESS;
}
else
{
$event->status=erFAIL;
$event->redirect=false;
break;
}
}
}
$event->redirect_params = Array('opener'=>'u');
}
/**
* Delete's kDBItem object
*
* @param kEvent $event
* @access protected
*/
function OnDelete(&$event)
{
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
/* @var $temp kTempTablesHandler */
$temp->DeleteItems($event->Prefix, $event->Special, Array($this->getPassedID($event)));
}
/**
* Prepares new kDBItem object
*
* @param kEvent $event
* @access protected
*/
function OnNew(&$event)
{
$object =& $event->getObject( Array('skip_autoload' => true) );
/* @var $object kDBItem */
$object->Clear(0);
$this->Application->SetVar($event->Prefix_Special.'_SaveEvent', 'OnCreate');
$table_info = $object->getLinkedInfo();
$object->SetDBField($table_info['ForeignKey'], $table_info['ParentId']);
$event->redirect = false;
}
/**
* Cancel's kDBItem Editing/Creation
*
* @param kEvent $event
* @access protected
*/
function OnCancel(&$event)
{
$object =& $event->getObject(Array('skip_autoload' => true));
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ($items_info) {
$delete_ids = Array();
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
foreach ($items_info as $id => $field_values) {
$object->Load($id);
// record created for using with selector (e.g. Reviews->Select User), and not validated => Delete it
if ($object->isLoaded() && !$object->Validate() && ($id <= 0) ) {
$delete_ids[] = $id;
}
}
if ($delete_ids) {
$temp->DeleteItems($event->Prefix, $event->Special, $delete_ids);
}
}
$event->redirect_params = Array('opener'=>'u');
}
/**
* Deletes all selected items.
* Automatically recurse into sub-items using temp handler, and deletes sub-items
* by calling its Delete method if sub-item has AutoDelete set to true in its config file
*
* @param kEvent $event
*/
function OnMassDelete(&$event)
{
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
$event->status=erSUCCESS;
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
$ids = $this->StoreSelectedIDs($event);
$event->setEventParam('ids', $ids);
$this->customProcessing($event, 'before');
$ids = $event->getEventParam('ids');
if($ids)
{
$temp->DeleteItems($event->Prefix, $event->Special, $ids);
}
$this->clearSelectedIDs($event);
}
/**
* Sets window id (of first opened edit window) to temp mark in uls
*
* @param kEvent $event
*/
function setTempWindowID(&$event)
{
$mode = $this->Application->GetVar($event->Prefix.'_mode');
if ($mode == 't') {
$wid = $this->Application->GetVar('m_wid');
$this->Application->SetVar($event->Prefix.'_mode', 't'.$wid);
}
}
/**
* Prepare temp tables and populate it
* with items selected in the grid
*
* @param kEvent $event
*/
function OnEdit(&$event)
{
$this->setTempWindowID($event);
$this->StoreSelectedIDs($event);
$var_name = $event->getPrefixSpecial().'_file_pending_actions'.$this->Application->GetVar('m_wid');
$this->Application->RemoveVar($var_name);
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
/* @var $temp kTempTablesHandler */
$temp->PrepareEdit();
$event->redirect=false;
}
/**
* Saves content of temp table into live and
* redirects to event' default redirect (normally grid template)
*
* @param kEvent $event
*/
function OnSave(&$event)
{
$event->CallSubEvent('OnPreSave');
if ($event->status == erSUCCESS) {
$skip_master = false;
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
$changes_var_name = $this->Prefix.'_changes_'.$this->Application->GetTopmostWid($this->Prefix);
if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
$live_ids = $temp->SaveEdit($event->getEventParam('master_ids') ? $event->getEventParam('master_ids') : Array());
// Deleteing files scheduled for delete
$var_name = $event->getPrefixSpecial().'_file_pending_actions'.$this->Application->GetVar('m_wid');
$schedule = $this->Application->RecallVar($var_name);
$schedule = $schedule ? unserialize($schedule) : array();
foreach ($schedule as $data) {
if ($data['action'] == 'delete') {
unlink($data['file']);
}
}
if ($live_ids) {
// ensure, that newly created item ids are avalable as if they were selected from grid
// NOTE: only works if main item has subitems !!!
$this->StoreSelectedIDs($event, $live_ids);
}
$this->SaveLoggedChanges($changes_var_name);
}
else {
$this->Application->RemoveVar($changes_var_name);
}
$this->clearSelectedIDs($event);
$event->redirect_params = Array('opener' => 'u');
$this->Application->RemoveVar($event->getPrefixSpecial().'_modified');
// all temp tables are deleted here => all after hooks should think, that it's live mode now
$this->Application->SetVar($event->Prefix.'_mode', '');
}
}
function SaveLoggedChanges($changes_var_name)
{
$ses_log_id = $this->Application->RecallVar('_SessionLogId_');
if (!$ses_log_id) {
return ;
}
$changes = $this->Application->RecallVar($changes_var_name);
$changes = $changes ? unserialize($changes) : Array ();
if (!$changes) {
return ;
}
$add_fields = Array (
'PortalUserId' => $this->Application->RecallVar('user_id'),
'SessionLogId' => $ses_log_id,
);
$changelog_table = $this->Application->getUnitOption('change-log', 'TableName');
$sessionlog_table = $this->Application->getUnitOption('session-log', 'TableName');
foreach ($changes as $rec) {
$this->Conn->doInsert(array_merge($rec, $add_fields), $changelog_table);
}
$sql = 'UPDATE '.$sessionlog_table.'
SET AffectedItems = AffectedItems + '.count($changes).'
WHERE SessionLogId = '.$ses_log_id;
$this->Conn->Query($sql);
$this->Application->RemoveVar($changes_var_name);
}
/**
* Cancels edit
* Removes all temp tables and clears selected ids
*
* @param kEvent $event
*/
function OnCancelEdit(&$event)
{
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
$temp->CancelEdit();
$this->clearSelectedIDs($event);
$event->redirect_params = Array('opener'=>'u');
$this->Application->RemoveVar($event->getPrefixSpecial().'_modified');
}
/**
* Allows to determine if we are creating new item or editing already created item
*
* @param kEvent $event
* @return bool
*/
function isNewItemCreate(&$event)
{
$event->setEventParam('raise_warnings', 0);
$object =& $event->getObject();
return !$object->IsLoaded();
// $item_id = $this->getPassedID($event);
// return ($item_id == '') ? true : false;
}
/**
* Saves edited item into temp table
* If there is no id, new item is created in temp table
*
* @param kEvent $event
*/
function OnPreSave(&$event)
{
//$event->redirect = false;
// if there is no id - it means we need to create an item
if (is_object($event->MasterEvent)) {
$event->MasterEvent->setEventParam('IsNew',false);
}
if ($this->isNewItemCreate($event)) {
$event->CallSubEvent('OnPreSaveCreated');
if (is_object($event->MasterEvent)) {
$event->MasterEvent->setEventParam('IsNew',true);
}
return;
}
$object =& $event->getObject( Array('skip_autoload' => true) );
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if ($items_info) {
foreach ($items_info as $id => $field_values) {
$object->SetDefaultValues();
$object->Load($id);
$object->SetFieldsFromHash($field_values);
$this->customProcessing($event, 'before');
if( $object->Update($id) )
{
$this->customProcessing($event, 'after');
$event->status=erSUCCESS;
}
else {
$event->status = erFAIL;
$event->redirect = false;
break;
}
}
}
}
/**
* Saves edited item in temp table and loads
* item with passed id in current template
* Used in Prev/Next buttons
*
* @param kEvent $event
*/
function OnPreSaveAndGo(&$event)
{
$event->CallSubEvent('OnPreSave');
if ($event->status == erSUCCESS) {
$event->SetRedirectParam($event->getPrefixSpecial(true).'_id', $this->Application->GetVar($event->Prefix_Special.'_GoId'));
}
}
/**
* Saves edited item in temp table and goes
* to passed tabs, by redirecting to it with OnPreSave event
*
* @param kEvent $event
*/
function OnPreSaveAndGoToTab(&$event)
{
$event->CallSubEvent('OnPreSave');
if ($event->status==erSUCCESS) {
$event->redirect=$this->Application->GetVar($event->getPrefixSpecial(true).'_GoTab');
}
}
/**
* Saves editable list and goes to passed tab,
* by redirecting to it with empty event
*
* @param kEvent $event
*/
function OnUpdateAndGoToTab(&$event)
{
$event->setPseudoClass('_List');
$event->CallSubEvent('OnUpdate');
if ($event->status==erSUCCESS) {
$event->redirect=$this->Application->GetVar($event->getPrefixSpecial(true).'_GoTab');
}
}
/**
* Prepare temp tables for creating new item
* but does not create it. Actual create is
* done in OnPreSaveCreated
*
* @param kEvent $event
*/
function OnPreCreate(&$event)
{
$this->setTempWindowID($event);
$this->clearSelectedIDs($event);
$object =& $event->getObject( Array('skip_autoload' => true) );
$temp =& $this->Application->recallObject($event->Prefix.'_TempHandler', 'kTempTablesHandler');
$temp->PrepareEdit();
$object->setID(0);
$this->Application->SetVar($event->getPrefixSpecial().'_id',0);
$this->Application->SetVar($event->getPrefixSpecial().'_PreCreate', 1);
$event->redirect=false;
}
/**
* Creates a new item in temp table and
* stores item id in App vars and Session on succsess
*
* @param kEvent $event
*/
function OnPreSaveCreated(&$event)
{
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if($items_info) $field_values = array_shift($items_info);
$object =& $event->getObject( Array('skip_autoload' => true) );
$object->SetFieldsFromHash($field_values);
$this->customProcessing($event, 'before');
if( $object->Create() )
{
$this->customProcessing($event, 'after');
$event->redirect_params[$event->getPrefixSpecial(true).'_id'] = $object->GetId();
$event->status=erSUCCESS;
}
else
{
$event->status=erFAIL;
$event->redirect=false;
$object->setID(0);
}
}
function OnReset(&$event)
{
//do nothing - should reset :)
if ($this->isNewItemCreate($event)) {
// just reset id to 0 in case it was create
$object =& $event->getObject( Array('skip_autoload' => true) );
$object->setID(0);
$this->Application->SetVar($event->getPrefixSpecial().'_id',0);
}
}
/**
* Apply same processing to each item beeing selected in grid
*
* @param kEvent $event
* @access private
*/
function iterateItems(&$event)
{
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
$object =& $event->getObject( Array('skip_autoload' => true) );
$ids = $this->StoreSelectedIDs($event);
if ($ids) {
$status_field = array_shift( $this->Application->getUnitOption($event->Prefix,'StatusField') );
foreach ($ids as $id) {
$object->Load($id);
switch ($event->Name) {
case 'OnMassApprove':
$object->SetDBField($status_field, 1);
break;
case 'OnMassDecline':
$object->SetDBField($status_field, 0);
break;
case 'OnMassMoveUp':
$object->SetDBField('Priority', $object->GetDBField('Priority') + 1);
break;
case 'OnMassMoveDown':
$object->SetDBField('Priority', $object->GetDBField('Priority') - 1);
break;
}
if ($object->Update()) {
$event->status = erSUCCESS;
}
else {
$event->status = erFAIL;
$event->redirect = false;
break;
}
}
}
$this->clearSelectedIDs($event);
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnMassClone(&$event)
{
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
$event->status = erSUCCESS;
$temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
$ids = $this->StoreSelectedIDs($event);
if ($ids) {
$temp->CloneItems($event->Prefix, $event->Special, $ids);
}
$this->clearSelectedIDs($event);
}
function check_array($records, $field, $value)
{
foreach ($records as $record) {
if ($record[$field] == $value) {
return true;
}
}
return false;
}
function OnPreSavePopup(&$event)
{
$object =& $event->getObject();
$this->RemoveRequiredFields($object);
$event->CallSubEvent('OnPreSave');
$this->finalizePopup($event);
}
/* End of Edit events */
// III. Events that allow to put some code before and after Update,Load,Create and Delete methods of item
/**
* Occurse before loading item, 'id' parameter
* allows to get id of item beeing loaded
*
* @param kEvent $event
* @access public
*/
function OnBeforeItemLoad(&$event)
{
}
/**
* Occurse after loading item, 'id' parameter
* allows to get id of item that was loaded
*
* @param kEvent $event
* @access public
*/
function OnAfterItemLoad(&$event)
{
}
/**
* Occurse before creating item
*
* @param kEvent $event
* @access public
*/
function OnBeforeItemCreate(&$event)
{
}
/**
* Occurse after creating item
*
* @param kEvent $event
* @access public
*/
function OnAfterItemCreate(&$event)
{
}
/**
* Occurse before updating item
*
* @param kEvent $event
* @access public
*/
function OnBeforeItemUpdate(&$event)
{
}
/**
* Occurse after updating item
*
* @param kEvent $event
* @access public
*/
function OnAfterItemUpdate(&$event)
{
}
/**
* Occurse before deleting item, id of item beeing
* deleted is stored as 'id' event param
*
* @param kEvent $event
* @access public
*/
function OnBeforeItemDelete(&$event)
{
}
/**
* Occurse after deleting item, id of deleted item
* is stored as 'id' param of event
*
* @param kEvent $event
* @access public
*/
function OnAfterItemDelete(&$event)
{
}
/**
* Occurs after successful item validation
*
* @param kEvent $event
*/
function OnAfterItemValidate(&$event)
{
}
/**
* Occures after an item has been copied to temp
* Id of copied item is passed as event' 'id' param
*
* @param kEvent $event
*/
function OnAfterCopyToTemp(&$event)
{
}
/**
* Occures before an item is deleted from live table when copying from temp
* (temp handler deleted all items from live and then copy over all items from temp)
* Id of item being deleted is passed as event' 'id' param
*
* @param kEvent $event
*/
function OnBeforeDeleteFromLive(&$event)
{
}
/**
* Occures before an item is copied to live table (after all foreign keys have been updated)
* Id of item being copied is passed as event' 'id' param
*
* @param kEvent $event
*/
function OnBeforeCopyToLive(&$event)
{
}
/**
* !!! NOT FULLY IMPLEMENTED - SEE TEMP HANDLER COMMENTS (search by event name)!!!
* Occures after an item has been copied to live table
* Id of copied item is passed as event' 'id' param
*
* @param kEvent $event
*/
function OnAfterCopyToLive(&$event)
{
}
/**
* Occures before an item is cloneded
* Id of ORIGINAL item is passed as event' 'id' param
* Do not call object' Update method in this event, just set needed fields!
*
* @param kEvent $event
*/
function OnBeforeClone(&$event)
{
}
/**
* Occures after an item has been cloned
* Id of newly created item is passed as event' 'id' param
*
* @param kEvent $event
*/
function OnAfterClone(&$event)
{
}
/**
* Ensures that popup will be closed automatically
* and parent window will be refreshed with template
* passed
*
* @param kEvent $event
* @access public
*/
function finalizePopup(&$event)
{
$event->SetRedirectParam('opener', 'u');
/*return ;
// 2. substitute opener
$opener_stack = $this->Application->RecallVar('opener_stack');
$opener_stack = $opener_stack ? unserialize($opener_stack) : Array();
//array_pop($opener_stack);
$t = $this->Application->RecallVar('return_template');
$this->Application->RemoveVar('return_template');
// restore original "m" prefix all params, that have values before opening selector
$return_m = $this->Application->RecallVar('return_m');
$this->Application->RemoveVar('return_m');
$this->Application->HttpQuery->parseEnvPart($return_m);
$pass_events = $event->getEventParam('pass_events');
$redirect_params = array_merge_recursive2($event->redirect_params, Array('m_opener' => 'u', '__URLENCODE__' => 1));
$new_level = 'index.php|'.ltrim($this->Application->BuildEnv($t, $redirect_params, 'all', $pass_events), ENV_VAR_NAME.'=');
array_push($opener_stack, $new_level);
$this->Application->StoreVar('opener_stack', serialize($opener_stack));*/
}
/**
* Create search filters based on search query
*
* @param kEvent $event
* @access protected
*/
function OnSearch(&$event)
{
$event->setPseudoClass('_List');
$search_helper =& $this->Application->recallObject('SearchHelper');
$search_helper->performSearch($event);
}
/**
* Clear search keywords
*
* @param kEvent $event
* @access protected
*/
function OnSearchReset(&$event)
{
$search_helper =& $this->Application->recallObject('SearchHelper');
$search_helper->resetSearch($event);
}
/**
* Set's new filter value (filter_id meaning from config)
*
* @param kEvent $event
*/
function OnSetFilter(&$event)
{
$filter_id = $this->Application->GetVar('filter_id');
$filter_value = $this->Application->GetVar('filter_value');
$view_filter = $this->Application->RecallVar($event->getPrefixSpecial().'_view_filter');
$view_filter = $view_filter ? unserialize($view_filter) : Array();
$view_filter[$filter_id] = $filter_value;
$this->Application->StoreVar( $event->getPrefixSpecial().'_view_filter', serialize($view_filter) );
}
function OnSetFilterPattern(&$event)
{
$filters = $this->Application->GetVar($event->getPrefixSpecial(true).'_filters');
if (!$filters) return ;
$view_filter = $this->Application->RecallVar($event->getPrefixSpecial().'_view_filter');
$view_filter = $view_filter ? unserialize($view_filter) : Array();
$filters = explode(',', $filters);
foreach ($filters as $a_filter) {
list($id, $value) = explode('=', $a_filter);
$view_filter[$id] = $value;
}
$this->Application->StoreVar( $event->getPrefixSpecial().'_view_filter', serialize($view_filter) );
$event->redirect = false;
}
/**
* Add/Remove all filters applied to list from "View" menu
*
* @param kEvent $event
*/
function FilterAction(&$event)
{
$view_filter = Array();
$filter_menu = $this->Application->getUnitOption($event->Prefix,'FilterMenu');
switch ($event->Name)
{
case 'OnRemoveFilters':
$filter_value = 1;
break;
case 'OnApplyFilters':
$filter_value = 0;
break;
}
foreach($filter_menu['Filters'] as $filter_key => $filter_params)
{
if(!$filter_params) continue;
$view_filter[$filter_key] = $filter_value;
}
$this->Application->StoreVar( $event->getPrefixSpecial().'_view_filter', serialize($view_filter) );
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnPreSaveAndOpenTranslator(&$event)
{
$this->Application->SetVar('allow_translation', true);
$object =& $event->getObject();
$this->RemoveRequiredFields($object);
$event->CallSubEvent('OnPreSave');
if ($event->status == erSUCCESS) {
$resource_id = $this->Application->GetVar('translator_resource_id');
if ($resource_id) {
$t_prefixes = explode(',', $this->Application->GetVar('translator_prefixes'));
$cdata =& $this->Application->recallObject($t_prefixes[1], null, Array('skip_autoload' => true));
$cdata->Load($resource_id, 'ResourceId');
if (!$cdata->isLoaded()) {
$cdata->SetDBField('ResourceId', $resource_id);
$cdata->Create();
}
$this->Application->SetVar($cdata->getPrefixSpecial().'_id', $cdata->GetID());
}
$event->redirect = $this->Application->GetVar('translator_t');
$event->redirect_params = Array('pass'=>'all,trans,'.$this->Application->GetVar('translator_prefixes'),
$event->getPrefixSpecial(true).'_id' => $object->GetID(),
'trans_event' => 'OnLoad',
'trans_prefix' => $this->Application->GetVar('translator_prefixes'),
'trans_field' => $this->Application->GetVar('translator_field'),
'trans_multi_line' => $this->Application->GetVar('translator_multi_line'),
);
// 1. SAVE LAST TEMPLATE TO SESSION (really needed here, because of tweaky redirect)
$last_template = $this->Application->RecallVar('last_template');
preg_match('/index4\.php\|'.$this->Application->GetSID().'-(.*):/U', $last_template, $rets);
$this->Application->StoreVar('return_template', $this->Application->GetVar('t'));
}
}
function RemoveRequiredFields(&$object)
{
// making all field non-required to achieve successful presave
foreach($object->Fields as $field => $options)
{
if(isset($options['required']))
{
unset($object->Fields[$field]['required']);
}
}
}
/**
* Saves selected user in needed field
*
* @param kEvent $event
*/
function OnSelectUser(&$event)
{
$items_info = $this->Application->GetVar('u');
if ($items_info) {
$user_id = array_shift( array_keys($items_info) );
$object =& $event->getObject();
$this->RemoveRequiredFields($object);
$is_new = !$object->isLoaded();
$is_main = substr($this->Application->GetVar($event->Prefix.'_mode'), 0, 1) == 't';
if ($is_new) {
$new_event = $is_main ? 'OnPreCreate' : 'OnNew';
$event->CallSubEvent($new_event);
$event->redirect = true;
}
$object->SetDBField($this->Application->RecallVar('dst_field'), $user_id);
if ($is_new) {
$object->Create();
if (!$is_main && $object->IsTempTable()) {
$object->setTempID();
}
}
else {
$object->Update();
}
}
$event->SetRedirectParam($event->getPrefixSpecial().'_id', $object->GetID());
$this->finalizePopup($event);
}
/** EXPORT RELATED **/
/**
* Shows export dialog
*
* @param kEvent $event
*/
function OnExport(&$event)
{
$this->StoreSelectedIDs($event);
$selected_ids = $this->getSelectedIDs($event);
if (implode(',', $selected_ids) == '') {
// K4 fix when no ids found bad selected ids array is formed
$selected_ids = false;
}
$this->Application->StoreVar($event->Prefix.'_export_ids', $selected_ids ? implode(',', $selected_ids) : '' );
$export_t = $this->Application->GetVar('export_template');
$this->Application->LinkVar('export_finish_t');
$this->Application->LinkVar('export_progress_t');
$this->Application->StoreVar('export_oroginal_special', $event->Special);
$export_helper =& $this->Application->recallObject('CatItemExportHelper');
$event->redirect = $export_t ? $export_t : $export_helper->getModuleFolder($event).'/export';
list($index_file, $env) = explode('|', $this->Application->RecallVar('last_template'));
$finish_url = $this->Application->BaseURL('/admin').$index_file.'?'.ENV_VAR_NAME.'='.$env;
$this->Application->StoreVar('export_finish_url', $finish_url);
$redirect_params = Array(
$this->Prefix.'.export_event' => 'OnNew',
'pass' => 'all,'.$this->Prefix.'.export');
$event->setRedirectParams($redirect_params);
}
/**
* Apply some special processing to
* object beeing recalled before using
* it in other events that call prepareObject
*
* @param Object $object
* @param kEvent $event
* @access protected
*/
function prepareObject(&$object, &$event)
{
if ($event->Special == 'export' || $event->Special == 'import')
{
$export_helper =& $this->Application->recallObject('CatItemExportHelper');
$export_helper->prepareExportColumns($event);
}
}
/**
* Returns specific to each item type columns only
*
* @param kEvent $event
* @return Array
*/
function getCustomExportColumns(&$event)
{
return Array();
}
/**
* Export form validation & processing
*
* @param kEvent $event
*/
function OnExportBegin(&$event)
{
$export_helper =& $this->Application->recallObject('CatItemExportHelper');
/* @var $export_helper kCatDBItemExportHelper */
$export_helper->OnExportBegin($event);
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnExportCancel(&$event)
{
$this->OnGoBack($event);
}
/**
* Allows configuring export options
*
* @param kEvent $event
*/
function OnBeforeExportBegin(&$event)
{
}
function OnDeleteExportPreset(&$event)
{
$object =& $event->GetObject();
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if($items_info)
{
list($id,$field_values) = each($items_info);
$preset_key = $field_values['ExportPresets'];
$export_settings = $this->Application->RecallPersistentVar('export_settings');
if (!$export_settings) return ;
$export_settings = unserialize($export_settings);
if (!isset($export_settings[$event->Prefix])) return ;
$to_delete = '';
$export_presets = array(''=>'');
foreach ($export_settings[$event->Prefix] as $key => $val) {
if (implode('|', $val['ExportColumns']) == $preset_key) {
$to_delete = $key;
break;
}
}
if ($to_delete) {
unset($export_settings[$event->Prefix][$to_delete]);
$this->Application->StorePersistentVar('export_settings', serialize($export_settings));
}
}
}
/**
* Saves changes & changes language
*
* @param kEvent $event
*/
function OnPreSaveAndChangeLanguage(&$event)
{
$event->CallSubEvent('OnPreSave');
if ($event->status == erSUCCESS) {
$this->Application->SetVar('m_lang', $this->Application->GetVar('language'));
}
}
function OnUploadFile(&$event)
{
// Flash uploader does NOT send correct cookies, so we need to make our own check
$cookie_name = 'adm_'.$this->Application->ConfigValue('SessionCookieName');
$this->Application->HttpQuery->Cookie['cookies_on'] = 1;
$this->Application->HttpQuery->Cookie[$cookie_name] = $this->Application->GetVar('flashsid');
$this->Application->HttpQuery->Cookie[$cookie_name.'_live'] = $this->Application->GetVar('flashsid'); // this prevents session from auto-expiring when KeepSessionOnBrowserClose & FireFox is used
$admin_ses =& $this->Application->recallObject('Session.admin');
/* @var $admin_ses Session */
$user = $admin_ses->RecallVar('user_id');
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$section = $event->getSection();
if (!$perm_helper->CheckUserPermission($user, $section.'.add') && !$perm_helper->CheckUserPermission($user, $section.'.edit')) {
$event->status = erPERM_FAIL;
header('HTTP/1.0 403 You don\'t have permissions to upload');
exit;
return;
}
if (!$cookie_name) {
$cookie_name = 'sid';
}
$value = $this->Application->GetVar('Filedata');
if (!$value) {
return ;
}
$tmp_path = defined('WRITEABLE') ? WRITEABLE.'/tmp/' : FULL_PATH.'/kernel/cache/';
$fname = $value['name'];
$id = $this->Application->GetVar('id');
if ($id) $fname = $id.'_'.$fname;
if (!is_writable($tmp_path)) {
header('HTTP/1.0 500 Write permissions not set on the server');
exit;
}
move_uploaded_file($value['tmp_name'], $tmp_path.$fname);
exit;
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnDeleteFile(&$event)
{
if (strpos($this->Application->GetVar('file'), '../') !== false) return ;
$object =& $event->getObject(array('skip_autoload'=>true));
$options = $object->GetFieldOptions($this->Application->GetVar('field'));
$var_name = $event->getPrefixSpecial().'_file_pending_actions'.$this->Application->GetVar('m_wid');
$schedule = $this->Application->RecallVar($var_name);
$schedule = $schedule ? unserialize($schedule) : array();
$schedule[] = array('action'=>'delete', 'file'=>$path = FULL_PATH.$options['upload_dir'].$this->Application->GetVar('file'));
$this->Application->StoreVar($var_name, serialize($schedule));
$this->Application->Session->SaveData();
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnViewFile(&$event)
{
if (strpos($this->Application->GetVar('file'), '../') !== false) return ;
if ($this->Application->GetVar('tmp')) {
$path = (defined('WRITEABLE') ? WRITEABLE.'/tmp/' : FULL_PATH.'/kernel/cache/').$this->Application->GetVar('id').'_'.$this->Application->GetVar('file');
}
else {
$object =& $event->getObject(array('skip_autoload'=>true));
$options = $object->GetFieldOptions($this->Application->GetVar('field'));
$path = FULL_PATH.$options['upload_dir'].$this->Application->GetVar('file');
}
$type = mime_content_type($path);
header('Content-Length: '.filesize($path));
header('Content-Type: '.$type);
safeDefine('DBG_SKIP_REPORTING',1);
readfile($path);
exit();
}
/**
* Validates MInput control fields
*
* @param kEvent $event
*/
function OnValidateMInputFields(&$event)
{
$minput_helper =& $this->Application->recallObject('MInputHelper');
/* @var $minput_helper MInputHelper */
$minput_helper->OnValidateMInputFields($event);
}
/**
* Returns auto-complete values for ajax-dropdown
*
* @param kEvent $event
*/
function OnSuggestValues(&$event)
{
$this->Application->XMLHeader();
$field = $this->Application->GetVar('field');
$cur_value = $this->Application->GetVar('cur_value');
if (!$field || !$cur_value) {
exit;
}
$object =& $event->getObject();
$sql = 'SELECT DISTINCT '.$field.'
FROM '.$object->TableName.'
WHERE '.$field.' LIKE '.$this->Conn->qstr($cur_value.'%').'
ORDER BY '.$field.'
LIMIT 0,20';
$data = $this->Conn->GetCol($sql);
echo '<suggestions>';
foreach ($data as $item) {
echo '<item>'.$item.'</item>';
}
echo '</suggestions>';
$event->status = erSTOP;
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnSaveWidths(&$event)
{
safeDefine('DBG_SKIP_REPORTING', 1);
$lang =& $this->Application->recallObject('lang.current');
// header('Content-type: text/xml; charset='.$lang->GetDBField('Charset'));
$picker_helper =& $this->Application->RecallObject('ColumnPickerHelper');
/* @var $picker_helper kColumnPickerHelper */
$picker_helper->PreparePicker($event->getPrefixSpecial(), $this->Application->GetVar('grid_name'));
$picker_helper->SaveWidths($event->getPrefixSpecial(), $this->Application->GetVar('widths'));
exit;
}
/**
* Called from CSV import script after item fields
* are set and validated, but before actual item create/update.
* If event status is erSUCCESS, line will be imported,
* else it will not be imported but added to skipped lines
* and displayed in the end of import.
* Event status is preset from import script.
*
* @param kEvent $event
*/
function OnBeforeCSVLineImport(&$event)
{
// abstract, for hooking
}
}
?>
\ No newline at end of file
Property changes on: branches/RC/core/kernel/db/db_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.99.2.20
\ No newline at end of property
+1.99.2.21
\ No newline at end of property
Index: branches/RC/core/units/categories/categories_config.php
===================================================================
--- branches/RC/core/units/categories/categories_config.php (revision 10454)
+++ branches/RC/core/units/categories/categories_config.php (revision 10455)
@@ -1,303 +1,307 @@
<?php
$config = Array(
'Prefix' => 'c',
'ItemClass' => Array('class'=>'CategoriesItem','file'=>'categories_item.php','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'CategoriesEventHandler','file'=>'categories_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'CategoriesTagProcessor','file'=>'categories_tag_processor.php','build_event'=>'OnBuild'),
'RegisterClasses' => Array(
Array('pseudo' => 'kPermCacheUpdater','class' => 'kPermCacheUpdater', 'file' => 'cache_updater.php','build_event'=>''),
),
'ConfigPriority' => 0,
'Hooks' => Array (
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => '',
'HookToSpecial' => '*',
'HookToEvent' => Array('OnAfterConfigRead'),
'DoPrefix' => 'cdata',
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
),
'AutoLoad' => true,
'CatalogItem' => true,
'AdminTemplatePath' => 'categories',
'AdminTemplatePrefix' => 'categories_',
'QueryString' => Array(
1 => 'id',
2 => 'Page',
3 => 'event',
4 => 'mode',
),
'AggregateTags' => Array(
Array(
'AggregateTo' => 'm',
'AggregatedTagName' => 'CategoryLink',
'LocalTagName' => 'CategoryLink',
),
),
'IDField' => 'CategoryId',
'StatusField' => Array('Status'),
'TitleField' => 'Name', // field, used in bluebar when editing existing item
'TitlePhrase' => 'la_Text_Category',
'ItemType' => 1, // used for custom fields only
'StatisticsInfo' => Array(
'pending' => Array(
'icon' => 'icon16_cat_pending.gif',
'label' => 'la_tab_Categories',
'js_url' => '#url#',
'url' => Array('t' => 'in-portal/advanced_view', 'SetTab' => 'c', 'pass' => 'm,c.showall', 'c.showall_event' => 'OnSetFilterPattern', 'c.showall_filters' => 'show_active=0,show_pending=1,show_disabled=0,show_new=1,show_pick=1'),
'status' => STATUS_PENDING,
),
),
'TableName' => TABLE_PREFIX.'Category',
'ViewMenuPhrase' => 'la_text_Categories',
'TitlePresets' => Array(
'default' => Array( 'new_status_labels' => Array('c' => '!la_title_Adding_Category!'),
'edit_status_labels' => Array('c' => '!la_title_Editing_Category!'),
'new_titlefield' => Array('c' => ''),
),
'category_list' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"),
'catalog' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (<span id='c_item_count'>#c_recordcount#</span>)"),
'advanced_view' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_AdvancedView!"),
+ 'reviews' => Array('prefixes' => Array(), 'format' => "!la_title_Reviews!"),
+
+ 'review_edit' => Array('prefixes' => Array(), 'format' => "!la_title_Editing_Review!"),
+
'categories_edit' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_General!"),
'categories_properties' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Properties!"),
'categories_relations' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Relations!"),
'categories_related_searches' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_RelatedSearches!"),
'categories_images' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Images!"),
'categories_permissions'=> Array('prefixes' => Array('c', 'g_List'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Permissions!"),
'categories_custom' => Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Custom!"),
'categories_update' => Array('prefixes' => Array(), 'format' => "!la_title_UpdatingCategories!"),
'images_edit' => Array( 'prefixes' => Array('c', 'c-img'),
'new_status_labels' => Array('c-img'=>'!la_title_Adding_Image!'),
'edit_status_labels' => Array('c-img'=>'!la_title_Editing_Image!'),
'new_titlefield' => Array('c-img'=>''),
'format' => "#c_status# '#c_titlefield#' - #c-img_status# '#c-img_titlefield#'",
),
'relations_edit' => Array( 'prefixes' => Array('c', 'c-rel'),
'new_status_labels' => Array('c-rel'=>"!la_title_Adding_Relationship! '!la_title_New_Relationship!'"),
'edit_status_labels' => Array('c-rel'=>'!la_title_Editing_Relationship!'),
'format' => "#c_status# '#c_titlefield#' - #c-rel_status#",
),
'related_searches_edit' => Array( 'prefixes' => Array('c', 'c-search'),
'new_status_labels' => Array('c-search'=>"!la_title_Adding_RelatedSearch_Keyword!"),
'edit_status_labels' => Array('c-search'=>'!la_title_Editing_RelatedSearch_Keyword!'),
'format' => "#c_status# '#c_titlefield#' - #c-search_status#",
),
'tree_site' => Array('format' => '!la_selecting_categories!'),
),
'PermItemPrefix' => 'CATEGORY',
'PermSection' => Array('main' => 'CATEGORY:in-portal:categories', /*'search' => 'in-portal:configuration_search',*/ 'email' => 'in-portal:configuration_email', 'custom' => 'in-portal:configuration_custom'),
/* 'Sections' => Array(
// "Structure & Data" section
'in-portal:site' => Array(
'parent' => 'in-portal:root',
'icon' => 'struct',
'label' => 'la_tab_Site_Structure',
'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array('view'),
'priority' => 1,
'type' => stTREE,
),
'in-portal:browse' => Array(
'parent' => 'in-portal:site',
'icon' => 'catalog',
'label' => 'la_tab_Browse',
'url' => Array('t' => 'in-portal/catalog', 'pass' => 'm'),
'late_load' => Array('t' => 'in-portal/xml/tree_categories', 'pass' => 'm', 'm_cat_id' => 0),
'onclick' => 'checkCatalog(0)',
'permissions' => Array('view'),
'priority' => 0.1,
'type' => stTREE,
),
'in-portal:advanced_view' => Array(
'parent' => 'in-portal:site',
'icon' => 'advanced_view',
'label' => 'la_tab_AdvancedView',
'url' => Array('t' => 'in-portal/advanced_view', 'pass' => 'm'),
'permissions' => Array('view'),
'priority' => 0.2,
'type' => stTREE,
),
'in-portal:reviews' => Array(
'parent' => 'in-portal:site',
'icon' => 'reviews',
'label' => 'la_tab_Reviews',
'url' => Array('index_file' => 'reviews.php', 'pass' => 'm'),
'permissions' => Array('view'),
'priority' => 3,
'type' => stTREE,
),
'in-portal:configure_categories' => Array(
'parent' => 'in-portal:site',
'icon' => 'cat_settings',
'label' => 'la_tab_Settings',
'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array('view', 'edit'),
'priority' => 4,
'type' => stTREE,
),
'in-portal:configuration_search' => Array(
'parent' => 'in-portal:site',
'icon' => 'settings_search',
'label' => 'la_tab_ConfigSearch',
'url' => Array('t' => 'in-portal/config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array('view', 'edit'),
'priority' => 5,
'type' => stTREE,
),
'in-portal:configuration_email' => Array(
'parent' => 'in-portal:site',
'icon' => 'settings_email',
'label' => 'la_tab_ConfigE-mail',
'url' => Array('t' => 'in-portal/config/config_email', 'module' => 'In-Portal:Category', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array('view', 'edit'),
'priority' => 6,
'type' => stTREE,
),
'in-portal:configuration_custom' => Array(
'parent' => 'in-portal:site',
'icon' => 'settings_custom',
'label' => 'la_tab_ConfigCustom',
'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 7,
'type' => stTREE,
),
),*/
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER),
Array('mode' => 'AND', 'filters' => Array('show_new'), 'type' => HAVING_FILTER),
Array('mode' => 'AND', 'filters' => Array('show_pick'), 'type' => WHERE_FILTER),
),
'Filters' => Array(
'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Status != 1' ),
'show_pending' => Array('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => 'Status != 2' ),
'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Status != 0' ),
's1' => Array(),
'show_new' => Array('label' => 'la_Text_New', 'on_sql' => '', 'off_sql' => '`IsNew` != 1' ),
'show_pick' => Array('label' => 'la_prompt_EditorsPick', 'on_sql' => '', 'off_sql' => '`EditorsPick` != 1' ),
)
),
'ListSQLs' => Array( ''=> ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'PermCache ON '.TABLE_PREFIX.'PermCache.CategoryId = %1$s.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryCustomData cust ON %1$s.ResourceId = cust.ResourceId'),
'ItemSQLs' => Array( ''=> ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'PermCache ON '.TABLE_PREFIX.'PermCache.CategoryId = %1$s.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryCustomData cust ON %1$s.ResourceId = cust.ResourceId'),
'SubItems' => Array('c-rel', 'c-search','c-img', 'c-cdata', 'c-perm'),
'ListSortings' => Array(
'' => Array(
'ForcedSorting' => Array("CurrentSort" => 'asc', 'Priority' => 'desc', 'Name' => 'asc'),
'Sorting' => Array('Name' => 'asc'),
)
),
'CalculatedFields' => Array(
'' => Array(
'CurrentSort' => "REPLACE(ParentPath, CONCAT('|', ".'%1$s'.".CategoryId, '|'), '')",
)
),
'Fields' => Array
(
'CategoryId' => Array('type' => 'int','not_null' => 1,'default' => 0),
'Type' => Array('type' => 'int','not_null' => 1,'default' => 0),
'SymLinkCategoryId' => Array('type' => 'int', 'default' => NULL),
'ParentId' => Array('type' => 'int','not_null' => 1,'default' => 0),
'Name' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''),
'Filename' => Array('type' => 'string', 'not_null' => 1, 'default' => ''),
'AutomaticFilename' => Array('type' => 'int', 'not_null' => 1, 'default' => 1),
'Description' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'required' => 0, 'default' => null),
'CreatedOn' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'required' => 1, 'not_null' => 1),
'EditorsPick' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'Status' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 2),
'Priority' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'MetaKeywords' => Array('type' => 'string', 'default' => null),
'CachedDescendantCatsQty' => Array('type' => 'int', 'default' => 0),
'CachedNavbar' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
'CreatedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1,'default' => 0),
'ResourceId' => Array('type' => 'int', 'default' => null),
'ParentPath' => Array('type' => 'string', 'default' => null),
'TreeLeft' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'TreeRight' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'NamedParentPath' => Array('type' => 'string', 'default' => null),
'MetaDescription' => Array('type' => 'string', 'default' => null),
'HotItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'NewItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'PopItem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'Modified' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => 1,'default' => '#NOW#'),
'ModifiedById' => Array('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1,'default' => 0),
'CategoryTemplate' => Array('type' => 'string', 'not_null' => 1, 'default' => ''),
'CachedCategoryTemplate' => Array('type' => 'string', 'not_null' => 1, 'default' => ''),
),
'VirtualFields' => Array(
'CurrentSort' => Array('type' => 'string', 'default' => ''),
'IsNew' => Array('type' => 'int', 'default' => 0),
),
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_cat.gif'),
'Fields' => Array(
'Name' => Array('title' => 'la_col_Name', 'data_block' => 'category_td'),
'Description' => Array('title' => 'la_col_Description'),
'CreatedOn_formatted' => Array('title' => 'la_col_CreatedOn', 'sort_field' => 'CreatedOn'),
),
),
),
'ConfigMapping' => Array(
'PerPage' => 'Perpage_Category',
'ShortListPerPage' => 'Perpage_Category_Short',
'DefaultSorting1Field' => 'Category_Sortfield',
'DefaultSorting2Field' => 'Category_Sortfield2',
'DefaultSorting1Dir' => 'Category_Sortorder',
'DefaultSorting2Dir' => 'Category_Sortorder2',
),
);
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/categories/categories_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.66.2.4
\ No newline at end of property
+1.66.2.5
\ No newline at end of property
Index: branches/RC/core/units/sections/sections_config.php
===================================================================
--- branches/RC/core/units/sections/sections_config.php (revision 10454)
+++ branches/RC/core/units/sections/sections_config.php (revision 10455)
@@ -1,342 +1,342 @@
<?php
- $config = Array(
- 'Prefix' => 'inportal-sections',
- 'EventHandlerClass' => Array('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
- 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
-
-// 'SectionPrefix' => 'u',
- 'Sections' => Array(
- 'in-portal:root' => Array(
- 'parent' => null,
- 'icon' => 'in-portal:site',
- 'label' => $this->Application->ConfigValue('Site_Name'),
- 'url' => Array('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1),
- 'permissions' => Array('advanced:admin_login', 'advanced:front_login'),
- 'priority' => 0,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:site' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:struct',
- 'label' => 'la_tab_Site_Structure',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 1,
- 'type' => stTREE,
- 'SectionPrefix' => 'c',
- ),
-
- 'in-portal:browse' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:catalog',
- 'label' => 'la_tab_Browse',
- 'url' => Array('t' => 'in-portal/catalog', 'pass' => 'm'),
- 'late_load' => Array('t' => 'in-portal/xml/tree_categories', 'pass' => 'm', 'm_cat_id' => 0),
- 'onclick' => 'checkCatalog(0)',
- 'permissions' => Array('view'),
- 'priority' => 0.1,
- 'type' => stTREE,
- ),
- 'in-portal:advanced_view' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:advanced_view',
- 'label' => 'la_tab_AdvancedView',
- 'url' => Array('t' => 'in-portal/advanced_view', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 0.2,
- 'type' => stTREE,
- ),
-
- 'in-portal:reviews' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:reviews',
- 'label' => 'la_tab_Reviews',
- 'url' => Array('index_file' => 'reviews.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:configure_categories' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:cat_settings',
- 'label' => 'la_tab_Settings',
- 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:configuration_search' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:settings_search',
- 'label' => 'la_tab_ConfigSearch',
- 'url' => Array('t' => 'in-portal/config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- 'in-portal:configuration_email' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:settings_email',
- 'label' => 'la_tab_ConfigE-mail',
- 'url' => Array('t' => 'in-portal/config/config_email', 'module' => 'In-Portal:Category', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 6,
- 'type' => stTREE,
- ),
-
- 'in-portal:configuration_custom' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'in-portal:settings_custom',
- 'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 7,
- 'type' => stTREE,
- ),
-
-
- 'in-portal:users' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:community',
- 'label' => 'la_tab_Community',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 2,
- 'type' => stTREE,
- 'SectionPrefix' => 'u',
- ),
-
- 'in-portal:user_list' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:users',
- 'label' => 'la_tab_User_List',
- 'url' => Array('t' => 'in-portal/users/users_list', 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
- 'priority' => 1,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_groups' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:usergroups',
- 'label' => 'la_tab_User_Groups',
- 'url' => Array('t' => 'in-portal/groups/groups_list', 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete', 'advanced:send_email', 'advanced:manage_permissions'),
- 'priority' => 2,
- 'type' => stTREE,
- ),
-
- 'in-portal:configure_users' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:users_settings',
- 'label' => 'la_tab_ConfigSettings',
- 'url' => Array('t' => 'config/config_universal', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_email' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:settings_email',
- 'label' => 'la_tab_ConfigE-mail',
- 'url' => Array('t' => 'config/config_email', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_custom' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:settings_custom',
- 'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- 'in-portal:user_banlist' => Array(
- 'parent' => 'in-portal:users',
- 'icon' => 'in-portal:banlist',
- 'label' => 'la_tab_BanList',
- 'url' => Array('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 6,
- 'type' => stTREE,
- ),
-
- // "Help" section
- 'in-portal:help' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:help',
- 'label' => 'la_tab_Help',
- 'url' => Array('index_file' => 'help/manual.pdf', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 7,
- 'type' => stTREE,
- ),
-
- // "Summary & Logs" section
- 'in-portal:reports' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:summary_logs',
- 'label' => 'la_tab_Reports',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 4,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:log_summary' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:summary',
- 'label' => 'la_tab_Summary',
- 'url' => Array('index_file' => 'logs/summary.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 1,
- 'type' => stTREE,
- ),
-
- 'in-portal:searchlog' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:search_log',
- 'label' => 'la_tab_SearchLog',
- 'url' => Array('index_file' => 'logs/searchlog.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 2,
- 'type' => stTREE,
- ),
-
- 'in-portal:sessionlog' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:sessions_log',
- 'label' => 'la_tab_SessionLog',
- 'url' => Array('index_file' => 'logs/session_list.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:emaillog' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:email_log',
- 'label' => 'la_tab_EmailLog',
- 'url' => Array('index_file' => 'logs/email_log.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:visits' => Array(
- 'parent' => 'in-portal:reports',
- 'icon' => 'in-portal:visits',
- 'label' => 'la_tab_Visits',
- 'url' => Array('t' => 'in-portal/visits/visits_list', 'pass' => 'm'),
- 'permissions' => Array('view', 'delete'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- // "Configuration" section
- 'in-portal:system' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:conf',
- 'label' => 'la_tab_Sys_Config',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 5,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:configure_general' => Array(
- 'parent' => 'in-portal:system',
- 'icon' => 'in-portal:conf_general',
- 'label' => 'la_tab_General',
- 'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'module' => 'In-Portal', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 1,
- 'type' => stTREE,
- ),
-
- 'in-portal:configure_themes' => Array(
- 'parent' => 'in-portal:system',
- 'icon' => 'in-portal:conf_themes',
- 'label' => 'la_tab_Themes',
- 'url' => Array('index_file' => 'config/config_theme.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- // "Tools" section
- 'in-portal:tools' => Array(
- 'parent' => 'in-portal:root',
- 'icon' => 'in-portal:tools',
- 'label' => 'la_tab_Tools',
- 'url' => Array('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 6,
- 'type' => stTREE,
- 'SectionPrefix' => 'adm',
- ),
-
- 'in-portal:backup' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_backup',
- 'label' => 'la_tab_Backup',
- 'url' => Array('index_file' => 'backup/backup1.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 2,
- 'type' => stTREE,
- ),
-
- 'in-portal:restore' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_restore',
- 'label' => 'la_tab_Restore',
- 'url' => Array('index_file' => 'backup/restore1.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
-
- 'in-portal:main_import' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_import',
- 'label' => 'la_tab_ImportData',
- 'url' => Array('index_file' => 'import/step1.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 4,
- 'type' => stTREE,
- ),
-
- 'in-portal:sql_query' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:tool_import',
- 'label' => 'la_tab_QueryDB',
- 'url' => Array('index_file' => 'tools/sql_query.php', 'pass' => 'm'),
- 'permissions' => Array('view', 'edit'),
- 'priority' => 5,
- 'type' => stTREE,
- ),
-
- 'in-portal:server_info' => Array(
- 'parent' => 'in-portal:tools',
- 'icon' => 'in-portal:server_info',
- 'label' => 'la_tab_ServerInfo',
- 'url' => Array('index_file' => 'tools/server_info.php', 'pass' => 'm'),
- 'permissions' => Array('view'),
- 'priority' => 6,
- 'type' => stTREE,
- ),
- ),
+ $config = Array (
+ 'Prefix' => 'inportal-sections',
+ 'EventHandlerClass' => Array ('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'),
+
+// 'SectionPrefix' => 'u',
+ 'Sections' => Array (
+ 'in-portal:root' => Array (
+ 'parent' => null,
+ 'icon' => 'in-portal:site',
+ 'label' => $this->Application->ConfigValue('Site_Name'),
+ 'url' => Array ('t' => 'sections_list', 'pass' => 'm', 'pass_section' => true, 'no_amp' => 1),
+ 'permissions' => Array ('advanced:admin_login', 'advanced:front_login'),
+ 'priority' => 0,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:site' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:struct',
+ 'label' => 'la_tab_Site_Structure',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'c',
+ ),
+
+ 'in-portal:browse' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:catalog',
+ 'label' => 'la_tab_Browse',
+ 'url' => Array ('t' => 'in-portal/catalog', 'pass' => 'm'),
+ 'late_load' => Array ('t' => 'in-portal/xml/tree_categories', 'pass' => 'm', 'm_cat_id' => 0),
+ 'onclick' => 'checkCatalog(0)',
+ 'permissions' => Array ('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+ 'in-portal:advanced_view' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:advanced_view',
+ 'label' => 'la_tab_AdvancedView',
+ 'url' => Array ('t' => 'in-portal/advanced_view', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:reviews' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:reviews',
+ 'label' => 'la_tab_Reviews',
+ 'url' => Array ('t' => 'in-portal/reviews', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_categories' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:cat_settings',
+ 'label' => 'la_tab_Settings',
+ 'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_search' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_search',
+ 'label' => 'la_tab_ConfigSearch',
+ 'url' => Array ('t' => 'in-portal/config/config_search', 'module_key' => 'category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_email' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array ('t' => 'in-portal/config/config_email', 'module' => 'In-Portal:Category', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configuration_custom' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+
+ 'in-portal:users' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:community',
+ 'label' => 'la_tab_Community',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'u',
+ ),
+
+ 'in-portal:user_list' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users',
+ 'label' => 'la_tab_User_List',
+ 'url' => Array ('t' => 'in-portal/users/users_list', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete', 'advanced:ban', 'advanced:send_email', /*'advanced:add_favorite', 'advanced:remove_favorite',*/),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_groups' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:usergroups',
+ 'label' => 'la_tab_User_Groups',
+ 'url' => Array ('t' => 'in-portal/groups/groups_list', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete', 'advanced:send_email', 'advanced:manage_permissions'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_users' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:users_settings',
+ 'label' => 'la_tab_ConfigSettings',
+ 'url' => Array ('t' => 'config/config_universal', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_email' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_email',
+ 'label' => 'la_tab_ConfigE-mail',
+ 'url' => Array ('t' => 'config/config_email', 'module' => 'In-Portal:Users', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_custom' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:settings_custom',
+ 'label' => 'la_tab_ConfigCustom',
+ 'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:user_banlist' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'in-portal:banlist',
+ 'label' => 'la_tab_BanList',
+ 'url' => Array ('index_file' => 'config/edit_banlist.php', 'DataType' => 6, 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+
+ // "Help" section
+ 'in-portal:help' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:help',
+ 'label' => 'la_tab_Help',
+ 'url' => Array ('index_file' => 'help/manual.pdf', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+
+ // "Summary & Logs" section
+ 'in-portal:reports' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:summary_logs',
+ 'label' => 'la_tab_Reports',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:log_summary' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:summary',
+ 'label' => 'la_tab_Summary',
+ 'url' => Array ('index_file' => 'logs/summary.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:searchlog' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:search_log',
+ 'label' => 'la_tab_SearchLog',
+ 'url' => Array ('index_file' => 'logs/searchlog.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sessionlog' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:sessions_log',
+ 'label' => 'la_tab_SessionLog',
+ 'url' => Array ('index_file' => 'logs/session_list.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:emaillog' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:email_log',
+ 'label' => 'la_tab_EmailLog',
+ 'url' => Array ('index_file' => 'logs/email_log.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:visits' => Array (
+ 'parent' => 'in-portal:reports',
+ 'icon' => 'in-portal:visits',
+ 'label' => 'la_tab_Visits',
+ 'url' => Array ('t' => 'in-portal/visits/visits_list', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'delete'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ // "Configuration" section
+ 'in-portal:system' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:conf',
+ 'label' => 'la_tab_Sys_Config',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:configure_general' => Array (
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_general',
+ 'label' => 'la_tab_General',
+ 'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'module' => 'In-Portal', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 1,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:configure_themes' => Array (
+ 'parent' => 'in-portal:system',
+ 'icon' => 'in-portal:conf_themes',
+ 'label' => 'la_tab_Themes',
+ 'url' => Array ('index_file' => 'config/config_theme.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ // "Tools" section
+ 'in-portal:tools' => Array (
+ 'parent' => 'in-portal:root',
+ 'icon' => 'in-portal:tools',
+ 'label' => 'la_tab_Tools',
+ 'url' => Array ('t' => 'sections_list', 'pass_section' => true, 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ 'SectionPrefix' => 'adm',
+ ),
+
+ 'in-portal:backup' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_backup',
+ 'label' => 'la_tab_Backup',
+ 'url' => Array ('index_file' => 'backup/backup1.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 2,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:restore' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_restore',
+ 'label' => 'la_tab_Restore',
+ 'url' => Array ('index_file' => 'backup/restore1.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 3,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:main_import' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_ImportData',
+ 'url' => Array ('index_file' => 'import/step1.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 4,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:sql_query' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:tool_import',
+ 'label' => 'la_tab_QueryDB',
+ 'url' => Array ('index_file' => 'tools/sql_query.php', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'edit'),
+ 'priority' => 5,
+ 'type' => stTREE,
+ ),
+
+ 'in-portal:server_info' => Array (
+ 'parent' => 'in-portal:tools',
+ 'icon' => 'in-portal:server_info',
+ 'label' => 'la_tab_ServerInfo',
+ 'url' => Array ('index_file' => 'tools/server_info.php', 'pass' => 'm'),
+ 'permissions' => Array ('view'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+ ),
);
\ No newline at end of file
Property changes on: branches/RC/core/units/sections/sections_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5.2.1
\ No newline at end of property
+1.5.2.2
\ No newline at end of property
Index: branches/RC/core/units/reviews/reviews_config.php
===================================================================
--- branches/RC/core/units/reviews/reviews_config.php (revision 10454)
+++ branches/RC/core/units/reviews/reviews_config.php (revision 10455)
@@ -1,190 +1,196 @@
<?php
$config = Array (
'Prefix' => 'rev',
'Clones' => Array (
'l-rev' => Array(
'ParentPrefix' => 'l',
'ConfigMapping' => Array (
'PerPage' => 'Perpage_LinkReviews',
'ShortListPerPage' => 'Perpage_LinkReviews_Short',
'DefaultSorting1Field' => 'Link_ReviewsSort',
'DefaultSorting2Field' => 'Link_ReviewsSort2',
'DefaultSorting1Dir' => 'Link_ReviewsOrder',
'DefaultSorting2Dir' => 'Link_ReviewsOrder2',
'ReviewDelayInterval' => 'link_ReviewDelay_Interval',
'ReviewDelayValue' => 'link_ReviewDelay_Value',
),
),
'n-rev' => Array (
'ParentPrefix' => 'n',
'ConfigMapping' => Array (
'PerPage' => 'Perpage_NewsReviews',
'ShortListPerPage' => 'Perpage_NewsReviews_Short',
'DefaultSorting1Field' => 'News_SortReviews',
'DefaultSorting2Field' => 'News_SortReviews2',
'DefaultSorting1Dir' => 'News_SortReviewsOrder',
'DefaultSorting2Dir' => 'News_SortReviewsOrder2',
'ReviewDelayInterval' => 'News_ReviewDelay_Interval',
'ReviewDelayValue' => 'News_ReviewDelay_Value',
),
),
'bb-rev' => Array (
'ParentPrefix' => 'bb',
'ConfigMapping' => Array (
'PerPage' => 'Perpage_TopicReviews',
'ReviewDelayInterval' => 'topic_ReviewDelay_Interval',
'ReviewDelayValue' => 'topic_ReviewDelay_Value',
),
),
'p-rev' => Array (
'ParentPrefix' => 'p',
'ConfigMapping' => Array (
'PerPage' => 'Comm_Perpage_Reviews',
'ReviewDelayInterval' => 'product_ReviewDelay_Value',
'ReviewDelayValue' => 'product_ReviewDelay_Interval',
),
),
),
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ReviewsEventHandler','file'=>'reviews_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'event',
4 => 'mode',
),
'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too
'ConfigMapping' => Array (
'PerPage' => 'Comm_Perpage_Reviews',
'ReviewDelayInterval' => 'product_ReviewDelay_Value',
'ReviewDelayValue' => 'product_ReviewDelay_Interval',
),
'IDField' => 'ReviewId',
'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events
'TableName' => TABLE_PREFIX.'ItemReview',
'ParentTableKey' => 'ResourceId', // linked field in master table
'ForeignKey' => 'ItemId', // linked field in subtable
'AutoDelete' => true,
'AutoClone' => true,
'TitlePresets' => Array (
'reviews_edit' => Array('format' => "!la_title_Editing_Review!"),
),
'FilterMenu' => Array (
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER),
),
'Filters' => Array(
'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => '%1$s.Status != 1' ),
'show_pending' => Array('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => '%1$s.Status != 2' ),
'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ),
)
),
'CalculatedFields' => Array (
'' => Array (
'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )',
),
'products' => Array (
'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )',
'ItemName' => 'pr.l1_Name',
'ProductId' => 'pr.ProductId',
),
'product' => Array (
'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )',
'ItemName' => 'pr.l1_Name',
'ProductId' => 'pr.ProductId',
),
),
// key - special, value - list select sql
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById',
'products' => ' SELECT %1$s.* %2$s
- FROM %1$s
+ FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Products pr ON pr.ResourceId = %1$s.ItemId
LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById',
'product' => ' SELECT %1$s.* %2$s
- FROM %1$s
+ FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Products pr ON pr.ResourceId = %1$s.ItemId
LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById',
),
'ItemSQLs' => Array ('' => 'SELECT * FROM %s'),
'ListSortings' => Array (
'' => Array(
'ForcedSorting' => Array('Priority' => 'desc'),
'Sorting' => Array('CreatedOn' => 'desc'),
)
),
'Fields' => Array (
'ReviewId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'CreatedOn' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'default'=>'#NOW#'),
'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''),
'Rating' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'lu_None', 1 => 'lu_Rating_1', 2 => 'lu_Rating_2', 3 => 'lu_Rating_3', 4 => 'lu_Rating_4', 5 => 'lu_Rating_5'), 'use_phrases' => 1, 'min_value_inc' => 0, 'max_value_inc' => 5, 'default' => 0),
'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''),
'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0),
'CreatedById' => Array('type' => 'int', 'formatter'=>'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array(-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'','left_key_field'=>'PortalUserId','left_title_field'=>'Login','required'=>1,'not_null'=>1,'default'=>-1),
'ItemType' => Array('type'=>'int','not_null'=>1,'default'=>0),
'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0),
'Status' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array(1=>'la_Active',2=>'la_Pending',0=>'la_Disabled'),'not_null'=>1,'default'=>2 ),
'TextFormat' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_text', 1 => 'la_html'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'Module' => Array('type'=>'string','not_null'=>1,'default'=>''),
),
'VirtualFields' => Array (
'ReviewedBy' => Array('type' => 'string', 'default' => ''),
+
+ 'CatalogItemName' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
+ 'CatalogItemId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array ('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'),
'Fields' => Array (
- 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'reviewtext_checkbox_td'),
+ 'ReviewId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td'),
+ 'ReviewText' => Array( 'title'=>'la_col_ReviewText',),
'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ),
'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ),
'Status' => Array( 'title'=>'la_col_Status' ),
'Rating' => Array( 'title'=>'la_col_Rating' ),
),
),
'ReviewsSection' => Array (
'Icons' => Array ('default'=>'icon16_custom.gif',1=>'icon16_review.gif',2=>'icon16_review_pending.gif',0=>'icon16_review_disabled.gif'),
'Fields' => Array (
- 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'grid_checkbox_namelink_td'),
+ 'ReviewId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td'),
+ 'ReviewText' => Array( 'title'=>'la_col_ReviewText', 'data_block' => 'grid_reviewtext_td'),
'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ),
'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ),
'Status' => Array( 'title'=>'la_col_Status' ),
+ 'Rating' => Array( 'title'=>'la_col_Rating' ),
),
),
),
);
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/reviews/reviews_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14.2.1
\ No newline at end of property
+1.14.2.2
\ No newline at end of property
Index: branches/RC/core/units/reviews/reviews_tag_processor.php
===================================================================
--- branches/RC/core/units/reviews/reviews_tag_processor.php (revision 10454)
+++ branches/RC/core/units/reviews/reviews_tag_processor.php (revision 10455)
@@ -1,97 +1,138 @@
<?php
class ReviewsTagProcessor extends kDBTagProcessor
{
/**
* Returns a link for editing product
*
* @param Array $params
* @return string
*/
function ItemEditLink($params)
{
- $item_prefix = $params['item_prefix'];
- $id_field = $this->Application->getUnitOption($item_prefix,'IDField');
+ $object =& $this->getObject();
+ /* @var $object kDBList */
- $object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
- $item_id = $object->GetDBField($id_field);
+ $item_prefix = $this->Application->findModule('Name', $object->GetDBField('Module'), 'Var');
+ $edit_template = $this->Application->getUnitOption($item_prefix, 'AdminTemplatePath') . '/' . $this->Application->getUnitOption($item_prefix, 'AdminTemplatePrefix') . 'edit';
+
+ $url_params = Array (
+ 'm_opener' => 'd',
+ $item_prefix.'_mode' => 't',
+ $item_prefix.'_event' => 'OnEdit',
+ $item_prefix.'_id' => $object->GetDBField('CatalogItemId'),
+ 'pass' => 'all,'.$item_prefix
+ );
- return $this->Application->HREF($params['edit_template'],'', Array(
- 'm_opener' => 'd',
- $item_prefix.'_mode' => 't',
- $item_prefix.'_event' => 'OnEdit',
- $item_prefix.'_id' => $item_id,
- 'pass' => 'all,'.$item_prefix
- ), 'index.php');
+ return $this->Application->HREF($edit_template,'', $url_params);
}
/**
* Get's reuested field value
*
* @param Array $params
* @return string
* @access public
*/
function Field($params)
{
$field = $this->SelectParam($params, 'name,field');
$object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
if ($field == 'ReviewText') {
if ($object->GetDBField('TextFormat') == 1) {
$params['no_special'] = 'no_special';
}
else {
unset($params['no_special']);
}
}
return parent::Field($params);
}
function AlreadyReviewed($params)
{
$parent_prefix = $this->Application->getUnitOption($this->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
$spam_helper->InitHelper($main_object->GetDBField('ResourceId'), 'Review', 0);
return $spam_helper->InSpamControl();
}
function HasError($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
if (method_exists($object, 'GetErrorMsg')) {
return parent::HasError($params);
}
else {
return 0;
}
}
/**
* Preserve main item id in subitem pagination url
*
* @param Array $params
* @return string
*/
function PageLink($params)
{
$object =& $this->getObject($params);
/* @var kDBList */
$parent_info = $object->getLinkedInfo();
if ($parent_info['ParentId'] > 0) {
$params['pass'] = 'm,'.$this->getPrefixSpecial().','.$parent_info['ParentPrefix'];
}
return parent::PageLink($params);
}
+
+ function InitCatalogTab($params)
+ {
+ $tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
+ $tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
+ $tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
+
+ // set default params (same as in catalog)
+ if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
+ if ($tab_params['special'] === false) $tab_params['special'] = '';
+ if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
+
+ // pass params to block with tab content
+ $params['name'] = $params['render_as'];
+ $params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+
+ $params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+ $params['tab_mode'] = $tab_params['mode'];
+ $params['tab_dependant'] = $tab_params['dependant'];
+ $params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
+ $params['tab_name'] = $this->Application->GetVar('tab_name');
+
+ return $this->Application->ParseBlock($params, 1);
+ }
+
+ /**
+ * Returns reviews count for each item type (in "Reviews" section)
+ *
+ * @param Array $params
+ * @return string
+ */
+ function CatalogItemCount($params)
+ {
+ $object =& $this->GetList($params);
+ if (!$object->Counted) {
+ $object->CountRecs();
+ }
+ return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
+ }
}
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/reviews/reviews_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.9.2.1
\ No newline at end of property
Index: branches/RC/core/units/reviews/reviews_event_handler.php
===================================================================
--- branches/RC/core/units/reviews/reviews_event_handler.php (revision 10454)
+++ branches/RC/core/units/reviews/reviews_event_handler.php (revision 10455)
@@ -1,346 +1,474 @@
<?php
class ReviewsEventHandler extends kDBEventHandler
{
/**
* Get's special of main item for linking with subitem
*
* @param kEvent $event
* @return string
*/
function getMainSpecial(&$event)
{
if ($event->Special == 'product' && !$this->Application->IsAdmin()) {
// rev.product should auto-link
return '';
}
return parent::getMainSpecial($event);
}
/**
* Checks REVIEW/REVIEW.PENDING permission by main object primary category (not current category)
*
* @param kEvent $event
*/
function CheckPermission(&$event)
{
if ($event->Name == 'OnAddReview' || $event->Name == 'OnCreate') {
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
$perm_name = $this->getPermPrefix($event).'.REVIEW';
$res = $this->Application->CheckPermission($perm_name, 0, $main_object->GetDBField('CategoryId')) ||
$this->Application->CheckPermission($perm_name.'.PENDING', 0, $main_object->GetDBField('CategoryId'));
if (!$res) {
$event->status = erPERM_FAIL;
}
return $res;
}
+ $check_events = Array (
+ 'OnItemBuild', 'OnUpdate', /*'OnMassApprove', 'OnMassDecline'*/
+ );
+
+ $perm_category = $this->_getReviewCategory($event);
+
+ if (in_array($event->Name, $check_events)) {
+ // check for PRODUCT.VIEW permission
+
+ $perm_helper =& $this->Application->recallObject('PermissionsHelper');
+ /* @var $perm_helper kPermissionsHelper */
+
+ $perm_prefix = $this->getPermPrefix($event);
+
+ if ($perm_category === false) {
+ // no item id present -> allow
+ return true;
+ }
+
+ switch ($event->Name) {
+ case 'OnItemBuild':
+ $res = $this->Application->CheckPermission($perm_prefix . '.VIEW', 0, $perm_category);
+ break;
+
+ case 'OnUpdate':
+ case 'OnMassApprove':
+ case 'OnMassDecline':
+ $res = $this->Application->CheckPermission($perm_prefix . '.ADD', 0, $perm_category) ||
+ $this->Application->CheckPermission($perm_prefix . '.MODIFY', 0, $perm_category);
+ break;
+ }
+
+ if (!$res) {
+ $event->status = erPERM_FAIL;
+ }
+
+ return $res;
+
+ }
+
return parent::CheckPermission($event);
}
/**
+ * Returns primary category of review's main item
+ *
+ * @param kEvent $event
+ * @return int
+ */
+ function _getReviewCategory(&$event)
+ {
+ $items_info = $this->Application->GetVar($event->getPrefixSpecial());
+ list ($review_id, ) = each($items_info);
+
+ if (!$review_id) {
+ return false;
+ }
+
+ // 1. get main item resource id
+ $sql = 'SELECT ItemId
+ FROM ' . $this->Application->getUnitOption($event->Prefix, 'TableName') . '
+ WHERE ' . $this->Application->getUnitOption($event->Prefix, 'IDField') . ' = ' . $review_id;
+ $resource_id = $this->Conn->GetOne($sql);
+
+ // 2. set main item id (for permission checks)
+ $parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
+ $sql = 'SELECT ' . $this->Application->getUnitOption($parent_prefix, 'IDField') .'
+ FROM ' . $this->Application->getUnitOption($parent_prefix, 'TableName') .'
+ WHERE ResourceId = ' . $resource_id;
+ $this->Application->SetVar($parent_prefix . '_id', $this->Conn->GetOne($sql));
+
+ // 3. get main item category
+ $sql = 'SELECT CategoryId
+ FROM ' . $this->Application->getUnitOption('ci', 'TableName') .'
+ WHERE ItemResourceId = ' . $resource_id .' AND PrimaryCat = 1';
+ return $this->Conn->GetOne($sql);
+ }
+
+ /**
* Returns prefix for permissions
*
* @param kEvent $event
*/
function getPermPrefix(&$event)
{
- $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix);
+ $main_prefix = $this->Application->GetTopmostPrefix($event->Prefix, true);
// this will return LINK for l, ARTICLE for n, TOPIC for bb, PRODUCT for p
$item_prefix = $this->Application->getUnitOption($main_prefix, 'PermItemPrefix');
return $item_prefix;
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @access protected
* @see OnListBuild
*/
function SetCustomQuery(&$event)
{
$object =& $event->getObject();
/* @var $object kDBList */
if (!$this->Application->IsAdmin()) {
$object->addFilter('active', '%1$s.Status = '.STATUS_ACTIVE);
}
switch ($event->Special)
{
case 'showall':
$object->clearFilters();
break;
case 'item': // used ?
$object->clearFilters();
$info = $object->getLinkedInfo();
$this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true);
$parent =& $this->Application->recallObject($info['ParentPrefix']);
$object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId'));
break;
case 'products': // used in In-Portal (Sturcture & Data -> Reviews section)
$object->removeFilter('parent_filter'); // this is important
$object->addFilter('product_reviews', 'pr.ResourceId IS NOT NULL');
break;
/*case 'product':
$object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); // for LEFT JOIN
break;*/
}
+ if (preg_match('/(.*)-rev/', $event->Prefix, $regs)) {
+ // "Structure & Data" -> "Reviews" (section in K4)
+ $item_type = $this->Application->getUnitOption($regs[1], 'ItemType');
+ $object->addFilter('itemtype_filter', '%1$s.ItemType = ' . $item_type);
+ }
+
if ($event->getEventParam('type') == 'current_user') {
// $object->removeFilter('active');
$object->addFilter('current_user', '%1$s.CreatedById = '.$this->Application->RecallVar('user_id'));
$object->addFilter('current_ip', '%1$s.IPAddress = "'.$_SERVER['REMOTE_ADDR'].'"');
}
}
/**
* Adds review from front in case if user is logged in
*
* @param kEvent $event
*/
function OnAddReview(&$event)
{
$event->CallSubEvent('OnCreate');
}
/**
* Get new review status on user review permission
*
* @param kEvent $event
* @return int
*/
function getReviewStatus(&$event)
{
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix);
/* @var $main_object kCatDBItem */
$ret = STATUS_DISABLED;
$perm_name = $this->getPermPrefix($event).'.REVIEW';
if ($this->Application->CheckPermission($perm_name, 0, $main_object->GetDBField('CategoryId'))) {
$ret = STATUS_ACTIVE;
}
else if ($this->Application->CheckPermission($perm_name.'.PENDING', 0, $main_object->GetDBField('CategoryId'))) {
$ret = STATUS_PENDING;
}
return $ret;
}
/**
* Prefills all fields on front-end
*
* @param kEvent $event
*/
function OnBeforeItemCreate(&$event)
{
$object =& $event->getObject();
/* @var $object kDBItem */
$parent_info = $object->getLinkedInfo();
$item_type = $this->Application->getUnitOption($parent_info['ParentPrefix'], 'ItemType');
$object->SetDBField('IPAddress', $_SERVER['REMOTE_ADDR']);
$object->SetDBField('ItemType', $item_type);
$object->SetDBField('Module', $this->Application->findModule('Var', $parent_info['ParentPrefix'], 'Name'));
if ($this->Application->IsAdmin()) {
return ;
}
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
$spam_helper->InitHelper($parent_info['ParentId'], 'Review', 0);
if ($spam_helper->InSpamControl()) {
$event->status = erFAIL;
$object->SetError('ReviewText', 'too_frequent', 'lu_ferror_review_duplicate');
return ;
}
$rating = $object->GetDBField('Rating');
if ($rating < 1 || $rating > 5) {
$object->SetDBField('Rating', null);
}
$object->SetDBField('ItemId', $parent_info['ParentId']); // ResourceId
$object->SetDBField('CreatedById', $this->Application->RecallVar('user_id'));
$object->SetDBField('Status', $this->getReviewStatus($event));
$object->SetDBField('TextFormat', 0); // set plain text format directly
}
/**
* Sets correct rating value
*
* @param kEvent $event
*/
function OnBeforeItemUpdate(&$event)
{
$object =& $event->getObject();
$rating = $object->GetDBField('Rating');
if (!$rating) {
$object->SetDBField('Rating', null);
}
}
/**
* Updates item review counter
*
* @param kEvent $event
*/
function OnAfterItemCreate(&$event)
{
$this->updateSubitemCounters($event);
if (!$this->Application->IsAdmin()) {
$spam_helper =& $this->Application->recallObject('SpamHelper');
/* @var $spam_helper SpamHelper */
$object =& $event->getObject();
$parent_info = $object->getLinkedInfo();
$config_mapping = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping');
$review_settings = $config_mapping['ReviewDelayValue'].':'.$config_mapping['ReviewDelayInterval'];
$spam_helper->InitHelper($parent_info['ParentId'], 'Review', $review_settings);
$spam_helper->AddToSpamControl();
}
}
/**
* Updates item review counter
*
* @param kEvent $event
*/
function OnAfterItemUpdate(&$event)
{
$this->updateSubitemCounters($event);
}
/**
* Updates total review counter, cached rating, votes count
*
* @param kEvent $event
*/
function updateSubitemCounters(&$event)
{
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$main_object =& $this->Application->recallObject($parent_prefix, null, Array ('raise_warnings' => 0));
/* @var $main_object kCatDBItem */
if (!$main_object->isLoaded()) {
// deleting main item / cloning main item
return ;
}
$object =& $event->getObject(); // for temp tables
/* @var $object kDBItem */
// 1. update review counter
$sql = 'SELECT COUNT(ReviewId)
FROM '.$object->TableName.'
WHERE ItemId = '.$main_object->GetDBField('ResourceId');
$review_count = $this->Conn->GetOne($sql);
$main_object->SetDBField('CachedReviewsQty', $review_count);
// 2. update votes counter + rating
$rating = $object->GetDBField('Rating');
$avg_rating = $main_object->GetDBField('CachedRating');
$votes_count = $main_object->GetDBField('CachedVotesQty');
switch ($event->Name) {
case 'OnAfterItemCreate': // adding new review with rating
$this->changeRating($avg_rating, $votes_count, $rating, '+');
break;
case 'OnAfterItemDelete':
$this->changeRating($avg_rating, $votes_count, $rating, '-');
break;
case 'OnAfterItemUpdate':
$this->changeRating($avg_rating, $votes_count, $object->GetOriginalField('Rating'), '-');
$this->changeRating($avg_rating, $votes_count, $rating, '+');
break;
}
$main_object->SetDBField('CachedRating', $avg_rating);
$main_object->SetDBField('CachedVotesQty', $votes_count);
$main_object->Update();
}
/**
* Changes average rating and votes count based on requested operation
*
* @param float $avg_rating average rating before new vote
* @param int $votes_count votes count before new vote
* @param int $rating new vote (from 1 to 5)
* @param string $operation requested operation (+ / -)
*/
function changeRating(&$avg_rating, &$votes_count, $rating, $operation)
{
if ($rating < 1 || $rating > 5) {
return ;
}
if ($operation == '+') {
$avg_rating = (($avg_rating * $votes_count) + $rating) / ($votes_count + 1);
++$votes_count;
}
else {
$avg_rating = (($avg_rating * $votes_count) - $rating) / ($votes_count - 1);
--$votes_count;
}
}
/**
* Updates main item cached review counter
*
* @param kEvent $event
*/
function OnAfterItemDelete(&$event)
{
$this->updateSubitemCounters($event);
}
/**
* Creates review & redirect to confirmation template
*
* @param kEvent $event
*/
function OnCreate(&$event)
{
parent::OnCreate($event);
if ($event->status != erSUCCESS || $this->Application->IsAdmin()) {
return ;
}
$object =& $event->getObject();
$next_template = $object->GetDBField('Status') == STATUS_ACTIVE ? 'success_template' : 'success_pending_template';
$event->redirect = $this->Application->GetVar($next_template);
$event->SetRedirectParam('opener', 's');
$parent_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
$event->SetRedirectParam('pass', 'm,'.$parent_prefix);
}
+
+ /**
+ * Makes left join to item's table, when in separate grid
+ *
+ * @param kEvent $event
+ */
+ function OnAfterConfigRead(&$event)
+ {
+ parent::OnAfterConfigRead($event);
+
+ if (preg_match('/(.*)-rev/', $event->Prefix, $regs)) {
+ // "Structure & Data" -> "Reviews" (section in K4)
+
+ // 1. add join to items table (for "Structure & Data" -> "Reviews" section)
+ $item_table = $this->Application->getUnitOption($regs[1], 'TableName');
+
+ $list_sqls = $this->Application->getUnitOption($event->Prefix, 'ListSQLs');
+ $list_sqls[''] .= ' LEFT JOIN '.$item_table.' item_table ON item_table.ResourceId = %1$s.ItemId';
+ $this->Application->setUnitOption($event->Prefix, 'ListSQLs', $list_sqls);
+
+ // 2. add calculated field
+ $calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields');
+ $calculated_fields['']['CatalogItemName'] = 'item_table.' . $this->getTitleField($regs[1]);
+ $calculated_fields['']['CatalogItemId'] = 'item_table.' . $this->Application->getUnitOption($regs[1], 'IDField');
+ $this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields);
+ }
+ }
+
+ /**
+ * Convert TitleField field of kMultiLanguage formatter used for it
+ *
+ * @param string $prefix
+ * @return string
+ */
+ function getTitleField($prefix)
+ {
+ $lang_prefix = 'l'.$this->Application->GetVar('m_lang').'_';
+
+ $title_field = $this->Application->getUnitOption($prefix, 'TitleField');
+ $field_options = $this->Application->getUnitOption($prefix.'.'.$title_field, 'Fields');
+
+ $formatter_class = isset($field_options['formatter']) ? $field_options['formatter'] : '';
+ if ($formatter_class == 'kMultiLanguage' && !isset($field_options['master_field'])) {
+ $title_field = $lang_prefix.$title_field;
+ }
+ return $title_field;
+ }
}
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/reviews/reviews_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14.2.2
\ No newline at end of property
+1.14.2.3
\ No newline at end of property
Index: branches/RC/core/units/admin/admin_events_handler.php
===================================================================
--- branches/RC/core/units/admin/admin_events_handler.php (revision 10454)
+++ branches/RC/core/units/admin/admin_events_handler.php (revision 10455)
@@ -1,491 +1,493 @@
<?php
class AdminEventsHandler extends kDBEventHandler {
function mapPermissions()
{
parent::mapPermissions();
$permissions = Array(
'OnSaveColumns' => array('self' => true),
'OnClosePopup' => array('self' => true),
'OnSaveSetting' => array('self' => true),
// export/import permissions is checked within events
'OnExportCSV' => Array('self' => true),
'OnGetCSV' => Array('self' => true),
'OnCSVImportBegin' => Array('self' => true),
'OnCSVImportStep' => Array('self' => true),
'OnDropTempTablesByWID' => array('self' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Checks permissions of user
*
* @param kEvent $event
*/
function CheckPermission(&$event)
{
$system_events = Array (
'OnResetModRwCache', 'OnResetCMSMenuCache', 'OnResetSections',
'OnResetConfigsCache', 'OnCompileTemplates', 'OnGenerateTableStructure',
'OnRebuildThemes', 'OnCheckPrefixConfig',
);
if ($this->Application->isDebugMode(false) && in_array($event->Name, $system_events)) {
return true;
}
return parent::CheckPermission($event);
}
function OnResetModRwCache(&$event)
{
$this->Conn->Query('DELETE FROM '.TABLE_PREFIX.'Cache WHERE VarName LIKE "mod_rw%"');
}
function OnResetCMSMenuCache(&$event)
{
$this->Conn->Query('DELETE FROM '.TABLE_PREFIX.'Cache WHERE VarName = "cms_menu"');
}
function OnResetSections(&$event)
{
$this->Conn->Query('DELETE FROM '.TABLE_PREFIX.'Cache WHERE VarName = "sections_parsed"');
}
function OnResetConfigsCache(&$event)
{
$this->Conn->Query('DELETE FROM '.TABLE_PREFIX.'Cache WHERE VarName = "config_files" OR VarName = "configs_parsed" OR VarName = "sections_parsed"');
}
function OnCompileTemplates(&$event)
{
$compiler =& $this->Application->recallObject('NParserCompiler');
/* @var $compiler NParserCompiler */
$compiler->CompileTemplatesStep();
$event->status = erSTOP;
}
/**
* Generates sturcture for specified table
*
* @param kEvent $event
* @author Alex
*/
function OnGenerateTableStructure(&$event)
{
$types_hash = Array(
'string' => 'varchar|text|mediumtext|longtext|date|datetime|time|timestamp|char|year|enum|set',
'int' => 'smallint|mediumint|int|bigint|tinyint',
'float' => 'float|double|decimal',
);
$table_name = $this->Application->GetVar('table_name');
if (!$table_name) {
echo 'error: no table name specified';
return ;
}
if (TABLE_PREFIX && !preg_match('/^'.preg_quote(TABLE_PREFIX, '/').'(.*)/', $table_name)) {
// table name without prefix, then add it
$table_name = TABLE_PREFIX.$table_name;
}
if (!$this->Conn->TableFound($table_name)) {
// table with prefix doesn't exist, assume that just config prefix passed -> resolve table name from it
$table_name = $this->Application->getUnitOption(substr($table_name, strlen(TABLE_PREFIX)), 'TableName');
}
$table_info = $this->Conn->Query('DESCRIBE '.$table_name);
// 1. prepare config keys
$id_field = '';
$fields = Array();
$float_types = Array ('float', 'double', 'numeric');
foreach ($table_info as $field_info) {
if (preg_match('/l[\d]+_.*/', $field_info['Field'])) {
// don't put multilingual fields in config
continue;
}
$field_options = Array ();
// 1. get php field type by mysql field type
foreach ($types_hash as $php_type => $db_types) {
if (preg_match('/'.$db_types.'/', $field_info['Type'])) {
$field_options['type'] = $php_type;
break;
}
}
$default_value = $field_info['Default'];
if (in_array($php_type, $float_types)) {
// this is float number
if (preg_match('/'.$db_types.'\([\d]+,([\d]+)\)/i', $field_info['Type'], $regs)) {
// size is described in structure -> add formatter
$field_options['formatter'] = 'kFormatter';
$field_options['format'] = '%01.'.$regs[1].'f';
if ($field_info['Null'] != 'YES') {
// null fields, will most likely have NULL as default value
$default_value = 0;
}
}
else {
// no size information, just convert to float
if ($field_info['Null'] != 'YES') {
// null fields, will most likely have NULL as default value
$default_value = (float)$default_value;
}
}
}
if (preg_match('/varchar\(([\d]+)\)/i', $field_info['Type'], $regs)) {
$field_options['max_len'] = (int)$regs[1];
}
if ($field_info['Null'] != 'YES') {
$field_options['not_null'] = 1;
}
if ($field_info['Key'] == 'PRI') {
$default_value = 0;
$id_field = $field_info['Field'];
}
if ($php_type == 'int' && ($field_info['Null'] != 'YES' || is_numeric($default_value))) {
// is integer field AND not null
$field_options['default'] = (int)$default_value;
}
else {
$field_options['default'] = $default_value;
}
$fields[ $field_info['Field'] ] = $this->transformDump($field_options);
}
$ret = stripslashes(var_export($fields, true));
$ret = preg_replace("/'(.*?)' => 'Array \((.*?), \)',/", "'\\1' => Array (\\2),", $ret);
$ret = preg_replace("/\n '/", "\n\t'", $ret);
$ret = "'IDField' => '".$id_field."',\n'Fields' => A".substr($ret, 1).',';
ob_start();
?>
<html>
<head>
<title>Table "<?php echo $table_name; ?>" Structure</title>
</head>
<body bgcolor="#E7E7E7">
<a href="javascript:window.close();">Close Window</a><br />
<?php echo $GLOBALS['debugger']->highlightString($ret); ?>
<br /><a href="javascript:window.close();">Close Window</a><br />
</body>
</html>
<?php
echo ob_get_clean();
$event->status = erSTOP;
}
function transformDump($dump)
{
if (is_array($dump)) {
$dump = var_export($dump, true);
}
$dump = preg_replace("/,\n[ ]*/", ', ', $dump);
$dump = preg_replace("/array \(\n[ ]*/", 'Array (', $dump); // replace array start
$dump = preg_replace("/,\n[ ]*\),/", "),", $dump); // replace array end
return $dump;
}
/**
* Refreshes ThemeFiles & Theme tables by actual content on HDD
*
* @param kEvent $event
*/
function OnRebuildThemes(&$event)
{
$themes_helper =& $this->Application->recallObject('ThemesHelper');
/* @var $themes_helper kThemesHelper */
$themes_helper->refreshThemes();
}
- function OnSaveColumns(&$event) {
+ function OnSaveColumns(&$event)
+ {
+ $picker_helper =& $this->Application->recallObject('ColumnPickerHelper');
/* @var $picker_helper kColumnPickerHelper */
- $picker_helper =& $this->Application->RecallObject('ColumnPickerHelper');
+
$picker_helper->SetGridName($this->Application->GetLinkedVar('grid_name'));
$picked = trim($this->Application->GetVar('picked_str'), '|');
$hidden = trim($this->Application->GetVar('hidden_str'), '|');
$main_prefix = $this->Application->GetVar('main_prefix');
$picker_helper->SaveColumns($main_prefix, $picked, $hidden);
$this->finalizePopup($event);
}
/**
* Saves various admin settings via ajax
*
* @param kEvent $event
*/
function OnSaveSetting(&$event)
{
if ($this->Application->GetVar('ajax') != 'yes') {
return ;
}
$var_name = $this->Application->GetVar('var_name');
$var_value = $this->Application->GetVar('var_value');
$this->Application->StorePersistentVar($var_name, $var_value);
$event->status = erSTOP;
}
/**
* Just closes popup & deletes last_template & opener_stack if popup, that is closing
*
* @param kEvent $event
*/
function OnClosePopup(&$event)
{
$event->SetRedirectParam('opener', 'u');
}
/**
* Occurs right after initialization of the kernel, used mainly as hook-to event
*
* @param kEvent $event
*/
function OnStartup(&$event)
{
}
/**
* Occurs right before echoing the output, in Done method of application, used mainly as hook-to event
*
* @param kEvent $event
*/
function OnBeforeShutdown(&$event)
{
}
/**
* Is called after tree was build (when not from cache)
*
* @param kEvent $event
*/
function OnAfterBuildTree(&$event)
{
}
/**
* Called by AJAX to perform CSV export
*
* @param kEvent $event
*/
function OnExportCSV(&$event)
{
$export_helper =& $this->Application->recallObject('CSVHelper');
/* @var $export_helper kCSVHelper */
$prefix_special = $this->Application->GetVar('PrefixSpecial');
if(!$prefix_special) {
$prefix_special = $export_helper->ExportData('prefix');
}
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.view')) {
$this->Application->Redirect('no_permission');
}
$export_helper->PrefixSpecial = $prefix_special;
$export_helper->grid = $this->Application->GetVar('grid');
$export_helper->ExportStep();
$event->status = erSTOP;
}
/**
* Returning created by AJAX CSV file
*
* @param kEvent $event
*/
function OnGetCSV(&$event)
{
$export_helper =& $this->Application->recallObject('CSVHelper');
/* @var $export_helper kCSVHelper */
$prefix_special = $export_helper->ExportData('prefix');
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.view')) {
$this->Application->Redirect('no_permission');
}
$export_helper->GetCSV();
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnCSVImportBegin(&$event)
{
$prefix_special = $this->Application->GetVar('PrefixSpecial');
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.add') && !$this->Application->CheckPermission($perm_sections['main'].'.edit')) {
$this->Application->Redirect('no_permission');
}
$object =& $event->getObject( Array('skip_autoload' => true) );
/* @var $object kDBItem */
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
$field_values = array_shift($items_info);
$object->SetFieldsFromHash($field_values);
$event->redirect = false;
$result = 'required';
if($object->GetDBField('ImportFile')) {
$import_helper =& $this->Application->recallObject('CSVHelper');
/* @var $import_helper kCSVHelper */
$import_helper->PrefixSpecial = $this->Application->GetVar('PrefixSpecial');
$import_helper->grid = $this->Application->GetVar('grid');
$result = $import_helper->ImportStart( $object->GetField('ImportFile', 'file_paths') );
if($result === true) {
$event->redirect = $this->Application->GetVar('next_template');
$event->SetRedirectParam('PrefixSpecial', $this->Application->GetVar('PrefixSpecial'));
$event->SetRedirectParam('grid', $this->Application->GetVar('grid'));
}
}
if($event->redirect === false) {
$object->SetError('ImportFile', $result);
$event->status = erFAIL;
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnCSVImportStep(&$event)
{
$import_helper =& $this->Application->recallObject('CSVHelper');
/* @var $export_helper kCSVHelper */
$prefix_special = $import_helper->ImportData('prefix');
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
if(!$this->Application->CheckPermission($perm_sections['main'].'.add') && !$this->Application->CheckPermission($perm_sections['main'].'.edit')) {
$this->Application->Redirect('no_permission');
}
$import_helper->ImportStep();
$event->status = erSTOP;
}
/**
* Shows unit config filename, where requested prefix is defined
*
* @param kEvent $event
*/
function OnCheckPrefixConfig(&$event)
{
$prefix = $this->Application->GetVar('config_prefix');
$config_file = $this->Application->UnitConfigReader->prefixFiles[$prefix];
ob_start();
?>
<html>
<head>
<title>Unit Config of "<?php echo $prefix; ?>" prefix</title>
</head>
<body bgcolor="#E7E7E7">
<a href="javascript:window.close();">Close Window</a><br /><br />
<strong>Prefix:</strong> <?php echo $prefix; ?><br />
<strong>Unit Config:</strong> <?php echo $GLOBALS['debugger']->highlightString($config_file); ?><br />
<br /><a href="javascript:window.close();">Close Window</a><br />
</body>
</html>
<?php
echo ob_get_clean();
$event->status = erSTOP;
}
function OnUploadFile(&$event)
{
// Flash uploader does NOT send correct cookies, so we need to make our own check
$cookie_name = 'adm_'.$this->Application->ConfigValue('SessionCookieName');
$this->Application->HttpQuery->Cookie['cookies_on'] = 1;
$this->Application->HttpQuery->Cookie[$cookie_name] = $this->Application->GetVar('flashsid');
$admin_ses =& $this->Application->recallObject('Session.admin');
/* @var $admin_ses Session */
$user = $admin_ses->RecallVar('user_id');
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
/*if() {
$prefix_special = $this->Application->GetVar('PrefixSpecial');
$prefix_elems = split('\.|_', $prefix_special, 2);
$perm_sections = $this->Application->getUnitOption($prefix_elems[0], 'PermSection');
$section = $perm_sections['main'];
}
else {*/
$section = $event->getSection();
/*}*/
if ($this->Application->GetVar('t') != 'import/import_start' && !$perm_helper->CheckUserPermission($user, $section.'.add') && !$perm_helper->CheckUserPermission($user, $section.'.edit')) {
$event->status = erPERM_FAIL;
header('HTTP/1.0 403 You don\'t have permissions to upload');
exit;
return;
}
if (!$cookie_name) $cookie_name = 'sid';
$value = $this->Application->GetVar('Filedata');
if (!$value) return ;
$tmp_path = WRITEABLE.'/tmp/';
$fname = $value['name'];
$id = $this->Application->GetVar('id');
if ($id) $fname = $id.'_'.$fname;
if (!is_writable($tmp_path)) {
header('HTTP/1.0 500 Write permissions not set on the server');
exit;
}
move_uploaded_file($value['tmp_name'], $tmp_path.$fname);
exit;
}
function OnDropTempTablesByWID(&$event)
{
$sid = $this->Application->GetSID();
$wid = $this->Application->GetVar('m_wid');
$tables = $this->Conn->GetCol('SHOW TABLES');
$mask_edit_table = '/'.TABLE_PREFIX.'ses_'.$sid.'_'.$wid.'_edit_(.*)$/';
foreach($tables as $table)
{
if( preg_match($mask_edit_table,$table,$rets) )
{
$this->Conn->Query('DROP TABLE IF EXISTS '.$table);
}
}
echo 'OK';
$event->status = erSTOP;
return ;
}
}
\ No newline at end of file
Property changes on: branches/RC/core/units/admin/admin_events_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.8.2.11
\ No newline at end of property
+1.8.2.12
\ No newline at end of property
Index: branches/RC/core/units/general/cat_tag_processor.php
===================================================================
--- branches/RC/core/units/general/cat_tag_processor.php (revision 10454)
+++ branches/RC/core/units/general/cat_tag_processor.php (revision 10455)
@@ -1,683 +1,689 @@
<?php
class kCatDBTagProcessor extends kDBTagProcessor {
/**
* Permission Helper
*
* @var kPermissionsHelper
*/
var $PermHelper = null;
function kCatDBTagProcessor()
{
parent::kDBTagProcessor();
$this->PermHelper = $this->Application->recallObject('PermissionsHelper');
}
function ItemIcon($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$icons =& $grids[ $params['grid'] ]['Icons'];
$status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
if (!$status_fields) return $icons['default'];
$value = $object->GetDBField($status_fields[0]); // sets base status icon
/* @var $object kDBItem */
if ($value == STATUS_ACTIVE) {
if( $object->HasField('IsPop') && $object->GetDBField('IsPop') ) $value = 'POP';
if( $object->HasField('IsHot') && $object->GetDBField('IsHot') ) $value = 'HOT';
if( $object->HasField('IsNew') && $object->GetDBField('IsNew') ) $value = 'NEW';
if( $object->HasField('EditorsPick') && $object->GetDBField('EditorsPick') ) $value = 'PICK';
}
return isset($icons[$value]) ? $icons[$value] : $icons['default'];
}
/**
* Allows to create valid mod-rewrite compatible link to module item
*
* @param Array $params
* @param string $id_prefix
* @return string
*/
function ItemLink($params, $id_prefix = null)
{
if (!isset($params['pass'])) {
$params['pass'] = 'm,'.$this->Prefix;
}
$item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id'];
if (!$item_id) {
$item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
if (!$item_id) {
$item_id = $this->Application->GetVar($this->Prefix.'_id');
}
}
$params[$this->Prefix.'_id'] = $item_id;
$object =& $this->getObject($params);
$params['m_cat_id'] = $object->GetDBField('CategoryId');
$params['m_cat_page'] = 1;
$params['pass_category'] = 1;
return $this->Application->ProcessParsedTag('m', 't', $params);
}
function CategoryPath($params)
{
if ($this->Application->IsAdmin()) {
// path for module root category in admin
if (!isset($params['cat_id'])) {
$params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
}
}
else {
// path for category item category in front-end
$object =& $this->getObject($params);
$params['cat_id'] = $object->GetDBField('CategoryId');
}
return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
}
function BuildListSpecial($params)
{
if ($this->Special != '') return $this->Special;
if ( isset($params['parent_cat_id']) ) {
$parent_cat_id = $params['parent_cat_id'];
}
else {
$parent_cat_id = $this->Application->GetVar('c_id');
if (!$parent_cat_id) {
$parent_cat_id = $this->Application->GetVar('m_cat_id');
}
}
$recursive = isset($params['recursive']);
$list_unique_key = $this->getUniqueListKey($params).$recursive;
if ($list_unique_key == '') {
return parent::BuildListSpecial($params);
}
return crc32($parent_cat_id.$list_unique_key);
}
function CatalogItemCount($params)
{
$object =& $this->GetList($params);
if (!$object->Counted) {
$object->CountRecs();
}
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
}
function ListReviews($params)
{
$prefix = $this->Prefix.'-rev';
$review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor');
return $review_tag_processor->PrintList($params);
}
function ReviewCount($params)
{
$review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
return $review_tag_processor->TotalRecords($params);
}
function InitCatalogTab($params)
{
$tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
$tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
$tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
// set default params (same as in catalog)
if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
if ($tab_params['special'] === false) $tab_params['special'] = '';
if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
// pass params to block with tab content
$params['name'] = $params['render_as'];
$params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
+
+ $prefix_append = $this->Application->GetVar('prefix_append');
+ if ($prefix_append) {
+ $params['prefix'] .= $prefix_append;
+ }
+
$params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
$params['tab_mode'] = $tab_params['mode'];
$params['tab_dependant'] = $tab_params['dependant'];
$params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
return $this->Application->ParseBlock($params, 1);
}
/**
* Show CachedNavbar of current item primary category
*
* @param Array $params
* @return string
*/
function CategoryName($params)
{
// show category cachednavbar of
$object =& $this->getObject($params);
$category_id = isset($params['cat_id']) ? $params['cat_id'] : $object->GetDBField('CategoryId');
$category_path = $this->Application->getCache('category_paths', $category_id);
if ($category_path === false) {
// not chached
if ($category_id > 0) {
$category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $object->GetDBField('CachedNavbar')), ' > ');
}
else {
$category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
}
$this->Application->setCache('category_paths', $category_id, $category_path);
}
return $category_path;
}
/**
* Allows to determine if original value should be shown
*
* @param Array $params
* @return bool
*/
function DisplayOriginal($params)
{
// original id found & greather then zero + show original
$display_original = isset($params['display_original']) && $params['display_original'];
$owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField');
if (!$owner_field) {
$owner_field = 'CreatedById';
}
$object =& $this->getObject($params);
$perm_value = $this->PermHelper->ModifyCheckPermission($object->GetDBField($owner_field), $object->GetDBField('CategoryId'), $this->Prefix);
return $display_original && ($perm_value == 1) && $this->Application->GetVar($this->Prefix.'.original_id');
}
/**
* Checks if user have one of required permissions
*
* @param Array $params
* @return bool
*/
function HasPermission($params)
{
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$params['raise_warnings'] = 0;
$object =& $this->getObject($params);
/* @var $object kCatDBItem */
// 1. category restriction
$params['cat_id'] = $object->isLoaded() ? $object->GetDBField('ParentPath') : $this->Application->GetVar('m_cat_id');
// 2. owner restriction
$owner_field = $this->Application->getUnitOption($this->Prefix, 'OwnerField');
if (!$owner_field) {
$owner_field = 'CreatedById';
}
$is_owner = $object->GetDBField($owner_field) == $this->Application->RecallVar('user_id');
return $perm_helper->TagPermissionCheck($params, $is_owner);
}
/**
* Creates link to current category or to module root category, when current category is home
*
* @param Array $params
* @return string
*/
function SuggestItemLink($params)
{
if (!isset($params['cat_id'])) {
$params['cat_id'] = $this->Application->GetVar('m_cat_id');
}
if ($params['cat_id'] == 0) {
$params['cat_id'] = $this->Application->findModule('Var', $this->Prefix, 'RootCat');
}
$params['m_cat_page'] = 1;
return $this->Application->ProcessParsedTag('c', 'CategoryLink', $params);
}
/**
* Allows to detect if item has any additional images available
*
* @param Array $params
* @return string
*/
function HasAdditionalImages($params)
{
$object =& $this->getObject($params);
$sql = 'SELECT ImageId
FROM '.$this->Application->getUnitOption('img', 'TableName').'
WHERE ResourceId = '.$object->GetDBField('ResourceId').' AND DefaultImg != 1 AND Enabled = 1';
return $this->Conn->GetOne($sql) ? 1 : 0;
}
/**
* Checks that item is pending
*
* @param Array $params
* @return bool
*/
function IsPending($params)
{
$object =& $this->getObject($params);
$pending_status = Array (STATUS_PENDING, STATUS_PENDING_EDITING);
return in_array($object->GetDBField('Status'), $pending_status);
}
function IsFavorite($params)
{
static $favorite_status = Array ();
$object =& $this->getObject($params);
/* @var $object kDBList */
if (!isset($favorite_status[$this->Special])) {
$resource_ids = $object->GetCol('ResourceId');
$user_id = $this->Application->RecallVar('user_id');
$sql = 'SELECT FavoriteId, ResourceId
FROM '.$this->Application->getUnitOption('fav', 'TableName').'
WHERE (PortalUserId = '.$user_id.') AND (ResourceId IN ('.implode(',', $resource_ids).'))';
$favorite_status[$this->Special] = $this->Conn->GetCol($sql, 'ResourceId');
}
return isset($favorite_status[$this->Special][$object->GetDBField('ResourceId')]);
}
/**
* Returns item's editors pick status (using not formatted value)
*
* @param Array $params
* @return bool
*/
function IsEditorsPick($params)
{
$object =& $this->getObject($params);
return $object->GetDBField('EditorsPick') == 1;
}
function FavoriteToggleLink($params)
{
$fav_prefix = $this->Prefix.'-fav';
$params['pass'] = implode(',', Array('m', $this->Prefix, $fav_prefix));
$params[$fav_prefix.'_event'] = 'OnFavoriteToggle';
return $this->ItemLink($params);
}
/**
* Checks if item is passed in url
*
* @param Array $params
* @return bool
*/
function ItemAvailable($params)
{
return $this->Application->GetVar($this->getPrefixSpecial().'_id') > 0;
}
function SortingSelected($params)
{
$list =& $this->GetList($params);
$user_sorting_start = $this->getUserSortIndex();
$sorting = strtolower($list->GetOrderField($user_sorting_start).'|'.$list->GetOrderDirection($user_sorting_start));
if ($sorting == strtolower($params['sorting'])) return $params['selected'];
}
function CombinedSortingDropDownName($params)
{
return $this->Prefix.'_CombinedSorting';
}
/**
* Prepares name for field with event in it (used only on front-end)
*
* @param Array $params
* @return string
*/
function SubmitName($params)
{
return 'events['.$this->Prefix.']['.$params['event'].']';
}
/**
* Returns prefix + any word (used for shared between categories per page settings)
*
* @param Array $params
* @return string
*/
function VarName($params)
{
return $this->Prefix.'_'.$params['type'];
}
/**
* Checks if we are viewing module root category
*
* @param Array $params
* @return bool
*/
function IsModuleHome($params)
{
$root_category = $this->Application->findModule('Var', $this->Prefix, 'RootCat');
return $root_category == $this->Application->GetVar('m_cat_id');
}
/**
* Dynamic votes indicator
*
* @param Array $params
*
* @return string
*/
function VotesIndicator($params)
{
$blocks_params = $this->prepareTagParams($params);
$blocks_params['name'] = $params['render_as'];
$object =& $this->getObject($params);
/* @var $object kDBItem */
if ($this->Application->ConfigValue('UseFloatRating')) {
$rating = $object->GetDBField('CachedRating');
$float_rating = floor(($rating - floor($rating)) / 0.25) * 0.25;
}
else {
$rating = round( $object->GetDBField('CachedRating') );
$float_rating = 0;
}
$i = 1;
$ret = '';
while ($i <= 5) {
$blocks_params['number'] = $i;
$blocks_params['active'] = $rating >= $i ? 1 : 0;
if ($rating > $i - 1 && $rating < $i && $float_rating > 0) {
$blocks_params['active'] = 1;
$blocks_params['float_rating'] = $float_rating;
}
else {
$blocks_params['float_rating'] = '';
}
$ret .= trim($this->Application->ParseBlock($blocks_params));
$i++;
}
return $ret;
}
function RelevanceIndicator($params)
{
$object =& $this->getObject($params);
$search_results_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
$sql = 'SELECT Relevance
FROM '.$search_results_table.'
WHERE ResourceId = '.$object->GetDBField('ResourceId');
$percents_off = (int)(100 - (100 * $this->Conn->GetOne($sql)));
$percents_off = ($percents_off < 0) ? 0 : $percents_off;
if ($percents_off) {
$params['percent_off'] = $percents_off;
$params['percent_on'] = 100 - $percents_off;
$params['name'] = $this->SelectParam($params, 'relevance_normal_render_as,block_relevance_normal');
}
else {
$params['name'] = $this->SelectParam($params, 'relevance_full_render_as,block_relevance_full');
}
return $this->Application->ParseBlock($params);
}
function SearchResultField($params)
{
$ret = $this->Field($params);
$keywords = unserialize( $this->Application->RecallVar('highlight_keywords') );
$opening = $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'highlight_opening_render_as,block_highlight_opening')) );
$closing = $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'highlight_closing_render_as,block_highlight_closing')) );
foreach ($keywords as $index => $keyword) {
$keywords[$index] = preg_quote($keyword, '/');
}
return preg_replace('/('.implode('|', $keywords).')/i', $opening.'\\1'.$closing, $ret);
}
function AdvancedSearchForm($params)
{
$search_table = $this->Application->getUnitOption('confs', 'TableName');
$module_name = $this->Application->findModule('Var', $this->Prefix, 'Name');
$sql = 'SELECT *
FROM '.$search_table.'
WHERE (ModuleName = '.$this->Conn->qstr($module_name).') AND (AdvancedSearch = 1)
ORDER BY DisplayOrder';
$search_config = $this->Conn->Query($sql);
$ret = '';
foreach ($search_config as $record) {
$params['name'] = $this->SelectParam($params, 'and_or_render_as,and_or_block');
$params['field'] = $record['FieldName'];
$params['andor'] = $this->Application->ParseBlock($params);
$params['name'] = $this->SelectParam($params, $record['FieldType'].'_render_as,'.$record['FieldType'].'_block');
$params['caption'] = $this->Application->Phrase($record['DisplayName']);
$ret .= $this->Application->ParseBlock($params);
}
return $ret;
}
/**
* Returns last modification date of items in category / system
*
* @param Array $params
* @return string
*/
function LastUpdated($params)
{
$category_id = $this->Application->GetVar('m_cat_id');
$table_name = $this->Application->getUnitOption($this->Prefix, 'TableName');
if (isset($params['local']) && $params['local'] && $category_id > 0) {
// scan only current category & it's children
$sql = 'SELECT TreeLeft, TreeRight
FROM '.TABLE_PREFIX.'Category
WHERE CategoryId = '.$category_id;
$tree_info = $this->Conn->GetRow($sql);
$sql = 'SELECT MAX(item_table.Modified) AS ModDate, MAX(item_table.CreatedOn) AS NewDate
FROM '.$table_name.' item_table
LEFT JOIN '.TABLE_PREFIX.'CategoryItems ci ON (item_table.ResourceId = ci.ItemResourceId)
LEFT JOIN '.TABLE_PREFIX.'Category c ON c.CategoryId = ci.CategoryId
WHERE c.TreeLeft BETWEEN '.$tree_info['TreeLeft'].' AND '.$tree_info['TreeRight'];
}
else {
// scan all categories in system
$sql = 'SELECT MAX(Modified) AS ModDate, MAX(CreatedOn) AS NewDate
FROM '.$table_name;
}
$row_data = $this->Conn->GetRow($sql);
if (!$row_data) {
return '';
}
$date = $row_data[ $row_data['NewDate'] > $row_data['ModDate'] ? 'NewDate' : 'ModDate' ];
// format date
$format = isset($params['format']) ? $params['format'] : '_regional_DateTimeFormat';
if (preg_match("/_regional_(.*)/", $format, $regs)) {
$lang =& $this->Application->recallObject('lang.current');
if ($regs[1] == 'DateTimeFormat') {
// combined format
$format = $lang->GetDBField('DateFormat').' '.$lang->GetDBField('TimeFormat');
}
else {
// simple format
$format = $lang->GetDBField($regs[1]);
}
}
return adodb_date($format, $date);
}
/**
* Counts category item count in system (not category-dependent)
*
* @param Array $params
* @return int
*/
function ItemCount($params)
{
$count_helper =& $this->Application->recallObject('CountHelper');
/* @var $count_helper kCountHelper */
$today_only = isset($params['today']) && $params['today'];
return $count_helper->ItemCount($this->Prefix, $today_only);
}
function CategorySelector($params)
{
$category_id = isset($params['category_id']) && is_numeric($params['category_id']) ? $params['category_id'] : false;
if ($category_id === false) {
// if category id not given use module root category
$category_id = $this->Application->findModule('Var', $this->Prefix, 'RootCat');
}
$id_field = $this->Application->getUnitOption('c', 'IDField');
$title_field = $this->Application->getUnitOption('c', 'TitleField');
$table_name = $this->Application->getUnitOption('c', 'TableName');
$count_helper =& $this->Application->recallObject('CountHelper');
/* @var $count_helper kCountHelper */
list ($view_perm, $view_filter) = $count_helper->GetPermissionClause('c', 'perm_cache');
// get category list (permission based)
$sql = 'SELECT c.'.$title_field.', c.'.$id_field.'
FROM '.$table_name.' c
INNER JOIN '.TABLE_PREFIX.'PermCache perm_cache ON c.CategoryId = perm_cache.CategoryId
WHERE (ParentId = '.$category_id.') AND ('.$view_filter.') AND (perm_cache.PermId = '.$view_perm.') AND (c.Status = '.STATUS_ACTIVE.')
ORDER BY c.'.$title_field.' ASC';
$categories = $this->Conn->GetCol($sql, $id_field);
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $params['render_as'];
$block_params['strip_nl'] = 2;
$ret = '';
foreach ($categories as $category_id => $category_name) {
// print category
$block_params['separator'] = isset($params['category_id']) ? $params['separator'] : ''; // return original separator, remove separator for top level categories
$block_params['category_id'] = $category_id;
$block_params['category_name'] = $category_name;
$ret .= $this->Application->ParseBlock($block_params);
// print it's children
$block_params['separator'] = '&nbsp;&nbsp;&nbsp;'.$params['separator'];
$ret .= $this->CategorySelector($block_params);
}
return $ret;
}
function PrintMoreCategories($params)
{
$object =& $this->getObject();
/* @var $object kDBItem */
$category_ids = $this->Field($params);
if (!$category_ids) {
return '';
}
$category_ids = explode('|', substr($category_ids, 1, -1));
$id_field = $this->Application->getUnitOption('c', 'IDField');
$title_field = $this->Application->getUnitOption('c', 'TitleField');
$table_name = $this->Application->getUnitOption('c', 'TableName');
$sql = 'SELECT '.$title_field.', '.$id_field.'
FROM '.$table_name.'
WHERE '.$id_field.' IN ('.implode(',', $category_ids).')';
$categories = $this->Conn->GetCol($sql, $id_field);
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $params['render_as'];
$ret = '';
foreach ($categories as $category_id => $category_name) {
$block_params['category_id'] = $category_id;
$block_params['category_name'] = $category_name;
$ret .= $this->Application->ParseBlock($block_params);
}
return $ret;
}
function DownloadFileLink($params)
{
$params[$this->getPrefixSpecial().'_event'] = 'OnDownloadFile';
return $this->ItemLink($params);
}
function ImageSrc($params)
{
list ($ret, $tag_processed) = $this->processAggregatedTag('ImageSrc', $params, $this->getPrefixSpecial());
return $tag_processed ? $ret : false;
}
/**
* Registers hit for item (one time per session)
*
* @param Array $params
*/
function RegisterHit($params)
{
$object =& $this->getObject();
/* @var $object kCatDBItem */
if ($object->isLoaded()) {
$object->RegisterHit();
}
}
/**
* Returns link to item's author public profile
*
* @param Array $params
* @return string
*/
function ProfileLink($params)
{
$object =& $this->getObject($params);
$owner_field = array_key_exists('owner_field', $params) ? $params['owner_field'] : 'CreatedById';
$params['user_id'] = $object->GetDBField($owner_field);
unset($params['owner_field']);
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
}
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/general/cat_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.38.2.13
\ No newline at end of property
+1.38.2.14
\ No newline at end of property
Index: branches/RC/core/admin_templates/reviews/reviews.tpl
===================================================================
--- branches/RC/core/admin_templates/reviews/reviews.tpl (nonexistent)
+++ branches/RC/core/admin_templates/reviews/reviews.tpl (revision 10455)
@@ -0,0 +1,146 @@
+<inp2:m_include t="incs/header" nobody="yes" noform="yes"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+
+<inp2:m_RenderElement name="combined_header" section="in-portal:reviews" prefix="c" module="in-portal" title_preset="reviews"/>
+
+<!-- main kernel_form: begin -->
+<inp2:m_RenderElement name="kernel_form"/>
+<!-- ToolBar --->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <input type="hidden" name="m_cat_id" value="<inp2:m_get name="m_cat_id"/>"/>
+ <link rel="stylesheet" rev="stylesheet" href="incs/nlsmenu.css" type="text/css" />
+ <script type="text/javascript" src="js/nlsmenu.js"></script>
+ <script type="text/javascript" src="js/nlsmenueffect_1_2_1.js"></script>
+ <script type="text/javascript" src="js/ajax.js"></script>
+ <script type="text/javascript" src="<inp2:m_TemplatesBase module='in-portal'/>/incs/catalog.js"></script>
+ <script type="text/javascript">
+ var menuMgr = new NlsMenuManager("mgr");
+ menuMgr.timeout = 500;
+ menuMgr.flowOverFormElement = true;
+
+ Request.progressText = '<inp2:m_phrase name="la_title_Loading" escape="1"/>';
+
+ Catalog.prototype.AfterInit = function() {
+ this.switchTab();
+ }
+
+ Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
+ var $cat_id = get_hidden_field('m_cat_id');
+ var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id');
+ if ($cat_id != $tab_cat_id || $force) {
+ // query tab content only in case if not queried or category don't match
+ var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#TAB_NAME#', this.queryTabRegistry('prefix', $prefix, 'tab_id'));
+ this.BusyRequest[$prefix] = false;
+
+ Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id, this);
+ }
+ }
+
+ var $Catalog = new Catalog('<inp2:m_Link template="in-portal/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"/>', 'reviews_', 0);
+ var a_toolbar = new ToolBar();
+
+ 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() {
+ var $template = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'view_template');
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ std_delete_items($Catalog.ActivePrefix, $template, 1);
+ } ) );
+
+
+ <inp2:m_ModuleInclude template="catalog_buttons" main_template="reviews" skip_prefixes="m,cms"/>
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
+ a_toolbar.AddButton( new ToolBarButton('approve', '<inp2:m_phrase label="la_ToolTip_Approve" escape="1"/>', function() {
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ $Catalog.submit_event($Catalog.ActivePrefix, 'OnMassApprove');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('decline', '<inp2:m_phrase label="la_ToolTip_Decline" escape="1"/>', function() {
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ $Catalog.submit_event($Catalog.ActivePrefix, 'OnMassDecline');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep3') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar, 'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+
+ function edit()
+ {
+ $form_name = $Catalog.queryTabRegistry('prefix', $Catalog.ActivePrefix, 'tab_id') + '_form';
+ 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"/>' . replace('#PREFIX#', $Catalog.ActivePrefix);
+
+ std_edit_temp_item($Catalog.ActivePrefix, 'in-portal/reviews/review_direct_edit');
+
+ $kf.action = $prev_action;
+ }
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+<inp2:m_RenderElement name="kernel_form_end"/>
+<!-- main kernel_form: end -->
+
+<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"/>-rev_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$Catalog.switchTab('<inp2:m_param name="prefix"/>-rev');">
+ <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_phrase name="$title"/> <span class="cats_stats">(<span id="<inp2:m_param name="prefix"/>-rev_item_count">?</span>)</span>
+ </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="ViewMenuPhrase" skip_prefixes="m,cms"/>
+ </tr>
+</table>
+<!-- item tabs: end -->
+<inp2:m_set prefix_append="-rev" td="no"/>
+<inp2:m_ModuleInclude template="catalog_tab" tab_init="2" skip_prefixes="m,cms"/>
+
+<inp2:m_if check="m_get" var="SetTab">
+<script type="text/javascript">
+ $Catalog.switchTab('<inp2:m_get var="SetTab"/>-rev');
+</script>
+</inp2:m_if>
+
+<script type="text/javascript">
+ addLoadEvent(
+ function() {
+ $Catalog.Init();
+ }
+ );
+</script>
+
+<inp2:m_include t="incs/footer" noform="yes"/>
\ No newline at end of file
Property changes on: branches/RC/core/admin_templates/reviews/reviews.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Index: branches/RC/core/admin_templates/reviews/reviews_tab.tpl
===================================================================
--- branches/RC/core/admin_templates/reviews/reviews_tab.tpl (nonexistent)
+++ branches/RC/core/admin_templates/reviews/reviews_tab.tpl (revision 10455)
@@ -0,0 +1,46 @@
+<inp2:m_DefineElement name="catalog_tab">
+ <inp2:m_if check="m_ParamEquals" name="tab_init" value="">
+ <inp2:lang.current_Field name="Charset" result_to_var="charset"/>
+ <inp2:m_Header data="Content-type: text/plain; charset=$charset"/>
+ <inp2:m_include t="incs/blocks"/>
+ <inp2:m_include t="incs/grid_blocks"/>
+
+ $Catalog.setItemCount('<inp2:m_param name="prefix"/>', '<inp2:{$prefix}_CatalogItemCount/>');
+ $Catalog.setCurrentCategory('<inp2:m_param name="prefix"/>', 0);
+
+ <inp2:m_RenderElement name="grid_js" selected_class="selected_div" tag_name="tr" PrefixSpecial="$prefix" IdField="ReviewId" grid="ReviewsSection" menu_filters="yes"/>
+ <inp2:m_RenderElement name="grid_search_buttons" PrefixSpecial="$prefix" grid="Default" ajax="1"/>
+ <inp2:m_if check="m_ParamEquals" name="tab_dependant" value="yes">
+ Grids['<inp2:m_param name="prefix"/>'].AddAlternativeGrid('<inp2:m_param name="cat_prefix"/>', true);
+ </inp2:m_if>
+ Grids['<inp2:m_param name="prefix"/>'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6'));
+ $Catalog.reflectPasteButton(<inp2:c_HasClipboard/>);
+ $Catalog.setViewMenu('<inp2:m_param name="prefix"/>');
+ <inp2:m_if check="m_ParamEquals" name="tab_mode" value="single">
+ Grids['<inp2:m_param name="prefix"/>'].EnableRadioMode();
+ Grids['<inp2:m_param name="prefix"/>'].DblClick = function() {return false};
+ </inp2:m_if>
+ #separator#
+ <!-- products tab: begin -->
+ <inp2:m_RenderElement name="kernel_form" form_name="{$tab_name}_form"/>
+
+ <inp2:m_DefineElement name="grid_reviewtext_td">
+ <td valign="top" class="text">
+ <inp2:Field field="$field" cut_first="100"/>
+ <br />
+ <span class="cats_stats">
+ <a href="<inp2:ItemEditLink/>"><inp2:Field field="CatalogItemName"/></a>
+ </span>
+ </td>
+ </inp2:m_DefineElement>
+
+
+ <inp2:m_RenderElement name="grid" ajax="1" PrefixSpecial="$prefix" IdField="ReviewId" grid="ReviewsSection" no_toolbar="no_toolbar" menu_filters="yes"/>
+
+ <inp2:m_RenderElement name="kernel_form_end"/>
+ <!-- products tab: end -->
+ </inp2:m_if>
+</inp2:m_DefineElement>
+
+<inp2:m_Get name="item_prefix" result_to_var="prefix"/>
+<inp2:{$prefix}_InitCatalogTab render_as="catalog_tab"/>
\ No newline at end of file
Property changes on: branches/RC/core/admin_templates/reviews/reviews_tab.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Index: branches/RC/core/admin_templates/reviews/review_direct_edit.tpl
===================================================================
--- branches/RC/core/admin_templates/reviews/review_direct_edit.tpl (nonexistent)
+++ branches/RC/core/admin_templates/reviews/review_direct_edit.tpl (revision 10455)
@@ -0,0 +1,43 @@
+<inp2:m_include t="incs/header" nobody="yes"/>
+<inp2:m_Get name="item_prefix" result_to_var="prefix"/>
+
+<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
+
+<inp2:m_RenderElement name="combined_header" section="in-portal:reviews" prefix="c" module="in-portal" title_preset="review_edit"/>
+
+<!-- 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('<inp2:m_Param name="prefix"/>','<inp2:{$prefix}_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ submit_event('<inp2:m_Param name="prefix"/>','OnCancel');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
+ <inp2:m_RenderElement name="subsection" title="!la_Text_Review!"/>
+ <inp2:m_RenderElement name="inp_edit_hidden" prefix="$prefix" field="ItemId"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox_allow_html" prefix="$prefix" field="TextFormat"/>
+ <inp2:m_RenderElement name="inp_label" prefix="$prefix" field="ReviewId" title="!la_fld_ReviewId!"/>
+ <inp2:m_RenderElement name="inp_edit_user" prefix="$prefix" field="CreatedById" title="!la_fld_CreatedById!" class="text"/>
+ <inp2:m_RenderElement name="inp_edit_textarea" prefix="$prefix" field="ReviewText" title="!la_fld_ReviewText!" cols="70" rows="8"/>
+ <inp2:m_RenderElement name="subsection" title="!la_Text_General!"/>
+ <inp2:m_RenderElement name="inp_edit_radio" prefix="$prefix" field="Status" title="!la_fld_Status!"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="$prefix" field="Priority" title="!la_fld_Priority!" size="3" class="text"/>
+ <inp2:m_RenderElement name="inp_edit_date_time" prefix="$prefix" field="CreatedOn" title="!la_fld_CreatedOn!" size="20" class="text"/>
+</table>
+<inp2:m_include t="incs/footer"/>
Property changes on: branches/RC/core/admin_templates/reviews/review_direct_edit.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1.2.1
\ No newline at end of property
Index: branches/RC/core/admin_templates/incs/form_blocks.tpl
===================================================================
--- branches/RC/core/admin_templates/incs/form_blocks.tpl (revision 10454)
+++ branches/RC/core/admin_templates/incs/form_blocks.tpl (revision 10455)
@@ -1,718 +1,718 @@
<inp2:m_DefineElement name="combined_header" permission_type="view" tab_preset="" module="" icon="">
<inp2:adm_SectionInfo section="$section" info="perm_section" result_to_var="perm_section"/>
<inp2:m_RequireLogin permissions="{$perm_section}.{$permission_type}" system="1"/>
<inp2:m_if check="m_Param" name="prefix" inverse="1"><inp2:adm_SectionInfo section="$section" info="SectionPrefix" result_to_var="prefix"/></inp2:m_if>
<inp2:m_if check="m_get" var="m_wid" inverse="1">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr style="background: url(<inp2:adm_SectionInfo section="$section" info="module_path" module="$module"/>img/logo_bg.gif) no-repeat top right; height: 55px;">
<td valign="top" class="admintitle" align="left" style="padding-top: 10px; padding-bottom: 10px;">
<img width="46" height="46" src="<inp2:adm_SectionInfo section="$section" info="module_path" module="$module"/>img/icons/icon46_<inp2:adm_SectionInfo section="$section" info="icon"/>.gif" align="absmiddle" title="<inp2:adm_SectionInfo section="$section" info="label"/>">&nbsp;<inp2:adm_SectionInfo section="$section" info="label"/>
</td>
</tr>
</table>
</inp2:m_if>
<inp2:m_if check="m_Param" name="tabs">
<inp2:m_include t="$tabs"/>
</inp2:m_if>
<inp2:m_if check="m_Param" name="tab_preset">
<inp2:m_RenderElement name="edit_tabs" prefix="$prefix" preset_name="$tab_preset"/>
</inp2:m_if>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="tablenav">
<table border="0" cellpadding="2" cellspacing="0" class="bordered-no-bottom" width="100%" height="30">
<tr>
<td class="header_left_bg" nowrap valign="middle">
<inp2:adm_SectionInfo section="$section" info="label" result_to_var="default_title"/>
<span class="tablenav_link" id="blue_bar"><inp2:{$prefix}_SectionTitle title_preset="$title_preset" title="$default_title" cut_first="100" pass_params="true"/></span>
</td>
<td align="right" valign="middle">
<script type="text/javascript">
set_window_title( RemoveTranslationLink(document.getElementById('blue_bar').innerHTML, false).replace(/(<[^<]+>)/g, '') + ' - <inp2:m_Phrase label="la_AdministrativeConsole"/>');
</script>
<inp2:m_if check="m_ModuleEnabled" module="In-Portal">
<script>
var $help_url='<inp2:m_t t="help" h_prefix="$prefix" h_icon="$icon" h_module="$module" h_title_preset="$title_preset" pass="all,m,h" m_opener="p" escape="escape"/>';
$help_url = $help_url.replace(/#/g, '%23');
</script>
<a href="javascript: OpenHelp($help_url);">
<img src="img/blue_bar_help.gif" border="0">
</a>
</inp2:m_if>
<inp2:m_if check="m_Param" name="pagination">
<inp2:m_RenderElement name="grid_pagination_elem" PrefixSpecial="$prefix" pass_params="1"/>
</inp2:m_if>
</td>
</tr>
</table>
</td>
</tr>
</table>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="section_header">
<inp2:m_if check="m_ParamEquals" name="prefix" value="" inverse="inverse">
<inp2:m_RenderElement name="section_header_new" pass_params="true"/>
<inp2:m_else />
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr class="section_header_bg">
<td valign="top" class="admintitle" align="left" style="padding-top: 2px; padding-bottom: 2px;">
<img width="46" height="46" src="img/icons/<inp2:adm_GetSectionIcon icon="$icon"/>.gif" align="absmiddle" title="<inp2:adm_GetSectionTitle phrase="$title"/>">&nbsp;<inp2:adm_GetSectionTitle phrase="$title"/>
</td>
</tr>
</table>
</inp2:m_if>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="section_header_new" module="#session#">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr style="background: url(<inp2:ModulePath module="$module"/>img/logo_bg.gif) no-repeat top right; height: 55px;">
<td valign="top" class="admintitle" align="left" style="padding-top: 10px; padding-bottom: 10px;">
<img width="46" height="46" src="<inp2:ModulePath module="$module"/>img/icons/<inp2:adm_GetSectionIcon icon="$icon"/>.gif" align="absmiddle" title="<inp2:adm_GetSectionTitle phrase="$title"/>">&nbsp;<inp2:adm_GetSectionTitle phrase="$title"/>
</td>
</tr>
</table>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="blue_bar" module="" icon="" pagination="0">
<table border="0" cellpadding="2" cellspacing="0" class="bordered-no-bottom" width="100%" height="30">
<tr>
<td class="header_left_bg" nowrap width="80%" valign="middle">
<span class="tablenav_link" id="blue_bar"><inp2:{$prefix}_SectionTitle title_preset="$title_preset" title="Invalid OR Missing title preset [#preset_name#]" cut_first="100" pass_params="true"/></span>
</td>
<td align="right" class="tablenav" width="20%" valign="middle">
<inp2:m_if check="m_ModuleEnabled" module="In-Portal">
<script>
var $help_url='<inp2:m_t t="help" h_prefix="$prefix" h_icon="$icon" h_module="$module" h_title_preset="$title_preset" pass="all,m,h" m_opener="p" escape="escape"/>';
$help_url = $help_url.replace(/#/g, '%23');
set_window_title( RemoveTranslationLink(document.getElementById('blue_bar').innerHTML, false).replace(/(<[^<]+>)/g, '') );
</script>
<a href="javascript: OpenHelp($help_url);">
<img src="img/blue_bar_help.gif" border="0">
</a>
</inp2:m_if>
<inp2:m_if check="m_Param" name="pagination">
<inp2:m_RenderElement name="grid_pagination_elem" grid="st" PrefixSpecial="$prefix" pass_params="1"/>
</inp2:m_if>
</td>
</tr>
</table>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_original_label">
<td><inp2:$prefix.original_Field field="$field" nl2br="1"/></td>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="subsection" prefix="">
<tr class="subsectiontitle">
<td colspan="3"><inp2:m_phrase label="$title"/></td>
<inp2:m_if check="m_ParamEquals" name="prefix" value="" inverse="inverse">
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<td><inp2:m_phrase name="$original_title"/></td>
</inp2:m_if>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_field_caption" title="" subfield="" NamePrefix="">
<inp2:m_inc param="tab_index" by="1"/>
<td class="text" nowrap>
<inp2:m_if check="m_Param" name="title">
<label for="<inp2:m_param name="NamePrefix"/><inp2:InputName field="$field" subfield="$subfield"/>">
<span class="<inp2:m_if check="HasError" field="$field" >error</inp2:m_if>">
<inp2:m_phrase label="$title"/></span><inp2:m_if check="{$prefix}_IsRequired" field="$field" ><span class="error">&nbsp;*</span></inp2:m_if>:
</label>
<inp2:m_else/>
&nbsp;
</inp2:m_if>
</td>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_label" is_last="" as_label="" currency="" is_last="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td valign="top" class="text">
<inp2:{$prefix}_Field field="$field" as_label="$as_label" currency="$currency"/>
<inp2:m_if check="{$prefix}_HasParam" name="hint_label"><span class="small"><inp2:m_phrase label="$hint_label"/></span></inp2:m_if>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_id_label" db="">
<inp2:m_if check="{$prefix}_FieldEquals" field="$field" value="" inverse="inverse">
<inp2:m_RenderElement name="inp_label" pass_params="true"/>
</inp2:m_if>
<input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" db="$db"/>">
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_box" subfield="" class="" is_last="" maxlength="" onblur="" size="" onkeyup="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" subfield="$subfield" title="$title" is_last="$is_last"/>
<td>
<input type="text" name="<inp2:{$prefix}_InputName field="$field" subfield="$subfield"/>" id="<inp2:{$prefix}_InputName field="$field" subfield="$subfield"/>" value="<inp2:{$prefix}_Field field="$field" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>" onkeyup="<inp2:m_Param name="onkeyup"/>">
<inp2:m_if check="{$prefix}_HasParam" name="hint_label"><span class="small"><inp2:m_phrase label="$hint_label"/></span></inp2:m_if>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_password" class="" size="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title"/>
<td>
<input type="password" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" value="" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" />
<inp2:m_if check="{$prefix}_HasParam" name="hint_label"><span class="small"><inp2:m_phrase label="$hint_label"/></span></inp2:m_if>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_upload" class="" size="" thumbnail="" is_last="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<inp2:m_if check="m_Param" name="thumbnail">
<inp2:m_if check="{$prefix}_FieldEquals" name="$field" value="" inverse="inverse">
<img src="<inp2:{$prefix}_Field field="$field" format="resize:{$thumbnail}"/>" alt=""/><br />
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="hidden" id="<inp2:{$prefix}_InputName field="Delete{$field}"/>" name="<inp2:{$prefix}_InputName field="Delete{$field}"/>" value="0" />
<input type="checkbox" id="_cb_<inp2:{$prefix}_InputName field="Delete{$field}"/>" onchange="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field="Delete{$field}"/>'));">
</td>
<td>
<label for="_cb_<inp2:{$prefix}_InputName field="Delete{$field}"/>"><inp2:m_phrase name="la_btn_DeleteImage"/></label>
</td>
</tr>
</table>
</inp2:m_if>
<input type="file" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>">
<inp2:m_else/>
<input type="file" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>">
<inp2:m_if check="{$prefix}_FieldEquals" name="$field" value="" inverse="inverse">
(<inp2:{$prefix}_Field field="$field"/>)
</inp2:m_if>
</inp2:m_if>
<input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[upload]" id="<inp2:{$prefix}_InputName field="$field"/>[upload]" value="<inp2:{$prefix}_Field field="$field"/>">
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_swf_upload" class="" is_last="" style="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td class="uploader-text">
<div class="uploader-main" id="<inp2:{$prefix}_InputName field="$field"/>_progress">
<div class="uploader-percent" id="<inp2:{$prefix}_InputName field="$field"/>_percent">0%</div>
<div class="uploader-left">
<div class="uploader-done" id="<inp2:{$prefix}_InputName field="$field"/>_done"></div>
</div>
<table style="border-collapse: collapse; width: 100%;">
<tr>
<td style="width: 120px">Uploading:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_filename"></td>
</tr>
<tr>
<td>Progress:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_progress"></td>
</tr>
<tr>
<td>Time elapsed:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_elapsed"></td>
</tr>
<tr>
<td>Time remaining:</td><td id="<inp2:{$prefix}_InputName field="$field"/>_progress_remaining"></td>
</tr>
<tr>
<td colspan="2" style="text-align: center"><a href="javascript:UploadsManager.CancelUpload('<inp2:{$prefix}_InputName field="$field"/>')">Cancel</a></td>
</tr>
</table>
</div>
<div>
<input class="button" type="button" onclick="UploadsManager.Browse('<inp2:{$prefix}_InputName field="$field"/>')" value="Browse"/>
<input class="button" type="button" onclick="UploadsManager.StartUpload('<inp2:{$prefix}_InputName field="$field"/>')" value="Upload"/>
</div>
<div id="<inp2:{$prefix}_InputName field="$field"/>_queueinfo"></div>
<div id="<inp2:{$prefix}_InputName field="$field"/>_holder"></div>
<input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[upload]" id="<inp2:{$prefix}_InputName field="$field"/>[upload]" value="<inp2:{$prefix}_Field field="$field"/>"><br/>
<input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[tmp_ids]" id="<inp2:{$prefix}_InputName field="$field"/>[tmp_ids]" value="">
<input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[tmp_names]" id="<inp2:{$prefix}_InputName field="$field"/>[tmp_names]" value="">
<input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>[tmp_deleted]" id="<inp2:{$prefix}_InputName field="$field"/>[tmp_deleted]" value="">
<script type="text/javascript">
UploadsManager.AddUploader('<inp2:{$prefix}_InputName field="$field"/>',
{
allowedFiletypesDescription : '<inp2:{$prefix}_FieldOption field="$field" option="files_description" js_escape="1"/>',
allowedFiletypes : '<inp2:{$prefix}_FieldOption field="$field" option="file_types"/>',
allowedFilesize : '<inp2:{$prefix}_FieldOption field="$field" option="max_size"/>',
multiple : '<inp2:{$prefix}_FieldOption field="$field" option="multiple"/>',
prefix : '<inp2:m_Param name="prefix"/>',
field : '<inp2:m_Param name="field"/>',
urls : '<inp2:{$prefix}_Field field="$field" format="file_urls" js_escape="1"/>',
names : '<inp2:{$prefix}_Field field="$field" format="file_names" js_escape="1"/>',
sizes : '<inp2:{$prefix}_Field field="$field" format="file_sizes" js_escape="1"/>',
flashsid : '<inp2:m_SID/>',
uploadURL : '<inp2:m_t pass="m,$prefix" {$prefix}_event="OnUploadFile" field="#FIELD#" id="#ID#" flashsid="#SID#" js_escape="1" no_amp="1" />',
deleteURL : '<inp2:m_t pass="m,$prefix" {$prefix}_event="OnDeleteFile" field="#FIELD#" file="#FILE#" js_escape="1" no_amp="1"/>',
tmp_url : '<inp2:m_t pass="m,$prefix" {$prefix}_event="OnViewFile" tmp="1" field="#FIELD#" file="#FILE#" id="#ID#" js_escape="1" no_amp="1" />',
IconPath: '../../admin/editor/cmseditor/editor/images'
}
)
UploadsManager.formContainerId = 'scroll_container';
</script>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_box_ml" class="" size="" onblur="" maxlength="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<td class="text" valign="top">
<span class="<inp2:m_if check="{$prefix}_HasError" field="$field" >error</inp2:m_if>">
<inp2:m_phrase label="$title"/><inp2:m_if check="{$prefix}_IsRequired" field="$field" ><span class="error"> *</span></inp2:m_if>:</span><br>
<a href="javascript:PreSaveAndOpenTranslator('<inp2:m_param name="prefix"/>', '<inp2:m_param name="field"/>', 'popups/translator');" title="<inp2:m_Phrase label="la_Translate"/>"><img src="img/icons/icon24_translate.gif" style="cursor:hand" border="0"></a>
</td>
<td>
<input type="text" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" format="no_default"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_hidden" db="">
<input type="hidden" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" db="$db"/>">
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_date" class="" is_last="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<input type="text" name="<inp2:{$prefix}_InputName field="{$field}_date"/>" id="<inp2:{$prefix}_InputName field="{$field}_date"/>" value="<inp2:{$prefix}_Field field="{$field}_date" format="_regional_InputDateFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:{$prefix}_Format field="{$field}_date" input_format="1" edit_size="edit_size"/>" class="<inp2:m_param name="class"/>" datepickerIcon="<inp2:m_ProjectBase/>core/admin_templates/img/calendar_icon.gif">&nbsp;<span class="small">(<inp2:{$prefix}_Format field="{$field}_date" input_format="1" human="true"/>)</span>
<script type="text/javascript">
initCalendar("<inp2:{$prefix}_InputName field="{$field}_date"/>", "<inp2:{$prefix}_Format field="{$field}_date" input_format="1"/>");
</script>
<input type="hidden" name="<inp2:{$prefix}_InputName field="{$field}_time"/>" id="<inp2:{$prefix}_InputName field="{$field}_time" input_format="1"/>" value="">
</td>
<td class="error"><inp2:{$prefix}_Error field="{$field}_date"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_time" class="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td class="control-cell">
<input type="text" name="<inp2:{$prefix}_InputName field="{$field}_time"/>" id="<inp2:{$prefix}_InputName field="{$field}_time"/>" value="<inp2:{$prefix}_Field field="{$field}_time" format="_regional_InputTimeFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:{$prefix}_Format field="{$field}_time" input_format="1" edit_size="edit_size"/>" class="<inp2:m_param name="class"/>">&nbsp;
<span class="small">(<inp2:{$prefix}_Format field="{$field}_time" input_format="1" human="true"/>)</span>
<input type="hidden" name="<inp2:{$prefix}_InputName field="{$field}_date"/>" id="<inp2:{$prefix}_InputName field="{$field}_date" input_format="1"/>" value="">
</td>
<td class="error"><inp2:{$prefix}_Error field="{$field}_time"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_date_time" class="" is_last="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<!-- <input type="hidden" id="<inp2:{$prefix}_InputName field="$field"/>" name="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" db="db"/>"> -->
<input type="text" name="<inp2:{$prefix}_InputName field="{$field}_date"/>" id="<inp2:{$prefix}_InputName field="{$field}_date"/>" value="<inp2:{$prefix}_Field field="{$field}_date" format="_regional_InputDateFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:{$prefix}_Format field="{$field}_date" input_format="1" edit_size="edit_size"/>" class="<inp2:m_param name="class"/>" datepickerIcon="<inp2:m_ProjectBase/>core/admin_templates/img/calendar_icon.gif">
<span class="small">(<inp2:{$prefix}_Format field="{$field}_date" input_format="1" human="true"/>)</span>
<script type="text/javascript">
initCalendar("<inp2:{$prefix}_InputName field="{$field}_date"/>", "<inp2:{$prefix}_Format field="{$field}_date" input_format="1"/>");
</script>
&nbsp;<input type="text" name="<inp2:{$prefix}_InputName field="{$field}_time"/>" id="<inp2:{$prefix}_InputName field="{$field}_time"/>" value="<inp2:{$prefix}_Field field="{$field}_time" format="_regional_InputTimeFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:{$prefix}_Format field="{$field}_time" input_format="1" edit_size="edit_size"/>" class="<inp2:m_param name="class"/>"><span class="small"> (<inp2:{$prefix}_Format field="{$field}_time" input_format="1" human="true"/>)</span>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_textarea" class="" allow_html="allow_html">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<td class="text" valign="top">
<span class="<inp2:m_if check="{$prefix}_HasError" field="$field" >error</inp2:m_if>">
<inp2:m_phrase label="$title"/><inp2:m_if check="{$prefix}_IsRequired" field="$field" ><span class="error"> *</span></inp2:m_if>:</span><br>
<inp2:m_if check="m_ParamEquals" name="allow_html" value="allow_html">
<a href="javascript:OpenEditor('&section=in-link:editlink_general','kernel_form','<inp2:{$prefix}_InputName field="$field"/>');"><img src="img/icons/icon24_link_editor.gif" style="cursor:hand" border="0"></a>
</inp2:m_if>
</td>
<td>
<textarea tabindex="<inp2:m_get param="tab_index"/>" id="<inp2:{$prefix}_InputName field="$field"/>" name="<inp2:{$prefix}_InputName field="$field"/>" cols="<inp2:m_param name="cols"/>" rows="<inp2:m_param name="rows"/>" class="<inp2:m_param name="class"/>"><inp2:{$prefix}_Field field="$field"/></textarea>
<inp2:m_if check="{$prefix}_HasParam" name="hint_label">
<br /><span class="small"><inp2:m_phrase label="$hint_label"/></span>
</inp2:m_if>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_textarea_ml" class="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<td class="text" valign="top">
<span class="<inp2:m_if check="{$prefix}_HasError" field="$field" >error</inp2:m_if>">
<inp2:m_phrase label="$title"/><inp2:m_if check="{$prefix}_IsRequired" field="$field" ><span class="error"> *</span></inp2:m_if>:</span><br>
<a href="javascript:OpenEditor('&section=in-link:editlink_general','kernel_form','<inp2:{$prefix}_InputName field="$field"/>');"><img src="img/icons/icon24_link_editor.gif" style="cursor:hand" border="0"></a>
<a href="javascript:PreSaveAndOpenTranslator('<inp2:m_param name="prefix"/>', '<inp2:m_param name="field"/>', 'popups/translator', 1);" title="<inp2:m_Phrase label="la_Translate"/>"><img src="img/icons/icon24_translate.gif" style="cursor:hand" border="0"></a>
</td>
<td>
<textarea tabindex="<inp2:m_get param="tab_index"/>" id="<inp2:{$prefix}_InputName field="$field"/>" name="<inp2:{$prefix}_InputName field="$field"/>" cols="<inp2:m_param name="cols"/>" rows="<inp2:m_param name="rows"/>" class="<inp2:m_param name="class"/>"><inp2:{$prefix}_Field field="$field"/></textarea>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_user" class="" size="" is_last="" old_style="0" onkeyup="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<input type="text" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" class="<inp2:m_param name="class"/>" onkeyup="<inp2:m_Param name="onkeyup"/>">
<inp2:m_if check="m_ParamEquals" name="old_style" value="1">
<a href="#" onclick="return OpenUserSelector('','kernel_form','<inp2:{$prefix}_InputName field="$field"/>');">
<inp2:m_else/>
<a href="javascript:openSelector('<inp2:m_param name="prefix"/>', '<inp2:m_t t="user_selector" pass="all,$prefix" escape="1"/>', '<inp2:m_param name="field"/>');">
</inp2:m_if>
<img src="img/icons/icon24_link_user.gif" style="cursor:hand;" border="0">
</a>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_category" class="" size="" is_last="" old_style="0" onkeyup="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td id="<inp2:{$prefix}_InputName field="$field"/>_path">
<inp2:m_DefineElement name="category_caption">
<inp2:m_if check="m_ParamEquals" name="cat_id" value="0" inverse="inverse">
<inp2:m_param name="separator"/>
</inp2:m_if>
<inp2:m_param name="cat_name"/>
</inp2:m_DefineElement>
<inp2:$prefix_FieldCategoryPath field="$field" separator=" &gt; " render_as="category_caption"/>
<inp2:m_RenderElement name="inp_edit_hidden" pass_params="1"/>
</td>
<td valign="middle">
<img src="img/spacer.gif" width="3" height="1" alt=""/>
<a href="javascript:openSelector('<inp2:m_param name="prefix"/>', '<inp2:adm_SelectorLink prefix="$prefix" selection_mode="single" tab_prefixes="none"/>', '<inp2:m_param name="field"/>');">
<img src="img/icons/icon24_cat.gif" border="0"/>
</a>
<a href="#" onclick="disable_category('<inp2:m_Param name="field"/>'); return false;"><inp2:m_Phrase name="la_Text_Disable"/></a>
<script type="text/javascript">
function disable_category($field) {
var $field = '<inp2:{$prefix}_InputName field="#FIELD_NAME#"/>'.replace('#FIELD_NAME#', $field);
set_hidden_field($field, '');
document.getElementById($field + '_path').style.display = 'none';
}
</script>
</td>
</tr>
</table>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_option_item">
<option value="<inp2:m_param name="key"/>"<inp2:m_param name="selected"/>><inp2:m_param name="option"/></option>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_option_phrase">
<option value="<inp2:m_param name="key"/>"<inp2:m_param name="selected"/>><inp2:m_phrase label="$option"/></option>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_options" is_last="" has_empty="0" empty_value="" onchange="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<select tabindex="<inp2:m_get param="tab_index"/>" name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>" onchange="<inp2:m_Param name="onchange"/>">
<inp2:m_if check="{$prefix}_FieldOption" field="$field" option="use_phrases">
<inp2:{$prefix}_PredefinedOptions field="$field" block="inp_option_phrase" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
<inp2:m_else/>
<inp2:{$prefix}_PredefinedOptions field="$field" block="inp_option_item" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
</inp2:m_if>
</select>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_multioptions" is_last="" has_empty="0" empty_value="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<select multiple tabindex="<inp2:m_get param="tab_index"/>" id="<inp2:{$prefix}_InputName field="$field"/>_select" onchange="update_multiple_options('<inp2:{$prefix}_InputName field="$field"/>');">
<inp2:m_if check="{$prefix}_FieldOption" field="$field" option="use_phrases">
<inp2:{$prefix}_PredefinedOptions field="$field" block="inp_option_phrase" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
<inp2:m_else/>
<inp2:{$prefix}_PredefinedOptions field="$field" block="inp_option_item" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
</inp2:m_if>
</select>
<input type="hidden" id="<inp2:{$prefix}_InputName field="$field"/>" name="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" db="db"/>"/>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_radio_item" onclick="" onchange="">
<input type="radio" <inp2:m_param name="checked"/> name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="<inp2:m_param name="onclick"/>" onchange="<inp2:m_param name="onchange"/>"><label for="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_param name="option"/></label>&nbsp;
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_radio_phrase" onclick="" onchange="">
<input type="radio" <inp2:m_param name="checked"/> name="<inp2:{$prefix}_InputName field="$field"/>" id="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="<inp2:m_param name="onclick"/>" onchange="<inp2:m_param name="onchange"/>"><label for="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_phrase label="$option"/></label>&nbsp;
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_radio" is_last="" pass_tabindex="" onclick="" onchange="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<inp2:m_if check="{$prefix}_FieldOption" field="$field" option="use_phrases">
<inp2:{$prefix}_PredefinedOptions field="$field" tabindex="$pass_tabindex" block="inp_radio_phrase" selected="checked" onclick="$onclick" onchange="$onchange" />
<inp2:m_else />
<inp2:{$prefix}_PredefinedOptions field="$field" tabindex="$pass_tabindex" block="inp_radio_item" selected="checked" onclick="$onclick" onchange="$onchange" />
</inp2:m_if>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_checkbox" is_last="" field_class="" onchange="" onclick="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last" NamePrefix="_cb_"/>
<td>
<input type="hidden" id="<inp2:{$prefix}_InputName field="$field"/>" name="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" db="db"/>">
<!--<input tabindex="<inp2:m_get param="tab_index"/>" type="checkbox" id="_cb_<inp2:{$prefix}_InputName field="$field"/>" name="_cb_<inp2:{$prefix}_InputName field="$field"/>" <inp2:{$prefix}_Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name="field_class"/>" onclick="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field="$field"/>'));" onchange="<inp2:m_param name="onchange"/>">-->
<input tabindex="<inp2:m_get param="tab_index"/>" type="checkbox" id="_cb_<inp2:{$prefix}_InputName field="$field"/>" name="_cb_<inp2:{$prefix}_InputName field="$field"/>" <inp2:{$prefix}_Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name="field_class"/>" onchange="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field="$field"/>'));<inp2:m_param name="onchange"/>" onclick="<inp2:m_param name="onclick"/>">
<inp2:m_if check="{$prefix}_HasParam" name="hint_label"><inp2:m_phrase label="$hint_label"/></inp2:m_if>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_checkbox_item">
<input type="checkbox" <inp2:m_param name="checked"/> id="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="update_checkbox_options(/^<inp2:{$prefix}_InputName field="$field" as_preg="1"/>_([0-9A-Za-z-]+)/, '<inp2:{$prefix}_InputName field="$field"/>');"><label for="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_param name="option"/></label>&nbsp;
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_checkbox_phrase">
<input type="checkbox" <inp2:m_param name="checked"/> id="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>" value="<inp2:m_param name="key"/>" onclick="update_checkbox_options(/^<inp2:{$prefix}_InputName field="$field" as_preg="1"/>_([0-9A-Za-z-]+)/, '<inp2:{$prefix}_InputName field="$field"/>');"><label for="<inp2:{$prefix}_InputName field="$field"/>_<inp2:m_param name="key"/>"><inp2:m_phrase label="$option"/></label>&nbsp;
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_checkboxes" no_empty="" is_last="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title" is_last="$is_last"/>
<td>
<inp2:m_if check="{$prefix}_FieldOption" field="$field" option="use_phrases">
<inp2:{$prefix}_PredefinedOptions field="$field" no_empty="$no_empty" tabindex="$pass_tabindex" block="inp_checkbox_phrase" selected="checked"/>
<inp2:m_else/>
<inp2:{$prefix}_PredefinedOptions field="$field" no_empty="$no_empty" tabindex="$pass_tabindex" block="inp_checkbox_item" selected="checked"/>
</inp2:m_if>
<inp2:m_RenderElement prefix="$prefix" name="inp_edit_hidden" field="$field" db="db"/>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="inp_edit_checkbox_allow_html">
+<inp2:m_DefineElement name="inp_edit_checkbox_allow_html" field_class="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<td colspan="2">
<label for="_cb_<inp2:m_param name="field"/>"><inp2:m_phrase label="la_enable_html"/></label>
<input type="hidden" id="<inp2:{$prefix}_InputName field="$field"/>" name="<inp2:{$prefix}_InputName field="$field"/>" value="<inp2:{$prefix}_Field field="$field" db="db"/>">
<input tabindex="<inp2:m_get param="tab_index"/>" type="checkbox" id="_cb_<inp2:m_param name="field"/>" name="_cb_<inp2:m_param name="field"/>" <inp2:{$prefix}_Field field="$field" checked="checked"/> class="<inp2:m_param name="field_class"/>" onclick="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field="$field"/>'))">
<br>
<span class="hint"><img src="img/smicon7.gif" width="14" height="14" align="absmiddle"><inp2:m_phrase label="la_Warning_Enable_HTML"/></span>
</td>
<td>&nbsp;</td>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_weight" subfield="" class="" is_last="" maxlength="">
<tr class="<inp2:m_odd_even odd="table-color1" even="table-color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" subfield="$subfield" title="$title" is_last="$is_last"/>
<td>
<inp2:m_if check="lang.current_FieldEquals" field="UnitSystem" value="1">
<input type="text" name="<inp2:{$prefix}_InputName field="$field" subfield="$subfield"/>" id="<inp2:{$prefix}_InputName field="$field" subfield="$subfield"/>" value="<inp2:{$prefix}_Field field="$field" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
<inp2:m_phrase label="la_kg" />
</inp2:m_if>
<inp2:m_if check="lang.current_FieldEquals" field="UnitSystem" value="2">
<input type="text" name="<inp2:{$prefix}_InputName field="{$field}_a" subfield="$subfield"/>" id="<inp2:{$prefix}_InputName field="{$field}_a" subfield="$subfield"/>" value="<inp2:{$prefix}_Field field="{$field}_a" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
<inp2:m_phrase label="la_lbs" />
<input type="text" name="<inp2:{$prefix}_InputName field="{$field}_b" subfield="$subfield"/>" id="<inp2:{$prefix}_InputName field="{$field}_b" subfield="$subfield"/>" value="<inp2:{$prefix}_Field field="{$field}_b" subfield="$subfield"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:m_param name="size"/>" maxlength="<inp2:m_param name="maxlength"/>" class="<inp2:m_param name="class"/>" onblur="<inp2:m_Param name="onblur"/>">
<inp2:m_phrase label="la_oz" />
</inp2:m_if>
</td>
<td class="error"><inp2:{$prefix}_Error field="$field"/>&nbsp;</td>
<inp2:m_if check="{$prefix}_DisplayOriginal" pass_params="1">
<inp2:m_RenderElement prefix="$prefix" field="$field" name="inp_original_label"/>
</inp2:m_if>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_edit_filler" control_options="false">
</inp2:m_DefineElement>
<inp2:m_DefineElement name="ajax_progress_bar">
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bordered">
<tr class="table-color1">
<td colspan="2">
<img src="img/spacer.gif" height="10" width="1" alt="" /><br />
<!-- progress bar paddings: begin -->
<table width="90%" cellpadding="2" cellspacing="0" border="0" align="center">
<tr>
<td class="progress-text">0%</td>
<td width="100%">
<!-- progress bar: begin -->
<table cellspacing="0" cellpadding="0" width="100%" border="0" align="center" style="background-color: #FFFFFF; border: 1px solid #E6E6E6;">
<tr>
<td colspan="3"><img src="img/spacer.gif" height="2" width="1" alt="" /></td>
</tr>
<tr>
<td width="2"><img src="img/spacer.gif" height="13" width="3" alt="" /></td>
<td align="center" width="100%">
<table cellspacing="0" cellpadding="0" width="100%" border="0" style="background: url(img/progress_left.gif) repeat-x;">
<tr>
<td id="progress_bar[done]" style="background: url(img/progress_done.gif);" align="left"></td>
<td id="progress_bar[left]" align="right"><img src="img/spacer.gif" height="9" width="1" alt="" /></td>
</tr>
</table>
</td>
<td width="1"><img src="img/spacer.gif" height="13" width="3" alt="" /></td>
</tr>
<tr>
<td colspan="3"><img src="img/spacer.gif" height="2" width="1" alt="" /></td>
</tr>
</table>
<!-- progress bar: end -->
</td>
<td class="progress-text">100%</td>
</tr>
</table>
<!-- progress bar paddings: end -->
<img src="img/spacer.gif" height="10" width="1" alt="" /><br />
</td>
</tr>
<tr class="table-color2">
<td width="50%" align="right"><inp2:m_phrase name="la_fld_PercentsCompleted"/>:</td>
<td id="progress_display[percents_completed]">0%</td>
</tr>
<tr class="table-color1">
<td align="right"><inp2:m_phrase name="la_fld_ElapsedTime"/>:</td>
<td id="progress_display[elapsed_time]">00:00</td>
</tr>
<tr class="table-color2">
<td align="right"><inp2:m_phrase name="la_fld_EstimatedTime"/>:</td>
<td id="progress_display[Estimated_time]">00:00</td>
</tr>
<tr class="table-color1">
<td align="center" colspan="2">
<input type="button" class="button" onclick="<inp2:m_param name="cancel_action"/>" value="<inp2:m_phrase name="la_Cancel"/>" />
</td>
</tr>
</table>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="edit_navigation" toolbar="a_toolbar">
<inp2:m_if check="{$prefix}_IsTopmostPrefix">
<inp2:m_if check="{$prefix}_IsSingle">
<inp2:m_param name="toolbar"/>.HideButton('prev');
<inp2:m_param name="toolbar"/>.HideButton('next');
<inp2:m_else/>
<inp2:m_if check="{$prefix}_IsLast">
<inp2:m_param name="toolbar"/>.DisableButton('next');
</inp2:m_if>
<inp2:m_if check="{$prefix}_IsFirst">
<inp2:m_param name="toolbar"/>.DisableButton('prev');
</inp2:m_if>
</inp2:m_if>
</inp2:m_if>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="edit_tabs" preset_name="Default">
<inp2:m_if check="{$prefix}_HasEditTabs" preset_name="$preset_name">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="right" width="100%">
<table cellpadding="0" cellspacing="0" border="0" height="23">
<tr>
<inp2:m_DefineElement name="edit_tab">
<inp2:m_RenderElement name="tab" title="$title" t="$template" main_prefix="$PrefixSpecial"/>
</inp2:m_DefineElement>
<inp2:{$prefix}_PrintEditTabs render_as="edit_tab" preset_name="$preset_name"/>
</tr>
</table>
</td>
</tr>
</table>
</inp2:m_if>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="ml_selector" prefix="">
</inp2:m_DefineElement>
Property changes on: branches/RC/core/admin_templates/incs/form_blocks.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.20.2.15
\ No newline at end of property
+1.20.2.16
\ No newline at end of property

Event Timeline