<?
// shortcuts_wml.php
//
// Copyright, Exolution GmbH / Michael Kerrisk, Sep 2000
// http://www.exolution.com/wapsh   mailto:wapsh@exolution.de
//
// This software is Open Source licensed under the terms of the Trolltech QPL
// version 1.0.  See http://www.exolution.de/wapsh for further information.
//
// -------------------------------------------------------------------
//
// WML shortcut menu page
//
    require("common.inc");
    require("common_wml.inc");
    header("Content-type: text/vnd.wap.wml");
    require("displayfuncs.inc");

    echo '<?xml version="1.0" encoding="iso-8859-1"?>';
?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>

<card title="<? echo SYSTEM_NAME ?> Shortcuts" newcontext="true">

<?
    if ($setOptions & OPT_DISPLAYMENU == 0 || $numSc <= 0) {
	echo sParaBlk("Either shortcuts are disabled or no " . 
		"shortcuts are defined");
    } else {
	if (!isset($scStart)) {
	    $scStart = 0;
	} else {
	    if (isset($prevSc))
		$scStart -= $shortcutBlockSize;
	    else if (isset($nextSc))
		$scStart += $shortcutBlockSize;
	} // if

	if ($scStart < 0) 
	    $scStart = 0;
	$scEnd = $scStart + $shortcutBlockSize;
	if ($scEnd > $numSc) 
	    $scEnd = $numSc;
	

	if (/* isUpPhone() && */ $numSc > $shortcutBlockSize) 
		echo "<p>Shortcuts " . ($scStart+1) . "-" . $scEnd . "</p>";

	for ($j = $scStart; $j < $scEnd; $j++) {
	    echo '<p>';
	    //if (isUpPhone())
            //    echo ($j + 1) . ': ';
	    wmlSubmitAnchor(escBrowserSpecialChars($scName[$j]), 
		    "command.php", "post", 
		    $shCommFields . '<postfield name="doShCut" value="y"/>' .
	    	    '<postfield name="shortcutCmd" value="' . $j . '"/>');

	    echo '</p>';
	} // for

	echo "<p>Total shortcuts: $numSc</p>";


	if ($scStart > 1) {
    	    wmlSoftkeyItem("doPrevSc", "Prev shortcuts", 
		    "shortcuts_wml.php", "post", 
    	    	    $commFields .
            		'<postfield name="scStart" value="' . $scStart . '"/>' .
            		'<postfield name="prevSc" value="y"/>');
	}
        
	if ($scStart + $shortcutBlockSize < $numSc) {
    	    wmlSoftkeyItem("doNextSc", "Next shortcuts", 
		    "shortcuts_wml.php", "post", 
    	    	    $commFields .
            		'<postfield name="scStart" value="' . $scStart . '"/>' .
            		'<postfield name="nextSc" value="y"/>');
	}
    } // if

    wmlSoftkeyHomeLink();

?>

</card>
</wml>
