Subversion Repositories DevTools

Rev

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