Permalink
Browse files

Merge branch '6.2.3' into stable

  • Loading branch information...
2 parents 4420acb + e4db235 commit 144775bc9492ddce395bb93c2dea5ff3bc78a2b4 @jstanden jstanden committed Jan 31, 2013
@@ -46,8 +46,8 @@
* - Jeff Standen, Darren Sugita, Dan Hildebrandt, Scott Luther
* WEBGROUP MEDIA LLC. - Developers of Cerberus Helpdesk
*/
-define("APP_BUILD", 2013012102);
-define("APP_VERSION", '6.2.2');
+define("APP_BUILD", 2013012901);
+define("APP_VERSION", '6.2.3');
define("APP_MAIL_PATH", APP_STORAGE_PATH . '/mail/');
View
@@ -168,7 +168,7 @@ private function _parseHeadersSubject() {
$subject = str_replace(array("\t","\n","\r")," ",$subject);
// The subject can still end up empty after QP decode
- if(empty($subject))
+ if(0 == strlen(trim($subject)))
$subject = "(no subject)";
$this->_subject = $subject;
@@ -471,6 +471,7 @@ function getContext($bucket, &$token_labels, &$token_values, $prefix=null) {
$token_values['_label'] = $bucket->name;
$token_values['id'] = $bucket->id;
$token_values['name'] = $bucket->name;
+ $token_values['reply_address_id'] = $bucket->reply_address_id;
// URL
//$url_writer = DevblocksPlatform::getUrlService();
@@ -1164,6 +1164,7 @@ function getContext($group, &$token_labels, &$token_values, $prefix=null) {
$token_values['_label'] = $group->name;
$token_values['id'] = $group->id;
$token_values['name'] = $group->name;
+ $token_values['reply_address_id'] = $group->reply_address_id;
// URL
$url_writer = DevblocksPlatform::getUrlService();
@@ -758,7 +758,11 @@ function renderActionExtension($token, $trigger, $params=array(), $seq=null) {
break;
case 'send_email':
- DevblocksEventHelper::renderActionSendEmail($trigger);
+ $placeholders = array(
+ 'ticket_bucket_reply_address_id,group_reply_address_id' => 'Ticket Bucket',
+ );
+
+ DevblocksEventHelper::renderActionSendEmail($trigger, $placeholders);
break;
case 'send_email_recipients':
@@ -468,11 +468,12 @@ function showGeneralTabAction() {
$worker = CerberusApplication::getActiveWorker();
$tpl->assign('worker', $worker);
- // [TODO] WorkerPrefs_*?
$prefs = array();
$prefs['assist_mode'] = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
$prefs['keyboard_shortcuts'] = intval(DAO_WorkerPref::get($worker->id, 'keyboard_shortcuts', 1));
$prefs['mail_always_show_all'] = DAO_WorkerPref::get($worker->id,'mail_always_show_all',0);
+ $prefs['mail_reply_textbox_size_inelastic'] = DAO_WorkerPref::get($worker->id,'mail_reply_textbox_size_inelastic',0);
+ $prefs['mail_reply_textbox_size_px'] = DAO_WorkerPref::get($worker->id,'mail_reply_textbox_size_px',300);
$prefs['mail_reply_button'] = DAO_WorkerPref::get($worker->id,'mail_reply_button',0);
$prefs['mail_status_compose'] = DAO_WorkerPref::get($worker->id,'compose.status','waiting');
$prefs['mail_status_reply'] = DAO_WorkerPref::get($worker->id,'mail_status_reply','waiting');
@@ -587,6 +588,12 @@ function saveDefaultsAction() {
@$mail_always_show_all = DevblocksPlatform::importGPC($_REQUEST['mail_always_show_all'],'integer',0);
DAO_WorkerPref::set($worker->id, 'mail_always_show_all', $mail_always_show_all);
+ @$mail_reply_textbox_size_px = DevblocksPlatform::importGPC($_REQUEST['mail_reply_textbox_size_px'],'integer',0);
+ DAO_WorkerPref::set($worker->id, 'mail_reply_textbox_size_px', max(100, min(2000, $mail_reply_textbox_size_px)));
+
+ @$mail_reply_textbox_size_inelastic = DevblocksPlatform::importGPC($_REQUEST['mail_reply_textbox_size_inelastic'],'integer',0);
+ DAO_WorkerPref::set($worker->id, 'mail_reply_textbox_size_inelastic', $mail_reply_textbox_size_inelastic);
+
@$mail_reply_button = DevblocksPlatform::importGPC($_REQUEST['mail_reply_button'],'integer',0);
DAO_WorkerPref::set($worker->id, 'mail_reply_button', $mail_reply_button);
@@ -1939,6 +1939,15 @@ For example: *receipt*</seg></tuv>
<tu tuid='preferences.account.mail.readall'>
<tuv xml:lang="en_US"><seg>Always use 'read all' mode (expand messages and sort chronologically)</seg></tuv>
</tu>
+ <tu tuid='preferences.account.mail.reply_textbox_size'>
+ <tuv xml:lang="en_US"><seg>While replying:</seg></tuv>
+ </tu>
+ <tu tuid='preferences.account.mail.reply_textbox_size.inelastic'>
+ <tuv xml:lang="en_US"><seg>Don't automatically grow the text box as I type</seg></tuv>
+ </tu>
+ <tu tuid='preferences.account.mail.reply_textbox_size.pixels'>
+ <tuv xml:lang="en_US"><seg>Set the initial text box height to </seg></tuv>
+ </tu>
<tu tuid='preferences.account.mail.reply_button'>
<tuv xml:lang="en_US"><seg>When I click the reply button:</seg></tuv>
</tu>
@@ -115,9 +115,11 @@
<input type="hidden" name="subject" value="{if !empty($draft)}{$draft->params.subject}{else}{if $is_forward}Fwd: {/if}{$ticket->subject}{/if}">
{$message_content = $message->getContent()}
+{$mail_reply_textbox_size_inelastic = DAO_WorkerPref::get($active_worker->id, 'mail_reply_textbox_size_inelastic', 0)}
+{$mail_reply_textbox_size_px = DAO_WorkerPref::get($active_worker->id, 'mail_reply_textbox_size_px', 300)}
{if $is_forward}
-<textarea name="content" rows="20" cols="80" id="reply_{$message->id}" class="reply" style="width:98%;border:1px solid rgb(180,180,180);padding:5px;">
+<textarea name="content" id="reply_{$message->id}" class="reply" style="width:98%;height:{$mail_reply_textbox_size_px|default:300}px;border:1px solid rgb(180,180,180);padding:5px;">
{if !empty($draft)}{$draft->body}{else}
{if !empty($signature)}
@@ -135,7 +137,7 @@
{/if}
</textarea>
{else}
-<textarea name="content" rows="20" cols="80" id="reply_{$message->id}" class="reply" style="width:98%;border:1px solid rgb(180,180,180);padding:5px;">
+<textarea name="content" id="reply_{$message->id}" class="reply" style="width:98%;height:{$mail_reply_textbox_size_px|default:300}px;border:1px solid rgb(180,180,180);padding:5px;">
{if !empty($draft)}{$draft->body}{else}
{if !empty($signature) && 1==$signature_pos}
@@ -302,7 +304,11 @@
$('#reply{$message->id}_suggested').appendTo($(this).closest('td'));
});
- var $content = $('#reply_{$message->id}').elastic();
+ var $content = $('#reply_{$message->id}');
+
+ {if empty($mail_reply_textbox_size_inelastic)}
+ $content.elastic();
+ {/if}
// Insert suggested on click
$('#reply{$message->id}_suggested').find('a.suggested').click(function(e) {
@@ -1,3 +1,26 @@
+<b>{'message.header.from'|devblocks_translate|capitalize}:</b>
+<div style="margin-left:10px;margin-bottom:0.5em;">
+ <select name="{$namePrefix}[from_address_id]">
+ <option value="0">(default)</option>
+ <optgroup label="Reply-to Addresses">
+ {foreach from=$replyto_addresses key=address_id item=replyto}
+ {if !empty($replyto->reply_personal)}
+ <option value="{$address_id}" {if $params.from_address_id==$address_id}selected="selected"{/if}>{if !empty($replyto->reply_personal)}{$replyto->reply_personal} {/if}&lt;{$replyto->email}&gt;</option>
+ {else}
+ <option value="{$address_id}" {if $params.from_address_id==$address_id}selected="selected"{/if}>{$replyto->email}</option>
+ {/if}
+ {/foreach}
+ </optgroup>
+ {if !empty($placeholders)}
+ <optgroup label="Placeholders">
+ {foreach from=$placeholders item=label key=placeholder}
+ <option value="{$placeholder}">{$label}</option>
+ {/foreach}
+ </optgroup>
+ {/if}
+ </select>
+</div>
+
<b>{'message.header.to'|devblocks_translate|capitalize}:</b>
<div style="margin-left:10px;margin-bottom:0.5em;">
<input type="text" name="{$namePrefix}[to]" value="{$params.to}" size="45" style="width:100%;" class="placeholders">
@@ -44,6 +44,14 @@
<label><input type="radio" name="mail_reply_button" value="1" {if 1==$prefs.mail_reply_button}checked="checked"{/if}> {'display.reply.no_quote'|devblocks_translate}</label><br>
</div>
+ <b>{'preferences.account.mail.reply_textbox_size'|devblocks_translate}</b>
+ <div style="margin:0px 0px 10px 10px;">
+ {$translate->_('preferences.account.mail.reply_textbox_size.pixels')} <input type="text" name="mail_reply_textbox_size_px" size="4" maxlength=4" value="{$prefs.mail_reply_textbox_size_px|default:'500'}" onfocus="$(this).prev().find('input:radio').click();"> pixels<br>
+ <div style="margin:0px 0px 10px 10px;">
+ <label><input type="checkbox" name="mail_reply_textbox_size_inelastic" value="1" {if !empty($prefs.mail_reply_textbox_size_inelastic)}checked{/if}> {$translate->_('preferences.account.mail.reply_textbox_size.inelastic')}</label><br>
+ </div>
+ </div>
+
<b>{'preferences.account.mail.signature'|devblocks_translate}</b>
<div style="margin:0px 0px 10px 10px;">
<label><input type="radio" name="mail_signature_pos" value="0" {if empty($prefs.mail_signature_pos)}checked="checked"{/if}> {'preferences.account.mail.signature.none'|devblocks_translate}</label><br>
@@ -77,7 +77,7 @@
{* This is used in two places depending on if the row is one or two lines *}
{capture name="ticket_subject_content"}
{if $result.t_is_deleted}<span class="cerb-sprite2 sprite-cross-circle-gray"></span> {elseif $result.t_is_closed}<span class="cerb-sprite2 sprite-tick-circle-gray" title="{$translate->_('status.closed')}"></span> {elseif $result.t_is_waiting}<span class="cerb-sprite sprite-clock"></span>{/if}
- <a href="{devblocks_url}c=profiles&type=ticket&id={$result.t_mask}{/devblocks_url}" class="subject">{$result.t_subject}</a>
+ <a href="{devblocks_url}c=profiles&type=ticket&id={$result.t_mask}{/devblocks_url}" class="subject">{$result.t_subject|default:'(no subject)'}</a>
<button type="button" class="peek" style="visibility:hidden;padding:1px;margin:0px 5px;" onclick="genericAjaxPopup('peek','c=internal&a=showPeekPopup&context={$view_context}&context_id={$result.t_id}&view_id={$view->id}', null, false, '650');"><span class="cerb-sprite2 sprite-document-search-result" style="margin-left:2px" title="{$translate->_('views.peek')}"></span></button>
{/capture}
@@ -286,7 +286,7 @@ public function writeResponse(DevblocksHttpResponse $response) {
$tpl->assign('module', $controller);
$tpl->assign('module_response', new DevblocksHttpResponse($stack));
- $tpl->display('devblocks:cerberusweb.support_center:portal_'.ChPortalHelper::getCode() . ":support_center/index.tpl");
+ $tpl->display('devblocks:cerberusweb.support_center:portal_' . ChPortalHelper::getCode() . ':support_center/index.tpl');
break;
}
}
@@ -42,7 +42,7 @@
<!-- Sidebar -->
{if !empty($module) && method_exists($module,'renderSidebar')}
{$module->renderSidebar($module_response)}
- {/if}
+ {/if}
</td>
<td width="99%" valign="top">
@@ -2004,13 +2004,21 @@ static function runActionCreateTicket($params, DevblocksDictionaryDelegate $dict
* Action: Send Email
*/
- static function renderActionSendEmail($trigger) {
+ static function renderActionSendEmail($trigger, $placeholders=array()) {
$tpl = DevblocksPlatform::getTemplateService();
+ $replyto_default = DAO_AddressOutgoing::getDefault();
+ $tpl->assign('replyto_default', $replyto_default);
+
+ $replyto_addresses = DAO_AddressOutgoing::getAll();
+ $tpl->assign('replyto_addresses', $replyto_addresses);
+
$event = $trigger->getEvent();
$values_to_contexts = $event->getValuesContexts($trigger);
$tpl->assign('values_to_contexts', $values_to_contexts);
+ $tpl->assign('placeholders', $placeholders);
+
$tpl->display('devblocks:cerberusweb.core::internal/decisions/actions/_send_email.tpl');
}
@@ -2049,6 +2057,38 @@ static function simulateActionSendEmail($params, DevblocksDictionaryDelegate $di
$to[] = $addy->email;
}
}
+
+ $replyto_addresses = DAO_AddressOutgoing::getAll();
+ $replyto_default = DAO_AddressOutgoing::getDefault();
+
+ if(empty($replyto_default))
+ return "[ERROR] There is no default reply-to address. Please configure one from Setup->Mail";
+
+ @$from_address_id = $params['from_address_id'];
+
+ if(!is_numeric($from_address_id) || false !== strpos($from_address_id, ',')) {
+ $from_address_id = 0;
+ $from_placeholders = DevblocksPlatform::parseCsvString($params['from_address_id']);
+
+ foreach($from_placeholders as $from_placeholder) {
+ if(!empty($from_address_id))
+ continue;
+
+ if(isset($dict->$from_placeholder)) {
+ $possible_from_id = $dict->$from_placeholder;
+
+ if(isset($replyto_addresses[$possible_from_id]))
+ $from_address_id = $possible_from_id;
+ }
+ }
+ }
+
+ if(empty($from_address_id))
+ $from_address_id = $replyto_default->address_id;
+
+ if(!isset($replyto_addresses[$from_address_id])) {
+ return "[ERROR] The 'from' address is invalid.";
+ }
if(empty($to)) {
return "[ERROR] The 'to' field has no recipients.";
@@ -2064,14 +2104,14 @@ static function simulateActionSendEmail($params, DevblocksDictionaryDelegate $di
return "[ERROR] The 'content' field has invalid placeholders.";
}
- // [TODO] Simulate 'From:'
-
$out = sprintf(">>> Sending email\n".
"To: %s\n".
+ "From: %s\n".
"Subject: %s\n".
"\n".
"%s\n",
implode(",\n ", $to),
+ $replyto_addresses[$from_address_id]->email,
$subject,
$content
);
@@ -2086,6 +2126,23 @@ static function runActionSendEmail($params, DevblocksDictionaryDelegate $dict) {
@$to_vars = @$params['to_var'];
$to = array();
+ // From
+
+ $replyto_addresses = DAO_AddressOutgoing::getAll();
+ $replyto_default = DAO_AddressOutgoing::getDefault();
+
+ if(empty($replyto_default))
+ return;
+
+ @$from_address_id = $params['from_address_id'];
+
+ if(empty($from_address_id))
+ $from_address_id = $replyto_default->address_id;
+
+ if(!isset($replyto_addresses[$from_address_id]))
+ return;
+
+
// To
if(isset($params['to']) && !empty($params['to'])) {
@@ -2123,7 +2180,9 @@ static function runActionSendEmail($params, DevblocksDictionaryDelegate $dict) {
CerberusMail::quickSend(
implode(', ', $to),
$subject,
- $content
+ $content,
+ $replyto_addresses[$from_address_id]->email,
+ $replyto_addresses[$from_address_id]->reply_personal
);
}
@@ -123,6 +123,7 @@
}
+ $textarea.css({'overflow':'auto'});
}
// Hide scrollbars

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 144775b

Please sign in to comment.