Example #1
0
function cge_CreateInputSubmit(&$mod, $id, $name, $value = '', $addtext = '', $image = '', $confirmtext = '', $class = '', $alt = '', $elid = '')
{
    $real_image = '';
    if (!empty($image)) {
        $config = cms_config::get_instance();
        // check image_directories first
        if (isset($mod->_image_directories) && !empty($mod->_image_directories)) {
            foreach ($mod->_image_directories as $dir) {
                $url = cms_join_path($dir, $image);
                $path = cms_join_path($config['root_path'], $url);
                if (is_readable($path)) {
                    $real_image = $url;
                }
            }
        }
        $theme = cms_utils::get_theme_object();
        if (empty($real_image)) {
            $path = $config['root_path'] . '/' . $config['admin_dir'] . '/themes/' . $theme->themeName . '/images/';
            if (file_exists($path . $image)) {
                // its a theme image
                $real_image = $config['admin_dir'] . "/themes/" . $theme->themeName . '/images/' . $image;
            }
        }
        if (empty($real_image)) {
            if (is_object($theme)) {
                // we're in the admin
                if (!$alt) {
                    $alt = $value;
                }
                $txt = $theme->DisplayImage($image, $alt, '', '', $class);
                $real_image = $theme->imageLink[$image];
            }
        }
        $addtext .= ' title="' . $value . '"';
    }
    if (!empty($class)) {
        $addtext .= ' class="' . $class . '"';
    }
    return $mod->CreateInputSubmit($id, $name, $value, $addtext, $real_image, $confirmtext);
}
Example #2
0
<?php

