コード例 #1
0
ファイル: spotlight.php プロジェクト: severnaya99/Sg-2010
 /**
  * Get a {@link XoopsForm} object for creating/editing Spotlight articles
  *
  * @return object
  */
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = _AMS_AM_SPOTLIGHT;
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/formimageselect.php";
     $form = new XoopsThemeForm($title, 'spotlightform', $action);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormHidden('id', $this->getVar('spotlightid')));
     }
     $mode_select = new XoopsFormRadio('', 'mode', $this->getVar('mode'));
     $mode_select->addOption(1, _AMS_AM_SPOT_LATESTARTICLE);
     $mode_select->addOption(2, _AMS_AM_SPOT_LATESTINTOPIC);
     $mode_select->addOption(3, _AMS_AM_SPOT_SPECIFICARTICLE);
     $mode_select->addOption(4, _AMS_AM_SPOT_CUSTOM);
     include_once XOOPS_ROOT_PATH . "/class/tree.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newstopic.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
     $xt = new AmsTopic($GLOBALS['xoopsDB']->prefix("ams_topics"));
     $allTopics = $xt->getAllTopics();
     $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
     $topic_select = new XoopsFormLabel(_AMS_AM_TOPIC, $topic_obj_tree->makeSelBox('topicid', 'topic_title', '--', $this->getVar('topicid'), false));
     $topic_select->setDescription(_AMS_AM_SPOT_TOPIC_DESC);
     $article_select = new XoopsFormSelect(_AMS_AM_ARTICLE, 'storyid', $this->getVar('storyid'));
     $article_select->addOptionArray(AmsStory::getAllPublished($GLOBALS['xoopsModuleConfig']['spotlight_art_num'], 0, false, 0, 1, false));
     $article_select->setDescription(_AMS_AM_SPOT_ARTICLE_DESC);
     $mode_tray = new XoopsFormElementTray(_AMS_AM_SPOT_MODE_SELECT);
     $mode_tray->addElement($mode_select);
     $showimage_select = new XoopsFormRadio(_AMS_AM_SPOT_SHOWIMAGE, 'showimage', $this->getVar('showimage'));
     $showimage_select->addOption(0, _AMS_AM_SPOT_SPECIFYIMAGE);
     $showimage_select->addOption(1, _AMS_AM_SPOT_TOPICIMAGE);
     $showimage_select->addOption(2, _AMS_AM_SPOT_AUTHORIMAGE);
     $showimage_select->addOption(3, _AMS_AM_SPOT_NOIMAGE);
     $showimage_select->setDescription(_AMS_AM_SPOT_SHOWIMAGE_DESC);
     $image_select = new XoopsFormImageSelect(_AMS_AM_SPOT_IMAGE, 'image', $this->getVar('image', 'e'), 70, 255);
     $autoteaser_select = new XoopsFormRadioYN(_AMS_AM_SPOT_AUTOTEASER, 'autoteaser', $this->getVar('autoteaser'));
     $teaser_text = new XoopsFormDhtmlTextArea(_AMS_AM_SPOT_TEASER, 'teaser', $this->getVar('teaser', 'e'));
     $maxlength_text = new XoopsFormText(_AMS_AM_SPOT_MAXLENGTH, 'maxlength', 10, 10, $this->getVar('maxlength'));
     $display_select = new XoopsFormRadioYN(_AMS_AM_SPOT_DISPLAY, 'display', $this->getVar('display'));
     $weight_text = new XoopsFormText(_AMS_AM_SPOT_WEIGHT, 'weight', 10, 10, $this->getVar('weight'));
     $form->addElement($mode_tray);
     $form->addElement($topic_select);
     $form->addElement($article_select);
     $form->addElement($showimage_select);
     $form->addElement($image_select);
     $form->addElement($autoteaser_select);
     $form->addElement($maxlength_text);
     $form->addElement($teaser_text);
     $form->addElement($display_select);
     $form->addElement($weight_text);
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'spotlightsubmit', _AMS_AM_SUBMIT, 'submit'));
     return $form;
 }
コード例 #2
0
 function render($ele_value, $caption, $markupName, $isDisabled, $element, $entry_id)
 {
     global $xoopsDB, $xoopsUser, $myts;
     $renderer = new formulizeElementRenderer();
     $form_handler = xoops_getmodulehandler('forms', 'formulize');
     $id_form = $element->getVar('id_form');
     if ($entry_id != "new") {
         $owner = getEntryOwner($entry_id, $id_form);
     } else {
         $owner = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
     }
     $formObject = $form_handler->get($id_form);
     $isDisabled = false;
     if (strstr(getCurrentURL(), "printview.php")) {
         $isDisabled = true;
         // disabled all elements if we're on the printable view
     }
     $ele_desc = $element->getVar('ele_desc', "f");
     if (strstr($ele_value[2], "#*=:*")) {
         // if we've got a link on our hands... -- jwe 7/29/04
         // new process for handling links...May 10 2008...new datastructure for formulize 3.0
         $boxproperties = explode("#*=:*", $ele_value[2]);
         $sourceFid = $boxproperties[0];
         $sourceHandle = $boxproperties[1];
         $sourceEntryIds = explode(",", trim($boxproperties[2], ","));
         // grab the user's groups and the module id
         global $regcode;
         if ($regcode) {
             // if we're dealing with a registration code, determine group membership based on the code
             $reggroupsq = q("SELECT reg_codes_groups FROM " . XOOPS_DB_PREFIX . "_reg_codes WHERE reg_codes_code=\"{$regcode}\"");
             $groups = explode("&8(%\$", $reggroupsq[0]['reg_codes_groups']);
             if ($groups[0] === "") {
                 unset($groups);
             }
             // if a code has no groups associated with it, then kill the null value that will be in position 0 in the groups array.
             $groups[] = XOOPS_GROUP_USERS;
             $groups[] = XOOPS_GROUP_ANONYMOUS;
         } else {
             $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
         }
         $module_id = getFormulizeModId();
         $pgroups = array();
         // handle new linkscope option -- August 30 2006
         $emptylist = false;
         if ($ele_value[3]) {
             $scopegroups = explode(",", $ele_value[3]);
             if (!in_array("all", $scopegroups)) {
                 if ($ele_value[4]) {
                     // limit by user's groups
                     foreach ($groups as $gid) {
                         // want to loop so we can get rid of reg users group simply
                         if ($gid == XOOPS_GROUP_USERS) {
                             continue;
                         }
                         if (in_array($gid, $scopegroups)) {
                             $pgroups[] = $gid;
                         }
                     }
                 } else {
                     // just use scopegroups
                     $pgroups = $scopegroups;
                 }
                 if (count($pgroups) == 0) {
                     // specific scope was specified, and nothing found, so we should show nothing
                     $emptylist = true;
                 }
             } else {
                 if ($ele_value[4]) {
                     // all groups selected, but limiting by user's groups is turned on
                     foreach ($groups as $gid) {
                         // want to loop so we can get rid of reg users group simply
                         if ($gid == XOOPS_GROUP_USERS) {
                             continue;
                         }
                         $pgroups[] = $gid;
                     }
                 } else {
                     // all groups should be used
                     unset($pgroups);
                     $allgroupsq = q("SELECT groupid FROM " . $xoopsDB->prefix("groups"));
                     //  . " WHERE groupid != " . XOOPS_GROUP_USERS); // use all groups now, if all groups are picked, with no restrictions on membership or anything, then use all groups
                     foreach ($allgroupsq as $thisgid) {
                         $pgroups[] = $thisgid['groupid'];
                     }
                 }
             }
         }
         // Note: OLD WAY: if no groups were found, then pguidq will be empty and so all entries will be shown, no restrictions
         // NEW WAY: if a specific group(s) was specified, and no match with the current user was found, then we return an empty list
         array_unique($pgroups);
         // remove duplicate groups from the list
         if ($ele_value[6] and count($pgroups) > 0) {
             $pgroupsfilter = " (";
             $start = true;
             foreach ($pgroups as $thisPgroup) {
                 if (!$start) {
                     $pgroupsfilter .= " AND ";
                 }
                 $pgroupsfilter .= "EXISTS(SELECT 1 FROM " . $xoopsDB->prefix("formulize_entry_owner_groups") . " AS t2 WHERE t2.groupid={$thisPgroup} AND t2.fid={$sourceFid} AND t2.entry_id=t1.entry_id)";
                 $start = false;
             }
             $pgroupsfilter .= ")";
         } elseif (count($pgroups) > 0) {
             $pgroupsfilter = " t2.groupid IN (" . formulize_db_escape(implode(",", $pgroups)) . ") AND t2.entry_id=t1.entry_id AND t2.fid={$sourceFid}";
         } else {
             $pgroupsfilter = "";
         }
         $sourceFormObject = $form_handler->get($sourceFid);
         list($conditionsfilter, $conditionsfilter_oom, $parentFormFrom) = buildConditionsFilterSQL($ele_value[5], $sourceFid, $entry_id, $owner, $formObject, "t1");
         // if there is a restriction in effect, then add some SQL to reject options that have already been selected ??
         $restrictSQL = "";
         if ($ele_value[9]) {
             $restrictSQL = " AND (\n\t\t\t\tNOT EXISTS (\n\t\t\t\tSELECT 1 FROM " . $xoopsDB->prefix("formulize_" . $formObject->getVar('form_handle')) . " AS t4 WHERE t4.`" . $element->getVar('ele_handle') . "` LIKE CONCAT( '%,', t1.`entry_id` , ',%' ) AND t4.entry_id != " . intval($entry_id);
             $restrictSQL .= $renderer->addEntryRestrictionSQL($ele_value[9], $id_form, $groups);
             // pass in the flag about restriction scope, and the form id, and the groups
             $restrictSQL .= " ) OR EXISTS (\n\t\t\t\tSELECT 1 FROM " . $xoopsDB->prefix("formulize_" . $formObject->getVar('form_handle')) . " AS t4 WHERE t4.`" . $element->getVar('ele_handle') . "` LIKE CONCAT( '%,', t1.`entry_id` , ',%' ) AND t4.entry_id = " . intval($entry_id);
             $restrictSQL .= $renderer->addEntryRestrictionSQL($ele_value[9], $id_form, $groups);
             $restrictSQL .= ") )";
         }
         static $cachedSourceValuesQ = array();
         static $cachedSourceValuesAutocompleteFile = array();
         static $cachedSourceValuesAutocompleteLength = array();
         // setup the sort order based on ele_value[12], which is an element id number
         $sortOrder = $ele_value[15] == 2 ? " DESC" : "ASC";
         if ($ele_value[12] == "none" or !$ele_value[12]) {
             $sortOrderClause = " ORDER BY t1.`{$sourceHandle}` {$sortOrder}";
         } else {
             list($sortHandle) = convertElementIdsToElementHandles(array($ele_value[12]), $sourceFormObject->getVar('id_form'));
             $sortOrderClause = " ORDER BY t1.`{$sortHandle}` {$sortOrder}";
         }
         if ($pgroupsfilter) {
             // if there is a groups filter, then join to the group ownership table
             $sourceValuesQ = "SELECT t1.entry_id, t1.`" . $sourceHandle . "` FROM " . $xoopsDB->prefix("formulize_" . $sourceFormObject->getVar('form_handle')) . " AS t1, " . $xoopsDB->prefix("formulize_entry_owner_groups") . " AS t2 {$parentFormFrom} WHERE {$pgroupsfilter} {$conditionsfilter} {$conditionsfilter_oom} {$restrictSQL} GROUP BY t1.entry_id {$sortOrderClause}";
         } else {
             // otherwise just query the source table
             $sourceValuesQ = "SELECT t1.entry_id, t1.`" . $sourceHandle . "` FROM " . $xoopsDB->prefix("formulize_" . $sourceFormObject->getVar('form_handle')) . " AS t1 {$parentFormFrom} WHERE t1.entry_id>0 {$conditionsfilter} {$conditionsfilter_oom} {$restrictSQL} GROUP BY t1.entry_id {$sortOrderClause}";
         }
         //print "$sourceValuesQ<br><br>";
         if (!$isDisabled) {
             // set the default selections, based on the entry_ids that have been selected as the defaults, if applicable
             $hasNoValues = trim($boxproperties[2]) == "" ? true : false;
             $useDefaultsWhenEntryHasNoValue = $ele_value[14];
             if (($entry_id == "new" or $useDefaultsWhenEntryHasNoValue and $hasNoValues) and (is_array($ele_value[13]) and count($ele_value[13]) > 0 or $ele_value[13])) {
                 $defaultSelected = $ele_value[13];
             } else {
                 $defaultSelected = "";
             }
             $form_ele = new XoopsFormSelect($caption, $markupName, $defaultSelected, $ele_value[0], $ele_value[1]);
             $form_ele->setExtra("onchange=\"javascript:formulizechanged=1;\" jquerytag='{$markupName}'");
             if ($ele_value[0] == 1) {
                 // add the initial default entry, singular or plural based on whether the box is one line or not.
                 $form_ele->addOption("none", _AM_FORMLINK_PICK);
             }
         } else {
             $disabledHiddenValue = array();
             $disabledOutputText = array();
         }
         if (!isset($cachedSourceValuesQ[$sourceValuesQ])) {
             $element_handler = xoops_getmodulehandler('elements', 'formulize');
             $sourceElementObject = $element_handler->get($boxproperties[1]);
             if ($sourceElementObject->isLinked) {
                 // need to jump one more level back to get value that this value is pointing at
                 $sourceEleValue = $sourceElementObject->getVar('ele_value');
                 $originalSource = explode("#*=:*", $sourceEleValue[2]);
                 include_once XOOPS_ROOT_PATH . "/modules/formulize/class/data.php";
                 $data_handler = new formulizeDataHandler($originalSource[0]);
             }
             $reslinkedvaluesq = $xoopsDB->query($sourceValuesQ);
             if ($reslinkedvaluesq) {
                 while ($rowlinkedvaluesq = $xoopsDB->fetchRow($reslinkedvaluesq)) {
                     if ($rowlinkedvaluesq[1] === "") {
                         continue;
                     }
                     if ($sourceElementObject->isLinked) {
                         $rowlinkedvaluesq[1] = $data_handler->getElementValueInEntry(trim($rowlinkedvaluesq[1], ","), $originalSource[1]);
                     }
                     $linkedElementOptions[$rowlinkedvaluesq[0]] = strip_tags($rowlinkedvaluesq[1]);
                 }
             }
             $cachedSourceValuesQ[$sourceValuesQ] = $linkedElementOptions;
             /* ALTERED - 20100318 - freeform - jeff/julian - start */
             if (!$isDisabled and $ele_value[8] == 1) {
                 // write the possible values to a cached file so we can look them up easily when we need them, don't want to actually send them to the browser, since it could be huge, but don't want to replicate all the logic that has already gathered the values for us, each time there's an ajax request
                 $cachedLinkedOptionsFileName = "formulize_linkedOptions_" . str_replace(".", "", microtime(true));
                 formulize_scandirAndClean(XOOPS_ROOT_PATH . "/cache/", "formulize_linkedOptions_");
                 $cachedLinkedOptions = fopen(XOOPS_ROOT_PATH . "/cache/{$cachedLinkedOptionsFileName}", "w");
                 fwrite($cachedLinkedOptions, "<?php\n\r");
                 $maxLength = 0;
                 foreach ($linkedElementOptions as $id => $text) {
                     $thisTextLength = strlen($text);
                     $maxLength = $thisTextLength > $maxLength ? $thisTextLength : $maxLength;
                     $text = str_replace("\$", "\\\$", $text);
                     $quotedText = "\"" . str_replace("\"", "\\\"", html_entity_decode($text, ENT_QUOTES)) . "\"";
                     $singleQuotedText = str_replace("'", "\\'", "[{$quotedText},{$id}]");
                     fwrite($cachedLinkedOptions, "if(stristr({$quotedText}, \$term)){ \$found[]='" . $singleQuotedText . "'; }\n");
                 }
                 fwrite($cachedLinkedOptions, "?>");
                 fclose($cachedLinkedOptions);
                 $cachedSourceValuesAutocompleteFile[$sourceValuesQ] = $cachedLinkedOptionsFileName;
                 $cachedSourceValuesAutocompleteLength[$sourceValuesQ] = $maxLength;
             }
         }
         // if we're rendering an autocomplete box
         if (!$isDisabled and $ele_value[8] == 1) {
             // do autocomplete rendering logic here
             if ($boxproperties[2]) {
                 $default_value = trim($boxproperties[2], ",");
                 $data_handler_autocomplete = new formulizeDataHandler($boxproperties[0]);
                 $default_value_user = $data_handler_autocomplete->getElementValueInEntry(trim($boxproperties[2], ","), $boxproperties[1]);
             }
             $renderedComboBox = $renderer->formulize_renderQuickSelect($markupName, $cachedSourceValuesAutocompleteFile[$sourceValuesQ], $default_value, $default_value_user, $cachedSourceValuesAutocompleteLength[$sourceValuesQ]);
             $form_ele = new xoopsFormLabel($caption, $renderedComboBox);
             $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
         }
         // only do this if we're rendering a normal element, that is not disabled
         if (!$isDisabled and $ele_value[8] == 0) {
             $form_ele->addOptionArray($cachedSourceValuesQ[$sourceValuesQ]);
         }
         // only do this if we're rendering a normal element (may be disabled)
         if ($ele_value[8] == 0) {
             foreach ($sourceEntryIds as $thisEntryId) {
                 if (!$isDisabled) {
                     $form_ele->setValue($thisEntryId);
                 } else {
                     $disabledName = $ele_value[1] ? $markupName . "[]" : $markupName;
                     $disabledHiddenValue[] = "<input type=hidden name=\"{$disabledName}\" value=\"{$thisEntryId}\">";
                     $disabledOutputText[] = $cachedSourceValuesQ[$sourceValuesQ][$thisEntryId];
                     // the text value of the option(s) that are currently selected
                 }
             }
         }
         if ($isDisabled) {
             $form_ele = new XoopsFormLabel($caption, implode(", ", $disabledOutputText) . implode("\n", $disabledHiddenValue));
             $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
         } elseif ($ele_value[8] == 0) {
             // this is a hack because the size attribute is private and only has a getSize and not a setSize, setting the size can only be done through the constructor
             $count = count($form_ele->getOptions());
             $size = $ele_value[0];
             $new_size = $count < $size ? $count : $size;
             $form_ele->_size = $new_size;
         }
         /* ALTERED - 20100318 - freeform - jeff/julian - stop */
     } else {
         // or if we don't have a link...
         $selected = array();
         $options = array();
         $disabledOutputText = array();
         $disabledHiddenValue = array();
         $disabledHiddenValues = "";
         // add the initial default entry, singular or plural based on whether the box is one line or not.
         if ($ele_value[0] == 1) {
             $options["none"] = _AM_FORMLINK_PICK;
         }
         // set opt_count to 1 if the box is NOT a multiple selection box. -- jwe 7/26/04
         if ($ele_value[1]) {
             $opt_count = 0;
         } else {
             $opt_count = 1;
         }
         $hiddenOutOfRangeValuesToWrite = array();
         while ($i = each($ele_value[2])) {
             // handle requests for full names or usernames -- will only kick in if there is no saved value (otherwise ele_value will have been rewritten by the loadValues function in the form display
             // note: if the user is about to make a proxy entry, then the list of users displayed will be from their own groups, but not from the groups of the user they are about to make a proxy entry for.  ie: until the proxy user is known, the choice of users for this list can only be based on the current user.  This could lead to confusing or buggy situations, such as users being selected who are outside the groups of the proxy user (who will become the owner) and so there will be an invalid value stored for this element in the db.
             if ($i['key'] === "{FULLNAMES}" or $i['key'] === "{USERNAMES}") {
                 // ADDED June 18 2005 to handle pulling in usernames for the user's group(s)
                 if ($i['key'] === "{FULLNAMES}") {
                     $nametype = "name";
                 }
                 if ($i['key'] === "{USERNAMES}") {
                     $nametype = "uname";
                 }
                 if (isset($ele_value[2]['{OWNERGROUPS}'])) {
                     $groups = $ele_value[2]['{OWNERGROUPS}'];
                 } else {
                     global $regcode;
                     if ($regcode) {
                         // if we're dealing with a registration code, determine group membership based on the code
                         $reggroupsq = q("SELECT reg_codes_groups FROM " . XOOPS_DB_PREFIX . "_reg_codes WHERE reg_codes_code=\"{$regcode}\"");
                         $groups = explode("&8(%\$", $reggroupsq[0]['reg_codes_groups']);
                         if ($groups[0] === "") {
                             unset($groups);
                         }
                         // if a code has no groups associated with it, then kill the null value that will be in position 0 in the groups array.
                         $groups[] = XOOPS_GROUP_USERS;
                         $groups[] = XOOPS_GROUP_ANONYMOUS;
                     } else {
                         global $xoopsUser;
                         $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
                     }
                 }
                 $pgroups = array();
                 if ($ele_value[3]) {
                     $scopegroups = explode(",", $ele_value[3]);
                     if (!in_array("all", $scopegroups)) {
                         if ($ele_value[4]) {
                             // limit by users's groups
                             foreach ($groups as $gid) {
                                 // want to loop so we can get rid of reg users group simply
                                 if ($gid == XOOPS_GROUP_USERS) {
                                     continue;
                                 }
                                 if (in_array($gid, $scopegroups)) {
                                     $pgroups[] = $gid;
                                 }
                             }
                             if (count($pgroups) > 0) {
                                 unset($groups);
                                 $groups = $pgroups;
                             } else {
                                 $groups = array();
                             }
                         } else {
                             // don't limit by user's groups
                             $groups = $scopegroups;
                         }
                     } else {
                         // use all
                         if (!$ele_value[4]) {
                             // really use all (otherwise, we're just going with all user's groups, so existing value of $groups will be okay
                             unset($groups);
                             global $xoopsDB;
                             $allgroupsq = q("SELECT groupid FROM " . $xoopsDB->prefix("groups"));
                             //  . " WHERE groupid != " . XOOPS_GROUP_USERS); // removed exclusion of registered users group March 18 2009, since it doesn't make sense in this situation.  All groups should mean everyone, period.
                             foreach ($allgroupsq as $thisgid) {
                                 $groups[] = $thisgid['groupid'];
                             }
                         }
                     }
                 }
                 $namelist = gatherNames($groups, $nametype, $ele_value[6], $ele_value[5]);
                 foreach ($namelist as $auid => $aname) {
                     $options[$auid] = $aname;
                 }
             } elseif ($i['key'] === "{SELECTEDNAMES}") {
                 // loadValue in formDisplay will create a second option with this key that contains an array of the selected values
                 $selected = $i['value'];
             } elseif ($i['key'] === "{OWNERGROUPS}") {
                 // do nothing with this piece of metadata that gets set in loadValue, since it's used above
             } else {
                 // regular selection list....
                 $options[$opt_count] = $myts->stripSlashesGPC($i['key']);
                 if (strstr($i['key'], _formulize_OUTOFRANGE_DATA)) {
                     $hiddenOutOfRangeValuesToWrite[$opt_count] = str_replace(_formulize_OUTOFRANGE_DATA, "", $i['key']);
                     // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                 }
                 if ($i['value'] > 0) {
                     $selected[] = $opt_count;
                 }
                 $opt_count++;
             }
         }
         $count = count($options);
         $size = $ele_value[0];
         $final_size = $count < $size ? $count : $size;
         $form_ele1 = new XoopsFormSelect($caption, $markupName, $selected, $final_size, $ele_value[1]);
         $form_ele1->setExtra("onchange=\"javascript:formulizechanged=1;\" jquerytag='{$markupName}'");
         // must check the options for uitext before adding to the element -- aug 25, 2007
         foreach ($options as $okey => $ovalue) {
             $options[$okey] = formulize_swapUIText($ovalue, $element->getVar('ele_uitext'));
         }
         $form_ele1->addOptionArray($options);
         if ($selected) {
             if (is_array($selected)) {
                 $hiddenElementName = $ele_value[1] ? $form_ele1->getName() . "[]" : $form_ele1->getName();
                 foreach ($selected as $thisSelected) {
                     $disabledOutputText[] = $options[$thisSelected];
                     $disabledHiddenValue[] = "<input type=hidden name=\"{$hiddenElementName}\" value=\"{$thisSelected}\">";
                 }
             } elseif ($ele_value[1]) {
                 // need to keep [] in the hidden element name if multiple values are expected, even if only one is chosen
                 $disabledOutputText[] = $options[$selected];
                 $disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "[]\" value=\"{$selected}\">";
             } else {
                 $disabledOutputText[] = $options[$selected];
                 $disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "\" value=\"{$selected}\">";
             }
         }
         $renderedHoorvs = "";
         if (count($hiddenOutOfRangeValuesToWrite) > 0) {
             foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
                 $thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
                 $renderedHoorvs .= $thisHoorv->render() . "\n";
                 unset($thisHoorv);
             }
         }
         if ($isDisabled) {
             $disabledHiddenValues = implode("\n", $disabledHiddenValue);
             // glue the individual value elements together into a set of values
             $renderedElement = implode(", ", $disabledOutputText);
         } elseif ($ele_value[8] == 1) {
             // autocomplete construction: make sure that $renderedElement is the final output of this chunk of code
             // write the possible values to a cached file so we can look them up easily when we need them, don't want to actually send them to the browser, since it could be huge, but don't want to replicate all the logic that has already gathered the values for us, each time there's an ajax request
             $cachedOptionsFileName = "formulize_Options_" . str_replace(".", "", microtime(true));
             formulize_scandirAndClean(XOOPS_ROOT_PATH . "/cache/", "formulize_Options_");
             $cachedOptions = fopen(XOOPS_ROOT_PATH . "/cache/{$cachedOptionsFileName}", "w");
             fwrite($cachedOptions, "<?php\n\r");
             $maxLength = 0;
             foreach ($options as $id => $text) {
                 $thisTextLength = strlen($text);
                 $maxLength = $thisTextLength > $maxLength ? $thisTextLength : $maxLength;
                 //$quotedText = "\"".str_replace("\"", "\\\"", trim($text))."\"";
                 $quotedText = "\"" . str_replace("\"", "\\\"", $text) . "\"";
                 fwrite($cachedOptions, "if(stristr({$quotedText}, \$term)){ \$found[]='[{$quotedText},{$id}]'; }\n\r");
             }
             fwrite($cachedOptions, "?>");
             fclose($cachedOptions);
             //print_r($selected); print_r($options);
             $defaultSelected = is_array($selected) ? $selected[0] : $selected;
             $renderedComboBox = $renderer->formulize_renderQuickSelect($markupName, $cachedOptionsFileName, $defaultSelected, $options[$defaultSelected], $maxLength);
             $form_ele2 = new xoopsFormLabel($caption, $renderedComboBox);
             $renderedElement = $form_ele2->render();
         } else {
             // normal element
             $renderedElement = $form_ele1->render();
         }
         $form_ele = new XoopsFormLabel($caption, "<nobr>{$renderedElement}</nobr>\n{$renderedHoorvs}\n{$disabledHiddenValues}\n");
         $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
     }
     // end of if we have a link on our hands. -- jwe 7/29/04
     return $form_ele;
 }
