/** * @param bool $index_by_page * @return array */ function &about_template_lookup($index_by_page = false) { include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; $files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['artdirname'] . '/templates/'); $list = array(); foreach ($files as $file => $name) { // The valid file name must be: art_article_mytpl.html OR art_category-1_your-trial.html if (preg_match('/^' . $GLOBALS['artdirname'] . "_([^_]*)(_(.*))?\\.(tpl|xotpl)\$/i", $name, $matches)) { if (empty($matches[1])) { continue; } if (empty($matches[3])) { $matches[3] = 'default'; } if (empty($index_by_page)) { $list[] = array('file' => $name, 'description' => $matches[3]); } else { $list[$matches[1]][$matches[3]] = $name; } } } $cache_file = empty($index_by_page) ? 'template-list' : 'template-page'; xoops_load('xoopscache'); $key = $GLOBALS['artdirname'] . "_{$cache_file}"; XoopsCache::write($key, $list); //load_functions("cache"); //mod_createCacheFile($list, $cache_file, $GLOBALS["artdirname"]); return $list; }
function &art_template_lookup($index_by_page = false) { include_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/templates/"); $list = array(); foreach ($files as $file => $name) { // The valid file name must be: art_article_mytpl.html OR art_category-1_your-trial.html if (preg_match("/^" . $GLOBALS["ART_VAR_PREFIX"] . "_([^_]*)(_(.*))?\\.(html|xotpl)\$/i", $name, $matches)) { if (empty($matches[1])) { continue; } if (empty($matches[3])) { $matches[3] = "default"; } if (empty($index_by_page)) { $list[] = array("file" => $name, "description" => $matches[3]); } else { $list[$matches[1]][$matches[3]] = $name; } } } $cache_file = empty($index_by_page) ? "template-list" : "template-page"; xoops_load("cache"); $key = $GLOBALS["artdirname"] . "_{$cache_file}"; XoopsCache::write($key, $list); //load_functions("cache"); //mod_createCacheFile($list, $cache_file, $GLOBALS["artdirname"]); return $list; }
} fclose ($fp); } include_once XOOPS_ROOT_PATH."/class/xoopslists.php"; $templates_array = array(); $templates_array = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH."/modules/{$mydirname}/templates/"); foreach($templates_array as $key) { // echo $templates_array[$key]; if ( preg_match('/^xwords/',$templates_array[$key]) ) { $renamefilename = preg_replace('/^xwords(.+)/', "$mydirname$1", $templates_array[$key]); rename( XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/".$templates_array[$key], XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/{$renamefilename}" ); } } $b_templates_array = array(); $b_templates_array = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH."/modules/{$mydirname}/templates/blocks/"); foreach($b_templates_array as $key) { // echo $b_templates_array[$key]; if ( preg_match('/^entries/',$b_templates_array[$key]) ) { $renamefilename = preg_replace('/^entries(.+)/', "$mydirname$1", $b_templates_array[$key]); rename( XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/blocks/".$b_templates_array[$key], XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/blocks/{$renamefilename}" ); } } ?>
/** * @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; }
function &catalog_template_lookup_blocks($index_by_page = false) { include_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . "/modules/" . "catalog" . "/templates/blocks/"); $list = array(); foreach ($files as $file => $name) { if (preg_match("/^" . 'blocks_' . "catalog" . "_([^_]*)(_(.*))?\\.(html|xotpl)\$/i", $name, $matches)) { if (empty($matches[1])) { continue; } if (empty($matches[3])) { $matches[3] = "default"; } if (empty($index_by_page)) { $list[] = array("file" => $name, "description" => $matches[3]); } else { $list[$matches[1]][$matches[3]] = $name; } } } $cache_file = empty($index_by_page) ? "template-list" : "template-page"; xoops_load("cache"); $key = "catalog" . "_{$cache_file}"; XoopsCache::write($key, $list); return $list; }
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 . "'> "; 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, ' '); $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); } }
/** * Build the main tab * * @param PublisherItem $obj data source * @param ContainerInterface $mainTab add elements to this tab/form * * @return void */ private function buildMainTab(PublisherItem $obj, ContainerInterface $mainTab) { $xoops = Xoops::getInstance(); $publisher = Publisher::getInstance(); // Category $category_select = new Xoops\Form\Select(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e')); $category_select->setDescription(_CO_PUBLISHER_CATEGORY_DSC); $category_select->addOptionArray($publisher->getCategoryHandler()->getCategoriesForSubmit()); $mainTab->addElement($category_select); // ITEM TITLE $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true); // SUBTITLE if ($this->isGranted(_PUBLISHER_SUBTITLE)) { $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e'))); } // SHORT URL if ($this->isGranted(_PUBLISHER_ITEM_SHORT_URL)) { $text_short_url = new Xoops\Form\Text(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->getVar('short_url', 'e')); $text_short_url->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC); $mainTab->addElement($text_short_url); } // TAGS if ($xoops->isActiveModule('tag') && $this->isGranted(_PUBLISHER_ITEM_TAG)) { include_once $xoops->path('modules/tag/include/formtag.php'); $text_tags = new Tag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0); $mainTab->addElement($text_tags); } $this->buildEditors($obj, $mainTab); $this->buildTSOptions($obj, $mainTab); // Available pages to wrap if ($this->isGranted(_PUBLISHER_AVAILABLE_PAGE_WRAP)) { $wrap_pages = XoopsLists::getHtmlListAsArray(PublisherUtils::getUploadDir(true, 'content')); $available_wrap_pages_text = array(); foreach ($wrap_pages as $page) { $available_wrap_pages_text[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");'" . " onmouseover='style.cursor=\"pointer\"'>{$page}</span>"; } $available_wrap_pages = new Xoops\Form\Label(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text)); $available_wrap_pages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC); $mainTab->addElement($available_wrap_pages); } // Uid /* We need to retrieve 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(_PUBLISHER_UID)) { $uid_select = new Xoops\Form\SelectUser(_CO_PUBLISHER_UID, 'uid', true, array($obj->getVar('uid', 'e')), 1, false); $uid_select->setDescription(_CO_PUBLISHER_UID_DSC); $mainTab->addElement($uid_select); } // Author Alias if ($this->isGranted(_PUBLISHER_AUTHOR_ALIAS)) { $element = new Xoops\Form\Text(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e')); $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC); $mainTab->addElement($element); unset($element); } // STATUS if ($this->isGranted(_PUBLISHER_STATUS)) { $options = array(_PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, _PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, _PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, _PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED); $status_select = new Xoops\Form\Select(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status')); $status_select->addOptionArray($options); $status_select->setDescription(_CO_PUBLISHER_STATUS_DSC); $mainTab->addElement($status_select); unset($status_select); } // Datesub if ($this->isGranted(_PUBLISHER_DATESUB)) { $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub'); $datesub_datetime = new Xoops\Form\DateTime(_CO_PUBLISHER_DATESUB, 'datesub', $datesub); $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC); $mainTab->addElement($datesub_datetime); } // NOTIFY ON PUBLISH if ($this->isGranted(_PUBLISHER_NOTIFY)) { $notify_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_NOTIFY, 'notify', $obj->getVar('notifypub')); $mainTab->addElement($notify_radio); } }