File size: 7,055 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlmenu">
  <PRO_UID type="private"/>
  <cases_New type="private" defaultValue="../cases/cases_New"/>
  <cases_Edit type="private" defaultValue="../cases/cases_Edit"/>
  <cases_Open type="private" defaultValue="../cases/cases_Open"/>
  <cases_Delete type="private" defaultValue="../cases/cases_Delete"/>
  <PAGED_TABLE_ID type="private"/>
  <!-- Default Search option -->
  <PROCESS_FILTER type="dropdown" colWidth="350" sqlconnection="dbarray" colAlign="left">
    select PRO_UID, APP_PRO_TITLE from _PROCESSES
    <en><![CDATA[Process]]><option name="0"><![CDATA[All]]></option></en>
</PROCESS_FILTER>
  <READ_FILTER type="link" link="#" onclick="javascript:applyAdditionalFilter('READ'); return false" value="" colWidth="2%" colAlign="bottom">
    <en><![CDATA[Read]]></en>
  </READ_FILTER>
  <UNREAD_FILTER type="link" link="#" onclick="javascript:applyAdditionalFilter('UNREAD'); return false" value="" colWidth="2%" colAlign="bottom">
    <en><![CDATA[Unread]]></en>
  </UNREAD_FILTER>
  <ALL_FILTER type="link" link="#" onclick="javascript:applyAdditionalFilter('ALL'); return false" value="" colWidth="2%" colAlign="bottom">
    <en><![CDATA[All]]></en>
  </ALL_FILTER>
  <SEARCH_FILTER_FORM type="private"/>
  <!--<MNU_NEW type="link" label="@G::LoadTranslation(ID_START_CASE)" value='' link="@G::encryptLink(@#cases_New)" colAlign="left" colWidth="85"/>-->
  <PAGED_TABLE_ID type="private"/>
  <PAGED_TABLE_FAST_SEARCH type="FastSearch" label=""/>
  <MNU_FAST_SEARCH type="button" label="@G::LoadTranslation(ID_SEARCH)" colAlign="right" colWidth="50" onclick="@#PAGED_TABLE_ID.doFastSearch(getField('PAGED_TABLE_FAST_SEARCH',this.form).value);"/>
  <PAGED_TABLE_JUMP type="text" colAlign="right" colWidth="80" size="4" maxlength="5" label=""/>
  <MNU_JUMP type="button" label="@G::LoadTranslation(ID_JUMP)" colAlign="right" colWidth="50" onclick="Jump()"/>
  <!--<MNU_SEARCH type="link" value='' link="#" onclick="showHideSearch('@#SEARCH_FILTER_FORM',this); return false;" colAlign="right" colWidth="130">
  <en>Advanced Search</en>
</MNU_SEARCH>-->
  <JS type="javascript"><![CDATA[
param = getURLParam("filter");
selectionHighlight(param);

function getURLParam(strParamName){
    var strReturn = "";
    var strHref = window.location.href;
    if ( strHref.indexOf("&") > -1 ){
        var strQueryString = strHref.substr(strHref.indexOf("&")).toLowerCase();
        var aQueryString = strQueryString.split("&");
        for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
            if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
                var aParam = aQueryString[iParam].split("=");
                strReturn = aParam[1];
                break;
            }
        }
    }
    return strReturn;
}

function casesDelete(app) {
  ajax_function('cases_Delete','','APP_UID='+encodeURIComponent(app));
  @#PAGED_TABLE_ID.refresh();
}

var cancelCase = function(sUID, iIndex) {
  new leimnud.module.app.confirm().make({
    label : G_STRINGS.ID_CONFIRM_CANCEL_CASE,
    action: function() {
      var oRPC = new leimnud.module.rpc.xmlhttp({
        url:  'cases_Ajax',
        args: 'action=cancelCase&amp;sApplicationUID=' + sUID + '&amp;iIndex=' + iIndex
      });
      oRPC.callback = function(oRPC) {
        @#PAGED_TABLE_ID.refresh();
      }.extend(this);
      oRPC.make();
    }.extend(this)
  });
};

