Kayako logo
Modifications & Addon Releases Modification guides and addons are posted here to share with the community. Do not post requests in here!

Notices

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  (#1) Old
richm Offline
Member
 
richm's Avatar
 
Posts: 387
Join Date: Jan 2007
Location: Orange County, CA
Add a dropdown "Tools" menu to the top right menu in eSupport - 12-05-2007, 02:52 AM

I wanted a "Tools" menu so staff could reach commonly used web apps via a menu in eSupport. See the screen shot attached for the end result. The links in the dropdown menu are set to open in a new page.

From the "total hacks out of left field department"

<disclaimer>
  1. I am not a coder nor a developer, total hack here
  2. I make no guarantee or warranty that this will work for you
  3. If it breaks your installation don't say I didn't warn you (see #1)
  4. I don't support this, your on your own. (see #1)
</disclaimer>

I borrowed code from the nifty www.dynamicdrive.com website to accomplish this.

If someone with developer skills or from Kayako could review how I have injected this into the .tpl file and ensure what I have done is ok, that would be nice. (If there is a better way to do this, please let us know)


Backup this file before you begin!
\esupport\themes\admin_default\cpheader.tpl

So on with this then,

In this file:
\esupport\themes\admin_default\cpheader.tpl

Right above the closing </head> tag

I inserted:

Code:
<style type="text/css">

#dropmenudiv{
position:absolute;
border:1px solid black;
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
}

#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;

}

#dropmenudiv a:hover{ /*hover background color*/
background-color: white;
}

</style>

<script type="text/javascript">

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/



//Contents for menu 1, and so on
var menu1=new Array()
menu1[0]='<a href="http://knowledebase.ourdomain.com" target="_blank">iKB</a>'                                                   
menu1[1]='<a href="http://10.1.27.59/index.php" target="_blank">FTP Server</a>'                                      
menu1[2]='<a href="http://base.ourdomain.com:411/Login.aspx" target="_blank">baseline</a>'                                   
menu1[3]='<a href="http://www.webex.com" target="_blank">Webex</a>'

		
var menuwidth='165px' //default menu width
var menubgcolor='white'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

</script>
Maintaining/adding links on the menu should be straightforward, as all you have to do is go to the
Quote:
//Contents for menu 1, and so on
section noted above and add/edit them.


Further down in the .tpl file, in this section:
Code:
<tr>
    <td align="right" valign="bottom"><span class="smalltext"><font color="#333333"><{$language[loggedinas]}><{$staffname}> | <a href="<{$swiftpath}>index.php" title="<{$language[clientarea]}>" target="_blank"><{$language[clientarea]}></a><{if $area eq "admin"}> | <a href="<{$swiftpath}>staff/index.php" title="<{$language[staffcp]}>" target="_blank"><{$language[staffcp]}></a><{elseif $area eq "staff"}> | 
<a href="default2.htm" onClick="return dropdownmenu(this, event, menu1, '200px')" onMouseout="delayhidemenu()">Tools</a> <{/if}></font> | <a href="<{if $area eq "admin"}><{$swiftpath}>admin/index.php?_ca=logout<{else}><{$swiftpath}>staff/index.php?_ca=logout<{/if}>" id="blue" title="<{$language[logout]}>"><strong><{$language[logout]}></strong></a>&nbsp; </span></td>
  </tr>
I added another vertical bar "|" as a seperator, and the following to create the link (in blue above to make it easier to find and repeated below)


| <a href="default2.htm" onClick="return dropdownmenu(this, event, menu1, '200px')" onMouseout="delayhidemenu()">Tools</a>



Regards,

Rich
Attached Images
File Type: jpg Tools.jpg (22.5 KB, 144 views)


--
Features I need asap:
1) Ticket search in the client portal!
2) Column display in client portal showing clients email address or name
3) Downloads by client
(i.e. - each client has their own download area and can't see/touch downloads for any other client.) This would be on top of a "public" download area.
4) Integrated KB image uploads
The ability for staff to upload images with a KB articles.
Cheers!

Last edited by richm; 12-05-2007 at 06:32 AM..
   
