Skip to content

Instantly share code, notes, and snippets.

@gioxx
Last active June 23, 2017 12:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gioxx/fa24458a78bbab089e5f4f37e21f7bcb to your computer and use it in GitHub Desktop.
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).
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
Copy link
Author

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