Example #1
0
 /**
  * Output the object administration form and handle its input.
  *
  * @access protected
  */
 function method_admin()
 {
     $this->foowd->track('foowd_object->method_admin');
     include_once INPUT_DIR . 'input.form.php';
     $error = NULL;
     $shortForm = new input_form('shortform');
     $lookup = smdoc_name_lookup::getInstance($this->foowd);
     $lookup->addShortNameToForm($this, $shortForm, $error);
     $adminForm = new input_form('adminForm');
     $this->addFormItemsToAdminForm($adminForm, $error);
     if ($error != NULL) {
         $this->foowd->template->assign('failure', $error);
     } elseif ($adminForm->submitted() && $this->foowd_changed) {
         if ($this->save()) {
             $this->foowd->template->assign('success', OBJECT_UPDATE_OK);
         } else {
             $this->foowd->template->assign('failure', OBJECT_UPDATE_FAILED);
         }
     }
     $this->foowd->template->assign_by_ref('shortform', $shortForm);
     $this->foowd->template->assign_by_ref('form', $adminForm);
     $this->foowd->track();
 }
 /**
  * Output a list of all known short names
  *
  * Values set in template:
  *  + shortlist       - below
  *  + addForm         - Form for adding a new shortname
  *  + deleteForm      - Form for deleting shortnames
  *
  * Sample contents of $t['shortlist']:
  * <pre>
  * array (
  *   shortname => array ( 
  *                 'objectid' => 8894324,
  *                 'classid' => 9321833,
  *                 'title' => 'Some page title',
  *                 'name_delete' => checkbox for deletion of shortname
  *                )
  * )
  * </pre>
  *
  * @static
  * @param smdoc  $foowd Reference to the foowd environment object.
  * @param string $className The name of the class.
  */
 function class_list(&$foowd, $className)
 {
     $foowd->track('smdoc_name_lookup->class_list');
     include_once INPUT_DIR . 'input.textbox.php';
     include_once INPUT_DIR . 'input.form.php';
     include_once INPUT_DIR . 'input.checkbox.php';
     $shortList = array();
     $lookup =& smdoc_name_lookup::getInstance($foowd);
     /*
      * Create form for clearing short names
      */
     $deleteForm = new input_form('deleteForm', NULL, SQ_POST, _("Delete Short Names"));
     if (!empty($lookup->shortNames)) {
         foreach ($lookup->shortNames as $idx => $value) {
             if (is_string($idx)) {
                 $elem = $value;
                 $deleteBox = new input_checkbox($idx, $deleteForm, FALSE, 'Delete');
                 if ($deleteForm->submitted() && $deleteBox->checked) {
                     $lookup->deleteShortName($idx);
                     unset($elem);
                 } else {
                     // Add box to form and array
                     $deleteForm->addObject($deleteBox);
                     $elem['name_delete'] =& $deleteForm->objects[$idx];
                 }
                 if (isset($elem)) {
                     $shortList[$idx] = $elem;
                 }
             }
         }
     }
     $foowd->template->assign_by_ref('deleteForm', $deleteForm);
     $foowd->template->assign('shortList', $shortList);
     $foowd->track();
 }
Example #3
0
    $classid_q = new input_querystring('classid', REGEX_ID, NULL);
    $classid = $classid_q->value;
    $objectid_q = new input_querystring('objectid', REGEX_ID, NULL);
    $objectid = $objectid_q->value;
}
$version_q = new input_querystring('version', REGEX_VERSION);
$method_q = new input_querystring('method', NULL);
$method = $method_q->value;
$className_q = new input_querystring('class', REGEX_TITLE, NULL);
if ($className_q->wasValid) {
    $className = $className_q->value;
    $objectMethod = FALSE;
} elseif ($classid != NULL) {
    $className = getClassName($classid);
} elseif ($objectid == NULL) {
    $lookup =& smdoc_name_lookup::getInstance($foowd);
    $result = $lookup->findObject('home', $objectid, $classid);
    // defined
    if (!$result) {
        $objectOK = FALSE;
        $_SESSION['error'] = OBJECT_NOT_FOUND;
    }
}
/*
 * If form has been cancelled, redirect to view of that object
 */
if ($objectOK && sqGetGlobalVar('form_cancel', $value, SQ_FORM)) {
    unset($_SESSION['error']);
    $_SESSION['ok'] = OBJECT_UPDATE_CANCEL;
    if (empty($objectid)) {
        $uri_arr['object'] = 'home';