2007-10-26 22:44:33 +00:00
|
|
|
<?php
|
|
|
|
|
2007-12-11 19:44:21 +00:00
|
|
|
// Allow the user to set preferences for this web interface. The preferences are stored
|
|
|
|
// in the browsers cookie.
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2007-11-27 16:00:27 +00:00
|
|
|
$TOPDIR = '..';
|
|
|
|
require_once "$TOPDIR/lib/functions.php";
|
|
|
|
|
|
|
|
insertHeader('Preferences', NULL, NULL, array('config','prefs'));
|
2007-12-11 19:44:21 +00:00
|
|
|
|
|
|
|
echo "<FORM NAME=prefs onsubmit='return false'><TABLE class=inner_table cellspacing=0 cellpadding=5><TBODY>\n";
|
|
|
|
|
|
|
|
//foreach ($_COOKIE as $key => $value) { echo "<p>$key: {$_COOKIE[$key]}</p>\n"; }
|
|
|
|
|
|
|
|
echo "<tr><td colspan=2>\n";
|
|
|
|
insertButtons(array('label' => 'Set Preferences', 'onclick' => 'doSetPref()'));
|
|
|
|
echo " <span id=setMsg class=Info style='display: none'>Preferences set successfully</span></td></tr>\n";
|
|
|
|
|
|
|
|
$nodesPerPage = getPref('nodesPerPage');
|
|
|
|
echo "<TR><TD align=right><font class=BlueBack>Number of nodes to display per page:</font></td>\n";
|
|
|
|
echo "<td><INPUT type=text id=nodesPerPage name=nodesPerPage value='$nodesPerPage' onchange='doSetPref()'></TD></TR>\n";
|
|
|
|
|
|
|
|
$displayCmds = getPref('displayCmds');
|
|
|
|
$displayStr = $displayCmds ? 'checked' : '';
|
|
|
|
echo "<TR><TD align=right><font class=BlueBack>Display commands run by this interface:</font></td>\n";
|
|
|
|
echo "<td><INPUT type=checkbox id=displayCmds name=displayCmds $displayStr></TD></TR>\n";
|
|
|
|
|
|
|
|
//echo "<TR><TD colspan=3><INPUT type=button id=setPrefButton name=setPrefButton value='Set Preferences' class=middle onclick='doSetPref();'> <span id=setMsg class=Info style='display: none'>Preferences set successfully</span></TD></TR>\n";
|
|
|
|
echo "</TBODY></TABLE></FORM>\n";
|
|
|
|
echo <<<EOS
|
|
|
|
<SCRIPT language=JavaScript>
|
|
|
|
//window.onload = function(){window.document.prefs.setPrefButton.focus()};
|
|
|
|
|
|
|
|
function doSetPref(){
|
2007-10-26 22:44:33 +00:00
|
|
|
var form = window.document.prefs;
|
2007-12-11 19:44:21 +00:00
|
|
|
var cookies = getCookies();
|
|
|
|
//for (c in cookies) { alert('cookies['+c+']='+cookies[c]); }
|
|
|
|
//alert('cookies[nodesPerPage]='+cookies['nodesPerPage']);
|
|
|
|
|
|
|
|
var nodesPerPage = form.nodesPerPage.value;
|
|
|
|
if (nodesPerPage != cookies['nodesPerPage']) { setCookie('nodesPerPage',nodesPerPage,'/'); }
|
2007-10-26 22:44:33 +00:00
|
|
|
|
2007-12-11 19:44:21 +00:00
|
|
|
var displayCmds = form.displayCmds.checked ? '1' : '0';
|
|
|
|
if (displayCmds != cookies['displayCmds']) { setCookie('displayCmds',displayCmds,'/'); }
|
|
|
|
|
|
|
|
document.getElementById('setMsg').style.display = 'inline';
|
|
|
|
//return false;
|
|
|
|
}
|
2007-10-26 22:44:33 +00:00
|
|
|
</SCRIPT>
|
|
|
|
</BODY>
|
2007-12-11 19:44:21 +00:00
|
|
|
</HTML>
|
|
|
|
EOS;
|
|
|
|
?>
|