Subversion Repositories DevTools

Rev

Rev 6827 | Rev 6876 | 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
'--------------------------------------------------------------------------------------------------------------------------
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
        "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
6784 dpurdie 135
   GenerateTableBody = html_string
6770 dpurdie 136
End Function
6783 dpurdie 137
'----------------------------------------------------
6784 dpurdie 138
'   Insert Includes and scripts associated with TIPS
139
Sub InsertTips
140
 %>
141
<!-- TIPS -->
142
<script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
143
<script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
144
<script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
145
<script language="JavaScript" type="text/JavaScript">
146
formTips.tips.activeReplica   = stdTip(200, 'Active Replica', 'This package replica has been marked as active.');
147
formTips.tips.enabledProject  = stdTip(200, 'Enabled Project','Replication of this project has been enabled. This will only ' +
148
                                    'be effective if the replica is active');
149
</script>
150
<%
151
End Sub
152
'----------------------------------------------------
6783 dpurdie 153
'   Insert scripts into the header section of the generated document
154
Sub InsertUserScripts
155
 %>
6784 dpurdie 156
<!-- JQUERY SCRIPTS -->
6770 dpurdie 157
<script language="javascript">
158
$(document).ready(function () {
159
 
160
    //  Add operation to all the delete buttons
161
    $('.btn_delete').on('click', function(){
162
        var el = $(this);
163
        var trel = el.closest("tr");
164
        var proj_id = <%=parProjId%>;
165
        var server_id = trel.data("server_id");
166
 
167
        var colData = new Array();
168
        trel.each(function(){
169
            $(this).find('td').each(function(){
170
                colData.push($(this));
171
            })
172
        });
173
        var replicaName = colData[1].text();
174
 
175
        vixConfirm("Remove replication to '"+replicaName+"' of all Releases in this Project", 
176
            {
177
                deferred : true,  
178
            }).done(function(){
179
                $.ajax({
180
                    type : 'POST',
181
                    url : '_json_Replication.asp',
182
                    data : {Opr : 'RemoveProject', server_id : server_id, user_id : <%=objAccessControl.UserId%>, proj_id : proj_id },
183
                    dataType : 'json',
184
                }).fail(function( jqXHR, textStatus, errorThrown ){
185
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
186
                }).done(function( data, textStatus, jqXHR ){
187
                    if (typeof data.result === undefined){
188
                        vixAlert('Ajax Error. Unexpected result');
189
                    } else if (data.result != 0){
190
                        vixAlert('Error Deleting item.<p>' + data.emsgDetails);
191
                    } else {
192
                        // Process individual items to show that an action has been taken
193
                        //
194
                        colData[1].addClass("strike");
195
                        colData[0].empty();
196
                        colData[2].empty();
197
                        colData[3].empty();
198
                    }
199
                });
200
            });
201
    });
202
 
203
    //  Add operation to all the enable buttons
204
    $('.btn_enable').on('click', function(e){
205
        var el = $(this);
206
        var trel = el.closest("tr");
207
        var proj_id = <%=parProjId%>;
208
        var server_id = trel.data("server_id");
209
        var state =  $(this).prop("checked");
210
        var stateChanged = false;
211
 
212
        var colData = new Array();
213
        trel.each(function(){
214
            $(this).find('td').each(function(){
215
                colData.push($(this));
216
            })
217
        });
218
        var replicaName = colData[1].text();
219
        var stateText = state ? 'Enable' : 'Disable'; 
220
 
221
        vixConfirm(stateText + " replication to '"+replicaName+"' of all Releases in this Project", 
222
             {
223
                 deferred : true,
224
             }).done(function(){
225
                $.ajax({
226
                    type : 'POST',
227
                    url : '_json_Replication.asp',
228
                    data : {Opr : 'EnableProject', server_id : server_id, user_id : <%=objAccessControl.UserId%>, proj_id : proj_id, new_state : state ? 'Y' : 'N' },
229
                    dataType : 'json',
230
                }).fail(function( jqXHR, textStatus, errorThrown ){
231
                    vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
232
                }).done(function( data, textStatus, jqXHR ){
233
                    if (typeof data.result === undefined){
234
                        vixAlert('Ajax Error. Unexpected result');
235
                    } else if (data.result != 0){
236
                        vixAlert('Error setting state.<p>' + data.emsgDetails);
237
                    } else {
238
                        stateChanged = true;
239
                    }
240
                }).always(function(){
241
                    if ( !stateChanged ) {
242
                        el.prop("checked", !state);
243
                    }
244
                });
245
            }).fail(function(){
246
                el.prop("checked", !state);
247
            });
248
        });
249
 
250
});
251
</script>
6783 dpurdie 252
<%
253
End Sub
254
 
