Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Mon, Sep 22, 10:32 PM

in-portal

Index: branches/unlabeled/unlabeled-1.12.2/kernel/units/custom_fields/custom_fields_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/kernel/units/custom_fields/custom_fields_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/kernel/units/custom_fields/custom_fields_config.php (revision 6626)
@@ -0,0 +1,133 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'cf',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'CustomFieldsEventHandler','file'=>'custom_fields_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'CustomFieldsTagProcessor','file'=>'custom_fields_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'type',
+ 5 => 'mode',
+ ),
+
+ 'Hooks' => Array(
+ Array(
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'cf',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array('OnSave'), // edit cloned fields to made alters :)
+ 'DoPrefix' => 'cf',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnSaveCustomField',
+ ),
+ ),
+
+ 'IDField' => 'CustomFieldId',
+
+ 'TitleField' => 'FieldName', // field, used in bluebar when editing existing item
+
+ 'TitlePhrase' => 'la_title_CustomFields',
+
+ 'TitlePresets' => Array(
+ 'default' => Array( 'new_status_labels' => Array('cf'=>'!la_title_addingCustom!'),
+ 'edit_status_labels' => Array('cf'=>'!la_title_Editing_CustomField!'),
+ 'new_titlefield' => Array('cf'=>'!la_title_NewCustomField!'),
+ ),
+
+ 'custom_fields_list'=>Array( 'prefixes' => Array('cf_List'),
+ 'format' => "!la_tab_ConfigCustom! (#cf_recordcount#)",
+ ),
+
+ 'custom_fields_edit'=>Array( 'prefixes' => Array('cf'),
+ 'new_titlefield' => Array('cf'=>'!la_title_NewCustomField!'),
+ 'format' => "#cf_status# '#cf_titlefield#'",
+ ),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'CustomField',
+
+ 'ListSQLs' => Array( ''=>'SELECT * FROM %s',
+ ), // key - special, value - list select sql
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'ForcedSorting' => Array('DisplayOrder' => 'asc'),
+ 'Sorting' => Array('FieldName' => 'asc'),
+ ),
+
+ 'general' => Array(
+ 'Sorting' => Array('DisplayOrder' => 'asc')
+ ),
+
+ ),
+
+ 'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
+ ),
+ 'SubItems' => Array('confs-cf'),
+
+ 'Fields' => Array(
+ 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => ''),
+ 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'FieldName' => Array('required'=>'1', 'type' => 'string','not_null' => 1,'default' => ''),
+ 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'Heading' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'Prompt' => Array('type' => 'string','default' => ''),
+ 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label', 'date' => 'la_type_date', 'datetime' => 'la_type_datetime')),
+ 'ValueList' => Array('type' => 'string','default' => ''),
+ 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'IsSystem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => '1', 'default' => '0'),
+ ),
+ 'VirtualFields' => Array(
+ 'Value' => Array('type' => 'string', 'default' => ''),
+ 'OriginalValue' => Array('type' => 'string', 'default' => ''),
+ 'Error' => Array('type' => 'string', 'default' => ''),
+
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'CustomFieldId' => Array( 'title'=>'la_prompt_FieldId', 'data_block' => 'grid_checkbox_td' ),
+ 'FieldName' => Array( 'title'=>'la_prompt_FieldName'),
+ 'FieldLabel' => Array( 'title'=>'la_prompt_FieldLabel', 'data_block' => 'cf_grid_data_td' ),
+ 'DisplayOrder' => Array('title' => 'la_prompt_DisplayOrder'),
+ ),
+ ),
+
+ 'SeparateTab' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_icon_td'),
+ 'Prompt' => Array( 'title'=>'la_col_Prompt', 'data_block' => 'grid_data_label_ml_td', 'ElementTypeField' => 'ElementType'),
+ 'Value' => Array( 'title'=>'la_col_Value', 'data_block' => 'edit_custom_td'),
+ 'Error' => Array( 'title'=>'la_col_Error', 'data_block' => 'custom_error_td'),
+ ),
+ ),
+
+ 'SeparateTabOriginal' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_icon_td'),
+ 'Prompt' => Array( 'title'=>'la_col_Prompt', 'data_block' => 'grid_data_label_ml_td', 'ElementTypeField' => 'ElementType'),
+ 'Value' => Array( 'title'=>'la_col_Value', 'data_block' => 'edit_custom_td'),
+ 'OriginalValue' => Array( 'title'=>'la_col_OriginalValue', 'data_block' => 'grid_original_td'),
+ ),
+ ),
+
+ ),
+ );
+
+ if (constOn('DEBUG_MODE')) {
+ $config['Grids']['Default']['Fields']['IsSystem'] = Array('title' => 'la_col_IsSystem');
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/kernel/units/custom_fields/custom_fields_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.12.2/admin/install/inportal_remove.sql
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/admin/install/inportal_remove.sql (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/admin/install/inportal_remove.sql (revision 6626)
@@ -0,0 +1,216 @@
+DROP TABLE Addresses
+# --------------------------------------------------------
+DROP TABLE AffiliatePayments
+# --------------------------------------------------------
+DROP TABLE AffiliatePlans
+# --------------------------------------------------------
+DROP TABLE AffiliatePlansBrackets
+# --------------------------------------------------------
+DROP TABLE AffiliatePlansItems
+# --------------------------------------------------------
+DROP TABLE AffiliatePaymentTypes
+# --------------------------------------------------------
+DROP TABLE Affiliates
+# --------------------------------------------------------
+DROP TABLE Currencies
+# --------------------------------------------------------
+DROP TABLE GatewayConfigFields
+# --------------------------------------------------------
+DROP TABLE GatewayConfigValues
+# --------------------------------------------------------
+DROP TABLE Gateways
+# --------------------------------------------------------
+DROP TABLE Manufacturers
+# --------------------------------------------------------
+DROP TABLE OrderItems
+# --------------------------------------------------------
+DROP TABLE Orders
+# --------------------------------------------------------
+DROP TABLE PaymentTypeCurrencies
+# --------------------------------------------------------
+DROP TABLE PaymentTypes
+# --------------------------------------------------------
+DROP TABLE ProductFiles
+# --------------------------------------------------------
+DROP TABLE Products
+# --------------------------------------------------------
+DROP TABLE ProductsCouponItems
+# --------------------------------------------------------
+DROP TABLE ProductsCoupons
+# --------------------------------------------------------
+DROP TABLE ProductsDiscountItems
+# --------------------------------------------------------
+DROP TABLE ProductsDiscounts
+# --------------------------------------------------------
+DROP TABLE ProductsPricing
+# --------------------------------------------------------
+DROP TABLE ShippingBrackets
+# --------------------------------------------------------
+DROP TABLE ShippingCosts
+# --------------------------------------------------------
+DROP TABLE ShippingQuoteEngines
+# --------------------------------------------------------
+DROP TABLE ShippingType
+# --------------------------------------------------------
+DROP TABLE ShippingZones
+# --------------------------------------------------------
+DROP TABLE ShippingZonesDestinations
+# --------------------------------------------------------
+DROP TABLE TaxZones
+# --------------------------------------------------------
+DROP TABLE TaxZonesDestinations
+# --------------------------------------------------------
+DROP TABLE UserDownloads
+# --------------------------------------------------------
+DROP TABLE UserFileAccess
+# --------------------------------------------------------
+DROP TABLE Censorship
+# --------------------------------------------------------
+DROP TABLE Emoticon
+# --------------------------------------------------------
+DROP TABLE Topic
+# --------------------------------------------------------
+DROP TABLE Posting
+# --------------------------------------------------------
+DROP TABLE PrivateMessageBody
+# --------------------------------------------------------
+DROP TABLE PrivateMessages
+# --------------------------------------------------------
+DROP TABLE Link
+# --------------------------------------------------------
+DROP TABLE LinkValidation
+# --------------------------------------------------------
+DROP TABLE ListingTypes
+# --------------------------------------------------------
+DROP TABLE Listings
+# --------------------------------------------------------
+DROP TABLE News
+# --------------------------------------------------------
+DROP TABLE Pages
+# --------------------------------------------------------
+DROP TABLE PageContent
+# --------------------------------------------------------
+DROP TABLE BanRules
+# --------------------------------------------------------
+DROP TABLE Cache
+# --------------------------------------------------------
+DROP TABLE Category
+# --------------------------------------------------------
+DROP TABLE CategoryItems
+# --------------------------------------------------------
+DROP TABLE ConfigurationAdmin
+# --------------------------------------------------------
+DROP TABLE ConfigurationValues
+# --------------------------------------------------------
+DROP TABLE CountCache
+# --------------------------------------------------------
+DROP TABLE CustomField
+# --------------------------------------------------------
+DROP TABLE CustomMetaData
+# --------------------------------------------------------
+DROP TABLE EmailLog
+# --------------------------------------------------------
+DROP TABLE EmailMessage
+# --------------------------------------------------------
+DROP TABLE EmailQueue
+# --------------------------------------------------------
+DROP TABLE EmailSubscribers
+# --------------------------------------------------------
+DROP TABLE Events
+# --------------------------------------------------------
+DROP TABLE Favorites
+# --------------------------------------------------------
+DROP TABLE IdGenerator
+# --------------------------------------------------------
+DROP TABLE IgnoreKeywords
+# --------------------------------------------------------
+DROP TABLE Images
+# --------------------------------------------------------
+DROP TABLE ImportScripts
+# --------------------------------------------------------
+DROP TABLE ItemRating
+# --------------------------------------------------------
+DROP TABLE ItemReview
+# --------------------------------------------------------
+DROP TABLE ItemTypes
+# --------------------------------------------------------
+DROP TABLE Language
+# --------------------------------------------------------
+DROP TABLE Modules
+# --------------------------------------------------------
+DROP TABLE PermCache
+# --------------------------------------------------------
+DROP TABLE PermissionConfig
+# --------------------------------------------------------
+DROP TABLE Permissions
+# --------------------------------------------------------
+DROP TABLE PersistantSessionData
+# --------------------------------------------------------
+DROP TABLE Phrase
+# --------------------------------------------------------
+DROP TABLE PhraseCache
+# --------------------------------------------------------
+DROP TABLE PortalGroup
+# --------------------------------------------------------
+DROP TABLE PortalUser
+# --------------------------------------------------------
+DROP TABLE Relationship
+# --------------------------------------------------------
+DROP TABLE SearchConfig
+# --------------------------------------------------------
+DROP TABLE SearchLog
+# --------------------------------------------------------
+DROP TABLE SessionData
+# --------------------------------------------------------
+DROP TABLE SpamControl
+# --------------------------------------------------------
+DROP TABLE StatItem
+# --------------------------------------------------------
+DROP TABLE StdDestinations
+# --------------------------------------------------------
+DROP TABLE StylesheetSelectors
+# --------------------------------------------------------
+DROP TABLE Stylesheets
+# --------------------------------------------------------
+DROP TABLE SuggestMail
+# --------------------------------------------------------
+DROP TABLE SysCache
+# --------------------------------------------------------
+DROP TABLE TagAttributes
+# --------------------------------------------------------
+DROP TABLE TagLibrary
+# --------------------------------------------------------
+DROP TABLE Theme
+# --------------------------------------------------------
+DROP TABLE ThemeFiles
+# --------------------------------------------------------
+DROP TABLE UserGroup
+# --------------------------------------------------------
+DROP TABLE UserSession
+# --------------------------------------------------------
+DROP TABLE Visits
+# --------------------------------------------------------
+DROP TABLE ProductOptions
+# --------------------------------------------------------
+DROP TABLE ProductOptionCombinations
+# --------------------------------------------------------
+DROP TABLE CategoryCustomData
+# --------------------------------------------------------
+DROP TABLE LinkCustomData
+# --------------------------------------------------------
+DROP TABLE NewsCustomData
+# --------------------------------------------------------
+DROP TABLE PortalUserCustomData
+# --------------------------------------------------------
+DROP TABLE ProductsCustomData
+# --------------------------------------------------------
+DROP TABLE TopicCustomData
+# --------------------------------------------------------
+DROP TABLE ImportCache
+# --------------------------------------------------------
+DROP TABLE FormFields
+# --------------------------------------------------------
+DROP TABLE Forms
+# --------------------------------------------------------
+DROP TABLE FormSubmissions
+#
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/admin/install/inportal_remove.sql
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.12.2/core/units/custom_fields/custom_fields_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/core/units/custom_fields/custom_fields_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/core/units/custom_fields/custom_fields_config.php (revision 6626)
@@ -0,0 +1,133 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'cf',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'CustomFieldsEventHandler','file'=>'custom_fields_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'CustomFieldsTagProcessor','file'=>'custom_fields_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'type',
+ 5 => 'mode',
+ ),
+
+ 'Hooks' => Array(
+ Array(
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'cf',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array('OnSave'), // edit cloned fields to made alters :)
+ 'DoPrefix' => 'cf',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnSaveCustomField',
+ ),
+ ),
+
+ 'IDField' => 'CustomFieldId',
+
+ 'TitleField' => 'FieldName', // field, used in bluebar when editing existing item
+
+ 'TitlePhrase' => 'la_title_CustomFields',
+
+ 'TitlePresets' => Array(
+ 'default' => Array( 'new_status_labels' => Array('cf'=>'!la_title_addingCustom!'),
+ 'edit_status_labels' => Array('cf'=>'!la_title_Editing_CustomField!'),
+ 'new_titlefield' => Array('cf'=>'!la_title_NewCustomField!'),
+ ),
+
+ 'custom_fields_list'=>Array( 'prefixes' => Array('cf_List'),
+ 'format' => "!la_tab_ConfigCustom! (#cf_recordcount#)",
+ ),
+
+ 'custom_fields_edit'=>Array( 'prefixes' => Array('cf'),
+ 'new_titlefield' => Array('cf'=>'!la_title_NewCustomField!'),
+ 'format' => "#cf_status# '#cf_titlefield#'",
+ ),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'CustomField',
+
+ 'ListSQLs' => Array( ''=>'SELECT * FROM %s',
+ ), // key - special, value - list select sql
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'ForcedSorting' => Array('DisplayOrder' => 'asc'),
+ 'Sorting' => Array('FieldName' => 'asc'),
+ ),
+
+ 'general' => Array(
+ 'Sorting' => Array('DisplayOrder' => 'asc')
+ ),
+
+ ),
+
+ 'ItemSQLs' => Array( ''=>'SELECT * FROM %s',
+ ),
+ 'SubItems' => Array('confs-cf'),
+
+ 'Fields' => Array(
+ 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => ''),
+ 'Type' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'FieldName' => Array('required'=>'1', 'type' => 'string','not_null' => 1,'default' => ''),
+ 'FieldLabel' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'Heading' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'Prompt' => Array('type' => 'string','default' => ''),
+ 'ElementType' => Array('required'=>'1', 'type'=>'string', 'not_null'=>1, 'default'=>'NULL', 'formatter'=>'kOptionsFormatter', 'use_phrases' => 1, 'options'=>Array('' => 'la_EmptyValue', 'text' => 'la_type_text', 'select' => 'la_type_select', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'label' => 'la_type_label', 'date' => 'la_type_date', 'datetime' => 'la_type_datetime')),
+ 'ValueList' => Array('type' => 'string','default' => ''),
+ 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'OnGeneralTab' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'IsSystem' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'not_null' => '1', 'default' => '0'),
+ ),
+ 'VirtualFields' => Array(
+ 'Value' => Array('type' => 'string', 'default' => ''),
+ 'OriginalValue' => Array('type' => 'string', 'default' => ''),
+ 'Error' => Array('type' => 'string', 'default' => ''),
+
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'CustomFieldId' => Array( 'title'=>'la_prompt_FieldId', 'data_block' => 'grid_checkbox_td' ),
+ 'FieldName' => Array( 'title'=>'la_prompt_FieldName'),
+ 'FieldLabel' => Array( 'title'=>'la_prompt_FieldLabel', 'data_block' => 'cf_grid_data_td' ),
+ 'DisplayOrder' => Array('title' => 'la_prompt_DisplayOrder'),
+ ),
+ ),
+
+ 'SeparateTab' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_icon_td'),
+ 'Prompt' => Array( 'title'=>'la_col_Prompt', 'data_block' => 'grid_data_label_ml_td', 'ElementTypeField' => 'ElementType'),
+ 'Value' => Array( 'title'=>'la_col_Value', 'data_block' => 'edit_custom_td'),
+ 'Error' => Array( 'title'=>'la_col_Error', 'data_block' => 'custom_error_td'),
+ ),
+ ),
+
+ 'SeparateTabOriginal' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'),
+ 'Fields' => Array(
+ 'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_icon_td'),
+ 'Prompt' => Array( 'title'=>'la_col_Prompt', 'data_block' => 'grid_data_label_ml_td', 'ElementTypeField' => 'ElementType'),
+ 'Value' => Array( 'title'=>'la_col_Value', 'data_block' => 'edit_custom_td'),
+ 'OriginalValue' => Array( 'title'=>'la_col_OriginalValue', 'data_block' => 'grid_original_td'),
+ ),
+ ),
+
+ ),
+ );
+
+ if (constOn('DEBUG_MODE')) {
+ $config['Grids']['Default']['Fields']['IsSystem'] = Array('title' => 'la_col_IsSystem');
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/core/units/custom_fields/custom_fields_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.12.2/core/units/phrases/phrases_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.12.2/core/units/phrases/phrases_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.12.2/core/units/phrases/phrases_event_handler.php (revision 6626)
@@ -0,0 +1,95 @@
+<?php
+
+ class PhrasesEventHandler extends kDBEventHandler
+ {
+
+ /**
+ * Allow to create phrases from front end in debug mode with DBG_PHRASES constant set
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ if (!$this->Application->IsAdmin() && $this->Application->isDebugMode() && constOn('DBG_PHRASES')) {
+ if ($event->Name == 'OnNew' || $event->Name == 'OnCreate') {
+ return true;
+ }
+ }
+
+ return parent::CheckPermission($event);
+ }
+
+ /**
+ * Forces new label in case if issued from get link
+ *
+ * @param kEvent $event
+ */
+ function OnNew(&$event)
+ {
+ parent::OnNew($event);
+ $label = $this->Application->GetVar('phrases_label');
+
+ $object =& $event->getObject( $label ? Array('live_table'=>true, 'skip_autoload' => true) : Array('skip_autoload' => true) );
+ if ($label) {
+ $object->SetDBField('Phrase',$label);
+ $object->SetDBField('LanguageId', $this->Application->GetVar('m_lang') );
+ $object->SetDBField('PhraseType',1);
+
+ $primary_language = $this->Application->GetDefaultLanguageId();
+ $live_table = $this->Application->getUnitOption($event->Prefix, 'TableName');
+ $sql = 'SELECT Translation FROM %s WHERE Phrase = %s';
+ $primary_value = $this->Conn->GetOne( sprintf($sql, $live_table, $this->Conn->qstr($label) ) );
+ $object->SetDBField('PrimaryTranslation', $primary_value);
+ }
+
+ $last_module = $this->Application->GetVar('last_module');
+ if($last_module) $object->SetDBField('Module', $last_module);
+
+ if($event->Special == 'export' || $event->Special == 'import')
+ {
+ $object->SetDBField('PhraseType', '|0|1|2|');
+ $modules = $this->Conn->GetCol('SELECT Name FROM '.TABLE_PREFIX.'Modules');
+ $object->SetDBField('Module', '|'.implode('|', $modules).'|' );
+ }
+ }
+
+ /**
+ * Forces create to use live table
+ *
+ * @param kEvent $event
+ */
+ function OnBeforePhraseCreate(&$event)
+ {
+ $edit_direct = $this->Application->GetVar($event->Prefix.'_label');
+ if ($edit_direct) {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ if ($this->Application->GetVar('m_lang') != $this->Application->GetVar('lang_id')) {
+ $object->SwitchToLive();
+ }
+ }
+ }
+
+ /**
+ * Save phrase change date & ip translation was made from
+ *
+ * @param kEvent $event
+ */
+ function OnSetLastUpdated(&$event)
+ {
+ $object =& $event->getObject();
+ $prev_translation = $this->Conn->GetOne('SELECT Translation FROM '.$object->TableName.' WHERE '.$object->IDField.' = '.(int)$object->GetId() );
+ if( $prev_translation != $object->GetDBField('Translation') )
+ {
+ $ip_address = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR');
+ $object->SetDBField('LastChanged_date', adodb_mktime() );
+ $object->SetDBField('LastChanged_time', adodb_mktime() );
+ $object->SetDBField('LastChangeIP', $ip_address);
+ }
+
+ $cookie_path = $this->Application->IsAdmin() ? BASE_PATH.'/admin' : BASE_PATH;
+ setcookie('last_module', $object->GetDBField('Module'), $cookie_path, '.'.SERVER_NAME);
+ }
+ }
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.12.2/core/units/phrases/phrases_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.12
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline