Subversion Repositories DevTools

Rev

Rev 6775 | Rev 6783 | Go to most recent revision | Details | Compare with Previous | 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
6777 dpurdie 27
Dim canModify
6770 dpurdie 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 -------------------
6777 dpurdie 34
canModify = canActionControl("ConfigureReplication")
6770 dpurdie 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 (+)" &_
6775 dpurdie 66
        "    AND (aa.BLAT_ID is NOT NULL OR br.BLAT_ID is NOT NULL OR bs.BLAT_MODE IN( 'P', 'E'))" &_
6770 dpurdie 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"
6775 dpurdie 82
      If rsQry("blat_mode") = "E" Then
6774 dpurdie 83
          replicationMode = "Entire Archive"
6775 dpurdie 84
      ElseIf rsQry("blat_mode") = "P" Then
6774 dpurdie 85
          replicationMode = "All Projects"
86
      Else
87
        If  rsQry("inProject") > 0 Then
88
            replicationMode = "Project"
89
        ElseIf  rsQry("inRelease") > 0 Then
90
            replicationMode = "Release"
91
        End If
6770 dpurdie 92
      End If
93
 
94
      ' BEGIN ROW
95
      html_string = html_string & "<tr data-server_id=""" & rsQry("BLAT_ID") & """>"
96
 
97
      ' Server Active
98
      Dim activeChecked
99
      activeChecked = IIF(rsQry("BLAT_ENABLE") = "Y", "checked", "" )
100
      html_string = html_string & "<td nowrap class='body_row'><input type='checkbox' disabled "& activeChecked &" ></td>"
101
 
102
      ' Server Name
103
      html_string = html_string & "<td nowrap class='body_row'>" & rsQry("BLAT_DISPLAY_NAME") & "</td>"
104
 
105
      ' Project Active
106
      activeChecked = IIF(rsQry("BR_ENABLED") = "Y", "checked", "" )
107
      btnText = "Operation not available"
108
      btnClass = ""
109
      btnDisable = "disabled"
6777 dpurdie 110
      If canModify AND isaRelease Then
6770 dpurdie 111
         btnText = "Toggle Replication State"
112
         btnClass = "class=btn_enable"
113
         btnDisable = ""
114
      End If
115
 
116
      html_string = html_string & "<td nowrap class='body_row' title='" & btnText & "'><input " & btnClass & " type='checkbox' " &btnDisable & " "& activeChecked &" ></td>"
117
 
118
     ' Replication Mode
119
      html_string = html_string & "<td nowrap class='body_row'>" & replicationMode & "</td>"
120
 
121
     ' Delete Operation
122
     Dim DelUserImage : DelUserImage = LIMG_NDEL_DISABLED
123
     btnText = "Operation not available"
124
     btnClass = ""
6777 dpurdie 125
     If canModify AND isaRelease Then
6770 dpurdie 126
         DelUserImage = LIMG_NDEL
127
         btnText = "Remove this replica"
128
         btnClass = "class=btn_delete"
129
     End If
130
 
131
     html_string = html_string & "<td nowrap valign='top' " & btnClass & " title='" & btnText & "'>" & DelUserImage & "</td>"
132
 
133
      ' END ROW
134
      html_string = html_string & "</tr>"
135
 
136
      rsQry.MoveNext
137
 
138
      ' ROW SEPERATOR
139
      'If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
140
         html_string = html_string & "<tr><td colspan='8' class=body_line></td></tr>"
141
      'End If
142
   Loop
143
 
144
   ' destroy objects
145
   rsQry.Close()
146
   Set rsQry = nothing
147
 
148
   ' return result
149
   PV_ID_ListHTML = html_string
150
End Function
151
'----------------------------------------------------
152
'   Insert scripts into the header section of the generated document
153
Sub InsertUserScripts
154
 %>
155
<script language="javascript">
156
$(document).ready(function () {
157
 
158
    //  Add operation to all the delete buttons
159
    $('.btn_delete').on('click', function(){
160
        var el = $(this);
161
        var trel = el.closest("tr");
162
        var rtag_id = <%=DB_RTAG_ID%>;
163
        var server_id = trel.data("server_id");
164
 
165
        var colData = new Array();
166
        trel.each(function(){
167
            $(this).find('td').each(function(){
168
                colData.push($(this));
169
            })
170
        });
171
        var replicaName = colData[1].text();
172
 
173
        vixConfirm("Remove replication to '"+replicaName+"' of this release", 
174
            {
175
                deferred : true,  
176
            }).done(function(){
177
                $.ajax({
178
                    type : 'POST',
179
                    url : '_json_Replication.asp',
180
                    data : {Opr : 'RemoveRelease', server_id : server_id, user_id : <%=objAccessControl.UserId%>, rtag_id : rtag_id },
181
                    dataType : 'json',
182
                }).fail(function( jqXHR, textStatus, errorThrown ){
183
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
184
                }).done(function( data, textStatus, jqXHR ){
185
                    if (typeof data.result === undefined){
186
                        vixAlert('Ajax Error. Unexpected result');
187
                    } else if (data.result != 0){
188
                        vixAlert('Error Deleting item.<p>' + data.emsgDetails);
189
                    } else {
190
                        // Process individual items to show that an action has been taken
191
                        //
192
                        colData[1].addClass("strike");
193
                        colData[0].empty();
194
                        colData[2].empty();
195
                        colData[3].empty();
196
                    }
197
                });
198
            });
199
    });
200
 
201
    //  Add operation to all the enable buttons
202
    $('.btn_enable').on('click', function(e){
203
        var el = $(this);
204
        var trel = el.closest("tr");
205
        var rtag_id = <%=DB_RTAG_ID%>;
206
        var server_id = trel.data("server_id");
207
        var state =  $(this).prop("checked");
208
        var stateChanged = false;
209
 
210
        var colData = new Array();
211
        trel.each(function(){
212
            $(this).find('td').each(function(){
213
                colData.push($(this));
214
            })
215
        });
216
        var replicaName = colData[1].text();
217
        var stateText = state ? 'Enable' : 'Disable'; 
218
 
219
        vixConfirm(stateText + " replication to '"+replicaName+"' of this release", 
220
             {
221
                 deferred : true,
222
             }).done(function(){
223
                $.ajax({
224
                    type : 'POST',
225
                    url : '_json_Replication.asp',
226
                    data : {Opr : 'EnableRelease', server_id : server_id, user_id : <%=objAccessControl.UserId%>, rtag_id : rtag_id, new_state : state ? 'Y' : 'N' },
227
                    dataType : 'json',
228
                }).fail(function( jqXHR, textStatus, errorThrown ){
229
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
230
                }).done(function( data, textStatus, jqXHR ){
231
                    if (typeof data.result === undefined){
232
                        vixAlert('Ajax Error. Unexpected result');
233
                    } else if (data.result != 0){
234
                        vixAlert('Error setting state.<p>' + data.emsgDetails);
235
                    } else {
236
                        stateChanged = true;
237
                    }
238
                }).always(function(){
239
                    if ( !stateChanged ) {
240
                        el.prop("checked", !state);
241
                    }
242
                });
243
            }).fail(function(){
244
                el.prop("checked", !state);
245
            });
246
        });
247
 
248
});
249
</script>
250
<%
251
End Sub
252
%>
253
<%
254
'------------ RUN BEFORE PAGE RENDER ----------
255
'
256
'----------------------------------------------------
257
Sub LeftPanelContent
258
End Sub
259
'----------------------------------------------------
260
Sub MainPanelContent
261
%>
262
   <table class="embedded_table" style="margin-bottom:20px">
263
      <tr>
264
         <td>
265
            <!-- Box Title -->
266
            <div class="form_ttl nowrap" align="left">
267
                 Release Replication Details
268
            </div>
269
         </td>
270
      </tr>
271
      <tr>
272
         <td>
273
            <!-- Box Content -->
274
            <div class="rounded_box">
275
               <div style="background-color: white;border-left: white solid 10px;border-right: white solid 10px;">
276
                    <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
277
                    <!--#include file="messages/_msg_inline.asp"-->
278
                    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
279
                    <table width="100%"  border="0" cellspacing="2" cellpadding="0">
280
                        <tr>
281
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Active<%=Quick_Help("activeReplica")%></td>
282
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Replica</td>
283
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Enabled<%=Quick_Help("enabledRelease")%></td>
284
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Relication Mode</td>
285
                           <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Opr</td>
286
                        </tr>
287
                        <%=PV_ID_ListHTML()%>
288
                  </table>
289
                  <table class="full_table">
290
                     <tr>
291
                        <td align="right" nowrap valign="bottom" class="abtnItem" title="Add New Replication Targets">
6777 dpurdie 292
                        <%If canModify Then%>
6770 dpurdie 293
                           <a href="javascript:;" onClick="MM_openVixIFrame('wAddReleaseReplica.asp?rtag_id=<%=DB_RTAG_ID%>','Add Release Replication')">
294
                              <img src="icons/btn_add.gif" width="13" height="13" align="absmiddle" border="0" hspace="3" >
295
                              Add Release Replica
296
                           </a>
297
                        <%Else%>
298
                             <img src="icons/btn_add_dis.gif" width="13" height="13" align="absmiddle" border="0" hspace="3">
299
                              Add Release Replica
300
                        <%End If%>
301
                        </td>
302
                     </tr>
303
                  </table>
304
               </div>
305
            </div>
306
         </td>
307
      </tr>
308
   </table>
309
<%
310
End Sub
311
%>
312
<html>
313
   <head>
314
      <title>Release Manager</title>
315
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
316
      <meta http-equiv="Pragma" content="no-cache">
317
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
318
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
319
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
320
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
321
      <!-- DROPDOWN MENUS -->
322
      <%bJqueryDataTables = TRUE%>
323
      <!--#include file="_jquery_includes.asp"-->
324
      <!--#include file="_menu_def.asp"-->
325
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
326
      <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
327
      <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
328
      <script language="JavaScript" type="text/JavaScript">
329
      formTips.tips.activeReplica   = stdTip(200, 'Active Replica', 'This package replica has been marked as active.');
330
      formTips.tips.enabledRelease  = stdTip(200, 'Enabled Release','Replication of this release has been enabled. This will only ' +
331
                                            'be effective if the replica is active');
332
      </script>
333
      <%Call InsertUserScripts%>
334
   </head>
335
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
336
      <!-- HEADER -->
337
      <!--#include file="_header.asp"-->
338
      <!-- BODY ---->
339
      <table class="full_table">
340
         <tr>
341
            <td width="146px" class="panel_bg" valign="top">
342
                <%Call LeftPanelContent%>
343
            </td>
344
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
345
                <%Call MainPanelContent%>
346
            </td>
347
         </tr>
348
         <tr>
349
            <td class="panel_bg" valign="bottom" align="center" height="350"></td>
350
         </tr>
351
      </table>
352
      <!-- FOOTER -->
353
      <!--#include file="_footer.asp"-->
354
   </body>
355
</html>
356