コード例 #3
0
ファイル: item.php プロジェクト: BackupTheBerlios/soopa
function edititem($showmenu = false, $itemid = 0)
{
    global $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a item
    if ($itemid != 0) {
        // Creating the ITEM object
        $itemObj = new ssItem($itemid);
        if ($itemObj->notLoaded()) {
            redirect_header("item.php", 1, _AM_SS_NOITEMSELECTED);
            exit;
        }
        switch ($itemObj->status()) {
            case _SS_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SS_SUBMITTED;
                $breadcrumb_action2 = _AM_SS_APPROVING;
                $page_title = _AM_SS_SUBMITTED_TITLE;
                $page_info = _AM_SS_SUBMITTED_INFO;
                $button_caption = _AM_SS_APPROVE;
                $new_status = _SS_STATUS_PUBLISHED;
                break;
            case _SS_STATUS_PUBLISHED:
                $breadcrumb_action1 = _AM_SS_PUBLISHED;
                $breadcrumb_action2 = _AM_SS_EDITING;
                $page_title = _AM_SS_PUBLISHEDEDITING;
                $page_info = _AM_SS_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SS_MODIFY;
                $new_status = _SS_STATUS_PUBLISHED;
                break;
            case _SS_STATUS_OFFLINE:
                $breadcrumb_action1 = _AM_SS_OFFLINE;
                $breadcrumb_action2 = _AM_SS_EDITING;
                $page_title = _AM_SS_OFFLINEEDITING;
                $page_info = _AM_SS_OFFLINEEDITING_INFO;
                $button_caption = _AM_SS_MODIFY;
                $new_status = _SS_STATUS_OFFLINE;
                break;
            case "default":
            default:
                break;
        }
        $categoryObj =& $itemObj->category();
        if ($showmenu) {
            ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        ss_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info);
    } else {
        // there's no parameter, so we're adding an item
        $itemObj =& $smartsection_item_handler->create();
        $categoryObj =& $smartsection_category_handler->create();
        $breadcrumb_action1 = _AM_SS_ITEMS;
        $breadcrumb_action2 = _AM_SS_CREATINGNEW;
        $button_caption = _AM_SS_CREATE;
        $new_status = _SS_STATUS_PUBLISHED;
        if ($showmenu) {
            ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0;
        $categoryObj->setVar('categoryid', $sel_categoryid);
        ss_collapsableBar('createitemtable', 'createitemicon', _AM_SS_ITEM_CREATING, _AM_SS_ITEM_CREATING_DSC);
    }
    // ITEM FORM
    $sform = new XoopsThemeForm(_AM_SS_ITEMS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // CATEGORY
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    ob_start();
    $sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid()));
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $category_label = new XoopsFormLabel(_AM_SS_CATEGORY, ob_get_contents());
    $category_label->setDescription(_AM_SS_CATEGORY_DSC);
    $sform->addElement($category_label);
    ob_end_clean();
    // TITLE
    $title_text = new XoopsFormText(_AM_SS_TITLE, 'title', 50, 255, $itemObj->title(0, 'e'));
    $sform->addElement($title_text, true);
    // SUMMARY
    $summary_text = ss_getEditor(_AM_SS_SUMMARY, 'summary', $itemObj->summary(0, 'e'));
    $summary_text->setDescription(_AM_SS_SUMMARY_DSC);
    $sform->addElement($summary_text, false);
    // DISPLAY_SUMMARY
    $display_summary_radio = new XoopsFormRadioYN(_AM_SS_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($display_summary_radio);
    // BODY
    $body_text = ss_getEditor(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'));
    //$body_text = new XoopsFormDhtmlTextArea(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'), 20, 60);
    $body_text->setDescription(_AM_SS_BODY_DSC);
    $sform->addElement($body_text, true);
    // IMAGE
    $image_array =& XoopsLists::getImgListAsArray(ss_getImageDir('item'));
    $image_select = new XoopsFormSelect('', 'image', $itemObj->image());
    //$image_select -> addOption ('-1', '---------------');
    $image_select->addOptionArray($image_array);
    $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $image_tray = new XoopsFormElementTray(_AM_SS_IMAGE_ITEM, '&nbsp;');
    $image_tray->addElement($image_select);
    $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . ss_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
    $image_tray->setDescription(_AM_SS_IMAGE_ITEM_DSC);
    $sform->addElement($image_tray);
    // IMAGE UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SS_IMAGE_UPLOAD, "image_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(_AM_SS_IMAGE_UPLOAD_ITEM_DSC);
    $sform->addElement($file_box);
    // Uid
    /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
    	    the method users::getobjects encounters a memory error 
    	*/
    $uid = $itemObj->uid() == 0 ? $xoopsUser->uid() : $itemObj->uid();
    $uid_select = new XoopsFormSelect(_AM_SS_UID, 'uid', $uid, 1, false);
    $uid_select->setDescription(_AM_SS_UID_DSC);
    $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC";
    $result = $xoopsDB->query($sql);
    $users_array = array();
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $users_array[$myrow['uid']] = $myrow['uname'];
    }
    $uid_select->addOptionArray($users_array);
    $sform->addElement($uid_select);
    // Datesub
    $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub');
    $datesub_datetime = new XoopsFormDateTime(_AM_SS_DATESUB, 'datesub', $size = 15, $datesub);
    $datesub_datetime->setDescription(_AM_SS_DATESUB_DSC);
    $sform->addElement($datesub_datetime);
    // STATUS
    $options = array(_SS_STATUS_PUBLISHED => _AM_SS_PUBLISHED, _SS_STATUS_OFFLINE => _AM_SS_OFFLINE);
    $status_select = new XoopsFormSelect(_AM_SS_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SS_STATUS_DSC);
    $sform->addElement($status_select);
    // WEIGHT
    $sform->addElement(new XoopsFormText(_AM_SS_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true);
    // COMMENTS
    $addcomments_radio = new XoopsFormRadioYN(_AM_SS_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($addcomments_radio);
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read());
    $groups_checkbox->setDescription(_AM_SS_PERMISSIONS_ITEM_DSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    // VARIOUS OPTIONS
    $options_tray = new XoopsFormElementTray(_AM_SS_OPTIONS, '<br />');
    $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml());
    $html_checkbox->addOption(1, _AM_SS_DOHTML);
    $options_tray->addElement($html_checkbox);
    $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley());
    $smiley_checkbox->addOption(1, _AM_SS_DOSMILEY);
    $options_tray->addElement($smiley_checkbox);
    $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode());
    $xcodes_checkbox->addOption(1, _AM_SS_DOXCODE);
    $options_tray->addElement($xcodes_checkbox);
    $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage());
    $images_checkbox->addOption(1, _AM_SS_DOIMAGE);
    $options_tray->addElement($images_checkbox);
    $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr());
    $linebreak_checkbox->addOption(1, _AM_SS_DOLINEBREAK);
    $options_tray->addElement($linebreak_checkbox);
    $sform->addElement($options_tray);
    // item ID
    $sform->addElement(new XoopsFormHidden('itemid', $itemObj->itemid()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'additem');
    $button_tray->addElement($hidden);
    if (!$itemid) {
        // there's no itemid? Then it's a new item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SS_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SS_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        ss_close_collapsable('createitemtable', 'createitemicon');
    } else {
        // else, we're editing an existing item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        ss_close_collapsable('edititemtable', 'edititemicon');
    }
    unset($hidden);
    if ($itemid != 0) {
        showfiles($itemObj);
    }
}
コード例 #4
0
 function constructElement($form_ele_id, $ele_value, $entry, $isDisabled = false, $screen = null)
 {
     if (strstr(getCurrentURL(), "printview.php")) {
         $isDisabled = true;
         // disabled all elements if we're on the printable view
     }
     global $xoopsUser, $xoopsModuleConfig, $separ, $myts;
     $myts =& MyTextSanitizer::getInstance();
     // $form_ele_id contains the ele_id of the current link select box, but we have to remove "ele_" from the front of it.
     //print "form_ele_id: $form_ele_id<br>"; // debug code
     if (strstr($form_ele_id, "de_")) {
         // display element uses a slightly different element name so it can be distinguished on subsequent page load from regular elements...THIS IS NOT TRUE/NECESSARY ANYMORE SINCE FORMULIZE 3, WHERE ALL ELEMENTS ARE DISPLAY ELEMENTS
         $true_ele_id = str_replace("de_" . $this->_ele->getVar('id_form') . "_" . $entry . "_", "", $form_ele_id);
         $displayElementInEffect = true;
     } else {
         $true_ele_id = str_replace("ele_", "", $form_ele_id);
         $displayElementInEffect = false;
     }
     // added July 6 2005.
     if (!$xoopsModuleConfig['delimeter']) {
         // assume that we're accessing a form from outside the Formulize module, therefore the Formulize delimiter setting is not available, so we have to query for it directly.
         global $xoopsDB;
         $delimq = q("SELECT conf_value FROM " . $xoopsDB->prefix("config") . ", " . $xoopsDB->prefix("modules") . " WHERE " . $xoopsDB->prefix("modules") . ".mid=" . $xoopsDB->prefix("config") . ".conf_modid AND " . $xoopsDB->prefix("modules") . ".dirname=\"formulize\" AND " . $xoopsDB->prefix("config") . ".conf_name=\"delimeter\"");
         $delimSetting = $delimq[0]['conf_value'];
     } else {
         $delimSetting = $xoopsModuleConfig['delimeter'];
     }
     $customElementHasData = false;
     $id_form = $this->_ele->getVar('id_form');
     $ele_caption = $this->_ele->getVar('ele_caption', 'e');
     $ele_caption = preg_replace('/\\{SEPAR\\}/', '', $ele_caption);
     // $ele_caption = stripslashes($ele_caption);
     // next line commented out to accomodate passing of ele_value from index.php
     // $ele_value = $this->_ele->getVar('ele_value');
     $ele_type = $this->_ele->getVar('ele_type');
     // call the text sanitizer, first try to convert HTML chars, and if there were no conversions, then do a textarea conversion to automatically make links clickable
     $ele_caption = trans($ele_caption);
     $htmlCaption = htmlspecialchars_decode($myts->undoHtmlSpecialChars($ele_caption));
     // do twice, because we need to handle &amp;lt; and other stupid stuff...do first time through XOOPS myts just because it might be doing a couple extra things that are useful...can probably just use PHP's own filter twice, not too big a deal
     if ($htmlCaption == $ele_caption) {
         $ele_caption = $myts->displayTarea($ele_caption);
     } else {
         $ele_caption = $htmlCaption;
     }
     $ele_caption = $this->formulize_replaceCurlyBracketVariables($ele_caption, $entry, $id_form);
     // ele_desc added June 6 2006 -- jwe
     $ele_desc = $this->_ele->getVar('ele_desc', "f");
     // the f causes no stupid reformatting by the ICMS core to take place
     // determine the entry owner
     if ($entry != "new") {
         $owner = getEntryOwner($entry, $id_form);
     } else {
         $owner = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
     }
     // setup the previous entry UI if necessary -- this is an option that can be specified for certain screens
     $previousEntryUI = "";
     if ($screen and $ele_type != "derived") {
         if ($screen->getVar('paraentryform') > 0) {
             $previousEntryUI = $this->formulize_setupPreviousEntryUI($screen, $true_ele_id, $ele_type, $owner, $displayElementInEffect, $entry, $this->_ele->getVar('ele_handle'), $this->_ele->getVar('id_form'));
         }
     }
     $form_handler = xoops_getmodulehandler('forms', 'formulize');
     $formObject = $form_handler->get($id_form);
     switch ($ele_type) {
         case 'derived':
             if ($entry != "new") {
                 $form_ele = new xoopsFormLabel($this->_ele->getVar('ele_caption'), formulize_numberFormat($ele_value[5], $this->_ele->getVar('ele_handle')));
                 $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
             } else {
                 $form_ele = new xoopsFormLabel($this->_ele->getVar('ele_caption'), _formulize_VALUE_WILL_BE_CALCULATED_AFTER_SAVE);
                 $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
             }
             break;
         case 'ib':
             if (get_magic_quotes_gpc()) {
                 $ele_value[0] = stripslashes($ele_value[0]);
             }
             if (trim($ele_value[0]) == "") {
                 $ele_value[0] = $ele_caption;
             }
             if (strstr($ele_value[0], "\$value=") or strstr($ele_value[0], "\$value =")) {
                 $form_id = $id_form;
                 $entry_id = $entry;
                 $entryData = $this->formulize_getCachedEntryData($id_form, $entry);
                 $creation_datetime = display($entryData, "creation_datetime");
                 $evalResult = eval($ele_value[0]);
                 if ($evalResult === false) {
                     $ele_value[0] = _formulize_ERROR_IN_LEFTRIGHT;
                 } else {
                     $ele_value[0] = $value;
                     // value is supposed to be the thing set in the eval'd code
                 }
             }
             $ele_value[0] = $this->formulize_replaceCurlyBracketVariables($ele_value[0], $entry, $id_form);
             $form_ele = $ele_value;
             // an array, item 0 is the contents of the break, item 1 is the class of the table cell (for when the form is table rendered)
             break;
         case 'text':
             $ele_value[2] = stripslashes($ele_value[2]);
             //        $ele_value[2] = $myts->displayTarea($ele_value[2]); // commented by jwe 12/14/04 so that info displayed for viewing in a form box does not contain HTML formatting
             $ele_value[2] = getTextboxDefault($ele_value[2], $id_form, $entry);
             //if placeholder value is set
             if ($ele_value[11]) {
                 $placeholder = $ele_value[2];
                 $ele_value[2] = "";
             }
             if (!strstr(getCurrentURL(), "printview.php")) {
                 // nmc 2007.03.24 - added
                 $form_ele = new XoopsFormText($ele_caption, $form_ele_id, $ele_value[0], $ele_value[1], $ele_value[2]);
             } else {
                 // nmc 2007.03.24 - added
                 $form_ele = new XoopsFormLabel($ele_caption, formulize_numberFormat($ele_value[2], $this->_ele->getVar('ele_handle')));
                 // nmc 2007.03.24 - added
             }
             //if placeholder value is set
             if ($ele_value[11]) {
                 $form_ele->setExtra("placeholder='" . $placeholder . "'");
             }
             //if numbers-only option is set
             if ($ele_value[3]) {
                 $form_ele->setExtra("class='numbers-only-textbox'");
             }
             // if required unique option is set, create validation javascript that will ask the database if the value is unique or not
             if ($ele_value[9]) {
                 $eltname = $form_ele_id;
                 $eltcaption = $ele_caption;
                 $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
                 $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                 $eltmsgUnique = empty($eltcaption) ? sprintf(_formulize_REQUIRED_UNIQUE, $eltname) : sprintf(_formulize_REQUIRED_UNIQUE, $eltcaption);
                 if ($this->_ele->getVar('ele_req')) {
                     // need to manually handle required setting, since only one validation routine can run for an element, so we need to include required checking in this unique checking routine, if the user selected required too
                     $form_ele->customValidationCode[] = "\nif ( myform.{$eltname}.value == '' ) {\n";
                     $form_ele->customValidationCode[] = "window.alert(\"{$eltmsg}\");\n myform.{$eltname}.focus();\n return false;\n";
                     $form_ele->customValidationCode[] = "}\n";
                 }
                 $form_ele->customValidationCode[] = "if(formulize_xhr_returned_check_for_unique_value != 'notreturned') {\n";
                 // a value has already been returned from xhr, so let's check that out...
                 $form_ele->customValidationCode[] = "if(formulize_xhr_returned_check_for_unique_value != 'valuenotfound') {\n";
                 // request has come back, form has been resubmitted, but the check turned up postive, ie: value is not unique, so we have to halt submission , and reset the check for unique flag so we can check again when the user has typed again and is ready to submit
                 $form_ele->customValidationCode[] = "window.alert(\"{$eltmsgUnique}\");\n";
                 $form_ele->customValidationCode[] = "formulize_xhr_returned_check_for_unique_value = 'notreturned'\n";
                 $form_ele->customValidationCode[] = "myform.{$eltname}.focus();\n return false;\n";
                 $form_ele->customValidationCode[] = "}\n";
                 $form_ele->customValidationCode[] = "} else {\n";
                 // do not submit the form, just send off the request, which will trigger a resubmission after setting the returned flag above to true so that we won't send again on resubmission
                 $form_ele->customValidationCode[] = "\nvar formulize_xhr_params = []\n";
                 $form_ele->customValidationCode[] = "formulize_xhr_params[0] = myform.{$eltname}.value;\n";
                 $form_ele->customValidationCode[] = "formulize_xhr_params[1] = " . $this->_ele->getVar('ele_id') . ";\n";
                 $xhr_entry_to_send = is_numeric($entry) ? $entry : 0;
                 $form_ele->customValidationCode[] = "formulize_xhr_params[2] = " . $xhr_entry_to_send . ";\n";
                 $form_ele->customValidationCode[] = "formulize_xhr_send('check_for_unique_value', formulize_xhr_params);\n";
                 $form_ele->customValidationCode[] = "return false;\n";
                 $form_ele->customValidationCode[] = "}\n";
             } elseif ($this->_ele->getVar('ele_req') and !$isDisabled) {
                 $eltname = $form_ele_id;
                 $eltcaption = $ele_caption;
                 $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
                 $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                 $form_ele->customValidationCode[] = "if (myform.{$eltname}.value == \"\") { window.alert(\"{$eltmsg}\"); myform.{$eltname}.focus(); return false; }";
             }
             break;
         case 'textarea':
             $ele_value[0] = stripslashes($ele_value[0]);
             //        $ele_value[0] = $myts->displayTarea($ele_value[0]); // commented by jwe 12/14/04 so that info displayed for viewing in a form box does not contain HTML formatting
             $ele_value[0] = getTextboxDefault($ele_value[0], $id_form, $entry);
             if (!strstr(getCurrentURL(), "printview.php") and !$isDisabled) {
                 // nmc 2007.03.24 - added
                 if (isset($ele_value['use_rich_text']) and $ele_value['use_rich_text']) {
                     include_once XOOPS_ROOT_PATH . "/class/xoopsform/formeditor.php";
                     $form_ele = new XoopsFormEditor($ele_caption, 'FCKeditor', $editor_configs = array("name" => $form_ele_id, "value" => $ele_value[0]), $noHtml = false, $OnFailure = "");
                     $eltname = $form_ele_id;
                     $eltcaption = $ele_caption;
                     $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
                     $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                     $form_ele->customValidationCode[] = "\n var FCKGetInstance = FCKeditorAPI.GetInstance('{$form_ele_id}');\n";
                     $form_ele->customValidationCode[] = "var getText = FCKGetInstance.EditorDocument.body.innerHTML; \n";
                     $form_ele->customValidationCode[] = "var StripTag = getText.replace(/(<([^>]+)>)/ig,''); \n";
                     $form_ele->customValidationCode[] = "if(StripTag=='' || StripTag=='&nbsp;') {\n";
                     $form_ele->customValidationCode[] = "window.alert(\"{$eltmsg}\");\n FCKGetInstance.Focus();\n return false;\n";
                     $form_ele->customValidationCode[] = "}\n";
                     $GLOBALS['formulize_fckEditors'] = true;
                 } else {
                     $form_ele = new XoopsFormTextArea($ele_caption, $form_ele_id, $ele_value[0], $ele_value[1], $ele_value[2]);
                 }
             } else {
                 // nmc 2007.03.24 - added
                 $form_ele = new XoopsFormLabel($ele_caption, str_replace("\n", "<br>", undoAllHTMLChars($ele_value[0], ENT_QUOTES)));
                 // nmc 2007.03.24 - added
             }
             break;
         case 'areamodif':
             if (strstr($ele_value[0], "\$value=") or strstr($ele_value[0], "\$value =")) {
                 $form_id = $id_form;
                 $entry_id = $entry;
                 $entryData = $this->formulize_getCachedEntryData($id_form, $entry);
                 $creation_datetime = display($entryData, "creation_datetime");
                 $evalResult = eval($ele_value[0]);
                 if ($evalResult === false) {
                     $ele_value[0] = _formulize_ERROR_IN_LEFTRIGHT;
                 } else {
                     $ele_value[0] = $value;
                     // value is supposed to be the thing set in the eval'd code
                 }
             }
             $ele_value[0] = $this->formulize_replaceCurlyBracketVariables($ele_value[0], $entry, $id_form);
             $form_ele = new XoopsFormLabel($ele_caption, $ele_value[0]);
             break;
         case 'select':
             if (is_string($ele_value[2]) and strstr($ele_value[2], "#*=:*")) {
                 // new process for handling links...May 10 2008...new datastructure for formulize 3.0
                 $boxproperties = explode("#*=:*", $ele_value[2]);
                 $sourceFid = $boxproperties[0];
                 $sourceHandle = $boxproperties[1];
                 $sourceEntryIds = explode(",", trim($boxproperties[2], ","));
                 // grab the user's groups and the module id
                 global $regcode;
                 if ($regcode) {
                     // if we're dealing with a registration code, determine group membership based on the code
                     $reggroupsq = q("SELECT reg_codes_groups FROM " . XOOPS_DB_PREFIX . "_reg_codes WHERE reg_codes_code=\"{$regcode}\"");
                     $groups = explode("&8(%\$", $reggroupsq[0]['reg_codes_groups']);
                     if ($groups[0] === "") {
                         unset($groups);
                     }
                     // if a code has no groups associated with it, then kill the null value that will be in position 0 in the groups array.
                     $groups[] = XOOPS_GROUP_USERS;
                     $groups[] = XOOPS_GROUP_ANONYMOUS;
                 } else {
                     $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
                 }
                 $module_id = getFormulizeModId();
                 global $xoopsDB;
                 $pgroups = array();
                 // handle new linkscope option -- August 30 2006
                 $emptylist = false;
                 if ($ele_value[3]) {
                     $scopegroups = explode(",", $ele_value[3]);
                     if (!in_array("all", $scopegroups)) {
                         if ($ele_value[4]) {
                             // limit by user's groups
                             foreach ($groups as $gid) {
                                 // want to loop so we can get rid of reg users group simply
                                 if ($gid == XOOPS_GROUP_USERS) {
                                     continue;
                                 }
                                 if (in_array($gid, $scopegroups)) {
                                     $pgroups[] = $gid;
                                 }
                             }
                         } else {
                             // just use scopegroups
                             $pgroups = $scopegroups;
                         }
                         if (count($pgroups) == 0) {
                             // specific scope was specified, and nothing found, so we should show nothing
                             $emptylist = true;
                         }
                     } else {
                         if ($ele_value[4]) {
                             // all groups selected, but limiting by user's groups is turned on
                             foreach ($groups as $gid) {
                                 // want to loop so we can get rid of reg users group simply
                                 if ($gid == XOOPS_GROUP_USERS) {
                                     continue;
                                 }
                                 $pgroups[] = $gid;
                             }
                         } else {
                             // all groups should be used
                             unset($pgroups);
                             $allgroupsq = q("SELECT groupid FROM " . $xoopsDB->prefix("groups"));
                             //  . " WHERE groupid != " . XOOPS_GROUP_USERS); // use all groups now, if all groups are picked, with no restrictions on membership or anything, then use all groups
                             foreach ($allgroupsq as $thisgid) {
                                 $pgroups[] = $thisgid['groupid'];
                             }
                         }
                     }
                 }
                 // Note: OLD WAY: if no groups were found, then pguidq will be empty and so all entries will be shown, no restrictions
                 // NEW WAY: if a specific group(s) was specified, and no match with the current user was found, then we return an empty list
                 array_unique($pgroups);
                 // remove duplicate groups from the list
                 if ($ele_value[6] and count($pgroups) > 0) {
                     $pgroupsfilter = " (";
                     $start = true;
                     foreach ($pgroups as $thisPgroup) {
                         if (!$start) {
                             $pgroupsfilter .= " AND ";
                         }
                         $pgroupsfilter .= "EXISTS(SELECT 1 FROM " . $xoopsDB->prefix("formulize_entry_owner_groups") . " AS t2 WHERE t2.groupid={$thisPgroup} AND t2.fid={$sourceFid} AND t2.entry_id=t1.entry_id)";
                         $start = false;
                     }
                     $pgroupsfilter .= ")";
                 } elseif (count($pgroups) > 0) {
                     $pgroupsfilter = " t2.groupid IN (" . formulize_db_escape(implode(",", $pgroups)) . ") AND t2.entry_id=t1.entry_id AND t2.fid={$sourceFid}";
                 } else {
                     $pgroupsfilter = "";
                 }
                 $sourceFormObject = $form_handler->get($sourceFid);
                 list($conditionsfilter, $conditionsfilter_oom, $parentFormFrom) = buildConditionsFilterSQL($ele_value[5], $sourceFid, $entry, $owner, $formObject, "t1");
                 // if there is a restriction in effect, then add some SQL to reject options that have already been selected ??
                 $restrictSQL = "";
                 if ($ele_value[9]) {
                     $t4_ele_value = $this->_ele->getVar('ele_value');
                     if ($t4_ele_value[1]) {
                         // allows multiple selections
                         $restrictSQL = " AND (\n\t\t\t\t\t\tNOT EXISTS (\n\t\t\t\t\t\tSELECT 1 FROM " . $xoopsDB->prefix("formulize_" . $formObject->getVar('form_handle')) . " AS t4 WHERE t4.`" . $this->_ele->getVar('ele_handle') . "` LIKE CONCAT( '%,', t1.`entry_id` , ',%' ) AND t4.entry_id != " . intval($entry);
                     } else {
                         $restrictSQL = " AND (\n                                                    NOT EXISTS (\n                                                    SELECT 1 FROM " . $xoopsDB->prefix("formulize_" . $formObject->getVar('form_handle')) . " AS t4 WHERE t4.`" . $this->_ele->getVar('ele_handle') . "` = t1.`entry_id` AND t4.entry_id != " . intval($entry);
                         $restrictSQL .= $this->addEntryRestrictionSQL($ele_value[9], $id_form, $groups);
                         // pass in the flag about restriction scope, and the form id, and the groups
                         $restrictSQL .= " ) OR EXISTS (\n                                                    SELECT 1 FROM " . $xoopsDB->prefix("formulize_" . $formObject->getVar('form_handle')) . " AS t4 WHERE t4.`" . $this->_ele->getVar('ele_handle') . "` = t1.`entry_id` AND t4.entry_id = " . intval($entry);
                     }
                     $restrictSQL .= $this->addEntryRestrictionSQL($ele_value[9], $id_form, $groups);
                     // pass in the flag about restriction scope, and the form id, and the groups
                     $restrictSQL .= " ) OR EXISTS (\n\t\t\t\t\t\tSELECT 1 FROM " . $xoopsDB->prefix("formulize_" . $formObject->getVar('form_handle')) . " AS t4 WHERE t4.`" . $this->_ele->getVar('ele_handle') . "` LIKE CONCAT( '%,', t1.`entry_id` , ',%' ) AND t4.entry_id = " . intval($entry);
                     $restrictSQL .= $this->addEntryRestrictionSQL($ele_value[9], $id_form, $groups);
                     $restrictSQL .= ") )";
                 }
                 static $cachedSourceValuesQ = array();
                 static $cachedSourceValuesAutocompleteFile = array();
                 static $cachedSourceValuesAutocompleteLength = array();
                 // setup the sort order based on ele_value[12], which is an element id number
                 $sortOrder = $ele_value[15] == 2 ? " DESC" : "ASC";
                 if ($ele_value[12] == "none" or !$ele_value[12]) {
                     $sortOrderClause = " ORDER BY t1.`{$sourceHandle}` {$sortOrder}";
                 } else {
                     list($sortHandle) = convertElementIdsToElementHandles(array($ele_value[12]), $sourceFormObject->getVar('id_form'));
                     $sortOrderClause = " ORDER BY t1.`{$sortHandle}` {$sortOrder}";
                 }
                 // if no extra elements are selected for display as a form element, then display the linked element
                 if (0 == count($ele_value[EV_MULTIPLE_FORM_COLUMNS]) or $ele_value[EV_MULTIPLE_FORM_COLUMNS][0] == 'none') {
                     $linked_columns = array($boxproperties[1]);
                 } else {
                     $linked_columns = convertElementIdsToElementHandles($ele_value[EV_MULTIPLE_FORM_COLUMNS], $sourceFormObject->getVar('id_form'));
                     // remove empty entries, which can happen if the "use the linked field selected above" option is selected
                     $linked_columns = array_filter($linked_columns);
                 }
                 if (is_array($linked_columns)) {
                     $select_column = "t1.`" . implode("`, t1.`", $linked_columns) . "`";
                 } else {
                     $select_column = "t1.`{$linked_columns}`";
                     // in this case, it's just one linked column
                 }
                 // if there is a groups filter, then join to the group ownership table
                 $extra_clause = "";
                 if ($pgroupsfilter) {
                     $extra_clause = ", " . $xoopsDB->prefix("formulize_entry_owner_groups") . " AS t2 {$parentFormFrom} WHERE {$pgroupsfilter}";
                 } else {
                     $extra_clause = " {$parentFormFrom} WHERE t1.entry_id>0";
                 }
                 $sourceValuesQ = "SELECT t1.entry_id, " . $select_column . " FROM " . $xoopsDB->prefix("formulize_" . $sourceFormObject->getVar('form_handle')) . " AS t1" . $extra_clause . "{$conditionsfilter} {$conditionsfilter_oom} {$restrictSQL}" . "GROUP BY t1.entry_id {$sortOrderClause}";
                 if (!$isDisabled) {
                     // set the default selections, based on the entry_ids that have been selected as the defaults, if applicable
                     $hasNoValues = trim($boxproperties[2]) == "" ? true : false;
                     $useDefaultsWhenEntryHasNoValue = $ele_value[14];
                     if (($entry == "new" or $useDefaultsWhenEntryHasNoValue and $hasNoValues) and (is_array($ele_value[13]) and count($ele_value[13]) > 0 or $ele_value[13])) {
                         $defaultSelected = $ele_value[13];
                     } else {
                         $defaultSelected = "";
                     }
                     $form_ele = new XoopsFormSelect($ele_caption, $form_ele_id, $defaultSelected, $ele_value[0], $ele_value[1]);
                     $form_ele->setExtra("onchange=\"javascript:formulizechanged=1;\" jquerytag='{$form_ele_id}'");
                     if ($ele_value[0] == 1) {
                         // add the initial default entry, singular or plural based on whether the box is one line or not.
                         $form_ele->addOption("none", _AM_FORMLINK_PICK);
                     }
                 } else {
                     $disabledHiddenValue = array();
                     $disabledOutputText = array();
                 }
                 if (!isset($cachedSourceValuesQ[$sourceValuesQ])) {
                     $element_handler = xoops_getmodulehandler('elements', 'formulize');
                     $sourceElementObject = $element_handler->get($boxproperties[1]);
                     if ($sourceElementObject->isLinked) {
                         // need to jump one more level back to get value that this value is pointing at
                         $sourceEleValue = $sourceElementObject->getVar('ele_value');
                         $originalSource = explode("#*=:*", $sourceEleValue[2]);
                         include_once XOOPS_ROOT_PATH . "/modules/formulize/class/data.php";
                         $data_handler = new formulizeDataHandler($originalSource[0]);
                     }
                     $reslinkedvaluesq = $xoopsDB->query($sourceValuesQ);
                     if ($reslinkedvaluesq) {
                         $linked_column_count = count($linked_columns);
                         while ($rowlinkedvaluesq = $xoopsDB->fetchRow($reslinkedvaluesq)) {
                             $linked_column_values = array();
                             foreach (range(1, $linked_column_count) as $linked_column_index) {
                                 if ($rowlinkedvaluesq[$linked_column_index] === "") {
                                     $linked_column_values[] = "";
                                 } else {
                                     if ($sourceElementObject->isLinked) {
                                         $linked_value = prepvalues($rowlinkedvaluesq[$linked_column_index], $boxproperties[1], $rowlinkedvaluesq[0]);
                                         $linked_column_values[] = $linked_value[0];
                                     } else {
                                         $linked_column_values[] = strip_tags(trim($rowlinkedvaluesq[$linked_column_index]));
                                     }
                                 }
                             }
                             $linkedElementOptions[$rowlinkedvaluesq[0]] = implode(" - ", $linked_column_values);
                         }
                     }
                     $cachedSourceValuesQ[$sourceValuesQ] = $linkedElementOptions;
                     /* ALTERED - 20100318 - freeform - jeff/julian - start */
                     if (!$isDisabled and $ele_value[8] == 1) {
                         // write the possible values to a cached file so we can look them up easily when we need them, don't want to actually send them to the browser, since it could be huge, but don't want to replicate all the logic that has already gathered the values for us, each time there's an ajax request
                         $cachedLinkedOptionsFileName = "formulize_linkedOptions_" . str_replace(".", "", microtime(true));
                         formulize_scandirAndClean(XOOPS_ROOT_PATH . "/cache/", "formulize_linkedOptions_");
                         $maxLength = 10;
                         $the_values = array();
                         asort($linkedElementOptions);
                         foreach ($linkedElementOptions as $id => $text) {
                             $the_values[$id] = trans($text);
                             $thisTextLength = strlen($text);
                             $maxLength = $thisTextLength > $maxLength ? $thisTextLength : $maxLength;
                         }
                         file_put_contents(XOOPS_ROOT_PATH . "/cache/{$cachedLinkedOptionsFileName}", "<?php\n\${$cachedLinkedOptionsFileName} = " . var_export($the_values, true) . ";\n");
                         $cachedSourceValuesAutocompleteFile[$sourceValuesQ] = $cachedLinkedOptionsFileName;
                         $cachedSourceValuesAutocompleteLength[$sourceValuesQ] = $maxLength;
                     }
                 }
                 if ($boxproperties[2]) {
                     $default_value = $boxproperties[2];
                     $default_value_user = $cachedSourceValuesQ[$sourceValuesQ][$boxproperties[2]];
                 }
                 // if we're rendering an autocomplete box
                 if (!$isDisabled and $ele_value[8] == 1) {
                     $renderedComboBox = $this->formulize_renderQuickSelect($form_ele_id, $cachedSourceValuesAutocompleteFile[$sourceValuesQ], $default_value, $default_value_user, $cachedSourceValuesAutocompleteLength[$sourceValuesQ]);
                     $form_ele = new xoopsFormLabel($ele_caption, $renderedComboBox);
                     $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
                 } elseif ($isDisabled) {
                     $disabledOutputText[] = $default_value_user;
                 }
                 // only do this if we're rendering a normal element, that is not disabled
                 if (!$isDisabled and $ele_value[8] == 0) {
                     $form_ele->addOptionArray($cachedSourceValuesQ[$sourceValuesQ]);
                 }
                 // only do this if we're rendering a normal element (may be disabled)
                 if ($ele_value[8] == 0) {
                     foreach ($sourceEntryIds as $thisEntryId) {
                         if (!$isDisabled) {
                             $form_ele->setValue($thisEntryId);
                         } else {
                             $disabledName = $ele_value[1] ? $form_ele_id . "[]" : $form_ele_id;
                             $disabledHiddenValue[] = "<input type=hidden name=\"{$disabledName}\" value=\"{$thisEntryId}\">";
                             $disabledOutputText[] = $cachedSourceValuesQ[$sourceValuesQ][$thisEntryId];
                             // the text value of the option(s) that are currently selected
                         }
                     }
                 }
                 if ($isDisabled) {
                     $form_ele = new XoopsFormLabel($ele_caption, implode(", ", $disabledOutputText) . implode("\n", $disabledHiddenValue));
                     $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
                 } elseif ($ele_value[8] == 0) {
                     // this is a hack because the size attribute is private and only has a getSize and not a setSize, setting the size can only be done through the constructor
                     $count = count($form_ele->getOptions());
                     $size = $ele_value[0];
                     $new_size = $count < $size ? $count : $size;
                     $form_ele->_size = $new_size;
                 }
                 /* ALTERED - 20100318 - freeform - jeff/julian - stop */
             } else {
                 $selected = array();
                 $options = array();
                 $disabledOutputText = array();
                 $disabledHiddenValue = array();
                 $disabledHiddenValues = "";
                 // add the initial default entry, singular or plural based on whether the box is one line or not.
                 if ($ele_value[0] == 1) {
                     $options["none"] = _AM_FORMLINK_PICK;
                 }
                 // set opt_count to 1 if the box is NOT a multiple selection box. -- jwe 7/26/04
                 if ($ele_value[1]) {
                     $opt_count = 0;
                 } else {
                     $opt_count = 1;
                 }
                 $hiddenOutOfRangeValuesToWrite = array();
                 while (is_array($ele_value[2]) and $i = each($ele_value[2])) {
                     // handle requests for full names or usernames -- will only kick in if there is no saved value (otherwise ele_value will have been rewritten by the loadValues function in the form display
                     // note: if the user is about to make a proxy entry, then the list of users displayed will be from their own groups, but not from the groups of the user they are about to make a proxy entry for.  ie: until the proxy user is known, the choice of users for this list can only be based on the current user.  This could lead to confusing or buggy situations, such as users being selected who are outside the groups of the proxy user (who will become the owner) and so there will be an invalid value stored for this element in the db.
                     if ($i['key'] === "{FULLNAMES}" or $i['key'] === "{USERNAMES}") {
                         // ADDED June 18 2005 to handle pulling in usernames for the user's group(s)
                         if ($i['key'] === "{FULLNAMES}") {
                             $nametype = "name";
                         }
                         if ($i['key'] === "{USERNAMES}") {
                             $nametype = "uname";
                         }
                         if (isset($ele_value[2]['{OWNERGROUPS}'])) {
                             $groups = $ele_value[2]['{OWNERGROUPS}'];
                         } else {
                             global $regcode;
                             if ($regcode) {
                                 // if we're dealing with a registration code, determine group membership based on the code
                                 $reggroupsq = q("SELECT reg_codes_groups FROM " . XOOPS_DB_PREFIX . "_reg_codes WHERE reg_codes_code=\"{$regcode}\"");
                                 $groups = explode("&8(%\$", $reggroupsq[0]['reg_codes_groups']);
                                 if ($groups[0] === "") {
                                     unset($groups);
                                 }
                                 // if a code has no groups associated with it, then kill the null value that will be in position 0 in the groups array.
                                 $groups[] = XOOPS_GROUP_USERS;
                                 $groups[] = XOOPS_GROUP_ANONYMOUS;
                             } else {
                                 global $xoopsUser;
                                 $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
                             }
                         }
                         $pgroups = array();
                         $declaredUsersGroups = $groups;
                         if ($ele_value[3]) {
                             $scopegroups = explode(",", $ele_value[3]);
                             if (!in_array("all", $scopegroups)) {
                                 $groups = $scopegroups;
                             } else {
                                 // use all
                                 if (!$ele_value[4]) {
                                     // really use all (otherwise, we're just going with all user's groups, so existing value of $groups will be okay
                                     unset($groups);
                                     global $xoopsDB;
                                     $allgroupsq = q("SELECT groupid FROM " . $xoopsDB->prefix("groups"));
                                     //  . " WHERE groupid != " . XOOPS_GROUP_USERS); // removed exclusion of registered users group March 18 2009, since it doesn't make sense in this situation.  All groups should mean everyone, period.
                                     foreach ($allgroupsq as $thisgid) {
                                         $groups[] = $thisgid['groupid'];
                                     }
                                 }
                             }
                         }
                         $namelist = gatherNames($groups, $nametype, $ele_value[6], $ele_value[5], $ele_value[4], $declaredUsersGroups);
                         foreach ($namelist as $auid => $aname) {
                             $options[$auid] = $aname;
                         }
                     } elseif ($i['key'] === "{SELECTEDNAMES}") {
                         // loadValue in formDisplay will create a second option with this key that contains an array of the selected values
                         $selected = $i['value'];
                     } elseif ($i['key'] === "{OWNERGROUPS}") {
                         // do nothing with this piece of metadata that gets set in loadValue, since it's used above
                     } else {
                         // regular selection list....
                         $options[$opt_count] = $myts->stripSlashesGPC($i['key']);
                         if (strstr($i['key'], _formulize_OUTOFRANGE_DATA)) {
                             $hiddenOutOfRangeValuesToWrite[$opt_count] = str_replace(_formulize_OUTOFRANGE_DATA, "", $i['key']);
                             // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                         }
                         if ($i['value'] > 0) {
                             $selected[] = $opt_count;
                         }
                         $opt_count++;
                     }
                 }
                 $count = count($options);
                 $size = $ele_value[0];
                 $final_size = $count < $size ? $count : $size;
                 $form_ele1 = new XoopsFormSelect($ele_caption, $form_ele_id, $selected, $final_size, $ele_value[1]);
                 $form_ele1->setExtra("onchange=\"javascript:formulizechanged=1;\" jquerytag='{$form_ele_id}'");
                 // must check the options for uitext before adding to the element -- aug 25, 2007
                 foreach ($options as $okey => $ovalue) {
                     $options[$okey] = formulize_swapUIText($ovalue, $this->_ele->getVar('ele_uitext'));
                 }
                 $form_ele1->addOptionArray($options);
                 if ($selected) {
                     if (is_array($selected)) {
                         $hiddenElementName = $ele_value[1] ? $form_ele1->getName() . "[]" : $form_ele1->getName();
                         foreach ($selected as $thisSelected) {
                             $disabledOutputText[] = $options[$thisSelected];
                             $disabledHiddenValue[] = "<input type=hidden name=\"{$hiddenElementName}\" value=\"{$thisSelected}\">";
                         }
                     } elseif ($ele_value[1]) {
                         // need to keep [] in the hidden element name if multiple values are expected, even if only one is chosen
                         $disabledOutputText[] = $options[$selected];
                         $disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "[]\" value=\"{$selected}\">";
                     } else {
                         $disabledOutputText[] = $options[$selected];
                         $disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "\" value=\"{$selected}\">";
                     }
                 }
                 $renderedHoorvs = "";
                 if (count($hiddenOutOfRangeValuesToWrite) > 0) {
                     foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
                         $thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
                         $renderedHoorvs .= $thisHoorv->render() . "\n";
                         unset($thisHoorv);
                     }
                 }
                 if ($isDisabled) {
                     $disabledHiddenValues = implode("\n", $disabledHiddenValue);
                     // glue the individual value elements together into a set of values
                     $renderedElement = implode(", ", $disabledOutputText);
                 } elseif ($ele_value[8] == 1) {
                     // autocomplete construction: make sure that $renderedElement is the final output of this chunk of code
                     // write the possible values to a cached file so we can look them up easily when we need them,
                     //don't want to actually send them to the browser, since it could be huge,
                     //but don't want to replicate all the logic that has already gathered the values for us, each time there's an ajax request
                     $cachedLinkedOptionsFileName = "formulize_Options_" . str_replace(".", "", microtime(true));
                     formulize_scandirAndClean(XOOPS_ROOT_PATH . "/cache/", "formulize_Options_");
                     $maxLength = 10;
                     $the_values = array();
                     foreach ($options as $id => $text) {
                         $the_values[$id] = trans($text);
                         $thisTextLength = strlen($the_values[$id]);
                         $maxLength = $thisTextLength > $maxLength ? $thisTextLength : $maxLength;
                     }
                     file_put_contents(XOOPS_ROOT_PATH . "/cache/{$cachedLinkedOptionsFileName}", "<?php\n\${$cachedLinkedOptionsFileName} = " . var_export($the_values, true) . ";\n");
                     $defaultSelected = is_array($selected) ? $selected[0] : $selected;
                     $renderedComboBox = $this->formulize_renderQuickSelect($form_ele_id, $cachedLinkedOptionsFileName, $defaultSelected, $options[$defaultSelected], $maxLength);
                     $form_ele2 = new xoopsFormLabel($ele_caption, $renderedComboBox);
                     $renderedElement = $form_ele2->render();
                 } else {
                     // normal element
                     $renderedElement = $form_ele1->render();
                 }
                 $form_ele = new XoopsFormLabel($ele_caption, "<nobr>{$renderedElement}</nobr>\n{$renderedHoorvs}\n{$disabledHiddenValues}\n");
                 $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
             }
             // end of if we have a link on our hands. -- jwe 7/29/04
             // set required validation code
             if ($this->_ele->getVar('ele_req') and !$isDisabled) {
                 $eltname = $form_ele_id;
                 $eltcaption = $ele_caption;
                 $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
                 $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                 if ($ele_value[8] == 1) {
                     // Has been edited in order to not allow the user to submit a form when "No match found" or "Choose an Option" is selected from the quickselect box.
                     $form_ele->customValidationCode[] = "\nif ( myform.{$eltname}.value == '' || myform.{$eltname}.value == 'none'  ) {\n window.alert(\"{$eltmsg}\");\n myform.{$eltname}_user.focus();\n return false;\n }\n";
                 } elseif ($ele_value[0] == 1) {
                     $form_ele->customValidationCode[] = "\nif ( myform.{$eltname}.options[0].selected ) {\n window.alert(\"{$eltmsg}\");\n myform.{$eltname}.focus();\n return false;\n }\n";
                 } elseif ($ele_value[0] > 1) {
                     $form_ele->customValidationCode[] = "selection = false;\n";
                     $form_ele->customValidationCode[] = "\nfor(i=0;i<myform.{$eltname}.options.length;i++) {\n";
                     $form_ele->customValidationCode[] = "if(myform.{$eltname}.options[i].selected) {\n";
                     $form_ele->customValidationCode[] = "selection = true;\n";
                     $form_ele->customValidationCode[] = "}\n";
                     $form_ele->customValidationCode[] = "}\n";
                     $form_ele->customValidationCode[] = "if(selection == false) { window.alert(\"{$eltmsg}\");\n myform.{$eltname}.focus();\n return false;\n }\n";
                 }
             }
             if ($isDisabled) {
                 $isDisabled = false;
                 // disabled stuff handled here in element, so don't invoke generic disabled handling below (which is only for textboxes and their variations)
             }
             break;
         case 'checkbox':
             $selected = array();
             $options = array();
             $disabledHiddenValue = array();
             $disabledHiddenValues = "";
             $disabledOutputText = array();
             $opt_count = 1;
             while ($i = each($ele_value)) {
                 $options[$opt_count] = $myts->stripSlashesGPC($i['key']);
                 if ($i['value'] > 0) {
                     $selected[] = $opt_count;
                     $disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele_id . "[]\" value=\"{$opt_count}\">";
                 }
                 $opt_count++;
             }
             if ($this->_ele->getVar('ele_delim') != "") {
                 $delimSetting = $this->_ele->getVar('ele_delim');
             }
             $delimSetting =& $myts->undoHtmlSpecialChars($delimSetting);
             if ($delimSetting == "br") {
                 $delimSetting = "<br />";
             }
             $hiddenOutOfRangeValuesToWrite = array();
             switch ($delimSetting) {
                 case 'space':
                     $form_ele1 = new XoopsFormCheckBox($ele_caption, $form_ele_id, $selected);
                     $counter = 0;
                     // counter used for javascript that works with 'Other' box
                     while ($o = each($options)) {
                         $o = formulize_swapUIText($o, $this->_ele->getVar('ele_uitext'));
                         $other = $this->optOther($o['value'], $form_ele_id, $entry, $counter, true);
                         if ($other != false) {
                             $form_ele1->addOption($o['key'], _formulize_OPT_OTHER . $other);
                             if (in_array($o['key'], $selected)) {
                                 $disabledOutputText[] = _formulize_OPT_OTHER . $other;
                             }
                         } else {
                             $form_ele1->addOption($o['key'], $o['value']);
                             if (in_array($o['key'], $selected)) {
                                 $disabledOutputText[] = $o['value'];
                             }
                             if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
                                 $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
                                 // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                             }
                         }
                         $counter++;
                     }
                     $form_ele1->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
                     break;
                 default:
                     $form_ele1 = new XoopsFormElementTray($ele_caption, $delimSetting);
                     $counter = 0;
                     // counter used for javascript that works with 'Other' box
                     while ($o = each($options)) {
                         $o = formulize_swapUIText($o, $this->_ele->getVar('ele_uitext'));
                         $other = $this->optOther($o['value'], $form_ele_id, $entry, $counter, true);
                         $t = new XoopsFormCheckBox('', $form_ele_id . '[]', $selected, $delimSetting);
                         if ($other != false) {
                             $t->addOption($o['key'], _formulize_OPT_OTHER . $other);
                             if (in_array($o['key'], $selected)) {
                                 $disabledOutputText[] = _formulize_OPT_OTHER . $other;
                             }
                         } else {
                             $t->addOption($o['key'], $o['value']);
                             if (in_array($o['key'], $selected)) {
                                 $disabledOutputText[] = $o['value'];
                             }
                             if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
                                 $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
                                 // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                             }
                         }
                         $t->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
                         $form_ele1->addElement($t);
                         unset($t);
                         $counter++;
                     }
                     break;
             }
             $renderedHoorvs = "";
             if (count($hiddenOutOfRangeValuesToWrite) > 0) {
                 foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
                     $thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
                     $renderedHoorvs .= $thisHoorv->render() . "\n";
                     unset($thisHoorv);
                 }
             }
             if ($isDisabled) {
                 $disabledHiddenValues = implode("\n", $disabledHiddenValue);
                 // glue the individual value elements together into a set of values
                 $renderedElement = implode(", ", $disabledOutputText);
             } else {
                 $renderedElement = $form_ele1->render();
             }
             $form_ele = new XoopsFormLabel($ele_caption, "{$renderedElement}\n{$renderedHoorvs}\n{$disabledHiddenValues}\n");
             $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
             if ($this->_ele->getVar('ele_req') and !$isDisabled) {
                 $eltname = $form_ele_id;
                 $eltcaption = $ele_caption;
                 $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
                 $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                 $form_ele->customValidationCode[] = "selection = true;\n";
                 $form_ele->customValidationCode[] = "checkboxes = \$('[jquerytag={$eltname}]:checked');\n";
                 // need to use this made up attribute here, because there is no good way to select the checkboxes using the name or anything else that XOOPS/Impress is giving us!!
                 $form_ele->customValidationCode[] = "if(checkboxes.length == 0) { window.alert(\"{$eltmsg}\");\n \$('[jquerytag={$eltname}]').focus();\n return false;\n }\n";
             }
             if ($isDisabled) {
                 $isDisabled = false;
                 // disabled stuff handled here in element, so don't invoke generic disabled handling below (which is only for textboxes and their variations)
             }
             break;
         case 'radio':
         case 'yn':
             $selected = '';
             $disabledHiddenValue = "";
             $options = array();
             $opt_count = 1;
             while ($i = each($ele_value)) {
                 switch ($ele_type) {
                     case 'radio':
                         $options[$opt_count] = $myts->stripSlashesGPC($i['key']);
                         $options[$opt_count] = $myts->displayTarea($options[$opt_count]);
                         break;
                     case 'yn':
                         $options[$opt_count] = constant($i['key']);
                         $options[$opt_count] = $myts->stripSlashesGPC($options[$opt_count]);
                         break;
                 }
                 if ($i['value'] > 0) {
                     $selected = $opt_count;
                 }
                 $opt_count++;
             }
             if ($this->_ele->getVar('ele_delim') != "") {
                 $delimSetting = $this->_ele->getVar('ele_delim');
             }
             $delimSetting =& $myts->undoHtmlSpecialChars($delimSetting);
             if ($delimSetting == "br") {
                 $delimSetting = "<br />";
             }
             $hiddenOutOfRangeValuesToWrite = array();
             switch ($delimSetting) {
                 case 'space':
                     $form_ele1 = new XoopsFormRadio('', $form_ele_id, $selected);
                     $counter = 0;
                     while ($o = each($options)) {
                         $o = formulize_swapUIText($o, $this->_ele->getVar('ele_uitext'));
                         $other = $this->optOther($o['value'], $form_ele_id, $entry, $counter);
                         if ($other != false) {
                             $form_ele1->addOption($o['key'], _formulize_OPT_OTHER . $other);
                             if ($o['key'] == $selected) {
                                 $disabledOutputText = _formulize_OPT_OTHER . $other;
                             }
                         } else {
                             $o['value'] = get_magic_quotes_gpc() ? stripslashes($o['value']) : $o['value'];
                             $form_ele1->addOption($o['key'], $o['value']);
                             if ($o['key'] == $selected) {
                                 $disabledOutputText = $o['value'];
                             }
                             if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
                                 $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
                                 // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                             }
                         }
                         $counter++;
                     }
                     $form_ele1->setExtra("onchange=\"javascript:formulizechanged=1;\"");
                     break;
                 default:
                     $form_ele1 = new XoopsFormElementTray('', $delimSetting);
                     $counter = 0;
                     while ($o = each($options)) {
                         $o = formulize_swapUIText($o, $this->_ele->getVar('ele_uitext'));
                         $t = new XoopsFormRadio('', $form_ele_id, $selected);
                         $other = $this->optOther($o['value'], $form_ele_id, $entry, $counter);
                         if ($other != false) {
                             $t->addOption($o['key'], _formulize_OPT_OTHER . "</label><label>{$other}");
                             // epic hack to terminate radio button's label so it doesn't include the clickable 'other' box!!
                             if ($o['key'] == $selected) {
                                 $disabledOutputText = _formulize_OPT_OTHER . $other;
                             }
                         } else {
                             $o['value'] = get_magic_quotes_gpc() ? stripslashes($o['value']) : $o['value'];
                             $t->addOption($o['key'], $o['value']);
                             if ($o['key'] == $selected) {
                                 $disabledOutputText = $o['value'];
                             }
                             if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
                                 $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
                                 // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                             }
                         }
                         $t->setExtra("onchange=\"javascript:formulizechanged=1;\"");
                         $form_ele1->addElement($t);
                         unset($t);
                         $counter++;
                     }
                     break;
             }
             $renderedHoorvs = "";
             if (count($hiddenOutOfRangeValuesToWrite) > 0) {
                 foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
                     $thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
                     $renderedHoorvs .= $thisHoorv->render() . "\n";
                     unset($thisHoorv);
                 }
             }
             if ($isDisabled) {
                 $disabledHiddenValue = "<input type=hidden name=\"" . $form_ele_id . "\" value=\"{$selected}\">\n";
                 $renderedElement = $disabledOutputText;
                 // just text for disabled elements
             } else {
                 $renderedElement = $form_ele1->render();
             }
             $form_ele = new XoopsFormLabel($ele_caption, "{$renderedElement}\n{$renderedHoorvs}\n{$disabledHiddenValue}\n");
             $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
             if ($this->_ele->getVar('ele_req') and !$isDisabled) {
                 $eltname = $form_ele_id;
                 $eltcaption = $ele_caption;
                 $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
                 $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                 $form_ele->customValidationCode[] = "selection = false;\n";
                 $form_ele->customValidationCode[] = "if(myform.{$eltname}.length) {\n";
                 $form_ele->customValidationCode[] = "for(var i=0;i<myform.{$eltname}.length;i++){\n";
                 $form_ele->customValidationCode[] = "if(myform.{$eltname}[i].checked){\n";
                 $form_ele->customValidationCode[] = "selection = true;\n";
                 $form_ele->customValidationCode[] = "}\n";
                 $form_ele->customValidationCode[] = "}\n";
                 $form_ele->customValidationCode[] = "}\n";
                 $form_ele->customValidationCode[] = "if(selection == false) { window.alert(\"{$eltmsg}\");\n myform.{$eltname}.focus();\n return false;\n }\n";
             }
             if ($isDisabled) {
                 $isDisabled = false;
                 // disabled stuff handled here in element, so don't invoke generic disabled handling below (which is only for textboxes and their variations)
             }
             break;
         case 'date':
             // if there's no value (ie: it's blank) ... OR it's the default value because someone submitted a date field without actually specifying a date, that last part added by jwe 10/23/04
             if ($ele_value[0] == "" or $ele_value[0] == "YYYY-mm-dd") {
                 $form_ele = new XoopsFormTextDateSelect($ele_caption, $form_ele_id, 15, "");
                 $form_ele->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
             } else {
                 $form_ele = new XoopsFormTextDateSelect($ele_caption, $form_ele_id, 15, getDateElementDefault($ele_value[0]));
                 $form_ele->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
             }
             // end of check to see if the default setting is for real
             // added validation code - sept 5 2007 - jwe
             if ($this->_ele->getVar('ele_req') and !$isDisabled) {
                 $eltname = $form_ele_id;
                 $eltcaption = $ele_caption;
                 $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
                 $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                 // parseInt() is used to determine if the element value contains a number
                 // Date.parse() would be better, except that it will fail for dd-mm-YYYY format, ie: 22-11-2013
                 $form_ele->customValidationCode[] = "\nif (isNaN(parseInt(myform.{$eltname}.value))) {\n window.alert(\"{$eltmsg}\");\n myform.{$eltname}.focus();\n return false;\n }\n";
             }
             if (!$isDisabled) {
                 $limit_past = (isset($ele_value["date_limit_past"]) and $ele_value["date_limit_past"] != "");
                 $limit_future = (isset($ele_value["date_limit_future"]) and $ele_value["date_limit_future"] != "");
                 if ($limit_past or $limit_future) {
                     $reference_date = time();
                     if ("new" != $entry) {
                         $entryData = $this->formulize_getCachedEntryData($id_form, $entry);
                         $reference_date = strtotime(display($entryData, "creation_date"));
                     }
                     if ($limit_past) {
                         $form_ele->setExtra(" min-date='" . date("Y-m-d", strtotime("-" . max(0, intval($ele_value["date_past_days"])) . " days", $reference_date)) . "' ");
                     }
                     if ($limit_future) {
                         $form_ele->setExtra(" max-date='" . date("Y-m-d", strtotime("+" . max(0, intval($ele_value["date_future_days"])) . " days", $reference_date)) . "' ");
                     }
                     $form_ele->setExtra(" onchange=\"javascript:formulizechanged=1;check_date_limits('{$form_ele_id}');\" onclick=\"javascript:check_date_limits('{$form_ele_id}');\" onblur=\"javascript:check_date_limits('{$form_ele_id}');\" jquerytag=\"{$form_ele_id}\" ");
                 } else {
                     $form_ele->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
                 }
             }
             break;
         case 'sep':
             //$ele_value[0] = $myts->displayTarea($ele_value[0]);
             $ele_value[0] = $myts->xoopsCodeDecode($ele_value[0]);
             $form_ele = new XoopsFormLabel($ele_caption, $ele_value[0]);
             break;
         case 'upload':
             $form_ele = new XoopsFormFile($ele_caption, $form_ele_id, $ele_value[1]);
             break;
             /*
              * Hack by F�lix<INBOX International>
              * Adding colorpicker form element
              */
         /*
          * Hack by F�lix<INBOX International>
          * Adding colorpicker form element
          */
         case 'colorpick':
             if ($ele_value[0] == "") {
                 //print "Bad date";
                 $form_ele = new XoopsFormColorPicker($ele_caption, $form_ele_id, "");
             } else {
                 //print "good date";
                 $form_ele = new XoopsFormColorPicker($ele_caption, $form_ele_id, $ele_value[0]);
             }
             // end of check to see if the default setting is for real
             break;
             /*
              * End of Hack by F�lix<INBOX International>
              * Adding colorpicker form element
              */
         /*
          * End of Hack by F�lix<INBOX International>
          * Adding colorpicker form element
          */
         default:
             if (file_exists(XOOPS_ROOT_PATH . "/modules/formulize/class/" . $ele_type . "Element.php")) {
                 $elementTypeHandler = xoops_getmodulehandler($ele_type . "Element", "formulize");
                 $form_ele = $elementTypeHandler->render($ele_value, $ele_caption, $form_ele_id, $isDisabled, $this->_ele, $entry, $screen);
                 // $ele_value as passed in here, $caption, name that we use for the element in the markup, flag for whether it's disabled or not, element object, entry id number that this element belongs to, $screen is the screen object that was passed in, if any
                 // if form_ele is an array, then we want to treat it the same as an "insertbreak" element, ie: it's not a real form element object
                 if (is_object($form_ele)) {
                     if (!$isDisabled and ($this->_ele->getVar('ele_req') or $this->_ele->alwaysValidateInputs) and $this->_ele->hasData) {
                         // if it's not disabled, and either a declared required element according to the webmaster, or the element type itself always forces validation...
                         $form_ele->customValidationCode = $elementTypeHandler->generateValidationCode($ele_caption, $form_ele_id, $this->_ele, $entry);
                     }
                     $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
                     $isDisabled = false;
                     // the render method must handle providing a disabled output, so as far as the rest of the logic here goes, the element is not disabled but should be rendered as is
                     $baseCustomElementObject = $elementTypeHandler->create();
                     if ($baseCustomElementObject->hasData) {
                         $customElementHasData = true;
                     }
                 }
             } else {
                 return false;
             }
             break;
     }
     // end element-type case
     if (is_object($form_ele) and !$isDisabled and $this->_ele->hasData) {
         if ($previousEntryUI) {
             $previousEntryUIRendered = "&nbsp;&nbsp;" . $previousEntryUI->render();
         } else {
             $previousEntryUIRendered = "";
         }
         // $ele_type is the type value...only put in a cue for certain kinds of elements, and definitely not for blank subforms
         if (substr($form_ele_id, 0, 9) != "desubform" and ($ele_type == "text" or $ele_type == "textarea" or $ele_type == "select" or $ele_type == "radio" or $ele_type == "checkbox" or $ele_type == "date" or $ele_type == "colorpick" or $ele_type == "yn" or $customElementHasData)) {
             $elementCue = "\n<input type=\"hidden\" id=\"decue_" . trim($form_ele_id, "de_") . "\" name=\"decue_" . trim($form_ele_id, "de_") . "\" value=1>\n";
         } else {
             $elementCue = "";
         }
         $form_ele->setExtra(" onchange=\"javascript:formulizechanged=1;\"");
         // reuse caption, put two spaces between element and previous entry UI
         $form_ele_new = new xoopsFormLabel($form_ele->getCaption(), $form_ele->render() . $previousEntryUIRendered . $elementCue);
         $form_ele_new->formulize_element = $this->_ele;
         if ($ele_desc != "") {
             $ele_desc = html_entity_decode($ele_desc, ENT_QUOTES);
             $ele_desc = $myts->makeClickable($ele_desc);
             $form_ele_new->setDescription($ele_desc);
         }
         $form_ele_new->setName($form_ele_id);
         // need to set this as the name, in case it is required and then the name will be picked up by any "required" checks that get done and used in the required validation javascript for textboxes
         if (!empty($form_ele->customValidationCode)) {
             $form_ele_new->customValidationCode = $form_ele->customValidationCode;
         }
         if ($form_ele->isRequired()) {
             $form_ele_new->setRequired();
         }
         return $form_ele_new;
     } elseif (is_object($form_ele) and $isDisabled and $this->_ele->hasData) {
         // element is disabled
         $form_ele = $this->formulize_disableElement($form_ele, $ele_type, $ele_desc);
         return $form_ele;
     } else {
         // form ele is not an object...and/or has no data.  Happens for IBs and for non-interactive elements, like grids.
         return $form_ele;
     }
 }
