Subversion Repositories DevTools

Rev

Rev 6508 | Rev 6579 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6508 Rev 6509
Line 30... Line 30...
30
Dim rsQry
30
Dim rsQry
31
Dim canDelete : canDelete = FALSE
31
Dim canDelete : canDelete = FALSE
32
'------------ Constants Declaration -----------
32
'------------ Constants Declaration -----------
33
Const LIMG_USER          = "<img src='images/i_user.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
33
Const LIMG_USER          = "<img src='images/i_user.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
34
Const LIMG_USER_DISABLED = "<img src='images/i_user_disabled.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
34
Const LIMG_USER_DISABLED = "<img src='images/i_user_disabled.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
-
 
35
 
-
 
36
Const LIMG_NDEL          = "<img src='icons/i_remove.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
-
 
37
Const LIMG_NDEL_DISABLED = "<img src='icons/i_remove_dis.gif' width='16' height='16' hspace='2' border='0' align='absmiddle' class='lessOpacity'>"
-
 
38
 
35
'------------ Variable Init -------------------
39
'------------ Variable Init -------------------
36
canDelete = canActionControlInProject("AdminView")
40
canDelete = canActionControlInProject("AdminView")
37
'----------------------------------------------
41
'----------------------------------------------
38
%>
42
%>
39
<html>
43
<html>
Line 60... Line 64...
60
formTips.tips.opr           = stdTip(200, 'Operations', 'A user can delete their own notification request' +
64
formTips.tips.opr           = stdTip(200, 'Operations', 'A user can delete their own notification request' +
61
                                         '<p>A user with "ViewAdmin" permission can delete any users notification request.');
65
                                         '<p>A user with "ViewAdmin" permission can delete any users notification request.');
62
 
66
 
63
 
67
 
64
</script>
68
</script>
65
 
-
 
66
<script language="javascript">
69
<script language="javascript">
67
$(document).ready(function () {
70
$(document).ready(function () {
68
 
71
 
69
    //  Add operation to all the delete buttons
72
    //  Add operation to all the delete buttons
70
    $('.btn_delete').on('click', function(){
73
    $('.btn_delete').on('click', function(){
71
        var el = $(this);
74
        var el = $(this);
72
        var trel = el.closest("tr");
75
        var trel = el.closest("tr");
73
        var proj_id = trel.data("proj_id");
76
        var proj_id = trel.data("proj_id");
74
        var uid_id = trel.data("user_id");
77
        var uid_id = trel.data("user_id");
75
 
78
 
-
 
79
        // Get the table row as an array to simplify access
-
 
80
        var colData = new Array();
-
 
81
        trel.each(function(){
-
 
82
            $(this).find('td').each(function(){
-
 
83
                colData.push($(this));
-
 
84
            })
-
 
85
        });
-
 
86
        var projName = colData[2].text();
-
 
87
        var userName = colData[0].text();
-
 
88
 
76
        vixConfirm("Remove notifications for this package from this user in the project shown", 
89
        vixConfirm("Remove notifications from this package<br>for user '"+userName+"'<br>in the '"+projName+"' project", 
77
            {ok     : removeUserNotification, 
90
            {ok     : removeUserNotification, 
78
             data   : { "uid"     : uid_id, 
91
             data   : { "uid"     : uid_id, 
79
                        "proj_id" : proj_id,
92
                        "proj_id" : proj_id,
80
                        "element" : trel
93
                        "element" : trel
81
            }});
94
            }});
82
    });
95
    });
83
 
96
 
84
    //  Delete notifications for this package in selected projects
97
    //  Delete notifications for this package in selected projects
85
    function removeUserNotification(args)
98
    function removeUserNotification(args)
86
    {
99
    {
87
        console.log("removeUserNotification", args.data.uid, args.data.proj_id);
100
        //console.log("removeUserNotification", args.data.uid, args.data.proj_id);
88
        $.ajax({
101
        $.ajax({
89
            type : 'POST',
102
            type : 'POST',
90
            url : '_json_Notifications.asp',
103
            url : '_json_Notifications.asp',
91
            data : {Opr : 'RemoveUserFromProject', pkg_id : <%=pkgInfoHash.Item("pkg_id")%>, user_id : args.data.uid, proj_id : args.data.proj_id },
104
            data : {Opr : 'RemoveUserFromProject', pkg_id : <%=pkgInfoHash.Item("pkg_id")%>, user_id : args.data.uid, proj_id : args.data.proj_id },
92
            dataType : 'json',
105
            dataType : 'json',
Line 183... Line 196...
183
                                Dim userImage : userImage = LIMG_USER_DISABLED
196
                                Dim userImage : userImage = LIMG_USER_DISABLED
184
                                If isNull(rsTemp("is_DISABLED")) Then
197
                                If isNull(rsTemp("is_DISABLED")) Then
185
                                    userImage = LIMG_USER
198
                                    userImage = LIMG_USER
186
                                End If
199
                                End If
187
 
200
 
-
 
201
                                Dim DelUserImage : DelUserImage = LIMG_NDEL_DISABLED
-
 
202
                                Dim btnText : btnText = "Operation not available"
188
                                Dim btnDisabled: btnDisabled = "disabled"
203
                                Dim btnClass : btnClass = "" 
189
                                If canDelete OR objAccessControl.UserId = rsTemp("user_id") Then
204
                                If canDelete OR objAccessControl.UserId = rsTemp("user_id") Then
-
 
205
                                    DelUserImage = LIMG_NDEL
-
 
206
                                    btnText = "Remove notifications to this user"
190
                                    btnDisabled = ""
207
                                    btnClass = "class=btn_delete"
191
                                End If
208
                                End If
192
 
209
 
193
                            %>
210
                            %>
194
                          <tr class="form_item_grey" data-user_id="<%=rsTemp("user_id")%>" data-proj_id="<%=rsTemp("proj_id")%>" > 
211
                          <tr class="form_item_grey" data-user_id="<%=rsTemp("user_id")%>" data-proj_id="<%=rsTemp("proj_id")%>" > 
195
                            <td nowrap valign="top"><a href="mailto:<%=rsTemp("user_email")%>" title="<%=rsTemp("user_email")%>" class="txt_linked"><%=userImage%><%=rsTemp("FULL_NAME")%></a></td>
212
                            <td nowrap valign="top"><a href="mailto:<%=rsTemp("user_email")%>" title="<%=rsTemp("user_email")%>" class="txt_linked"><%=userImage%><%=rsTemp("FULL_NAME")%></a></td>
196
                            <td nowrap valign="top"><button class="form_btn btn_delete" type="button" <%=btnDisabled%>>Delete</button></td>
213
                            <td nowrap valign="top" <%=btnClass%> title="<%=btnText%>"><%=DelUserImage%></td>
197
                            <td nowrap valign="top"><a href="rtree.asp?proj_id=<%=rsTemp("PROJ_ID")%>"><%=rsTemp("PROJ_NAME")%></a></td>
214
                            <td nowrap valign="top"><a href="rtree.asp?proj_id=<%=rsTemp("PROJ_ID")%>"><%=rsTemp("PROJ_NAME")%></a></td>
198
                          </tr>
215
                          </tr>
199
                          <%rsTemp.MoveNext
216
                          <%rsTemp.MoveNext
200
                          WEnd
217
                          WEnd
201
                          rsTemp.Close
218
                          rsTemp.Close