Subversion Repositories DevTools

Rev

Rev 6579 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5344 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|
5
'|  _iframe_pkgs_followed.asp
6
'|  This page is designed to be called from within an IFRAME
7
'|
8
'|  Follow specified package in one or more projects
9
'|
10
'=====================================================
11
%>
12
<%
13
Option explicit
14
' Good idea to set when using redirect
15
Response.Expires = 0    ' always load the page, dont store
16
%>
17
<!--#include file="common/conf.asp"-->
18
<!--#include file="common/globals.asp"-->
19
<!--#include file="common/formating.asp"-->
20
<!--#include file="common/qstr.asp"-->
21
<!--#include file="common/common_subs.asp"-->
22
<!--#include file="common/_form_window_common.asp"-->
23
<%
24
'------------ ACCESS CONTROL ------------------
25
%>
26
<!--#include file="_access_control_login.asp"-->
27
<!--#include file="_access_control_general.asp"-->
28
<%
29
'------------ Variable Definition -------------
30
Dim rsTemp
31
Dim parProjId
32
Dim parPkgId
33
'------------ Constants Declaration -----------
34
'------------ Variable Init -------------------
35
parProjId = Request("proj_id")
36
parPkgId = Request("pkg_id")
37
'----------------------------------------------
38
 
39
Function Get_My_Interest_Packages ( NNuser_id )
40
    Get_My_Interest_Packages = _
41
        "WITH Followed AS" &_
42
        "  (SELECT PRJ.proj_id," &_
43
        "    PRJ.proj_name," &_
44
        "    1 AS inUse" &_
45
        "  FROM PACKAGE_INTEREST PI," &_
46
        "    PROJECTS PRJ" &_
47
        "  WHERE PI.USER_ID = " & NNuser_id &_
48
        "  AND PI.PKG_ID    = " &  parPkgId &_
49
        "  AND PI.PROJ_ID   = PRJ.PROJ_ID" &_
50
        "  )" &_
51
        "SELECT prj.proj_id," &_
52
        "  prj.proj_name," &_
53
        "  NVL(Followed.inUse,0) as Followed" &_
54
        " FROM PROJECTS PRJ," &_
55
        "  Followed" &_
56
        " WHERE prj.proj_id = Followed.proj_id (+)" &_
57
        " ORDER BY upper(PRJ.PROJ_NAME)"
58
End Function
59
'--------------------------------------------------------------------------------------------------------------------------
60
%>
61
<html>
62
<head>
63
<title>Release Manager</title>
5357 dpurdie 64
<link rel="shortcut icon" href="<%=FavIcon%>"/>
5344 dpurdie 65
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
66
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 67
<link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
68
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
5344 dpurdie 69
<!--#include file="_jquery_includes.asp"-->
70
<script language="javascript">
71
$(document).ready(function () {
72
    //  Cancel button must close this iFrame using a function provided by the parent
73
    $('#btn_cancel').on('click', function (e) {parent.closeIFrame()});
74
 
75
    //  Restore the state of the checkboxes
76
    $('#btn_reset').on('click', function (e) {
77
        $('input.checkbox1[type="checkbox"]').prop("checked", false);
78
        $('input.checkbox0[type="checkbox"]').prop("checked", true);
79
        $('#btn_checkAll').prop("checked", false);
80
        $('#checktable').trigger('change');
81
    });
82
 
83
    //  Table all the tick boxes
84
    $('#btn_checkAll').on('change', function (e){
85
        var isChecked = $(this).prop("checked");
86
        $(".checkbox1").prop('checked', isChecked);
87
        $(".checkbox0").prop('checked', isChecked);
88
        $('#checktable').trigger('change');
89
    });
90
 
91
    //  Enable Update/Reset button when there is work to be done
92
    $('#checktable').on('change', function (e){
93
        var count = $('input.checkbox1[type="checkbox"]:checked').length;
94
        count += $('input.checkbox0[type="checkbox"]:not(:checked)').length; 
95
        $('#btn_update').prop('disabled', count <= 0);
96
        $('#btn_reset').prop('disabled', count <= 0);
97
    });
98
 
99
    //  Show Hide projects
100
    $('#btn_checkHide').on('change', function (e) {
101
        if($(this).prop("checked"))
102
        {
103
            $('input.checkbox1[type="checkbox"]').closest('tr').css('display', '');
104
            $('#eline1').text('Showing All projects');
105
        }
106
        else
107
        {
108
            $('input.checkbox1[type="checkbox"]').closest('tr').css('display', 'none');
109
            $('#eline1').text('Showing active projects');
110
        }
111
    });
112
 
113
    //  Update checked projects in the watchlist
114
    $('#btn_update').on('click', function(){
115
        vixConfirm("Update Notifications to the selected projects.", {ok : updateProjects});
116
    });
117
 
118
    //  Delete notifications for this package in selected projects
119
    function updateProjects()
120
    {
121
        var projectList = [];
122
        $('input.checkbox1[type="checkbox"]:checked').each(function(){
123
            projectList.push($(this).data('proj_id'));
124
            });
125
 
126
        var projectRmList = [];
127
        $('input.checkbox0[type="checkbox"]:not(:checked)').each(function(){
128
            projectRmList.push($(this).data('proj_id'));
129
            });
130
 
6510 dpurdie 131
        //console.log('ListAdd:',projectList.join());
132
        //console.log('ListDel:',projectRmList.join());
5344 dpurdie 133
        $('#eline1').empty();
134
        $('#eline2').empty();
135
        $.ajax({
136
            type : 'POST',
137
            url : '_json_Notifications.asp',
138
            data : {Opr : 'updateProjects', pkg_id : '<%=parPkgId%>', alist : projectList.join(), rlist : projectRmList.join()},
139
            dataType : 'json',
140
        }).fail(function( jqXHR, textStatus, errorThrown ){
141
            $('#eline1').text('Ajax Processing Error');
142
            $('#eline2').text(errorThrown);
143
        }).done(function( data, textStatus, jqXHR ){
144
            if (typeof data.result === undefined){
145
                vixAlert('Ajax Error. Unexpected result');
146
                $('#eline1').text('Ajax Error. Unexpected result');
147
            } else if (data.result != 0){
148
                $('#eline1').text('Processing Error:' + data.emsgSummary);
149
                $('#eline2').text(data.emsgDetails);
150
            } else {
151
            // Delete checked items
152
            $('input.checkbox1[type="checkbox"]:checked').removeClass("checkbox1").addClass("checkbox0");
153
            $('input.checkbox0[type="checkbox"]:not(:checked)').removeClass("checkbox0").addClass("checkbox1");
154
            $('#checktable').trigger('change');
155
            }
156
        });
157
    }
158
});
159
</script>
160
</head>
161
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
162
<!----------------------------------------------------->
163
<!-- BODY ---->
164
<table width="100%" border="0" cellspacing="0" cellpadding="0">
165
        <tr>
