public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('ProcessInfo');
        $fields->removeByName('ProcessStages');
        $processParent = Process::get();
        if ($processParent) {
            $fields->insertAfter(new DropdownField('ParentID', 'Belongs to this Process', $processParent->map('ID', 'Title')), 'Title');
        }
        $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField(new GridField('ProcessInfo', 'Information for this stage', $this->ProcessInfo(), GridFieldConfig_RelationEditor::create())));
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">1.1</span><span class="arrow"></span>
				<span class="title">Stop stage details</span>
			</span>
		</h3>'), 'Title');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
			<span class="step-label">
				<span class="flyout">1.2</span><span class="arrow"></span>
				<span class="title">Final information</span>
			</span>
		</h3>'), 'ProcessInfo');
        return $fields;
    }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('Title');
        $fields->removeByName('ProcessInfo');
        $fields->removeByName('ParentProcessID');
        $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField($title = new TextField('Title', 'Title')));
        $title->addExtraClass('process-noborder');
        $processSteps->addExtraClass('process-step');
        $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField(new GridField('ProcessInfo', 'Information for this case', $this->ProcessInfo(), GridFieldConfig_RecordViewer::create())));
        $processes = Process::get();
        if ($processes) {
            $fields->insertAfter($inner = new CompositeField(new LiteralField('ExplainStop', '<label class="right">This must be set after you create a process</label>'), $processesOptions = new DropdownField('ParentProcessID', 'Process', $processes->map('ID', 'Title'))), 'Title');
            $inner->addExtraClass('message special');
        }
        $processSteps->addExtraClass('process-step');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
				<span class="step-label">
					<span class="flyout">0.1</span><span class="arrow"></span>
					<span class="title">Case details</span>
				</span>
			</h3>'), 'Title');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
				<span class="step-label">
					<span class="flyout">0.2</span><span class="arrow"></span>
					<span class="title">Associated Information Pieces</span>
				</span>
			</h3>'), 'ProcessInfo');
        return $fields;
    }
예제 #3
0
 /**
  * Get the terminal title.
  * @return string
  */
 public static function getTitle()
 {
     if (!empty(self::$username)) {
         $process = new Process("uname -n");
         $title = self::$username . "@" . trim($process->get());
         $process->close();
         return $title;
     } else {
         return "not logged shell - how cold it be possible, uh?";
     }
 }
 /**
  * Initialise la requete.
  */
 public function __construct(ServerCallRequest $httpRequest, ServerCallResponse $httpResponse)
 {
     parent::__construct();
     //On appelle le constructeur parent
     //On initialise la requete et la reponse HTTP
     $this->httpRequest = $httpRequest;
     $this->httpResponse = $httpResponse;
     //Classe demandee dans la requete
     $class = $this->getHTTPRequest()->getClass();
     if (!class_exists('\\lib\\controllers\\' . $class)) {
         //On verifie que la classe existe
         throw new \InvalidArgumentException('La classe "' . $class . '" sp&eacute;cifi&eacute;e dans la requ&ecirc;te HTTP n\'existe pas');
     }
     //Et qu'elle herite bien de ServerCallComponent
     if (!in_array('lib\\ServerCallComponent', class_parents('\\lib\\controllers\\' . $class))) {
         throw new \InvalidArgumentException('La classe "' . $class . '" sp&eacute;cifi&eacute;e dans la requ&ecirc;te HTTP ne peut pas &ecirc;tre appell&eacute;e comme action d\'administration');
     }
     //Si un mot de passe et un nom d'utilisateur sont specifies dans la requete
     //On tente d'executer l'action demandee avec l'utilisateur specifie
     if ($this->getHTTPRequest()->getPassword() != null && $this->getHTTPRequest()->getUsername() != null) {
         $this->user = new User($this->getHTTPRequest()->getUsername(), $this->getHTTPRequest()->getPassword());
     }
     if ($this->getHTTPRequest()->getPid() != null && $this->getHTTPRequest()->getKey() != null) {
         $process = Process::get($this->getHTTPRequest()->getPid());
         if ($process->getKey() == $this->getHTTPRequest()->getKey()) {
             throw new RuntimeException('Clef du processus #' . $this->getHTTPRequest()->getPid() . ' invalide');
         }
         if (!$process->getAuthorization()->check($this->getHTTPRequest())) {
             throw new RuntimeException('Vous n\'avez pas les droits requis pour effectuer cette action (module : "' . $class . '"; action : "' . $this->getHTTPRequest()->getMethod() . '"; arguments: "' . implode('", "', $this->getHTTPRequest()->getArguments()) . '")');
         }
         $this->process = $process;
     } else {
         //On cree l'autorisation d'executer l'action
         $authorization = new Authorization($this, $this->user);
         //Si on n'a pas les droits suffisants pour executer la requete demandee
         if (!$authorization->check($this->getHTTPRequest())) {
             throw new RuntimeException('Vous n\'avez pas les droits requis pour effectuer cette action (module : "' . $class . '"; action : "' . $this->getHTTPRequest()->getMethod() . '"; arguments: "' . implode('", "', $this->getHTTPRequest()->getArguments()) . '")');
         }
         //On cree le processus de l'action
         $this->process = new models\ServerCallProcess($this, $authorization, $this->getHTTPRequest()->getClass(), $this->getHTTPRequest()->getMethod());
     }
 }
예제 #5
0
<?php

require_once 'test_webterminal/process.class.php';
$p = new Process("su neco");
usleep(500000);
$p->put("neco");
$p->put(chr(13));
echo $p->get();
echo '<hr>';
//$p->put(chr(21));
//var_dump($p->close());
//echo json_encode($p->getStatus());
//echo '<hr>';
// $p->put("whoami");
// $p->put(chr(13));
//echo $p->get();
usleep(500000);
echo $p->get();
$p->put("whoami");
$p->put(chr(13));
echo $p->get();
echo '<hr>';
usleep(500000);
echo $p->get();
echo '<hr>';
echo json_encode($p->getStatus());
echo '<hr>';
$p->put("ls -l");
$p->put(chr(13));
echo $p->get();
echo '<hr>';
 public function ProcessContent()
 {
     return Process::get()->byID($this->ProcessID);
 }