cms_admin_sendheaders();
$orig_memory = function_exists('memory_get_usage') ? memory_get_usage() : 0;
$starttime = microtime();
if (!(isset($USE_OUTPUT_BUFFERING) && $USE_OUTPUT_BUFFERING == false)) {
    @ob_start();
}
$gCms = cmsms();
$config = $gCms->GetConfig();
$userid = get_userid();
if (isset($USE_THEME) && $USE_THEME == false) {
    //echo '<!-- admin theme disabled -->';
} else {
    debug_buffer('before theme load');
    $themeObject = cms_utils::get_theme_object();
    debug_buffer('after theme load');
    if (isset($headtext) && $headtext != '') {
        $themeObject->set_value('headertext', $headtext);
    }
    // Display notification stuff from modules
    // should be controlled by preferences or something
    $ignoredmodules = explode(',', get_preference($userid, 'ignoredmodules'));
    if (get_site_preference('enablenotifications', 1) && get_preference($userid, 'enablenotifications', 1)) {
        debug_buffer('before notifications');
        if ($data = get_site_preference('__NOTIFICATIONS__')) {
            $data = unserialize($data);
            if (is_array($data) && count($data)) {
                foreach ($data as $item) {
                    $old = $item->html;
                    $regex = '/' . CMS_SECURE_PARAM_NAME . '\\=[0-9a-z]{8}/';
 function _DisplayTemplateList(&$module, $id, $returnid, $prefix, $defaulttemplatepref, $active_tab, $defaultprefname, $title, $info = '', $destaction = 'defaultadmin')
 {
     // we're gonna allow multiple templates here
     // but we're gonna prefix them all with something
     $falseimage1 = cms_utils::get_theme_object()->DisplayImage('icons/system/false.gif', 'make default', '', '', 'systemicon');
     $trueimage1 = cms_utils::get_theme_object()->DisplayImage('icons/system/true.gif', 'default', '', '', 'systemicon');
     $alltemplates = cge_template_utils::get_templates_by_prefix($module, $prefix, true);
     $rowarray = array();
     $rowclass = 'row1';
     foreach ($alltemplates as $onetemplate) {
         if ($prefix . $onetemplate == $defaulttemplatepref) {
             continue;
         }
         // don't show the system default.
         $tmp = $onetemplate;
         $row = new StdClass();
         $row->name = $this->_module->CreateLink($id, 'edittemplate', $returnid, $tmp, array('template' => $tmp, 'destaction' => $destaction, 'cg_activetab' => $active_tab, 'title' => $title, 'info' => $info, 'prefix' => $prefix, 'modname' => $module->GetName(), 'moddesc' => $module->GetFriendlyName(), 'mode' => 'edit'));
         $row->rowclass = $rowclass;
         $row->default = null;
         if ($defaultprefname) {
             $default = $module->GetPreference($defaultprefname) == $tmp ? true : false;
             if ($default) {
                 $row->default = $trueimage1;
             } else {
                 $row->default = $this->_module->CreateLink($id, 'makedefaulttemplate', $returnid, $falseimage1, array('template' => $tmp, 'destaction' => $destaction, 'defaultprefname' => $defaultprefname, 'modname' => $module->GetName(), 'cg_activetab' => $active_tab));
             }
         }
         $row->editlink = $this->_module->CreateImageLink($id, 'edittemplate', $returnid, $this->_module->Lang('prompt_edittemplate'), 'icons/system/edit.gif', array('template' => $tmp, 'destaction' => $destaction, 'cg_activetab' => $active_tab, 'prefix' => $prefix, 'title' => $title, 'info' => $info, 'modname' => $module->GetName(), 'moddesc' => $module->GetFriendlyName(), 'mode' => 'edit'));
         if ($defaultprefname && $default) {
             $row->deletelink = '&nbsp;';
         } else {
             $row->deletelink = $this->_module->CreateImageLink($id, 'deletetemplate', $returnid, $this->_module->Lang('prompt_deletetemplate'), 'icons/system/delete.gif', array('template' => $onetemplate, 'prefix' => $prefix, 'modname' => $module->GetName(), 'destaction' => $destaction, 'cg_activetab' => $active_tab), '', $this->_module->Lang('areyousure'));
         }
         $rowarray[] = $row;
         $rowclass == "row1" ? $rowclass = "row2" : ($rowclass = "row1");
     }
     $mod = \cms_utils::get_module(MOD_CGEXTENSIONS);
     $tpl = $mod->CreateSmartyTemplate('listtemplates.tpl');
     $tpl->assign('parent_module_name', $module->GetFriendlyName());
     $tpl->assign('items', $rowarray);
     $tpl->assign('nameprompt', $this->_module->Lang('prompt_name'));
     $tpl->assign('defaultprompt', $this->_module->Lang('prompt_default'));
     $tpl->assign('newtemplatelink', $this->_module->CreateImageLink($id, 'edittemplate', $returnid, $this->_module->Lang('prompt_newtemplate'), 'icons/system/newobject.gif', array('prefix' => $prefix, 'destaction' => $destaction, 'cg_activetab' => $active_tab, 'modname' => $module->GetName(), 'moddesc' => $module->GetFriendlyName(), 'title' => $title, 'info' => $info, 'mode' => 'add', 'defaulttemplatepref' => $defaulttemplatepref), '', '', false));
     //$tpl->assign($this->_module->CreateFormEnd());
     return $tpl->fetch();
 }
    }
}
$tplvars['tabsheader'] = $this->StartTabHeaders() . $this->SetTabHeader('main', $this->Lang('title_maintab'), $indx == 0) . $this->SetTabHeader('settings', $this->Lang('title_settingstab'), $indx == 1) . $this->EndTabHeaders() . $this->StartTabContent();
//NOTE CMSMS 2+ barfs if EndTab() is called before EndTabContent() - some craziness there !!!
$tplvars = $tplvars + array('tabsfooter' => $this->EndTabContent(), 'tab_end' => $this->EndTab(), 'form_end' => $this->CreateFormEnd());
$jsincs = array();
$jsfuncs = array();
$jsloads = array();
$baseurl = $this->GetModuleURLPath();
if (!empty($params['message'])) {
    $tplvars['message'] = $params['message'];
}
//~~~~~~~~~~~~~~~ ACCOUNTS TAB ~~~~~~~~~~~~~~~~
$tplvars['tabstart_main'] = $this->StartTab('main');
$tplvars['formstart_main'] = $this->CreateFormStart($id, 'process');
$theme = $this->before20 ? cmsms()->get_variable('admintheme') : cms_utils::get_theme_object();
if ($mod) {
    $icon_open = $theme->DisplayImage('icons/system/edit.gif', $this->Lang('tip_edit'), '', '', 'systemicon');
    $t = $this->Lang('tip_toggle');
    $icon_yes = $theme->DisplayImage('icons/system/true.gif', $t, '', '', 'systemicon');
    $icon_no = $theme->DisplayImage('icons/system/false.gif', $t, '', '', 'systemicon');
    $icon_export = $theme->DisplayImage('icons/system/export.gif', $this->Lang('tip_export'), '', '', 'systemicon');
    $t = $this->Lang('tip_admin');
    $icon_admin = '<img src="' . $baseurl . '/images/administer.png" alt="' . $t . '" title="' . $t . '" class="systemicon" />';
} else {
    $icon_open = $theme->DisplayImage('icons/system/view.gif', $this->Lang('tip_view'), '', '', 'systemicon');
    $yes = $this->Lang('yes');
    $no = $this->Lang('no');
}
if ($pdel) {
    $icon_del = $theme->DisplayImage('icons/system/delete.gif', $this->Lang('tip_delete'), '', '', 'systemicon');
Example #5
0
 function AddEditForm($id, $returnid, $tab, $message = '')
 {
     $gCms = cmsms();
     $mod = $this->module_ptr;
     $config = $mod->GetConfig();
     if (!empty($message)) {
         $mod->smarty->assign('message', $mod->ShowMessage($message));
     }
     $mod->smarty->assign('formstart', $mod->CreateFormStart($id, 'admin_store_form', $returnid));
     $mod->smarty->assign('formid', $mod->CreateInputHidden($id, 'form_id', $this->Id));
     # fixes for CMSMS 2 compatibility (JM)
     if (!formbuilder_utils::is_CMS2()) {
         $mod->smarty->assign('tab_start', $mod->StartTabHeaders() . $mod->SetTabHeader('maintab', $mod->Lang('tab_main'), 'maintab' == $tab ? true : false) . $mod->SetTabHeader('submittab', $mod->Lang('tab_submit'), 'submittab' == $tab ? true : false) . $mod->SetTabHeader('symboltab', $mod->Lang('tab_symbol'), 'symboltab' == $tab ? true : false) . $mod->SetTabHeader('captchatab', $mod->Lang('tab_captcha'), 'captchatab' == $tab ? true : false) . $mod->SetTabHeader('udttab', $mod->Lang('tab_udt'), 'udttab' == $tab ? true : false) . $mod->SetTabHeader('templatelayout', $mod->Lang('tab_templatelayout'), 'templatelayout' == $tab ? true : false) . $mod->SetTabHeader('submittemplate', $mod->Lang('tab_submissiontemplate'), 'submittemplate' == $tab ? true : false) . $mod->EndTabHeaders() . $mod->StartTabContent());
         $mod->smarty->assign('tabs_end', $mod->EndTabContent());
         $mod->smarty->assign('maintab_start', $mod->StartTab("maintab"));
         $mod->smarty->assign('submittab_start', $mod->StartTab("submittab"));
         $mod->smarty->assign('symboltab_start', $mod->StartTab("symboltab"));
         $mod->smarty->assign('udttab_start', $mod->StartTab("udttab"));
         $mod->smarty->assign('templatetab_start', $mod->StartTab("templatelayout"));
         $mod->smarty->assign('submittemplatetab_start', $mod->StartTab("submittemplate"));
         $mod->smarty->assign('captchatab_start', $mod->StartTab("captchatab"));
         $mod->smarty->assign('tab_end', $mod->EndTab());
     }
     $mod->smarty->assign('form_end', $mod->CreateFormEnd());
     $mod->smarty->assign('title_form_name', $mod->Lang('title_form_name'));
     $mod->smarty->assign('input_form_name', $mod->CreateInputText($id, 'fbrp_form_name', $this->Name, 50));
     $mod->smarty->assign('title_load_template', $mod->Lang('title_load_template'));
     $modLink = $mod->CreateLink($id, 'admin_get_template', $returnid, '', array(), '', true);
     $mod->smarty->assign('security_key', CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY]);
     $templateList = array($mod->Lang('select_source_template') => '', $mod->Lang('default_template') => 'RenderFormDefault.tpl', $mod->Lang('table_left_template') => 'RenderFormTableTitleLeft.tpl', $mod->Lang('table_top_template') => 'RenderFormTableTitleTop.tpl');
     $allForms = $mod->GetForms();
     foreach ($allForms as $thisForm) {
         if ($thisForm['form_id'] != $this->Id) {
             $templateList[$mod->Lang('form_template_name', $thisForm['name'])] = $thisForm['form_id'];
         }
     }
     $mod->smarty->assign('input_load_template', $mod->CreateInputDropdown($id, 'fbrp_fb_template_load', $templateList, -1, '', 'id="fb_template_load" onchange="jQuery(this).fb_get_template(\'' . $mod->Lang('template_are_you_sure') . '\',\'' . $modLink . '\');"'));
     $mod->smarty->assign('help_template_variables', $mod->Lang('template_variable_help'));
     $mod->smarty->assign('title_form_unspecified', $mod->Lang('title_form_unspecified'));
     $mod->smarty->assign('input_form_unspecified', $mod->CreateInputText($id, 'fbrp_forma_unspecified', $this->GetAttr('unspecified', $mod->Lang('unspecified')), 50));
     $mod->smarty->assign('title_form_status', $mod->Lang('title_form_status'));
     $mod->smarty->assign('text_ready', $mod->Lang('title_ready_for_deployment'));
     $mod->smarty->assign('title_form_alias', $mod->Lang('title_form_alias'));
     $mod->smarty->assign('input_form_alias', $mod->CreateInputText($id, 'fbrp_form_alias', $this->Alias, 50));
     $mod->smarty->assign('title_form_css_class', $mod->Lang('title_form_css_class'));
     $mod->smarty->assign('input_form_css_class', $mod->CreateInputText($id, 'fbrp_forma_css_class', $this->GetAttr('css_class', 'formbuilderform'), 50, 50));
     $mod->smarty->assign('title_form_fields', $mod->Lang('title_form_fields'));
     $mod->smarty->assign('title_form_main', $mod->Lang('title_form_main'));
     if ($mod->GetPreference('show_fieldids', 0) != 0) {
         $mod->smarty->assign('title_field_id', $mod->Lang('title_field_id'));
     }
     if ($mod->GetPreference('show_fieldaliases', 1) != 0) {
         $mod->smarty->assign('title_field_alias', $mod->Lang('title_field_alias_short'));
     }
     $mod->smarty->assign('back', $mod->CreateLink($id, 'defaultadmin', '', $mod->Lang('back_top'), array()));
     $mod->smarty->assign('title_field_name', $mod->Lang('title_field_name'));
     $mod->smarty->assign('title_field_type', $mod->Lang('title_field_type'));
     $mod->smarty->assign('title_field_type', $mod->Lang('title_field_type'));
     $mod->smarty->assign('title_form_template', $mod->Lang('title_form_template'));
     $mod->smarty->assign('title_list_delimiter', $mod->Lang('title_list_delimiter'));
     $mod->smarty->assign('title_redirect_page', $mod->Lang('title_redirect_page'));
     $mod->smarty->assign('title_submit_action', $mod->Lang('title_submit_action'));
     $mod->smarty->assign('title_submit_response', $mod->Lang('title_submit_response'));
     $mod->smarty->assign('title_must_save_order', $mod->Lang('title_must_save_order'));
     $mod->smarty->assign('title_inline_form', $mod->Lang('title_inline_form'));
     //JM
     $admintheme = cms_utils::get_theme_object();
     //
     $mod->smarty->assign('title_submit_actions', $mod->Lang('title_submit_actions'));
     $mod->smarty->assign('title_submit_labels', $mod->Lang('title_submit_labels'));
     $mod->smarty->assign('title_submit_javascript', $mod->Lang('title_submit_javascript'));
     $mod->smarty->assign('title_submit_help', $mod->Lang('title_submit_help'));
     $mod->smarty->assign('title_submit_response_help', $mod->Lang('title_submit_response_help'));
     $submitActions = array($mod->Lang('display_text') => 'text', $mod->Lang('redirect_to_page') => 'redir');
     $mod->smarty->assign('input_submit_action', $mod->CreateInputRadioGroup($id, 'fbrp_forma_submit_action', $submitActions, $this->GetAttr('submit_action', 'text')));
     $captcha = $mod->getModuleInstance('Captcha');
     if ($captcha == null) {
         $mod->smarty->assign('title_install_captcha', $mod->Lang('title_captcha_not_installed'));
         $mod->smarty->assign('captcha_installed', 0);
     } else {
         $mod->smarty->assign('title_use_captcha', $mod->Lang('title_use_captcha'));
         $mod->smarty->assign('captcha_installed', 1);
         $mod->smarty->assign('input_use_captcha', $mod->CreateInputHidden($id, 'fbrp_forma_use_captcha', '0') . $mod->CreateInputCheckbox($id, 'fbrp_forma_use_captcha', '1', $this->GetAttr('use_captcha', '0')) . $mod->Lang('title_use_captcha_help'));
     }
     $mod->smarty->assign('title_information', $mod->Lang('information'));
     $mod->smarty->assign('title_order', $mod->Lang('order'));
     $mod->smarty->assign('title_field_required_abbrev', $mod->Lang('title_field_required_abbrev'));
     $mod->smarty->assign('hasdisposition', $this->HasDisposition() ? 1 : 0);
     $maxOrder = 1;
     if ($this->Id > 0) {
         $mod->smarty->assign('fb_hidden', $mod->CreateInputHidden($id, 'fbrp_form_op', $mod->Lang('updated')) . $mod->CreateInputHidden($id, 'fbrp_sort', '', 'class="fbrp_sort"'));
         $mod->smarty->assign('adding', 0);
         $mod->smarty->assign('save_button', $mod->CreateInputSubmit($id, 'fbrp_submit', $mod->Lang('save')));
         $mod->smarty->assign('submit_button', $mod->CreateInputHidden($id, 'active_tab', '', 'id="fbr_atab"') . $mod->CreateInputSubmit($id, 'fbrp_submit', $mod->Lang('save_and_continue'), 'onclick="jQuery(this).fb_set_tab()"'));
         $fieldList = array();
         $currow = "row1";
         $count = 1;
         $last = $this->GetFieldCount();
         foreach ($this->Fields as $thisField) {
             $oneset = new stdClass();
             $oneset->rowclass = $currow;
             $oneset->name = $mod->CreateLink($id, 'admin_add_edit_field', '', $thisField->GetName(), array('field_id' => $thisField->GetId(), 'form_id' => $this->Id));
             if ($mod->GetPreference('show_fieldids', 0) != 0) {
                 $oneset->id = $mod->CreateLink($id, 'admin_add_edit_field', '', $thisField->GetId(), array('field_id' => $thisField->GetId(), 'form_id' => $this->Id));
             }
             $oneset->type = $thisField->GetDisplayType();
             $oneset->alias = $thisField->GetAlias();
             $oneset->id = $thisField->GetID();
             if (!$thisField->DisplayInForm() || $thisField->IsNonRequirableField()) {
                 $no_avail = $mod->Lang('not_available');
                 if ($admintheme->themeName == 'NCleanGrey') {
                     $oneset->disposition = '<img src="' . $config['root_url'] . '/modules/' . $mod->GetName() . '/images/stop.gif" width="20" height="20" alt="' . $no_avail . '" title="' . $no_avail . '" />';
                 } else {
                     $oneset->disposition = '<img src="' . $config['root_url'] . '/modules/' . $mod->GetName() . '/images/stop.gif" width="16" height="16" alt="' . $no_avail . '" title="' . $no_avail . '" />';
                 }
             } else {
                 if ($thisField->IsRequired()) {
                     $oneset->disposition = $mod->CreateLink($id, 'admin_update_field_required', '', $admintheme->DisplayImage('icons/system/true.gif', 'true', '', '', 'systemicon'), array('form_id' => $this->Id, 'fbrp_active' => 'off', 'field_id' => $thisField->GetId()), '', '', '', 'class="true" onclick="jQuery(this).fb_admin_update_field_required(); return false;"');
                 } else {
                     $oneset->disposition = $mod->CreateLink($id, 'admin_update_field_required', '', $admintheme->DisplayImage('icons/system/false.gif', 'false', '', '', 'systemicon'), array('form_id' => $this->Id, 'fbrp_active' => 'on', 'field_id' => $thisField->GetId()), '', '', '', 'class="false" onclick="jQuery(this).fb_admin_update_field_required(); return false;"');
                 }
             }
             $oneset->field_status = $thisField->StatusInfo();
             $oneset->editlink = $mod->CreateLink($id, 'admin_add_edit_field', '', $admintheme->DisplayImage('icons/system/edit.gif', $mod->Lang('edit'), '', '', 'systemicon'), array('field_id' => $thisField->GetId(), 'form_id' => $this->Id));
             $oneset->deletelink = $mod->CreateLink($id, 'admin_delete_field', '', $admintheme->DisplayImage('icons/system/delete.gif', $mod->Lang('delete'), '', '', 'systemicon'), array('field_id' => $thisField->GetId(), 'form_id' => $this->Id), '', '', '', 'onclick="jQuery(this).fb_delete_field(\'' . $mod->Lang('are_you_sure_delete_field', htmlspecialchars($thisField->GetName())) . '\'); return false;"');
             /* Removed By Stikki, reinstated by SjG with Javascript to hide it if Javascript's enabled. */
             if ($count > 1) {
                 $oneset->up = $mod->CreateLink($id, 'admin_update_field_order', '', $admintheme->DisplayImage('icons/system/arrow-u.gif', 'up', '', '', 'systemicon'), array('form_id' => $this->Id, 'fbrp_dir' => 'up', 'field_id' => $thisField->GetId()));
             } else {
                 $oneset->up = '&nbsp;';
             }
             if ($count < $last) {
                 $oneset->down = $mod->CreateLink($id, 'admin_update_field_order', '', $admintheme->DisplayImage('icons/system/arrow-d.gif', 'down', '', '', 'systemicon'), array('form_id' => $this->Id, 'fbrp_dir' => 'down', 'field_id' => $thisField->GetId()));
             } else {
                 $oneset->down = '&nbsp;';
             }
             $currow == "row1" ? $currow = "row2" : ($currow = "row1");
             $count++;
             if ($thisField->GetOrder() >= $maxOrder) {
                 $maxOrder = $thisField->GetOrder() + 1;
             }
             array_push($fieldList, $oneset);
         }
         $mod->smarty->assign('fields', $fieldList);
         $mod->smarty->assign('add_field_link', $mod->CreateLink($id, 'admin_add_edit_field', $returnid, $admintheme->DisplayImage('icons/system/newobject.gif', $mod->Lang('title_add_new_field'), '', '', 'systemicon'), array('form_id' => $this->Id, 'fbrp_order_by' => $maxOrder), '', false) . $mod->CreateLink($id, 'admin_add_edit_field', $returnid, $mod->Lang('title_add_new_field'), array('form_id' => $this->Id, 'fbrp_order_by' => $maxOrder), '', false));
         if ($mod->GetPreference('enable_fastadd', 1) == 1) {
             $mod->smarty->assign('fastadd', 1);
             $mod->smarty->assign('title_fastadd', $mod->Lang('title_fastadd'));
             $typeInput = "<script type=\"text/javascript\">\n/* <![CDATA[ */\nfunction fast_add(field_type)\n{\n\tvar type=field_type.options[field_type.selectedIndex].value;\n\tvar link = '" . $mod->CreateLink($id, 'admin_add_edit_field', $returnid, '', array('form_id' => $this->Id, 'fbrp_order_by' => $maxOrder), '', true, true) . "&" . $id . "fbrp_field_type='+type;\n\tthis.location=link;\n\treturn true;\n}\n/* ]]> */\n</script>";
             $typeInput = str_replace('&amp;', '&', $typeInput);
             $mod->initialize();
             if ($mod->GetPreference('show_field_level', 'basic') == 'basic') {
                 $mod->smarty->assign('input_fastadd', $typeInput . $mod->CreateInputDropdown($id, 'fbrp_field_type', array_merge(array($mod->Lang('select_type') => ''), $mod->std_field_types), -1, '', 'onchange="fast_add(this)"') . $mod->Lang('title_switch_advanced') . $mod->CreateLink($id, 'admin_add_edit_form', $returnid, $mod->Lang('title_switch_advanced_link'), array('form_id' => $this->Id, 'fbrp_set_field_level' => 'advanced')));
             } else {
                 $mod->smarty->assign('input_fastadd', $typeInput . $mod->CreateInputDropdown($id, 'fbrp_field_type', array_merge(array($mod->Lang('select_type') => ''), $mod->field_types), -1, '', 'onchange="fast_add(this)"') . $mod->Lang('title_switch_basic') . $mod->CreateLink($id, 'admin_add_edit_form', $returnid, $mod->Lang('title_switch_basic_link'), array('form_id' => $this->Id, 'fbrp_set_field_level' => 'basic')));
             }
         }
     } else {
         $mod->smarty->assign('save_button', '');
         $mod->smarty->assign('submit_button', $mod->CreateInputSubmit($id, 'fbrp_submit', $mod->Lang('add')));
         $mod->smarty->assign('fb_hidden', $mod->CreateInputHidden($id, 'fbrp_form_op', $mod->Lang('added')) . $mod->CreateInputHidden($id, 'fbrp_sort', '', 'id="fbrp_sort"'));
         $mod->smarty->assign('adding', 1);
     }
     $mod->smarty->assign('cancel_button', $mod->CreateInputSubmit($id, 'fbrp_cancel', $mod->Lang('cancel')));
     $mod->smarty->assign('link_notready', "<strong>" . $mod->Lang('title_not_ready1') . "</strong> " . $mod->Lang('title_not_ready2') . " " . $mod->CreateLink($id, 'admin_add_edit_field', $returnid, $mod->Lang('title_not_ready_link'), array('form_id' => $this->Id, 'fbrp_order_by' => $maxOrder, 'fbrp_dispose_only' => 1), '', false, false, 'class="module_fb_link"') . " " . $mod->Lang('title_not_ready3'));
     $mod->smarty->assign('input_inline_form', $mod->CreateInputHidden($id, 'fbrp_forma_inline', '0') . $mod->CreateInputCheckbox($id, 'fbrp_forma_inline', '1', $this->GetAttr('inline', '0')) . $mod->Lang('title_inline_form_help'));
     $mod->smarty->assign('title_form_submit_button', $mod->Lang('title_form_submit_button'));
     $mod->smarty->assign('input_form_submit_button', $mod->CreateInputText($id, 'fbrp_forma_submit_button_text', $this->GetAttr('submit_button_text', $mod->Lang('button_submit')), 35, 35));
     $mod->smarty->assign('title_submit_button_safety', $mod->Lang('title_submit_button_safety_help'));
     $mod->smarty->assign('input_submit_button_safety', $mod->CreateInputHidden($id, 'fbrp_forma_input_button_safety', '0') . $mod->CreateInputCheckbox($id, 'fbrp_forma_input_button_safety', '1', $this->GetAttr('input_button_safety', '0')) . $mod->Lang('title_submit_button_safety'));
     $mod->smarty->assign('title_form_prev_button', $mod->Lang('title_form_prev_button'));
     $mod->smarty->assign('input_form_prev_button', $mod->CreateInputText($id, 'fbrp_forma_prev_button_text', $this->GetAttr('prev_button_text', $mod->Lang('button_previous')), 35, 35));
     $mod->smarty->assign('input_title_user_captcha', $mod->CreateInputText($id, 'fbrp_forma_title_user_captcha', $this->GetAttr('title_user_captcha', $mod->Lang('title_user_captcha')), 35, 256));
     $mod->smarty->assign('title_title_user_captcha', $mod->Lang('title_title_user_captcha'));
     $mod->smarty->assign('input_title_user_captcha_error', $mod->CreateInputText($id, 'fbrp_forma_captcha_wrong', $this->GetAttr('captcha_wrong', $mod->Lang('wrong_captcha')), 35, 256));
     $mod->smarty->assign('title_user_captcha_error', $mod->Lang('title_user_captcha_error'));
     $mod->smarty->assign('title_form_next_button', $mod->Lang('title_form_next_button'));
     $mod->smarty->assign('input_form_next_button', $mod->CreateInputText($id, 'fbrp_forma_next_button_text', $this->GetAttr('next_button_text', $mod->Lang('button_continue')), 35, 35));
     $mod->smarty->assign('title_form_predisplay_udt', $mod->Lang('title_form_predisplay_udt'));
     $mod->smarty->assign('title_form_predisplay_each_udt', $mod->Lang('title_form_predisplay_each_udt'));
     $usertagops = $gCms->GetUserTagOperations();
     $usertags = $usertagops->ListUserTags();
     $usertaglist = array();
     $usertaglist[$mod->lang('none')] = -1;
     foreach ($usertags as $key => $value) {
         $usertaglist[$value] = $key;
     }
     $mod->smarty->assign('input_form_predisplay_udt', $mod->CreateInputDropdown($id, 'fbrp_forma_predisplay_udt', $usertaglist, -1, $this->GetAttr('predisplay_udt', -1)));
     $mod->smarty->assign('input_form_predisplay_each_udt', $mod->CreateInputDropdown($id, 'fbrp_forma_predisplay_each_udt', $usertaglist, -1, $this->GetAttr('predisplay_each_udt', -1)));
     $mod->smarty->assign('title_form_validate_udt', $mod->Lang('title_form_validate_udt'));
     $usertagops = $gCms->GetUserTagOperations();
     $usertags = $usertagops->ListUserTags();
     $usertaglist = array();
     $usertaglist[$mod->lang('none')] = -1;
     foreach ($usertags as $key => $value) {
         $usertaglist[$value] = $key;
     }
     $mod->smarty->assign('input_form_validate_udt', $mod->CreateInputDropdown($id, 'fbrp_forma_validate_udt', $usertaglist, -1, $this->GetAttr('validate_udt', -1)));
     $mod->smarty->assign('title_form_required_symbol', $mod->Lang('title_form_required_symbol'));
     $mod->smarty->assign('input_form_required_symbol', $mod->CreateInputText($id, 'fbrp_forma_required_field_symbol', $this->GetAttr('required_field_symbol', '*'), 50));
     $mod->smarty->assign('input_list_delimiter', $mod->CreateInputText($id, 'fbrp_forma_list_delimiter', $this->GetAttr('list_delimiter', ','), 50));
     $contentops = $gCms->GetContentOperations();
     $mod->smarty->assign('input_redirect_page', $contentops->CreateHierarchyDropdown('', $this->GetAttr('redirect_page', '0'), $id . 'fbrp_forma_redirect_page'));
     $mod->smarty->assign('input_form_template', $mod->CreateTextArea(false, $id, $this->GetAttr('form_template', $this->DefaultTemplate()), 'fbrp_forma_form_template', 'module_fb_area_wide', 'fb_form_template', '', '', '80', '15', '', 'html'));
     $mod->smarty->assign('input_submit_javascript', $mod->CreateTextArea(false, $id, $this->GetAttr('submit_javascript', ''), 'fbrp_forma_submit_javascript', 'module_fb_area_short', 'fb_submit_javascript', '', '', '80', '15', '', 'js') . '<br />' . $mod->Lang('title_submit_javascript_long'));
     $mod->smarty->assign('input_submit_response', $mod->CreateTextArea(false, $id, $this->GetAttr('submit_response', $this->createSampleTemplate(true, false)), 'fbrp_forma_submit_response', 'module_fb_area_wide', '', '', '', '80', '15', '', 'html'));
     $parms = array();
     $parms['forma_submit_response']['html_button'] = true;
     $parms['forma_submit_response']['txt_button'] = false;
     $parms['forma_submit_response']['is_one_line'] = false;
     $parms['forma_submit_response']['is_email'] = false;
     $mod->smarty->assign('help_submit_response', $this->AdminTemplateHelp($id, $parms));
     # fixes for CMSMS 2 compatibility (JM)
     # we need this to get (at least) the lang method on the template {$frmbld->Lang('string')}
     $mod->smarty->assign('frmbld', $mod);
     if (formbuilder_utils::is_CMS2()) {
         return $mod->ProcessTemplate('AddEditForm2.tpl');
     }
     return $mod->ProcessTemplate('AddEditForm.tpl');
 }
Example #6
0
 /**
  * ShowErrors
  * Outputs errors in a nice error box with a troubleshooting link to the wiki
  *
  * @final
  * @param errors - array or string of errors to be shown
  * @return string
  */
 function ShowErrors($errors)
 {
     $theme = cms_utils::get_theme_object();
     if (is_object($theme)) {
         return $theme->ShowErrors($errors);
     }
     return '';
 }
 public function GetHeaderHTML()
 {
     $config = cmsms()->GetConfig();
     if (version_compare(CMS_VERSION, '1.11') < 0) {
         # backward compatibility
         if (version_compare(CMS_VERSION, '1.9') < 0) {
             $this->smarty->assign('bc', true);
         }
         $this->smarty->assign('jq_ui_css', $config['root_url'] . '/modules/' . $this->GetName() . '/css/jquery-ui/base/jquery.ui.all.css');
         $themeName = get_class(cmsms()->variables['admintheme']);
         if (endswith($themeName, 'Theme')) {
             $themeName = substr($themeName, 0, strlen($themeName) - 5);
         }
         $admin_url = $config['root_url'] . '/' . $config['admin_dir'];
     } else {
         $themeName = cms_utils::get_theme_object()->themeName;
         $admin_url = $config['admin_url'];
     }
     $this->smarty->assign('expand_img', $admin_url . '/themes/' . $themeName . '/images/icons/system/expand.gif', '', '', '', 'systemicon');
     $this->smarty->assign('contract_img', $admin_url . '/themes/' . $themeName . '/images/icons/system/contract.gif', '', '', '', 'systemicon');
     $this->smarty->assign('module_id', 'm1_');
     $this->smarty->assign('debug', $config['debug']);
     $this->smarty->assign('locale', substr(get_preference(get_userid(), 'default_cms_language'), 0, 2));
     return $this->ProcessTemplate('header.tpl');
 }
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#-------------------------------------------------------------------------
if (!is_object(@cmsms())) {
    exit;
}
$admintheme = cms_utils::get_theme_object();
$smarty = cmsms()->GetSmarty();
// and a list of all the existent forms.
$forms = $this->GetForms();
$num_forms = count($forms);
if (!formbuilder_utils::is_CMS2()) {
    $smarty->assign('tabheaders', $this->StartTabHeaders() . $this->SetTabHeader('forms', $this->Lang('forms')) . $this->SetTabHeader('config', $this->Lang('configuration')) . $this->EndTabHeaders() . $this->StartTabContent());
    $smarty->assign('start_formtab', $this->StartTab("forms"));
    $smarty->assign('start_configtab', $this->StartTab("config"));
    $smarty->assign('end_tab', $this->EndTab());
    $smarty->assign('end_tabs', $this->EndTabContent());
}
$smarty->assign('start_configform', $this->CreateFormStart($id, 'admin_update_config', $returnid));
$smarty->assign('frmbld', $this);
$smarty->assign('title_form_name', $this->Lang('title_form_name'));
$smarty->assign('title_form_alias', $this->Lang('title_form_alias'));
Example #9
0
 public function offsetGet($key)
 {
     if ($key == 'admintheme') {
         // special case, for compatibility.
         return cms_utils::get_theme_object();
     }
     if (!in_array($key, $this->_allowed_variables)) {
         trigger_error('Retrival of unauthorized internal variables is deprecated: ' . $key, E_USER_NOTICE);
         return;
     }
     if (isset($this->_data[$key])) {
         return $this->_data[$key];
     }
     switch ($key) {
         case 'convertclass':
             $this->_data[$key] = new ConvertClass();
             return $this->_data[$key];
     }
 }