Reply With Quote
  (#2) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,283
Join Date: Apr 2007
Location: Toronto Canada
14-05-2007, 07:49 PM

Sweet, just implemented this. Great work, I love it.
   
Reply With Quote
  (#3) Old
OutHOST Offline
New Member
 
Posts: 8
Join Date: Jan 2008
08-02-2008, 12:32 AM

hmm, it dont work for me, using esupport cvs build
   
Reply With Quote
  (#4) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,283
Join Date: Apr 2007
Location: Toronto Canada
08-02-2008, 01:19 AM

Can you define how it "didn't work"?


Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#5) Old
OutHOST Offline
New Member
 
Posts: 8
Join Date: Jan 2008
08-02-2008, 11:42 AM

i copied the code in as stated, modified the variables, ie the links to be made and saved it and then uploaded it to the site, when i go into the staff side there is no tools link there and it doesnt have anywhere on it that it could possibly be, i deleted the contents of the cache folder, but still nothing, tested on safari and ff
   
Reply With Quote
  (#6) Old
OutHOST Offline
New Member
 
Posts: 8
Join Date: Jan 2008
08-02-2008, 11:43 AM

just double checked there on IE and still the same
   
Reply With Quote
  (#7) Old
craigbrass Offline
Senior Member
 
Posts: 5,920
Join Date: Jun 2005
Location: Cumbria, UK
08-02-2008, 02:20 PM

Did you try holding down Control and pressing F5 to do a hard refresh?


Craig Brass - Kayako Forum Squatter (Note: I am NOT a staff member)

Icon Headquarters - Its Elixir - Web2Messenger
   
Reply With Quote
  (#8) Old
OutHOST Offline
New Member
 
Posts: 8
Join Date: Jan 2008
08-02-2008, 03:05 PM

no, but i did clear my local cache, have tried it on 2 machines now, my laptop at home that i used to make the change and a terminal in the shopping centre, and its been tried on 3 diff browsers, the first thing i did was make sure it wasnt a cache issue, will have another look at it later on when i get back home,
   
Reply With Quote
  (#9) Old
Siora Offline
Member
 
Siora's Avatar
 
Posts: 1,283
Join Date: Apr 2007
Location: Toronto Canada
08-02-2008, 04:38 PM

I also did this when I did this mod, maybe that will help:

Remove Admin CP link from Staff CP


Siora Solutions Inc.
www.sioraIT.com
   
Reply With Quote
  (#10) Old
OutHOST Offline
New Member
 
Posts: 8
Join Date: Jan 2008
08-02-2008, 07:00 PM

Quote:
Originally Posted by Siora View Post
I also did this when I did this mod, maybe that will help:

Remove Admin CP link from Staff CP
tried but didnt work
   
Reply With Quote
  (#11) Old
OutHOST Offline
New Member
 
Posts: 8
Join Date: Jan 2008
09-02-2008, 08:43 PM

ok, so i tried again with a fresh file, maybe its the cvs build that im using thats not compatible
   
Reply With Quote
  (#12) Old
bimmer Offline
New Member
 
Posts: 8
Join Date: Feb 2008
no luck - 12-02-2008, 02:58 AM

Tried it also without any luck.

Can somebody supply me the file so I can test with it.

Thanks,
Eric
   
Reply With Quote
  (#13) Old
mopa Offline
Member
 
mopa's Avatar
 
Posts: 146
Join Date: May 2007
Location: Denmark
13-02-2008, 03:56 PM

I cannot seem to get it working either.

Update:
I forgot to put this in:
| <a href="default2.htm" onClick="return dropdownmenu(this, event, menu1, '200px')" onMouseout="delayhidemenu()">Tools</a>
For some funny reason that did the trick.... doh ;o)


Kayako: 3.11.01 | PHP: 5.2.3 | MySQL: 5.0.41 | Windows 2003 Server

Last edited by mopa; 13-02-2008 at 04:01 PM..
   
Reply With Quote
  (#14) Old
bimmer Offline
New Member
 
Posts: 8
Join Date: Feb 2008
16-02-2008, 02:53 PM

I had aleready that code in the file and no luck.

Eric
   
Reply With Quote
  (#15) Old
VineHosting.com Offline
New Member
 
Posts: 22
Join Date: Oct 2005
Awesome - 19-02-2008, 05:55 AM

Thank you very much for this -
Works like a charm.

Especially nice to have backlinks to the WHMCS system we have running.

:-)

Great stuff - thanks for helping the community.
   
Reply With Quote
Reply

Tags
dropdown, esupport, menu, tools

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Powered by vBulletin® Version 3.7.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Help desk software by Kayako.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48