Subversion Repositories DevTools

Rev

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