Subversion Repositories DevTools

Rev

Rev 6579 | Rev 6612 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'   View Release Notification Details
'   form_view_release_notifications.asp
'=====================================================
Option explicit
' Good idea to set when using redirect
Response.Expires = 0  ' always load the page, dont store
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_form_window_common.asp"-->
<%
' Make sure rtag_id is always present
If Request("proj_id") = "" Then
    Call Destroy_All_Objects
        Response.Redirect("index.asp")
End If

' Set rfile parameter. This is a return page after Login
Call objPMod.StoreParameter ( "rfile", "dependencies.asp" )
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim sPrevPage
Dim parProjId
Dim canDelete
'------------ Constants Declaration -----------
Const LIMG_USER          = "<img src='images/i_user.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
Const LIMG_USER_DISABLED = "<img src='images/i_user_disabled.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"

Const LIMG_NDEL          = "<img src='icons/i_remove.gif' width='16' height='16' hspace='2' border='0' align='absmiddle'>"
Const LIMG_NDEL_DISABLED = "<img src='icons/i_remove_dis.gif' width='16' height='16' hspace='2' border='0' align='absmiddle' class='lessOpacity'>"

'------------ Variable Init -------------------
parProjId = Request("proj_id")
sPrevPage = QStrParDefault("prevPage", Request.ServerVariables("HTTP_REFERER"))
canDelete = canActionControlInProject("AdminView")

'--------------------------------------------------------------------------------------------------------------------------
'  notifications_query_string
'
'  DESCRIPTION
'     Constructs a query string using the provided notification information
'
Function notifications_query_string()

   notifications_query_string = _
            "SELECT p.PKG_NAME, " & _
            "  p.pkg_id, " & _
            "  u.user_id, " & _
            "  u.FULL_NAME, " & _
            "  u.USER_EMAIL, " & _
            "  u.IS_DISABLED " & _
            "FROM PACKAGE_INTEREST pi, " & _
            "  USERS u, " & _
            "  PACKAGES p " & _
            "WHERE pi.USER_ID = u.USER_ID " & _
            "AND pi.PROJ_ID   = :PROJ_ID " & _
            "AND p.PKG_ID     = pi.PKG_ID " & _
            "ORDER BY UPPER(PKG_NAME), " & _
            "  UPPER(FULL_NAME)"

End Function