コード例 #5
0
ファイル: searchform.php プロジェクト: nunoluciano/uxcl
	$criteria = new CriteriaCompo();
	$criteria->add(new Criteria('hassearch', 1));
	$criteria->add(new Criteria('isactive', 1));
	if (!empty($available_modules)) {
		$criteria->add(new Criteria('mid', "(".implode(',', $available_modules).")", 'IN'));
	}
	$db =& Database::getInstance();
	$result = $db->query("SELECT mid FROM ".$db->prefix("search")." WHERE notshow!=0");
    	while (list($badmid) = $db->fetchRow($result)) {
		$criteria->add(new Criteria('mid', $badmid, '!='));
	}
	$module_handler =& xoops_gethandler('module');
	$mod_arr = $module_handler->getList($criteria);
	$mods_checkbox->addOptionArray($mod_arr);
	if( count($mod_arr) == 0){
		$mods_checkbox = new XoopsFormLabel(_MD_SEARCHIN,_MD_UNABLE_TO_SEARCH);
	}
}
else {
    foreach ($modules as $mid => $module) {
        if (!is_object($module)) continue;
        $module_array[$mid] = $module->getVar('name');
    }
    $mods_checkbox->addOptionArray($module_array);
}
$search_form->addElement($mods_checkbox);
if( $xoopsModuleConfig['search_display_text'] == 1 ){
	$search_form->addElement(new XoopsFormRadioYN(_MD_SHOW_CONTEXT, "showcontext", $showcontext));
}
$lessthan = ($xoopsConfigSearch['keyword_min'] > 1) ? sprintf(_MD_KEYIGNORE, $xoopsConfigSearch['keyword_min'], ceil($xoopsConfigSearch['keyword_min']/2)).'<br />' : "" ;
$search_form->addElement(new XoopsFormLabel(_MD_SEARCHRULE, $lessthan._MD_KEY_SPACE));
コード例 #6
0
ファイル: myblockform.php プロジェクト: koki-h/xoops_utf8
$form->addElement($mod_select);
$form->addElement(new XoopsFormText(_AM_TITLE, 'btitle', 50, 255, $block['title']), false);
if ($block['is_custom']) {
    // Custom Block's textarea
    $notice_for_tags = '<span style="font-size:x-small;font-weight:bold;">' . _AM_USEFULTAGS . '</span><br /><span style="font-size:x-small;font-weight:normal;">' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . '</span>';
    $current_op = @$_GET['op'] == 'clone' ? 'clone' : 'edit';
    $uri_to_myself = XOOPS_URL . "/modules/blocksadmin/admin/admin.php?fct=blocksadmin&amp;op={$current_op}&amp;bid={$block['bid']}";
    // $can_use_spaw = check_browser_can_use_spaw() ;
    $can_use_spaw = true;
    if ($usespaw && $can_use_spaw) {
        // SPAW Config
        include XOOPS_ROOT_PATH . '/common/spaw/spaw_control.class.php';
        ob_start();
        $sw = new SPAW_Wysiwyg('bcontent', $block['content']);
        $sw->show();
        $textarea = new XoopsFormLabel(_AM_CONTENT, ob_get_contents());
        $textarea->setDescription($notice_for_tags . "<br /><br /><a href='{$uri_to_myself}&amp;usespaw=0'>NORMAL</a>");
        ob_end_clean();
    } else {
        $myts =& MyTextSanitizer::getInstance();
        $textarea = new XoopsFormDhtmlTextArea(_AM_CONTENT, 'bcontent', $myts->htmlSpecialChars($block['content']), 15, 70);
        if ($can_use_spaw) {
            $textarea->setDescription($notice_for_tags . "<br /><br /><a href='{$uri_to_myself}&amp;usespaw=1'>SPAW</a>");
        } else {
            $textarea->setDescription($notice_for_tags);
        }
    }
    $form->addElement($textarea, true);
    $ctype_select = new XoopsFormSelect(_AM_CTYPE, 'bctype', $block['ctype']);
    $ctype_select->addOptionArray(array('H' => _AM_HTML, 'P' => _AM_PHP, 'S' => _AM_AFWSMILE, 'T' => _AM_AFNOSMILE));
    $form->addElement($ctype_select);
コード例 #7
0
/**
** get_option_widget()
** parameters:
** option_result - result set containing option_id, option_name, option_type,
**                 option_value, option_description, option_admin_level
** editable      - flag to determine whether the returned widget will be editable
**/
function &get_option_formElement($option_result, $editable = true, $between = "")
{
    global $wpdb, $wp_id;
    $disabled = $editable ? '' : 'disabled';
    switch ($option_result->option_type) {
        case 1:
            // integer
        // integer
        case 3:
            // string
        // string
        case 8:
            // float
        // float
        case 6:
            // range -- treat same as integer for now!
            if ($option_result->option_type == 1 || $option_result->option_type == 6) {
                $width = 10;
            } elseif ($option_result->option_width < 20) {
                $width = $option_result->option_width;
            } else {
                $width = 50;
            }
            $elem = new XoopsFormText($option_result->option_name, $option_result->option_name, $width, 150, $option_result->option_value);
            break;
        case 2:
            // boolean
            $elem = new XoopsFormSelect($option_result->option_name, "{$option_result->option_name}", $option_result->option_value);
            $elem->addOption("1", "true");
            $elem->addOption("0", "false");
            break;
        case 5:
            // select
            $elem = new XoopsFormSelect($option_result->option_name, "{$option_result->option_name}", $option_result->option_value);
            $select = $wpdb->get_results("SELECT optionvalue, optionvalue_desc " . "FROM {$wpdb->optionvalues[$wp_id]} " . "WHERE option_id = {$option_result->option_id} " . "ORDER BY optionvalue_seq");
            if ($select) {
                foreach ($select as $option) {
                    $elem->addOption($option->optionvalue, $option->optionvalue_desc);
                }
            }
            break;
        case 7:
            // SQL select
            $sql = $wpdb->get_var("SELECT optionvalue FROM {$wpdb->optionvalues[$wp_id]} WHERE option_id = {$option_result->option_id}");
            if (!$sql) {
                $elem = new XoopsFormLabel($option_result->option_nam, $editable);
                break;
            }
            // now we may need to do table name substitution
            eval("include('../wp-config.php');\$sql = \"{$sql}\";");
            $elem = new XoopsFormSelect($option_result->option_name, "{$option_result->option_name}", $option_result->option_value);
            $select = $wpdb->get_results("{$sql}");
            if ($select) {
                foreach ($select as $option) {
                    $elem->addOption($option->value, $option->label);
                }
            }
            break;
        default:
            $elem = new XoopsFormLabel($option_result->option_nam, $editable);
    }
    if ($option_result->option_description) {
        $elem->setDescription(replace_constant($option_result->option_description));
    }
    $elem->setExtra($disabled);
    return $elem;
}
コード例 #8
0
ファイル: news.php プロジェクト: trabisdementia/xuups
            // Categories to be imported
            $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM " . $xoopsDB->prefix("topics") . " AS cat INNER JOIN " . $xoopsDB->prefix("stories") . " AS art ON cat.topic_id=art.topicid GROUP BY art.topicid";
            $result = $xoopsDB->query($sql);
            $cat_cbox_options = array();
            while (list($cid, $pid, $cat_title, $art_count) = $xoopsDB->fetchRow($result)) {
                $cat_title = $myts->displayTarea($cat_title);
                $cat_cbox_options[$cid] = "{$cat_title} ({$art_count})";
            }
            $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("<br />", $cat_cbox_options));
            $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC);
            $form->addElement($cat_label);
            // Publisher parent category
            $mytree = new XoopsTree($xoopsDB->prefix("publisher_categories"), "categoryid", "parentid");
            ob_start();
            $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category");
            $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents());
            $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC);
            $form->addElement($parent_cat_sel);
            ob_end_clean();
            $form->addElement(new XoopsFormHidden('op', 'go'));
            $form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));
            $form->addElement(new XoopsFormHidden('from_module_version', $_POST['news_version']));
            $form->display();
        }
    }
    publisher_closeCollapsableBar('newsimport', 'newsimporticon');
    xoops_cp_footer();
}
if ($op == 'go') {
    publisher_cpHeader();
    //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
コード例 #9
0
ファイル: wfsection.php プロジェクト: severnaya99/Sg-2010
            $sql = "SELECT cat.id, cat.pid, cat.title, COUNT(art.articleid) FROM " . $xoopsDB->prefix("wfs_category") . " AS cat INNER JOIN " . $xoopsDB->prefix("wfs_article") . " AS art ON cat.id=art.categoryid GROUP BY art.categoryid";
            $result = $xoopsDB->query($sql);
            $cat_cbox_values = array();
            $cat_cbox_options = array();
            while (list($cid, $pid, $cat_title, $art_count) = $xoopsDB->fetchRow($result)) {
                $cat_title = $myts->displayTarea($cat_title);
                $cat_cbox_options[$cid] = "{$cat_title} ({$art_count})";
            }
            $cat_label = new XoopsFormLabel(_AM_SSECTION_IMPORT_CATEGORIES, implode("<br />", $cat_cbox_options));
            $cat_label->setDescription(_AM_SSECTION_IMPORT_CATEGORIES_DSC);
            $form->addElement($cat_label);
            // SmartFAQ parent category
            $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
            ob_start();
            $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category");
            $parent_cat_sel = new XoopsFormLabel(_AM_SSECTION_IMPORT_PARENT_CATEGORY, ob_get_contents());
            $parent_cat_sel->setDescription(_AM_SSECTION_IMPORT_PARENT_CATEGORY_DSC);
            $form->addElement($parent_cat_sel);
            ob_end_clean();
            $form->addElement(new XoopsFormHidden('op', 'go'));
            $form->addElement(new XoopsFormButton('', 'import', _AM_SSECTION_IMPORT, 'submit'));
            $form->addElement(new XoopsFormHidden('from_module_version', $_POST['wfs_version']));
            $form->display();
        }
    }
    smartsection_close_collapsable('wfsectionimport', 'wfsectionimporticon');
    exit;
}
if ($op == 'go') {
    smartsection_xoops_cp_header();
    smartsection_adminMenu(-1, _AM_SSECTION_IMPORT);
コード例 #10
0
ファイル: submit.inc.php プロジェクト: trabisdementia/xuups
*/
if (!defined("XOOPS_ROOT_PATH")) {
    die("XOOPS root path not defined");
}
global $_POST, $xoopsDB;
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once 'functions.php';
$mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
$form = new XoopsThemeForm(_MD_SF_SUB_SMNAME, "form", xoops_getenv('PHP_SELF'));
// Category
ob_start();
$form->addElement(new XoopsFormHidden('categoryid', ''));
$mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
$category_label = new XoopsFormLabel(_MD_SF_CATEGORY_FAQ, ob_get_contents());
$category_label->setDescription(_MD_SF_CATEGORY_FAQ_DSC);
$form->addElement($category_label);
ob_end_clean();
// FAQ QUESTION
$form->addElement(new XoopsFormTextArea(_MD_SF_QUESTION, 'question', $faqObj->question(), 7, 60), true);
// ANSWER
$answer_text = new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', $answerObj->answer(), 15, 60);
$answer_text->setDescription(_MD_SF_ANSWER_FAQ_DSC);
$form->addElement($answer_text, true);
// HOW DO I
$howdoi_text = new XoopsFormText(_MD_SF_HOWDOI_FAQ, 'howdoi', 50, 255, $faqObj->howdoi());
$howdoi_text->setDescription(_MD_SF_HOWDOI_FAQ_DSC);
$form->addElement($howdoi_text, false);
// DIDUNO
$diduno_text = new XoopsFormTextArea(_MD_SF_DIDUNO_FAQ, 'diduno', $faqObj->diduno(), 3, 60);
コード例 #11
0
 function render($ele_value, $caption, $markupName, $isDisabled, $element, $entry_id)
 {
     $slider_html = "<input type=\"range\" ";
     $slider_html .= "name=\"{$markupName}\"";
     $slider_html .= "id=\"{$markupName}\"";
     $slider_html .= "min=\"{$ele_value[0]}\" ";
     $slider_html .= "max=\"{$ele_value[1]}\" ";
     $slider_html .= "step=\"{$ele_value[2]}\" ";
     $slider_html .= "value=\"{$ele_value[3]}\"";
     $slider_html .= "oninput=\"updateTextInput(value);\"";
     $slider_html .= "</input>";
     $value_html = "<output id=\"rangeValue\" type=\"text\" size=\"2\"";
     $value_html .= "for=\"{$markupName}\"";
     $value_html .= ">{$ele_value['3']}<output>";
     $form_slider_value = new XoopsFormLabel($caption, $value_html);
     $form_slider = new XoopsFormLabel($caption, $slider_html);
     $update_script = "<script type=\"text/javascript\">";
     $update_script .= "function updateTextInput(val) {";
     $update_script .= "document.getElementById('rangeValue').value=val;}";
     $update_script .= "</script>";
     if ($isDisabled) {
         $renderedValue = $form_slider_value->render();
         $form_ele = new XoopsFormLabel($caption, "{$renderedValue}");
     } else {
         $renderedSlider = $form_slider->render();
         $renderedValue = $form_slider_value->render();
         $form_ele = new XoopsFormLabel($caption, "<nobr>{$renderedSlider} {$renderedValue}</nobr>{$update_script}");
     }
     return $form_ele;
 }
コード例 #12
0
ファイル: category.php プロジェクト: trabisdementia/xuups
function editcat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null)
{
    global $xoopsDB, $smartpartner_category_handler, $xoopsUser, $myts, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a category
    if ($categoryid != 0) {
        // Creating the category object for the selected category
        //$categoryObj = new SmartpartnerCategory($categoryid);
        $categoryObj = $smartpartner_category_handler->get($categoryid);
        if ($showmenu) {
            smartpartner_adminMenu(1, _AM_SPARTNER_CATEGORIES . " > " . _AM_SPARTNER_EDITING);
        }
        echo "<br />\n";
        if ($categoryObj->notLoaded()) {
            redirect_header("category.php", 1, _AM_SPARTNER_NOCOLTOEDIT);
            exit;
        }
        smartpartner_collapsableBar('edittable', 'edittableicon', _AM_SPARTNER_CATEGORY_EDIT, _AM_SPARTNER_CATEGORY_EDIT_INFO);
    } else {
        if (!$categoryObj) {
            $categoryObj = $smartpartner_category_handler->create();
        }
        if ($showmenu) {
            smartpartner_adminMenu(1, _AM_SPARTNER_CATEGORIES . " > " . _AM_SPARTNER_CATEGORY_CREATING);
        }
        //echo "<br />\n";
        smartpartner_collapsableBar('createtable', 'createtableicon', _AM_SPARTNER_CATEGORY_CREATE, _AM_SPARTNER_CATEGORY_CREATE_INFO);
    }
    // Start category form
    $mytree = new XoopsTree($xoopsDB->prefix("smartpartner_categories"), "categoryid", "parentid");
    $sform = new XoopsThemeForm(_AM_SPARTNER_CATEGORY, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // Name
    $sform->addElement(new XoopsFormText(_AM_SPARTNER_CATEGORY, 'name', 50, 255, $categoryObj->name('e')), true);
    // Description
    $sform->addElement(new XoopsFormTextArea(_AM_SPARTNER_CATEGORY_DSC, 'description', $categoryObj->description('e'), 7, 60));
    // IMAGE
    $image_array =& XoopsLists::getImgListAsArray(smartpartner_getImageDir('category'));
    $image_select = new XoopsFormSelect('', 'image', $categoryObj->image());
    $image_select->addOption('-1', '---------------');
    $image_select->addOptionArray($image_array);
    $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartpartner/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $image_tray = new XoopsFormElementTray(_AM_SPARTNER_CATEGORY_IMAGE, '&nbsp;');
    $image_tray->addElement($image_select);
    $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartpartner_getImageDir('category', false) . $categoryObj->image() . "' name='image3' id='image3' alt='' />"));
    $image_tray->setDescription(_AM_SPARTNER_CATEGORY_IMAGE_DSC);
    $sform->addElement($image_tray);
    // IMAGE UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SPARTNER_CATEGORY_IMAGE_UPLOAD, "image_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(_AM_SPARTNER_CATEGORY_IMAGE_UPLOAD_DSC);
    $sform->addElement($file_box);
    // Weight
    $sform->addElement(new XoopsFormText(_AM_SPARTNER_CATEGORY_WEIGHT, 'weight', 4, 4, $categoryObj->weight()));
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $module_id = $xoopsModule->getVar('mid');
    // Parent Category
    ob_start();
    $mytree->makeMySelBox("name", "weight", $categoryObj->parentid(), 1, 'parentid');
    //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
    $parent_cat_select = new XoopsFormLabel(_AM_SPARTNER_CATEGORY_PARENT, ob_get_contents());
    $parent_cat_select->setDescription(_AM_SPARTNER_CATEGORY_PARENT_DSC);
    $sform->addElement($parent_cat_select);
    ob_end_clean();
    // Added by fx2024
    // sub Categories
    $cat_tray = new XoopsFormElementTray(_AM_SPARTNER_CATEGORY_SUBCATS_CREATE, '<br /><br />');
    $cat_tray->setDescription(_AM_SPARTNER_CATEGORY_SUBCATS_CREATE_DSC);
    for ($i = 0; $i < $nb_subcats; $i++) {
        if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
            $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
        } else {
            $subname = '';
        }
        $cat_tray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname), true);
    }
    $t = new XoopsFormText('', 'nb_subcats', 3, 2);
    $l = new XoopsFormLabel('', sprintf(_AM_SPARTNER_ADD_OPT, $t->render()));
    $b = new XoopsFormButton('', 'submit', _AM_SPARTNER_ADD_OPT_SUBMIT, 'submit');
    if ($categoryid == 0) {
        $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
    } else {
        $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
    }
    $r = new XoopsFormElementTray('');
    $r->addElement($l);
    $r->addElement($b);
    $cat_tray->addElement($r);
    $sform->addElement($cat_tray);
    //End of fx2024 code
    /*$gperm_handler = &xoops_gethandler('groupperm');
         $mod_perms = $gperm_handler->getGroupIds('category_moderation', $categoryid, $module_id);
    
         $moderators_select = new XoopsFormSelect('', 'moderators', $moderators, 5, true);
         $moderators_tray->addElement($moderators_select);
    
         $butt_mngmods = new XoopsFormButton('', '', 'Manage mods', 'button');
         $butt_mngmods->setExtra('onclick="javascript:small_window(\'pop.php\', 370, 350);"');
         $moderators_tray->addElement($butt_mngmods);
    
         $butt_delmod = new XoopsFormButton('', '', 'Delete mod', 'button');
         $butt_delmod->setExtra('onclick="javascript:deleteSelectedItemsFromList(this.form.elements[\'moderators[]\']);"');
         $moderators_tray->addElement($butt_delmod);
    
         $sform->addElement($moderators_tray);
         */
    $sform->addElement(new XoopsFormHidden('categoryid', $categoryid));
    //$parentid = $categoryObj->parentid('s');
    //$sform -> addElement( new XoopsFormHidden( 'parentid', $parentid ) );
    $sform->addElement(new XoopsFormHidden('nb_sub_yet', $nb_subcats));
    // Action buttons tray
    $button_tray = new XoopsFormElementTray('', '');
    /*for ($i = 0; $i < sizeof($moderators); $i++) {
         $allmods[] = $moderators[$i];
         }
    
         $hiddenmods = new XoopsFormHidden('allmods', $allmods);
         $button_tray->addElement($hiddenmods);
         */
    $hidden = new XoopsFormHidden('op', 'addcategory');
    $button_tray->addElement($hidden);
    // No ID for category -- then it's new category, button says 'Create'
    if (!$categoryid) {
        $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SPARTNER_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartpartner_close_collapsable('createtable', 'createtableicon');
    } else {
        // button says 'Update'
        $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_MODIFY, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartpartner_close_collapsable('edittable', 'edittableicon');
    }
    /*
    //Added by fx2024
    if ($categoryid) {
        // TODO : displaysubcats comes from smartpartner and need to be adapted for smartpartner
        include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/displaysubcats.php";
    
        // TODO : displayitems comes from smartpartner and need to be adapted for smartpartner
        //include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/displayitems.php";
    }
    //end of fx2024 code
    */
    unset($hidden);
}
コード例 #13
0
ファイル: index.php プロジェクト: jjdai/tellafriend
$styleWidth = "style='width:{$xoopsModuleConfig['form_style_width']};'";
if (!is_object($xoopsUser)) {
    $fromname_text = new XoopsFormText(_MI_TAF_FORMTHFROMNAME, "fromName", 30, 100, '');
    $fromname_text->setExtra($styleWidth);
    $fromemail_text = new XoopsFormText(_MI_TAF_FORMTHFROMEMAIL, "fromEmail", 40, 100, '');
    $fromemail_text->setExtra($styleWidth);
    $_SESSION['usersSubject'] = $subject;
    $subject_text = new XoopsFormLabel(_MI_TAF_FORMTHSUBJ, $subject4show);
    $subject_text->setExtra($styleWidth);
} else {
    $subject_text = new XoopsFormText(_MI_TAF_FORMTHSUBJ, "usersSubject", 50, 100, $subject4show);
    $subject_text->setExtra($styleWidth);
}
$to_text = new XoopsFormText(_MI_TAF_FORMTHTO, "usersTo", 40, 100, '');
$to_text->setExtra($styleWidth);
$body_label = new XoopsFormLabel(_MI_TAF_FORMTHBODY, nl2br($comment4show));
$body_label->setExtra($styleWidth);
$body_hidden = new XoopsFormHidden("usersComments", $comment4show);
$comment_textarea = new XoopsFormTextArea(_MI_TAF_FORMTHBODY, "usersComments", $comment4show, 10, 40);
$comment_textarea->setExtra($styleWidth);
$ticket_hidden = $xoopsGTicket->getTicketXoopsForm(__LINE__);
$submit_button = new XoopsFormButton("", "submit", _MI_TAF_BUTTONSEND, "submit");
$contact_form = new XoopsThemeForm(_MI_TAF_FORMTITLE, "tf_form", "index.php");
$contact_form->addElement($to_text, true);
if (!is_object($xoopsUser)) {
    $contact_form->addElement($fromname_text, true);
    $contact_form->addElement($fromemail_text, true);
}
$contact_form->addElement($subject_text);
if ($xoopsModuleConfig['can_bodyedit']) {
    $contact_form->addElement($comment_textarea, true);
コード例 #14
0
 function render($ele_value, $caption, $markupName, $isDisabled, $element, $entry_id)
 {
     global $myts;
     $myts =& MyTextSanitizer::getInstance();
     $renderer =& new formulizeElementRenderer();
     $ele_desc = $element->getVar('ele_desc', "f");
     if (strstr($markupName, "de_")) {
         // display element uses a slightly different element name so it can be distinguished on subsequent page load from regular elements...THIS IS NOT TRUE/NECESSARY ANYMORE SINCE FORMULIZE 3, WHERE ALL ELEMENTS ARE DISPLAY ELEMENTS
         $true_ele_id = str_replace("de_" . $element->getVar('id_form') . "_" . $entry_id . "_", "", $markupName);
     } else {
         $true_ele_id = str_replace("ele_", "", $markupName);
     }
     $selected = array();
     $options = array();
     $disabledHiddenValue = array();
     $disabledHiddenValues = "";
     $disabledOutputText = array();
     $opt_count = 1;
     while ($i = each($ele_value)) {
         $options[$opt_count] = $myts->stripSlashesGPC($i['key']);
         if ($i['value'] > 0) {
             $selected[] = $opt_count;
             $disabledHiddenValue[] = "<input type=hidden name=\"" . $markupName . "[]\" value=\"{$opt_count}\">";
         }
         $opt_count++;
     }
     if ($element->getVar('ele_delim') != "") {
         $delimSetting = $element->getVar('ele_delim');
     }
     $delimSetting =& $myts->undoHtmlSpecialChars($delimSetting);
     if ($delimSetting == "br") {
         $delimSetting = "<br />";
     }
     $hiddenOutOfRangeValuesToWrite = array();
     switch ($delimSetting) {
         case 'space':
             $form_ele1 = new XoopsFormCheckBox($caption, $markupName, $selected);
             $counter = 0;
             // counter used for javascript that works with 'Other' box
             while ($o = each($options)) {
                 $o = formulize_swapUIText($o, $element->getVar('ele_uitext'));
                 $other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter, true);
                 if ($other != false) {
                     $form_ele1->addOption($o['key'], _formulize_OPT_OTHER . $other);
                     if (in_array($o['key'], $selected)) {
                         $disabledOutputText[] = _formulize_OPT_OTHER . $other;
                     }
                 } else {
                     $form_ele1->addOption($o['key'], $o['value']);
                     if (in_array($o['key'], $selected)) {
                         $disabledOutputText[] = $o['value'];
                     }
                     if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
                         $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
                         // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                     }
                 }
                 $counter++;
             }
             $form_ele1->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
             break;
         default:
             $form_ele1 = new XoopsFormElementTray($caption, $delimSetting);
             $counter = 0;
             // counter used for javascript that works with 'Other' box
             while ($o = each($options)) {
                 $o = formulize_swapUIText($o, $element->getVar('ele_uitext'));
                 $t = new XoopsFormCheckBox('', $markupName . '[]', $selected);
                 $other = $renderer->optOther($o['value'], $markupName, $entry_id, $counter, true);
                 if ($other != false) {
                     $t->addOption($o['key'], _formulize_OPT_OTHER . $other);
                     if (in_array($o['key'], $selected)) {
                         $disabledOutputText[] = _formulize_OPT_OTHER . $other;
                     }
                 } else {
                     $t->addOption($o['key'], $o['value']);
                     if (in_array($o['key'], $selected)) {
                         $disabledOutputText[] = $o['value'];
                     }
                     if (strstr($o['value'], _formulize_OUTOFRANGE_DATA)) {
                         $hiddenOutOfRangeValuesToWrite[$o['key']] = str_replace(_formulize_OUTOFRANGE_DATA, "", $o['value']);
                         // if this is an out of range value, grab the actual value so we can stick it in a hidden element later
                     }
                 }
                 $t->setExtra(" onchange=\"javascript:formulizechanged=1;\" jquerytag=\"{$form_ele_id}\" ");
                 $form_ele1->addElement($t);
                 unset($t);
                 $counter++;
             }
             break;
     }
     $renderedHoorvs = "";
     if (count($hiddenOutOfRangeValuesToWrite) > 0) {
         foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
             $thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
             $renderedHoorvs .= $thisHoorv->render() . "\n";
             unset($thisHoorv);
         }
     }
     if ($isDisabled) {
         $disabledHiddenValues = implode("\n", $disabledHiddenValue);
         // glue the individual value elements together into a set of values
         $renderedElement = implode(", ", $disabledOutputText);
     } else {
         $renderedElement = $form_ele1->render();
     }
     $form_ele = new XoopsFormLabel($caption, "<nobr>{$renderedElement}</nobr>\n{$renderedHoorvs}\n{$disabledHiddenValues}\n");
     $form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
     return $form_ele;
 }