255
 
256
'--------------------------------------------------------------------------------------------------------------------------
257
'--------------------------------------------------------------------------------------------------------------------------
258
'------------ RUN BEFORE PAGE RENDER ----------
259
'
260
'----------------------------------------------------
261
Sub LeftPanelContent
262
End Sub
263
'----------------------------------------------------
264
Sub MainPanelContent
265
%>
6770 dpurdie 266
          <table class="rounded_box embedded_table">
267
          <caption nowrap class="form_ttl tleft">Project Replication Details</caption>
268
              <tr>
6784 dpurdie 269
                <td>
6874 dpurdie 270
                    <div class='rounded_box_pad'>
6770 dpurdie 271
                        <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
272
                        <!--#include file="messages/_msg_inline.asp"-->
273
                        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
274
                        <table width="100%"  border="0" cellspacing="2" cellpadding="0">
275
                            <tr>
276
                               <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Active<%=Quick_Help("activeReplica")%></td>
277
                               <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Replica</td>
278
                               <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Enabled<%=Quick_Help("enabledProject")%></td>
279
                               <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Relication Mode</td>
280
                               <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Opr</td>
281
                            </tr>
6784 dpurdie 282
                            <%=GenerateTableBody()%>
6770 dpurdie 283
                      </table>
284
                      <table class="full_table">
285
                         <tr>
6827 dpurdie 286
                            <%BuildActionButtonClick canModify, "Add Project Replica", "Add New Replication Target", true, _
287
                                "src='icons/btn_add.gif' width='13' height='13' align='absmiddle' border='0' hspace='3'", _
288
                                "MM_openVixIFrame('wAddProjReplica.asp?proj_id=" & parProjId &"','Add Project Replication')"
289
                            %>
6770 dpurdie 290
                            </td>
291
                         </tr>
292
                      </table>
6784 dpurdie 293
                    </div>
294
                </td>
6770 dpurdie 295
              </tr>
296
          </table>
6783 dpurdie 297
<%End Sub%>
298
<html>
299
   <head>
300
      <title>Release Manager</title>
301
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
302
      <meta http-equiv="Pragma" content="no-cache">
303
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
304
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
305
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
306
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
307
      <!-- DROPDOWN MENUS -->
308
      <!--#include file="_jquery_includes.asp"-->
309
      <!--#include file="_menu_def.asp"-->
310
      <%Call InsertUserScripts%>
6784 dpurdie 311
      <%Call InsertTips%>
6783 dpurdie 312
   </head>
313
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
314
      <!-- HEADER -->
315
      <!--#include file="_header.asp"-->
316
      <!-- BODY ---->
317
      <table class="full_table">
318
         <tr>
319
            <td width="146px" class="panel_bg" valign="top">
320
                <%Call LeftPanelContent%>
321
            </td>
322
            <td width="90%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
323
                <%Call MainPanelContent%>
324
            </td>
325
         </tr>
326
         <tr>
327
            <td class="panel_bg" valign="bottom" align="center" height="350"></td>
328
         </tr>
329
      </table>
330
      <!-- FOOTER -->
331
      <!--#include file="_footer.asp"-->
332
   </body>
6770 dpurdie 333
</html>