Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Tue, Sep 23, 6:42 AM

in-portal

Index: branches/unlabeled/unlabeled-1.4.4/core/units/relationship/relationship_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.4.4/core/units/relationship/relationship_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.4.4/core/units/relationship/relationship_config.php (revision 5539)
@@ -0,0 +1,107 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'rel',
+
+ 'Clones' => Array(
+ 'c-rel' => Array('ParentPrefix' => 'c'),
+ 'l-rel' => Array('ParentPrefix' => 'l'),
+ 'n-rel' => Array('ParentPrefix' => 'n'),
+ 'bb-rel'=> Array('ParentPrefix' => 'bb'),
+ /*'p-rel' => Array('ParentPrefix' => 'p'),*/
+ 'cms-rel'=> Array('ParentPrefix' => 'cms'),
+ ),
+
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'RelationshipEventHandler','file'=>'relationship_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'Hooks' => Array(
+ Array(
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => '#PARENT#',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array('OnAfterItemDelete'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '',
+ 'DoEvent' => 'OnDeleteForeignRelations',
+ ),
+ ),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ ),
+ 'IDField' => 'RelationshipId',
+ 'StatusField' => Array('Enabled','Type'),
+ 'TableName' => TABLE_PREFIX.'Relationship',
+ 'ParentTableKey'=> 'ResourceId',
+ 'ForeignKey' => 'SourceId',
+ 'ParentPrefix' => 'p',
+ 'AutoDelete' => true,
+ 'AutoClone' => true,
+
+ 'FilterMenu' => Array(
+ 'Groups' => Array(
+ Array('mode' => 'AND', 'filters' => Array('show_active','show_disabled'), 'type' => WHERE_FILTER),
+ Array('mode' => 'AND', 'filters' => Array('show_recip','show_oneway'), 'type' => WHERE_FILTER),
+ ),
+ 'Filters' => Array(
+ 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Enabled != 1' ),
+ 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Enabled != 0' ),
+ 's1' => Array(),
+ 'show_recip' => Array('label' => 'la_Reciprocal', 'on_sql' => '', 'off_sql' => '%1$s.Type != 1' ),
+ 'show_oneway' => Array('label' => 'la_OneWay', 'on_sql' => '', 'off_sql' => '%1$s.Type != 2' ),
+ )
+ ),
+
+ 'CalculatedFields' => Array(
+ '' => Array(
+ 'ItemName' => 'TRIM(CONCAT(#ITEM_NAMES#))',
+ 'ItemType' => '#ITEM_TYPES#',
+ ),
+ ),
+
+ 'ListSQLs' => Array( ''=> 'SELECT %1$s.RelationshipId, %1$s.Priority, %1$s.Type, %1$s.Enabled %2$s
+ FROM %1$s #ITEM_JOIN#',
+ ), // key - special, value - list select sql
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'ForcedSorting' => Array('Priority' => 'desc'),
+ 'Sorting' => Array('ItemName' => 'asc', 'ItemType' => 'asc'),
+ )
+ ),
+ 'ItemSQLs' => Array( '' => 'SELECT %1$s.* %2$s FROM %1$s #ITEM_JOIN#',),
+
+ 'Fields' => Array(
+ 'RelationshipId' => Array(),
+ 'SourceId' => Array('type'=>'int'),
+ 'TargetId' => Array('type'=>'int'),
+ 'SourceType' => Array('type'=>'int','not_null'=>1,'default'=>0),
+ 'TargetType' => Array('type'=>'int','not_null'=>1,'default'=>0),
+ 'Type' => Array('type'=>'int','formatter'=>'kOptionsFormatter','options'=>Array(1=>'la_Reciprocal',0=>'la_OneWay'),'not_null'=>1,'default'=>0,'use_phrases'=>1),
+ 'Enabled' => Array('type'=>'int','formatter'=>'kOptionsFormatter','options'=>Array(0=>'la_Disabled',1=>'la_Enabled'),'not_null'=>1,'default'=>1,'use_phrases'=>1),
+ 'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0),
+ ),
+ 'VirtualFields' => Array( 'ItemName' => Array(),
+ 'ItemType' => Array(),
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif','1_0'=>'icon16_relation_one-way.gif','0_0'=>'icon16_relation_one-way_disabled.gif','1_1'=>'icon16_relation_reciprocal.gif','0_1'=>'icon16_relation_reciprocal_disabled.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used
+ 'Fields' => Array(
+ 'ItemName' => Array( 'title'=>'la_col_TargetId', 'data_block' => 'grid_checkbox_td'),
+ 'ItemType' => Array( 'title'=>'la_col_TargetType' ),
+ 'Type' => Array( 'title'=>'la_col_RelationshipType' ),
+ 'Enabled' => Array( 'title'=>'la_col_Status' ),
+ ),
+
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.4.4/core/units/relationship/relationship_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_tag_processor.php (revision 5539)
@@ -0,0 +1,95 @@
+<?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->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
+ $item_id = $object->GetDBField($id_field);
+
+ 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
+ ), 'index4.php');
+ }
+
+ /**
+ * 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)
+ {
+ $user_id = ($this->Application->GetVar('u_id') == 0) ? -2 : $this->Application->GetVar('u_id');
+ $object =& $this->getObject( Array('skip_autoload' => true) );
+ $product_info = $object->getLinkedInfo();
+
+ $sql = ' SELECT * FROM '.TABLE_PREFIX.'SpamControl
+ WHERE ItemResourceId='.$product_info['ParentId'].'
+ AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'"
+ AND PortalUserId='.$user_id.'
+ AND DataType="Review"';
+ $res = $this->Conn->GetRow($sql);
+ if($res['Expire'] > adodb_mktime())
+ {
+ $ret = 1;
+ }
+ else
+ {
+ $sql = 'DELETE FROM '.TABLE_PREFIX.'SpamControl
+ WHERE ItemResourceId='.$product_info['ParentId'].'
+ AND IPaddress="'.$_SERVER['REMOTE_ADDR'].'"
+ AND PortalUserId='.$user_id.'
+ AND DataType="Review"';
+ $this->Conn->Query($sql);
+ $ret = 0;
+ }
+ return $ret;
+ }
+
+ function HasError($params)
+ {
+ $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
+ if (method_exists($object, 'GetErrorMsg')) {
+ return parent::HasError($params);
+ }
+ else {
+ return 0;
+ }
+ }
+}
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_config.php (revision 5539)
@@ -0,0 +1,136 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'rev',
+
+ 'Clones' => Array(
+ 'l-rev' => Array(
+ 'ParentPrefix' => 'l',
+ ),
+ 'n-rev' => Array(
+ 'ParentPrefix' => 'n',
+ ),
+ 'bb-rev'=> Array(
+ 'ParentPrefix' => 'bb',
+ ),
+ /*'p-rev' => Array('ParentPrefix' => 'p'),*/
+ ),
+
+ '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',
+ ),
+
+
+ 'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too
+
+ '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, '.TABLE_PREFIX.'Products pr
+ LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById',
+
+ 'product' => ' SELECT %1$s.* %2$s
+ FROM %1$s, '.TABLE_PREFIX.'Products pr
+ 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'),
+ 'CreatedOn' => Array('formatter'=>'kDateFormatter','not_null'=>1,'default'=>'#NOW#'),
+ 'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''),
+ 'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''),
+ 'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0),
+ 'CreatedById' => Array('formatter'=>'kLEFTFormatter','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('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','not_null'=>1,'default'=>0),
+ 'Module' => Array('type'=>'string','not_null'=>1,'default'=>''),
+ ),
+ 'VirtualFields' => Array(
+ 'ReviewedBy' => Array(),
+ ),
+
+ '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'),
+ 'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ),
+ 'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ),
+ 'Status' => Array( 'title'=>'la_col_Status' ),
+ ),
+
+ ),
+
+ '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'),
+ 'ReviewedBy' => Array( 'title'=>'la_col_ReviewedBy' ),
+ 'CreatedOn_formatted' => Array( 'title'=>'la_col_CreatedOn', 'sort_field' => 'CreatedOn' ),
+ 'Status' => Array( 'title'=>'la_col_Status' ),
+ ),
+
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.4.4/core/units/reviews/reviews_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.4.4/core/units/images/images_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.4.4/core/units/images/images_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.4.4/core/units/images/images_config.php (revision 5539)
@@ -0,0 +1,140 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'img',
+ 'Clones' => Array(
+ 'l-img' => Array('ParentPrefix' => 'l'),
+ 'n-img' => Array('ParentPrefix' => 'n'),
+ 'bb-img'=> Array('ParentPrefix' => 'bb'),
+ /*'p-img' => Array('ParentPrefix' => 'p'),*/
+ 'c-img' => Array('ParentPrefix' => 'c'),
+ ),
+
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ImageEventHandler','file'=>'image_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ImageTagProcessor','file'=>'image_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+
+ 'AggregateTags' => Array(
+ Array(
+ 'AggregateTo' => '#PARENT#',
+ 'AggregatedTagName' => 'Image',
+ 'LocalTagName' => 'ItemImage',
+ ),
+ Array(
+ 'AggregateTo' => '#PARENT#',
+ 'AggregatedTagName' => 'ListImages',
+ 'LocalTagName' => 'PrintList2',
+ 'LocalSpecial' => 'list',
+ ),
+ Array(
+ 'AggregateTo' => '#PARENT#',
+ 'AggregatedTagName' => 'LargeImageExists',
+ 'LocalTagName' => 'LargeImageExists',
+ ),
+ ),
+
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ ),
+ 'IDField' => 'ImageId',
+ 'StatusField' => Array('Enabled', 'DefaultImg'), // field, that is affected by Approve/Decline events
+ 'TitleField' => 'Name', // field, used in bluebar when editing existing item
+ 'TableName' => TABLE_PREFIX.'Images',
+ 'ParentTableKey'=> 'ResourceId', // linked field in master table
+ 'ForeignKey' => 'ResourceId', // linked field in subtable
+ 'ParentPrefix' => 'p',
+ 'AutoDelete' => true,
+ 'AutoClone' => true,
+
+ 'FilterMenu' => Array(
+ 'Groups' => Array(
+ Array('mode' => 'AND', 'filters' => Array('show_active','show_disabled'), 'type' => WHERE_FILTER),
+ ),
+ 'Filters' => Array(
+ 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => 'Enabled != 1' ),
+ 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => 'Enabled != 0' ),
+ )
+ ),
+
+ 'CalculatedFields' => Array(
+ '' => Array(
+ 'Preview' => '0',
+ ),
+ ),
+
+ 'ListSQLs' => Array( ''=>'SELECT * FROM %s',
+ ), // key - special, value - list select sql
+ 'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
+ ),
+ 'ListSortings' => Array(
+ '' => Array(
+ 'ForcedSorting' => Array('Priority' => 'desc'),
+ 'Sorting' => Array('Name' => 'asc'),
+ )
+ ),
+ 'Fields' => Array(
+ 'ImageId' => Array('type'=>'int'),
+ 'ResourceId' => Array('type'=>'int', 'not_null'=>1, 'default' => 0),
+ 'Url' => Array('max_len'=>255, 'default' => '', 'not_null'=>1),
+ 'Name' => Array('max_len'=>255, 'required'=>1, 'not_null'=>1, 'default' => ''),
+ 'AltName' => Array('max_len'=>255, 'required'=>1, 'not_null'=>1),
+ 'ImageIndex' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
+ 'LocalImage' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
+ 'LocalPath' => Array('formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len'=>240, 'default' => '', 'not_null' => 1, 'include_path' => 1,
+ 'allowed_types' => Array(
+ 0 => 'image/jpeg',
+ 1 => 'image/pjpeg',
+ 2 => 'image/png',
+ 3 => 'image/gif',
+ 4 => 'image/bmp'
+ ),
+ 'error_msgs' => Array( 'bad_file_format' => '!la_error_InvalidFileFormat!',
+ 'bad_file_size' => '!la_error_FileTooLarge!',
+ 'cant_save_file' => '!la_error_cant_save_file!'
+ )
+ ),
+ 'Enabled' => Array('formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options' => Array ( 1 => 'la_Enabled', 0 => 'la_Disabled' ), 'default' => 0, 'not_null'=>1),
+ 'DefaultImg' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
+ 'ThumbUrl' => Array('max_len' => 255),
+ 'Priority' => Array('type'=>'int', 'default' => 0, 'not_null'=>1),
+ 'ThumbPath' => Array( 'formatter'=>'kPictureFormatter', 'skip_empty'=>1, 'max_len' => 255,
+ 'allowed_types' => Array(
+ 0 => 'image/jpeg',
+ 1 => 'image/pjpeg',
+ 2 => 'image/png',
+ 3 => 'image/gif',
+ 4 => 'image/bmp'
+ ),
+ 'error_msgs' => Array( 'bad_file_format' => '!la_error_InvalidFileFormat!',
+ 'bad_file_size' => '!la_error_FileTooLarge!',
+ 'cant_save_file' => '!la_error_cant_save_file!'
+ )
+ ),
+ 'LocalThumb' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
+ 'SameImages' => Array('type'=>'int', 'default' => 1, 'not_null'=>1),
+ ),
+ 'VirtualFields' => Array(
+ 'Preview' => Array(),
+ 'ImageUrl' => Array(),
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon17_custom.gif','1_0'=>'icon16_image.gif','0_0'=>'icon16_image_disabled.gif','1_1'=>'icon16_image_primary.gif'),
+ 'Fields' => Array(
+ 'Name' => Array( 'title'=>'la_col_ImageName' , 'data_block' => 'image_caption_td'),
+ 'AltName' => Array( 'title'=>'la_col_AltName' ),
+ 'Url' => Array( 'title'=>'la_col_ImageUrl', 'data_block' => 'image_url_td' ),
+ 'Enabled' => Array( 'title'=>'la_col_ImageEnabled' ),
+ 'Preview' => Array( 'title'=>'la_col_Preview', 'data_block' => 'image_preview_td' ),
+ ),
+
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.4.4/core/units/images/images_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.4.4/core/units/statistics/statistics_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.4.4/core/units/statistics/statistics_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.4.4/core/units/statistics/statistics_tag_processor.php (revision 5539)
@@ -0,0 +1,290 @@
+<?php
+
+ class StatisticsTagProcessor extends kDBTagProcessor {
+
+ var $TagCache = Array(); // parsed tag (in sql queries only) values are cached
+
+ var $CurrentSQL = ''; // sql query being currently processed
+ var $PostFormatting = false; // apply formatting to sql query results
+ var $PostFormattingParams = Array(); // post formatting params if any
+
+ function CalculateValue($params)
+ {
+ $object =& $this->getObject($params);
+ $this->CurrentSQL = $object->GetDBField($params['field']);
+
+ // 1. replace prefix to actual one
+ $this->CurrentSQL = str_replace("<%prefix%>", TABLE_PREFIX, $this->CurrentSQL);
+
+ // 2. replace all pseudo-tags found in sql with their values
+ while ( ($tag = $this->FindTag()) != false ) {
+ $this->CurrentSQL = str_replace('<%'.$tag.'%>', $this->ProcessStatisticTag($tag), $this->CurrentSQL);
+ }
+
+ // 3. query sql and process gathered data
+ $values = $this->Conn->GetCol($this->CurrentSQL);
+ if (!$values) return '';
+ if (!$this->PostFormatting) return array_shift($values);
+
+
+ switch ($this->PostFormatting) {
+ case 'number':
+ // simple-specific postformatting
+ $lang =& $this->Application->recallObject('lang.current');
+ $value = $lang->formatNumber($value, $this->PostFormattingParams['precision']);
+ break;
+
+ case 'COUNT':
+ // extended postformatting
+ $value = count($values);
+ break;
+
+ case 'SUM':
+ $value = 0;
+ foreach ($values as $cur_value) {
+ $value += $cur_value;
+ }
+
+ if ($this->PostFormattingParams['format_as'] == 'file') {
+ $value = size($value);
+ }
+ break;
+
+ // other type of information (not from db)
+ case 'SysFileSize':
+ $value = size( dir_size(FULL_PATH.'/') );
+ break;
+
+ default: // simple-default postformatting
+ $value = adodb_date($this->PostFormatting, array_shift($values));
+ break;
+ }
+ $this->PostFormatting = false;
+ $this->PostFormattingParams = Array();
+
+
+ return $value;
+
+ }
+
+ function FindTag()
+ {
+ // finds tag in current sql & returns it if found, false otherwise
+ $tagOpen = '<%'; $tagClose = '%>'; $tagOpenLen = strlen($tagOpen);
+ $startPos = strpos($this->CurrentSQL, $tagOpen);
+ if( $startPos !== false )
+ {
+ $endPos = strpos($this->CurrentSQL, $tagClose, $startPos);
+ return ($endPos > $startPos) ? substr($this->CurrentSQL, $startPos + $tagOpenLen, $endPos - $startPos - $tagOpenLen) : false;
+ }
+ return false;
+ }
+
+ function ProcessStatisticTag($tag)
+ {
+ $tag = trim($tag);
+ if (isset($this->TagCache[$tag])) {
+ return $this->TagCache[$tag];
+ }
+
+ $object =& $this->getObject();
+
+ list($tag_name, $tag_params) = explode(' ', $tag, 2); // 1st - function, 2nd .. nth - params
+ preg_match_all('/([\${}a-zA-Z0-9_.-]+)=(["\']{1,1})(.*?)(?<!\\\)\\2/s', $tag_params, $rets, PREG_SET_ORDER);
+
+ $tag_params = Array();
+ foreach ($rets AS $key => $val){
+ $tag_params[$val[1]] = str_replace(Array('\\' . $val[2], '+'), Array($val[2], ' '), $val[3]);
+ }
+
+ switch ($tag_name) {
+ case 'm:config':
+ // m:config name="<variable_name>"
+ return $this->Application->ConfigValue($tag_params['name']);
+ break;
+
+ case 'm:post_format':
+ // m:post_format field="<field_name>" type="<formatting_type>" precision="2"
+ $lang =& $this->Application->recallObject('lang.current');
+ switch ($tag_params['type']) {
+ case 'date':
+ $this->PostFormatting = $lang->GetDBField('DateFormat');
+ break;
+
+ case 'time':
+ $this->PostFormatting = $lang->GetDBField('TimeFormat');
+ break;
+
+ case 'currency':
+ $this->PostFormatting = 'number';
+ $this->PostFormattingParams['precision'] = $tag_params['precision'];
+ break;
+ }
+ return $tag_params['field'];
+ break;
+
+ case 'm:custom_action':
+ // m:custom_action sql="empty" action="SysFileSize"
+ $this->PostFormatting = $tag_params['action'];
+ return ($tag_params['sql'] == 'empty') ? 'SELECT 1' : $tag_params['sql'];
+ break;
+
+ case 'modules:get_current':
+ return $object->GetDBField('Module');
+ break;
+
+ case 'm:sql_action':
+ //m:sql_action sql="SHOW TABLES" action="COUNT" field="*"
+ $this->PostFormatting = $tag_params['action'];
+ $this->PostFormattingParams = $tag_params;
+ return $tag_params['sql'];
+ break;
+
+ case 'link:hit_count':
+ if ($tag_params['type'] == 'top') {// by now only top is supported
+ $top_links_count = $this->Application->ConfigValue('Link_TopCount');
+
+ $sql = 'SELECT Hits
+ FROM '.TABLE_PREFIX.'Link
+ ORDER BY Hits DESC LIMIT 0, '.$top_links_count;
+ return $this->getLastRecord($sql, 'Hits');
+ }
+ break;
+
+ case 'article:hit_count':
+ if ($tag_params['type'] == 'top') {// by now only top is supported
+ $top_articles_count = $this->Application->ConfigValue('News_VotesToHot');
+ $min_votes = $this->Application->ConfigValue('News_MinVotes');
+
+ $sql = 'SELECT CachedRating
+ FROM '.TABLE_PREFIX.'News
+ WHERE CachedVotesQty > '.$min_votes.'
+ ORDER BY CachedRating DESC LIMIT 0, '.$top_articles_count;
+ return $this->getLastRecord($sql, 'CachedRating');
+ }
+ break;
+
+ case 'topic:hit_count':
+ if ($tag_params['type'] == 'top') {// by now only top is supported
+ $top_posts_count = $this->Application->ConfigValue('Topic_PostsToPop');
+
+ $sql = 'SELECT Views
+ FROM '.TABLE_PREFIX.'Topic
+ ORDER BY Views DESC LIMIT 0, '.$top_posts_count;
+ return $this->getLastRecord($sql, 'Views');
+ }
+ break;
+
+
+ }
+ }
+
+ function getLastRecord($sql, $field)
+ {
+ $records = $this->Conn->GetCol($sql);
+ return count($records) ? array_pop($records) : 0;
+ }
+
+ /**
+ * Allows to get pending item count for prefix
+ *
+ * @param Array $params
+ * @return int
+ */
+ function CountPending($params)
+ {
+ $prefix = $params['prefix'];
+ $value = $this->Application->getCache('statistics.pending', $prefix);
+ if ($value === false) {
+ $statistics_info = $this->Application->getUnitOption($prefix.'.pending', 'StatisticsInfo');
+ if (!$statistics_info) {
+ return 0;
+ }
+
+ $table = $this->Application->getUnitOption($prefix, 'TableName');
+ $status_field = array_shift( $this->Application->getUnitOption($prefix, 'StatusField') );
+ $sql = 'SELECT COUNT(*)
+ FROM '.$table.'
+ WHERE '.$status_field.' = '.$statistics_info['status'];
+ $value = $this->Conn->GetOne($sql);
+ $this->Application->setCache('statistics.pending', $prefix, $value);
+ }
+ return $value;
+ }
+
+ function GetTotalPending()
+ {
+ $prefixes = $this->getPendingPrefixes();
+
+ $sum = 0;
+ foreach ($prefixes as $prefix) {
+ $sum += $this->CountPending( Array('prefix' => $prefix) );
+ }
+ return $sum;
+ }
+
+ function getPendingPrefixes()
+ {
+ $sql = 'SELECT Prefix
+ FROM '.TABLE_PREFIX.'ItemTypes it
+ LEFT JOIN '.TABLE_PREFIX.'Modules m ON m.Name = it.Module
+ WHERE (m.Loaded = 1) AND (LENGTH(it.ClassName) > 0)';
+ return $this->Conn->GetCol($sql);
+ }
+
+ function PrintPendingStatistics($params)
+ {
+ $check_prefixes = $this->getPendingPrefixes();
+ if (!$check_prefixes) {
+ return '';
+ }
+
+ $ret = '';
+ $columns = $params['columns'];
+ $block_params = $this->prepareTagParams( Array('name' => $this->SelectParam($params, 'render_as,block') ) );
+
+ $prefixes = Array();
+ foreach ($check_prefixes as $prefix) {
+ $statistics_info = $this->Application->getUnitOption($prefix.'.pending', 'StatisticsInfo');
+ if ($statistics_info) {
+ $prefixes[] = $prefix;
+ }
+ }
+
+ $row_number = 0;
+
+ foreach ($prefixes as $i => $prefix) {
+ $block_params['prefix'] = $prefix;
+ $statistics_info = $this->Application->getUnitOption($prefix.'.pending', 'StatisticsInfo');
+
+ if ($i % $columns == 0) {
+ $column_number = 1;
+ $ret .= '<tr>';
+ }
+
+ $block_params['column_number'] = $column_number;
+ $block_params['is_first'] = $i < $columns ? 1 : 0;
+ $template = $statistics_info['url']['t'];
+ unset($statistics_info['url']['t']);
+ $url = $this->Application->HREF($template, '', $statistics_info['url']);
+ if ($statistics_info['js_url'] != '#url#') {
+ $statistics_info['js_url'] = 'javascript:'.$statistics_info['js_url'];
+ }
+
+ $block_params['url'] = str_replace('#url#', $url, $statistics_info['js_url']);
+ $block_params['icon'] = $statistics_info['icon'];
+ $block_params['label'] = $statistics_info['label'];
+ $ret .= $this->Application->ParseBlock($block_params);
+ $column_number++;
+
+ if (($i+1) % $columns == 0) {
+ $ret .= '</tr>';
+ }
+ }
+ return $ret;
+ }
+
+ }
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.4.4/core/units/statistics/statistics_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.4.4/core/admin_templates/categories/xml/tree_categories.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.4.4/core/admin_templates/categories/xml/tree_categories.tpl (nonexistent)
+++ branches/unlabeled/unlabeled-1.4.4/core/admin_templates/categories/xml/tree_categories.tpl (revision 5539)
@@ -0,0 +1,7 @@
+<inp2:m_XMLTemplate/>
+<inp2:m_DefineElement name="category">
+ <folder name="<inp2:Field name="Name"/>" icon="<inp2:c_ModulePath/>img/icons/icon24_catalog.gif" href="<inp2:CategoryLink template="catalog" pass="m" m_opener="r"/>" onclick="checkCatalog(<inp2:m_get name="c_id"/>)" load_url="<inp2:CategoryLink pass="m"/>"></folder>
+</inp2:m_DefineElement>
+<tree>
+<inp2:c_ListCategories render_as="category" row_start_render_as="html:" row_end_render_as="html:" per_page="-1"/>
+</tree>
Property changes on: branches/unlabeled/unlabeled-1.4.4/core/admin_templates/categories/xml/tree_categories.tpl
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.4
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline