<?php /** * Gestion des annexes d'un document * @package Backend * @subpackage Presentation * @author Laurent Jouanneau * @author Florian Hatat * @copyright Copyright © 2003 OpenWeb.eu.org * @license http://www.gnu.org/licenses/gpl.html GNU General Public License */ define('OW_BACKEND_ACTION', 'ACT_DOC_ANNEXES'); require_once '../../include/backend/init.inc.php'; require_once PATH_INC_BACKEND_SERVICE . 'Document.class.php'; require_once PATH_INC_BACKEND_SERVICE . 'WorkflowManager.class.php'; $wk = new WorkflowManager($db, $_SESSION['utilisateur']['uti_id']); if (!isset($_GET['id'])) { echo "<p>Aucun document sur lequel travailler</p>\n"; exit; } if (!$wk->canDoAction($_GET['id'], OW_BACKEND_ACTION)) { echo "<p>Vous n'avez pas la permission de modifier les annexes</p>\n"; exit; } /* TODO: vérifier que le chargement a réussi */ $doc = new Document($db, $_GET['id']); $errors = array(); $listeannx = $doc->listeAnnexe(); if (isset($_POST['ficdel'])) { foreach ($_POST['ficdel'] as $todel) { if (in_array($todel, $listeannx)) {
<?php /** * Détails d'un document * @package Backend * @subpackage Presentation * @author Laurent Jouanneau * @author Florian Hatat * @copyright Copyright © 2003 OpenWeb.eu.org * @license http://www.gnu.org/licenses/gpl.html GNU General Public License */ define('OW_BACKEND_ACTION', 'ACT_DOC_DETAILS'); require_once '../../include/backend/init.inc.php'; require_once PATH_INC_BACKEND_SERVICE . 'Document.class.php'; require_once PATH_INC_BACKEND_SERVICE . 'WorkflowManager.class.php'; $wk = new WorkflowManager($db, $_SESSION['utilisateur']['uti_id']); /** * @todo permettre de choisir un document si aucun n'a été précisé */ if (!isset($_GET['id'])) { echo '<p>Aucun document à afficher</p>'; exit; } /** * @todo vérifier que le chargement du document a réussi */ $doc = new Document($db, $_GET['id']); $actionsAll = $wk->getListActions($doc->id, true); $actionsAllow = $wk->getListActions($doc->id); $actionsForbid = array_diff($actionsAll, $actionsAllow); ?>
public function testUpdateWorkflowNodeConfiguration() { $workflow = new \ezcWorkflow('UpdateTest4'); $printAction1 = new \ezcWorkflowNodeAction(array('class' => 'DoctrinExtensions\\Workflow\\MyPrintAction', 'arguments' => array('Foo'))); $workflow->startNode->addOutNode($printAction1); $printAction1->addOutNode($workflow->endNode); $manager = new WorkflowManager($this->conn, $this->options); $manager->save($workflow); $workflowId = $workflow->id; $reflField = new \ReflectionProperty('ezcWorkflowNodeAction', 'configuration'); $reflField->setAccessible(true); $this->assertEquals(array('class' => 'DoctrinExtensions\\Workflow\\MyPrintAction', 'arguments' => array('Foo')), $reflField->getValue($printAction1)); $reflField->setValue($printAction1, array('class' => 'DoctrinExtensions\\Workflow\\MyPrintAction', 'arguments' => array('bar'))); $manager->save($workflow); $this->assertEquals($workflowId, $workflow->id); $loadedWorkflow = $manager->loadWorkflowById($workflow->id); $startOutNodes = $loadedWorkflow->startNode->getOutNodes(); $this->assertInstanceOf('ezcWorkflowNodeAction', $startOutNodes[0]); $printAction1 = $startOutNodes[0]; $this->assertEquals(array('class' => 'DoctrinExtensions\\Workflow\\MyPrintAction', 'arguments' => array('bar')), $reflField->getValue($printAction1)); }
* @author Laurent Jouanneau * @author Florian Hatat * @copyright Copyright © 2003 OpenWeb.eu.org * @license http://www.gnu.org/licenses/gpl.html GNU General Public License */ $action = array_filter(array_keys($_POST), create_function('$var', 'return strpos($var, "act_") === 0;')); if (count($action) != 1) { echo 'J\'exécute *exactement* une action, pas ', count($action); exit; } $action = substr(array_pop($action), 4); define('OW_BACKEND_ACTION', $action); require_once "../../include/backend/init.inc.php"; require_once PATH_INC_BACKEND_SERVICE . 'Document.class.php'; require_once PATH_INC_BACKEND_SERVICE . 'WorkflowManager.class.php'; $wk = new WorkflowManager($db, $_SESSION['utilisateur']['uti_id']); if (!isset($_GET['id'])) { echo '<p>Aucun document à traiter</p>'; exit; } /** * @todo vérifier que le chargement du document a réussi */ $doc = new Document($db, $_GET['id']); $act = $wk->getActionInfos($action, $doc->id); if (!$wk->canDoAction($doc->id, $act['act_name'])) { echo '<p>Vous ne pouvez pas exécuter cette action</p>'; exit; } // Réalisation de l'action switch ($act['act_name']) {
require_once PATH_INC_BACKEND_SERVICE . 'mime.inc.php'; if (empty($_SERVER['PATH_INFO'])) { echo "Je ne ferai rien sans paramètres.\n"; exit(1); } @(list($id, $fic) = explode('/', trim(ereg_replace('/+', '/', $_SERVER['PATH_INFO']), '/'), 2)); if (empty($id)) { echo "ID du document manquant\n"; exit(1); } $doc = new Document($db, $id); if (count($doc->errors) != 0) { echo "Impossible d'ouvrir le document\n"; exit(1); } $wk = new WorkflowManager($db, $_SESSION['utilisateur']['uti_id']); if (!$wk->canDoAction($doc->id, OW_BACKEND_ACTION)) { echo "Vous n'avez pas la permission de consulter le document\n"; exit(1); } if (empty($fic)) { echo "Rien à afficher\n"; exit(1); } $filenames = $doc->getDocumentFormats(); foreach ($doc->listeAnnexe() as $format) { $filenames[] = "annexes/" . $format; } if (!in_array($fic, $filenames)) { echo "Format demandé inconnu\n"; exit(1);