var pauseCase = function(sUID, iIndex)
{
  new leimnud.module.app.confirm().make({
    label : G_STRINGS.ID_CONFIRM_PAUSE_CASE,
    action: function() {
      var oRPC = new leimnud.module.rpc.xmlhttp({
        url:  'cases_Ajax',
        args: 'action=pauseCase&amp;sApplicationUID=' + sUID + '&amp;iIndex=' + iIndex
      });
      oRPC.callback = function(oRPC) {
        @#PAGED_TABLE_ID.refresh();
      }.extend(this);
      oRPC.make();
    }.extend(this)
  });
};

var reactivateCase = function(sUID, iIndex) {
  new leimnud.module.app.confirm().make({
    label : G_STRINGS.ID_MSG_CONFIRM_REACTIVATE_CASES,
    action: function() {
      var oRPC = new leimnud.module.rpc.xmlhttp({
        url:  'cases_Ajax',
        args: 'action=reactivateCase&amp;sApplicationUID=' + sUID + '&amp;iIndex=' + iIndex
      });
      oRPC.callback = function(oRPC) {
        @#PAGED_TABLE_ID.refresh();
      }.extend(this);
      oRPC.make();
    }.extend(this)
  });
};

var unpauseCase = function(sUID, iIndex)
{
  new leimnud.module.app.confirm().make({
    label : G_STRINGS.ID_CONFIRM_UNPAUSE_CASE,
    action: function() {
      var oRPC = new leimnud.module.rpc.xmlhttp({
        url:  'cases_Ajax',
        args: 'action=unpauseCase&amp;sApplicationUID=' + sUID + '&amp;iIndex=' + iIndex
      });
      oRPC.callback = function(oRPC) {
        @#PAGED_TABLE_ID.refresh();
      }.extend(this);
      oRPC.make();
    }.extend(this)
  });
};

getField("PAGED_TABLE_JUMP").onkeypress = function(event) {
  event = window.event ? window.event : event;
  if (event.keyCode===13) Jump();
};

function Jump(){
  window.location.href='@#cases_Open?APP_NUMBER='+encodeURIComponent(getField('PAGED_TABLE_JUMP').value)+"&content=inner";
}

// Additional filter -- By Erik
leimnud.event.add(getField('PROCESS_FILTER'), 'change', function() {
    loc = new String(window.location);
    tmp = (loc.indexOf('&') != -1 )? loc.indexOf('&'): loc.length;
    uri = loc.substring(0, tmp); 
    
    if(uri.indexOf('?l=to_do')==-1) uri=uri+'?l=to_do';
    
	document.location.href =  uri + '&PROCESS_UID='+this.value+'&r='+Math.floor(Math.random()*999999);
}.extend(getField('PROCESS_FILTER')));

function selectionHighlight(filter) {
    switch (param.toUpperCase()) {
    case 'READ'  :  getField("READ_FILTER").style.fontWeight = 'bold';
                    getField("UNREAD_FILTER").style.fontWeight = 'normal';
                    getField("ALL_FILTER").style.fontWeight = 'normal';
                    break;
    case 'UNREAD':  getField("READ_FILTER").style.fontWeight = 'normal';
                    getField("UNREAD_FILTER").style.fontWeight = 'bold';
                    getField("ALL_FILTER").style.fontWeight = 'normal';
                    break;
    case 'ALL'   :  getField("READ_FILTER").style.fontWeight = 'normal';
                    getField("UNREAD_FILTER").style.fontWeight = 'normal';
                    getField("ALL_FILTER").style.fontWeight = 'bold';
                    break;
    default      :  getField("READ_FILTER").style.fontWeight = 'normal';
                    getField("UNREAD_FILTER").style.fontWeight = 'normal';
                    getField("ALL_FILTER").style.fontWeight = 'bold';
                    break;
    }
}

function applyAdditionalFilter(filter){
    selectionHighlight(filter);
    loc = new String(window.location);
    tmp = (loc.indexOf('&') != -1 )? loc.indexOf('&'): loc.length;
    uri = loc.substring(0, tmp);
    
    location.href = uri + '&PROCESS_UID='+getField('PROCESS_FILTER').value + '&' + filter + '=1'+'&r='+Math.floor(Math.random()*999999) + '&filter=' + filter;
}

]]></JS>
</dynaForm>