Index: branches/5.2.x/core/units/email_events/email_events_event_handler.php
===================================================================
diff -u -r15065 -r15116
--- branches/5.2.x/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 15065)
+++ branches/5.2.x/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 15116)
@@ -1,6 +1,6 @@
Array ('self' => 'edit'),
'OnSaveSelected' => Array ('self' => 'view'),
'OnProcessEmailQueue' => Array ('self' => 'add|edit'),
+ 'OnExportEmailEvents' => Array ('self' => 'view'),
'OnSuggestAddress' => Array ('self' => 'add|edit'),
@@ -1044,9 +1045,36 @@
$object->SetDBField('ReplacementTags', $replacement_tags ? serialize($replacement_tags) : NULL);
}
+
+ if ( $this->translationChanged($object) ) {
+ $object->SetDBField('LastChanged_date', TIMENOW);
+ $object->SetDBField('LastChanged_time', TIMENOW);
+ }
}
/**
+ * Checks, that at least one of phrase's translations was changed
+ *
+ * @param kDBItem $object
+ * @return bool
+ */
+ function translationChanged(&$object)
+ {
+ $changed_fields = array_keys( $object->GetChangedFields() );
+ $translation_fields = Array ('Subject', 'Body');
+
+ foreach ($changed_fields as $changed_field) {
+ $changed_field = preg_replace('/^l[\d]+_/', '', $changed_field);
+
+ if ( in_array($changed_field, $translation_fields) ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Validates address using given field prefix
*
* @param kEvent $event
@@ -1213,4 +1241,32 @@
$object->SetError($field, 'parsing_error');
}
}
+
+ /**
+ * Stores ids of selected phrases and redirects to export language step 1
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnExportEmailEvents(kEvent &$event)
+ {
+ if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) ) {
+ $event->status = kEvent::erFAIL;
+ return;
+ }
+
+ $this->Application->setUnitOption('phrases', 'AutoLoad', false);
+
+ $this->StoreSelectedIDs($event);
+ $this->Application->StoreVar('export_language_ids', $this->Application->GetVar('m_lang'));
+
+ $event->setRedirectParams(
+ Array (
+ 'phrases.export_event' => 'OnNew',
+ 'pass' => 'all,phrases.export',
+ 'export_mode' => $event->Prefix,
+ )
+ );
+ }
}
\ No newline at end of file
Index: branches/5.2.x/core/units/helpers/language_import_helper.php
===================================================================
diff -u -r15012 -r15116
--- branches/5.2.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 15012)
+++ branches/5.2.x/core/units/helpers/language_import_helper.php (.../language_import_helper.php) (revision 15116)
@@ -1,6 +1,6 @@
getExportIDs($prefix);
+
+ $sql = 'SELECT ' . $key_field . '
+ FROM ' . $this->Application->getUnitOption($prefix, 'TableName') . '
+ WHERE ' . $this->Application->getUnitOption($prefix, 'IDField') . ' IN (' . $ids . ')';
+ $rs = $this->Conn->QueryRaw($sql);
+
+ if ( $this->Conn->RowCount($rs) ) {
+ $data = '';
+
+ while ( ($row = $this->Conn->GetNextRow($rs)) ) {
+ $data .= ',' . $row[$key_field];
+ }
+
+ $data = substr($data, 1);
+ }
+
+ $this->Conn->Destroy($rs);
}
- if (!is_array($email_events)) {
- $email_events = str_replace(',', "\n", $email_events);
- $email_events = preg_replace("/\n+/", "\n", str_replace("\r", '', trim($email_events)));
- $email_events = $email_events ? array_map('trim', explode("\n", $email_events)) : Array ();
+ if ( !is_array($data) ) {
+ $data = str_replace(',', "\n", $data);
+ $data = preg_replace("/\n+/", "\n", str_replace("\r", '', trim($data)));
+ $data = $data ? array_map('trim', explode("\n", $data)) : Array ();
}
- $this->_exportLimits = Array ('phrases' => $phrases, 'emailevents' => $email_events);
+ $this->_exportLimits[$prefix] = $data;
}
/**
@@ -1101,4 +1117,48 @@
return array_key_exists($country_id . '-' . $state_iso, $cache) ? $cache[$country_id . '-' . $state_iso] : false;
}
+
+ /**
+ * Returns comma-separated list of IDs, that will be exported
+ *
+ * @param string $prefix
+ * @return string
+ * @access public
+ */
+ public function getExportIDs($prefix)
+ {
+ $ids = $this->Application->RecallVar($prefix . '_selected_ids');
+
+ if ( $ids ) {
+ // some records were selected in grid
+ return $ids;
+ }
+
+ $tag_params = Array (
+ 'grid' => $prefix == 'phrases' ? 'Phrases' : 'Emails',
+ 'skip_counting' => 1,
+ 'per_page' => -1
+ );
+
+ $list =& $this->Application->recallObject($prefix, $prefix . '_List', $tag_params);
+ /* @var $list kDBList */
+
+ $sql = $list->getCountSQL($list->GetSelectSQL());
+ $sql = str_replace('COUNT(*) AS count', $list->TableName . '.' . $list->IDField, $sql);
+
+ $ids = '';
+ $rs = $this->Conn->QueryRaw($sql);
+
+ if ( $this->Conn->RowCount($rs) ) {
+ while ( ($row = $this->Conn->GetNextRow($rs)) ) {
+ $ids .= ',' . $row[$list->IDField];
+ }
+
+ $ids = substr($ids, 1);
+ }
+
+ $this->Conn->Destroy($rs);
+
+ return $ids;
+ }
}
\ No newline at end of file
Index: branches/5.2.x/core/admin_templates/languages/email_message_list.tpl
===================================================================
diff -u -r14244 -r15116
--- branches/5.2.x/core/admin_templates/languages/email_message_list.tpl (.../email_message_list.tpl) (revision 14244)
+++ branches/5.2.x/core/admin_templates/languages/email_message_list.tpl (.../email_message_list.tpl) (revision 15116)
@@ -15,85 +15,48 @@
a_toolbar = new ToolBar();
- id=" |
- - - | -
- |
-
- |
-
+ id=" |
+ + + | +
+ |
+
+ |
+
-
-
- +
+
+
+ |
- - + table#modules td, table#modules th { + border: 1px solid black; + padding: 3px; + } + - |
+
- | Index: branches/5.2.x/admin/system_presets/simple/email_events_emailevents.php =================================================================== diff -u -r14244 -r15116 --- branches/5.2.x/admin/system_presets/simple/email_events_emailevents.php (.../email_events_emailevents.php) (revision 14244) +++ branches/5.2.x/admin/system_presets/simple/email_events_emailevents.php (.../email_events_emailevents.php) (revision 15116) @@ -15,7 +15,7 @@ // toolbar buttons $remove_buttons = Array ( // list of all email templates -// 'email_message_list' => Array ('new_item', 'edit', 'delete', 'approve', 'decline', 'frontend_mail', 'view', 'dbl-click'), + 'email_message_list' => Array (/*'new_item', 'edit', 'delete', 'approve', 'decline', 'frontend_mail', 'view',*/ 'export', /*'dbl-click'*/), // edit email edit - general tab // 'email_message_edit' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'), @@ -59,6 +59,6 @@ // hide columns in grids $hide_columns = Array ( -// 'Default' => Array ('EventId', 'Description', 'Event', 'Module', 'Type', 'Enabled'), -// 'Emails' => Array ('EventId', 'Event', 'Subject', 'Description', 'Type', 'Enabled', 'Module', 'FrontEndOnly'), +// 'Default' => Array ('EventId', 'Description', 'Event', 'Module', 'Type', 'Enabled', 'LastChanged'), +// 'Emails' => Array ('EventId', 'Event', 'Subject', 'Description', 'Type', 'Enabled', 'Module', 'FrontEndOnly', 'LastChanged'), ); \ No newline at end of file