Complete the missing "by date" option in mail app->sieve_rules->vacation

This commit is contained in:
Hadi Nategh 2013-10-16 11:22:53 +00:00
parent d1a2b89815
commit e5aa8a4873
3 changed files with 50 additions and 26 deletions

View File

@ -448,11 +448,6 @@ class mail_sieve
die('You should not be here!');
}
if ($this->timed_vacation)
{
include_once(EGW_API_INC.'/class.jscalendar.inc.php');
$jscal = new jscalendar();
}
if($this->bosieve->getScript($this->scriptName))
{
if(PEAR::isError($error = $this->bosieve->retrieveRules($this->scriptName)) )
@ -532,12 +527,14 @@ class mail_sieve
if ($this->mailbo->icServer->enableSieve)
{
$vacRules = $this->getVacation($vacation,$msg);
if ($this->timed_vacation)
{
include_once(EGW_API_INC.'/class.jscalendar.inc.php');
$ByDate = array('by_date' => lang('By date'));
}
if (!is_array($content))
{
$content = $vacation = $vacRules['vacation'];
//$content['addresses'] = array_merge($vacRules['allAlliances'],$content['addresses']);
//$vacRules['predefinedAddresses'] = array_merge($content['addresses'],$vacRules['predefinedAddresses']);
if (empty($vacation['addresses'])) $content['addresses']='';
if (!empty($vacation['forwards']))
{
@ -572,7 +569,6 @@ class mail_sieve
{
//error_log(__METHOD__. 'content:' . array2string($content));
$newVacation = $content;
$newVacation ['status'] = $content ['status'];
if (empty($preferences->preferences['prefpreventforwarding']) ||
$preferences->preferences['prefpreventforwarding'] == 0 )
{
@ -597,13 +593,11 @@ class mail_sieve
if ($content['addresses'])
{
$newVacation ['addresses'] = $content['addresses'];
error_log(__METHOD__. '() Respond addresses :'. __LINE__. array2string($content['addresses']));
}
else
{
}
//_debug_array($newVacation);
if($this->checkRule($newVacation,$checkAddresses))
{
@ -614,7 +608,6 @@ class mail_sieve
}
else
{
//error_log(__METHOD__.__LINE__.array2string($newVacation));
if (!isset($newVacation['scriptName']) || empty($newVacation['scriptName'])) $newVacation['scriptName'] = $this->scriptName;
$this->bosieve->setAsyncJob($newVacation);
$msg = lang('Vacation notice sucessfully updated.');
@ -641,9 +634,11 @@ class mail_sieve
),
'addresses' => array_combine($vacRules['aliases'],$vacRules['aliases']),
);
if (!empty($ByDate))
{
$sel_options['status'] += $ByDate;
}
$content['msg'] = $msg;
error_log(__METHOD__. '() sel_option ' . array2string($sel_options));
}
else
{
@ -797,7 +792,7 @@ class mail_sieve
'data' => $data,
'DOMNodeID' => 'mail-sieve-index'
));
error_log(__METHOD__. "RESPONSE".array2string($response));
//error_log(__METHOD__. "RESPONSE".array2string($response));
}
/**

View File

@ -127,6 +127,11 @@ app.mail = AppJS.extend(
//alert('resizing to'+(w_h[0]?w_h[0]:870)+','+(w_h[1]?w_h[1]:egw_getWindowOuterHeight()));
window.resizeTo((w_h[0]?w_h[0]:870),(w_h[1]?w_h[1]:(screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight())));
}
//Vacation By_date filter
if (typeof et2.templates['mail.sieve.vacation'] != 'undefined')
{
this.vacationFilterStatusChange();
}
},
/**
@ -1119,7 +1124,7 @@ app.mail = AppJS.extend(
/**
* User clicked an address (FROM, TO, etc)
*
*
* @param object tag_info with values for attributes id, label, title, ...
* @param et2_taglist widget
*/
@ -1566,7 +1571,7 @@ app.mail = AppJS.extend(
{
this.et2_obj.submit();
},
/**
* Focus handler for folder, address, reject textbox/taglist to automatic check associated radio button
*/
@ -1587,6 +1592,25 @@ app.mail = AppJS.extend(
//addr.set_autocomplete_url('mail.mail_compose.ajax_searchAddress');
},
/**
* Disable/Enable date widgets on vacation seive rules form when status is "by_date"
*
*/
vacationFilterStatusChange: function()
{
var status = this.et2.getWidgetById('status');
var s_date = this.et2.getWidgetById('start_date');
var e_date = this.et2.getWidgetById('end_date');
var by_date_label = this.et2.getWidgetById('by_date_label');
if (status && s_date && e_date && by_date_label)
{
s_date.set_disabled(status.get_value() != "by_date");
e_date.set_disabled(status.get_value() != "by_date");
by_date_label.set_disabled(status.get_value() != "by_date");
}
},
/**
* action - handling actions on sieve rules
*

View File

@ -20,26 +20,31 @@
<description value="Status:"/>
<hbox>
<menulist>
<menupopup id="status"/>
<menupopup id="status" onchange='app.mail.vacationFilterStatusChange'/>
</menulist>
<date id="start_date"/>
<date id="end_date" />
</hbox>
</row>
<row>
<description value="Respond to mail sent to:"/>
<hbox>
<vbox>
<taglist-email id="addresses" width="40%" allowFreeEntries="true" />
<button class="$cont[hideIfSieveDisabled]" label="Add all my aliases" id="AllAddresses" onclick='app.mail.sieve_vac_all_aliases()'/>
</hbox>
</vbox>
</row>
<row>
<description value="Every:"/>
<textbox type="integer" id="days" min="1" max="31"/>
</row>
<row>
<vbox>
<hbox>
<description value="With message:"/>
</hbox>
<vbox>
<textbox multiline="true" id="text" width="40%"/>
<description id="by_date_label" value="You can use $$start$$ for the above start date and $$end$$ for the end date."/>
</vbox>
<textbox multiline="true" id="text" width="40%"/>
</row>
<row>
<description value="Forward messages:"/>
@ -59,13 +64,13 @@
</row>
<row>
<hbox>
<button class="$cont[hideIfSieveDisabled]" label="Save" id="button[save]"/>
<button class="$cont[hideIfSieveDisabled]" label="Apply" id="button[apply]"/>
<button class="$cont[hideIfSieveDisabled]" label="Cancel" id="button[cancel]"/>
<button label="Save" id="button[save]" class="$cont[hideIfSieveDisabled]"/>
<button label="Apply" id="button[apply]" class="$cont[hideIfSieveDisabled]"/>
<button label="Cancel" id="button[cancel]" class="$cont[hideIfSieveDisabled]"/>
</hbox>
<description/>
</row>
</rows>
</grid>
</template>
</overlay>
</overlay>