mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-17 10:51:38 +01:00
* EMail: sort Sieve filter rules via drag-n-drop
This commit is contained in:
parent
05d8491861
commit
7944b77bb2
@ -25,7 +25,6 @@
|
||||
'editRule' => True,
|
||||
'editScript' => True,
|
||||
'editVacation' => True,
|
||||
'increaseFilter' => True,
|
||||
'listScripts' => True,
|
||||
'listRules' => True,
|
||||
'updateRules' => True,
|
||||
@ -300,44 +299,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
# // RalfBecker: that does obviously nothing
|
||||
# function deactivateScript()
|
||||
# {
|
||||
# $scriptName = get_var('scriptname',array('GET'));
|
||||
# if(!empty($scriptName))
|
||||
# {
|
||||
# #if($this->sieve->activatescript($scriptName))
|
||||
# #{
|
||||
# # #print "Successfully changed active script!<br>";
|
||||
# #}
|
||||
# #else
|
||||
# #{
|
||||
# # #print "Unable to change active script!<br>";
|
||||
# # /* we could display the full output here */
|
||||
# #}
|
||||
# }
|
||||
#
|
||||
# $this->listScripts();
|
||||
# }
|
||||
|
||||
function decreaseFilter()
|
||||
{
|
||||
$this->getRules(); /* ADDED BY GHORTH */
|
||||
$ruleID = get_var('ruleID',array('GET'));
|
||||
if ($this->rules[$ruleID] && $this->rules[$ruleID+1])
|
||||
{
|
||||
$tmp = $this->rules[$ruleID+1];
|
||||
$this->rules[$ruleID+1] = $this->rules[$ruleID];
|
||||
$this->rules[$ruleID] = $tmp;
|
||||
}
|
||||
|
||||
$this->updateScript();
|
||||
|
||||
$this->saveSessionData();
|
||||
|
||||
$this->listRules();
|
||||
}
|
||||
|
||||
function display_app_header() {
|
||||
if(preg_match('/^(vacation|filter)$/',get_var('editmode',array('GET'))))
|
||||
$editMode = get_var('editmode',array('GET'));
|
||||
@ -815,22 +776,22 @@
|
||||
$this->t->pfp('out','email_notification');
|
||||
}
|
||||
|
||||
function increaseFilter()
|
||||
/**
|
||||
* Move rule to an other position in list
|
||||
*
|
||||
* @param int $from 0, 1, ...
|
||||
* @param int $to 0, 1, ...
|
||||
*/
|
||||
function ajax_moveRule($from, $to)
|
||||
{
|
||||
$this->getRules(); /* ADDED BY GHORTH */
|
||||
$ruleID = get_var('ruleID',array('GET'));
|
||||
if ($this->rules[$ruleID] && $this->rules[$ruleID-1])
|
||||
{
|
||||
$tmp = $this->rules[$ruleID-1];
|
||||
$this->rules[$ruleID-1] = $this->rules[$ruleID];
|
||||
$this->rules[$ruleID] = $tmp;
|
||||
}
|
||||
$this->getRules();
|
||||
|
||||
$from_rule = $this->rules[$from];
|
||||
unset($this->rules[$from]);
|
||||
$this->rules = array_merge(array_slice($this->rules, 0, $to), array($from_rule), array_slice($this->rules, $to, count($this->rules)-$to));
|
||||
|
||||
$this->updateScript();
|
||||
|
||||
$this->saveSessionData();
|
||||
|
||||
$this->listRules();
|
||||
}
|
||||
|
||||
function listRules()
|
||||
@ -882,9 +843,8 @@
|
||||
$linkData = array
|
||||
(
|
||||
'menuaction' => 'felamimail.uisieve.editRule',
|
||||
'ruletype' => 'filter'
|
||||
);
|
||||
$this->t->set_var('url_add_rule',$GLOBALS['egw']->link('/index.php',$linkData));
|
||||
$this->t->set_var('url_edit_rule',$GLOBALS['egw']->link('/index.php',$linkData));
|
||||
|
||||
$linkData = array
|
||||
(
|
||||
@ -908,27 +868,6 @@
|
||||
$this->t->set_var('filter_text',htmlspecialchars($this->buildRule($rule),ENT_QUOTES,$GLOBALS['egw']->translation->charset()));
|
||||
$this->t->set_var('ruleID',$ruleID);
|
||||
|
||||
$linkData = array
|
||||
(
|
||||
'menuaction' => 'felamimail.uisieve.editRule',
|
||||
'ruleID' => $ruleID,
|
||||
);
|
||||
$this->t->set_var('url_edit_rule',$GLOBALS['egw']->link('/index.php',$linkData));
|
||||
|
||||
$linkData = array
|
||||
(
|
||||
'menuaction' => 'felamimail.uisieve.increaseFilter',
|
||||
'ruleID' => $ruleID,
|
||||
);
|
||||
$this->t->set_var('url_increase',$GLOBALS['egw']->link('/index.php',$linkData));
|
||||
|
||||
$linkData = array
|
||||
(
|
||||
'menuaction' => 'felamimail.uisieve.decreaseFilter',
|
||||
'ruleID' => $ruleID,
|
||||
);
|
||||
$this->t->set_var('url_decrease',$GLOBALS['egw']->link('/index.php',$linkData));
|
||||
|
||||
$linkData = array
|
||||
(
|
||||
'menuaction' => 'felamimail.uisieve.updateRules',
|
||||
|
@ -4,8 +4,29 @@
|
||||
function submitRuleList(action)
|
||||
{
|
||||
document.rulelist.rulelist_action.value = action;
|
||||
$j( "#sortable input[type=checkbox]").each(function(){
|
||||
this.value = $j(this).parent().parent().index();
|
||||
});
|
||||
document.rulelist.submit();
|
||||
}
|
||||
egw.LAB.wait(function() {
|
||||
$j(document).ready(function() {
|
||||
$j( "#sortable tbody" ).sortable({
|
||||
start: function(e, ui) {
|
||||
ui.item.data('start-pos', ui.item.index());
|
||||
},
|
||||
update: function(e, ui) {
|
||||
var request = new egw_json_request('felamimail.uisieve.ajax_moveRule', [ui.item.data('start-pos'), ui.item.index()]);
|
||||
request.sendRequest(true);
|
||||
}
|
||||
});
|
||||
$j( "#sortable tbody" ).disableSelection();
|
||||
$j( "#sortable tbody a" ).on("click", function(e){
|
||||
fm_sieve_displayRuleEditWindow('{url_edit_rule}&ruleID='+$j(this).parent().parent().index());
|
||||
return false;
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
var refreshURL='{refreshURL}';
|
||||
|
||||
@ -20,24 +41,22 @@ var refreshURL='{refreshURL}';
|
||||
<a href="javascript:submitRuleList('delete');">{lang_delete}</a>
|
||||
</td>
|
||||
<td style='text-align : right;'>
|
||||
<!-- <a href="{url_add_rule}">{lang_add_rule}</a> -->
|
||||
<a href="#" onclick="fm_sieve_displayRuleEditWindow('{url_add_rule}'); return false;">{lang_add_rule}</a>
|
||||
<a href="#" onclick="fm_sieve_displayRuleEditWindow('{url_edit_rule}'); return false;">{lang_add_rule}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form name='rulelist' method='post' action='{action_rulelist}'>
|
||||
<input type='hidden' name='rulelist_action' value='unset'>
|
||||
<table width="100%" border="0" cellpadding="2" cellspacing="1">
|
||||
<table width="100%" border="0" cellpadding="2" cellspacing="1" id="sortable">
|
||||
<thead class="th">
|
||||
<tr>
|
||||
<th width="3%"> </th>
|
||||
<th width="10%">Status</th>
|
||||
<th width="80%">{lang_rule}</th>
|
||||
<th width="5%">Order</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{filterrows}
|
||||
<tbody>
|
||||
{filterrows}
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
@ -48,17 +67,13 @@ var refreshURL='{refreshURL}';
|
||||
<!-- BEGIN filterrow -->
|
||||
<tr class="{ruleCSS}">
|
||||
<td style="text-align: center;">
|
||||
<input type="checkbox" name="ruleID[]" value="{ruleID}">
|
||||
<input type="checkbox" name="ruleID[]" value="x">
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
{filter_status}
|
||||
</td>
|
||||
<td>
|
||||
<a class="{ruleCSS}" href="#" onclick="fm_sieve_displayRuleEditWindow('{url_edit_rule}'); return false;" onmouseover="window.status='Edit This Rule'; return true;" onmouseout="window.status='';">{filter_text}</a>
|
||||
</td>
|
||||
<td nowrap="nowrap" style="text-align: center;">
|
||||
<a href="{url_increase}"><img src="{url_up}" alt="Move rule up" border="0" onmouseover="window.status='Move rule up'; return true;" onmouseout="window.status='';"></a>
|
||||
<a href="{url_decrease}"><img src="{url_down}" alt="Move rule down" border="0" onmouseover="window.status='Move rule down'; return true;" onmouseout="window.status='';"></a>
|
||||
<a class="{ruleCSS}" href="#" onmouseover="window.status='Edit This Rule'; return true;" onmouseout="window.status='';">{filter_text}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END filterrow -->
|
||||
|
Loading…
Reference in New Issue
Block a user