コード例 #15
0
ファイル: submit.inc.php プロジェクト: BackupTheBerlios/soopa
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
global $_POST, $xoopsDB;
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once SMARTSECTION_ROOT_PATH . "include/functions.php";
$categoryid = isset($_GET['categoryid']) ? intval($_GET['categoryid']) : 0;
$mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
$sform = new XoopsThemeForm(_MD_SS_SUB_SMNAME, "form", xoops_getenv('PHP_SELF'));
// Category
ob_start();
$sform->addElement(new XoopsFormHidden('categoryid', $newItemObj->categoryid()));
$mytree->makeMySelBox("name", "weight", $categoryid);
$category_label = new XoopsFormLabel(_MD_SS_CATEGORY, ob_get_contents());
$category_label->setDescription(_MD_SS_CATEGORY_DSC);
$sform->addElement($category_label);
ob_end_clean();
// ITEM TITLE
$sform->addElement(new XoopsFormText(_MD_SS_TITLE, 'title', 50, 255, $newItemObj->title('e')), true);
// SUMMARY
$summary_text = new XoopsFormTextArea(_MD_SS_SUMMARY, 'summary', $newItemObj->summary(0, 'e'), 7, 60);
$summary_text->setDescription(_MD_SS_SUMMARY_DSC);
$sform->addElement($summary_text, false);
// BODY
//$body_text = new XoopsFormDhtmlTextArea(_MD_SS_BODY, 'body', '', 15, 60);
$body_text = ss_getEditor(_MD_SS_BODY_REQ, 'body', $newItemObj->body(0, 'e'));
$body_text->setDescription(_MD_SS_BODY_DSC);
$sform->addElement($body_text, true);
// NOTIFY ON PUBLISH
コード例 #16
0
ファイル: partner.php プロジェクト: trabisdementia/xuups
function editpartner($showmenu = false, $id = 0)
{
    global $xoopsDB, $smartpartner_partner_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    if (!isset($smartpartner_partner_handler)) {
        $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    }
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a partner
    if ($id != 0) {
        // Creating the partner object
        $partnerObj = new SmartpartnerPartner($id);
        if ($partnerObj->notLoaded()) {
            redirect_header("partner.php", 1, _AM_SPARTNER_NOPARTNERSELECTED);
            exit;
        }
        switch ($partnerObj->status()) {
            case _SPARTNER_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SPARTNER_SUBMITTED_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_APPROVING;
                $page_title = _AM_SPARTNER_SUBMITTED_TITLE;
                $page_info = _AM_SPARTNER_SUBMITTED_INFO;
                $button_caption = _AM_SPARTNER_APPROVE;
                $new_status = _SPARTNER_STATUS_ACTIVE;
                break;
            case _SPARTNER_STATUS_ACTIVE:
                $breadcrumb_action1 = _AM_SPARTNER_ACTIVE_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_ACTIVE_EDITING;
                $page_info = _AM_SPARTNER_ACTIVE_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_ACTIVE;
                break;
            case _SPARTNER_STATUS_INACTIVE:
                $breadcrumb_action1 = _AM_SPARTNER_INACTIVE_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_INACTIVE_EDITING;
                $page_info = _AM_SPARTNER_INACTIVE_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_INACTIVE;
                break;
            case _SPARTNER_STATUS_REJECTED:
                $breadcrumb_action1 = _AM_SPARTNER_REJECTED_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_REJECTED_EDITING;
                $page_info = _AM_SPARTNER_REJECTED_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_REJECTED;
                break;
            case "default":
            default:
                break;
        }
        if ($showmenu) {
            smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        smartpartner_collapsableBar('editpartner', 'editpartmericon', $page_title, $page_info);
    } else {
        // there's no parameter, so we're adding a partner
        $partnerObj =& $smartpartner_partner_handler->create();
        $breadcrumb_action1 = _AM_SPARTNER_PARTNERS;
        $breadcrumb_action2 = _AM_SPARTNER_CREATE;
        $button_caption = _AM_SPARTNER_CREATE;
        $new_status = _SPARTNER_STATUS_ACTIVE;
        if ($showmenu) {
            smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        smartpartner_collapsableBar('addpartner', 'addpartmericon', _AM_SPARTNER_PARTNER_CREATING, _AM_SPARTNER_PARTNER_CREATING_DSC);
    }
    // PARTNER FORM
    $sform = new XoopsThemeForm(_AM_SPARTNER_PARTNERS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // TITLE
    $title_text = new XoopsFormText(_AM_SPARTNER_TITLE, 'title', 50, 255, $partnerObj->title('e'));
    $sform->addElement($title_text, true);
    // Parent Category
    $mytree = new SmartTree($xoopsDB->prefix("smartpartner_categories"), "categoryid", "parentid");
    ob_start();
    $mytree->makeMySelBox("name", "weight", explode('|', $partnerObj->categoryid()), 0, 'categoryid', '', true);
    //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
    $parent_cat_select = new XoopsFormLabel(_AM_SPARTNER_CATEGORY_BELONG, ob_get_contents());
    $parent_cat_select->setDescription(_AM_SPARTNER_BELONG_CATEGORY_DSC);
    $sform->addElement($parent_cat_select);
    ob_end_clean();
    // LOGO
    $logo_array =& XoopsLists::getImgListAsArray(smartpartner_getImageDir());
    $logo_select = new XoopsFormSelect('', 'image', $partnerObj->image());
    $logo_select->addOption('-1', '---------------');
    $logo_select->addOptionArray($logo_array);
    $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTPARTNER_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $logo_tray = new XoopsFormElementTray(_AM_SPARTNER_LOGO, '&nbsp;');
    $logo_tray->addElement($logo_select);
    $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartpartner_getImageDir('', false) . $partnerObj->image() . "' name='image3' id='image3' alt='' />"));
    $logo_tray->setDescription(_AM_SPARTNER_LOGO_DSC);
    $sform->addElement($logo_tray);
    // LOGO UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SPARTNER_LOGO_UPLOAD, "logo_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(sprintf(_AM_SPARTNER_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height']));
    $sform->addElement($file_box);
    // IMAGE_URL
    $image_url_text = new XoopsFormText(_CO_SPARTNER_IMAGE_URL, 'image_url', 50, 255, $partnerObj->image_url());
    $image_url_text->setDescription(_CO_SPARTNER_IMAGE_URL_DSC);
    $sform->addElement($image_url_text, false);
    // URL
    $url_text = new XoopsFormText(_AM_SPARTNER_URL, 'url', 50, 255, $partnerObj->url());
    $url_text->setDescription(_AM_SPARTNER_URL_DSC);
    $sform->addElement($url_text, false);
    // SUMMARY
    $summary_text = new XoopsFormTextArea(_AM_SPARTNER_SUMMARY, 'summary', $partnerObj->summary(0, 'e'), 7, 60);
    $summary_text->setDescription(_AM_SPARTNER_SUMMARY_DSC);
    $sform->addElement($summary_text, true);
    // SHOW summary on partner page
    $showsum_radio = new XoopsFormRadioYN(_AM_SPARTNER_SHOW_SUMMARY, 'showsummary', $partnerObj->getVar('showsummary'));
    $showsum_radio->setDescription(_AM_SPARTNER_SHOW_SUMMARY_DSC);
    $sform->addElement($showsum_radio);
    // DESCRIPTION
    $description_text = new XoopsFormDhtmlTextArea(_AM_SPARTNER_DESCRIPTION, 'description', $partnerObj->description(0, 'e'), 15, 60);
    $description_text->setDescription(_AM_SPARTNER_DESCRIPTION_DSC);
    $sform->addElement($description_text, false);
    // CONTACT_NAME
    $contact_name_text = new XoopsFormText(_CO_SPARTNER_CONTACT_NAME, 'contact_name', 50, 255, $partnerObj->contact_name('e'));
    $contact_name_text->setDescription(_CO_SPARTNER_CONTACT_NAME_DSC);
    $sform->addElement($contact_name_text, false);
    // CONTACT_EMAIL
    $contact_email_text = new XoopsFormText(_CO_SPARTNER_CONTACT_EMAIL, 'contact_email', 50, 255, $partnerObj->contact_email('e'));
    $contact_email_text->setDescription(_CO_SPARTNER_CONTACT_EMAIL_DSC);
    $sform->addElement($contact_email_text, false);
    // EMAIL_PRIV
    $email_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_EMAILPRIV, 'email_priv', $partnerObj->email_priv('e'));
    $email_priv_radio->setDescription(_CO_SPARTNER_CONTACT_EMAILPRIV_DSC);
    $sform->addElement($email_priv_radio);
    // CONTACT_PHONE
    $contact_phone_text = new XoopsFormText(_CO_SPARTNER_CONTACT_PHONE, 'contact_phone', 50, 255, $partnerObj->contact_phone('e'));
    $contact_phone_text->setDescription(_CO_SPARTNER_CONTACT_PHONE_DSC);
    $sform->addElement($contact_phone_text, false);
    // PHONE_PRIV
    $phone_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_PHONEPRIV, 'phone_priv', $partnerObj->phone_priv('e'));
    $phone_priv_radio->setDescription(_CO_SPARTNER_CONTACT_PHONEPRIV_DSC);
    $sform->addElement($phone_priv_radio);
    // ADRESS
    //$adress_text = new XoopsFormText(_CO_SPARTNER_ADRESS, 'adress', 50, 255, $partnerObj->adress('e'));
    $adress_text = new XoopsFormTextArea(_CO_SPARTNER_ADRESS, 'adress', $partnerObj->adress('e'));
    $adress_text->setDescription(_CO_SPARTNER_ADRESS_DSC);
    $sform->addElement($adress_text, false);
    // ADRESS_PRIV
    $adress_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_ADRESSPRIV, 'adress_priv', $partnerObj->adress_priv('e'));
    $adress_priv_radio->setDescription(_CO_SPARTNER_CONTACT_ADRESSPRIV_DSC);
    $sform->addElement($adress_priv_radio);
    // STATUS
    $options = $partnerObj->getAvailableStatus();
    $status_select = new XoopsFormSelect(_AM_SPARTNER_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SPARTNER_STATUS_DSC);
    $sform->addElement($status_select);
    // WEIGHT
    $weight_text = new XoopsFormText(_AM_SPARTNER_WEIGHT, 'weight', 4, 4, $partnerObj->weight());
    $weight_text->setDescription(_AM_SPARTNER_WEIGHT_DSC);
    $sform->addElement($weight_text);
    //perms
    global $smartpermissions_handler;
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
    $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);
    if ($partnerObj->id() != 0) {
        $grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $partnerObj->id());
    } else {
        $grantedGroups = $xoopsModuleConfig['default_full_view'];
    }
    $full_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_FULL_PERM_READ, 'full_view', true, $grantedGroups, 5, true);
    $full_view_select->setDescription(_CO_SPARTNER_FULL_PERM_READ_DSC);
    $sform->addElement($full_view_select);
    if ($partnerObj->id() != 0) {
        $partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $partnerObj->id());
    } else {
        $partGrantedGroups = $xoopsModuleConfig['default_part_view'];
    }
    $part_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_PART_PERM_READ, 'partial_view', true, $partGrantedGroups, 5, true);
    $part_view_select->setDescription(_CO_SPARTNER_PART_PERM_READ_DSC);
    $sform->addElement($part_view_select);
    // Partner id
    $sform->addElement(new XoopsFormHidden('id', $partnerObj->id()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addpartner');
    $button_tray->addElement($hidden);
    $sform->addElement(new XoopsFormHidden('original_status', $partnerObj->status()));
    if (!$id) {
        // there's no id? Then it's a new partner
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SPARTNER_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // else, we're editing an existing partner
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    unset($hidden);
    if (!$id) {
        smartpartner_close_collapsable('addpartner', 'addpartnericon');
    } else {
        smartpartner_close_collapsable('editpartner', 'editpartnericon');
    }
    if ($id != 0) {
        showfiles($partnerObj);
    }
}
コード例 #17
0
ファイル: item.php プロジェクト: trabisdementia/publisher
    /**
     * @param $obj
     *
     * @return $this
     */
    public function createElements($obj)
    {
        $publisher =& PublisherPublisher::getInstance();
        $allowedEditors = publisherGetEditors($publisher->getHandler('permission')->getGrantedItems('editors'));
        if (!is_object($GLOBALS['xoopsUser'])) {
            $group = array(XOOPS_GROUP_ANONYMOUS);
        } else {
            $group = $GLOBALS['xoopsUser']->getGroups();
        }
        $this->setExtra('enctype="multipart/form-data"');
        $this->startTab(_CO_PUBLISHER_TAB_MAIN);
        // Category
        $categoryFormSelect = new XoopsFormSelect(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
        $categoryFormSelect->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
        $categoryFormSelect->addOptionArray($publisher->getHandler('category')->getCategoriesForSubmit());
        $this->addElement($categoryFormSelect);
        // ITEM TITLE
        $this->addElement(new XoopsFormText(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true);
        // SUBTITLE
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUBTITLE)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e')));
        }
        // SHORT URL
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_SHORT_URL)) {
            $textShortUrl = new XoopsFormText(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->short_url('e'));
            $textShortUrl->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC);
            $this->addElement($textShortUrl);
        }
        // TAGS
        if (xoops_isActiveModule('tag') && $this->isGranted(PublisherConstants::PUBLISHER_ITEM_TAG)) {
            include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
            $textTags = new XoopsFormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
            $this->addElement($textTags);
        }
        // SELECT EDITOR
        $nohtml = !$obj->dohtml();
        if (count($allowedEditors) === 1) {
            $editor = $allowedEditors[0];
        } elseif (count($allowedEditors) > 0) {
            $editor = XoopsRequest::getString('editor', '', 'POST');
            if (!empty($editor)) {
                publisherSetCookieVar('publisher_editor', $editor);
            } else {
                $editor = publisherGetCookieVar('publisher_editor');
                if (empty($editor) && is_object($GLOBALS['xoopsUser'])) {
                    //                    $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile
                    $editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
                    // Need set through user profile
                }
            }
            $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $publisher->getConfig('submit_editor') : $editor;
            $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
            $this->addElement($formEditor);
        } else {
            $editor = $publisher->getConfig('submit_editor');
        }
        $editorConfigs = array();
        $editorConfigs['rows'] = !$publisher->getConfig('submit_editor_rows') ? 35 : $publisher->getConfig('submit_editor_rows');
        $editorConfigs['cols'] = !$publisher->getConfig('submit_editor_cols') ? 60 : $publisher->getConfig('submit_editor_cols');
        $editorConfigs['width'] = !$publisher->getConfig('submit_editor_width') ? '100%' : $publisher->getConfig('submit_editor_width');
        $editorConfigs['height'] = !$publisher->getConfig('submit_editor_height') ? '400px' : $publisher->getConfig('submit_editor_height');
        // SUMMARY
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUMMARY)) {
            // Description
            //$summaryText = new XoopsFormTextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60);
            $editorConfigs['name'] = 'summary';
            $editorConfigs['value'] = $obj->getVar('summary', 'e');
            $summaryText = new XoopsFormEditor(_CO_PUBLISHER_SUMMARY, $editor, $editorConfigs, $nohtml, $onfailure = null);
            $summaryText->setDescription(_CO_PUBLISHER_SUMMARY_DSC);
            $this->addElement($summaryText);
        }
        // BODY
        $editorConfigs['name'] = 'body';
        $editorConfigs['value'] = $obj->getVar('body', 'e');
        $bodyText = new XoopsFormEditor(_CO_PUBLISHER_BODY, $editor, $editorConfigs, $nohtml, $onfailure = null);
        $bodyText->setDescription(_CO_PUBLISHER_BODY_DSC);
        $this->addElement($bodyText);
        // VARIOUS OPTIONS
        if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML) || $this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY) || $this->isGranted(PublisherConstants::PUBLISHER_DOXCODE) || $this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE) || $this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML)) {
                $html_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO);
                $this->addElement($html_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY)) {
                $smiley_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO);
                $this->addElement($smiley_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOXCODE)) {
                $xcode_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->doxcode(), _YES, _NO);
                $this->addElement($xcode_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE)) {
                $image_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->doimage(), _YES, _NO);
                $this->addElement($image_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
                $linebreak_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->dobr(), _YES, _NO);
                $this->addElement($linebreak_radio);
            }
        }
        // Available pages to wrap
        if ($this->isGranted(PublisherConstants::PUBLISHER_AVAILABLE_PAGE_WRAP)) {
            $wrapPages = XoopsLists::getHtmlListAsArray(publisherGetUploadDir(true, 'content'));
            $availableWrapPagesText = array();
            foreach ($wrapPages as $page) {
                $availableWrapPagesText[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
            }
            $availableWrapPages = new XoopsFormLabel(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $availableWrapPagesText));
            $availableWrapPages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
            $this->addElement($availableWrapPages);
        }
        // Uid
        /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
            the method users::getobjects encounters a memory error
            */
        // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
        if ($this->isGranted(PublisherConstants::PUBLISHER_UID)) {
            $uidSelect = new XoopsFormSelect(_CO_PUBLISHER_UID, 'uid', $obj->uid(), 1, false);
            $uidSelect->setDescription(_CO_PUBLISHER_UID_DSC);
            $sql = 'SELECT uid, uname FROM ' . $obj->db->prefix('users') . ' ORDER BY uname ASC';
            $result = $obj->db->query($sql);
            $usersArray = array();
            $usersArray[0] = $GLOBALS['xoopsConfig']['anonymous'];
            while (($myrow = $obj->db->fetchArray($result)) !== false) {
                $usersArray[$myrow['uid']] = $myrow['uname'];
            }
            $uidSelect->addOptionArray($usersArray);
            $this->addElement($uidSelect);
        }
        /* else {
           $hidden = new XoopsFormHidden('uid', $obj->uid());
           $this->addElement($hidden);
           unset($hidden);
           }*/
        // Author ALias
        if ($this->isGranted(PublisherConstants::PUBLISHER_AUTHOR_ALIAS)) {
            $element = new XoopsFormText(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e'));
            $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC);
            $this->addElement($element);
            unset($element);
        }
        // STATUS
        if ($this->isGranted(PublisherConstants::PUBLISHER_STATUS)) {
            $options = array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, PublisherConstants::PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, PublisherConstants::PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, PublisherConstants::PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
            $statusSelect = new XoopsFormSelect(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
            $statusSelect->addOptionArray($options);
            $statusSelect->setDescription(_CO_PUBLISHER_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
        }
        // Datesub
        if ($this->isGranted(PublisherConstants::PUBLISHER_DATESUB)) {
            if ($obj->isNew()) {
                $datesub = time();
            } else {
                $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub');
            }
            $datesub_datetime = new PublisherFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            // $datesub_datetime = new XoopsFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC);
            $this->addElement($datesub_datetime);
        }
        // NOTIFY ON PUBLISH
        if ($this->isGranted(PublisherConstants::PUBLISHER_NOTIFY)) {
            $notify_radio = new XoopsFormRadioYN(_CO_PUBLISHER_NOTIFY, 'notify', $obj->notifypub(), _YES, _NO);
            $this->addElement($notify_radio);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_IMAGES)) {
            $this->startTab(_CO_PUBLISHER_TAB_IMAGES);
        }
        // IMAGE
        if ($this->isGranted(PublisherConstants::PUBLISHER_IMAGE_ITEM)) {
            $objimages = $obj->getImages();
            $mainarray = is_object($objimages['main']) ? array($objimages['main']) : array();
            $mergedimages = array_merge($mainarray, $objimages['others']);
            $objimage_array = array();
            foreach ($mergedimages as $imageObj) {
                $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $catids = array_keys($catlist);
            $imageObjs = array();
            if (!empty($catids)) {
                $imageHandler =& xoops_getHandler('image');
                $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . implode(',', $catids) . ')', 'IN'));
                $criteria->add(new Criteria('image_display', 1));
                $criteria->setSort('image_nicename');
                $criteria->setOrder('ASC');
                $imageObjs = $imageHandler->getObjects($criteria, true);
                unset($criteria);
            }
            $image_array = array();
            foreach ($imageObjs as $imageObj) {
                $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $image_array = array_diff($image_array, $objimage_array);
            $imageSelect = new XoopsFormSelect('', 'image_notused', '', 5);
            $imageSelect->addOptionArray($image_array);
            $imageSelect->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            //$imageSelect->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'");
            unset($image_array);
            $imageSelect2 = new XoopsFormSelect('', 'image_item', '', 5, true);
            $imageSelect2->addOptionArray($objimage_array);
            $imageSelect2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $buttonadd = new XoopsFormButton('', 'buttonadd', _CO_PUBLISHER_ADD);
            $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $buttonremove = new XoopsFormButton('', 'buttonremove', _CO_PUBLISHER_REMOVE);
            $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $opentable = new XoopsFormLabel('', '<table><tr><td>');
            $addcol = new XoopsFormLabel('', '</td><td>');
            $addbreak = new XoopsFormLabel('', '<br />');
            $closetable = new XoopsFormLabel('', '</td></tr></table>');
            $GLOBALS['xoTheme']->addScript(PUBLISHER_URL . '/assets/js/ajaxupload.3.9.js');
            $js_data = new XoopsFormLabel('', '
<script type= "text/javascript">/*<![CDATA[*/
$publisher(document).ready(function () {
    var button = $publisher("#publisher_upload_button"), interval;
    new AjaxUpload(button,{
        action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons
        responseType: "text/html",
        name: "publisher_upload_file",
        onSubmit : function (file, ext) {
            // change button text, when user selects file
            $publisher("#publisher_upload_message").html(" ");
            button.html("<img src=\'' . PUBLISHER_URL . '/assets/images/loadingbar.gif\'/>"); this.setData({
                "image_nicename": $publisher("#image_nicename").val(),
                "imgcat_id" : $publisher("#imgcat_id").val()
            });
            // If you want to allow uploading only 1 file at time,
            // you can disable upload button
            this.disable();
            interval = window.setInterval(function () {
            }, 200);
        },
        onComplete: function (file, response) {
            button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '");
            window.clearInterval(interval);
            // enable upload button
            this.enable();
            // add file to the list
            var result = eval(response);
            if ("success" == result[0]) {
                 $publisher("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>");
                 publisher_updateSelectOption(\'image_item\', \'image_featured\');
                 showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XOOPS_URL . '\')
            } else {
                 $publisher("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>");
            }
        }
    });
});
/*]]>*/</script>
');
            $messages = new XoopsFormLabel('', "<div id='publisher_upload_message'></div>");
            $button = new XoopsFormLabel('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '</div>');
            $nicename = new XoopsFormText('', 'image_nicename', 30, 30, _CO_PUBLISHER_IMAGE_NICENAME);
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $imagecat = new XoopsFormSelect('', 'imgcat_id', '', 1);
            $imagecat->addOptionArray($catlist);
            $imageUploadTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, '');
            $imageUploadTray->addElement($js_data);
            $imageUploadTray->addElement($messages);
            $imageUploadTray->addElement($opentable);
            $imageUploadTray->addElement($imagecat);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($nicename);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($button);
            $imageUploadTray->addElement($closetable);
            $this->addElement($imageUploadTray);
            $imageTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_ITEMS, '');
            $imageTray->addElement($opentable);
            $imageTray->addElement($imageSelect);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonadd);
            $imageTray->addElement($addcol);
            $imageTray->addElement($imageSelect2);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonremove);
            $imageTray->addElement($closetable);
            $imageTray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC);
            $this->addElement($imageTray);
            $imagename = is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : '';
            $imageforpath = $imagename != '' ? $imagename : 'blank.gif';
            $imageSelect3 = new XoopsFormSelect(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1);
            $imageSelect3->addOptionArray($objimage_array);
            $imageSelect3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $imageSelect3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC);
            $this->addElement($imageSelect3);
            $image_preview = new XoopsFormLabel(_CO_PUBLISHER_IMAGE_PREVIEW, "<img src='" . XOOPS_URL . '/uploads/' . $imageforpath . "' name='image_display' id='image_display' alt='' />");
            $this->addElement($image_preview);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_FILES)) {
            $this->startTab(_CO_PUBLISHER_TAB_FILES);
        }
        // File upload UPLOAD
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_UPLOAD_FILE)) {
            // NAME
            $nameText = new XoopsFormText(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, '');
            $nameText->setDescription(_CO_PUBLISHER_FILE_NAME_DSC);
            $this->addElement($nameText);
            unset($nameText);
            // DESCRIPTION
            $descriptionText = new XoopsFormTextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', '');
            $descriptionText->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC);
            $this->addElement($descriptionText);
            unset($descriptionText);
            $statusSelect = new XoopsFormRadioYN(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1);
            //1 - active
            $statusSelect->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
            $fileBox = new XoopsFormFile(_CO_PUBLISHER_ITEM_UPLOAD_FILE, 'item_upload_file', 0);
            $fileBox->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC);
            $fileBox->setExtra("size ='50'");
            $this->addElement($fileBox);
            unset($fileBox);
            if (!$obj->isNew()) {
                $filesObj =& $publisher->getHandler('file')->getAllFiles($obj->itemid());
                if (count($filesObj) > 0) {
                    $table = '';
                    $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
                    $table .= '<tr>';
                    $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>";
                    $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . '</strong></td>';
                    $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . '</strong></td>';
                    $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
                    $table .= '</tr>';
                    foreach ($filesObj as $fileObj) {
                        $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>";
                        $delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>";
                        if ($fileObj->status() == 0) {
                            $not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'/>";
                        } else {
                            $not_visible = '';
                        }
                        $table .= '<tr>';
                        $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . '</td>';
                        $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . '</td>';
                        $table .= "<td class='even' align='left'>" . $fileObj->description() . '</td>';
                        $table .= "<td class='even' align='center'>" . $fileObj->counter() . '';
                        $table .= "<td class='even' align='center'>" . $fileObj->getDatesub() . '</td>';
                        $table .= "<td class='even' align='center'> {$modify} {$delete} </td>";
                        $table .= '</tr>';
                    }
                    $table .= '</table>';
                    $files_box = new XoopsFormLabel(_CO_PUBLISHER_FILES_LINKED, $table);
                    $this->addElement($files_box);
                    unset($files_box, $filesObj, $fileObj);
                }
            }
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_OTHERS)) {
            $this->startTab(_CO_PUBLISHER_TAB_OTHERS);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_META);
        // Meta Keywords
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_KEYWORDS)) {
            $text_meta_keywords = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->meta_keywords('e'), 7, 60);
            $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC);
            $this->addElement($text_meta_keywords);
        }
        // Meta Description
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_DESCRIPTION)) {
            $text_meta_description = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->meta_description('e'), 7, 60);
            $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC);
            $this->addElement($text_meta_description);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_PERMISSIONS);
        // COMMENTS
        if ($this->isGranted(PublisherConstants::PUBLISHER_ALLOWCOMMENTS)) {
            $addcomments_radio = new XoopsFormRadioYN(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->cancomment(), _YES, _NO);
            $this->addElement($addcomments_radio);
        }
        // WEIGHT
        if ($this->isGranted(PublisherConstants::PUBLISHER_WEIGHT)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->weight()));
        }
        $this->endTabs();
        //COMMON TO ALL TABS
        $button_tray = new XoopsFormElementTray('', '');
        if (!$obj->isNew()) {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _SUBMIT, 'submit'));
            //orclone
        } else {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _CO_PUBLISHER_CREATE, 'submit'));
            $button_tray->addElement(new XoopsFormButton('', '', _CO_PUBLISHER_CLEAR, 'reset'));
        }
        $button_tray->addElement(new XoopsFormButton('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit'));
        $butt_cancel = new XoopsFormButton('', '', _CO_PUBLISHER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $this->addElement($button_tray);
        $hidden = new XoopsFormHidden('itemid', $obj->itemid());
        $this->addElement($hidden);
        unset($hidden);
        return $this;
    }
