Subversion Repositories DevTools

Rev

Rev 6774 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6770 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'   form_release_replication.asp
5
'=====================================================
6
%>
7
<%
8
Option explicit
9
' Good idea to set when using redirect
10
Response.Expires = 0   ' always load the page, dont store
11
%>
12
<!--#include file="common/conf.asp"-->
13
<!--#include file="common/globals.asp"-->
14
<!--#include file="common/formating.asp"-->
15
<!--#include file="common/qstr.asp"-->
16
<!--#include file="common/common_subs.asp"-->
17
<!--#include file="common/_form_window_common.asp"-->
18
<!--#include file="_action_buttons.asp"-->
19
<!--#include file="class/classActionButtonControl.asp"-->
20
<% '------------ ACCESS CONTROL ------------------ %>
21
<!--#include file="_access_control_login.asp"-->
22
<!--#include file="_access_control_general.asp"-->
23
<!--#include file="_access_control_action_project.asp"-->
24
<%
25
'------------ Variable Definition -------------
26
Dim parRtagId
27
Dim canDelete
28
'------------ Constants Declaration -----------
29
 
30
Const LIMG_NDEL          = "<img src='icons/i_remove.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
31
Const LIMG_NDEL_DISABLED = "<img src='icons/i_remove_dis.gif' width='16' height='16' hspace='2' border='0' align='absmiddle' class='lessOpacity'>"
32
 
33
'------------ Variable Init -------------------
34
canDelete = canActionControlInProject("AdminView")
35
'------------ Variable Init -------------------
36
parRtagId = Request("rtag_id")
37
objPMod.PersistInQryString("rtag_id")
38
'--------------------------------------------------------------------------------------------------------------------------
39
'  PV_ID_ListHTML
40
'
41
'  DESCRIPTION
42
'     Constructs the HTML to render the rows of package names, and other information
43
'
44
Function PV_ID_ListHTML
45
   Dim rsQry
46
   Dim html_string
47
   Dim sQry
48
 
49
   sQry = _
50
        "WITH aa as (" &_
51
        "    SELECT * from blat_projects where proj_id = (select PROJ_ID from RELEASE_TAGS where rtag_id = :RTAG_ID)" &_
52
        " )" &_
53
        " SELECT" &_
54
        "    bs.*," &_
55
        "    br.rtag_id, br.br_enabled, br.br_exclude," &_
56
        "    nvl2(br.BLAT_ID, 1, 0) AS inRelease," &_
57
        "    nvl2(aa.BLAT_ID, 1, 0) AS inProject" &_
58
        " FROM" &_
59
        "    blat_servers bs," &_
60
        "    blat_releases br," &_
61
        "    aa" &_
62
        " WHERE" &_
63
        "    bs.BLAT_ID = br.BLAT_ID (+)" &_
64
        "    AND br.rtag_id(+) = :RTAG_ID" &_
65
        "    AND bs.BLAT_ID = aa.BLAT_ID (+)" &_
66
        "    AND (aa.BLAT_ID is NOT NULL OR br.BLAT_ID is NOT NULL OR bs.BLAT_FULL = 'Y')" &_
67
        " ORDER BY" &_
68
        "    upper(blat_display_name) ASC"
69
 
70
 
71
   OraDatabase.Parameters.Add "RTAG_ID", DB_RTAG_ID, ORAPARM_INPUT, ORATYPE_NUMBER
72
   Set rsQry = OraDatabase.DbCreateDynaset( sQry, cint(0) )
73
   OraDatabase.Parameters.Remove "RTAG_ID"
74
 
75
   '--- Render rows ---
76
   Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
77
      Dim btnText, btnClass, btnDisable, isaRelease, replicationMode
78
 
79
      isaRelease = rsQry("inRelease") > 0
80
 
81
      replicationMode = "Unknown"
82
      If rsQry("blat_full") = "Y" Then
83
          replicationMode = "Repository"
84
      ElseIf  rsQry("inProject") > 0 Then
85
          replicationMode = "Project"
86
      ElseIf  rsQry("inRelease") > 0 Then
87
          replicationMode = "Release"
88
      End If
89
 
90
      ' BEGIN ROW
