Last active
June 23, 2017 12:31
-
-
Save gioxx/fa24458a78bbab089e5f4f37e21f7bcb to your computer and use it in GitHub Desktop.
Ho aggiunto una toolbar che riporta dei collegamenti rapidi utili per ManageEngine ServiceDesk Plus. Posizione fixata in basso a destra, box in trasparenza, azioni rapide di Pick Up, Merge, Delete e Close (Edit esiste ma è commentata per scelta).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function() { | |
/* | |
Custom "Shortcuts" toolbar for ManageEngine SDP | |
From an ideas of MKR @ SDPAdmins.pl | |
SDP Community: https://forums.manageengine.com/topic/show-bottom-toolbar#49000008012652 | |
Master HEX To RGBA Color Chart: http://www.websitecodetutorials.com/code/css/master-hex-to-rgba-color-chart.php | |
GSolone, first release 7/7/16 ( CustomScripts.js @ https://gist.github.com/gioxx ) | |
last mod. 10/11/16 | |
10/11/16- I have added a new button to refresh the page. | |
8/7/16- I have included an array of possible words that you can "catch" in the URL (var checkURL) and a "for" cycle to check and show the custom toolbar (credits: http://stackoverflow.com/questions/15344413/how-to-check-if-one-of-the-strings-from-an-array-are-in-the-url-window-location). | |
*/ | |
//Original idea | |
//var userLoc = location.pathname; | |
//if(userLoc == "/WOListView.do" && sdp_user["USERTYPE"] =="Technician"){ | |
//My idea: intercept an array of possible URLs. | |
var checkURL = ['WOListView.do', 'CompleteRequest.do', 'SearchN.do']; | |
for (var i = 0; i < checkURL.length; i++) { | |
if( (document.URL.indexOf(checkURL[i]) != -1) && sdp_user["USERTYPE"] =="Technician"){ | |
// Style | |
var toolbarStyle = '<style type="text/css">' + | |
' #rapidtools{' + | |
' bottom: 0;' + | |
' right: 0;' + | |
' margin-bottom: 10px;' + | |
' position: fixed;' + | |
' background-color: rgba(208,208,208,0.6);' + | |
' width: 310px;' + | |
' height: 50px;' + | |
' margin: 0 auto;' + | |
' }' + | |
' #rapidtoolscontent{' + | |
' text-align: center;' + | |
' margin-top: 8px;' + | |
' }' + | |
'</style>' | |
// Append Style | |
jQuery('head').append(toolbarStyle); | |
// Shortcuts | |
var buttons = '<div id="rapidtools">' + | |
'<strong style="padding-left: 10px; padding-right: 10px; background-color:#fff486;">Shortcuts</strong> <br />' + | |
'<div id="rapidtoolscontent">' + | |
// PICK UP | |
'<input type="button" title="Pickup" class="formStylebutton" style="width:auto;height:18" onclick="return checkWOSelection(document.getElementById(\'ReqListForm\'),\'checkbox\',\'pickUpRequest=Pick up&\')" value="Pick up" name="pickUpRequest"> ' + | |
// MERGE | |
'<input type="button" title="Merge" class="formStylebutton" style="width:auto;height:18" onclick="return checkMergeSelection(document.getElementById(\'ReqListForm\'),\'checkbox\',\'mergeRequest=merge&\',serReqId)" value="Merge" name="mergeRequest"> ' + | |
// DELETE | |
'<input type="button" title="Delete" class="formStylebutton" style="width:auto;height:18" onclick="return confirmRequestDeleteFromList(document.getElementById(\'ReqListForm\'),\'checkbox\',document.getElementById(\'confirmrequestdelete\'),document.getElementById(\'chooserequest\'),\'deleteRequest=Delete\',true)" value="Delete" name="deleteRequest"> ' + | |
// REFRESH | |
'<input type="button" title="Refresh" class="formStylebutton" style="width:auto;height:18" onclick="window.location.reload()" value="Refresh" name="refreshButton"> ' + | |
// CLOSE | |
'<input type="button" title="Close" class="formStylebutton" style="width:auto;height:18" onclick="return checkWOSelection(document.getElementById(\'ReqListForm\'),\'checkbox\',\'closeRequest=Close&\')" value="Close" name="closeRequest"> ' + | |
// END OF TOOLBAR | |
'</div></div>'; | |
// Show Toolbar | |
jQuery('body').append(buttons); | |
} | |
} | |
}); |
Piccola novità: dato che quando si va a chiudere un ticket l'URL passa a /CompleteRequest.do, ho incluso un nuovo array e un ciclo for per intercettare più URL anziché solo uno (WOListView, nda).
Perso per strada e integrato, toolbar ora visibile anche in caso di ricerca (SearchN.do).
Aggiunto un pulsante per il Refresh della pagina visualizzata (ho dovuto allargare il box a 310px).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Il file CustomScripts.js dovrà essere salvato nella cartella [VOSTROSERVERSDP]\ServiceDesk\custom\scripts
È possibile togliere il commento all'azione di Edit se lo si desidera, ma consiglio di portare il valore di width a 300px nel blocco di stile di #rapidtools