From fcd6df1437b118cf904eee8a155b4632040585ee Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Thu, 30 Jun 2005 23:41:59 +0000 Subject: [PATCH] Added top menu, tabbed browsing. The beginnings of the context page and the user page are there. Decision was made to distinguish between "system" and "customer" contexts so that a generic context editor could be used to manage the system. There will now be a drop-down on the users page to select the appropriate customer. It will be hidden if only one context is valid for the current user. The same is already true for the contexts and global tabs. git-svn-id: https://svn.alkaloid.net/gpl/shout/trunk@39 06cd67b6-e706-0410-b29e-9de616bca6e9 --- contexts.php | 16 ++++++------- index.php | 73 +++++++++++++++++++++++++++++++++++++++--------------------- shout.webprj | 39 ++++++++++++++++++++------------ users.php | 42 ++++++++++++++++++++++++++-------- 4 files changed, 114 insertions(+), 56 deletions(-) diff --git a/contexts.php b/contexts.php index 42d6099fd..d9c7299be 100644 --- a/contexts.php +++ b/contexts.php @@ -3,12 +3,8 @@ if (!defined(SHOUT_BASE)) { define(SHOUT_BASE, dirname(__FILE__)); } -require_once SHOUT_BASE . "/lib/base.php"; -require_once SHOUT_BASE . "/lib/Shout.php"; - -# Get list of available contexts from the driver -$contexts = $shout->getContexts(); -if (is_a($contexts, 'PEAR_Error')) { +# Check that we are properly initialized +if (!isset($contexts) || is_a($contexts, 'PEAR_Error')) { $notification->push(_("Internal error viewing requested page"), 'horde.error'); } @@ -19,11 +15,15 @@ system.", 'horde.error')); exit(); } elseif (count($contexts) == 1) { header("Location: " . - Horde::applicationUrl("users.php?context=$contexts[0]")); + Horde::applicationUrl("index.php?context=$contexts[0]§ion=users")); exit(); } +$notification->notify(); + # Print the contexts +$toggle = false; foreach($contexts as $context) { - print "$context
\n"; + include SHOUT_TEMPLATES . "/context/contextline.inc"; + $toggle = !$toggle; } \ No newline at end of file diff --git a/index.php b/index.php index 02724d748..9b90c09c8 100644 --- a/index.php +++ b/index.php @@ -23,42 +23,65 @@ require_once SHOUT_BASE . '/lib/Shout.php'; require_once 'Horde/Variables.php'; require_once 'Horde/Text/Filter.php'; +$context = Util::getFormData("context"); +$section = Util::getFormData("section"); + $contexts = $shout->getContexts(); $vars = &Variables::getDefaultVariables(); #$ticket->setDetails($vars); -$title = '[#' . $ticket->getId() . '] ' . $ticket->get('summary'); -require WHUPS_TEMPLATES . '/common-header.inc'; -require WHUPS_TEMPLATES . '/menu.inc'; -require WHUPS_TEMPLATES . '/prevnext.inc'; +#$title = '[#' . $ticket->getId() . '] ' . $ticket->get('summary'); +require SHOUT_TEMPLATES . '/common-header.inc'; +require SHOUT_TEMPLATES . '/menu.inc'; -$tabs = &Whups::getTicketTabs($vars); -$tabs->preserve('id', $ticket->getId()); +$tabs = &Shout::getTabs($vars); +$tabs->preserve('context', $context); echo $tabs->render(); -$form = &new TicketDetailsForm($vars); -$form->addAttributes($whups->getAllTicketAttributesWithNames($ticket->getId())); +switch ($section) { + case "contexts": + require "contexts.php"; + break; -$RENDERER = &new Horde_Form_Renderer(); -$RENDERER->beginInactive($title); -$RENDERER->renderFormInactive($form, $vars); -$RENDERER->end(); + case "users": + require "users.php"; + break; -echo '
'; + case "moh": + require "moh.php"; + break; -$COMMENT = &new Comment(); -$COMMENT->begin(_("History")); -$history = Whups::permissionsFilter($whups->getHistory($ticket->getId()), - 'comment', PERMS_READ); -$chtml = array(); -foreach ($history as $comment_values) { - $chtml[] = $COMMENT->render(new Variables($comment_values)); -} -if ($prefs->getValue('comment_sort_dir')) { - $chtml = array_reverse($chtml); + case "global": + require "global.php"; + break; + + default: + break; } -echo implode('', $chtml); -$COMMENT->end(); +// $form = &new TicketDetailsForm($vars); +// $form->addAttributes($whups->getAllTicketAttributesWithNames( +// $ticket->getId())); +// +// $RENDERER = &new Horde_Form_Renderer(); +// $RENDERER->beginInactive($title); +// $RENDERER->renderFormInactive($form, $vars); +// $RENDERER->end(); +// +// echo '
'; +// +// $COMMENT = &new Comment(); +// $COMMENT->begin(_("History")); +// $history = Whups::permissionsFilter($whups->getHistory($ticket->getId()), +// 'comment', PERMS_READ); +// $chtml = array(); +// foreach ($history as $comment_values) { +// $chtml[] = $COMMENT->render(new Variables($comment_values)); +// } +// if ($prefs->getValue('comment_sort_dir')) { +// $chtml = array_reverse($chtml); +// } +// echo implode('', $chtml); +// $COMMENT->end(); require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/shout.webprj b/shout.webprj index 82bd6235d..b291d0956 100644 --- a/shout.webprj +++ b/shout.webprj @@ -9,31 +9,36 @@ - - - - - + + + + + - - + + - + - + - - + + + + - + + + + @@ -55,7 +60,7 @@ - + Ben Klang ben@alkaloid.net Gubed @@ -66,11 +71,17 @@ - + + + + + + + diff --git a/users.php b/users.php index 20fbf3fa6..d5a60b678 100644 --- a/users.php +++ b/users.php @@ -3,16 +3,40 @@ if (!defined(SHOUT_BASE)) { define(SHOUT_BASE, dirname(__FILE__)); } -require_once SHOUT_BASE . "/lib/base.php"; -require_once SHOUT_BASE . "/lib/Shout.php"; - -# Verify the current user has access to this context -$context = Util::getFormData("context"); +# Check that we are properly initialized +if (!isset($contexts) || is_a($contexts, 'PEAR_Error')) { + $notification->push(_("Internal error viewing requested page"), + 'horde.error'); +} -if (!in_array($context, $shout->getContexts())) { - $notification->push(_("You do not have permission to access this system.", - 'horde.error')); - exit(); +if (!in_array($context, $contexts)) { + $notification->push("You do not have permission to access this system.", + 'horde.error'); } +$notification->notify(); +require_once SHOUT_BASE . "/lib/Users.php"; + +$RENDERER = &new Horde_Form_Renderer(); +$empty = ''; +$vars = &Variables::getDefaultVariables($empty); +$formname = $vars->get('formname'); + +$title = "Users"; + +$form = &Horde_Form::singleton('SelectContextForm', $vars); +$valid = $form->validate($vars, true); +/* +if ($valid) { +} else {*/ + if ($formname != 'selectcontext') { + $form->clearValidation(); + } + $form->open($RENDERER, $vars, 'users.php', 'post'); + $RENDERER->beginActive($form->getTitle()); + $RENDERER->renderFormActive($form, $vars); + $RENDERER->submit(); + $RENDERER->end(); + $form->close($RENDERER); +// } print_r($shout->getUsers($context)); \ No newline at end of file -- 2.11.0