91
      html_string = html_string & "<tr data-server_id=""" & rsQry("BLAT_ID") & """>"
92
 
93
      ' Server Active
94
      Dim activeChecked
95
      activeChecked = IIF(rsQry("BLAT_ENABLE") = "Y", "checked", "" )
96
      html_string = html_string & "<td nowrap class='body_row'><input type='checkbox' disabled "& activeChecked &" ></td>"
97
 
98
      ' Server Name
99
      html_string = html_string & "<td nowrap class='body_row'>" & rsQry("BLAT_DISPLAY_NAME") & "</td>"
100
 
101
      ' Project Active
102
      activeChecked = IIF(rsQry("BR_ENABLED") = "Y", "checked", "" )
103
      btnText = "Operation not available"
104
      btnClass = ""
105
      btnDisable = "disabled"
106
      If canDelete AND isaRelease Then
107
         btnText = "Toggle Replication State"
108
         btnClass = "class=btn_enable"
109
         btnDisable = ""
110
      End If
111
 
112
      html_string = html_string & "<td nowrap class='body_row' title='" & btnText & "'><input " & btnClass & " type='checkbox' " &btnDisable & " "& activeChecked &" ></td>"
113
 
114
     ' Replication Mode
115
      html_string = html_string & "<td nowrap class='body_row'>" & replicationMode & "</td>"
116
 
117
     ' Delete Operation
118
     Dim DelUserImage : DelUserImage = LIMG_NDEL_DISABLED
119
     btnText = "Operation not available"
120
     btnClass = ""
121
     If canDelete AND isaRelease Then
122
         DelUserImage = LIMG_NDEL
123
         btnText = "Remove this replica"
124
         btnClass = "class=btn_delete"
125
     End If
126
 
127
     html_string = html_string & "<td nowrap valign='top' " & btnClass & " title='" & btnText & "'>" & DelUserImage & "</td>"
128
 
129
      ' END ROW
130
      html_string = html_string & "</tr>"
131
 
132
      rsQry.MoveNext
133
 
134
      ' ROW SEPERATOR
135
      'If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
136
         html_string = html_string & "<tr><td colspan='8' class=body_line></td></tr>"
137
      'End If
138
   Loop
139
 
140
   ' destroy objects
141
   rsQry.Close()
142
   Set rsQry = nothing
143
 
144
   ' return result
145
   PV_ID_ListHTML = html_string
146
End Function
147
'----------------------------------------------------
148
'   Insert scripts into the header section of the generated document
149
Sub InsertUserScripts
150
 %>
151
<script language="javascript">
152
$(document).ready(function () {
153
 
154
    //  Add operation to all the delete buttons
155
    $('.btn_delete').on('click', function(){
156
        var el = $(this);
157
        var trel = el.closest("tr");
158
        var rtag_id = <%=DB_RTAG_ID%>;
159
        var server_id = trel.data("server_id");
160
 
161
        var colData = new Array();
162
        trel.each(function(){
163
            $(this).find('td').each(function(){
164
                colData.push($(this));
165
            })
166
        });
167
        var replicaName = colData[1].text();
168
 
169
        vixConfirm("Remove replication to '"+replicaName+"' of this release", 
170
            {
171
                deferred : true,  
172
            }).done(function(){
173
                $.ajax({
174
                    type : 'POST',
175
                    url : '_json_Replication.asp',
176
                    data : {Opr : 'RemoveRelease', server_id : server_id, user_id : <%=objAccessControl.UserId%>, rtag_id : rtag_id },
177
                    dataType : 'json',
178
                }).fail(function( jqXHR, textStatus, errorThrown ){
179
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
180
                }).done(function( data, textStatus, jqXHR ){
181
                    if (typeof data.result === undefined){
182
                        vixAlert('Ajax Error. Unexpected result');
183
                    } else if (data.result != 0){
184
                        vixAlert('Error Deleting item.<p>' + data.emsgDetails);
185
                    } else {
186
                        // Process individual items to show that an action has been taken
187
                        //
188
                        colData[1].addClass("strike");
189
                        colData[0].empty();
190
                        colData[2].empty();
191
                        colData[3].empty();
192
                    }
193
                });
194
            });
195
    });
196
 
197
    //  Add operation to all the enable buttons
198
    $('.btn_enable').on('click', function(e){
199
        var el = $(this);
200
        var trel = el.closest("tr");
201
        var rtag_id = <%=DB_RTAG_ID%>;
202
        var server_id = trel.data("server_id");
203
        var state =  $(this).prop("checked");
204
        var stateChanged = false;
205
 
206
        var colData = new Array();
207
        trel.each(function(){
208
            $(this).find('td').each(function(){
209
                colData.push($(this));
210
            })
211
        });
212
        var replicaName = colData[1].text();
213
        var stateText = state ? 'Enable' : 'Disable'; 
214
 
215
        vixConfirm(stateText + " replication to '"+replicaName+"' of this release", 
216
             {
217
                 deferred : true,
218
             }).done(function(){
219
                $.ajax({
220
                    type : 'POST',
221
                    url : '_json_Replication.asp',
222
                    data : {Opr : 'EnableRelease', server_id : server_id, user_id : <%=objAccessControl.UserId%>, rtag_id : rtag_id, new_state : state ? 'Y' : 'N' },
223
                    dataType : 'json',
224
                }).fail(function( jqXHR, textStatus, errorThrown ){
225
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
226
                }).done(function( data, textStatus, jqXHR ){
227
                    if (typeof data.result === undefined){
228
                        vixAlert('Ajax Error. Unexpected result');
229
                    } else if (data.result != 0){
230
                        vixAlert('Error setting state.<p>' + data.emsgDetails);
231
                    } else {
232
                        stateChanged = true;
233
                    }
234
                }).always(function(){
235
                    if ( !stateChanged ) {
236
                        el.prop("checked", !state);
237
                    }
238
                });
239
            }).fail(function(){
240
                el.prop("checked", !state);
241
            });
242
        });
243
 
244
});
245
</script>
246
<%
247
End Sub
248
%>
249
<%
250
'------------ RUN BEFORE PAGE RENDER ----------
251
'
252
'----------------------------------------------------
253
Sub LeftPanelContent
254
End Sub
255
'----------------------------------------------------
256
Sub MainPanelContent
257
%>
258
   <table class="embedded_table" style="margin-bottom:20px">
259
      <tr>
260
         <td>
261
            <!-- Box Title -->
262
            <div class="form_ttl nowrap" align="left">
263
                 Release Replication Details
264
            </div>
265
         </td>
266
      </tr>
267
      <tr>
268
         <td>
269
            <!-- Box Content -->
270
            <div class="rounded_box">
271
               <div style="background-color: white;border-left: white solid 10px;border-right: white solid 10px;">
272
                    <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
273
                    <!--#include file="messages/_msg_inline.asp"-->
274
                    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
275
                    <table width="100%"  border="0" cellspacing="2" cellpadding="0">
276
                        <tr>
277
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Active<%=Quick_Help("activeReplica")%></td>
278
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Replica</td>
279
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Enabled<%=Quick_Help("enabledRelease")%></td>
280
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Relication Mode</td>
281
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Opr</td>
282
                        </tr>
283
                        <%=PV_ID_ListHTML()%>
284
                  </table>
285
                  <table class="full_table">
286
                     <tr>
287
                        <td align="right" nowrap valign="bottom" class="abtnItem" title="Add New Replication Targets">
288
                        <%If canDelete Then%>
289
                           <a href="javascript:;" onClick="MM_openVixIFrame('wAddReleaseReplica.asp?rtag_id=<%=DB_RTAG_ID%>','Add Release Replication')">
290
                              <img src="icons/btn_add.gif" width="13" height="13" align="absmiddle" border="0" hspace="3" >
291
                              Add Release Replica
292
                           </a>
293
                        <%Else%>
294
                             <img src="icons/btn_add_dis.gif" width="13" height="13" align="absmiddle" border="0" hspace="3">
295
                              Add Release Replica
296
                        <%End If%>
297
                        </td>
298
                     </tr>
299
                  </table>
300
               </div>
301
            </div>
302
         </td>
303
      </tr>
304
   </table>
305
<%
306
End Sub
307
%>
308
<html>
309
   <head>
310
      <title>Release Manager</title>
311
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
312
      <meta http-equiv="Pragma" content="no-cache">
313
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
314
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
315
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
316
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
317
      <!-- DROPDOWN MENUS -->
318
      <%bJqueryDataTables = TRUE%>
319
      <!--#include file="_jquery_includes.asp"-->
320
      <!--#include file="_menu_def.asp"-->
321
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
322
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
323
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
324
      <script language="JavaScript" type="text/JavaScript">
325
      formTips.tips.activeReplica   = stdTip(200, 'Active Replica', 'This package replica has been marked as active.');
326
      formTips.tips.enabledRelease  = stdTip(200, 'Enabled Release','Replication of this release has been enabled. This will only ' +
327
                                            'be effective if the replica is active');
328
      </script>
329
      <%Call InsertUserScripts%>
330
   </head>
331
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
332
      <!-- HEADER -->
333
      <!--#include file="_header.asp"-->
334
      <!-- BODY ---->
335
      <table class="full_table">
336
         <tr>
337
            <td width="146px" class="panel_bg" valign="top">
338
                <%Call LeftPanelContent%>
339
            </td>
340
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
341
                <%Call MainPanelContent%>
342
            </td>
343
         </tr>
344
         <tr>
345
            <td class="panel_bg" valign="bottom" align="center" height="350"></td>
346
         </tr>
347
      </table>
348
      <!-- FOOTER -->
349
      <!--#include file="_footer.asp"-->
350
   </body>
351
</html>
352