コード例 #18
0
 function render($ele_value, $caption, $markupName, $isDisabled, $element, $entry_id)
 {
     $id_form = $element->getVar('id_form');
     $ele_value[2] = stripslashes($ele_value[2]);
     $ele_value[2] = getTextboxDefault($ele_value[2], $id_form, $entry_id);
     //if placeholder value is set
     if ($ele_value[11]) {
         $placeholder = $ele_value[2];
         $ele_value[2] = "";
     }
     if (!strstr(getCurrentURL(), "printview.php")) {
         // nmc 2007.03.24 - added
         $form_ele = new XoopsFormText($caption, $markupName, $ele_value[0], $ele_value[1], $ele_value[2]);
     } else {
         // nmc 2007.03.24 - added
         $form_ele = new XoopsFormLabel($caption, $ele_value[2]);
         // nmc 2007.03.24 - added
     }
     //if placeholder value is set
     if ($ele_value[11]) {
         $form_ele->setExtra("placeholder='" . $placeholder . "'");
     }
     $ele_value = $element->getVar('ele_value');
     return $form_ele;
 }
コード例 #19
0
ファイル: item.php プロジェクト: severnaya99/Sg-2010
function edititem($showmenu = false, $itemid = 0, $clone = false)
{
    global $smartsection_current_page, $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    include_once SMARTSECTION_ROOT_PATH . '/class/formdatetime.php';
    // if there is a parameter, and the id exists, retrieve data: we're editing a item
    if ($itemid != 0) {
        // Creating the ITEM object
        $itemObj = $smartsection_item_handler->get($itemid);
        if (!$itemObj) {
            redirect_header("item.php", 1, _AM_SSECTION_NOITEMSELECTED);
            exit;
        }
        if ($clone) {
            $itemObj->setNew();
            $itemObj->setVar('status', _SSECTION_STATUS_NOTSET);
            $itemObj->setVar('datesub', time());
        }
        switch ($itemObj->status()) {
            case _SSECTION_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SSECTION_SUBMITTED;
                $breadcrumb_action2 = _AM_SSECTION_APPROVING;
                $page_title = _AM_SSECTION_SUBMITTED_TITLE;
                $page_info = _AM_SSECTION_SUBMITTED_INFO;
                $button_caption = _AM_SSECTION_APPROVE;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
            case _SSECTION_STATUS_PUBLISHED:
                $breadcrumb_action1 = _AM_SSECTION_PUBLISHED;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_PUBLISHEDEDITING;
                $page_info = _AM_SSECTION_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
            case _SSECTION_STATUS_OFFLINE:
                $breadcrumb_action1 = _AM_SSECTION_OFFLINE;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_OFFLINEEDITING;
                $page_info = _AM_SSECTION_OFFLINEEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_OFFLINE;
                break;
            case _SSECTION_STATUS_REJECTED:
                $breadcrumb_action1 = _AM_SSECTION_REJECTED;
                $breadcrumb_action2 = _AM_SSECTION_REJECTED;
                $page_title = _AM_SSECTION_REJECTED_EDIT;
                $page_info = _AM_SSECTION_REJECTED_EDIT_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_REJECTED;
                break;
            case _SSECTION_STATUS_NOTSET:
                // Then it's a clone...
                $breadcrumb_action1 = _AM_SSECTION_ITEMS;
                $breadcrumb_action2 = _AM_SSECTION_CLONE_NEW;
                $button_caption = _AM_SSECTION_CREATE;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                $page_title = _AM_SSECTION_ITEM_DUPLICATING;
                $page_info = _AM_SSECTION_ITEM_DUPLICATING_DSC;
                break;
            case "default":
            default:
                $breadcrumb_action1 = _AM_SSECTION_ITEMS;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_PUBLISHEDEDITING;
                $page_info = _AM_SSECTION_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
        }
        $categoryObj = $itemObj->category();
        if ($showmenu) {
            smartsection_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        smartsection_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info);
        if (!$clone) {
            echo "<form><div style=\"margin-bottom: 10px;\">";
            echo "<input type='button' name='button' onclick=\"location='item.php?op=clone&itemid=" . $itemObj->itemid() . "'\" value='" . _AM_SSECTION_CLONE_ITEM . "'>&nbsp;&nbsp;";
            echo "</div></form>";
        }
    } else {
        // there's no parameter, so we're adding an item
        $itemObj =& $smartsection_item_handler->create();
        $itemObj->setVar('uid', $xoopsUser->uid());
        $categoryObj =& $smartsection_category_handler->create();
        $breadcrumb_action1 = _AM_SSECTION_ITEMS;
        $breadcrumb_action2 = _AM_SSECTION_CREATINGNEW;
        $button_caption = _AM_SSECTION_CREATE;
        $new_status = _SSECTION_STATUS_PUBLISHED;
        if ($showmenu) {
            smartsection_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0;
        $categoryObj->setVar('categoryid', $sel_categoryid);
        smartsection_collapsableBar('createitemtable', 'createitemicon', _AM_SSECTION_ITEM_CREATING, _AM_SSECTION_ITEM_CREATING_DSC);
    }
    // ITEM FORM
    $sform = new XoopsThemeForm(_AM_SSECTION_ITEMS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // CATEGORY
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    ob_start();
    //$sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid()));
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $category_label = new XoopsFormLabel(_AM_SSECTION_CATEGORY, ob_get_contents());
    $category_label->setDescription(_AM_SSECTION_CATEGORY_DSC);
    $sform->addElement($category_label);
    ob_end_clean();
    // TITLE
    $title_text = new XoopsFormText(_AM_SSECTION_TITLE, 'title', 50, 255, $itemObj->title(0, 'e'));
    $sform->addElement($title_text, true);
    if (SMARTSECTION_LEVEL >= 5) {
        // SUMMARY
        $summary_text = smartsection_getEditor(_AM_SSECTION_SUMMARY, 'summary', $itemObj->getVar('summary', 'e'));
        $summary_text->setDescription(_AM_SSECTION_SUMMARY_DSC);
        $sform->addElement($summary_text, false);
        // DISPLAY_SUMMARY
        $display_summary_radio = new XoopsFormRadioYN(_AM_SSECTION_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
        $sform->addElement($display_summary_radio);
    }
    // BODY
    /*if ($itemObj->address()) {
    		// Main body : pagewrap
    		$address_select = new XoopsFormSelect(_AM_SSECTION_BODY_SELECTFILE, "address", $itemObj->address());
    		$address_select->setDescription(_AM_SSECTION_BODY_SELECTFILE_DSC);
    	    $dir = smartsection_getUploadDir(true, 'content');
    		$folder = dir($dir);
    		while($file = $folder->read()) {
    	      if ($file != "." && $file != "..") {
    		     $address_select->addOption($file, "".$file."");
    		  }
    		}
    	    $folder->close();
    		$sform->addElement($address_select);
    
    		$sform->addElement(new XoopsFormHidden('body', ''));
    	} else {*/
    $body_text = smartsection_getEditor(_AM_SSECTION_BODY, 'body', $itemObj->getVar('body', 'e'));
    if (SMARTSECTION_LEVEL >= 5) {
        $body_text->setDescription(sprintf(_AM_SSECTION_BODY_DSC, SMARTSECTION_URL . "/admin/pagewrap_lookup.php"));
    }
    $sform->addElement($body_text);
    //}
    if (SMARTSECTION_LEVEL >= 5) {
        // Available pages to wrap
        $wrap_pages = XoopsLists::getHtmlListAsArray(smartsection_getUploadDir(true, 'content'));
        $available_wrap_pages_text = array();
        foreach ($wrap_pages as $page) {
            $available_wrap_pages_text[] = "<span onclick='smartsectionPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
        }
        $available_wrap_pages = new XoopsFormLabel(_AM_SSECTION_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text));
        $available_wrap_pages->setDescription(_AM_SSECTION_AVAILABLE_PAGE_WRAP_DSC);
        $sform->addElement($available_wrap_pages);
        // Tags
        if (smartsection_tag_module_included()) {
            include_once XOOPS_ROOT_PATH . "/modules/tag/include/formtag.php";
            $text_tags = new XoopsFormTag("item_tag", 60, 255, $itemObj->getVar('item_tag', 'e'), 0);
            $sform->addElement($text_tags);
        }
        // IMAGE
        $image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('item'));
        $image_select = new XoopsFormSelect('', 'image', $itemObj->image());
        //$image_select -> addOption ('-1', '---------------');
        $image_select->addOptionArray($image_array);
        $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
        $image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE_ITEM, '&nbsp;');
        $image_tray->addElement($image_select);
        $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
        $image_tray->setDescription(_AM_SSECTION_IMAGE_ITEM_DSC);
        $sform->addElement($image_tray);
        // IMAGE UPLOAD
        $max_size = 5000000;
        $image_file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size);
        $image_file_box->setExtra("size ='50'");
        $image_file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_ITEM_DSC);
        $sform->addElement($image_file_box);
    }
    // File upload UPLOAD
    $file_box = new XoopsFormFile(smartsection_new_feature_tag() . _AM_SSECTION_ITEM_UPLOAD_FILE, "userfile", 0);
    $file_box->setDescription(_AM_SSECTION_ITEM_UPLOAD_FILE_DSC . smartsection_new_feature_tag());
    $file_box->setExtra("size ='50'");
    $sform->addElement($file_box);
    // Uid
    /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
    	    the method users::getobjects encounters a memory error
    	*/
    $uid = $itemObj->uid();
    $uid_select = new XoopsFormSelect(_AM_SSECTION_UID, 'uid', $uid, 1, false);
    $uid_select->setDescription(_AM_SSECTION_UID_DSC);
    $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC";
    $result = $xoopsDB->query($sql);
    $users_array = array();
    $users_array[0] = $xoopsConfig['anonymous'];
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $users_array[$myrow['uid']] = $myrow['uname'];
    }
    $uid_select->addOptionArray($users_array);
    $sform->addElement($uid_select);
    // Datesub
    $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub');
    $datesub_datetime = new SmartsectionFormDateTime(_AM_SSECTION_DATESUB, 'datesub', $size = 15, $datesub);
    $datesub_datetime->setDescription(_AM_SSECTION_DATESUB_DSC);
    $sform->addElement($datesub_datetime);
    // STATUS
    $options = array(_SSECTION_STATUS_PUBLISHED => _AM_SSECTION_PUBLISHED, _SSECTION_STATUS_OFFLINE => _AM_SSECTION_OFFLINE, _SSECTION_STATUS_SUBMITTED => _AM_SSECTION_SUBMITTED, _SSECTION_STATUS_REJECTED => _AM_SSECTION_REJECTED);
    $status_select = new XoopsFormSelect(_AM_SSECTION_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SSECTION_STATUS_DSC);
    $sform->addElement($status_select);
    if (SMARTSECTION_LEVEL > 0) {
        // Short url
        $text_short_url = new XoopsFormText(_AM_SSECTION_ITEM_SHORT_URL, 'short_url', 50, 255, $itemObj->short_url('e'));
        $text_short_url->setDescription(_AM_SSECTION_ITEM_SHORT_URL_DSC);
        $sform->addElement($text_short_url);
        // Meta Keywords
        $text_meta_keywords = new XoopsFormTextArea(_AM_SSECTION_ITEM_META_KEYWORDS, 'meta_keywords', $itemObj->meta_keywords('e'), 7, 60);
        $text_meta_keywords->setDescription(_AM_SSECTION_ITEM_META_KEYWORDS_DSC);
        $sform->addElement($text_meta_keywords);
        // Meta Description
        $text_meta_description = new XoopsFormTextArea(_AM_SSECTION_ITEM_META_DESCRIPTION, 'meta_description', $itemObj->meta_description('e'), 7, 60);
        $text_meta_description->setDescription(_AM_SSECTION_ITEM_META_DESCRIPTION_DSC);
        $sform->addElement($text_meta_description);
    }
    // WEIGHT
    $sform->addElement(new XoopsFormText(_AM_SSECTION_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true);
    if (SMARTSECTION_LEVEL >= 5) {
        // COMMENTS
        $addcomments_radio = new XoopsFormRadioYN(_AM_SSECTION_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
        $sform->addElement($addcomments_radio);
    }
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list = $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read());
    $groups_checkbox->setDescription(_AM_SSECTION_PERMISSIONS_ITEM_DSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    $p_view_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PARTIAL_VIEW, 'partial_view[]', $itemObj->partial_view());
    $p_view_checkbox->setDescription(_AM_SSECTION_PARTIAL_VIEWDSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $p_view_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($p_view_checkbox);
    /*$partial_view_radio = new XoopsFormRadioYN(_AM_SSECTION_PARTIAL_VIEW, 'partial_view', $itemObj->partial_view(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
    	$partial_view_radio->setDescription(_AM_SSECTION_PARTIAL_VIEWDSC);
    	$sform->addElement($partial_view_radio);*/
    if (SMARTSECTION_LEVEL >= 5) {
        // VARIOUS OPTIONS
        $options_tray = new XoopsFormElementTray(_AM_SSECTION_OPTIONS, '<br />');
        $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml());
        $html_checkbox->addOption(1, _AM_SSECTION_DOHTML);
        $options_tray->addElement($html_checkbox);
        $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley());
        $smiley_checkbox->addOption(1, _AM_SSECTION_DOSMILEY);
        $options_tray->addElement($smiley_checkbox);
        $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode());
        $xcodes_checkbox->addOption(1, _AM_SSECTION_DOXCODE);
        $options_tray->addElement($xcodes_checkbox);
        $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage());
        $images_checkbox->addOption(1, _AM_SSECTION_DOIMAGE);
        $options_tray->addElement($images_checkbox);
        $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr());
        $linebreak_checkbox->addOption(1, _AM_SSECTION_DOLINEBREAK);
        $options_tray->addElement($linebreak_checkbox);
        $sform->addElement($options_tray);
    }
    // item ID
    if ($clone) {
        $itemid = 0;
    }
    $sform->addElement(new XoopsFormHidden('itemid', $itemid));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'additem');
    $button_tray->addElement($hidden);
    if (!$itemid) {
        // there's no itemid? Then it's a new item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SSECTION_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SSECTION_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SSECTION_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartsection_close_collapsable('createitemtable', 'createitemicon');
    } else {
        // else, we're editing an existing item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SSECTION_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartsection_close_collapsable('edititemtable', 'edititemicon');
    }
    if (SMARTSECTION_LEVEL >= 5) {
        smartsection_collapsableBar('pagewraptable', 'pagewrapicon', _AM_SSECTION_PAGEWRAP, _AM_SSECTION_PAGEWRAPDSC);
        $dir = smartsection_getUploadDir(true, 'content');
        if (!eregi("777", decoct(fileperms($dir)))) {
            echo "<font color='FF0000'><h4>" . _AM_SSECTION_PERMERROR . "</h4></font>";
        }
        // Upload File
        echo "<form name='form_name2' id='form_name2' action='pw_upload_file.php' method='post' enctype='multipart/form-data'>";
        echo "<table cellspacing='1' width='100%' class='outer'>";
        echo "<tr><th colspan='2'>" . _AM_SSECTION_UPLOAD_FILE . "</th></tr>";
        echo "<tr valign='top' align='left'><td class='head'>" . _AM_SSECTION_SEARCH_PW . "</td><td class='even'><input type='file' name='fileupload' id='fileupload' size='30' /></td></tr>";
        echo "<tr valign='top' align='left'><td class='head'><input type='hidden' name='MAX_FILE_SIZE' id='op' value='500000' /></td><td class='even'><input type='submit' name='submit' value='" . _AM_SSECTION_UPLOAD . "' /></td></tr>";
        echo "<input type='hidden' name='backto' value='{$smartsection_current_page}'/>";
        echo "</table>";
        echo "</form>";
        // Delete File
        $form = new XoopsThemeForm(_AM_SSECTION_DELETEFILE, "form_name", "pw_delete_file.php");
        $pWrap_select = new XoopsFormSelect(smartsection_getUploadDir(true, 'content'), "address");
        $folder = dir($dir);
        while ($file = $folder->read()) {
            if ($file != "." && $file != "..") {
                $pWrap_select->addOption($file, $file);
            }
        }
        $folder->close();
        $form->addElement($pWrap_select);
        $delfile = "delfile";
        $form->addElement(new XoopsFormHidden('op', $delfile));
        $submit = new XoopsFormButton("", "submit", _AM_SSECTION_BUTTON_DELETE, "submit");
        $form->addElement($submit);
        $form->addElement(new XoopsFormHidden('backto', $smartsection_current_page));
        $form->display();
        smartsection_close_collapsable('pagewraptable', 'pagewrapicon');
    }
    unset($hidden);
    if ($itemid != 0) {
        showfiles($itemObj);
    }
}