Skip to content

Instantly share code, notes, and snippets.

@gioxx
Last active Jun 23, 2017
Embed
What would you like to do?
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).
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&amp;\')" 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&amp;\',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&amp;\')" value="Close" name="closeRequest"> ' +
// END OF TOOLBAR
'</div></div>';
// Show Toolbar
jQuery('body').append(buttons);
}
}
});
@gioxx

This comment has been minimized.

Copy link
Owner Author

@gioxx gioxx commented Jul 7, 2016

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

@gioxx

This comment has been minimized.

Copy link
Owner Author

@gioxx gioxx commented Jul 8, 2016

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).

@gioxx

This comment has been minimized.

Copy link
Owner Author

@gioxx gioxx commented Jul 8, 2016

Perso per strada e integrato, toolbar ora visibile anche in caso di ricerca (SearchN.do).

@gioxx

This comment has been minimized.

Copy link
Owner Author

@gioxx gioxx commented Nov 10, 2016

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