166
          <td bgcolor="#FFFFFF" valign="top" class="form_item"> 
167
              <p>You are currently interested in this package in the selected projects.
168
              <p>NOTE: You will be notified when the package is officially released/autobuild.</p>
169
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
170
              <tr class="form_field_hdr">
171
                <td nowrap><input type=checkbox id="btn_checkAll" title='Toggle all projects'></td>
172
                <td nowrap>Project&nbsp;</td>
173
                <td nowrap style='text-align:right' title='Show/Hide all projects'><input type=checkbox id="btn_checkHide" checked></td>
174
              </tr>
175
              </table>
176
              <div style="min-height:300px;max-height:500px;overflow:auto;">
177
              <table id=checktable width="100%" border="0" cellspacing="0" cellpadding="0">
178
              <%
179
              Set rsTemp = OraDatabase.DbCreateDynaset(Get_My_Interest_Packages( objAccessControl.UserId ), cint(0))
180
              While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
181
                %>
182
                    <tr class=form_item_grey>
183
                        <%If rsTemp("followed") <> 0 Then %>
184
                            <td nowrap><input type="checkbox" class="checkbox0" data-proj_id="<%=rsTemp("proj_id")%>" checked></td>
185
                        <%Else%>
186
                            <td nowrap><input type="checkbox" class="checkbox1" data-proj_id="<%=rsTemp("proj_id")%>"></td>
187
                        <%End If%>
188
                        <td nowrap><%=rsTemp("proj_name")%></td>
189
                    </tr>
190
                <%rsTemp.MoveNext
191
              WEnd%>
192
              </table>
193
              </div>
194
              <%If rsTemp.RecordCount = 0 Then%>
195
                <div class=form_item_grey>
196
                    You are interested in all current projects
197
                </div>
198
              <%End If%>
199
              <br>
200
              <%If rsTemp.RecordCount <> 0 Then%>
201
              <div>
202
                    <button id="btn_update" class="form_btn" disabled>Update</button>
203
                    <button id="btn_reset"  class="form_btn" disabled>Reset</button>
204
                    <button id="btn_cancel" class="form_btn">Cancel</button>
205
                </div>
206
              <%End If
207
              rsTemp.Close()
208
              set rsTemp = nothing
209
              %>
210
              <div id='eline1' class=err_alert>&nbsp;</div>
211
              <div id='eline2' class=err_alert>&nbsp;</div>
212
            </td>
213
        </tr>
214
    </td>
215
  </tr>
216
</table>
217
</body>
218
</html>
219
<%
220
Call Destroy_All_Objects
221
%>