Help Desk Software & Beyond
May 21, 2012, 11:23:53 PM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [MOD] 'Auto-refresh' (TTX v 2.21 and up)  (Read 2420 times)
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« on: September 17, 2007, 11:39:39 AM »

This modification is for people that always want "auto-refresh" operating on their main helpdesk page.

Currently you select "never, 1 minute, 3 minutes, etc." from the 'Auto-refresh' pull down menu.  It remembers your settings for the session but next time you log in, you have to choose the refresh rate again.  You could embed the refresh rate in the URL so next time you log in, it's already selected.  However, if you always want that particular refresh rate, the pull down menu might now seem pointless to you.  This mod is not for everyone, for example, different operators may want different refresh settings.

But if you are the only operator, this mod will clean up your interface and permanently give you the auto-refresh feature.

ALL changes are made on the "helpdesk.html" template.

This is the Javascript function already in the Javascript section of the template.  No changes to this.

Quote
<script language=Javascript> <!--
function update()
{
 document.forms['hd'].submit();
 return false;
}
var htimeout = null;
function setrefreshrate(tmout) {
  if (htimeout != null) {
    clearTimeout(htimeout);
    htimeout = null;
  }
  if (tmout > 0) {
    htimeout = setTimeout(update, tmout * 1000);
  }
}
//-->
</script>

Remove this...

Quote
[%Autorefresh rate%] <select name=autorefresh onchange="setrefreshrate(this.options[this.selectedIndex].value)">
              <option value="0">[%never%]</option>
              <option value="60">[%1 min%]</option>
              <option value="180">[%3 min%]</option>
              <option value="300">[%5 min%]</option>
              <option value="600">[%10 min%]</option>
            </select>
<script type="text/javascript"><!--
  var i;
  var inauto = '(%INPUT_autorefresh%)';
  if (inauto == '') {
    inauto = '(%CONFIG_AUTOREFRESH%)';
  }
   for (i = 0; i < document.forms['hd'].autorefresh.options.length; i++) {
     if (document.forms['hd'].autorefresh.options.value == inauto) {
       document.forms['hd'].autorefresh.options.selected = true;
      setrefreshrate(document.forms['hd'].autorefresh.options.value);
     }
   }
   //--></script>


Add this to bottom of template...

Quote
<script type="text/javascript"><!--
setrefreshrate(180); // refreshes every 3 minutes
//-->
</script>

Notes:

1.  I chose "180" for every 3 minutes.  You can insert any number representing the number of seconds.

2.  This mod can be applied to versions of TTX prior to 2.23.  Just add the purple Javascript code above if any of it's missing from your "helpdesk.html" template.

3.  Adding the original and unmodified "Auto-refresh" feature including pull-down menu to older versions of TTX would required additional modifications to PM modules so that the "auto-refresh" setting is remembered for the entire session.  This is not discussed here.
« Last Edit: January 16, 2008, 05:39:22 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
oni
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #1 on: October 01, 2007, 10:11:33 AM »

You can also add the following to ttxcfg.cgi:

Code:
autorefresh=60

This will select 1min as a default and leaves the options-list functional.

Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #2 on: October 01, 2007, 10:58:32 AM »

You can also add the following to ttxcfg.cgi:

Code:
autorefresh=60

This will select 1min as a default and leaves the options-list functional.


True, but that alone will not work on versions prior to 2.23 without the code I posted above.

The purpose of this mod is to not merely set a default time, but to permanently remove the pull down list completely.  Additionally, it was to post the 'auto-refresh' code so people can add this feature to older versions of TTX.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
oni
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #3 on: October 01, 2007, 12:20:35 PM »

My code does indeed not remove the option-list itself.

Quote
This mod is not for everyone, for example, different operators may want different refresh settings

My code shows how you can have different operators and also set a default refresh-rate.
Don't see it as a replacement of you mod, but as a different way of achieving almost the same.
Maybe someone will find use for it.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #4 on: October 01, 2007, 12:35:21 PM »

Quote
My code shows how you can have different operators and also set a default refresh-rate.

Yes, adding the "autorefresh" line to the config file will make the option selected as default for all operators.  Thanks for catching that and expanding the topic.

I was merely pointing out previously that this thread is also about giving the 'autorefresh' option to anyone using any version of TTX.  In that case, however, they'd be limited to my menu-less system since it's bound within the HTML of the template.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.026 seconds with 19 queries.