<%@page import="org.apache.commons.lang.math.NumberUtils"%>
<%@ page import="java.sql.*,java.util.Vector,sapphire.reports.*,sapphire.ui.SapphireConfigsettings,sapphire.performance.BusinessServiceReportDAO,com.sapphireims.web.i18n.SapphireI18nUtil" %>
<%@page import="sapphire.servicedesk.utils.*"%>
<%@page import="java.io.Serializable"%>
<%@page import="org.xnap.commons.i18n.I18n"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/WEB-INF/ajaxtld/ajaxtags.tld" prefix="ajax" %>
<%@ taglib uri="/WEB-INF/ajaxtld/displaytag-12.tld" prefix="display" %>
<%@page import="sapphire.servicedesk.utils.SDProjectPermission,sapphire.servicedesk.utils.GetUserData"%>
<%@ page import="java.io.Serializable,sapphire.ui.*,sapphire.servicedesk.utils.*"%>
<%@page import="org.xnap.commons.i18n.I18n,com.sapphireims.web.i18n.SapphireI18nUtil"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="toptable.jsp" %>
<%    I18n i18n = SapphireI18nUtil.getI18nInstance((String) session.getAttribute("LANGUAGE_UNICODE"));
    String messageIn = "";
    Sapphire sapphire = new Sapphire();
    String settingsTenentDB = (String) session.getAttribute("TELANTNAME");
    Integer module = (Integer) application.getAttribute(settingsTenentDB + "_MODULES_Enabled");
    IConfigSettingService configSettingService = (IConfigSettingService) SpringContextUtil.getBeanByName("configSettingService",Sapphire.applicationScope);
    String itsmContextPath = "../" + configSettingService.findBySettingKey("ITSM_CONTEXTPATH") + "/";
    String welcomHeader = (String) session.getAttribute("welcomeMsgHeader");
%>