'--------------------------------------------------------------------------------------------------------------------------
'  PV_ID_ListHTML
'
'  DESCRIPTION
'     Constructs the HTML to render the rows of package names, and other information
'
Function PV_ID_ListHTML
   Dim rsQry
   Dim html_string
   Dim lastPkgId : lastPkgId = 0
   Dim thisPkgId

   OraDatabase.Parameters.Add "PROJ_ID", parProjId, ORAPARM_INPUT, ORATYPE_NUMBER
   Set rsQry = OraDatabase.DbCreateDynaset( notifications_query_string(), cint(0) )
   OraDatabase.Parameters.Remove "PROJ_ID"

   '--- Render rows ---
   Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)


      ' BEGIN ROW
      html_string = html_string & "<tr data-user_id=""" & rsQry("user_id") & """ data-pkg_id=""" & rsQry("pkg_id") & """>"

      ' PACKAGE NAME
      thisPkgId = rsQry("pkg_id")
      Dim eClass : eClass = ""
      Dim pName : pName = rsQry("pkg_name")

      If lastPkgId <> thisPkgId Then
        lastPkgId = thisPkgId 
      Else
        eClass = " invisible"
      End If
      html_string = html_string & "<td nowrap class='body_rowg" & eClass &"'>" & rsQry("pkg_name") & "</td>"


      ' User Name, with email as hyperlink
      Dim userImage : userImage = LIMG_USER_DISABLED
      If isNull(rsQry("is_DISABLED")) Then
          userImage = LIMG_USER
      End If

      html_string = html_string & "<td nowrap class='body_rowg'><span data-email='" & rsQry("user_email") & "' class='mailto txt_linked'>" & userImage & rsQry("FULL_NAME") & "</span></td>"

      ' Operation
      Dim DelUserImage : DelUserImage = LIMG_NDEL_DISABLED
      Dim btnText : btnText = "Operation not available"
      Dim btnClass : btnClass = "" 
      If canDelete OR objAccessControl.UserId = rsQry("user_id") Then
          DelUserImage = LIMG_NDEL
          btnText = "Remove notifications to this user"
          btnClass = "class=btn_delete"
      End If

      html_string = html_string & "<td nowrap valign='top' " & btnClass & " title='" & btnText & "'>" & DelUserImage & "</td>"

      ' END ROW
      html_string = html_string & "</tr>"

      rsQry.MoveNext

      ' ROW SEPERATOR
      If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
         html_string = html_string & "<tr><td colspan='8' background='images/bg_table_border.gif'><img src='images/spacer.gif' width='1' height='1'></td></tr>"
      End If
   Loop

   ' destroy objects
   rsQry.Close()
   Set rsQry = nothing

   ' return result
   PV_ID_ListHTML = html_string
End Function

'--------------------------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------------------------
'------------ RUN BEFORE PAGE RENDER ----------
'----------------------------------------------
%>
<html>

<head>
<title>Release Manager</title>
<link rel="shortcut icon" href="<%=FavIcon%>"/>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
<link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
<script language="JavaScript" src="scripts/remote_scripting.js?ver=<%=VixVerNum%>"></script>
<!-- DROPDOWN MENUS -->
<!--#include file="_jquery_includes.asp"-->
<!--#include file="_menu_def.asp"-->
<script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
<!-- TIPS -->
<script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
<script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
<script language="JavaScript" type="text/javascript">
<!--
formTips.tips.enabledUser   = stdTip(200, 'Enabled User', 'Emails will be sent to disabled users.'+
                                         '<p>They will not be allowed access to the Manager Suite of applications.' +
                                         'This is an indication that the user many not be required to receive notifications.' );
formTips.tips.opr           = stdTip(200, 'Operations', 'A user can delete their own notification request' +
                                         '<p>A user with "ViewAdmin" permission can delete any users notification request.');
</script>
<script language="javascript">
$(document).ready(function () {

    //  Add operation to all the delete buttons
    $('.btn_delete').on('click', function(){
        var el = $(this);
        var trel = el.closest("tr");
        var proj_id = <%=parProjId%>;
        var uid_id = trel.data("user_id");
        var pkg_id = trel.data("pkg_id");

        var colData = new Array();
        trel.each(function(){
            $(this).find('td').each(function(){
                colData.push($(this));
            })
        });
        var pkgName = colData[0].text();
        var userName = colData[1].text();

        vixConfirm("Remove notifications from the '"+pkgName+"' package<br>for user '"+userName+"'<br>in the current project", 
            {ok     : removeUserNotification, 
             data   : { uid     : uid_id, 
                        proj_id : proj_id,
                        pkg_id  : pkg_id,
                        element : trel,
                        colData   : colData
            }});
    });

    //  Delete notifications for this package in selected projects
    function removeUserNotification(args)
    {
        //console.log("removeUserNotification", args.data.pkg_id, args.data.uid, args.data.proj_id);
        $.ajax({
            type : 'POST',
            url : '_json_Notifications.asp',
            data : {Opr : 'RemoveUserFromProject', pkg_id : args.data.pkg_id, user_id : args.data.uid, proj_id : args.data.proj_id },
            dataType : 'json',
        }).fail(function( jqXHR, textStatus, errorThrown ){
            vixAlert('Ajax Error. Unexpected result.<p>' + errorThrown);
        }).done(function( data, textStatus, jqXHR ){
            if (typeof data.result === undefined){
                vixAlert('Ajax Error. Unexpected result');
            } else if (data.result != 0){
                vixAlert('Error Deleting item.<p>' + data.emsgDetails);
            } else {
                // Process individual items to show that an action has been taken
                //
                args.data.colData[1].addClass("strike");
                args.data.colData[2].remove();
            }
        });
    }
});
</script>
</head>
<!-- HEADER -->
<!--#include file="_header.asp"-->
<!-- BODY ---->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
      <td width="1" background="images/bg_home_orange.gif" valign="top"></td>
      <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
         <table width="95%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td width="1%"></td>
               <td width="100%">
                  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                     <tr>
                        <td nowrap class="body_txt"></td>
                     </tr>
                  </table>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                     <tr>
                        <td nowrap class="form_ttl"><p>&nbsp;</p>
                           <p>VIEW PROJECT NOTIFICATION DETAILS</p>
                        </td>
                        <td align="right" valign="bottom"></td>
                     </tr>
                  </table>
               </td>
               <td width="1%"></td>
            </tr>
            <tr>
               <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
               <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
               <td align="right" valign="top"  background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
            </tr>
            <tr>
               <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
               <td bgcolor="#FFFFFF" valign="top">
                  <%
                  %>
                  <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
                  <!--#include file="messages/_msg_inline.asp"-->
                  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
                  <br>
                  <table width="100%"  border="0" cellspacing="2" cellpadding="0">
                  <tr><td colspan="3" class="body_row"> Notifications apply to all Releases in a Project<p></td></tr>
                     <tr>
                        <td valign="top"></td>
                     </tr>
                     <tr>
                       <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package Name</td>
                       <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">User<%=Quick_Help("enabledUser")%></td>
                       <td width="1%" valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Opr<%=Quick_Help("opr")%></td>
                       <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">
                    </tr>
                    <%=PV_ID_ListHTML()%>
                  </table>
               </td>
               <td background="images/lbox_bgside_white.gif">&nbsp;</td>
            </tr>
            <tr>
               <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
               <td background="images/lbox_bg_blue.gif"></td>
               <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
            </tr>
         </table>
      </td>
      <td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
   </tr>
   <tr>
      <td valign="bottom" align="center" background="images/bg_home_orange.gif"><img src="images/img_vtree.gif" width="86" height="99" vspace="20" hspace="30"></td>
      <td background="images/bg_lght_gray.gif" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="500"></td>
   </tr>
</table>
<!-- FOOTER -->
<!--#include file="_footer.asp"-->
</body>
</html>