Beispiel #1
0
 public function __construct(&$theArray)
 {
     ENTER("minimenu::minimenu", __LINE__);
     $a = new config("gilles", $anElement);
     unset($anOption);
     foreach ($anElement as $a) {
         switch ($a->getType()) {
             case MINIMENU_CATEGORY:
                 $anOption[] = "+ " . $a->name;
                 break;
             case MINIMENU_PROGRAM:
                 $anOption[] = "* " . $a->name;
                 break;
             case MINIMENU_DOCUMENT:
                 $anOption[] = $a->name;
                 break;
         }
     }
     $this->_myTerminal = new enhancedTerminal();
     if (!$this->_myTerminal->isBuild()) {
         $this->_myTerminal = new dumbTerminal($theTerminal);
     }
     $this->myDialog = new cliDialog($this->_myTerminal, false);
     $aTitle = "";
     $theText = NULL;
     $theSelectedOption = NULL;
     $theKeyIsDisplayed = false;
     $this->myDialog->menu($aTitle, $anOption, &$aResult, NULL, NULL, false);
 }
Beispiel #2
0
 function mailConfig($theUser)
 {
     ENTER("mailConfig::mailConfig", __LINE__);
     parent::__construct();
     SHOW("theUser={$theUser}, this={$this}");
     $this->_myUser = $theUser;
     $this->_myFilename = sprintf($this->_myTemplateFilename, $theUser);
     if (!is_file($this->_myFilename)) {
         $fd = fopen($this->_myFilename, "w");
         if ($fd == NULL) {
             $aError = sprintf("Error: can't open file: %s\n", $this->_myFilename);
             ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.8 $');
             return;
         }
         fwrite($fd, $this->_myInitialFile);
         fclose($fd);
     }
     if (!is_readable($this->_myFilename)) {
         $aError = sprintf("Error: file unreadable: %s\n", $this->_myFilename);
         ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.8 $');
         return;
     }
     $this->load($this->_myFilename);
     $this->_myXpath = new domxpath($this);
     $this->_myMailconfigContext = $this->_myXpath->query($this->_mailconfigPath)->item(0);
     $this->initMailSourceIndex();
     $this->_my_object_is_build = true;
 }
function say($the_sentence_to_say)
{
    ENTER("say");
    $fd = fopen("/tmp/a.txt", "w");
    fwrite($fd, "q \\{{$the_sentence_to_say}}\nd\n");
    fclose($fd);
    system("eflite -f /tmp/a.txt");
    echo $the_sentence_to_say;
}
Beispiel #4
0
 protected function getElement(&$theNode, &$theElement)
 {
     ENTER("config::getElement", __LINE__);
     SHOW("====== nodeName=" . $theNode->nodeName . " ======\n");
     $theElement = NULL;
     $anArray = NULL;
     $aName = "";
     $aElementIsHidden = false;
     if ($theNode->nodeType !== XML_ELEMENT_NODE) {
         return;
     }
     if ($theNode->hasAttributes()) {
         foreach ($theNode->attributes as $a) {
             $anArray[$a->name] = $a->value;
         }
     }
     if ($theNode->hasChildNodes()) {
         $a = $theNode->firstChild;
         while ($a != NULL) {
             if ($a->nodeType === XML_ELEMENT_NODE) {
                 $b = $a->firstChild;
                 if ($b != NULL && $b->isSameNode($a->lastChild)) {
                     $anArray[$a->nodeName] = $b->nodeValue;
                 }
             }
             $a = $a->nextSibling;
         }
     }
     switch ($theNode->nodeName) {
         case MINIMENU_CATEGORY:
             $theElement = new category($anArray);
             break;
         case MINIMENU_PROGRAM:
             $theElement = new program($anArray);
             break;
         case MINIMENU_DOCUMENT:
             $theElement = new document($anArray);
             break;
         default:
             $aError = sprintf("Error: unknown element: %s\n", $aNode->nodeName);
             ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.2 $');
             break;
     }
 }
