$Form =& new Form(NULL, 'form'); $Form->global_icon(T_('Cancel editing!'), 'close', regenerate_url('action')); $Form->begin_form('fform', $creating ? T_('New widget') : T_('Widget')); $Form->hidden('action', $creating ? 'create' : 'update'); $Form->hidden('wi_ID', $edited_ComponentWidget->ID); $Form->hiddens_by_key(get_memorized('action')); // Display properties: $Form->begin_fieldset(T_('Properties')); $Form->info(T_('Widget type'), $edited_ComponentWidget->get_name()); $Form->info(T_('Description'), $edited_ComponentWidget->get_desc()); $Form->end_fieldset(); // Display (editable) parameters: $Form->begin_fieldset(T_('Params')); //$params = $edited_ComponentWidget->get_params(); // Loop through all widget params: foreach ($edited_ComponentWidget->get_param_definitions($tmp_params = array('for_editing' => true)) as $l_name => $l_meta) { // Display field: autoform_display_field($l_name, $l_meta, $Form, 'Widget', $edited_ComponentWidget); } $Form->end_fieldset(); // dh> TODO: allow the widget to display information, e.g. the coll_category_list // widget could say which blogs it affects. (Maybe this would be useful // for all even, so a default info field(set)). // Does a callback make sense? Then we should have a action hook too, to // catch any params/settings maybe? Although this could be done in the // same hook in most cases probably. (dh) if ($creating) { $Form->end_form(array(array('submit', 'submit', T_('Record'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton'))); } else { $Form->end_form(array(array('submit', 'submit', T_('Update'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton'))); }
/** * Display a blog skin setting fieldset which can be normal, mobile or tablet ( used on _coll_skin_settings.form.php ) * * @param object Form * @param integer skin ID * @param array display params */ function display_skin_fieldset(&$Form, $skin_ID, $display_params) { $Form->begin_fieldset($display_params['fieldset_title'] . get_manual_link('blog_skin_settings') . ' ' . $display_params['fieldset_links']); if (!$skin_ID) { // The skin ID is empty use the same as normal skin ID echo '<div style="font-weight:bold;padding:0.5ex;">' . T_('Same as normal skin.') . '</div>'; } else { $SkinCache =& get_SkinCache(); $edited_Skin = $SkinCache->get_by_ID($skin_ID); echo '<div class="skin_settings well">'; $disp_params = array('skinshot_class' => 'coll_settings_skinshot'); Skin::disp_skinshot($edited_Skin->folder, $edited_Skin->name, $disp_params); // Skin name echo '<div class="skin_setting_row">'; echo '<label>' . T_('Skin name') . ':</label>'; echo '<span>' . $edited_Skin->name . '</span>'; echo '</div>'; if (isset($edited_Skin->version)) { // Skin version echo '<div class="skin_setting_row">'; echo '<label>' . T_('Skin version') . ':</label>'; echo '<span>' . $edited_Skin->version . '</span>'; echo '</div>'; } // Skin type echo '<div class="skin_setting_row">'; echo '<label>' . T_('Skin type') . ':</label>'; echo '<span>' . $edited_Skin->type . '</span>'; echo '</div>'; // Containers if ($skin_containers = $edited_Skin->get_containers()) { $container_ul = '<ul><li>' . implode('</li><li>', $skin_containers) . '</li></ul>'; } else { $container_ul = '-'; } echo '<div class="skin_setting_row">'; echo '<label>' . T_('Containers') . ':</label>'; echo '<span>' . $container_ul . '</span>'; echo '</div>'; echo '</div>'; echo '<div class="skin_settings_form">'; $skin_params = $edited_Skin->get_param_definitions($tmp_params = array('for_editing' => true)); if (empty($skin_params)) { // Advertise this feature!! echo '<p>' . T_('This skin does not provide any configurable settings.') . '</p>'; } else { load_funcs('plugins/_plugin.funcs.php'); // Check if skin settings contain at least one fieldset $skin_fieldsets_exist = false; foreach ($skin_params as $l_name => $l_meta) { if (isset($l_meta['layout']) && $l_meta['layout'] == 'begin_fieldset') { $skin_fieldsets_exist = true; break; } } if (!$skin_fieldsets_exist) { // Enclose all skin settings in single group if no group on the skin array_unshift($skin_params, array('layout' => 'begin_fieldset', 'label' => T_('Skin settings'))); array_push($skin_params, array('layout' => 'end_fieldset')); } // Loop through all widget params: foreach ($skin_params as $l_name => $l_meta) { // Display field: autoform_display_field($l_name, $l_meta, $Form, 'Skin', $edited_Skin); } } echo '</div>'; } $Form->end_fieldset(); }
bad_request_die('Invalid Plugin.'); } param('set_type', 'string', ''); // "Settings" or "UserSettings" if ($set_type != 'Settings') { bad_request_die('Invalid set_type param!'); } param('set_path', '/^\\w+(?:\\[\\w+\\])+$/', ''); load_funcs('plugins/_plugin.funcs.php'); // Init the new setting set: _set_setting_by_path($Plugin, $set_type, $set_path, array()); // Get the new plugin setting set and display it with a fake Form $r = get_plugin_settings_node_by_path($Plugin, $set_type, $set_path, false); $Form = new Form(); // fake Form to display plugin setting autoform_display_field($set_path, $r['set_meta'], $Form, $set_type, $Plugin, NULL, $r['set_node']); break; case 'set_object_link_position': // Change a position of a link on the edit item screen (fieldset "Images & Attachments") // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('link'); // Check item/comment edit permission below after we have the $LinkOwner object ( we call LinkOwner->check_perm ... ) param('link_ID', 'integer', true); param('link_position', 'string', true); $LinkCache =& get_LinkCache(); if (($Link =& $LinkCache->get_by_ID($link_ID)) === false) { // Bad request with incorrect link ID echo ''; exit(0); } $LinkOwner =& $Link->get_LinkOwner();
/** * Display a blog skin setting fieldset which can be normal, mobile or tablet ( used on _coll_skin_settings.form.php ) * * @param object Form * @param integer skin ID * @param array display params */ function display_skin_fieldset(&$Form, $skin_ID, $display_params) { $Form->begin_fieldset($display_params['fieldset_title'] . get_manual_link('blog_skin_settings') . ' ' . $display_params['fieldset_links']); if (!$skin_ID) { // The skin ID is empty use the same as normal skin ID echo '<div style="font-weight:bold;padding:0.5ex;">' . T_('Same as normal skin.') . '</div>'; } else { $SkinCache =& get_SkinCache(); $edited_Skin = $SkinCache->get_by_ID($skin_ID); echo '<div style="float:left;width:30%">'; $disp_params = array('skinshot_class' => 'coll_settings_skinshot'); Skin::disp_skinshot($edited_Skin->folder, $edited_Skin->name, $disp_params); $Form->info(T_('Skin name'), $edited_Skin->name); if (isset($edited_Skin->version)) { $Form->info(T_('Skin version'), $edited_Skin->version); } $Form->info(T_('Skin type'), $edited_Skin->type); if ($skin_containers = $edited_Skin->get_containers()) { $container_ul = '<ul><li>' . implode('</li><li>', $skin_containers) . '</li></ul>'; } else { $container_ul = '-'; } $Form->info(T_('Containers'), $container_ul); echo '</div>'; echo '<div style="margin-left:30%">'; $skin_params = $edited_Skin->get_param_definitions($tmp_params = array('for_editing' => true)); if (empty($skin_params)) { // Advertise this feature!! echo '<p>' . T_('This skin does not provide any configurable settings.') . '</p>'; } else { load_funcs('plugins/_plugin.funcs.php'); // Loop through all widget params: foreach ($skin_params as $l_name => $l_meta) { // Display field: autoform_display_field($l_name, $l_meta, $Form, 'Skin', $edited_Skin); } } echo '</div>'; } $Form->end_fieldset(); }
load_funcs('plugins/_plugin.funcs.php'); $Plugins->restart(); while ($loop_Plugin =& $Plugins->get_next()) { if (!$loop_Plugin->UserSettings && !$Plugins->has_event($loop_Plugin->ID, 'PluginSettingsEditDisplayAfter')) { continue; } // We use output buffers here to display the fieldset only, if there's content in there (either from PluginUserSettings or PluginSettingsEditDisplayAfter). ob_start(); $Form->begin_fieldset($loop_Plugin->name); ob_start(); // UserSettings: $plugin_user_settings = $loop_Plugin->GetDefaultUserSettings($tmp_params = array('for_editing' => true, 'user_ID' => $edited_User->ID)); if (is_array($plugin_user_settings)) { foreach ($plugin_user_settings as $l_name => $l_meta) { // Display form field for this setting: autoform_display_field($l_name, $l_meta, $Form, 'UserSettings', $loop_Plugin, $edited_User); } } // fp> what's a use case for this event? (I soooo want to nuke it...) $Plugins->call_method($loop_Plugin->ID, 'PluginUserSettingsEditDisplayAfter', $tmp_params = array('Form' => &$Form, 'User' => $edited_User)); $has_contents = strlen(ob_get_contents()); $Form->end_fieldset(); if ($has_contents) { ob_end_flush(); ob_end_flush(); } else { // No content, discard output buffers: ob_end_clean(); ob_end_clean(); } }
// Desc: $Form->text_input('edited_plugin_shortdesc', $edited_plugin_shortdesc, 50, T_('Short desc'), '', array('maxlength' => 255)); // Links to external manual (dh> has been removed from form's global_icons before by fp, but is very useful IMHO): if ($edit_Plugin->get_help_link('$help_url')) { $Form->info(T_('Help'), $edit_Plugin->get_help_link('$help_url') . ' ' . $edit_Plugin->get_help_link('$readme')); } $Form->end_fieldset(); // --------------------------- SETTINGS --------------------------- if ($edit_Plugin->Settings) { load_funcs('plugins/_plugin.funcs.php'); // We use output buffers here to only display the fieldset if there's content in there // (either from PluginSettings or PluginSettingsEditDisplayAfter). ob_start(); foreach ($edit_Plugin->GetDefaultSettings($tmp_params = array('for_editing' => true)) as $l_name => $l_meta) { // Display form field for this setting: autoform_display_field($l_name, $l_meta, $Form, 'Settings', $edit_Plugin); } // This can be used add custom input fields or display custom output (e.g. a test link): $admin_Plugins->call_method($edit_Plugin->ID, 'PluginSettingsEditDisplayAfter', $tmp_params = array('Form' => &$Form)); $setting_contents = ob_get_contents(); ob_end_clean(); if ($setting_contents) { $Form->begin_fieldset(T_('Plugin settings'), array('class' => 'clear')); echo $setting_contents; $Form->end_fieldset(); } } // --------------------------- VARIABLES --------------------------- $Form->begin_fieldset(T_('Plugin variables') . ' (' . T_('Advanced') . ')', array('class' => 'clear')); $Form->text_input('edited_plugin_code', $edited_plugin_code, 15, T_('Code'), T_('The code to call the plugin by code. This is also used to link renderer plugins to items.'), array('maxlength' => 32)); $Form->text_input('edited_plugin_priority', $edited_plugin_priority, 4, T_('Priority'), '', array('maxlength' => 4));
$Form->begin_form('fform'); $Form->add_crumb('collection'); $Form->hidden_ctrl(); $Form->hidden('tab', 'plugin_settings'); $Form->hidden('action', 'update'); $Form->hidden('blog', $Blog->ID); // We use output buffers here to display the fieldset only if there's content in there ob_start(); $priority_link = '<a href="' . $loop_Plugin->get_edit_settings_url() . '#ffield_edited_plugin_code">' . $loop_Plugin->priority . '</a>'; $Form->begin_fieldset($loop_Plugin->name . ' ' . $loop_Plugin->get_help_link('$help_url') . ' (' . T_('Priority') . ': ' . $priority_link . ')'); ob_start(); $plugin_settings = $loop_Plugin->get_coll_setting_definitions($tmp_params = array('for_editing' => true, 'blog_ID' => $Blog->ID)); if (is_array($plugin_settings)) { foreach ($plugin_settings as $l_name => $l_meta) { // Display form field for this setting: autoform_display_field($l_name, $l_meta, $Form, 'CollSettings', $loop_Plugin, $Blog); } } $has_contents = strlen(ob_get_contents()); $Form->end_fieldset(); if ($has_contents) { ob_end_flush(); ob_end_flush(); $have_plugins = true; } else { // No content, discard output buffers: ob_end_clean(); ob_end_clean(); } } if ($have_plugins) {
/** * Recursive helper function to display a field of the plugin's settings (by manipulating a Form). * * Used for PluginSettings ("Edit plugin") and PluginUserSettings ("Edit user settings") as well as widgets. * * @todo dh> Allow to move setting sets up and down (order). Control goes into /inc/CONTROL/settings/plugins.php. * @todo NOTE: fp> I'm using this outside of Plugins; I'm not sure about proper factorization yet. * This should probably be an extension of the Form class. Sth like "AutoForm" ;) * * @param string Settings path, e.g. 'locales[0]' or 'setting' * @param array Meta data for this setting. * @param Form (by reference) * @param string Settings type ('Settings' or 'UserSettings' or 'Widget' or 'Skin') * @param Plugin|Widget * @param mixed Target (User object for 'UserSettings') * @param mixed Value to really use (used for recursion into array type settings) */ function autoform_display_field($parname, $parmeta, &$Form, $set_type, $Obj, $set_target = NULL, $use_value = NULL) { global $debug; global $htsrv_url; static $has_array_type; if (!empty($parmeta['no_edit'])) { // this setting is not editable return; } $params = array(); if ($use_value === NULL) { // outermost level $has_array_type = false; // for adding a note about JS $outer_most = true; } else { $outer_most = false; } // Passthrough some attributes to elements: foreach ($parmeta as $k => $v) { if (in_array($k, array('id', 'onchange', 'onclick', 'onfocus', 'onkeyup', 'onkeydown', 'onreset', 'onselect', 'cols', 'rows', 'maxlength'))) { $params[$k] = $v; } } if (!empty($parmeta['multiple'])) { // "multiple" attribute for "select" inputs: $params['multiple'] = 'multiple'; } if (isset($parmeta['note'])) { $params['note'] = $parmeta['note']; } if (!isset($parmeta['type']) || $parmeta['type'] == 'html_input') { $parmeta['type'] = 'text'; } elseif ($parmeta['type'] == 'html_textarea') { $parmeta['type'] = 'textarea'; } if (strpos($parmeta['type'], 'select_') === 0) { // 'allow_none' setting for select_* types if (isset($parmeta['allow_none'])) { $params['allow_none'] = $parmeta['allow_none']; } } $help_icon = NULL; if (isset($parmeta['help'])) { if ($parmeta['help'] === true) { // link to $parname-target: $help_target = '#' . preg_replace(array('~\\]?\\[\\d+\\]\\[~', '~\\]$~'), array('_', ''), $parname); } else { $help_target = $parmeta['help']; } $help_icon = $Obj->get_help_link($help_target); } $set_label = isset($parmeta['label']) ? $parmeta['label'] : ''; if (!empty($parmeta['disabled'])) { $params['disabled'] = 'disabled'; } // "Layout" settings: if (isset($parmeta['layout'])) { switch ($parmeta['layout']) { case 'begin_fieldset': $fieldset_title = $set_label; $Form->begin_fieldset($fieldset_title . $help_icon); break; case 'end_fieldset': $Form->end_fieldset(); break; case 'separator': echo '<hr />'; break; case 'html': // Output HTML code here if (!isset($parmeta['value'])) { $parmeta['value'] = '<div class="error">HTML layout usage:<pre>' . htmlentities("'layout' => 'html',\n'value' => '<em>My HTML code</em>',") . '</pre></div>'; } echo $parmeta['value']; break; } return; } if (!empty($help_icon)) { // Append help icon to note: if (empty($params['note'])) { $params['note'] = $help_icon; } else { $params['note'] .= ' ' . $help_icon; } } if (isset($use_value)) { $set_value = $use_value; } else { switch ($set_type) { case 'CollSettings': $set_value = $Obj->get_coll_setting($parname, $set_target); $error_value = NULL; break; case 'MsgSettings': $set_value = $Obj->get_msg_setting($parname); $error_value = NULL; break; case 'Skin': $set_value = $Obj->get_setting($parname); $error_value = NULL; break; case 'Widget': $set_value = $Obj->get_param($parname); $error_value = NULL; break; case 'UserSettings': // NOTE: this assumes we come here only on recursion or with $use_value set..! $set_value = $Obj->UserSettings->get($parname, $set_target->ID); $error_value = $Obj->PluginUserSettingsValidateSet($tmp_params = array('name' => $parname, 'value' => &$set_value, 'meta' => $parmeta, 'User' => $set_target, 'action' => 'display')); break; case 'Settings': // NOTE: this assumes we come here only on recursion or with $use_value set..! $set_value = $Obj->Settings->get($parname); $error_value = $Obj->PluginSettingsValidateSet($tmp_params = array('name' => $parname, 'value' => &$set_value, 'meta' => $parmeta, 'action' => 'display')); break; default: debug_die("unhandled set_type {$set_type}"); break; } if ($error_value) { // add error param_error('edit_plugin_' . $Obj->ID . '_set_' . $parname, NULL, $error_value); // only add the error to the field } } // Display input element: $input_name = 'edit_plugin_' . $Obj->ID . '_set_' . $parname; if (substr($parmeta['type'], 0, 6) == 'select' && !empty($parmeta['multiple'])) { // a "multiple" select: $input_name .= '[]'; } // Get a value from _POST request to display it e.g. when some error was created during update $value_from_request = get_param($input_name); if ($value_from_request !== NULL) { $set_value = $value_from_request; } switch ($parmeta['type']) { case 'checkbox': $Form->checkbox_input($input_name, $set_value, $set_label, $params); break; case 'checklist': $options = array(); foreach ($parmeta['options'] as $meta_option) { $meta_option_checked = $set_value === NULL ? $meta_option[2] : !empty($set_value[$meta_option[0]]); $options[] = array($input_name . '[' . $meta_option[0] . ']', 1, $meta_option[1], $meta_option_checked); } $Form->checklist($options, $input_name, $set_label, false, false, $params); break; case 'textarea': $textarea_rows = isset($parmeta['rows']) ? $parmeta['rows'] : 3; $Form->textarea_input($input_name, $set_value, $textarea_rows, $set_label, $params); break; case 'select': $params['force_keys_as_values'] = true; // so that numeric keys get used as values! autoform_validate_param_value() checks for the keys only. $Form->select_input_array($input_name, $set_value, $parmeta['options'], $set_label, isset($parmeta['note']) ? $parmeta['note'] : NULL, $params); break; case 'select_blog': $BlogCache =& get_BlogCache(); $Form->select_input_object($input_name, $set_value, $BlogCache, $set_label, $params); break; case 'select_group': $GroupCache =& get_GroupCache(); $Form->select_input_object($input_name, $set_value, $GroupCache, $set_label, $params); break; case 'select_user': $UserCache =& get_UserCache(); $UserCache->clear(); $users_SQL = $UserCache->get_SQL_object(); $users_SQL->LIMIT(isset($parmeta['users_limit']) ? intval($parmeta['users_limit']) : 20); $UserCache->load_by_sql($users_SQL); if (!isset($params['loop_object_method'])) { $params['loop_object_method'] = 'get_preferred_name'; } $Form->select_input_object($input_name, $set_value, $UserCache, $set_label, $params); break; case 'radio': if (!isset($parmeta['field_lines'])) { $parmeta['field_lines'] = false; } $Form->radio($input_name, $set_value, $parmeta['options'], $set_label, $parmeta['field_lines'], $parmeta['note']); break; case 'array': $has_array_type = true; // Always use 'fieldset' layout to display it the same way from normal and ajax calls $Form->switch_layout('fieldset'); if (substr_count($parname, '[') % 2) { // this refers to a specific array type set (with index pos at the end), e.g. when adding a field through AJAX: $pos_last_bracket = strrpos($parname, '['); $k_nb = substr($parname, $pos_last_bracket + 1, -1); $disp_arrays = array('' => $set_value); // empty key.. $parname = substr($parname, 0, $pos_last_bracket); } else { // display all values hold in this set: $disp_whole_set = true; $disp_arrays = $set_value; $fieldset_title = $set_label; if ($debug) { $fieldset_title .= ' [debug: ' . $parname . ']'; } $Form->begin_fieldset($fieldset_title); if (!empty($params['note'])) { echo '<p class="notes">' . $params['note'] . '</p>'; } $k_nb = 0; } $user_ID = $set_type == 'UserSettings' ? $set_target->ID : ''; if (is_array($set_value) && !empty($set_value)) { // Display value of the setting. It may be empty, if there's no set yet. foreach ($disp_arrays as $k => $v) { $remove_action = ''; if (!isset($parmeta['min_count']) || count($set_value) > $parmeta['min_count']) { // provide icon to remove this set $remove_action = '<span class="pull-right">' . action_icon(T_('Remove'), 'minus', regenerate_url('action', array('action=del_settings_set&set_path=' . $parname . '[' . $k . ']' . ($set_type == 'UserSettings' ? '&user_ID=' . $user_ID : ''), 'plugin_ID=' . $Obj->ID)), T_('Remove'), 5, 3, array('onclick' => "\n\t\t\t\t\t\t\t\t\t\tjQuery('#" . $parname . '_' . $k_nb . "').remove();\n\t\t\t\t\t\t\t\t\t\treturn false;")) . '</span>'; } $Form->begin_fieldset('#' . $k_nb . $remove_action, array('class' => 'bordered', 'id' => $parname . '_' . $k_nb)); if (isset($parmeta['key'])) { // KEY FOR THIS ENTRY: if (!strlen($k) && isset($parmeta['key']['defaultvalue'])) { // key is not given/set and we have a default: $l_value = $parmeta['key']['defaultvalue']; } else { $l_value = $k; } // RECURSE: autoform_display_field($parname . '[' . $k_nb . '][__key__]', $parmeta['key'], $Form, $set_type, $Obj, $set_target, $l_value); } foreach ($parmeta['entries'] as $l_set_name => $l_set_entry) { $l_value = isset($set_value[$k][$l_set_name]) ? $set_value[$k][$l_set_name] : NULL; // RECURSE: autoform_display_field($parname . '[' . $k_nb . '][' . $l_set_name . ']', $l_set_entry, $Form, $set_type, $Obj, $set_target, $l_value); } $Form->end_fieldset(); $k_nb++; } } // TODO: fix this for AJAX callbacks, when removing and re-adding items (dh): if (!isset($parmeta['max_number']) || $parmeta['max_number'] > $k_nb) { // no max_number defined or not reached: display link to add a new set $set_path = $parname . '[' . $k_nb . ']'; echo '<div id="' . $parname . '_add_new">'; echo action_icon(sprintf(T_('Add a new set of «%s»'), $set_label), 'add', regenerate_url('action', array('action=add_settings_set', 'set_path=' . $set_path . ($set_type == 'UserSettings' ? '&user_ID=' . get_param('user_ID') : ''), 'plugin_ID=' . $Obj->ID)), T_('Add'), 5, 3, array('onclick' => "\n\t\t\t\t\t\tvar oThis = this;\n\t\t\t\t\t\tjQuery.get('{$htsrv_url}async.php', {\n\t\t\t\t\t\t\t\taction: 'add_plugin_sett_set',\n\t\t\t\t\t\t\t\tplugin_ID: '{$Obj->ID}',\n\t\t\t\t\t\t\t\tset_type: '{$set_type}',\n\t\t\t\t\t\t\t\tset_path: '{$set_path}'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfunction(r, status) {\n\t\t\t\t\t\t\t\tjQuery('#" . $parname . "_add_new').replaceWith(r);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn false;")); echo '</div>'; } if (!empty($disp_whole_set)) { // close the surrounding fieldset: $Form->end_fieldset(); } $Form->switch_layout(NULL); break; case 'password': $params['type'] = 'password'; // same as text input, but type=password // same as text input, but type=password case 'float': case 'integer': case 'text': // Default: "text input" if (isset($parmeta['size'])) { $size = (int) $parmeta['size']; } else { // Default size: $size = 15; } if (isset($parmeta['maxlength'])) { $params['maxlength'] = (int) $parmeta['maxlength']; } else { // do not use size as maxlength, if not given! $params['maxlength'] = ''; } $Form->text_input($input_name, $set_value, $size, $set_label, '', $params); // TEMP: Note already in params break; case 'info': $Form->info($parmeta['label'], $parmeta['info']); break; case 'color': $Form->color_input($input_name, $set_value, $set_label, '', $params); break; default: debug_die('Unsupported type [' . $parmeta['type'] . '] from GetDefaultSettings()!'); } if ($outer_most && $has_array_type) { // Note for Non-Javascript users: echo '<script type="text/javascript"></script><noscript>'; echo '<p class="note">' . T_('Note: before adding a new set you have to save any changes.') . '</p>'; echo '</noscript>'; } }
} $Form->username('reportpm_from', $User, T_('From'), T_('User login.')); $Form->text_input('reportpm_title', $Settings->get('reportpm_title'), 58, T_('Title'), '', array('maxlength' => 5000)); $Form->textarea_input('reportpm_message', $Settings->get('reportpm_message'), 15, T_('Message'), array('cols' => 45)); $Form->end_fieldset(); // -------- Display plugins settings -------- // load_funcs('plugins/_plugin.funcs.php'); $plugins_settings_content = ''; $Plugins->restart(); while ($loop_Plugin =& $Plugins->get_next()) { // We use output buffers here to display the fieldset only if there's content in there ob_start(); $plugin_settings = $loop_Plugin->get_msg_setting_definitions($tmp_params = array('for_editing' => true)); if (is_array($plugin_settings)) { foreach ($plugin_settings as $l_name => $l_meta) { // Display form field for this setting: autoform_display_field($l_name, $l_meta, $Form, 'MsgSettings', $loop_Plugin); } } $plugins_settings_content .= ob_get_contents(); ob_end_clean(); } if (!empty($plugins_settings_content)) { // Display fieldset only when at least one renderer plugin exists $Form->begin_fieldset(T_('Renderer plugins settings') . get_manual_link('messaging-plugin-settings'), array('id' => 'msgplugins')); echo $plugins_settings_content; $Form->end_fieldset(); } // -------- End of Display plugins settings -------- // $Form->buttons(array(array('submit', 'submit', T_('Save Changes!'), 'SaveButton'))); $Form->end_form();