<html>
    <head>
        <link rel="stylesheet" href="css/style_sapphireIMS.css">
        <link rel="stylesheet" href="css/headerTop.css">
        <link rel="stylesheet" href="css/quickLink.css">
    </head>
    <script type="text/javascript" src="assets/js/jquery.min.js" ></script>
    <script>
        $(document).ready(function () {
            $.ajax({
                url: "../ITSM/getProcessTemplates.do",
                type: "GET",
                dataType: "json",

                success: function (data) {     
                    $.each(data, function (index, template) {
                        var templateName = template[1]; 
                        var templateLink = $("<a>").attr({
                            href: "<%= itsmContextPath%>SDProject_List.jsp?isNewUIAvailable=yes&projectImport=yes&templateID=" + template[0] + "&filename=" + encodeURIComponent(template[2]),
                            id: "projectImportLink"
                        }).text("Import " + templateName);
                        $('.quickLink_Block:first-child .quickLink_listing').prepend(templateLink);
                    });

                },
                error: function (xhr, status, error) {
                    console.error("Error occurred: " + error);
                }
            });
        });
    </script>
    <div class="quickLinkContainer">
        <div class="quickLinkBg">
            <h3>Quick Links</h3>
        </div>
        <div class="infoPanel basic">
            Here you go, and explore. A simplified way to configure projects, import users, set up email to record, and so on.Quick Link tab helps you to perform configurations for the various module Service Desk Configuration, Asset and Inventory Management,User Management
        </div>
        <div class="infoPanel process" style="display:none">
            IT Service Desk which is used to manage the IT services to end users. It comes with ITIL compliant in-built processes for Incident, Problem, Change and Service Requests. The processes can be customized based on the organization's process.
        </div>
        <div class="infoPanel emailToRecConfig" style="display:none">
            Mail server has to be configured in the service desk module so that when an e-mail is sent to the specified e-mail ID, automatically a service desk record is generated. This is to facilitate service desk users as well as those users who are not a part of SapphireIMS to submit a record.
        </div>
        <div class="infoPanel announcementInfo" style="display:none">
            Service Desk is also used for communicating with the service desk user community for important announcements like service outages, planned maintenance, conducting user surveys, organization announcement etc. Such announcements can be configured using SapphrieIMS Service Desk.
            SapphireIMS provides an option to conduct periodic surveys to assess satisfaction level of the users.
        </div>
        <div class="infoPanel assetInfo" style="display:none">
            Asset configuration provides an interface to capture additional asset details (which is not possible by auto discovery process). You can manage the life cycle of the assets right from procurement to scrap. This ensures effective management of your assets.
        </div>
        <div class="infoPanel usersInfo" style="display:none">
            SapphireIMS facilitates the creation and management of users who would be able to use the system through the user interface which allows addition/editing/removal of users. For each users the personal information including user ID, the full name, e-mail address, Phone Number, Each user is associated with a particular user role to facilitate secured access to the system.
        </div>
        <div class="infoPanel archivalInfo" style="display:none">
            Once a service desk record reaches the end state for example 'Close' state it reaches the end of its cycle and hence can be archived. Such service desk records can be automatically archived and moved to 'My Archived Requests' tab. These service desk records are archived after retaining it for a specified period.
            Service Desk Records can be archived only if 'Data Archival Scheduler' is enabled.
        </div>
        <div class="infoPanel smsToRecInfo" style="display:none">
            SapphireIMS uses wirelessmessenger schema to convert SMS to service desk records. The SMS is sent to a hard coded mobile number which will be converted into a service desk record. This is to facilitate service desk users as well as those users who are not a part of SapphireIMS to submit a record.
        </div>
        <div class="infoPanel customizeInfo" style="display:none">
            SapphireIMS gives you an option to customize the appearance of the application.Change the logos to reflect your organization's logo. Allows to change
            Customer Title which is visible in the browser title area, Login Header Text which is visible in the login header.Login Footer Text which is visible in the login footer
        </div>
        <div class="quickLink_Main">
            <div class="quickLink_MainBlock">
                <div class="quickLink_Block green">
                    <h3><i class="cardIco  templates"></i>Processes </h3>
                    <div class="quickLink_listing">
                        <a href="<%= itsmContextPath%>SDProject_List.jsp?isNewUIAvailable=yes&projectImport=yes" id="projectImportLink">Import Process</a>
                        <a href="<%= itsmContextPath%>SDProject_Configuration?isNewUIAvailable=yes&projectTemplate=1&projectType=4">Create Service Request</a>
                        <a href="<%= itsmContextPath%>SDProject_Configuration?isNewUIAvailable=yes&projectTemplate=4&projectType=3">Create Change Management </a>
                        <a href="<%= itsmContextPath%>SDProject_Configuration?isNewUIAvailable=yes&projectTemplate=2&projectType=1">Create Incident Management</a>
                        <a href="<%= itsmContextPath%>SDProject_Configuration?isNewUIAvailable=yes&projectTemplate=3&projectType=2">Create Problem Management</a>
                    </div>
                </div>
                <div class="quickLink_Block red">
                    <h3><i class="cardIco  emailToRec"></i>Email To Record</h3>
                    <div class="quickLink_listing">					
                        <a href="javascript:void(0)" id="emailToRecConfigLink">Enable Email to Record</a>
                        <a href="<%= itsmContextPath%>MailServerConfiguration.jsp?isNewUIAvailable=yes&transport=Transport1">Configure Pop3</a>
                        <a href="<%= itsmContextPath%>MailServerConfiguration.jsp?isNewUIAvailable=yes&transport=Transport2">Configure IMAP</a>
                        <a href="<%= itsmContextPath%>MailServerConfiguration.jsp?isNewUIAvailable=yes&transport=Transport3">Configure Exchange</a>
                        <a href="<%= itsmContextPath%>MailServerConfiguration.jsp?isNewUIAvailable=yes&transport=Transport4">Configure Modern Exchange</a>
                        <a href="<%= itsmContextPath%>MailServerConfiguration.jsp?isNewUIAvailable=yes&transport=Transport5">Configure Modern IMAP</a>
                        <a href="getMailProfileData.do?id1=0&isNewUIAvailable=yes&jqueryProtoReq=yes">Mail Profile</a>
                    </div>
                </div>
                <div class="quickLink_Block purple">
                    <h3><i class="cardIco announcePurple"></i>Announcement and Surveys</h3>
                    <div class="quickLink_listing">
                        <a href="<%= itsmContextPath%>Announcement.jsp?isNewUIAvailable=yes">Add New Announcement</a>
                        <a href="<%= itsmContextPath%>Survey_Add.jsp?isNewUIAvailable=yes">Add New Survey</a>
                        <a href="<%= itsmContextPath%>SurveyScheduleAdd.jsp?isNewUIAvailable=yes">Schedule Survey</a>
                        <a href="<%= itsmContextPath%>FeedbackAdditionalFieldTemplateAdd.jsp?isNewUIAvailable=yes">Create Feedback Form</a>
                    </div>
                </div>	
                <div class="quickLink_Block devicesGreen">
                    <h3><i class="cardIco  devicesGreen"></i>Assets</h3>
                    <div class="quickLink_listing">
                        <a href="<%= itsmContextPath%>AssetModule_AddEdit.jsp?action=Add&isNewUIAvailable=yes">New Module</a>
                        <a href="<%= itsmContextPath%>ManageAssetAdditionParam_Add.jsp?isNewUIAvailable=yes">Create Item Types</a>
                        <a href="<%= itsmContextPath%>UploadZipData.jsp?ExcelImport=yes&extensionType=CMDB_ASSET_IMPORT&isNewUIAvailable=yes&saveTemplate=yes">Create asset template</a>
                        <a href="<%= itsmContextPath%>UploadZipData.jsp?ExcelImport=yes&extensionType=CMDB_ASSET_IMPORT&isNewUIAvailable=yes">Import assets from template</a>
                    </div>
                </div>	
                <div class="quickLink_Block pink">
                    <h3><i class="cardIco  userImportPink"></i>Users</h3>
                    <div class="quickLink_listing">
                        <a href="ExcelUserImport.do?saveXL=yes&isNewUIAvailable=yes">Create user template</a>
                        <a href="ExcelUserImport.do?importXL=yes=1&isNewUIAvailable=yes">Import users from template</a>
                        <a href="ADConfiguration.jsp?isNewUIAvailable=yes">Add LDAP Rule Configuration</a>
                    </div>
                </div>
                <div class="quickLink_Block paleGreen">
                    <h3><i class="cardIco  archiveGreen"></i>Data Archival</h3>
                    <div class="quickLink_listing">
                        <a href="<%= itsmContextPath%>SD_DataArchivingScheduler.jsp?enableScheduler=yes&isNewUIAvailable=yes">Enable Data Archival Scheduler</a>
                    </div>
                </div>
                <div class="quickLink_Block yellow">
                    <h3><i class="cardIco smsToRec"></i>SMS To Record</h3>
                    <div class="quickLink_listing">					
                        <a href="<%= itsmContextPath%>SD_SMSToRecordConfiguration.jsp?isNewUIAvailable=yes">Configure SMS to Record Rule</a>
                    </div>
                </div>
                <div class="quickLink_Block orange">
                    <h3><i class="cardIco  customizeApp"></i>Customize Appearance</h3>
                    <div class="quickLink_listing">
                        <a href="ServiceDeskTemplate.jsp?loginLogo=yes&isNewUIAvailable=yes">Change Login Logo</a>
                        <a href="ServiceDeskTemplate.jsp?HeaderLogo=yes&isNewUIAvailable=yes">Change Header Logo</a>
                    </div>
                </div>					
            </div>				
        </div>
    </div>
</html>
<script  type="text/javascript" src="js/quickLink.js"></script>
<%
    connection myConn = null;
    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String headerContent = "";

    try {
        myConn = new connection();
        conn = myConn.getConnection(settingsTenentDB);
        pstmt = conn.prepareStatement("SELECT SettingValue FROM configSettings WHERE SettingKey='SEARCH_TOP'");
        rs = pstmt.executeQuery();
        if (rs.next()) {
            headerContent = rs.getString(1);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try { if (rs != null) rs.close(); } catch (Exception e) {}
        try { if (pstmt != null) pstmt.close(); } catch (Exception e) {}
        try { if (conn != null) conn.close(); } catch (Exception e) {}
    }
%>
<script type="text/javascript">
    jQuery(function () {
        var loggedInUserName = jQuery(".msg").attr("title");
        var originalString = "<%=headerContent%>";
        var updatedString = originalString.replace("MACRO_LOGINID", loggedInUserName);
        jQuery("#header_new").prepend('<div id="welcomeContentHeader"><h1>' + updatedString + '</h1></div>');
    });
</script>