/** * Displayes xoopsCode buttons and target textarea to which xoopscodes are inserted * * @param string $textarea_id a unique id of the target textarea * @param int $cols * @param int $rows * @param null $suffix */ function xoopsCodeTarea($textarea_id, $cols = 60, $rows = 15, $suffix = null) { xoops_load('XoopsFormDhtmlTextArea'); $hiddenText = isset($suffix) ? 'xoopsHiddenText' . trim($suffix) : 'xoopsHiddenText'; $content = isset($GLOBALS[$textarea_id]) ? $GLOBALS[$textarea_id] : ''; $text_editor = new XoopsFormDhtmlTextArea('', $textarea_id, $content, $rows, $cols, $hiddenText); $text_editor->htmlEditor = null; $text_editor->smilies = false; echo $text_editor->render(); }
/** * @public */ public static function renderBBCode(&$html, $params) { if (!XC_CLASS_EXISTS('xoopsformelement')) { require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; } $form = new XoopsFormDhtmlTextArea($params['name'], $params['name'], $params['value'], $params['rows'], $params['cols']); $form->setId($params['id']); if ($params['class'] != null) { $form->setClass($params['class']); } $html = $form->render(); }
function smarty_function_xoopsdhtmltarea($params, &$smarty) { if (!class_exists('xoopsformelement')) { require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; } $form = null; if (isset($params['name'])) { $name = trim($params['name']); $rows = isset($params['rows']) ? intval($params['rows']) : 5; $cols = isset($params['cols']) ? intval($params['cols']) : 50; $value = isset($params['value']) ? trim($params['value']) : ""; $form = new XoopsFormDhtmlTextArea($name, $name, $value, $rows, $cols); print $form->render(); } }
function smarty_function_xoopsdhtmltarea($params, &$smarty) { if (!class_exists('xoopsformelement')) { require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; } $form = null; if (!empty($params['name'])) { $name = trim($params['name']); $rows = isset($params['rows']) ? intval($params['rows']) : 5; $cols = isset($params['cols']) ? intval($params['cols']) : 50; $value = isset($params['value']) ? $params['value'] : ""; $form = new XoopsFormDhtmlTextArea($name, $name, $value, $rows, $cols); $rendered = $form->render(); print '<div id="' . $name . '_bbcode_buttons_pre" style="' . @$params['pre_style'] . '">' . str_replace(array('<textarea', '</textarea><br />'), array('</div><textarea', '</textarea><div id="' . $name . '_bbcode_buttons_post" style="' . @$params['post_style'] . '">'), $rendered) . '</div>'; } }
function form_edit($bid, $mode = 'edit') { $bid = intval($bid); //HACK by domifara $block = new XoopsBlock($bid); if (!$block->getVar('bid')) { // new defaults $bid = 0; $mode = 'new'; $block->setVar('mid', 0); $block->setVar('block_type', 'C'); } switch ($mode) { case 'clone': $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM; $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE; $next_op = 'clone_ok'; // breadcrumbs $breadcrumbsObj =& AltsysBreadcrumbs::getInstance(); $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM); break; case 'new': $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM; $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW; $next_op = 'new_ok'; // breadcrumbs $breadcrumbsObj =& AltsysBreadcrumbs::getInstance(); $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM); break; case 'edit': default: $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM; $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT; $next_op = 'edit_ok'; // breadcrumbs $breadcrumbsObj =& AltsysBreadcrumbs::getInstance(); $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM); break; } $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false; $block_template = $block->getVar('template', 'n'); $block_template_tplset = ''; if (!$is_custom && $block_template) { // find template of the block $tplfile_handler =& xoops_gethandler('tplfile'); $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template); $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default'; } //HACK by domifara /* if ( !($block->getVar('c_type')) ){ $block->setVar('c_type','S'); } */ $block_data = $this->preview_request + array('bid' => $bid, 'name' => $block->getVar('name', 'n'), 'title' => $block->getVar('title', 'n'), 'weight' => intval($block->getVar('weight')), 'bcachetime' => intval($block->getVar('bcachetime')), 'side' => intval($block->getVar('side')), 'visible' => intval($block->getVar('visible')), 'template' => $block_template, 'template_tplset' => $block_template_tplset, 'options' => $block->getVar('options'), 'content' => $block->getVar('content', 'n'), 'is_custom' => $is_custom, 'type' => $block->getVar('block_type'), 'ctype' => $block->getVar('c_type')); $block4assign = array('name_raw' => $block_data['name'], 'title_raw' => $block_data['title'], 'content_raw' => $block_data['content'], 'cell_position' => $this->renderCell4BlockPosition($block_data), 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data), 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data), 'cell_options' => $this->renderCell4BlockOptions($block_data), 'content_preview' => $this->previewContent($block_data)) + $block_data; // display require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php'; $tpl = new D3Tpl(); //dhtml include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; if ($block_data['ctype'] == 'H' || empty($block_data['ctype'])) { $editor_configs = array(); $editor_configs["name"] = "content_block"; $editor_configs["value"] = $block_data['content']; $editor_configs["rows"] = 20; $editor_configs["cols"] = 100; $editor_configs["width"] = "100%"; $editor_configs["height"] = "400px"; $editor_configs["editor"] = xoops_getModuleOption('blocks_editor', 'system'); $form = new XoopsFormEditor('', "textarea_content", $editor_configs); $rendered = $form->render(); $tpl->assign('altsys_x25_dhtmltextarea', $rendered); } else { $form = new XoopsFormDhtmlTextArea('', 'textarea_content', $block_data['content'], 80, 20); $rendered = $form->render(); $rendered = '<div id="textarea_content_bbcode_buttons_pre" style="display:block;">' . str_replace(array('<textarea', '</textarea><br />'), array('</div><textarea', '</textarea><div id="textarea_content_bbcode_buttons_post" style="display:block;">'), $rendered) . '</div>'; $tpl->assign('altsys_x25_dhtmltextarea', $rendered); } $tpl->assign(array('target_dirname' => $this->target_dirname, 'target_mname' => $this->target_mname, 'language' => $this->lang, 'cachetime_options' => $this->cachetime_options, 'ctype_options' => $this->ctype_options, 'block' => $block4assign, 'op' => $next_op, 'form_title' => $form_title, 'submit_button' => $button_value, 'common_fck_installed' => file_exists(XOOPS_ROOT_PATH . '/common/fckeditor/fckeditor.js'), 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin'))); //HACK by domifara $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html'); return; }
$form->addElement($side_select); $form->addElement(new XoopsFormText(_AM_WEIGHT, "bweight", 2, 5, $block['weight'])); $form->addElement(new XoopsFormRadioYN(_AM_VISIBLE, 'bvisible', $block['visible'])); $mod_select = new XoopsFormSelect(_AM_VISIBLEIN, "bmodule", $block['modules'], 5, true); $module_handler =& xoops_gethandler('module'); $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); $criteria->add(new Criteria('isactive', 1)); $module_list =& $module_handler->getList($criteria); $module_list[-1] = _AM_TOPPAGE; $module_list[0] = _AM_ALLPAGES; ksort($module_list); $mod_select->addOptionArray($module_list); $form->addElement($mod_select); $form->addElement(new XoopsFormText(_AM_TITLE, 'btitle', 50, 255, $block['title']), false); if ($block['is_custom']) { $textarea = new XoopsFormDhtmlTextArea(_AM_CONTENT, 'bcontent', $block['content'], 15, 70); $textarea->setDescription('<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>'); $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); } else { if ($block['template'] != '') { $tplfile_handler =& xoops_gethandler('tplfile'); $btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']); if (count($btemplate) > 0) { $form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate[0]->getVar('tpl_id') . '">' . _AM_EDITTPL . '</a>')); } else { $btemplate2 =& $tplfile_handler->find('default', 'block', $block['bid']); if (count($btemplate2) > 0) { $form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="' . XOOPS_URL . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate2[0]->getVar('tpl_id') . '" target="_blank">' . _AM_EDITTPL . '</a>'));
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, ' '); $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); } }
$file_box->setDescription(sprintf(_CO_SPARTNER_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height'])); $form->addElement($file_box); // IMAGE_URL $image_url_text = new XoopsFormText(_CO_SPARTNER_IMAGE_URL, 'image_url', 50, 255, ''); $image_url_text->setDescription(_CO_SPARTNER_IMAGE_URL_DSC); $form->addElement($image_url_text, false); // URL $url_text = new XoopsFormText(_CO_SPARTNER_URL, 'url', 50, 255, ''); $url_text->setDescription(_CO_SPARTNER_URL_DSC); $form->addElement($url_text, false); // SUMMARY $summary_text = new XoopsFormTextArea(_CO_SPARTNER_SUMMARY, 'summary', '', 7, 60); $summary_text->setDescription(_CO_SPARTNER_SUMMARY_DSC); $form->addElement($summary_text, true); // DESCRIPTION $description_text = new XoopsFormDhtmlTextArea(_CO_SPARTNER_DESCRIPTION, 'description', '', 15, 60); $description_text->setDescription(_CO_SPARTNER_DESCRIPTION_DSC); $form->addElement($description_text, false); // CONTACT_NAME $contact_name_text = new XoopsFormText(_CO_SPARTNER_CONTACT_NAME, 'contact_name', 50, 255, ''); $contact_name_text->setDescription(_CO_SPARTNER_CONTACT_NAME_DSC); $form->addElement($contact_name_text, false); // CONTACT_EMAIL $contact_email_text = new XoopsFormText(_CO_SPARTNER_CONTACT_EMAIL, 'contact_email', 50, 255, ''); $contact_email_text->setDescription(_CO_SPARTNER_CONTACT_EMAIL_DSC); $form->addElement($contact_email_text, false); // EMAIL_PRIV $email_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_EMAILPRIV, 'email_priv', 0); $email_priv_radio->setDescription(_CO_SPARTNER_CONTACT_EMAILPRIV_DSC); $form->addElement($email_priv_radio); // CONTACT_PHONE
$current_op = @$_GET['op'] == 'clone' ? 'clone' : 'edit'; $uri_to_myself = XOOPS_URL . "/modules/blocksadmin/admin/admin.php?fct=blocksadmin&op={$current_op}&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}&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}&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); } else { if ($block['template'] != '' && !defined('XOOPS_ORETEKI')) { $tplfile_handler =& xoops_gethandler('tplfile'); $btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']); if (count($btemplate) > 0) {
} else { $v = $xoopsConfig['anonymous']; } break; case 'integer': if ($field['name'] == 'hits') { $field['input'] = $v; } break; case 'date': if (empty($v)) { $v = formatTimestamp(time(), 'Y-m-d'); } break; case 'text': $text = new XoopsFormDhtmlTextArea('', $field['name'], $v, 10, 50); $field['input'] = $text->render(); if ($field['name'] == 'description') { $cur = $content->getVar('style'); if (empty($cur)) { $cur = 'b'; } $style = new XoopsFormSelect('', 'style', $cur); $style->addOptionArray($edit_style); $field['option'] = "<br/>" . _MD_CONTENT_STYLE . " " . $style->render(); } } if (is_array($field)) { $field['value'] = $v; } if (preg_match('/\\*$/', $field['label'])) {
function getTextArea($key) { $var = $this->targetObject->vars[$key]; // if no control has been created, let's create a default one if (!isset($this->targetObject->controls[$key])) { $control = array('name' => 'textarea', 'itemHandler' => false, 'method' => false, 'module' => false, 'form_editor' => 'default'); } else { $control = $this->targetObject->controls[$key]; } $xoops22 = smart_isXoops22(); $form_editor = isset($control['form_editor']) ? $control['form_editor'] : 'textarea'; /** * If the editor is 'default', retreive the default editor of this module */ if ($form_editor == 'default') { global $xoopsModuleConfig; $form_editor = isset($xoopsModuleConfig['default_editor']) ? $xoopsModuleConfig['default_editor'] : 'textarea'; } $caption = $var['form_caption']; $name = $key; $value = $this->targetObject->getVar($key); $value = $this->targetObject->getValueFor($key, true); $editor_configs = array(); $editor_configs["name"] = $name; $editor_configs["value"] = $value; if ($form_editor != 'textarea') { $editor_configs["rows"] = 35; $editor_configs["cols"] = 60; } if (isset($control['rows'])) { $editor_configs["rows"] = $control['rows']; } if (isset($control['cols'])) { $editor_configs["cols"] = $control['cols']; } $editor_configs["width"] = "100%"; $editor_configs["height"] = "400px"; $dhtml = true; $xoopseditorclass = XOOPS_ROOT_PATH . '/class/xoopsform/formeditor.php'; if (file_exists($xoopseditorclass)) { include_once $xoopseditorclass; $editor = new XoopsFormEditor($caption, $form_editor, $editor_configs, $nohtml = false, $onfailure = "textarea"); } else { switch ($form_editor) { case 'tiny': if (!$xoops22) { if (is_readable(XOOPS_ROOT_PATH . "/class/xoopseditor/tinyeditor/formtinytextarea.php")) { include_once XOOPS_ROOT_PATH . "/class/xoopseditor/tinyeditor/formtinytextarea.php"; $editor = new XoopsFormTinyTextArea(array('caption' => $caption, 'name' => $name, 'value' => $value, 'width' => '100%', 'height' => '300px'), true); } else { if ($dhtml) { $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); } else { $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); } } } else { $editor = new XoopsFormEditor($caption, "tinyeditor", $editor_configs); } break; case 'dhtmltextarea': case 'dhtmltext': $editor = new XoopsFormDhtmlTextArea($var['form_caption'], $key, $this->targetObject->getVar($key, 'e'), 20, 60); if ($var['form_dsc']) { $editor->setDescription($var['form_dsc']); } break; case 'fckeditor': if (!$xoops22) { if (is_readable(XOOPS_ROOT_PATH . "/class/xoopseditor/fckeditor/formfckeditor.php")) { include_once XOOPS_ROOT_PATH . "/class/xoopseditor/fckeditor/formfckeditor.php"; $editor = new XoopsFormFckeditor(array('caption' => $caption, 'name' => $name, 'value' => $value, 'width' => '100%', 'height' => '300px'), true); } else { if ($dhtml) { $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); } else { $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); } } } else { $editor = new XoopsFormEditor($caption, "fckeditor", $editor_configs); } break; case 'inbetween': if (!$xoops22) { if (is_readable(XOOPS_ROOT_PATH . "/class/xoopseditor/inbetween/forminbetweentextarea.php")) { include_once XOOPS_ROOT_PATH . "/class/xoopseditor/inbetween/forminbetweentextarea.php"; $editor = new XoopsFormInbetweenTextArea(array('caption' => $caption, 'name' => $name, 'value' => $value, 'width' => '100%', 'height' => '300px'), true); } else { if ($dhtml) { $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); } else { $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); } } } else { $editor = new XoopsFormEditor($caption, "inbetween", $editor_configs); } break; case 'koivi': if (!$xoops22) { if (is_readable(XOOPS_ROOT_PATH . "/class/wysiwyg/formwysiwygtextarea.php")) { include_once XOOPS_ROOT_PATH . "/class/wysiwyg/formwysiwygtextarea.php"; $editor = new XoopsFormWysiwygTextArea($caption, $name, $value, '100%', '400px'); } else { if ($dhtml) { $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60); } else { $editor = new XoopsFormTextArea($caption, $name, $value, 7, 60); } } } else { $editor = new XoopsFormEditor($caption, "koivi", $editor_configs); } break; case "spaw": if (!$xoops22) { if (is_readable(XOOPS_ROOT_PATH . "/class/spaw/formspaw.php")) { include_once XOOPS_ROOT_PATH . "/class/spaw/formspaw.php"; $editor = new XoopsFormSpaw($caption, $name, $value); } } else { $editor = new XoopsFormEditor($caption, "spaw", $editor_configs); } break; case "htmlarea": if (!$xoops22) { if (is_readable(XOOPS_ROOT_PATH . "/class/htmlarea/formhtmlarea.php")) { include_once XOOPS_ROOT_PATH . "/class/htmlarea/formhtmlarea.php"; $editor = new XoopsFormHtmlarea($caption, $name, $value); } } else { $editor = new XoopsFormEditor($caption, "htmlarea", $editor_configs); } break; default: case 'textarea': $form_rows = isset($control['rows']) ? $control['rows'] : 5; $form_cols = isset($control['cols']) ? $control['cols'] : 60; $editor = new XoopsFormTextArea($var['form_caption'], $key, $this->targetObject->getVar($key, 'e'), $form_rows, $form_cols); if ($var['form_dsc']) { $editor->setDescription($var['form_dsc']); } break; } } return $editor; }
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); $diduno_text->setDescription(_MD_SF_DIDUNO_FAQ_DSC); $form->addElement($diduno_text); // CONTEXT MODULE LINK // Retreive the list of module currently installed. The key value is the dirname /*$module_handler = &xoops_gethandler('module'); $modules_array = $module_handler->getList(null, true); $modulelink_select_array = array("url" => _MD_SF_SPECIFIC_URL_SELECT);
echo "<select id='tcontColor' onchange='setVisible(\"tconthiddenText\");setElementColor(\"tconthiddenText\",this.options[this.selectedIndex].value);'>\n"; echo "<option value='COLOR'>" . _COLOR . "</option>\n"; foreach ($colorarray as $color1) { foreach ($colorarray as $color2) { foreach ($colorarray as $color3) { echo "<option value='" . $color1 . $color2 . $color3 . "' style='background-color:#" . $color1 . $color2 . $color3 . ";color:#" . $color1 . $color2 . $color3 . ";'>#" . $color1 . $color2 . $color3 . "</option>\n"; } } } echo "</select><span id='tconthiddenText'>" . _EXAMPLE . "</span>\n"; echo "<br /><input type='checkbox' id='tcontBold' onclick='setVisible(\"tconthiddenText\");makeBold(\"tconthiddenText\");' /><b>B</b> <input type='checkbox' id='tcontItalic' onclick='setVisible(\"tconthiddenText\");makeItalic(\"tconthiddenText\");' /><i>I</i> <input type='checkbox' id='tcontUnderline' onclick='setVisible(\"tconthiddenText\");makeUnderline(\"tconthiddenText\");' /><u>U</u> <input type='textbox' id='tcontAddtext' size='20' /> <input type='button' onclick='xoopsCodeText(\"tcont\")' value='" . _ADD . "'><br /><br /><textarea id='tcont' name='tcont' wrap='virtual' cols='80' rows='20'>"; if (isset($tcont)) { echo $tcont; } echo "</textarea><br />\n"; $desc = new XoopsFormDhtmlTextArea('', 'tcont'); echo $desc->renderSmileys(); //xoopsSmilies("tcont"); if (!empty($xoopsConfig['allow_html'])) { echo "<tr><td><p>" . _MD_ALLOWEDHTML . "<br />"; echo get_allowed_html(); echo "</p></td></tr>"; } echo "<tr><td><input type=\"checkbox\" name=\"xsmiley\" value=\"1\""; if (!empty($xsmiley)) { echo " checked=\"checked\""; } echo "> " . _MD_DISSMILEY . "</td></tr>"; echo "<tr><td><input type=\"checkbox\" name=\"xhtml\" value=\"1\""; if (!empty($xhtml)) { echo " checked=\"checked\"";
/** * Prepare HTML for output * * @return string HTML */ function render() { // include files include_once XOOPS_ROOT_PATH . '' . $this->getUrl() . '/include/functions.inc.php'; include_once getLanguage($this->getUrl()); static $koivi_js_loaded = false; static $koivi_tabletools_loaded = false; $url = XOOPS_URL . '' . $this->getUrl(); $skinUrl = $url . '/skins/' . $this->getSkin(); $isie = checkBrowser(); $toggleMode = false; $themeCss = false; $colorPalette = false; $extraDivs = ''; // show dhtml textarea for non compatible browsers if (!checkBrowser(false)) { $textarea = new XoopsFormDhtmlTextArea($this->getCaption(), $this->getName(), $this->getValue(), 15, 60, ''); return $textarea->render(); } if (!$koivi_js_loaded) { $form = '<script language="JavaScript" type="text/javascript" src="' . $url . '/include/js/cntextmenu.js"></script>'; $form .= '<script language="JavaScript" type="text/javascript" src="' . $url . '/include/js/editor.js"></script>'; $form .= '<script language="JavaScript" type="text/javascript" src="' . $url . '/include/js/xhtml.js"></script>'; $koivi_js_loaded = true; } else { $form = ''; } if (in_array('createtable', $this->getOptions()) && $koivi_tabletools_loaded == false) { $form .= '<script language="JavaScript" type="text/javascript" src="' . $url . '/include/js/table_tools.js"></script>'; $koivi_tabletools_loaded = true; } $form .= '<link href="' . $skinUrl . '/' . $this->getSkin() . '.css" rel="Stylesheet" type="text/css" /> <div id="alleditor' . $this->getName() . '" style="width:' . $this->getWidth() . ';border:1px solid silver;"> <div id="toolbar' . $this->getName() . '" class="' . $this->getSkin() . 'toolbarBackCell">'; if (in_array('floating', $this->getOptions())) { $form .= ' <div class="' . $this->getSkin() . 'editorStatus"> <img alt="" src="' . $skinUrl . '/minimize.gif" onclick="XK_hideToolbar(\'' . $this->getName() . '\',\'' . $skinUrl . '\')" /> <img id="floatButton' . $this->getName() . '" alt="' . _XK_FLOAT . '" title="' . _XK_FLOAT . '" src="' . $skinUrl . '/floating.gif" onclick="XK_floatingToolbar(\'' . $this->getName() . '\',\'' . $this->getSkin() . '\')"/> <img id="maximizeButton' . $this->getName() . '" alt="' . _XK_FLOAT . '" title="' . _XK_FLOAT . '" src="' . $skinUrl . '/fullscreen.gif" onclick="XK_maximizeEditor(\'' . $this->getName() . '\')"/> </div>'; } $form .= '<div id="buttons' . $this->getName() . '" class="' . $this->getSkin() . 'toolBar">'; foreach ($this->getOptions() as $tool) { switch (strtolower($tool)) { case "bold": $form .= '<img alt="' . _XK_BOLD . '" title="' . _XK_BOLD . '" src="' . $skinUrl . '/bold.gif" onmousedown="XK_doTextFormat(\'bold\',\'\',\'' . $this->getName() . '\')" />'; break; case "cellalign": $form .= '<img alt="' . _XK_CELLALIGN . '" title="' . _XK_CELLALIGN . '" src="' . $skinUrl . '/cellalign.gif"/>'; $form .= '<img alt="' . _XK_CELLALIGN . '" title="' . _XK_CELLALIGN . '" id="cellpropbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_useTableDivs(\'' . $this->getName() . '\',\'align\')"/>'; $extraDivs .= $this->_renderCellAlign(); break; case "cellborders": $form .= '<img alt="' . _XK_CELLPROPS . '" title="' . _XK_CELLPROPS . '" src="' . $skinUrl . '/cellborders.gif" onmousedown="XK_TTools(\'' . $this->getName() . '\',\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=cellProps&skin=' . $this->getSkin() . '&url=' . $this->getUrl() . '\',\'table\',400,260)"/>'; $form .= '<img alt="' . _XK_CELLALIGN . '" title="' . _XK_CELLALIGN . '" id="cbbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_useTableDivs(\'' . $this->getName() . '\',\'borders\')"/>'; $extraDivs .= $this->_renderCellBorders(); break; case "cellcolor": $form .= '<img alt="' . _XK_FORECOLOR . '" id="cellcolor' . $this->getName() . '" title="' . _XK_FORECOLOR . '" src="' . $skinUrl . '/cellcolor.gif" onclick="XK_color(\'' . $this->getName() . '\',\'cellcolor\',\'cellcolor\')"/>'; $colorPalette = true; break; case "code": $form .= '<img alt="' . _XK_CODE . '" title="' . _XK_CODE . '" src="' . $skinUrl . '/code.gif" onmousedown="XK_doTextFormat(\'Code\',\'\',\'' . $this->getName() . '\')"/>'; break; case "copy": $form .= '<img alt="' . _XK_COPY . '" title="' . _XK_COPY . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'copy\',\'\',\'' . $this->getName() . '\')"/>'; break; case "createlink": $form .= '<img alt="' . _XK_CREATELINK . '" title="' . _XK_CREATELINK . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'createlink\',\'\',\'' . $this->getName() . '\')"/>'; break; case "createtable": $form .= '<img alt="' . _XK_INSERTTABLE . '" title="' . _XK_INSERTTABLE . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_openPopup(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=table&url=' . $this->getUrl() . '\',\'table\',400,290)"/>'; $form .= '<img alt="' . _XK_CREATEQUICKTABLE . '" id="tablebutton' . $this->getName() . '" title="' . _XK_CREATEQUICKTABLE . '" src="' . $skinUrl . '/popup.gif" onclick="XK_showHideDiv(\'' . $this->getName() . '\',\'tablebutton\',\'tablepicker\')"/>'; $extraDivs .= $this->_renderQuickTable(); break; case "cut": $form .= '<img alt="' . _XK_CUT . '" title="' . _XK_CUT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'cut\',\'\',\'' . $this->getName() . '\')"/>'; break; case "fontname": $form .= '<select id="fontname' . $this->getName() . '" class="' . $this->getSkin() . 'selectInput" onchange="XK_doTextFormat(\'fontname\',this.options[this.selectedIndex].value,\'' . $this->getName() . '\')"><option value="">' . _XK_FONT . '</option>'; foreach ($this->getFonts() as $fontname => $font) { $form .= '<option value="' . $font . '">' . $fontname . '</option>'; } $form .= '</select>'; break; case "fontsize": $form .= ' <select id="fontsize' . $this->getName() . '" class="' . $this->getSkin() . 'selectInput" onchange="XK_doTextFormat(\'fontsize\',this.options[this.selectedIndex].value,\'' . $this->getName() . '\')""> <option value="">' . _XK_FONT_SIZE . '</option> <option value="-2">' . _XK_FONT_XSMALL . '</option> <option value="-1">' . _XK_FONT_SMALL . '</option> <option value="+0">' . _XK_FONT_MEDIUM . '</option> <option value="+1">' . _XK_FONT_LARGE . '</option> <option value="+2">' . _XK_FONT_XLARGE . '</option> <option value="+4">' . _XK_FONT_XXLARGE . '</option> </select>'; break; case "forecolor": $form .= '<img alt="' . _XK_FORECOLOR . '" id="forecolor' . $this->getName() . '" title="' . _XK_FORECOLOR . '" src="' . $skinUrl . '/forecolor.gif" onclick="XK_color(\'' . $this->getName() . '\',\'forecolor\',\'forecolor\')"/>'; $colorPalette = true; break; case "formatblock": $form .= ' <select id="formatblock' . $this->getName() . '" class="' . $this->getSkin() . 'selectInput" onchange="XK_doTextFormat(\'formatblock\',this.options[this.selectedIndex].value,\'' . $this->getName() . '\')"> <option value="">' . _XK_FONT_FORMAT . '</option> <option value="<p>">' . _XK_FONT_NONE . '</option> <option value="<h1>">' . _XK_FONT_HEADING1 . '</option> <option value="<h2>">' . _XK_FONT_HEADING2 . '</option> <option value="<h3>">' . _XK_FONT_HEADING3 . '</option> <option value="<h4>">' . _XK_FONT_HEADING4 . '</option> <option value="<h5>">' . _XK_FONT_HEADING5 . '</option> <option value="<h6>">' . _XK_FONT_HEADING6 . '</option> <option value="<p>">' . _XK_FONT_PARAGRAPH . '</option> <option value="<pre>">' . _XK_FONT_FORMATTED . '</option> <option value="<address>">' . _XK_FONT_ADDRESS . '</option> </select>'; break; case "hilitecolor": $form .= '<img alt="' . _XK_HILITECOLOR . '" id="hilitecolor' . $this->getName() . '" title="' . _XK_HILITECOLOR . '" src="' . $skinUrl . '/hilitecolor.gif" onclick="XK_color(\'' . $this->getName() . '\',\'hilitecolor\',\'hilitecolor\')"/>'; $colorPalette = true; break; case "imagemanager": $form .= '<img alt="' . _XK_INSERTIMAGEM . '" title="' . _XK_INSERTIMAGEM . '" onmouseover="style.cursor=\'hand\'" onmousedown="javascript:openWithSelfMain(\'' . XOOPS_URL . '/imagemanager.php?target=' . $this->getName() . '\',\'imgmanager\',400,430);" src="' . $skinUrl . '/imagemanager.gif"/>'; break; case "imageproperties": $form .= '<img alt="' . _XK_EDITIMAGE . '" title="' . _XK_EDITIMAGE . '" src="' . $skinUrl . '/imageprops.gif" onmousedown="XK_openPopup(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=imageProps&url=' . $this->getUrl() . '&skin=' . $this->getSkin() . '\',\'table\',400,260)"/>'; break; case "indent": $form .= '<img alt="' . _XK_INDENT . '" title="' . _XK_INDENT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'indent\',\'\',\'' . $this->getName() . '\')"/>'; break; case "inserthorizontalrule": $form .= '<img alt="' . _XK_INSERTHORIZONTALRULE . '" title="' . _XK_INSERTHORIZONTALRULE . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'inserthorizontalrule\',\'\',\'' . $this->getName() . '\')"/>'; break; case 'insertanchor': $form .= '<img alt="' . _XK_INSERTANCHOR . '" title="' . _XK_INSERTANCHOR . '" src="' . $skinUrl . '/insertanchor.gif" onmousedown="XK_insertAnchor(\'' . $this->getName() . '\')"/>'; break; case "insertdate": $form .= '<img alt="' . _XK_INSERTDATE . '" title="' . _XK_INSERTDATE . '" src="' . $skinUrl . '/insertdate.gif" onmousedown="XK_insertDate(\'' . $this->getName() . '\')"/>'; break; case "insertimage": $form .= '<img alt="' . _XK_INSERTIMAGE . '" title="' . _XK_INSERTIMAGE . '" src="' . $skinUrl . '/insertimage.gif" onmousedown="XK_doTextFormat(\'insertimage\',\'\',\'' . $this->getName() . '\')"/>'; break; case "insertorderedlist": $form .= '<img alt="' . _XK_INSERTORDEREDLIST . '" title="' . _XK_INSERTORDEREDLIST . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'insertorderedlist\',\'\',\'' . $this->getName() . '\')"/>'; break; case "insertunorderedlist": $form .= '<img alt="' . _XK_INSERTUNORDEREDLIST . '" title="' . _XK_INSERTUNORDEREDLIST . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'insertunorderedlist\',\'\',\'' . $this->getName() . '\')"/>'; break; case "insertsymbols": $form .= $this->_renderInsertSymbols(); break; case "italic": $form .= '<img alt="' . _XK_ITALIC . '" title="' . _XK_ITALIC . '" src="' . $skinUrl . '/italic.gif" onmousedown="XK_doTextFormat(\'italic\',\'\',\'' . $this->getName() . '\')"/>'; break; case "justifycenter": $form .= '<img alt="' . _XK_JUSTIFYCENTER . '" title="' . _XK_JUSTIFYCENTER . '" src="' . $skinUrl . '/justifycenter.gif" onmousedown="XK_doTextFormat(\'justifycenter\',\'\',\'' . $this->getName() . '\')"/>'; break; case "justifyfull": $form .= '<img alt="' . _XK_JUSTIFYFULL . '" title="' . _XK_JUSTIFYFULL . '" src="' . $skinUrl . '/justifyfull.gif" onmousedown="XK_doTextFormat(\'justifyfull\',\'\',\'' . $this->getName() . '\')"/>'; break; case "justifyleft": $form .= '<img alt="' . _XK_JUSTIFYLEFT . '" title="' . _XK_JUSTIFYLEFT . '" src="' . $skinUrl . '/justifyleft.gif" onmousedown="XK_doTextFormat(\'justifyleft\',\'\',\'' . $this->getName() . '\')"/>'; break; case "justifyright": $form .= '<img alt="' . _XK_JUSTIFYRIGHT . '" title="' . _XK_JUSTIFYRIGHT . '" src="' . $skinUrl . '/justifyright.gif" onmousedown="XK_doTextFormat(\'justifyright\',\'\',\'' . $this->getName() . '\')"/>'; break; case "ltr": $form .= '<img alt="' . _XK_LEFTTORIGHT . '" title="' . _XK_LEFTTORIGHT . '" src="' . $skinUrl . '/ltr.gif" onmousedown="XK_textDirection(\'ltr\',\'' . $this->getName() . '\')"/>'; break; case "newline": $form .= '<br />'; break; case 'newparagraph': if ($isie) { $form .= '<input class="' . $this->getSkin() . 'checkbox" type="checkbox" alt="' . _XK_NEWPARAGRAPH . '" title="' . _XK_NEWPARAGRAPH . '" id="ptagenabled' . $this->getName() . '" onclick="XK_destroyPTag(\'' . $this->getName() . '\')">'; } break; case "outdent": $form .= '<img alt="' . _XK_OUTDENT . '" title="' . _XK_OUTDENT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'outdent\',\'\',\'' . $this->getName() . '\')"/>'; break; case "paste": $form .= '<img alt="' . _XK_PASTE . '" title="' . _XK_PASTE . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'paste\',null,\'' . $this->getName() . '\')"/>'; break; case "pastespecial": $form .= '<img alt="' . _XK_PASTESPECIAL . '" title="' . _XK_PASTESPECIAL . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="document.getElementById(\'iframe' . $this->getName() . '\').contentWindow.focus();openWithSelfMain(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&skin=' . $this->getSkin() . '&dialog=pastespecial&url=' . $this->getUrl() . '\',\'pastespecial\',350,280);"/>'; break; case 'print': $form .= '<img alt="' . _XK_PRINT . '" title="' . _XK_PRINT . '" src="' . $skinUrl . '/print.gif" onmousedown="XK_print(\'' . $this->getName() . '\')"/>'; break; case "quote": $form .= '<img alt="' . _XK_QUOTE . '" title="' . _XK_QUOTE . '" src="' . $skinUrl . '/quote.gif" onmousedown="XK_doTextFormat(\'Quote\',\'\',\'' . $this->getName() . '\')"/>'; break; case "redo": $form .= '<img alt="' . _XK_REDO . '" title="' . _XK_REDO . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'redo\',\'\',\'' . $this->getName() . '\')"/>'; break; case "rtl": $form .= '<img alt="' . _XK_RIGHTTOLEFT . '" title="' . _XK_RIGHTTOLEFT . '" src="' . $skinUrl . '/rtl.gif" onmousedown="XK_textDirection(\'rtl\',\'' . $this->getName() . '\')"/>'; break; case "separator": $form .= '<img alt="|" src="' . $skinUrl . '/separator.gif"/>'; break; case 'spellcheck': $form .= '<img alt="' . _XK_SPELLCHECK . '" title="' . _XK_SPELLCHECK . '" src="' . $skinUrl . '/spellcheck.gif" onmousedown="XK_checkspell()"/>'; break; case "strikethrough": $form .= '<img alt="' . _XK_STRIKETHROUGH . '" title="' . _XK_STRIKETHROUGH . '" src="' . $skinUrl . '/strikethrough.gif" onmousedown="XK_doTextFormat(\'strikethrough\',\'\',\'' . $this->getName() . '\')"/>'; break; case "subscript": $form .= '<img alt="' . _XK_SUBSCRIPT . '" title="' . _XK_SUBSCRIPT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'subscript\',\'\',\'' . $this->getName() . '\')"/>'; break; case "superscript": $form .= '<img alt="' . _XK_SUPERSCRIPT . '" title="' . _XK_SUPERSCRIPT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'superscript\',\'\',\'' . $this->getName() . '\')"/>'; break; case "removeformat": $form .= '<img alt="' . _XK_REMOVEFORMAT . '" title="' . _XK_REMOVEFORMAT . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'removeformat\',\'\',\'' . $this->getName() . '\')"/>'; $form .= '<img alt="' . _XK_REMOVE_DESC . '" title="' . _XK_REMOVE_DESC . '" id="rformatbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_showHideDiv(\'' . $this->getName() . '\',\'rformatbutton\',\'RemoveFormat\')"/>'; $extraDivs .= $this->_renderCleanFormats(); break; case "themecss": $themeCss = true; break; case "tableprops": $form .= '<img alt="' . _XK_TABLEPROPS . '" title="' . _XK_TABLEPROPS . '" src="' . $skinUrl . '/tableprops.gif" onmousedown="XK_TTools(\'' . $this->getName() . '\',\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=tableProps&skin=' . $this->getSkin() . '&url=' . $this->getUrl() . '\',\'table\',400,260)"/>'; $form .= '<img alt="' . _XK_TABLETOOLS . '" title="' . _XK_TABLETOOLS . '" id="tpropbutton' . $this->getName() . '" src="' . $skinUrl . '/popup.gif" onclick="XK_useTableOps(\'TableOps\',\'' . $this->getName() . '\')"/>'; $extraDivs .= $this->_renderTableProps(); break; case "toggleborders": $form .= '<img alt="' . _XK_TABLEBORDERS_TOGGLE . '" title="' . _XK_TABLEBORDERS_TOGGLE . '" src="' . $skinUrl . '/toggletableborders.gif" onmousedown="XK_toggleBorders(\'' . $this->getName() . '\',\'document.body\')"/>'; break; case "togglemode": $toggleMode = true; break; case "underline": $form .= '<img alt="' . _XK_UNDERLINE . '" title="' . _XK_UNDERLINE . '" src="' . $skinUrl . '/underline.gif" onmousedown="XK_doTextFormat(\'underline\',\'\',\'' . $this->getName() . '\')"/>'; break; case "undo": $form .= '<img alt="' . _XK_UNDO . '" title="' . _XK_UNDO . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'undo\',\'\',\'' . $this->getName() . '\')"/>'; break; case "unlink": $form .= '<img alt="' . _XK_UNLINK . '" title="' . _XK_UNLINK . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'unlink\',\'\',\'' . $this->getName() . '\')"/>'; break; default: break; } } $form .= '</div></div> <iframe class="' . $this->getSkin() . 'wIframe" id="iframe' . $this->getName() . '"style="height:' . $this->getHeight() . ';" frameBorder="0"></iframe> <textarea wrap=soft id="' . $this->getName() . '" name="' . $this->getName() . '" rows="1" cols="1" style="display:none; width:' . $this->getWidth() . '; height:' . $this->getHeight() . '">' . $this->getValue() . '</textarea> <div class="' . $this->getSkin() . 'statusBar"> <div class="' . $this->getSkin() . 'smileysBar">' . $this->_renderWysiwygSmileys() . '</div>'; if ($toggleMode) { $form .= '<div class="' . $this->getSkin() . 'htmlBar"><input type="checkbox" alt="' . _XK_TOGLE_MODE . '" title="' . _XK_TOGLE_MODE . '" onclick="XK_doToggleView(\'' . $this->getName() . '\')" />HTML</div>'; } if ($themeCss) { $form .= '<div class="' . $this->getSkin() . 'htmlBar"><input type="checkbox" alt="' . _XK_ENABLECSS_MODE . '" title="' . _XK_ENABLECSS_MODE . '" id="cssEnabled' . $this->getName() . '" onclick="XK_appendXoopsCss(\'' . $this->getName() . '\',\'' . $this->getThemeCSS() . '\')" />CSS </div>'; } $form .= '</div>'; // Render additional DIV'S if ($colorPalette) { include_once XOOPS_ROOT_PATH . '' . $this->getUrl() . '/class/colorpalette.class.php'; $palette = new WysiwygColorPalette('XK_applyColor', $this->getName(), $url, $this->getSkin()); $extraDivs .= $palette->_renderColorPalette(); } $extraDivs .= $this->_renderContextMenu(); $form .= $extraDivs; $form .= '<input type="hidden" value="off" id="borderstoggle' . $this->getName() . '"/>'; $form .= '<img alt="" width="0" height="0" src="' . $url . '/skins/common/blank.gif" onload="XK_init(\'' . $this->getName() . '\',\'' . $isie . '\',\'' . $url . '\',\'' . $this->getDirection() . '\')"/>'; $form .= '</div>'; return $form; }
function editclient($showmenu = false, $id = 0) { global $client_handler, $xoopsUser, $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 client if ($id != 0) { // Creating the client object $clientObj = new SmartclientClient($id); if ($clientObj->notLoaded()) { redirect_header("client.php", 1, _AM_SCLIENT_NOCLIENTSELECTED); exit; } switch ($clientObj->status()) { case _SCLIENT_STATUS_SUBMITTED: $breadcrumb_action1 = _AM_SCLIENT_SUBMITTED_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_APPROVING; $page_title = _AM_SCLIENT_SUBMITTED_TITLE; $page_info = _AM_SCLIENT_SUBMITTED_INFO; $button_caption = _AM_SCLIENT_APPROVE; $new_status = _SCLIENT_STATUS_ACTIVE; break; case _SCLIENT_STATUS_ACTIVE: $breadcrumb_action1 = _AM_SCLIENT_ACTIVE_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_ACTIVE_EDITING; $page_info = _AM_SCLIENT_ACTIVE_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_ACTIVE; break; case _SCLIENT_STATUS_INACTIVE: $breadcrumb_action1 = _AM_SCLIENT_INACTIVE_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_INACTIVE_EDITING; $page_info = _AM_SCLIENT_INACTIVE_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_INACTIVE; break; case _SCLIENT_STATUS_REJECTED: $breadcrumb_action1 = _AM_SCLIENT_REJECTED_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_REJECTED_EDITING; $page_info = _AM_SCLIENT_REJECTED_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_REJECTED; break; case "default": default: break; } if ($showmenu) { smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; smartclient_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . $page_title . "</h3>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $page_info . "</span>"; echo "<div id='bottomtable'>"; } else { // there's no parameter, so we're adding a client $clientObj =& $client_handler->create(); $breadcrumb_action1 = _AM_SCLIENT_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_CREATE; $button_caption = _AM_SCLIENT_CREATE; $new_status = _SCLIENT_STATUS_ACTIVE; if ($showmenu) { smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2); } smartclient_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SCLIENT_CLIENT_CREATING . "</h3>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SCLIENT_CLIENT_CREATING_DSC . "</span>"; echo "<div id='bottomtable'>"; } // CLIENT FORM $sform = new XoopsThemeForm(_AM_SCLIENT_CLIENTS, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // TITLE $title_text = new XoopsFormText(_CO_SCLIENT_TITLE_REQ, 'title', 50, 255, $clientObj->title('e')); $sform->addElement($title_text, true); // LOGO $logo_array =& XoopsLists::getImgListAsArray(smartclient_getImageDir()); $logo_select = new XoopsFormSelect('', 'image', $clientObj->image()); $logo_select->addOption('-1', '---------------'); $logo_select->addOptionArray($logo_array); $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTCLIENT_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'"); $logo_tray = new XoopsFormElementTray(_AM_SCLIENT_LOGO, ' '); $logo_tray->addElement($logo_select); $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartclient_getImageDir('', false) . $clientObj->image() . "' name='image3' id='image3' alt='' />")); $logo_tray->setDescription(_AM_SCLIENT_LOGO_DSC); $sform->addElement($logo_tray); // LOGO UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SCLIENT_LOGO_UPLOAD, "logo_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(sprintf(_AM_SCLIENT_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height'])); $sform->addElement($file_box); // IMAGE_URL $image_url_text = new XoopsFormText(_CO_SCLIENT_IMAGE_URL, 'image_url', 50, 255, $clientObj->image_url()); $image_url_text->setDescription(_CO_SCLIENT_IMAGE_URL_DSC); $sform->addElement($image_url_text, false); // URL $url_text = new XoopsFormText(_AM_SCLIENT_URL, 'url', 50, 255, $clientObj->url()); $url_text->setDescription(_AM_SCLIENT_URL_DSC); $sform->addElement($url_text, false); // SUMMARY $summary_text = new XoopsFormTextArea(_AM_SCLIENT_SUMMARY_REQ, 'summary', $clientObj->summary(0, 'e'), 7, 60); $summary_text->setDescription(_AM_SCLIENT_SUMMARY_DSC); $sform->addElement($summary_text, true); // DESCRIPTION $description_text = new XoopsFormDhtmlTextArea(_AM_SCLIENT_DESCRIPTION, 'description', $clientObj->description(0, 'e'), 15, 60); $description_text->setDescription(_AM_SCLIENT_DESCRIPTION_DSC); $sform->addElement($description_text, false); // CONTACT_NAME $contact_name_text = new XoopsFormText(_CO_SCLIENT_CONTACT_NAME, 'contact_name', 50, 255, $clientObj->contact_name('e')); $contact_name_text->setDescription(_CO_SCLIENT_CONTACT_NAME_DSC); $sform->addElement($contact_name_text, false); // CONTACT_EMAIL $contact_email_text = new XoopsFormText(_CO_SCLIENT_CONTACT_EMAIL, 'contact_email', 50, 255, $clientObj->contact_email('e')); $contact_email_text->setDescription(_CO_SCLIENT_CONTACT_EMAIL_DSC); $sform->addElement($contact_email_text, false); // CONTACT_PHONE $contact_phone_text = new XoopsFormText(_CO_SCLIENT_CONTACT_PHONE, 'contact_phone', 50, 255, $clientObj->contact_phone('e')); $contact_phone_text->setDescription(_CO_SCLIENT_CONTACT_PHONE_DSC); $sform->addElement($contact_phone_text, false); // ADRESS //$adress_text = new XoopsFormText(_CO_SCLIENT_ADRESS, 'adress', 50, 255, $clientObj->adress('e')); $adress_text = new XoopsFormTextArea(_CO_SCLIENT_ADRESS, 'adress', $clientObj->adress('e')); $adress_text->setDescription(_CO_SCLIENT_ADRESS_DSC); $sform->addElement($adress_text, false); // STATUS $options = $clientObj->getAvailableStatus(); $status_select = new XoopsFormSelect(_AM_SCLIENT_STATUS, 'status', $new_status); $status_select->addOptionArray($options); $status_select->setDescription(_AM_SCLIENT_STATUS_DSC); $sform->addElement($status_select); // WEIGHT $weight_text = new XoopsFormText(_AM_SCLIENT_WEIGHT, 'weight', 4, 4, $clientObj->weight()); $weight_text->setDescription(_AM_SCLIENT_WEIGHT_DSC); $sform->addElement($weight_text); // Client id $sform->addElement(new XoopsFormHidden('id', $clientObj->id())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'addclient'); $button_tray->addElement($hidden); $sform->addElement(new XoopsFormHidden('original_status', $clientObj->status())); if (!$id) { // there's no id? Then it's a new client // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SCLIENT_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SCLIENT_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } else { // else, we're editing an existing client // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } $sform->addElement($button_tray); $sform->display(); unset($hidden); echo "</div>"; }
// Category ob_start(); $sform->addElement(new XoopsFormHidden('categoryid', '')); $mytree->makeMySelBox("name", "weight", $categoryid); $category_label = new XoopsFormLabel(_MD_SMEDIA_CATEGORY, ob_get_contents()); $category_label->setDescription(_MD_SMEDIA_CATEGORY_DSC); $sform->addElement($category_label); ob_end_clean(); // ITEM TITLE $sform->addElement(new XoopsFormText(_MD_SMEDIA_TITLE, 'title', 50, 255, ''), true); // SUMMARY $summary_text = new XoopsFormTextArea(_MD_SMEDIA_SUMMARY, 'summary', '', 7, 60); $summary_text->setDescription(_MD_SMEDIA_SUMMARY_DSC); $sform->addElement($summary_text, false); // BODY $body_text = new XoopsFormDhtmlTextArea(_MD_SMEDIA_BODY, 'body', '', 15, 60); $body_text->setDescription(_MD_SMEDIA_BODY_DSC); $sform->addElement($body_text, true); // NOTIFY ON PUBLISH if (is_object($xoopsUser)) { $notify_checkbox = new XoopsFormCheckBox('', 'notifypub', 1); $notify_checkbox->addOption(1, _MD_SMEDIA_NOTIFY); $sform->addElement($notify_checkbox); } $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'post'); $button_tray->addElement($hidden); $button_tray->addElement(new XoopsFormButton('', 'post', _MD_SMEDIA_CREATE, 'submit')); //$hidden2 = new XoopsFormHidden('op', 'preview'); //$button_tray->addElement($hidden2); //$button_tray->addElement(new XoopsFormButton('', 'preview', _MD_SMEDIA_PREVIEW, 'submit'));
function entryEdit( $entryID = '' ) { global $xoopsUser,$xoopsConfig,$xoopsModuleConfig,$mydirname,$MYDIRNAME,$spaw_root,$cat_table,$ent_table,$xoopsGTicket; $xoopsDB =& Database::getInstance(); $xoopsModule = XoopsModule::getByDirname("$mydirname"); $myts =& MyTextSanitizer::getInstance(); $op = 'default'; if ( !empty( $_GET['op'] ) ) $op = trim($_GET['op']); if ( !empty( $_POST['op'] ) ) $op = trim($_POST['op']); $entryID = !empty( $_GET['entryID'] ) ? intval($_GET['entryID']) : ''; /** * Clear all variables before we start */ if(!isset($block)) { $block = 0; } if(!isset($html)) { $html = 0; } if(!isset($smiley)) { $smiley = 0; } if(!isset($xcodes)) { $xcodes = 0; } if(!isset($breaks)) { $breaks = 0; } if(!isset($offline)) { $offline = 0; } if(!isset($submit)) { $submit = 0; } if(!isset($request)) { $request = 0; } if(!isset($notifypub)) { $notifypub = 0; } if(!isset($categoryID)) { $categoryID = 0; } if(!isset($term)) { $term = ""; } if(!isset($proc)) { $proc = ""; } if(!isset($definition)) { $definition = constant("_AM_{$MYDIRNAME}_WRITEHERE"); } if(!isset($ref)) { $ref = ""; } if(!isset($url)) { $url = ""; } if(!isset($renewdate)) { $renewdate = 0; } if(!isset($datesub)) { $datesub = 0; } // If there is a parameter, and the id exists, retrieve data: were editing an entry if ( $entryID > 0 ) { $result = $xoopsDB -> query( "SELECT categoryID, term, proc, definition, ref, url, uid, submit, datesub, html, smiley, xcodes, breaks, block, offline, notifypub, request FROM $ent_table WHERE entryID = '$entryID'" ); list( $categoryID, $term, $proc, $definition, $ref, $url, $uid, $submit, $datesub, $html, $smiley, $xcodes, $breaks, $block, $offline, $notifypub, $request ) = $xoopsDB -> fetchrow( $result ); if ( !$xoopsDB -> getRowsNum( $result ) ) { redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_NOENTRYTOEDIT") ); } $term = $myts -> htmlspecialchars($term); if ($proc) { list($temp,$proc) = explode(",",$proc); } $proc = $myts -> htmlSpecialChars($proc); $ref = $myts -> htmlSpecialChars($ref); $url = $myts -> htmlSpecialChars($url); $datesub = intval( $datesub ); $block = intval( $block ); $html = intval( $html ); $smiley = intval( $smiley ); $xcodes = intval( $xcodes ); $breaks = intval( $breaks ); $notifypub = intval( $notifypub ); xoops_cp_header(); adminMenu(2, constant("_AM_{$MYDIRNAME}_ENTRIES")." » ".constant("_AM_{$MYDIRNAME}_MODIFY")); include('./mymenu.php'); echo "<fieldset style='margin:1em 0em 0em 0em;border:1px solid #778;'><legend style='font-weight: bold; color: #900;'>" . constant("_AM_{$MYDIRNAME}_ENTRIES") . "</legend><br />\n"; $sform = new XoopsThemeForm( constant("_AM_{$MYDIRNAME}_MODENTRY") . ": " .$myts -> htmlSpecialChars($term) , "op", xoops_getenv( 'PHP_SELF' ) ); } else // there's no parameter, so we're adding an entry { $result01 = $xoopsDB -> query( "SELECT COUNT(*) FROM $cat_table" ); list( $totalcats ) = $xoopsDB -> fetchRow( $result01 ); if ( $totalcats == 0 && $xoopsModuleConfig['multicats'] == 1 ) { redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_NEEDONECOLUMN") ); } xoops_cp_header(); adminMenu(2, constant("_AM_{$MYDIRNAME}_ENTRIES")." » ".constant("_AM_{$MYDIRNAME}_ADMINENTRYMNGMT")); include('./mymenu.php'); echo "<fieldset style='margin:1em 0em 0em 0em;border:1px solid #778;'><legend style='font-weight: bold; color: #900;'>" . constant("_AM_{$MYDIRNAME}_ENTRIES") . "</legend><br />\n"; $uid = $xoopsUser->getVar('uid'); $sform = new XoopsThemeForm( constant("_AM_{$MYDIRNAME}_NEWENTRY"), "op", xoops_getenv( 'PHP_SELF' ) ); $html = $smiley = $xcodes = $breaks = 1; } $sform -> setExtra( 'enctype="multipart/form-data"' ); // Author selector ob_start(); echo xoops_getLinkedUnameFromId( intval($uid) ); $sform -> addElement( new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_AUTHOR"), ob_get_contents() ) ); ob_end_clean(); // Category selector if ($xoopsModuleConfig['multicats'] == 1) { $mytree = new XoopsTree( $cat_table, "categoryID" , "0" ); ob_start(); //okino $sform -> addElement( new XoopsFormHidden( 'categoryID', intval($categoryID) ) ); $mytree -> makeMySelBox( "name", "weight", $categoryID ); $sform -> addElement( new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_CATNAME"), ob_get_contents() ) ); ob_end_clean(); } // Term, definition, reference and related URL $sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYTERM"), 'term', 50, 80, $term), true ); $sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYPROC"), 'proc', 50, 80, $proc), true ); if( !empty( $_GET['usespaw'] ) && $spaw_root ) { // SPAW Config include_once $spaw_root."spaw_control.class.php"; ob_start() ; $sw = new SPAW_Wysiwyg( 'definition', $definition, _LANGCODE, 'full', 'default', '100%', '400px' ); $def_block = new XoopsFormLabel( constant("_AM_{$MYDIRNAME}_ENTRYDEF")."[<a href=\"".xoops_getenv( 'PHP_SELF')."?op=$op&entryID=$entryID\" title=\"".constant("_AM_{$MYDIRNAME}_BB")."\">".constant("_AM_{$MYDIRNAME}_SPAWTOBB")."</a>]" , $sw->getHtml() ) ; ob_end_clean() ; } elseif( $spaw_root ) { $def_block = new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_ENTRYDEF")."[<a href=\"".xoops_getenv( 'PHP_SELF')."?op=$op&entryID=$entryID&usespaw=1\" title=\"".constant("_AM_{$MYDIRNAME}_SPAW")."\">".constant("_AM_{$MYDIRNAME}_BBTOSPAW")."</a>]", 'definition', $myts -> htmlSpecialChars($definition), 15, 60 ); } else { $def_block = new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_ENTRYDEF"), 'definition', $myts -> htmlSpecialChars($definition), 15, 60 ); } if ($definition == constant("_AM_{$MYDIRNAME}_WRITEHERE")) { $def_block -> setExtra( 'onfocus="this.select()"' ); } $sform -> addElement ( $def_block ); if ($xoopsModuleConfig['allowedtypes']) { $butt_upfile = new XoopsFormButton( constant("_AM_{$MYDIRNAME}_UPFILES"), '', constant("_AM_{$MYDIRNAME}_UPLOADOPEN"), 'button' ); $butt_upfile->setExtra('onclick="window.open (\'upload.php\', \'wbupload\', \'width=550,height=360,location=0,menubar=0,resizable=1,scrollbars=yes,status=1,toolbar=0\')"'); $sform->addElement( $butt_upfile ); } $sform -> addElement( new XoopsFormTextArea( constant("_AM_{$MYDIRNAME}_ENTRYREFERENCE"), 'ref', $ref, 5, 60 ), false ); $sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_ENTRYURL"), 'url', 50, 80, $url ), false ); // Code to take entry offline, for maintenance purposes $offline_radio = new XoopsFormRadioYN(constant("_AM_{$MYDIRNAME}_SWITCHOFFLINE"), 'offline', intval($offline), ' '.constant("_AM_{$MYDIRNAME}_YES").'', ' '.constant("_AM_{$MYDIRNAME}_NO").''); $sform -> addElement($offline_radio); // Code to put entry in block // $block_radio = new XoopsFormRadioYN( _AM_XWORDS_BLOCK, 'block', $block , ' ' . _AM_XWORDS_YES . '', ' ' . _AM_XWORDS_NO . '' ); // $sform -> addElement( $block_radio ); if ( $entryID > 0) { $renewdate_checkbox = new XoopsFormCheckBox( constant("_AM_{$MYDIRNAME}_ENTRYCREATED")."<br /><span style='font-size: xx-small; font-weight: normal;'>(".constant("_AM_{$MYDIRNAME}_RENEWDATE_DEFAULT").formatTimestamp($datesub).")</span>", 'renewdate', $renewdate ); $renewdate_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_RENEWDATE")."<br />".getSetTimeForm($datesub) ); } else { $renewdate_checkbox = new XoopsFormCheckBox( constant("_AM_{$MYDIRNAME}_ENTRYCREATED")."<br /><span style='font-size: xx-small; font-weight: normal;'>(".constant("_AM_{$MYDIRNAME}_RENEWDATE_DEFAULT").formatTimestamp(time()).")</span>", 'renewdate', $renewdate ); $renewdate_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_SETNEWDATE")."<br />".getSetTimeForm(time()) ); } $sform -> addElement( $renewdate_checkbox ); // VARIOUS OPTIONS $options_tray = new XoopsFormElementTray(constant("_AM_{$MYDIRNAME}_OPTIONS"),'<br />'); $html_checkbox = new XoopsFormCheckBox( '', 'html', intval($html) ); $html_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOHTML") ); $options_tray -> addElement( $html_checkbox ); $smiley_checkbox = new XoopsFormCheckBox( '', 'smiley', intval($smiley) ); $smiley_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOSMILEY") ); $options_tray -> addElement( $smiley_checkbox ); $xcodes_checkbox = new XoopsFormCheckBox( '', 'xcodes', intval($xcodes) ); $xcodes_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_DOXCODE") ); $options_tray -> addElement( $xcodes_checkbox ); $breaks_checkbox = new XoopsFormCheckBox( '', 'breaks', intval($breaks) ); $breaks_checkbox -> addOption( 1, constant("_AM_{$MYDIRNAME}_BREAKS") ); $options_tray -> addElement( $breaks_checkbox ); $sform -> addElement( $options_tray ); $button_tray = new XoopsFormElementTray( '', '' ); $hidden = new XoopsFormHidden( 'op', 'addentry' ); $button_tray -> addElement( $hidden ); $hidden_date = new XoopsFormHidden( 'datesub', $datesub ); $button_tray -> addElement( $hidden_date ); $hidden_id = new XoopsFormHidden( 'entryID', $entryID ); $button_tray -> addElement( $hidden_id ); $hidden_uid = new XoopsFormHidden( 'uid', $uid ); $button_tray -> addElement( $hidden_uid ); $hidden_block = new XoopsFormHidden( 'block', $block ); $button_tray -> addElement( $hidden_block ); if ( !$entryID) { $hidden_renewdate = new XoopsFormHidden( 'renewdate', 1 ); $button_tray -> addElement( $hidden_renewdate ); } //PREVIEW(ver0.31) $butt_preview = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_PREVIEWOPEN"), 'button' ); $butt_preview->setExtra('onclick="document.op.action=\'../preview.php\';document.op.target=\'_blank\';document.op.submit();"'); $button_tray->addElement( $butt_preview ); if ( !$entryID ) // therez no entryID? Then its a new entry { $butt_create = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CREATE"), 'submit' ); $butt_create->setExtra('onclick="document.op.action=\'./entry.php\';document.op.target=\'_self\';this.form.elements.op.value=\'addentry\'"'); $button_tray->addElement( $butt_create ); $butt_clear = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CLEAR"), 'reset' ); $button_tray->addElement( $butt_clear ); $butt_cancel = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CANCEL"), 'button' ); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement( $butt_cancel ); } else // else, were editing an existing entry { $butt_create = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_MODIFY"), 'submit' ); $butt_create->setExtra('onclick="document.op.action=\'./entry.php\';document.op.target=\'_self\';this.form.elements.op.value=\'addentry\'"'); $button_tray->addElement( $butt_create ); $butt_cancel = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CANCEL"), 'button' ); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement( $butt_cancel ); } $button_tray->addElement( $xoopsGTicket->getTicketXoopsForm( __LINE__ ) );//GIJ $sform -> addElement( $button_tray ); $sform -> display(); unset( $hidden ); echo "</fieldset>\n"; xoops_cp_footer(); }