Esempio n. 1
0
function pathConfiguration()
{
    global $xoopsModule;
    // Upload and Images Folders
    ss_collapsableBar('configtable', 'configtableicon', _AM_SS_PATHCONFIGURATION);
    echo "<br />";
    echo "<table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' ><tr>";
    echo "<td class='bg3'><b>" . _AM_SS_PATH_ITEM . "</b></td>";
    echo "<td class='bg3'><b>" . _AM_SS_PATH . "</b></td>";
    echo "<td class='bg3' align='center'><b>" . _AM_SS_STATUS . "</b></td></tr>";
    echo "<tr><td class='odd'>" . _AM_SS_PATH_FILES . "</td>";
    $upload_path = ss_getUploadDir();
    echo "<td class='odd'>" . $upload_path . "</td>";
    echo "<td class='even' style='text-align: center;'>" . ss_admin_getPathStatus('root') . "</td></tr>";
    echo "<tr><td class='odd'>" . _AM_SS_PATH_IMAGES . "</td>";
    $image_path = ss_getImageDir();
    echo "<td class='odd'>" . $image_path . "</td>";
    echo "<td class='even' style='text-align: center;'>" . ss_admin_getPathStatus('images') . "</td></tr>";
    echo "<tr><td class='odd'>" . _AM_SS_PATH_IMAGES_CATEGORY . "</td>";
    $image_path = ss_getImageDir('category');
    echo "<td class='odd'>" . $image_path . "</td>";
    echo "<td class='even' style='text-align: center;'>" . ss_admin_getPathStatus('images/category') . "</td></tr>";
    echo "<tr><td class='odd'>" . _AM_SS_PATH_IMAGES_ITEM . "</td>";
    $image_path = ss_getImageDir('item');
    echo "<td class='odd'>" . $image_path . "</td>";
    echo "<td class='even' style='text-align: center;'>" . ss_admin_getPathStatus('images/item') . "</td></tr>";
    echo "</table>";
    echo "<br />";
    ss_close_collapsable('configtable', 'configtableicon');
}
Esempio n. 2
0
    case "default":
    default:
        global $xoopsDB, $xoopsModule;
        ss_xoops_cp_header();
        ss_adminMenu(4, _AM_SS_PERMISSIONS);
        // View Categories permissions
        $item_list_view = array();
        $block_view = array();
        // echo "<h3 style='color: #2F5376; '>"._AM_SS_PERMISSIONSADMIN."</h3>\n" ;
        ss_collapsableBar('permissionstable', 'permissionsicon', _AM_SS_PERMISSIONSVIEWMAN, _AM_SS_VIEW_CATS);
        $result_view = $xoopsDB->query("SELECT categoryid, name FROM " . $xoopsDB->prefix("smartsection_categories") . " ");
        if ($xoopsDB->getRowsNum($result_view)) {
            while ($myrow_view = $xoopsDB->fetcharray($result_view)) {
                $item_list_view['cid'] = $myrow_view['categoryid'];
                $item_list_view['title'] = $myrow_view['name'];
                $form_view = new XoopsGroupPermForm("", $xoopsModule->getVar('mid'), "category_read", "");
                $block_view[] = $item_list_view;
                foreach ($block_view as $itemlists) {
                    $form_view->addItem($itemlists['cid'], $itemlists['title']);
                }
            }
            echo $form_view->render();
        } else {
            echo "<img id='toptableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SS_PERMISSIONSVIEWMAN . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" . _AM_SS_NOPERMSSET . "</span>";
        }
        ss_close_collapsable('permissionstable', 'permissionsicon');
        echo "<br />\n";
}
$modfooter = ss_modFooter();
echo "<div align='center'>" . $modfooter . "</div>";
xoops_cp_footer();
Esempio n. 3
0
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);
    }
}
Esempio n. 4
0
$totalsubs = $smartsection_category_handler->getCategoriesCount($sel_cat);
// creating the categories objects that are published
$subcatsObj = $smartsection_category_handler->getCategories(0, 0, $categoriesObj->categoryid());
$totalSCOnPage = count($subcatsObj);
echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
echo "<tr>";
echo "<td width='60' class='bg3' align='left'><b>" . _AM_SS_CATID . "</b></td>";
echo "<td width='20%' class='bg3' align='left'><b>" . _AM_SS_CATCOLNAME . "</b></td>";
echo "<td class='bg3' align='left'><b>" . _AM_SS_SUBDESCRIPT . "</b></td>";
echo "<td width='60' class='bg3' align='right'><b>" . _AM_SS_ACTION . "</b></td>";
echo "</tr>";
if ($totalsubs > 0) {
    foreach ($subcatsObj as $subcat) {
        $modify = "<a href='category.php?op=mod&amp;categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/edit.gif' title='" . _AM_SS_MODIFY . "' alt='" . _AM_SS_MODIFY . "' /></a>";
        $delete = "<a href='category.php?op=del&amp;categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/delete.gif' title='" . _AM_SS_DELETE . "' alt='" . _AM_SS_DELETE . "'/></a>";
        echo "<tr>";
        echo "<td class='head' align='left'>" . $subcat->categoryid() . "</td>";
        echo "<td class='even' align='left'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/category.php?categoryid=" . $subcat->categoryid() . "&parentid=" . $subcat->parentid() . "'>" . $subcat->name() . "</a></td>";
        echo "<td class='even' align='left'>" . $subcat->description() . "</td>";
        echo "<td class='even' align='right'> {$modify} {$delete} </td>";
        echo "</tr>";
    }
} else {
    echo "<tr>";
    echo "<td class='head' align='center' colspan= '7'>" . _AM_SS_NOSUBCAT . "</td>";
    echo "</tr>";
}
echo "</table>\n";
echo "<br />\n";
ss_close_collapsable('subcatstable', 'subcatsicon');
Esempio n. 5
0
function list_groups()
{
    global $xoopsModule, $block_arr;
    ss_collapsableBar('groupstable', 'groupsicon', _AM_SS_GROUPS, _AM_SS_GROUPSINFO);
    foreach (array_keys($block_arr) as $i) {
        $item_list[$block_arr[$i]->getVar("bid")] = $block_arr[$i]->getVar("title");
    }
    $form = new MyXoopsGroupPermForm('', 1, 'block_read', "");
    $form->addAppendix('module_admin', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACTIVERIGHTS);
    $form->addAppendix('module_read', $xoopsModule->mid(), $xoopsModule->name() . ' ' . _AM_ACCESSRIGHTS);
    foreach ($item_list as $item_id => $item_name) {
        $form->addItem($item_id, $item_name);
    }
    echo $form->render();
    ss_close_collapsable('groupstable', 'groupsicon');
}
Esempio n. 6
0
function editcat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null)
{
    global $xoopsDB, $smartsection_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 ssCategory($categoryid);
        if ($showmenu) {
            ss_adminMenu(1, _AM_SS_CATEGORIES . " > " . _AM_SS_EDITING);
        }
        echo "<br />\n";
        if ($categoryObj->notLoaded()) {
            redirect_header("category.php", 1, _AM_SS_NOCOLTOEDIT);
            exit;
        }
        ss_collapsableBar('edittable', 'edittableicon', _AM_SS_EDITCOL, _AM_SS_CATEGORY_EDIT_INFO);
    } else {
        if (!$categoryObj) {
            $categoryObj = $smartsection_category_handler->create();
        }
        if ($showmenu) {
            ss_adminMenu(1, _AM_SS_CATEGORIES . " > " . _AM_SS_CREATINGNEW);
        }
        //echo "<br />\n";
        ss_collapsableBar('createtable', 'createtableicon', _AM_SS_CATEGORY_CREATE, _AM_SS_CATEGORY_CREATE_INFO);
    }
    // Start category form
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    $sform = new XoopsThemeForm(_AM_SS_CATEGORY, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // Name
    $sform->addElement(new XoopsFormText(_AM_SS_CATEGORY, 'name', 50, 255, $categoryObj->name('e')), true);
    // Decsription
    $sform->addElement(new XoopsFormTextArea(_AM_SS_COLDESCRIPT, 'description', $categoryObj->description('e'), 7, 60));
    /*
    // IMAGE
    $image_array = & XoopsLists :: getImgListAsArray( ss_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/smartsection/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'" );
    $image_tray = new XoopsFormElementTray( _AM_SS_IMAGE, '&nbsp;' );
    $image_tray -> addElement( $image_select );
    $image_tray -> addElement( new XoopsFormLabel( '', "<br /><br /><img src='" . ss_getImageDir('category', false) .$categoryObj->image() . "' name='image3' id='image3' alt='' />" ) );
    $image_tray->setDescription(_AM_SS_IMAGE_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_DSC);
    $sform->addElement($file_box);
    */
    // Weight
    $sform->addElement(new XoopsFormText(_AM_SS_COLPOSIT, 'weight', 4, 4, $categoryObj->weight()));
    // READ PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_read_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_CAT_READ, 'groups_read[]', $categoryObj->getGroups_read());
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_read_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_read_checkbox);
    // Apply permissions on all items
    $apply = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0;
    $addapplyall_radio = new XoopsFormRadioYN(_AM_SS_PERMISSIONS_APPLY_ON_ITEMS, 'applyall', $apply, ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($addapplyall_radio);
    // MODERATORS
    //$moderators_tray = new XoopsFormElementTray(_AM_SS_MODERATORS_DEF, '');
    $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="")
    $sform->addElement(new XoopsFormLabel(_AM_SS_PARENT_CATEGORY_EXP, ob_get_contents()));
    ob_end_clean();
    // Added by fx2024
    // sub Categories
    $cat_tray = new XoopsFormElementTray(_AM_SS_SCATEGORYNAME, '<br /><br />');
    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_SS_ADD_OPT, $t->render()));
    $b = new XoopsFormButton('', 'submit', _AM_SS_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_SS_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $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('createtable', 'createtableicon');
    } else {
        // button says 'Update'
        $butt_create = new XoopsFormButton('', '', _AM_SS_MODIFY, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $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('edittable', 'edittableicon');
    }
    //Added by fx2024
    if ($categoryid) {
        include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/displaysubcats.php";
        include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/displayitems.php";
    }
    //end of fx2024 code
    unset($hidden);
}