Index: branches/5.1.x/core/admin_templates/regional/email_messages_edit.tpl
===================================================================
diff -u -N -r13140 -r13151
--- branches/5.1.x/core/admin_templates/regional/email_messages_edit.tpl (.../email_messages_edit.tpl) (revision 13140)
+++ branches/5.1.x/core/admin_templates/regional/email_messages_edit.tpl (.../email_messages_edit.tpl) (revision 13151)
@@ -30,6 +30,7 @@
+
Index: branches/5.1.x/core/kernel/languages/phrases_cache.php
===================================================================
diff -u -N -r13086 -r13151
--- branches/5.1.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 13086)
+++ branches/5.1.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 13151)
@@ -1,6 +1,6 @@
_phraseEditTemplate = 'regional/phrases_edit';
+ $this->_phraseEditTemplate = 'languages/phrase_edit';
}
/**
@@ -158,9 +158,9 @@
return;
}
- $sql = 'SELECT Translation, PhraseKey
+ $sql = 'SELECT l' . $this->LanguageId . '_Translation, PhraseKey
FROM ' . TABLE_PREFIX . 'Phrase
- WHERE (LanguageId = ' . $this->LanguageId . ') AND PhraseId IN (' . implode(',', $ids) . ')';
+ WHERE PhraseId IN (' . implode(',', $ids) . ')';
$this->Phrases = $this->Conn->GetCol($sql, 'PhraseKey');
/*foreach($phrases as $phrase => $tanslation)
@@ -233,7 +233,7 @@
if ($this->_editExisting && $allow_editing && !array_key_exists($label, $this->_missingPhrases)) {
// option to change translation for Labels
- $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPrepareUpdate\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});';
+ $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPreparePhrase\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});';
$translated_label = '<' . $this->_translateHtmlTag . ' href="' . $edit_url . '" name="cms-translate-phrase" title="Edit translation">' . $translated_label . '' . $this->_translateHtmlTag . '>';
if ($this->fromTag) {
@@ -260,16 +260,16 @@
$language_id = $use_admin ? $this->AdminLanguageId : $this->LanguageId;
- $sql = 'SELECT PhraseId, Translation
+ $sql = 'SELECT PhraseId, l' . $language_id . '_Translation
FROM ' . TABLE_PREFIX . 'Phrase
- WHERE (LanguageId = ' . $language_id . ') AND (PhraseKey = ' . $this->Conn->qstr($label) . ')';
+ WHERE (PhraseKey = ' . $this->Conn->qstr($label) . ') AND (l' . $language_id . '_Translation IS NOT NULL)';
$res = $this->Conn->GetRow($sql);
if ($res === false || count($res) == 0) {
$translation = '!' . $label . '!';
if ($this->_editMissing && $allow_editing) {
- $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnNew\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});';
+ $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPreparePhrase\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});';
$translation = '<' . $this->_translateHtmlTag . ' href="' . $edit_url . '" name="cms-translate-phrase" title="Translate">!' . $label . '!' . $this->_translateHtmlTag . '>';
if ($this->fromTag) {
@@ -286,7 +286,7 @@
}
$cache_key = ($allow_editing ? '' : 'NE:') . $label;
- $this->Phrases[$cache_key] = $res['Translation'];
+ $this->Phrases[$cache_key] = $res['l' . $language_id . '_Translation'];
array_push($this->Ids, $res['PhraseId']);
$this->Ids = array_unique($this->Ids); // just to make sure
Index: branches/5.1.x/core/install/install_data.sql
===================================================================
diff -u -N -r13140 -r13151
--- branches/5.1.x/core/install/install_data.sql (.../install_data.sql) (revision 13140)
+++ branches/5.1.x/core/install/install_data.sql (.../install_data.sql) (revision 13151)
@@ -239,38 +239,38 @@
INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category');
INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User');
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.ADD', NULL, 1, 0, NULL, 'Core:Users', 'Add User', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.ADD', NULL, 1, 1, NULL, 'Core:Users', 'Add User', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.APPROVE', NULL, 1, 0, NULL, 'Core:Users', 'Approve User', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.APPROVE', NULL, 1, 1, NULL, 'Core:Users', 'Approve User', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.VALIDATE', NULL, 1, 0, NULL, 'Core:Users', 'Validate User', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.VALIDATE', NULL, 1, 1, NULL, 'Core:Users', 'Validate User', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.DENY', NULL, 1, 0, NULL, 'Core:Users', 'Deny User', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.DENY', NULL, 1, 1, NULL, 'Core:Users', 'Deny User', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.PSWD', NULL, 1, 1, NULL, 'Core:Users', 'Forgot Password', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.PSWD', NULL, 1, 0, NULL, 'Core:Users', 'Forgot Password', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.ADD.PENDING', NULL, 1, 0, NULL, 'Core:Users', 'Add Pending User', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.ADD.PENDING', NULL, 1, 1, NULL, 'Core:Users', 'Add Pending User', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD', NULL, 1, 0, NULL, 'Core:Category', 'Add Category', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD.PENDING', NULL, 1, 0, NULL, 'Core:Category', 'Add Pending Category', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD.PENDING', NULL, 1, 1, NULL, 'Core:Category', 'Add Pending Category', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD', NULL, 1, 1, NULL, 'Core:Category', 'Add Category', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'CATEGORY.APPROVE', NULL, 1, 0, NULL, 'Core:Category', 'Approve Category', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'CATEGORY.DENY', NULL, 1, 0, NULL, 'Core:Category', 'Deny Category', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.SUBSCRIBE', NULL, 1, 0, NULL, 'Core:Users', 'User subscribed', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.SUBSCRIBE', NULL, 1, 1, NULL, 'Core:Users', 'User subscribed', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.UNSUBSCRIBE', NULL, 1, 0, NULL, 'Core:Users', 'User unsubscribed', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.UNSUBSCRIBE', NULL, 1, 1, NULL, 'Core:Users', 'User unsubscribed', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.SUGGEST', NULL, 1, 0, NULL, 'Core:Users', 'Suggest to a friend', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.SUGGEST', NULL, 1, 1, NULL, 'Core:Users', 'Suggest to a friend', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.PSWDC', NULL, 1, 0, NULL, 'Core:Users', 'Password Confirmation', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRED', NULL, 1, 0, NULL, 'Core:Users', 'Membership expired', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRED', NULL, 1, 0, NULL, 'Core:Users', 'Membership expired', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRATION.NOTICE', NULL, 1, 0, NULL, 'Core:Users', 'Membership expiration notice', 0);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRATION.NOTICE', NULL, 1, 0, NULL, 'Core:Users', 'Membership expiration notice', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'COMMON.FOOTER', NULL, 1, 0, NULL, 'Core', 'Common Footer Template', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'FORM.SUBMITTED', NULL, 1, 0, NULL, 'Core:Category', 'This e-mail is sent to a user after filling in the Contact Us form', 1);
-INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, l1_Description, Type) VALUES(DEFAULT, 'FORM.SUBMITTED', NULL, 1, 0, NULL, 'Core:Category', 'This e-mail is sent to a user after filling in the Contact Us form', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.ADD', NULL, 1, 0, NULL, 'Core:Users', 'Add User', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.ADD', NULL, 1, 1, NULL, 'Core:Users', 'Add User', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.APPROVE', NULL, 1, 0, NULL, 'Core:Users', 'Approve User', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.APPROVE', NULL, 1, 1, NULL, 'Core:Users', 'Approve User', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.VALIDATE', NULL, 1, 0, NULL, 'Core:Users', 'Validate User', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.VALIDATE', NULL, 1, 1, NULL, 'Core:Users', 'Validate User', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.DENY', NULL, 1, 0, NULL, 'Core:Users', 'Deny User', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.DENY', NULL, 1, 1, NULL, 'Core:Users', 'Deny User', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.PSWD', NULL, 1, 1, NULL, 'Core:Users', 'Forgot Password', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.PSWD', NULL, 1, 0, NULL, 'Core:Users', 'Forgot Password', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.ADD.PENDING', NULL, 1, 0, NULL, 'Core:Users', 'Add Pending User', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.ADD.PENDING', NULL, 1, 1, NULL, 'Core:Users', 'Add Pending User', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD', NULL, 1, 0, NULL, 'Core:Category', 'Add Category', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD.PENDING', NULL, 1, 0, NULL, 'Core:Category', 'Add Pending Category', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD.PENDING', NULL, 1, 1, NULL, 'Core:Category', 'Add Pending Category', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'CATEGORY.ADD', NULL, 1, 1, NULL, 'Core:Category', 'Add Category', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'CATEGORY.APPROVE', NULL, 1, 0, NULL, 'Core:Category', 'Approve Category', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'CATEGORY.DENY', NULL, 1, 0, NULL, 'Core:Category', 'Deny Category', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.SUBSCRIBE', NULL, 1, 0, NULL, 'Core:Users', 'User subscribed', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.SUBSCRIBE', NULL, 1, 1, NULL, 'Core:Users', 'User subscribed', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.UNSUBSCRIBE', NULL, 1, 0, NULL, 'Core:Users', 'User unsubscribed', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.UNSUBSCRIBE', NULL, 1, 1, NULL, 'Core:Users', 'User unsubscribed', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.SUGGEST', NULL, 1, 0, NULL, 'Core:Users', 'Suggest to a friend', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.SUGGEST', NULL, 1, 1, NULL, 'Core:Users', 'Suggest to a friend', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.PSWDC', NULL, 1, 0, NULL, 'Core:Users', 'Password Confirmation', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRED', NULL, 1, 0, NULL, 'Core:Users', 'Membership expired', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRED', NULL, 1, 0, NULL, 'Core:Users', 'Membership expired', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRATION.NOTICE', NULL, 1, 0, NULL, 'Core:Users', 'Membership expiration notice', 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'USER.MEMBERSHIP.EXPIRATION.NOTICE', NULL, 1, 0, NULL, 'Core:Users', 'Membership expiration notice', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'COMMON.FOOTER', NULL, 1, 0, NULL, 'Core', 'Common Footer Template', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'FORM.SUBMITTED', NULL, 1, 0, NULL, 'Core:Category', 'This e-mail is sent to a user after filling in the Contact Us form', 1);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, FromUserId, Module, Description, Type) VALUES(DEFAULT, 'FORM.SUBMITTED', NULL, 1, 0, NULL, 'Core:Category', 'This e-mail is sent to a user after filling in the Contact Us form', 0);
INSERT INTO IdGenerator VALUES ('100');
Index: branches/5.1.x/core/units/email_events/email_events_event_handler.php
===================================================================
diff -u -N -r13140 -r13151
--- branches/5.1.x/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 13140)
+++ branches/5.1.x/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 13151)
@@ -1,6 +1,6 @@
Application->setUnitOption($event->Prefix, 'Fields', $fields);
- // make grid on "Email Events" tab in "Regional" section show columns of editable language, not admin language
- $language_id = $this->Application->GetVar('lang_id');
-
- if ($language_id) {
- $grids = $this->Application->getUnitOption($event->Prefix, 'Grids');
- // used by column picker to track column position
- $grids['Default']['Fields']['Description']['formatter_renamed'] = true;
- array_rename_key($grids['Default']['Fields'], 'Description', 'l' . $language_id . '_Description');
- $this->Application->setUnitOption($event->Prefix, 'Grids', $grids);
+ if ($this->Application->GetVar('regional')) {
+ $this->Application->setUnitOption($event->Prefix, 'PopulateMlFields', true);
}
}
+
+ /**
+ * Prepare temp tables and populate it
+ * with items selected in the grid
+ *
+ * @param kEvent $event
+ */
+ function OnEdit(&$event)
+ {
+ parent::OnEdit($event);
+
+ // use language from grid, instead of primary language used by default
+ $event->SetRedirectParam('m_lang', $this->Application->GetVar('m_lang'));
+ }
}
\ No newline at end of file
Index: branches/5.1.x/core/units/languages/languages_config.php
===================================================================
diff -u -N -r13140 -r13151
--- branches/5.1.x/core/units/languages/languages_config.php (.../languages_config.php) (revision 13140)
+++ branches/5.1.x/core/units/languages/languages_config.php (.../languages_config.php) (revision 13151)
@@ -1,6 +1,6 @@
TABLE_PREFIX.'Language',
- 'SubItems' => Array('phrases',/*'emailmessages'*/),
'FilterMenu' => Array(
'Groups' => Array(
Index: branches/5.1.x/core/admin_templates/regional/languages_edit_email_events.tpl
===================================================================
diff -u -N -r12657 -r13151
--- branches/5.1.x/core/admin_templates/regional/languages_edit_email_events.tpl (.../languages_edit_email_events.tpl) (revision 12657)
+++ branches/5.1.x/core/admin_templates/regional/languages_edit_email_events.tpl (.../languages_edit_email_events.tpl) (revision 13151)
@@ -12,6 +12,7 @@
function edit()
{
+ Application.SetVar('regional', 1);
std_edit_temp_item('emailevents', 'regional/email_messages_edit');
}
Index: branches/5.1.x/core/units/helpers/country_states_helper.php
===================================================================
diff -u -N -r13086 -r13151
--- branches/5.1.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 13086)
+++ branches/5.1.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 13151)
@@ -1,6 +1,6 @@
Application->GetVar('m_lang');
+
+ $sql = 'SELECT p.l' . $language_id . '_Translation as DestName, sd.DestAbbr
FROM ' . TABLE_PREFIX . 'StdDestinations AS sd
LEFT JOIN ' . TABLE_PREFIX . 'Phrase AS p ON p.Phrase = sd.DestName
- WHERE DestType = 2 AND DestParentId = ' . $country_id . ' AND LanguageId = ' . $this->Application->GetVar('m_lang') . '
- ORDER BY Translation';
-
+ WHERE DestType = 2 AND DestParentId = ' . $country_id . '
+ ORDER BY l' . $language_id . '_Translation';
$country_states[$country_abbr] = $this->Conn->GetCol($sql, 'DestAbbr');
}
@@ -72,18 +73,19 @@
*/
function CheckState($state_name, $country_code)
{
- if( !$this->CountryHasStates($country_code) ) return $state_name;
+ if (!$this->CountryHasStates($country_code)) {
+ return $state_name;
+ }
$sql = 'SELECT sdStates.DestAbbr
FROM '.TABLE_PREFIX.'StdDestinations AS sdStates
LEFT JOIN '.TABLE_PREFIX.'Phrase AS p ON p.Phrase = sdStates.DestName
LEFT JOIN '.TABLE_PREFIX.'StdDestinations AS sdCountries ON sdStates.DestParentId = sdCountries.DestId
WHERE (sdStates.DestType = 2) AND
(sdStates.DestParentId = sdCountries.DestId) AND
- (p.LanguageId = %1$s) AND
(sdCountries.DestAbbr = %2$s) AND
(
- (LOWER(sdStates.DestAbbr) = %3$s) OR (LOWER(sdStates.DestAbbr2) = %3$s) OR (LOWER(sdStates.DestName) = %3$s) OR (LOWER(p.Translation) = %3$s)
+ (LOWER(sdStates.DestAbbr) = %3$s) OR (LOWER(sdStates.DestAbbr2) = %3$s) OR (LOWER(sdStates.DestName) = %3$s) OR (LOWER(p.l%1$s_Translation) = %3$s)
)';
$state_name = trim( mb_strtolower($state_name) );
Index: branches/5.1.x/core/units/phrases/phrases_config.php
===================================================================
diff -u -N -r13086 -r13151
--- branches/5.1.x/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 13086)
+++ branches/5.1.x/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 13151)
@@ -1,6 +1,6 @@
'phrases',
- 'Clones' => Array (
- 'phrases-single' => Array (
- 'ForeignKey' => false,
- 'ParentTableKey' => false,
- 'ParentPrefix' => false,
-
- 'Sections' => Array (
- // "Phrases"
- 'in-portal:phrases' => Array (
- 'parent' => 'in-portal:site',
- 'icon' => 'phrases_labels',
- 'label' => 'la_title_Phrases',
- 'url' => Array ('t' => 'languages/phrase_list', 'pass' => 'm'),
- 'permissions' => Array ('view', 'add', 'edit', 'delete'),
-// 'perm_prefix' => 'lang',
- 'priority' => 4,
-// 'show_mode' => smSUPER_ADMIN,
- 'type' => stTREE,
- ),
- ),
- )
- ),
-
'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'),
@@ -67,54 +44,61 @@
'phrase_edit' => Array (
'prefixes' => Array ('phrases'), 'format' => '#phrases_status# #phrases_titlefield#',
'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
- ),
+ ),
// for separate phrases list
'phrases_list_st' => Array (
- 'prefixes' => Array ('phrases.st_List'), 'format' => "!la_title_Phrases!",
+ 'prefixes' => Array ('phrases_List'), 'format' => "!la_title_Phrases!",
'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'view', 'dbl-click'),
- ),
+ ),
'phrase_edit_single' => Array (
'prefixes' => Array ('phrases'), 'format' => '#phrases_status# #phrases_titlefield#',
'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
- ),
+ ),
),
+ 'Sections' => Array (
+ // "Phrases"
+ 'in-portal:phrases' => Array (
+ 'parent' => 'in-portal:site',
+ 'icon' => 'phrases_labels',
+ 'label' => 'la_title_Phrases',
+ 'url' => Array ('t' => 'languages/phrase_list', 'pass' => 'm'),
+ 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+// 'perm_prefix' => 'lang',
+ 'priority' => 4,
+// 'show_mode' => smSUPER_ADMIN,
+ 'type' => stTREE,
+ ),
+ ),
+
'FilterMenu' => Array (
'Groups' => Array (
Array ('mode' => 'AND', 'filters' => Array ('show_front', 'show_admin', 'show_both'), 'type' => WHERE_FILTER),
- Array ('mode' => 'AND', 'filters' => Array ('translated', 'not_translated'), 'type' => WHERE_FILTER),
+ Array ('mode' => 'AND', 'filters' => Array ('translated', 'not_translated'), 'type' => HAVING_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'),
's1' => Array (),
- 'translated' => Array ('label' => 'la_PhraseTranslated', 'on_sql' => '', 'off_sql' => '%1$s.Translation = pri.Translation'),
- 'not_translated' => Array ('label' => 'la_PhraseNotTranslated', 'on_sql' => '', 'off_sql' => '%1$s.Translation != pri.Translation'),
+ 'translated' => Array ('label' => 'la_PhraseTranslated', 'on_sql' => '', 'off_sql' => 'CurrentTranslation IS NULL'),
+ 'not_translated' => Array ('label' => 'la_PhraseNotTranslated', 'on_sql' => '', 'off_sql' => 'CurrentTranslation IS NOT NULL'),
)
),
'TableName' => TABLE_PREFIX . 'Phrase',
'CalculatedFields' => Array (
'' => Array (
- 'PrimaryTranslation' => 'pri.Translation',
+ 'PrimaryTranslation' => 'l%4$s_Translation',
+ 'CurrentTranslation' => 'l%5$s_Translation',
),
-
- 'st' => Array (
- 'PackName' => 'lang.PackName',
- ),
),
'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)',
- 'st' => 'SELECT %1$s.* %2$s
- FROM %1$s
- LEFT JOIN ' . TABLE_PREFIX . 'Language lang ON (%1$s.LanguageId = lang.LanguageId)',
+ '' => 'SELECT %1$s.* %2$s FROM %1$s',
),
'ListSortings' => Array (
@@ -123,60 +107,54 @@
)
),
- 'ForeignKey' => 'LanguageId',
- 'ParentTableKey' => 'LanguageId',
- 'ParentPrefix' => 'lang',
- 'AutoDelete' => true,
- 'AutoClone' => true,
-
'Fields' => Array (
+ 'PhraseId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Phrase' => Array (
'type' => 'string',
- 'required' => 1, 'unique' => Array ('LanguageId'),
+ 'required' => 1, 'unique' => Array (),
'not_null' => 1, 'default' => ''
),
'PhraseKey' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
- 'Translation' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'required' => 1, 'using_fck' => 1, 'default' => NULL),
+ 'Translation' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'required' => 1, 'using_fck' => 1, 'default' => NULL, 'db_type' => 'text'),
'PhraseType' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_PhraseType_Front', 1 => 'la_PhraseType_Admin', 2 => 'la_PhraseType_Both'), 'use_phrases' => 1,
'not_null' => 1, 'required' => 1, 'default' => 0
),
- 'PhraseId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
-
- 'LanguageId' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Language ORDER BY LocalName', 'option_key_field' => 'LanguageId', 'option_title_field' => 'LocalName',
- 'not_null' => 1, 'default' => 0
- ),
-
'LastChanged' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL),
'LastChangeIP' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'Module' => Array (
'type' => 'string',
'formatter' => 'kOptionsFormatter', 'options' => Array ('' => ''), 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Modules WHERE (Loaded = 1) AND (Name <> "In-Portal") ORDER BY LoadOrder', 'option_key_field' => 'Name', 'option_title_field' => 'Name',
- 'not_null' => 1, 'default' => 'Core'
+ 'not_null' => 1, 'required' => 1, 'default' => 'Core'
),
),
'VirtualFields' => Array (
'PrimaryTranslation' => Array ('type' => 'string', 'default' => ''),
+ 'CurrentTranslation' => Array ('type' => 'string', 'default' => ''),
+
+ // for language pack import/export
'LangFile' => Array (
'type' => 'string',
'formatter' => 'kUploadFormatter',
'max_size' => MAX_UPLOAD_SIZE, 'upload_dir' => WRITEBALE_BASE . '/',
'max_len' => 255, 'default' => ''
),
- 'ImportOverwrite' => Array ('type' => 'int', 'default' => 0),
- 'DoNotEncode' => Array (),
- 'PackName' => Array (
- 'type' => 'string',
- 'formatter' => 'kOptionsFormatter',
- 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Language ORDER BY PackName', 'option_title_field' => 'PackName', 'option_key_field' => 'PackName',
+ 'ImportOverwrite' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
+ 'default' => 0
),
+ 'DoNotEncode' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
+ 'default' => 0
+ ),
),
'Grids' => Array (
+ // used on "Phrases" tab in language editing in "Regional" section
'Default' => Array (
'Icons' => Array (
'default' => 'icon16_item.png',
@@ -186,14 +164,15 @@
'Fields' => Array (
'PhraseId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 50),
'Phrase' => Array ('title' => 'la_col_Label', 'data_block' => 'grid_checkbox_td', 'width' => 200),
- 'Translation' => Array ('title' => 'la_col_Phrase', 'width' => 200),
+ 'CurrentTranslation' => Array ('title' => 'la_col_Phrase', 'width' => 200),
'PrimaryTranslation' => Array ('title' => 'la_col_PrimaryValue', 'width' => 200),
'PhraseType' => Array ('title' => 'la_col_PhraseType', 'filter_block' => 'grid_options_filter', 'width' => 60),
'LastChanged' => Array ('title' => 'la_col_Modified', 'filter_block' => 'grid_date_range_filter', 'width' => 150),
'Module' => Array ('title' => 'la_col_Module', 'filter_block' => 'grid_options_filter', 'width' => 100),
),
),
+ // used on "Labels & Phrases" section
'Phrases' => Array (
'Icons' => Array (
'default' => 'icon16_item.png',
@@ -203,8 +182,7 @@
'Fields' => Array (
'PhraseId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 50),
'Phrase' => Array ('title' => 'la_col_Label', 'filter_block' => 'grid_like_filter', 'width' => 170),
- 'Translation' => Array ('title' => 'la_col_Phrase', 'filter_block' => 'grid_like_filter', 'width' => 180),
- 'PackName' => Array ('title' => 'la_col_Language', 'filter_block' => 'grid_options_filter', 'width' => 95),
+ 'CurrentTranslation' => Array ('title' => 'la_col_Phrase', 'filter_block' => 'grid_like_filter', 'width' => 180),
'PhraseType' => Array ('title' => 'la_col_Location', 'filter_block' => 'grid_options_filter', 'width' => 80),
'LastChanged' => Array ('title' => 'la_col_Modified', 'filter_block' => 'grid_date_range_filter', 'width' => 145),
'Module' => Array ('title' => 'la_col_Module', 'filter_block' => 'grid_options_filter', 'width' => 100),
Index: branches/5.1.x/core/units/users/users_config.php
===================================================================
diff -u -N -r13086 -r13151
--- branches/5.1.x/core/units/users/users_config.php (.../users_config.php) (revision 13086)
+++ branches/5.1.x/core/units/users/users_config.php (.../users_config.php) (revision 13151)
@@ -1,6 +1,6 @@
Array('type' => 'string', 'default' => null),
'Street2' => Array('type' => 'string', 'not_null' => '1', 'default' => ''),
'City' => Array('type' => 'string','default' => null),
- 'State' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter',
- 'options' => Array(),
- 'option_key_field'=>'DestAbbr','option_title_field'=>'Translation',
- 'not_null' => '1','default' => ''),
+ 'State' => Array(
+ 'type' => 'string',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array(),
+ 'not_null' => 1,
+ 'default' => ''
+ ),
'Zip' => Array('type' => 'string','default' => null),
- 'Country' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter',
- 'options_sql'=>'SELECT %1$s
- FROM '.TABLE_PREFIX.'StdDestinations
- LEFT JOIN '.TABLE_PREFIX.'Phrase
- ON '.TABLE_PREFIX.'Phrase.Phrase = '.TABLE_PREFIX.'StdDestinations.DestName
- WHERE
- DestType=1
- AND
- LanguageId = %2$s
- ORDER BY Translation',
- 'option_key_field'=>'DestAbbr','option_title_field'=>'Translation',
- 'not_null' => '1','default' => ''),
+ 'Country' => Array(
+ 'type' => 'string',
+ 'formatter' => 'kOptionsFormatter',
+ 'options_sql' => ' SELECT %1$s
+ FROM '.TABLE_PREFIX.'StdDestinations
+ LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = '.TABLE_PREFIX.'StdDestinations.DestName
+ WHERE DestType = 1
+ ORDER BY l%2$s_Translation',
+ 'option_key_field' => 'DestAbbr', 'option_title_field' => 'l%2$s_Translation',
+ 'not_null' => 1, 'default' => ''
+ ),
'ResourceId' => Array('type' => 'int','not_null' => 1, 'default' => 0),
'Status' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array(1=>'la_Enabled', 0=>'la_Disabled', 2=>'la_Pending'), 'use_phrases'=>1, 'not_null' => '1','default' => 1),
'Modified' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
Index: branches/5.1.x/core/install/upgrades.sql
===================================================================
diff -u -N -r13140 -r13151
--- branches/5.1.x/core/install/upgrades.sql (.../upgrades.sql) (revision 13140)
+++ branches/5.1.x/core/install/upgrades.sql (.../upgrades.sql) (revision 13151)
@@ -1636,12 +1636,17 @@
FROM <%TABLE_PREFIX%>Permissions
WHERE Permission = 'in-portal:configemail.edit';
+ALTER TABLE Events ADD l1_Description text;
+
UPDATE Events e
SET e.l1_Description = (
SELECT p.Translation
FROM <%TABLE_PREFIX%>Phrase p
WHERE (p.Phrase = e.Description) AND (p.LanguageId = 1)
);
-ALTER TABLE Events DROP Description;
+UPDATE Events SET Description = l1_Description;
+ALTER TABLE Events DROP l1_Description;
+
DELETE FROM Phrase WHERE Phrase LIKE 'la_event_%';
+DELETE FROM PersistantSessionData WHERE VariableName = 'phrases_columns_.';
Index: branches/5.1.x/core/admin_templates/languages/phrase_list.tpl
===================================================================
diff -u -N -r13086 -r13151
--- branches/5.1.x/core/admin_templates/languages/phrase_list.tpl (.../phrase_list.tpl) (revision 13086)
+++ branches/5.1.x/core/admin_templates/languages/phrase_list.tpl (.../phrase_list.tpl) (revision 13151)
@@ -1,5 +1,5 @@
-
+
-
+
\ No newline at end of file