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
'   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
34
Dim canDelete
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"))
43
canDelete = canActionControlInProject("AdminView")
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" &_
66
        "    AND (bp.BLAT_ID is NOT NULL OR bs.BLAT_FULL = 'Y')" &_
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"
81
      If rsQry("blat_full") = "Y" Then
82
          replicationMode = "Repository"
83
      ElseIf  rsQry("inUse") > 0 Then
84
          replicationMode = "Project"
85
      End If
86
 
87
      ' BEGIN ROW
88
      html_string = html_string & "<tr data-server_id=""" & rsQry("BLAT_ID") & """>"
89
 
90
      ' Server Active
91
      Dim activeChecked
92
      activeChecked = IIF(rsQry("BLAT_ENABLE") = "Y", "checked", "" )
93
      html_string = html_string & "<td nowrap class='body_row'><input type='checkbox' disabled "& activeChecked &" ></td>"
94
 
95
      ' Server Name
96
      html_string = html_string & "<td nowrap class='body_row'>" & rsQry("BLAT_DISPLAY_NAME") & "</td>"
97
 
98
      ' Project Active
99
      activeChecked = IIF(rsQry("BP_ENABLED") = "Y", "checked", "" )
100
      btnText = "Operation not available"
101
      btnClass = ""
102
      btnDisable = "disabled"
103
      If canDelete AND inUse Then
104
         btnText = "Toggle Replication State"
105
         btnClass = "class=btn_enable"
106
         btnDisable = ""
107
      End If
108
 
109
      html_string = html_string & "<td nowrap class='body_row' title='" & btnText & "'><input " & btnClass & " type='checkbox' " &btnDisable & " "& activeChecked &" ></td>"
110
 
111
     ' Replication Mode
112
      html_string = html_string & "<td nowrap class='body_row'>" & replicationMode & "</td>"
113
 
114
     ' Delete Operation
115
     Dim DelUserImage : DelUserImage = LIMG_NDEL_DISABLED
116
     btnText = "Operation not available"
117
     btnClass = ""
118
     If canDelete AND inUse Then
119
         DelUserImage = LIMG_NDEL
120
         btnText = "Remove this replica"
121
         btnClass = "class=btn_delete"
122
     End If
123
 
124
     html_string = html_string & "<td nowrap valign='top' " & btnClass & " title='" & btnText & "'>" & DelUserImage & "</td>"
125
 
126
      ' END ROW
127
      html_string = html_string & "</tr>"
128
 
129
      rsQry.MoveNext
130
 
131
      ' ROW SEPERATOR
132
      'If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
133
         html_string = html_string & "<tr><td colspan='8' class=body_line></td></tr>"
134
      'End If
135
   Loop
136
 
137
   ' destroy objects
138
   rsQry.Close()
139
   Set rsQry = nothing
140
 
141
   ' return result
142
   PV_ID_ListHTML = html_string
143
End Function
144
 
145
'--------------------------------------------------------------------------------------------------------------------------
146
'--------------------------------------------------------------------------------------------------------------------------
147
'------------ RUN BEFORE PAGE RENDER ----------
148
'----------------------------------------------
149
%>
150
<html>
151
 
152
<head>
153
<title>Release Manager</title>
154
<link rel="shortcut icon" href="<%=FavIcon%>"/>
155
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
156
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
157
<link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
158
<link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
159
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
160
<script language="JavaScript" src="scripts/remote_scripting.js?ver=<%=VixVerNum%>"></script>
161
<!-- DROPDOWN MENUS -->
162
<!--#include file="_jquery_includes.asp"-->
163
<!--#include file="_menu_def.asp"-->
164
<script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
165
<!-- TIPS -->
166
<script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
167
<script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
168
<script language="JavaScript" type="text/javascript">
169
formTips.tips.activeReplica   = stdTip(200, 'Active Replica', 'This package replica has been marked as active.');
170
formTips.tips.enabledProject  = stdTip(200, 'Enabled Project','Replication of this project has been enabled. This will only ' +
171
                                            'be effective if the replica is active');
172
</script>
173
<script language="javascript">
174
$(document).ready(function () {
175
 
176
    //  Add operation to all the delete buttons
177
    $('.btn_delete').on('click', function(){
178
        var el = $(this);
179
        var trel = el.closest("tr");
180
        var proj_id = <%=parProjId%>;
181
        var server_id = trel.data("server_id");
182
 
183
        var colData = new Array();
184
        trel.each(function(){
185
            $(this).find('td').each(function(){
186
                colData.push($(this));
187
            })
188
        });
189
        var replicaName = colData[1].text();
190
 
191
        vixConfirm("Remove replication to '"+replicaName+"' of all Releases in this Project", 
192
            {
193
                deferred : true,  
194
            }).done(function(){
195
                $.ajax({
196
                    type : 'POST',
197
                    url : '_json_Replication.asp',
198
                    data : {Opr : 'RemoveProject', server_id : server_id, user_id : <%=objAccessControl.UserId%>, proj_id : proj_id },
199
                    dataType : 'json',
200
                }).fail(function( jqXHR, textStatus, errorThrown ){
201
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
202
                }).done(function( data, textStatus, jqXHR ){
203
                    if (typeof data.result === undefined){
204
                        vixAlert('Ajax Error. Unexpected result');
205
                    } else if (data.result != 0){
206
                        vixAlert('Error Deleting item.<p>' + data.emsgDetails);
207
                    } else {
208
                        // Process individual items to show that an action has been taken
209
                        //
210
                        colData[1].addClass("strike");
211
                        colData[0].empty();
212
                        colData[2].empty();
213
                        colData[3].empty();
214
                    }
215
                });
216
            });
217
    });
218
 
219
    //  Add operation to all the enable buttons
220
    $('.btn_enable').on('click', function(e){
221
        var el = $(this);
222
        var trel = el.closest("tr");
223
        var proj_id = <%=parProjId%>;
224
        var server_id = trel.data("server_id");
225
        var state =  $(this).prop("checked");
226
        var stateChanged = false;
227
 
228
        var colData = new Array();
229
        trel.each(function(){
230
            $(this).find('td').each(function(){
231
                colData.push($(this));
232
            })
233
        });
234
        var replicaName = colData[1].text();
235
        var stateText = state ? 'Enable' : 'Disable'; 
236
 
237
        vixConfirm(stateText + " replication to '"+replicaName+"' of all Releases in this Project", 
238
             {
239
                 deferred : true,
240
             }).done(function(){
241
                $.ajax({
242
                    type : 'POST',
243
                    url : '_json_Replication.asp',
244
                    data : {Opr : 'EnableProject', server_id : server_id, user_id : <%=objAccessControl.UserId%>, proj_id : proj_id, new_state : state ? 'Y' : 'N' },
245
                    dataType : 'json',
246
                }).fail(function( jqXHR, textStatus, errorThrown ){
247
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
248
                }).done(function( data, textStatus, jqXHR ){
249
                    if (typeof data.result === undefined){
250
                        vixAlert('Ajax Error. Unexpected result');
251
                    } else if (data.result != 0){
252
                        vixAlert('Error setting state.<p>' + data.emsgDetails);
253
                    } else {
254
                        stateChanged = true;
255
                    }
256
                }).always(function(){
257
                    if ( !stateChanged ) {
258
                        el.prop("checked", !state);
259
                    }
260
                });
261
            }).fail(function(){
262
                el.prop("checked", !state);
263
            });
264
        });
265
 
266
});
267
</script>
268
</head>
269
<!-- HEADER -->
270
<!--#include file="_header.asp"-->
271
<!-- BODY ---->
272
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
273
   <tr>
274
      <td width="146px" class="panel_bg" valign="top">&nbsp;</td>
275
      <td align="center" valign="top" bgcolor="#EEEFEF" style="padding: 5px;">
276
      <!-- Main Pane -->
277
      <!-- Section Header ---->
278
      <div>
279
          <table class="rounded_box embedded_table">
280
          <caption nowrap class="form_ttl tleft">Project Replication Details</caption>
281
              <tr>
282
                    <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10"></td>
283
                    <td bgcolor="#FFFFFF" valign="top">
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("enabledProject")%></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>
295
                            <%=PV_ID_ListHTML()%>
296
                      </table>
297
                      <table class="full_table">
298
                         <tr>
299
                            <td align="right" nowrap valign="bottom" class="abtnItem">
300
                            <%If canDelete Then%>
301
                               <a href="javascript:;" onClick="MM_openVixIFrame('wAddProjReplica.asp?proj_id=<%=parProjId%>','Add Project Replication')">
302
                                  <img src="icons/btn_add.gif" width="13" height="13" align="absmiddle" border="0" hspace="3" title="Add New Replication Targets">
303
                                  Add Project Replica
304
                               </a>
305
                            <%Else%>
306
                                 <img src="icons/btn_add_dis.gif" width="13" height="13" align="absmiddle" border="0" hspace="3" title="Add New Replication Targets">
307
                                  Add Project Replica
308
                            <%End If%>
309
                            </td>
310
                         </tr>
311
                      </table>
312
                  </td>
313
                  <td background="images/lbox_bgside_white.gif">&nbsp;</td>
314
              </tr>
315
          </table>
316
      </div>
317
      <!-- End Main Pane -->
318
      </td>
319
   </tr>
320
</table>
321
 
322
<!-- FOOTER -->
323
<!--#include file="_footer.asp"-->
324
</body>
325
</html>