Beispiel #5
0
 protected function _inputMailbox(&$theArray)
 {
     ENTER("mailMenu::_inputMailbox", __LINE__);
     $aFollowingKeyExists = true;
     reset($this->_myConf->myMailSourceFieldName);
     while ($aFollowingKeyExists) {
         //	  $aState=$this->_myConf->myMailSourceFieldName[$aKey];
         $aState = current($this->_myConf->myMailSourceFieldName);
         $aKeyPressed = OkPressedValue;
         switch ($aState) {
             case "label":
                 $aDialog = new cliDialog($this->_myTerminal, false);
                 $aKeyPressed = $aDialog->inputBox(gettext("Enter the name of this mailbox, for example: My Mailbox"), $theArray[$aState], $aValue);
                 unset($aDialog);
                 break;
             case "host":
                 $aDialog = new cliDialog($this->_myTerminal, false);
                 $aKeyPressed = $aDialog->inputBox(gettext("Enter the name of the POP server, for example: pop.smith.com"), $theArray[$aState], $aValue);
                 unset($aDialog);
                 break;
             case "port":
                 $aPort = $theArray[$aState];
                 if (strlen($aPort) == 0 || !is_numeric($aPort)) {
                     $aPort = "110";
                 }
                 $aDialog = new cliDialog($this->_myTerminal, false);
                 $aKeyPressed = $aDialog->inputBox(gettext("Enter the port or press return"), $aPort, $aValue);
                 unset($aDialog);
                 break;
             case "login":
                 $aDialog = new cliDialog($this->_myTerminal, false);
                 $aKeyPressed = $aDialog->inputBox(gettext("Enter the login"), $theArray[$aState], $aValue);
                 unset($aDialog);
                 break;
             case "password":
                 $aDialog = new cliDialog($this->_myTerminal, false);
                 $aKeyPressed = $aDialog->inputBox(gettext("Enter the password"), $theArray[$aState], $aValue);
                 unset($aDialog);
                 break;
             case "keep":
                 $aDialog = new cliDialog($this->_myTerminal, false);
                 $aValue = $aDialog->yesNo(gettext("Do you want to keep the messages in the server once they have been fetched to your computer?"));
                 unset($aDialog);
                 if ($aKeyPressed != EscapePressedValue) {
                     $theArray[$aState] = $aValue;
                 }
                 break;
             case "smtp":
                 $aDialog = new cliDialog($this->_myTerminal, false);
                 $aKeyPressed = $aDialog->inputBox(gettext("Enter the name of the S M T P server, for example: smtp.smith.com"), $theArray[$aState], $aValue);
                 unset($aDialog);
                 break;
             default:
                 exit;
                 break;
         }
         if ($aKeyPressed == OkPressedValue) {
             $theArray[$aState] = $aValue;
         }
         $aFollowingKeyExists = $this->_getWishedState($this->_myConf->myMailSourceFieldName, $aKeyPressed);
     }
     return $aKeyPressed;
 }
Beispiel #6
0
 function apply(&$theInput)
 {
     ENTER("cliYesNo::apply", __LINE__);
     return $this->myCurrentValue;
 }
Beispiel #7
0
 public function getType()
 {
     ENTER("document::getType", __LINE__);
     return MINIMENU_DOCUMENT;
 }
Beispiel #8
0
 function getMessage($theMessageType, &$theMessage, $theValue = NULL)
 {
     ENTER("dumbTerminal::getMessage", __LINE__);
     switch ($theMessageType) {
         case MessageNavigationMenu:
             $theMessage[verbose][] = gettext("\nPress return to read the next item. ");
             $theMessage[verbose][] = gettext("\nAnd type yes to select your preferred item. ");
             break;
         case MessageNavigationRadio:
             $theMessage[verbose][] = gettext("\nPress return to read the next option. ");
             $theMessage[verbose][] = gettext("\nAnd type yes to select your preferred option. ");
             break;
         case MessageNavigationCheckbox:
             $theMessage[verbose][] = gettext("\nPress return to read the next option. ");
             $theMessage[verbose][] = gettext("\nAnd type yes to select an option, or type no to unselect it. ");
             $theMessage[verbose][] = gettext("\nNote that you can select several options. ");
             break;
         case MessageNavigationInputBox:
             $theMessage[verbose][] = gettext("\nType your answer in this input field. ");
             $theMessage[notVerbose][] = gettext("\nInput. ");
             break;
         case MessageNavigationInputBoxDefaultButton:
             $theMessage[verbose][] = sprintf(gettext("\nJust type yes if you accept this proposal: %s. "), $theValue);
             $theMessage[notVerbose][] = sprintf(gettext("\nProposal: %s. "), $theValue);
             break;
         default:
             echo "\ndisplay: unknown message {$theMessage}. ";
             break;
     }
 }
 function _LookForMyDirectory($thePath, &$theTarBalls, &$theOptionalDirectory)
 {
     ENTER("_LookForMyDirectory");
     Debug("Input: {$thePath}");
     $isDECtalkFound = FALSE;
     $aDirectoryPointer = opendir($thePath);
     while ($aFilename = readdir($aDirectoryPointer)) {
         if (@is_dir("{$thePath}/{$aFilename}")) {
             if ($aFilename == "DECtalk") {
                 Debug("Dir = DECtalk");
                 $isDECtalkFound = TRUE;
             } else {
                 if ($aFilename != "." && $aFilename != ".." && $aFilename != "emacspeak" && $aFilename != "oralux" && $aFilename != "dtk" && $aFilename != "usr" && $aFilename != "home" && $aFilename != "var") {
                     // This might be a directory related to an optional language
                     Debug("Optional Dir = {$aFilename}");
                     $theOptionalDirectory[] = $aFilename;
                 }
             }
         } else {
             if (preg_match("/[lL][iI][nN][uU][xX].*.[gG][zZ]/", $aFilename, $b)) {
                 // Yes, this looks like a DECtalk tarball!
                 Debug("tarball={$aFilename}");
                 $theTarBalls[] = $aFilename;
             }
         }
     }
     closedir($aDirectoryPointer);
     Debug("theTarBalls=");
     Debug($theTarBalls);
     Debug("theOptionalDirectory=");
     Debug($theOptionalDirectory);
     return $isDECtalkFound;
 }