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