Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Jul 20, 1:46 AM

in-portal

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
Index: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_1_8.txt
===================================================================
--- branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_1_8.txt (revision 4533)
+++ branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_1_8.txt (revision 4534)
@@ -1,15 +1,15 @@
Readme notes for In-Portal 1.1.8
Intechnic Corporation, May 4, 2006
New features:
- - Category Template and Item Template properties added to category edit allowing eliminating template filename in the URL when using mod_rewrite and use different template for displaying different sub-categories and items in different sub-categories
- - Custom field mechanism fully redone, resulting an improved performance when querying, displaying and searching through custom fields. All custom fields data is now stored as a single record in a table rather then a record for each custom field. The table structure is automatically altered when custom fields are being added or removed.
- - Extended quick search syntax in number of sections (Languages, all In-commerce sections) allowing usage of exact match (by enclosing keywords into double quotes, i.e. "exact match"), include or exclude single keywords or exact match keywords (by using +/- operators before keywords, i.e. +keyword +"exact match" -keyword1 -"exact match2")
- - Save warning in the administrative console when trying to switch between sections in the tree without saving an item currently being edited lowers the possibility of accidental data loss
- - Logging of Advanced Search on the front end
+ - Category Template and Item Template properties added to the Category Edit form, allowing to eliminate template filename in the URL when using mod_rewrite and to use a different template for displaying different sub-categories and items in different sub-categories
+ - Custom field mechanism fully reengineered, resulting in an improved performance when querying, displaying and searching through custom fields. All custom field data is now stored as a single record in a table rather then in a record for each custom field. The table structure is automatically altered when custom fields are being added or removed.
+ - Extended quick search syntax added in a number of sections (Languages, all In-commerce sections) allowing usage of exact match (by enclosing keywords into double quotes, i.e. "exact match"), allowing to include or exclude single keywords or exact match keywords (by using +/- operators before keywords, i.e. +keyword +"exact match" -keyword1 -"exact match2")
+ - 'Save' warning in the administrative console when trying to switch between sections in the tree without saving the current form. This lowers the possibility of accidental data loss.
+ - Logging of Advanced Search queries on the front end
Bug fixes:
- Automatic password assignment
- Possibility of selecting two languages as primary
- Searching and sorting of user list when editing a group
- - Editing of Home category may have resulted a blank screen
+ - Editing of the Home category in some situations resulted in a blank screen
Property changes on: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_1_8.txt
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.2
\ No newline at end of property
+1.1.2.3
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.6.10/kernel/admin_templates/regional/languages_export.tpl
===================================================================
--- branches/unlabeled/unlabeled-1.6.10/kernel/admin_templates/regional/languages_export.tpl (revision 4533)
+++ branches/unlabeled/unlabeled-1.6.10/kernel/admin_templates/regional/languages_export.tpl (revision 4534)
@@ -1,49 +1,49 @@
<inp2:m_set nobody="yes"/>
<inp2:m_include t="incs/header"/>
<body topmargin="0" leftmargin="8" marginheight="0" marginwidth="8" bgcolor="#FFFFFF">
<inp2:m_ParseBlock name="section_header" icon="icon46_conf_regional" title="!la_title_ExportLanguagePack!"/>
<inp2:m_ParseBlock name="blue_bar" prefix="lang" title_preset="export_language" module="in-portal" icon="icon46_conf_regional"/>
<!-- 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('lang','OnExportProgress');
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
submit_event('lang', 'OnGoBack');
}
) );
-
+
a_toolbar.Render();
</script>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="tableborder">
- <inp2:m_ParseBlock name="subsection" title="!la_section_General!"/>
+ <inp2:m_ParseBlock name="subsection" title="!la_section_General!"/>
+
-
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_ParseBlock name="inp_edit_field_caption" prefix="phrases.export" field="LangFile" title="la_fld_ExportFileName"/>
<td>
<inp2:lang_ExportPath/> <input type="text" name="<inp2:phrases.export_InputName field="LangFile"/>" id="<inp2:phrases.export_InputName field="LangFile"/>" value="<inp2:phrases.export_Field field="LangFile"/>" />
</td>
<td class="error"><inp2:phrases.export_Error field="LangFile"/>&nbsp;</td>
</tr>
-
+
<inp2:m_ParseBlock name="inp_edit_checkboxes" use_phrases="1" prefix="phrases.export" field="PhraseType" title="!la_fld_ExportPhraseTypes!"/>
<inp2:m_ParseBlock name="inp_edit_checkboxes" no_empty="no_empty" prefix="phrases.export" field="Module" title="!la_fld_ExportModules!"/>
-</table>
+ <inp2:m_ParseBlock name="inp_edit_checkbox" no_empty="no_empty" prefix="phrases.export" field="DoNotEncode" title="!la_fld_DoNotEncode!"/>
+</table>
<inp2:m_include t="incs/footer"/>
-
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.6.10/kernel/admin_templates/regional/languages_export.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.6.10.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.5.52/kernel/units/general/inp_db_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.5.52/kernel/units/general/inp_db_event_handler.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.5.52/kernel/units/general/inp_db_event_handler.php (revision 4534)
@@ -1,122 +1,130 @@
-<?php
-
- class InpDBEventHandler extends kDBEventHandler
- {
-
- function mapEvents()
- {
- parent::mapEvents();
- $common_events = Array( 'OnMassApprove'=>'iterateItems',
- 'OnMassDecline'=>'iterateItems',
- 'OnMassMoveUp'=>'iterateItems',
- 'OnMassMoveDown'=>'iterateItems',
- );
-
- $this->eventMethods = array_merge($this->eventMethods, $common_events);
- }
-
- /**
- * 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', 0)) {
- return;
- }
-
- $this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
- $object =& $event->getObject();
- $this->StoreSelectedIDs($event);
- $ids=$this->getSelectedIDs($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;
- $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay!
- }
- else
- {
- $event->status=erFAIL;
- $event->redirect=false;
- break;
- }
- }
- }
- }
-
- /**
- * Enter description here...
- *
- * @param kEvent $event
- */
- function OnMassClone(&$event)
- {
- if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) {
- return;
- }
-
- $event->status=erSUCCESS;
-
- $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
-
- $this->StoreSelectedIDs($event);
- $ids=$this->getSelectedIDs($event);
-
- if($ids)
- {
- $temp->CloneItems($event->Prefix, $event->Special, $ids);
- }
- }
-
- function check_array($records, $field, $value)
- {
- foreach ($records as $record)
- {
- if ($record[$field] == $value)
- {
- return true;
- }
- }
- return false;
- }
-
- function OnPreSavePopup(&$event)
- {
- $event->CallSubEvent('OnPreSave');
- $this->Application->StoreVar('PermCache_UpdateRequired', 1);
- $event->redirect = 'incs/just_close';
- }
- }
-
-
+<?php
+
+ class InpDBEventHandler extends kDBEventHandler
+ {
+
+ function mapEvents()
+ {
+ parent::mapEvents();
+ $common_events = Array( 'OnMassApprove'=>'iterateItems',
+ 'OnMassDecline'=>'iterateItems',
+ 'OnMassMoveUp'=>'iterateItems',
+ 'OnMassMoveDown'=>'iterateItems',
+ );
+
+ $this->eventMethods = array_merge($this->eventMethods, $common_events);
+ }
+
+ /**
+ * 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', 0)) {
+ return;
+ }
+
+ $this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
+ $object =& $event->getObject();
+ $this->StoreSelectedIDs($event);
+ $ids=$this->getSelectedIDs($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;
+ $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay!
+ }
+ else
+ {
+ $event->status=erFAIL;
+ $event->redirect=false;
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnMassClone(&$event)
+ {
+ if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) {
+ return;
+ }
+
+ $event->status=erSUCCESS;
+
+ $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
+
+ $this->StoreSelectedIDs($event);
+ $ids=$this->getSelectedIDs($event);
+
+ if($ids)
+ {
+ $temp->CloneItems($event->Prefix, $event->Special, $ids);
+ }
+ }
+
+ 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');
+
+ // 2. RESTORE SAVED LAST TEMPLATE AS LAST PARAM FOR FINILIZE_POPUP
+ $return_template = $this->Application->RecallVar('return_template');
+ $this->finalizePopup($event, '', $return_template);
+
+
+// $event->CallSubEvent('OnPreSave');
+// $event->redirect = 'incs/just_close';
+ }
+ }
+
+
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.5.52/kernel/units/general/inp_db_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5.52.1
\ No newline at end of property
+1.5.52.2
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.5.52/core/units/general/inp_db_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.5.52/core/units/general/inp_db_event_handler.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.5.52/core/units/general/inp_db_event_handler.php (revision 4534)
@@ -1,122 +1,130 @@
-<?php
-
- class InpDBEventHandler extends kDBEventHandler
- {
-
- function mapEvents()
- {
- parent::mapEvents();
- $common_events = Array( 'OnMassApprove'=>'iterateItems',
- 'OnMassDecline'=>'iterateItems',
- 'OnMassMoveUp'=>'iterateItems',
- 'OnMassMoveDown'=>'iterateItems',
- );
-
- $this->eventMethods = array_merge($this->eventMethods, $common_events);
- }
-
- /**
- * 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', 0)) {
- return;
- }
-
- $this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
- $object =& $event->getObject();
- $this->StoreSelectedIDs($event);
- $ids=$this->getSelectedIDs($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;
- $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay!
- }
- else
- {
- $event->status=erFAIL;
- $event->redirect=false;
- break;
- }
- }
- }
- }
-
- /**
- * Enter description here...
- *
- * @param kEvent $event
- */
- function OnMassClone(&$event)
- {
- if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) {
- return;
- }
-
- $event->status=erSUCCESS;
-
- $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
-
- $this->StoreSelectedIDs($event);
- $ids=$this->getSelectedIDs($event);
-
- if($ids)
- {
- $temp->CloneItems($event->Prefix, $event->Special, $ids);
- }
- }
-
- function check_array($records, $field, $value)
- {
- foreach ($records as $record)
- {
- if ($record[$field] == $value)
- {
- return true;
- }
- }
- return false;
- }
-
- function OnPreSavePopup(&$event)
- {
- $event->CallSubEvent('OnPreSave');
- $this->Application->StoreVar('PermCache_UpdateRequired', 1);
- $event->redirect = 'incs/just_close';
- }
- }
-
-
+<?php
+
+ class InpDBEventHandler extends kDBEventHandler
+ {
+
+ function mapEvents()
+ {
+ parent::mapEvents();
+ $common_events = Array( 'OnMassApprove'=>'iterateItems',
+ 'OnMassDecline'=>'iterateItems',
+ 'OnMassMoveUp'=>'iterateItems',
+ 'OnMassMoveDown'=>'iterateItems',
+ );
+
+ $this->eventMethods = array_merge($this->eventMethods, $common_events);
+ }
+
+ /**
+ * 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', 0)) {
+ return;
+ }
+
+ $this->Application->setUnitOption($event->Prefix,'AutoLoad',false);
+ $object =& $event->getObject();
+ $this->StoreSelectedIDs($event);
+ $ids=$this->getSelectedIDs($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;
+ $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay!
+ }
+ else
+ {
+ $event->status=erFAIL;
+ $event->redirect=false;
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnMassClone(&$event)
+ {
+ if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) {
+ return;
+ }
+
+ $event->status=erSUCCESS;
+
+ $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler');
+
+ $this->StoreSelectedIDs($event);
+ $ids=$this->getSelectedIDs($event);
+
+ if($ids)
+ {
+ $temp->CloneItems($event->Prefix, $event->Special, $ids);
+ }
+ }
+
+ 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');
+
+ // 2. RESTORE SAVED LAST TEMPLATE AS LAST PARAM FOR FINILIZE_POPUP
+ $return_template = $this->Application->RecallVar('return_template');
+ $this->finalizePopup($event, '', $return_template);
+
+
+// $event->CallSubEvent('OnPreSave');
+// $event->redirect = 'incs/just_close';
+ }
+ }
+
+
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.5.52/core/units/general/inp_db_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.5.52.1
\ No newline at end of property
+1.5.52.2
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.19.2/kernel/units/languages/languages_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.19.2/kernel/units/languages/languages_event_handler.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.19.2/kernel/units/languages/languages_event_handler.php (revision 4534)
@@ -1,396 +1,399 @@
<?php
class LanguagesEventHandler extends InpDBEventHandler
{
/**
* Updates table structure on new language adding/removing language
*
* @param kEvent $event
*/
function OnReflectMultiLingualFields($event)
{
$ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
-
+
$unit_config_reader =& $this->Application->recallObject('kUnitConfigReader');
foreach ($unit_config_reader->configData as $prefix => $config_data) {
$ml_helper->createFields($prefix);
}
}
/**
* Allows to set selected language as primary
*
* @param kEvent $event
*/
function OnSetPrimary(&$event)
{
$this->StoreSelectedIDs($event);
$ids = $this->getSelectedIDs($event);
if ($ids) {
$id = array_shift($ids);
$object =& $event->getObject( Array('skip_autoload' => true) );
$object->Load($id);
$object->setPrimary();
}
}
-
+
/**
* [HOOK] Reset primary status of other languages if we are saving primary language
*
* @param kEvent $event
*/
function OnUpdatePrimary(&$event)
{
$object =& $event->getObject( Array('skip_autoload' => true) );
$object->SwitchToLive();
-
+
// set primary for each languages, that have this checkbox checked
$ids = explode(',', $event->MasterEvent->getEventParam('ids'));
foreach ($ids as $id) {
$object->Load($id);
if ($object->GetDBField('PrimaryLang')) {
$object->setPrimary();
}
-
+
}
-
+
// if no primary language left, then set primary last language (not to load again) from edited list
$sql = 'SELECT '.$object->IDField.'
FROM '.$object->TableName.'
WHERE PrimaryLang = 1';
$primary_language = $this->Conn->GetOne($sql);
-
+
if (!$primary_language) {
$object->setPrimary(false);
}
}
-
-
+
+
/**
* Occurse before updating item
*
* @param kEvent $event
* @access public
*/
function OnBeforeItemUpdate(&$event)
{
$object =& $event->getObject();
$status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
if ($object->GetDBField('PrimaryLang') == 1 && $object->GetDBField($status_field) == 0) {
$object->SetDBField($status_field, 1);
}
}
-
+
/**
* Shows only enabled languages on front
*
* @param kEvent $event
*/
function SetCustomQuery(&$event)
{
if($event->Special == 'enabled')
{
$object =& $event->getObject();
$object->addFilter('enabled_filter', '%1$s.Enabled = 1');
}
}
/**
* Copy labels from another language
*
* @param kEvent $event
*/
function OnCopyLabels(&$event)
{
$object =& $event->getObject();
$from_lang_id = $object->GetDBField('CopyFromLanguage');
if( ($event->MasterEvent->status == erSUCCESS) && $object->GetDBField('CopyLabels') == 1 && ($from_lang_id > 0) )
{
$lang_id = $object->GetID();
// 1. phrases import
$phrases_live = $this->Application->getUnitOption('phrases','TableName');
$phrases_temp = kTempTablesHandler::GetTempName($phrases_live);
$sql = 'INSERT INTO '.$phrases_temp.'
SELECT Phrase, Translation, PhraseType, 0-PhraseId, '.$lang_id.', '.adodb_mktime().', "", Module
FROM '.$phrases_live.'
WHERE LanguageId='.$from_lang_id;
$this->Conn->Query($sql);
// 2. events import
$em_table_live = $this->Application->getUnitOption('emailmessages','TableName');
$em_table_temp = kTempTablesHandler::GetTempName($em_table_live);
$sql = 'SELECT * FROM '.$em_table_live.' WHERE LanguageId = '.$from_lang_id;
$email_messages = $this->Conn->Query($sql);
if($email_messages)
{
$id = $this->Conn->GetOne('SELECT MIN(EmailMessageId) FROM '.$em_table_live);
if($id > 0) $id = 0;
$id--;
$sqls = Array();
foreach($email_messages as $email_message)
{
$sqls[] = $id.','.$this->Conn->qstr($email_message['Template']).','.$this->Conn->qstr($email_message['MessageType']).','.$lang_id.','.$email_message['EventId'];
$id--;
}
$sql = 'INSERT INTO '.$em_table_temp.'(EmailMessageId,Template,MessageType,LanguageId,EventId) VALUES ('.implode('),(',$sqls).')';
$this->Conn->Query($sql);
}
$object->SetDBField('CopyLabels', 0);
}
}
/**
* Prepare temp tables for creating new item
* but does not create it. Actual create is
* done in OnPreSaveCreated
*
* @param kEvent $event
*/
function OnPreCreate(&$event)
{
parent::OnPreCreate($event);
$object =& $event->getObject();
$object->SetDBField('CopyLabels', 1);
$live_table = kTempTablesHandler::GetLiveName($object->TableName);
$primary_lang_id = $this->Conn->GetOne('SELECT '.$object->IDField.' FROM '.$live_table.' WHERE PrimaryLang = 1');
$object->SetDBField('CopyFromLanguage', $primary_lang_id);
}
function OnChangeLanguage(&$event)
{
$this->Application->SetVar('m_lang', $this->Application->GetVar('language'));
//$this->Application->LinkVar('language', 'm_lang');
}
/**
* Parse language XML file into temp tables and redirect to progress bar screen
*
* @param kEvent $event
*/
function OnImportLanguage(&$event)
{
$items_info = $this->Application->GetVar('phrases_import');
if($items_info)
{
list($id,$field_values) = each($items_info);
$object =& $this->Application->recallObject('phrases.import', 'phrases', Array('skip_autoload' => true) );
$object->SetFieldsFromHash($field_values);
$filename = getArrayValue($field_values, 'LangFile', 'tmp_name');
if( filesize($filename) )
{
$modules = getArrayValue($field_values,'Module');
$lang_xml =& $this->Application->recallObject('LangXML');
$lang_xml->Parse($filename, $field_values['PhraseType'], $modules, $field_values['ImportOverwrite']);
$event->redirect = 'dummy';
$event->SetRedirectParams( Array('lang_event' => 'OnImportProgress', 'pass' => 'all,lang', 'mode'=>$field_values['ImportOverwrite']) );
}
else
{
$object =& $this->Application->recallObject('phrases.import');
$object->SetError('LangFile', 'la_empty_file', 'la_EmptyFile');
$event->redirect = false;
}
}
}
/**
* Copies imported from xml file from temp table to live table
*
* @param kEvent $event
*/
function OnImportProgress(&$event)
{
define('IMPORT_BY', 300); // import this much records per step
$template_name = 'regional/languages_import_step2';
$import_mode = (int)$this->Application->GetVar('mode'); // 1 - overwrite existing phrases, 0 - don't overwrite existing phrases
$import_source = (int)$this->Application->GetVar('source');
$import_steps = Array(0 => 'lang', 1 => 'phrases', 2 => 'emailmessages', 3 => 'finish');
$key_fields = Array(0 => 'PackName', 1 => 'Phrase', 2 => 'EventId'); // by what field should we search record match
$import_titles = Array(0 => 'la_ImportingLanguages', 1 => 'la_ImportingPhrases', 2 => 'la_ImportingEmailEvents', 3 => 'la_Done');
// --- BEFORE ---
$import_prefix = $import_steps[$import_source];
$import_start = (int)$this->Application->GetVar('start');
$id_field = $this->Application->getUnitOption($import_prefix,'IDField');
$dst_table = $this->Application->getUnitOption($import_prefix,'TableName');
$src_table = kTempTablesHandler::GetTempName($dst_table);
$import_total = $this->Application->GetVar('total');
if(!$import_total) $import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table);
// --- AFTER ---
if($import_start == $import_total)
{
$import_source++;
$import_prefix = $import_steps[$import_source];
if($import_prefix == 'finish')
{
$event->SetRedirectParam('opener','u');
return true;
}
$import_start = 0;
$id_field = $this->Application->getUnitOption($import_prefix,'IDField');
$dst_table = $this->Application->getUnitOption($import_prefix,'TableName');
$src_table = kTempTablesHandler::GetTempName($dst_table);
$import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table);
}
if($import_total > 0)
{
$done_percent = ($import_start * 100) / $import_total;
}
else
{
$done_percent = 100;
}
-
+
$block_params = Array( 'name' => $template_name,
'title' => $import_titles[$import_source],
'percent_done' => $done_percent,
'percent_left' => 100 - $done_percent);
$this->Application->InitParser();
$this->Application->setUnitOption('phrases','AutoLoad',false);
echo $this->Application->ParseBlock($block_params);
flush();
$sql = 'SELECT * FROM %s LIMIT %s,%s';
$rows = $this->Conn->Query( sprintf($sql,$src_table,$import_start,IMPORT_BY) );
$values_sql = '';
// if found and mode = 1 (overwrite)
$search_sql = 'SELECT '.$id_field.' FROM '.$dst_table.' WHERE '.$key_fields[$import_source].' = %s AND LanguageId = %s';
$update_sql = 'UPDATE '.$dst_table.' SET %s WHERE '.$id_field.' = %s';
foreach($rows as $row)
{
$tmp_sql = sprintf($search_sql, $this->Conn->qstr($row[ $key_fields[$import_source] ]), $row['LanguageId'] );
$tmp_id = $this->Conn->GetOne($tmp_sql);
if($tmp_id > 0 && $import_mode == 1)
{
// update
$update_fields = '';
foreach($row as $field_name => $field_value)
{
if($field_name == $id_field) continue;
$update_fields .= '`'.$field_name.'` = '.$this->Conn->qstr($field_value).',';
}
$update_fields = preg_replace('/(.*),$/', '\\1', $update_fields);
$this->Conn->Query( sprintf($update_sql, $update_fields, $tmp_id) );
}
elseif(!$tmp_id)
{
$values_sql .= '(';
foreach($row as $field_value)
{
$values_sql .= $this->Conn->qstr($field_value).',';
}
$values_sql = preg_replace('/(.*),$/', '\\1', $values_sql).'),';
}
}
if($values_sql)
{
$fields_sql = '';
$fields = array_keys( $this->Application->getUnitOption($import_prefix,'Fields') );
foreach($fields as $field_name)
{
$fields_sql .= '`'.$field_name.'`,';
}
$fields_sql = preg_replace('/(.*),$/', '\\1', $fields_sql);
$values_sql = preg_replace('/(.*),$/', '\\1', $values_sql);
$sql = sprintf('INSERT INTO %s (%s) VALUES %s', $dst_table, $fields_sql, $values_sql);
$this->Conn->Query($sql);
}
$event->setRedirectParams( Array('lang_event' => 'OnImportProgress', 'pass' => 'all,lang', 'start' => $import_start += count($rows), 'total' => $import_total, 'source' => $import_source, 'mode' => $import_mode) );
}
/**
* Stores ids of selected languages and redirects to export language step 1
*
* @param kEvent $event
*/
function OnExportLanguage(&$event)
{
$this->Application->setUnitOption('phrases','AutoLoad',false);
$this->StoreSelectedIDs($event);
$this->Application->StoreVar('export_language_ids', implode(',', $this->getSelectedIDs($event)) );
$event->setRedirectParams( Array('m_opener'=>'d','phrases.export_event'=>'OnNew','pass'=>'all,phrases.export') );
$event->redirect = 'regional/languages_export';
}
/**
* Saves selected languages to xml file passed
*
* @param kEvent $event
*/
function OnExportProgress(&$event)
{
$items_info = $this->Application->GetVar('phrases_export');
if($items_info)
{
list($id,$field_values) = each($items_info);
$object =& $this->Application->recallObject('phrases.export', 'phrases', Array('skip_autoload' => true) );
$object->SetFieldsFromHash($field_values);
$lang_ids = explode(',', $this->Application->RecallVar('export_language_ids') );
if( !getArrayValue($field_values,'LangFile') )
{
$object->SetError('LangFile', 'required');
$event->redirect = false;
return false;
}
if( !is_writable(EXPORT_PATH) )
{
$object->SetError('LangFile', 'write_error', 'la_ExportFolderNotWritable');
$event->redirect = false;
return false;
}
if( substr($field_values['LangFile'], -5) != '.lang' ) $field_values['LangFile'] .= '.lang';
$filename = EXPORT_PATH.'/'.$field_values['LangFile'];
$lang_xml =& $this->Application->recallObject('LangXML');
+ if ($object->GetDBField('DoNotEncode')) {
+ $lang_xml->SetEncoding('plain');
+ }
$lang_xml->Create($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']);
}
$event->redirect = 'regional/languages_export_step2';
$event->SetRedirectParam('export_file', $field_values['LangFile']);
}
/**
* Returns to previous template in opener stack
*
* @param kEvent $event
*/
function OnGoBack(&$event)
{
$event->redirect_params['opener'] = 'u';
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.19.2/kernel/units/languages/languages_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.19
\ No newline at end of property
+1.19.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.19.2/core/units/languages/languages_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.19.2/core/units/languages/languages_event_handler.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.19.2/core/units/languages/languages_event_handler.php (revision 4534)
@@ -1,396 +1,399 @@
<?php
class LanguagesEventHandler extends InpDBEventHandler
{
/**
* Updates table structure on new language adding/removing language
*
* @param kEvent $event
*/
function OnReflectMultiLingualFields($event)
{
$ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
-
+
$unit_config_reader =& $this->Application->recallObject('kUnitConfigReader');
foreach ($unit_config_reader->configData as $prefix => $config_data) {
$ml_helper->createFields($prefix);
}
}
/**
* Allows to set selected language as primary
*
* @param kEvent $event
*/
function OnSetPrimary(&$event)
{
$this->StoreSelectedIDs($event);
$ids = $this->getSelectedIDs($event);
if ($ids) {
$id = array_shift($ids);
$object =& $event->getObject( Array('skip_autoload' => true) );
$object->Load($id);
$object->setPrimary();
}
}
-
+
/**
* [HOOK] Reset primary status of other languages if we are saving primary language
*
* @param kEvent $event
*/
function OnUpdatePrimary(&$event)
{
$object =& $event->getObject( Array('skip_autoload' => true) );
$object->SwitchToLive();
-
+
// set primary for each languages, that have this checkbox checked
$ids = explode(',', $event->MasterEvent->getEventParam('ids'));
foreach ($ids as $id) {
$object->Load($id);
if ($object->GetDBField('PrimaryLang')) {
$object->setPrimary();
}
-
+
}
-
+
// if no primary language left, then set primary last language (not to load again) from edited list
$sql = 'SELECT '.$object->IDField.'
FROM '.$object->TableName.'
WHERE PrimaryLang = 1';
$primary_language = $this->Conn->GetOne($sql);
-
+
if (!$primary_language) {
$object->setPrimary(false);
}
}
-
-
+
+
/**
* Occurse before updating item
*
* @param kEvent $event
* @access public
*/
function OnBeforeItemUpdate(&$event)
{
$object =& $event->getObject();
$status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
if ($object->GetDBField('PrimaryLang') == 1 && $object->GetDBField($status_field) == 0) {
$object->SetDBField($status_field, 1);
}
}
-
+
/**
* Shows only enabled languages on front
*
* @param kEvent $event
*/
function SetCustomQuery(&$event)
{
if($event->Special == 'enabled')
{
$object =& $event->getObject();
$object->addFilter('enabled_filter', '%1$s.Enabled = 1');
}
}
/**
* Copy labels from another language
*
* @param kEvent $event
*/
function OnCopyLabels(&$event)
{
$object =& $event->getObject();
$from_lang_id = $object->GetDBField('CopyFromLanguage');
if( ($event->MasterEvent->status == erSUCCESS) && $object->GetDBField('CopyLabels') == 1 && ($from_lang_id > 0) )
{
$lang_id = $object->GetID();
// 1. phrases import
$phrases_live = $this->Application->getUnitOption('phrases','TableName');
$phrases_temp = kTempTablesHandler::GetTempName($phrases_live);
$sql = 'INSERT INTO '.$phrases_temp.'
SELECT Phrase, Translation, PhraseType, 0-PhraseId, '.$lang_id.', '.adodb_mktime().', "", Module
FROM '.$phrases_live.'
WHERE LanguageId='.$from_lang_id;
$this->Conn->Query($sql);
// 2. events import
$em_table_live = $this->Application->getUnitOption('emailmessages','TableName');
$em_table_temp = kTempTablesHandler::GetTempName($em_table_live);
$sql = 'SELECT * FROM '.$em_table_live.' WHERE LanguageId = '.$from_lang_id;
$email_messages = $this->Conn->Query($sql);
if($email_messages)
{
$id = $this->Conn->GetOne('SELECT MIN(EmailMessageId) FROM '.$em_table_live);
if($id > 0) $id = 0;
$id--;
$sqls = Array();
foreach($email_messages as $email_message)
{
$sqls[] = $id.','.$this->Conn->qstr($email_message['Template']).','.$this->Conn->qstr($email_message['MessageType']).','.$lang_id.','.$email_message['EventId'];
$id--;
}
$sql = 'INSERT INTO '.$em_table_temp.'(EmailMessageId,Template,MessageType,LanguageId,EventId) VALUES ('.implode('),(',$sqls).')';
$this->Conn->Query($sql);
}
$object->SetDBField('CopyLabels', 0);
}
}
/**
* Prepare temp tables for creating new item
* but does not create it. Actual create is
* done in OnPreSaveCreated
*
* @param kEvent $event
*/
function OnPreCreate(&$event)
{
parent::OnPreCreate($event);
$object =& $event->getObject();
$object->SetDBField('CopyLabels', 1);
$live_table = kTempTablesHandler::GetLiveName($object->TableName);
$primary_lang_id = $this->Conn->GetOne('SELECT '.$object->IDField.' FROM '.$live_table.' WHERE PrimaryLang = 1');
$object->SetDBField('CopyFromLanguage', $primary_lang_id);
}
function OnChangeLanguage(&$event)
{
$this->Application->SetVar('m_lang', $this->Application->GetVar('language'));
//$this->Application->LinkVar('language', 'm_lang');
}
/**
* Parse language XML file into temp tables and redirect to progress bar screen
*
* @param kEvent $event
*/
function OnImportLanguage(&$event)
{
$items_info = $this->Application->GetVar('phrases_import');
if($items_info)
{
list($id,$field_values) = each($items_info);
$object =& $this->Application->recallObject('phrases.import', 'phrases', Array('skip_autoload' => true) );
$object->SetFieldsFromHash($field_values);
$filename = getArrayValue($field_values, 'LangFile', 'tmp_name');
if( filesize($filename) )
{
$modules = getArrayValue($field_values,'Module');
$lang_xml =& $this->Application->recallObject('LangXML');
$lang_xml->Parse($filename, $field_values['PhraseType'], $modules, $field_values['ImportOverwrite']);
$event->redirect = 'dummy';
$event->SetRedirectParams( Array('lang_event' => 'OnImportProgress', 'pass' => 'all,lang', 'mode'=>$field_values['ImportOverwrite']) );
}
else
{
$object =& $this->Application->recallObject('phrases.import');
$object->SetError('LangFile', 'la_empty_file', 'la_EmptyFile');
$event->redirect = false;
}
}
}
/**
* Copies imported from xml file from temp table to live table
*
* @param kEvent $event
*/
function OnImportProgress(&$event)
{
define('IMPORT_BY', 300); // import this much records per step
$template_name = 'regional/languages_import_step2';
$import_mode = (int)$this->Application->GetVar('mode'); // 1 - overwrite existing phrases, 0 - don't overwrite existing phrases
$import_source = (int)$this->Application->GetVar('source');
$import_steps = Array(0 => 'lang', 1 => 'phrases', 2 => 'emailmessages', 3 => 'finish');
$key_fields = Array(0 => 'PackName', 1 => 'Phrase', 2 => 'EventId'); // by what field should we search record match
$import_titles = Array(0 => 'la_ImportingLanguages', 1 => 'la_ImportingPhrases', 2 => 'la_ImportingEmailEvents', 3 => 'la_Done');
// --- BEFORE ---
$import_prefix = $import_steps[$import_source];
$import_start = (int)$this->Application->GetVar('start');
$id_field = $this->Application->getUnitOption($import_prefix,'IDField');
$dst_table = $this->Application->getUnitOption($import_prefix,'TableName');
$src_table = kTempTablesHandler::GetTempName($dst_table);
$import_total = $this->Application->GetVar('total');
if(!$import_total) $import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table);
// --- AFTER ---
if($import_start == $import_total)
{
$import_source++;
$import_prefix = $import_steps[$import_source];
if($import_prefix == 'finish')
{
$event->SetRedirectParam('opener','u');
return true;
}
$import_start = 0;
$id_field = $this->Application->getUnitOption($import_prefix,'IDField');
$dst_table = $this->Application->getUnitOption($import_prefix,'TableName');
$src_table = kTempTablesHandler::GetTempName($dst_table);
$import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table);
}
if($import_total > 0)
{
$done_percent = ($import_start * 100) / $import_total;
}
else
{
$done_percent = 100;
}
-
+
$block_params = Array( 'name' => $template_name,
'title' => $import_titles[$import_source],
'percent_done' => $done_percent,
'percent_left' => 100 - $done_percent);
$this->Application->InitParser();
$this->Application->setUnitOption('phrases','AutoLoad',false);
echo $this->Application->ParseBlock($block_params);
flush();
$sql = 'SELECT * FROM %s LIMIT %s,%s';
$rows = $this->Conn->Query( sprintf($sql,$src_table,$import_start,IMPORT_BY) );
$values_sql = '';
// if found and mode = 1 (overwrite)
$search_sql = 'SELECT '.$id_field.' FROM '.$dst_table.' WHERE '.$key_fields[$import_source].' = %s AND LanguageId = %s';
$update_sql = 'UPDATE '.$dst_table.' SET %s WHERE '.$id_field.' = %s';
foreach($rows as $row)
{
$tmp_sql = sprintf($search_sql, $this->Conn->qstr($row[ $key_fields[$import_source] ]), $row['LanguageId'] );
$tmp_id = $this->Conn->GetOne($tmp_sql);
if($tmp_id > 0 && $import_mode == 1)
{
// update
$update_fields = '';
foreach($row as $field_name => $field_value)
{
if($field_name == $id_field) continue;
$update_fields .= '`'.$field_name.'` = '.$this->Conn->qstr($field_value).',';
}
$update_fields = preg_replace('/(.*),$/', '\\1', $update_fields);
$this->Conn->Query( sprintf($update_sql, $update_fields, $tmp_id) );
}
elseif(!$tmp_id)
{
$values_sql .= '(';
foreach($row as $field_value)
{
$values_sql .= $this->Conn->qstr($field_value).',';
}
$values_sql = preg_replace('/(.*),$/', '\\1', $values_sql).'),';
}
}
if($values_sql)
{
$fields_sql = '';
$fields = array_keys( $this->Application->getUnitOption($import_prefix,'Fields') );
foreach($fields as $field_name)
{
$fields_sql .= '`'.$field_name.'`,';
}
$fields_sql = preg_replace('/(.*),$/', '\\1', $fields_sql);
$values_sql = preg_replace('/(.*),$/', '\\1', $values_sql);
$sql = sprintf('INSERT INTO %s (%s) VALUES %s', $dst_table, $fields_sql, $values_sql);
$this->Conn->Query($sql);
}
$event->setRedirectParams( Array('lang_event' => 'OnImportProgress', 'pass' => 'all,lang', 'start' => $import_start += count($rows), 'total' => $import_total, 'source' => $import_source, 'mode' => $import_mode) );
}
/**
* Stores ids of selected languages and redirects to export language step 1
*
* @param kEvent $event
*/
function OnExportLanguage(&$event)
{
$this->Application->setUnitOption('phrases','AutoLoad',false);
$this->StoreSelectedIDs($event);
$this->Application->StoreVar('export_language_ids', implode(',', $this->getSelectedIDs($event)) );
$event->setRedirectParams( Array('m_opener'=>'d','phrases.export_event'=>'OnNew','pass'=>'all,phrases.export') );
$event->redirect = 'regional/languages_export';
}
/**
* Saves selected languages to xml file passed
*
* @param kEvent $event
*/
function OnExportProgress(&$event)
{
$items_info = $this->Application->GetVar('phrases_export');
if($items_info)
{
list($id,$field_values) = each($items_info);
$object =& $this->Application->recallObject('phrases.export', 'phrases', Array('skip_autoload' => true) );
$object->SetFieldsFromHash($field_values);
$lang_ids = explode(',', $this->Application->RecallVar('export_language_ids') );
if( !getArrayValue($field_values,'LangFile') )
{
$object->SetError('LangFile', 'required');
$event->redirect = false;
return false;
}
if( !is_writable(EXPORT_PATH) )
{
$object->SetError('LangFile', 'write_error', 'la_ExportFolderNotWritable');
$event->redirect = false;
return false;
}
if( substr($field_values['LangFile'], -5) != '.lang' ) $field_values['LangFile'] .= '.lang';
$filename = EXPORT_PATH.'/'.$field_values['LangFile'];
$lang_xml =& $this->Application->recallObject('LangXML');
+ if ($object->GetDBField('DoNotEncode')) {
+ $lang_xml->SetEncoding('plain');
+ }
$lang_xml->Create($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']);
}
$event->redirect = 'regional/languages_export_step2';
$event->SetRedirectParam('export_file', $field_values['LangFile']);
}
/**
* Returns to previous template in opener stack
*
* @param kEvent $event
*/
function OnGoBack(&$event)
{
$event->redirect_params['opener'] = 'u';
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.19.2/core/units/languages/languages_event_handler.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.19
\ No newline at end of property
+1.19.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.2.20/kernel/admin/include/help/editcategory_general.txt
===================================================================
--- branches/unlabeled/unlabeled-1.2.20/kernel/admin/include/help/editcategory_general.txt (revision 4533)
+++ branches/unlabeled/unlabeled-1.2.20/kernel/admin/include/help/editcategory_general.txt (revision 4534)
@@ -1,15 +1,18 @@
<ul>
<li> Enable HTML? – this check box enables or disables HTML code in the category name and the category description. When checked, it will render the HTML (for example, a &lt;B&gt; tag will actually make the text bold). When unchecked, it will display the HTML as regular text (the &lt;B&gt; tag will appear exactly as ‘&lt;B&gt;'). This is very important, since some HTML tags can break the page layout, and in some instances can be a security weakness (the Java Script, for example).
<li> Category ID - this is a read-only field that displays the internal system ID. It is of a small importance, other than the fact that it's a truly unique identifier of a category – there can never be two categories with the same ID.
<li> Name - this is the category name
<li> Description - this is the category description
<li> Automatic Directory Name – specifies whether the Directory Name used for mod_rewrite should be generated automatically from the category name, or entered manually. If checked, the Directory Name will be generated from the category name, replacing all special characters ( !@#$%^&*()+|\=-~`{}][:”’;,./?>< ) by the underscore character (“_”), and all multiple underscores with a single underscore. If the resulting name ends with an underscore followed by number, an additional letter will be appended, since the names ending with a number are reserved for system use. The resulting name will also be checked for uniqueness, and if it’s not unique, additional letters will be appended to the end of the name
<li>Directory Name – the directory name used for the URL generation when using mod_rewrite. The field is disabled if Automatic Directory Name is On. If Automatic Directory Name is Off, the administrator may enter the directory name manually, however it will still be checked for uniqueness, special characters and whether it ends with a number. In such cases the Directory Name will be automatically corrected before saving.
+<li>Category Temple – the template file name used for displaying category index (item listing). If not explicitly set, the template filename will be inherited from the parent category, or taken from the URL if present. When used in conjunction with mod_rewrite, the template name will be eliminated from the URLs pointing to the category index, deduced by matching the category name from the URLs. The Category Template may be set to different values for different categories providing the ability to adjust the design of different categories.
+<li>Item Template – the template file name used for displaying items (such as links, products, articles etc) inside the given category. Works exactly the same way as the Category Template, except it’s used for URLs pointing to an item.
+
<li> ‘Editor' – this icon that looks like a notepad and a pen, will pop up the online HTML editor for the category description. It will only work if the Enable HTML check box is checked.
<li> Status – this is the category status
<li> New – this is the control for the ‘New' flag. The ‘auto' setting will let the system set the ‘new' flag automatically, based on the number of days since its creation and a setting; ‘always' will enable the flag, and ‘never' will disable it.
<li> Editor's Pick – this sets the Editor's pick flag
<li> Created on – this is the creation date. It can be either entered directly into the field, or you can use the calendar tool to select a date. The ‘Calendar' button is an icon to the right of the field that looks like a date book page. To the right of the ‘Calendar' button there is a hint that shows the current date format. This format may change, if a different Regional package is activated.
<li> META keywords – this field contains the META keywords that will be displayed on the front end of the In-portal site, in the special HTML “meta” tags. These particular keywords will be displayed when the current category is entered.
META description – similar to the META keywords, but for the META description HTML tag. Both are useful for search engine recognition of the page, as well as alternative descriptions of the category that will not be visible to a human visitor.
</ul>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.2.20/kernel/admin/include/help/editcategory_general.txt
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.2
\ No newline at end of property
+1.2.20.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.4.48/kernel/units/phrases/phrases_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.4.48/kernel/units/phrases/phrases_config.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.4.48/kernel/units/phrases/phrases_config.php (revision 4534)
@@ -1,130 +1,131 @@
<?php
$config = Array(
'Prefix' => 'phrases',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'PhrasesEventHandler','file'=>'phrases_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
'AutoLoad' => true,
-
- 'Hooks' => Array(
+
+ 'Hooks' => Array(
Array(
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'phrases',
'HookToSpecial' => '',
'HookToEvent' => Array('OnCreate'),
'DoPrefix' => 'phrases',
'DoSpecial' => '',
'DoEvent' => 'OnBeforePhraseCreate',
),
-
+
Array(
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'phrases',
'HookToSpecial' => '',
'HookToEvent' => Array('OnBeforeItemCreate','OnBeforeItemUpdate'),
'DoPrefix' => 'phrases',
'DoSpecial' => '',
'DoEvent' => 'OnSetLastUpdated',
),
),
-
+
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
4 => 'label',
),
'IDField' => 'PhraseId',
-
+
'StatusField' => Array('Type'),
-
+
'TitleField' => 'Phrase',
-
+
'TitlePresets' => Array(
'default' => Array( 'new_status_labels' => Array('phrases'=>'!la_title_Adding_Phrase!'),
'edit_status_labels' => Array('phrases'=>'!la_title_Editing_Phrase!'),
'new_titlefield' => Array('phrases'=>'!la_title_New_Phrase!'),
),
-
+
'phrase_edit' => Array('prefixes' => Array('phrases'), 'format' => '#phrases_status# - #phrases_titlefield#'),
-
+
),
-
+
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_front','show_admin','show_both'), 'type' => WHERE_FILTER),
),
'Filters' => Array(
'show_front' => Array('label' =>'la_PhraseType_Front', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 0' ),
'show_admin' => Array('label' => 'la_PhraseType_Admin', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 1' ),
'show_both' => Array('label' => 'la_PhraseType_Both', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 2' ),
)
),
-
+
'TableName' => TABLE_PREFIX.'Phrase',
-
+
'CalculatedFields' => Array(
'' => Array(
'PrimaryTranslation' => 'pri.Translation',
),
-
+
),
-
+
'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)'),
-
+
'ItemSQLs' => Array( ''=>' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)',),
-
+
'ListSortings' => Array(
'' => Array(
'Sorting' => Array('Phrase' => 'asc'),
)
),
-
+
'ForeignKey' => 'LanguageId',
'ParentTableKey' => 'LanguageId',
'ParentPrefix' => 'lang',
'AutoDelete' => true,
'AutoClone' => true,
-
+
'Fields' => Array(
'Phrase' => Array('type' => 'string','required'=>1,'unique'=>Array('LanguageId'),'not_null' => '1','default' => ''),
'Translation' => Array('type' => 'string','required'=>1,'not_null' => '1','default' => ''),
'PhraseType' => Array('type' => 'int','required'=>1,'formatter'=>'kOptionsFormatter','options'=>Array(0=>'la_PhraseType_Front',1=>'la_PhraseType_Admin',2=>'la_PhraseType_Both'), 'use_phrases' => 1, 'not_null' => '1','default' => '0'),
'PhraseId' => Array('type' => 'int','not_null' => '1','default' => ''),
'LanguageId' => Array('type' => 'int','not_null' => '1','default' => '0'),
'LastChanged' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'not_null' => '1','default' => '0'),
'LastChangeIP' => Array('type' => 'string','not_null' => '1','default' => ''),
'Module' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array(''=>''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Modules ORDER BY Name', 'option_key_field'=>'Name', 'option_title_field'=>'Name', 'not_null' => '1','default' => 'In-Portal'),
),
-
- 'VirtualFields' => Array(
+
+ 'VirtualFields' => Array(
'PrimaryTranslation' => Array(),
'LangFile' => Array(),
'ImportOverwrite' => Array(),
+ 'DoNotEncode' => Array(),
),
-
+
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_language_var.gif'),
'Fields' => Array(
'Phrase' => Array( 'title'=>'la_col_Label', 'data_block' => 'grid_checkbox_td'),
'Translation' => Array( 'title'=>'la_col_Translation' ),
'PrimaryTranslation' => Array( 'title'=>'la_col_PrimaryValue' ),
'PhraseType' => Array( 'title'=>'la_col_PhraseType' ),
'LastChanged' => Array( 'title'=>'la_col_LastChanged' ),
'Module' => Array( 'title'=>'la_col_Module' ),
),
-
+
),
),
);
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.4.48/kernel/units/phrases/phrases_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.4.48.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.4.48/core/units/phrases/phrases_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.4.48/core/units/phrases/phrases_config.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.4.48/core/units/phrases/phrases_config.php (revision 4534)
@@ -1,130 +1,131 @@
<?php
$config = Array(
'Prefix' => 'phrases',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'PhrasesEventHandler','file'=>'phrases_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
'AutoLoad' => true,
-
- 'Hooks' => Array(
+
+ 'Hooks' => Array(
Array(
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'phrases',
'HookToSpecial' => '',
'HookToEvent' => Array('OnCreate'),
'DoPrefix' => 'phrases',
'DoSpecial' => '',
'DoEvent' => 'OnBeforePhraseCreate',
),
-
+
Array(
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'phrases',
'HookToSpecial' => '',
'HookToEvent' => Array('OnBeforeItemCreate','OnBeforeItemUpdate'),
'DoPrefix' => 'phrases',
'DoSpecial' => '',
'DoEvent' => 'OnSetLastUpdated',
),
),
-
+
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
4 => 'label',
),
'IDField' => 'PhraseId',
-
+
'StatusField' => Array('Type'),
-
+
'TitleField' => 'Phrase',
-
+
'TitlePresets' => Array(
'default' => Array( 'new_status_labels' => Array('phrases'=>'!la_title_Adding_Phrase!'),
'edit_status_labels' => Array('phrases'=>'!la_title_Editing_Phrase!'),
'new_titlefield' => Array('phrases'=>'!la_title_New_Phrase!'),
),
-
+
'phrase_edit' => Array('prefixes' => Array('phrases'), 'format' => '#phrases_status# - #phrases_titlefield#'),
-
+
),
-
+
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array('show_front','show_admin','show_both'), 'type' => WHERE_FILTER),
),
'Filters' => Array(
'show_front' => Array('label' =>'la_PhraseType_Front', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 0' ),
'show_admin' => Array('label' => 'la_PhraseType_Admin', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 1' ),
'show_both' => Array('label' => 'la_PhraseType_Both', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 2' ),
)
),
-
+
'TableName' => TABLE_PREFIX.'Phrase',
-
+
'CalculatedFields' => Array(
'' => Array(
'PrimaryTranslation' => 'pri.Translation',
),
-
+
),
-
+
'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)'),
-
+
'ItemSQLs' => Array( ''=>' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)',),
-
+
'ListSortings' => Array(
'' => Array(
'Sorting' => Array('Phrase' => 'asc'),
)
),
-
+
'ForeignKey' => 'LanguageId',
'ParentTableKey' => 'LanguageId',
'ParentPrefix' => 'lang',
'AutoDelete' => true,
'AutoClone' => true,
-
+
'Fields' => Array(
'Phrase' => Array('type' => 'string','required'=>1,'unique'=>Array('LanguageId'),'not_null' => '1','default' => ''),
'Translation' => Array('type' => 'string','required'=>1,'not_null' => '1','default' => ''),
'PhraseType' => Array('type' => 'int','required'=>1,'formatter'=>'kOptionsFormatter','options'=>Array(0=>'la_PhraseType_Front',1=>'la_PhraseType_Admin',2=>'la_PhraseType_Both'), 'use_phrases' => 1, 'not_null' => '1','default' => '0'),
'PhraseId' => Array('type' => 'int','not_null' => '1','default' => ''),
'LanguageId' => Array('type' => 'int','not_null' => '1','default' => '0'),
'LastChanged' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'not_null' => '1','default' => '0'),
'LastChangeIP' => Array('type' => 'string','not_null' => '1','default' => ''),
'Module' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array(''=>''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Modules ORDER BY Name', 'option_key_field'=>'Name', 'option_title_field'=>'Name', 'not_null' => '1','default' => 'In-Portal'),
),
-
- 'VirtualFields' => Array(
+
+ 'VirtualFields' => Array(
'PrimaryTranslation' => Array(),
'LangFile' => Array(),
'ImportOverwrite' => Array(),
+ 'DoNotEncode' => Array(),
),
-
+
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_language_var.gif'),
'Fields' => Array(
'Phrase' => Array( 'title'=>'la_col_Label', 'data_block' => 'grid_checkbox_td'),
'Translation' => Array( 'title'=>'la_col_Translation' ),
'PrimaryTranslation' => Array( 'title'=>'la_col_PrimaryValue' ),
'PhraseType' => Array( 'title'=>'la_col_PhraseType' ),
'LastChanged' => Array( 'title'=>'la_col_LastChanged' ),
'Module' => Array( 'title'=>'la_col_Module' ),
),
-
+
),
),
);
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.4.48/core/units/phrases/phrases_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.4.48.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.16.2/kernel/units/languages/import_xml.php
===================================================================
--- branches/unlabeled/unlabeled-1.16.2/kernel/units/languages/import_xml.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.16.2/kernel/units/languages/import_xml.php (revision 4534)
@@ -1,385 +1,404 @@
<?php
-
+
define('LANG_OVERWRITE_EXISTING', 1);
define('LANG_SKIP_EXISTING', 2);
-
+
class LangXML_Parser extends kBase {
-
+
/**
* Path to current node beeing processed
*
* @var Array
*/
var $path = Array();
-
+
/**
* Connection to database
*
* @var kDBConnection
*/
var $Conn = null;
-
+
/**
* Fields of language currently beeing processed
*
* @var Array
*/
var $current_language = Array();
-
+
/**
* Fields of phrase currently beeing processed
*
* @var Array
*/
var $current_phrase = Array();
-
+
/**
* Fields of event currently beeing processed
*
* @var Array
*/
var $current_event = Array();
-
+
/**
* Event type + name mapping to id (from system)
*
* @var Array
*/
var $events_hash = Array();
-
-
+
+
/**
* Phrase types allowed for import/export operations
*
* @var Array
*/
var $phrase_types_allowed = Array();
-
+
/**
* Modules allowed for export (import in development)
*
* @var Array
*/
var $modules_allowed = Array();
-
+
var $lang_object = null;
-
+
var $tables = Array();
-
+
var $ip_address = '';
-
+
var $import_mode = LANG_SKIP_EXISTING;
-
+
+ var $Encoding = 'base64';
+
function LangXML_Parser()
{
parent::kBase();
$this->Conn =& $this->Application->GetADODBConnection();
-
+
$this->Application->SetVar('lang_mode', 't');
-
+
$this->tables['lang'] = $this->prepareTempTable('lang');
$this->Application->setUnitOption('lang','AutoLoad',false);
$this->lang_object =& $this->Application->recallObject('lang.imp');
-
+
$this->tables['phrases'] = $this->prepareTempTable('phrases');
$this->tables['emailmessages'] = $this->prepareTempTable('emailmessages');
-
+
$sql = 'SELECT EventId, CONCAT(Event,"_",Type) AS EventMix FROM '.TABLE_PREFIX.'Events';
$this->events_hash = $this->Conn->GetCol($sql, 'EventMix');
-
+
$this->ip_address = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR');
}
-
+
+ function SetEncoding($enc)
+ {
+ $this->Encoding = $enc;
+ }
+
function renameTable($table_prefix, $new_name)
{
$this->Conn->Query('ALTER TABLE '.$this->tables[$table_prefix].' RENAME '.$new_name);
$this->tables[$table_prefix] = $new_name;
}
-
+
/**
* Create temp table for prefix, if table already exists, then delete it and create again
*
* @param string $prefix
*/
function prepareTempTable($prefix)
{
$idfield = $this->Application->getUnitOption($prefix, 'IDField');
$table = $this->Application->getUnitOption($prefix,'TableName');
$temp_table = kTempTablesHandler::GetTempName($table);
-
+
$sql = 'DROP TABLE IF EXISTS %s';
$this->Conn->Query( sprintf($sql, $temp_table) );
-
+
$sql = 'CREATE TABLE %s SELECT * FROM %s WHERE 0';
$this->Conn->Query( sprintf($sql, $temp_table, $table) );
-
+
$sql = 'ALTER TABLE %1$s CHANGE %2$s %2$s INT(11) NOT NULL';
$this->Conn->Query( sprintf($sql, $temp_table, $idfield) );
-
+
return $temp_table;
}
-
+
function Parse($filename, $phrase_types, $module_ids, $import_mode = LANG_SKIP_EXISTING)
- {
+ {
// define the XML parsing routines/functions to call based on the handler path
if( !file_exists($filename) || !$phrase_types /*|| !$module_ids*/ ) return false;
-
+
$phrase_types = explode('|', substr($phrase_types, 1, -1) );
// $module_ids = explode('|', substr($module_ids, 1, -1) );
-
+
$this->phrase_types_allowed = array_flip($phrase_types);
$this->import_mode = $import_mode;
-
+
//if (in_array('In-Portal',)
-
+
$xml_parser = xml_parser_create();
xml_set_element_handler( $xml_parser, Array(&$this, 'startElement'), Array(&$this, 'endElement') );
xml_set_character_data_handler( $xml_parser, Array(&$this, 'characterData') );
-
+
$fdata = file_get_contents($filename);
-
+
$ret = xml_parse($xml_parser, $fdata);
- xml_parser_free($xml_parser); // clean up the parser object
-
+ xml_parser_free($xml_parser); // clean up the parser object
+
$this->Application->SetVar('lang_mode', '');
return $ret;
}
-
+
function startElement(&$parser, $element, $attributes)
{
array_push($this->path, $element);
$path = implode(' ',$this->path);
//check what path we are in
-
+
switch($path)
{
case 'LANGUAGES LANGUAGE':
- $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME']);
-
+ $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME'], 'Encoding' => $attributes['ENCODING']);
+
$sql = 'SELECT %s FROM %s WHERE PackName = %s';
$sql = sprintf( $sql,
$this->lang_object->IDField,
kTempTablesHandler::GetLiveName($this->lang_object->TableName),
$this->Conn->qstr($this->current_language['PackName']) );
$language_id = $this->Conn->GetOne($sql);
if($language_id)
{
$this->current_language['LanguageId'] = $language_id;
$this->lang_object->SwitchToLive();
$this->lang_object->Load($language_id);
}
break;
-
+
case 'LANGUAGES LANGUAGE PHRASES':
case 'LANGUAGES LANGUAGE EVENTS':
if( !getArrayValue($this->current_language,'Charset') ) $this->current_language['Charset'] = 'iso-8859-1';
$this->lang_object->SetFieldsFromHash($this->current_language);
-
+
if( !getArrayValue($this->current_language,'LanguageId') )
{
if( $this->lang_object->Create() ) $this->current_language['LanguageId'] = $this->lang_object->GetID();
}
elseif($this->import_mode == LANG_OVERWRITE_EXISTING)
{
$this->lang_object->TableName = $this->Application->getUnitOption($this->lang_object->Prefix, 'TableName');
- $this->lang_object->Update();
+ $this->lang_object->Update();
}
break;
-
+
case 'LANGUAGES LANGUAGE PHRASES PHRASE':
$phrase_module = getArrayValue($attributes,'MODULE');
if(!$phrase_module) $phrase_module = 'In-Portal';
-
+
$this->current_phrase = Array( 'LanguageId' => $this->current_language['LanguageId'],
'Phrase' => $attributes['LABEL'],
'PhraseType' => $attributes['TYPE'],
'Module' => $phrase_module,
'LastChanged' => adodb_mktime(),
'LastChangeIP' => $this->ip_address,
'Translation' => '');
break;
-
+
case 'LANGUAGES LANGUAGE EVENTS EVENT':
$this->current_event = Array( 'LanguageId' => $this->current_language['LanguageId'],
'EventId' => $this->events_hash[ $attributes['EVENT'].'_'.$attributes['TYPE'] ],
'MessageType' => $attributes['MESSAGETYPE'],
'Template' => '');
break;
-
-
+
+
}
-
- // if($path == 'SHIPMENT PACKAGE')
+
+ // if($path == 'SHIPMENT PACKAGE')
}
-
- function characterData(&$parser, $line)
- {
+
+ function characterData(&$parser, $line)
+ {
$line = trim($line);
if(!$line) return ;
-
- $path = join (' ',$this->path);
-
+
+ $path = join (' ',$this->path);
+
$language_nodes = Array('DATEFORMAT','TIMEFORMAT','INPUTDATEFORMAT','INPUTTIMEFORMAT','DECIMAL','THOUSANDS','CHARSET','UNITSYSTEM');
-
-
+
+
$node_field_map = Array('LANGUAGES LANGUAGE DATEFORMAT' => 'DateFormat',
'LANGUAGES LANGUAGE TIMEFORMAT' => 'TimeFormat',
-
+
'LANGUAGES LANGUAGE INPUTDATEFORMAT'=> 'InputDateFormat',
'LANGUAGES LANGUAGE INPUTTIMEFORMAT'=> 'InputTimeFormat',
-
+
'LANGUAGES LANGUAGE DECIMAL' => 'DecimalPoint',
'LANGUAGES LANGUAGE THOUSANDS' => 'ThousandSep',
'LANGUAGES LANGUAGE CHARSET' => 'Charset',
'LANGUAGES LANGUAGE UNITSYSTEM' => 'UnitSystem');
-
+
if( in_array( end($this->path), $language_nodes) )
{
$this->current_language[ $node_field_map[$path] ] = $line;
}
else
{
switch($path)
{
case 'LANGUAGES LANGUAGE PHRASES PHRASE':
if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) )
{
$this->current_phrase['Translation'] .= $line;
}
break;
-
+
case 'LANGUAGES LANGUAGE EVENTS EVENT':
$this->current_event['Template'] .= $line;
break;
- }
+ }
}
}
-
+
function endElement(&$parser, $element)
{
$path = implode(' ',$this->path);
-
+
switch($path)
{
case 'LANGUAGES LANGUAGE PHRASES PHRASE':
if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) )
{
- $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']);
+ if ($this->current_language['Encoding'] == 'plain') {
+ // nothing to decode!
+ }
+ else {
+ $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']);
+ }
$this->insertRecord($this->tables['phrases'], $this->current_phrase);
}
break;
-
+
case 'LANGUAGES LANGUAGE EVENTS EVENT':
- $this->current_event['Template'] = base64_decode($this->current_event['Template']);
+ if ($this->current_language['Encoding'] == 'plain') {
+ // nothing to decode!
+ }
+ else {
+ $this->current_event['Template'] = base64_decode($this->current_event['Template']);
+ }
$this->insertRecord($this->tables['emailmessages'],$this->current_event);
break;
}
-
+
array_pop($this->path);
}
-
+
function insertRecord($table, $fields_hash)
{
$fields = '';
$values = '';
-
+
foreach($fields_hash as $field_name => $field_value)
{
$fields .= '`'.$field_name.'`,';
$values .= $this->Conn->qstr($field_value).',';
}
-
+
$fields = preg_replace('/(.*),$/', '\\1', $fields);
$values = preg_replace('/(.*),$/', '\\1', $values);
-
+
$sql = 'INSERT INTO `'.$table.'` ('.$fields.') VALUES ('.$values.')';
$this->Conn->Query($sql);
-
+
// return $this->Conn->getInsertID(); // no need because of temp table without auto_increment column at all
}
-
+
/**
* Creates XML file with exported language data
*
* @param string $filename filename to export into
* @param Array $phrase_types phrases types to export from modules passed in $module_ids
* @param Array $language_ids IDs of languages to export
* @param Array $module_ids IDs of modules to export phrases from
*/
function Create($filename, $phrase_types, $language_ids, $module_ids)
{
$fp = fopen($filename,'w');
if(!$fp || !$phrase_types || !$module_ids || !$language_ids) return false;
-
+
$phrase_types = explode('|', substr($phrase_types, 1, -1) );
$module_ids = explode('|', substr($module_ids, 1, -1) );
-
+
$this->events_hash = array_flip($this->events_hash);
-
+
$lang_table = $this->Application->getUnitOption('lang','TableName');
$phrases_table = $this->Application->getUnitOption('phrases','TableName');
$emailevents_table = $this->Application->getUnitOption('emailmessages','TableName');
$mainevents_table = $this->Application->getUnitOption('emailevents','TableName');
-
+
$phrase_tpl = "\t\t\t".'<PHRASE Label="%s" Module="%s" Type="%s">%s</PHRASE>'."\n";
$event_tpl = "\t\t\t".'<EVENT MessageType="%s" Event="%s" Type="%s">%s</EVENT>'."\n";
$sql = 'SELECT * FROM %s WHERE LanguageId = %s';
$ret = '<LANGUAGES>'."\n";
foreach($language_ids as $language_id)
{
// languages
$row = $this->Conn->GetRow( sprintf($sql, $lang_table, $language_id) );
- $ret .= "\t".'<LANGUAGE PackName="'.$row['PackName'].'"><DATEFORMAT>'.$row['DateFormat'].'</DATEFORMAT>';
+ $ret .= "\t".'<LANGUAGE PackName="'.$row['PackName'].'" Encoding="'.$this->Encoding.'"><DATEFORMAT>'.$row['DateFormat'].'</DATEFORMAT>';
$ret .= '<TIMEFORMAT>'.$row['TimeFormat'].'</TIMEFORMAT><INPUTDATEFORMAT>'.$row['InputDateFormat'].'</INPUTDATEFORMAT>';
$ret .= '<INPUTTIMEFORMAT>'.$row['InputTimeFormat'].'</INPUTTIMEFORMAT><DECIMAL>'.$row['DecimalPoint'].'</DECIMAL>';
$ret .= '<THOUSANDS>'.$row['ThousandSep'].'</THOUSANDS><CHARSET>'.$row['Charset'].'</CHARSET>';
$ret .= '<UNITSYSTEM>'.$row['UnitSystem'].'</UNITSYSTEM>'."\n";
-
+
// phrases
$phrases_sql = 'SELECT * FROM '.$phrases_table.' WHERE LanguageId = %s AND PhraseType IN (%s) AND Module IN (%s) ORDER BY Phrase';
if( in_array('In-Portal',$module_ids) ) array_push($module_ids, ''); // for old language packs
$rows = $this->Conn->Query( sprintf($phrases_sql,$language_id, implode(',',$phrase_types), '\''.implode('\',\'',$module_ids).'\'' ) );
if($rows)
{
$ret .= "\t\t".'<PHRASES>'."\n";
foreach($rows as $row)
{
- $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['Module'], $row['PhraseType'], base64_encode($row['Translation']) );
+ $data = $this->Encoding == 'base64' ? base64_encode($row['Translation']) : '<![CDATA['.$row['Translation'].']]>';
+ $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['Module'], $row['PhraseType'], $data );
}
$ret .= "\t\t".'</PHRASES>'."\n";
}
-
+
// email events
if( in_array('In-Portal',$module_ids) ) unset( $module_ids[array_search('',$module_ids)] ); // for old language packs
$module_sql = preg_replace('/(.*) OR $/', '\\1', preg_replace('/(.*),/U', 'INSTR(Module,\'\\1\') OR ', implode(',', $module_ids).',' ) );
-
+
$sql = 'SELECT EventId FROM '.$mainevents_table.' WHERE '.$module_sql;
$event_ids = $this->Conn->GetCol($sql);
-
+
if($event_ids)
{
$ret .= "\t\t".'<EVENTS>'."\n";
$event_sql = ' SELECT em.*
FROM '.$emailevents_table.' em
LEFT JOIN '.$mainevents_table.' e ON e.EventId = em.EventId
WHERE em.LanguageId = %s AND em.EventId IN (%s)
ORDER BY e.Event, e.Type';
$rows = $this->Conn->Query( sprintf($event_sql,$language_id, $event_ids ? implode(',',$event_ids) : '' ) );
foreach($rows as $row)
{
list($event_name, $event_type) = explode('_', $this->events_hash[ $row['EventId'] ] );
- $ret .= sprintf($event_tpl, $row['MessageType'], $event_name, $event_type, base64_encode($row['Template']) );
+ $data = $this->Encoding == 'base64' ? base64_encode($row['Template']) : '<![CDATA['.$row['Template'].']]>';
+ $ret .= sprintf($event_tpl, $row['MessageType'], $event_name, $event_type, $data );
}
$ret .= "\t\t".'</EVENTS>'."\n";
}
$ret .= "\t".'</LANGUAGE>'."\n";
}
-
+
$ret .= '</LANGUAGES>';
fwrite($fp, $ret);
fclose($fp);
return true;
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.16.2/kernel/units/languages/import_xml.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.16
\ No newline at end of property
+1.16.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.16.2/core/units/languages/import_xml.php
===================================================================
--- branches/unlabeled/unlabeled-1.16.2/core/units/languages/import_xml.php (revision 4533)
+++ branches/unlabeled/unlabeled-1.16.2/core/units/languages/import_xml.php (revision 4534)
@@ -1,385 +1,404 @@
<?php
-
+
define('LANG_OVERWRITE_EXISTING', 1);
define('LANG_SKIP_EXISTING', 2);
-
+
class LangXML_Parser extends kBase {
-
+
/**
* Path to current node beeing processed
*
* @var Array
*/
var $path = Array();
-
+
/**
* Connection to database
*
* @var kDBConnection
*/
var $Conn = null;
-
+
/**
* Fields of language currently beeing processed
*
* @var Array
*/
var $current_language = Array();
-
+
/**
* Fields of phrase currently beeing processed
*
* @var Array
*/
var $current_phrase = Array();
-
+
/**
* Fields of event currently beeing processed
*
* @var Array
*/
var $current_event = Array();
-
+
/**
* Event type + name mapping to id (from system)
*
* @var Array
*/
var $events_hash = Array();
-
-
+
+
/**
* Phrase types allowed for import/export operations
*
* @var Array
*/
var $phrase_types_allowed = Array();
-
+
/**
* Modules allowed for export (import in development)
*
* @var Array
*/
var $modules_allowed = Array();
-
+
var $lang_object = null;
-
+
var $tables = Array();
-
+
var $ip_address = '';
-
+
var $import_mode = LANG_SKIP_EXISTING;
-
+
+ var $Encoding = 'base64';
+
function LangXML_Parser()
{
parent::kBase();
$this->Conn =& $this->Application->GetADODBConnection();
-
+
$this->Application->SetVar('lang_mode', 't');
-
+
$this->tables['lang'] = $this->prepareTempTable('lang');
$this->Application->setUnitOption('lang','AutoLoad',false);
$this->lang_object =& $this->Application->recallObject('lang.imp');
-
+
$this->tables['phrases'] = $this->prepareTempTable('phrases');
$this->tables['emailmessages'] = $this->prepareTempTable('emailmessages');
-
+
$sql = 'SELECT EventId, CONCAT(Event,"_",Type) AS EventMix FROM '.TABLE_PREFIX.'Events';
$this->events_hash = $this->Conn->GetCol($sql, 'EventMix');
-
+
$this->ip_address = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR');
}
-
+
+ function SetEncoding($enc)
+ {
+ $this->Encoding = $enc;
+ }
+
function renameTable($table_prefix, $new_name)
{
$this->Conn->Query('ALTER TABLE '.$this->tables[$table_prefix].' RENAME '.$new_name);
$this->tables[$table_prefix] = $new_name;
}
-
+
/**
* Create temp table for prefix, if table already exists, then delete it and create again
*
* @param string $prefix
*/
function prepareTempTable($prefix)
{
$idfield = $this->Application->getUnitOption($prefix, 'IDField');
$table = $this->Application->getUnitOption($prefix,'TableName');
$temp_table = kTempTablesHandler::GetTempName($table);
-
+
$sql = 'DROP TABLE IF EXISTS %s';
$this->Conn->Query( sprintf($sql, $temp_table) );
-
+
$sql = 'CREATE TABLE %s SELECT * FROM %s WHERE 0';
$this->Conn->Query( sprintf($sql, $temp_table, $table) );
-
+
$sql = 'ALTER TABLE %1$s CHANGE %2$s %2$s INT(11) NOT NULL';
$this->Conn->Query( sprintf($sql, $temp_table, $idfield) );
-
+
return $temp_table;
}
-
+
function Parse($filename, $phrase_types, $module_ids, $import_mode = LANG_SKIP_EXISTING)
- {
+ {
// define the XML parsing routines/functions to call based on the handler path
if( !file_exists($filename) || !$phrase_types /*|| !$module_ids*/ ) return false;
-
+
$phrase_types = explode('|', substr($phrase_types, 1, -1) );
// $module_ids = explode('|', substr($module_ids, 1, -1) );
-
+
$this->phrase_types_allowed = array_flip($phrase_types);
$this->import_mode = $import_mode;
-
+
//if (in_array('In-Portal',)
-
+
$xml_parser = xml_parser_create();
xml_set_element_handler( $xml_parser, Array(&$this, 'startElement'), Array(&$this, 'endElement') );
xml_set_character_data_handler( $xml_parser, Array(&$this, 'characterData') );
-
+
$fdata = file_get_contents($filename);
-
+
$ret = xml_parse($xml_parser, $fdata);
- xml_parser_free($xml_parser); // clean up the parser object
-
+ xml_parser_free($xml_parser); // clean up the parser object
+
$this->Application->SetVar('lang_mode', '');
return $ret;
}
-
+
function startElement(&$parser, $element, $attributes)
{
array_push($this->path, $element);
$path = implode(' ',$this->path);
//check what path we are in
-
+
switch($path)
{
case 'LANGUAGES LANGUAGE':
- $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME']);
-
+ $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME'], 'Encoding' => $attributes['ENCODING']);
+
$sql = 'SELECT %s FROM %s WHERE PackName = %s';
$sql = sprintf( $sql,
$this->lang_object->IDField,
kTempTablesHandler::GetLiveName($this->lang_object->TableName),
$this->Conn->qstr($this->current_language['PackName']) );
$language_id = $this->Conn->GetOne($sql);
if($language_id)
{
$this->current_language['LanguageId'] = $language_id;
$this->lang_object->SwitchToLive();
$this->lang_object->Load($language_id);
}
break;
-
+
case 'LANGUAGES LANGUAGE PHRASES':
case 'LANGUAGES LANGUAGE EVENTS':
if( !getArrayValue($this->current_language,'Charset') ) $this->current_language['Charset'] = 'iso-8859-1';
$this->lang_object->SetFieldsFromHash($this->current_language);
-
+
if( !getArrayValue($this->current_language,'LanguageId') )
{
if( $this->lang_object->Create() ) $this->current_language['LanguageId'] = $this->lang_object->GetID();
}
elseif($this->import_mode == LANG_OVERWRITE_EXISTING)
{
$this->lang_object->TableName = $this->Application->getUnitOption($this->lang_object->Prefix, 'TableName');
- $this->lang_object->Update();
+ $this->lang_object->Update();
}
break;
-
+
case 'LANGUAGES LANGUAGE PHRASES PHRASE':
$phrase_module = getArrayValue($attributes,'MODULE');
if(!$phrase_module) $phrase_module = 'In-Portal';
-
+
$this->current_phrase = Array( 'LanguageId' => $this->current_language['LanguageId'],
'Phrase' => $attributes['LABEL'],
'PhraseType' => $attributes['TYPE'],
'Module' => $phrase_module,
'LastChanged' => adodb_mktime(),
'LastChangeIP' => $this->ip_address,
'Translation' => '');
break;
-
+
case 'LANGUAGES LANGUAGE EVENTS EVENT':
$this->current_event = Array( 'LanguageId' => $this->current_language['LanguageId'],
'EventId' => $this->events_hash[ $attributes['EVENT'].'_'.$attributes['TYPE'] ],
'MessageType' => $attributes['MESSAGETYPE'],
'Template' => '');
break;
-
-
+
+
}
-
- // if($path == 'SHIPMENT PACKAGE')
+
+ // if($path == 'SHIPMENT PACKAGE')
}
-
- function characterData(&$parser, $line)
- {
+
+ function characterData(&$parser, $line)
+ {
$line = trim($line);
if(!$line) return ;
-
- $path = join (' ',$this->path);
-
+
+ $path = join (' ',$this->path);
+
$language_nodes = Array('DATEFORMAT','TIMEFORMAT','INPUTDATEFORMAT','INPUTTIMEFORMAT','DECIMAL','THOUSANDS','CHARSET','UNITSYSTEM');
-
-
+
+
$node_field_map = Array('LANGUAGES LANGUAGE DATEFORMAT' => 'DateFormat',
'LANGUAGES LANGUAGE TIMEFORMAT' => 'TimeFormat',
-
+
'LANGUAGES LANGUAGE INPUTDATEFORMAT'=> 'InputDateFormat',
'LANGUAGES LANGUAGE INPUTTIMEFORMAT'=> 'InputTimeFormat',
-
+
'LANGUAGES LANGUAGE DECIMAL' => 'DecimalPoint',
'LANGUAGES LANGUAGE THOUSANDS' => 'ThousandSep',
'LANGUAGES LANGUAGE CHARSET' => 'Charset',
'LANGUAGES LANGUAGE UNITSYSTEM' => 'UnitSystem');
-
+
if( in_array( end($this->path), $language_nodes) )
{
$this->current_language[ $node_field_map[$path] ] = $line;
}
else
{
switch($path)
{
case 'LANGUAGES LANGUAGE PHRASES PHRASE':
if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) )
{
$this->current_phrase['Translation'] .= $line;
}
break;
-
+
case 'LANGUAGES LANGUAGE EVENTS EVENT':
$this->current_event['Template'] .= $line;
break;
- }
+ }
}
}
-
+
function endElement(&$parser, $element)
{
$path = implode(' ',$this->path);
-
+
switch($path)
{
case 'LANGUAGES LANGUAGE PHRASES PHRASE':
if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) )
{
- $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']);
+ if ($this->current_language['Encoding'] == 'plain') {
+ // nothing to decode!
+ }
+ else {
+ $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']);
+ }
$this->insertRecord($this->tables['phrases'], $this->current_phrase);
}
break;
-
+
case 'LANGUAGES LANGUAGE EVENTS EVENT':
- $this->current_event['Template'] = base64_decode($this->current_event['Template']);
+ if ($this->current_language['Encoding'] == 'plain') {
+ // nothing to decode!
+ }
+ else {
+ $this->current_event['Template'] = base64_decode($this->current_event['Template']);
+ }
$this->insertRecord($this->tables['emailmessages'],$this->current_event);
break;
}
-
+
array_pop($this->path);
}
-
+
function insertRecord($table, $fields_hash)
{
$fields = '';
$values = '';
-
+
foreach($fields_hash as $field_name => $field_value)
{
$fields .= '`'.$field_name.'`,';
$values .= $this->Conn->qstr($field_value).',';
}
-
+
$fields = preg_replace('/(.*),$/', '\\1', $fields);
$values = preg_replace('/(.*),$/', '\\1', $values);
-
+
$sql = 'INSERT INTO `'.$table.'` ('.$fields.') VALUES ('.$values.')';
$this->Conn->Query($sql);
-
+
// return $this->Conn->getInsertID(); // no need because of temp table without auto_increment column at all
}
-
+
/**
* Creates XML file with exported language data
*
* @param string $filename filename to export into
* @param Array $phrase_types phrases types to export from modules passed in $module_ids
* @param Array $language_ids IDs of languages to export
* @param Array $module_ids IDs of modules to export phrases from
*/
function Create($filename, $phrase_types, $language_ids, $module_ids)
{
$fp = fopen($filename,'w');
if(!$fp || !$phrase_types || !$module_ids || !$language_ids) return false;
-
+
$phrase_types = explode('|', substr($phrase_types, 1, -1) );
$module_ids = explode('|', substr($module_ids, 1, -1) );
-
+
$this->events_hash = array_flip($this->events_hash);
-
+
$lang_table = $this->Application->getUnitOption('lang','TableName');
$phrases_table = $this->Application->getUnitOption('phrases','TableName');
$emailevents_table = $this->Application->getUnitOption('emailmessages','TableName');
$mainevents_table = $this->Application->getUnitOption('emailevents','TableName');
-
+
$phrase_tpl = "\t\t\t".'<PHRASE Label="%s" Module="%s" Type="%s">%s</PHRASE>'."\n";
$event_tpl = "\t\t\t".'<EVENT MessageType="%s" Event="%s" Type="%s">%s</EVENT>'."\n";
$sql = 'SELECT * FROM %s WHERE LanguageId = %s';
$ret = '<LANGUAGES>'."\n";
foreach($language_ids as $language_id)
{
// languages
$row = $this->Conn->GetRow( sprintf($sql, $lang_table, $language_id) );
- $ret .= "\t".'<LANGUAGE PackName="'.$row['PackName'].'"><DATEFORMAT>'.$row['DateFormat'].'</DATEFORMAT>';
+ $ret .= "\t".'<LANGUAGE PackName="'.$row['PackName'].'" Encoding="'.$this->Encoding.'"><DATEFORMAT>'.$row['DateFormat'].'</DATEFORMAT>';
$ret .= '<TIMEFORMAT>'.$row['TimeFormat'].'</TIMEFORMAT><INPUTDATEFORMAT>'.$row['InputDateFormat'].'</INPUTDATEFORMAT>';
$ret .= '<INPUTTIMEFORMAT>'.$row['InputTimeFormat'].'</INPUTTIMEFORMAT><DECIMAL>'.$row['DecimalPoint'].'</DECIMAL>';
$ret .= '<THOUSANDS>'.$row['ThousandSep'].'</THOUSANDS><CHARSET>'.$row['Charset'].'</CHARSET>';
$ret .= '<UNITSYSTEM>'.$row['UnitSystem'].'</UNITSYSTEM>'."\n";
-
+
// phrases
$phrases_sql = 'SELECT * FROM '.$phrases_table.' WHERE LanguageId = %s AND PhraseType IN (%s) AND Module IN (%s) ORDER BY Phrase';
if( in_array('In-Portal',$module_ids) ) array_push($module_ids, ''); // for old language packs
$rows = $this->Conn->Query( sprintf($phrases_sql,$language_id, implode(',',$phrase_types), '\''.implode('\',\'',$module_ids).'\'' ) );
if($rows)
{
$ret .= "\t\t".'<PHRASES>'."\n";
foreach($rows as $row)
{
- $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['Module'], $row['PhraseType'], base64_encode($row['Translation']) );
+ $data = $this->Encoding == 'base64' ? base64_encode($row['Translation']) : '<![CDATA['.$row['Translation'].']]>';
+ $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['Module'], $row['PhraseType'], $data );
}
$ret .= "\t\t".'</PHRASES>'."\n";
}
-
+
// email events
if( in_array('In-Portal',$module_ids) ) unset( $module_ids[array_search('',$module_ids)] ); // for old language packs
$module_sql = preg_replace('/(.*) OR $/', '\\1', preg_replace('/(.*),/U', 'INSTR(Module,\'\\1\') OR ', implode(',', $module_ids).',' ) );
-
+
$sql = 'SELECT EventId FROM '.$mainevents_table.' WHERE '.$module_sql;
$event_ids = $this->Conn->GetCol($sql);
-
+
if($event_ids)
{
$ret .= "\t\t".'<EVENTS>'."\n";
$event_sql = ' SELECT em.*
FROM '.$emailevents_table.' em
LEFT JOIN '.$mainevents_table.' e ON e.EventId = em.EventId
WHERE em.LanguageId = %s AND em.EventId IN (%s)
ORDER BY e.Event, e.Type';
$rows = $this->Conn->Query( sprintf($event_sql,$language_id, $event_ids ? implode(',',$event_ids) : '' ) );
foreach($rows as $row)
{
list($event_name, $event_type) = explode('_', $this->events_hash[ $row['EventId'] ] );
- $ret .= sprintf($event_tpl, $row['MessageType'], $event_name, $event_type, base64_encode($row['Template']) );
+ $data = $this->Encoding == 'base64' ? base64_encode($row['Template']) : '<![CDATA['.$row['Template'].']]>';
+ $ret .= sprintf($event_tpl, $row['MessageType'], $event_name, $event_type, $data );
}
$ret .= "\t\t".'</EVENTS>'."\n";
}
$ret .= "\t".'</LANGUAGE>'."\n";
}
-
+
$ret .= '</LANGUAGES>';
fwrite($fp, $ret);
fclose($fp);
return true;
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.16.2/core/units/languages/import_xml.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.16
\ No newline at end of property
+1.16.2.1
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.21.2/admin/help/manual.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: branches/unlabeled/unlabeled-1.21.2/admin/help/manual.pdf
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.21
\ No newline at end of property
+1.21.2.1
\ No newline at end of property

Event Timeline