/** * Display Site Settings */ function display_site_settings() { global $DB, $PREFS, $DSP; $SD = new Fieldframe_SettingsDisplay(); $r = $SD->block() . $SD->row(array($SD->label('api_url_label', 'api_url_desc'), $SD->text('api_url', $this->site_settings['api_url']))) . $SD->row(array($SD->label('username_label', 'username_desc'), $SD->text('username', $this->site_settings['username']))) . $SD->row(array($SD->label('password_label', 'password_desc'), $SD->text('password', $this->site_settings['password']))) . $SD->block_c(); return $r; }
/** * Display Field Settings * * @param array $field_settings The field's settings * @return array Settings HTML (cell1, cell2, rows) */ function display_field_settings($field_settings) { global $DSP, $LANG; $LANG->fetch_language_file('ff_vz_upload'); // Initialize a new instance of SettingsDisplay $SD = new Fieldframe_SettingsDisplay(); $out = $SD->block('field_settings'); // Get the file upload destinations $dests = $this->_get_upload_dests(); if ($dests) { // If there are any upload destinations, put them in a select box... $upload_dest = isset($field_settings['vz_upload_dest']) ? $field_settings['vz_upload_dest'] : key($dests); $out .= $SD->row(array($SD->label('settings_destination'), $SD->select('vz_upload_dest', $upload_dest, $dests))); } else { $out .= '<p class="highlight">' . $LANG->line('no_destinations_found') . '</p>'; } // Which file types are allowed? $types = isset($field_settings['vz_upload_types']) ? $field_settings['vz_upload_types'] : '*.jpg;*.jpeg;*.png;*.gif'; $out .= $SD->row(array($SD->label('settings_types', 'settings_types_example'), $SD->text('vz_upload_types', $types))); // Allow multiple uploads? $multiple = isset($field_settings['vz_upload_multiple']) ? 1 : 0; $out .= $SD->row(array('<label for="vz_upload_multiple" class="defaultBold">' . $LANG->line('settings_multiple_uploads') . '</label>', $DSP->input_checkbox('vz_upload_multiple', 'y', $multiple, 'style="width:auto"'))); $out .= $SD->block_c(); // Return the settings block return array('cell2' => $out); }
/** * Display Site Settings */ function display_site_settings() { global $DB, $DSP; $fields_q = $DB->query('SELECT f.field_id, f.field_label, g.group_name FROM exp_weblog_fields AS f, exp_field_groups AS g WHERE f.field_type = "data_matrix" AND f.group_id = g.group_id ORDER BY g.group_name, f.field_order, f.field_label'); if ($fields_q->num_rows) { $SD = new Fieldframe_SettingsDisplay(); $r = $SD->block(); $convert_r = ''; $last_group_name = ''; foreach ($fields_q->result as $row) { if ($row['group_name'] != $last_group_name) { $convert_r .= $DSP->qdiv('defaultBold', $row['group_name']); $last_group_name = $row['group_name']; } $convert_r .= '<label>' . $DSP->input_checkbox('convert[]', $row['field_id']) . $row['field_label'] . '</label>' . '<br>'; } $r .= $SD->row(array($SD->label('convert_label', 'convert_desc'), $convert_r)); $r .= $SD->block_c(); return $r; } return FALSE; }
/** * Display Site Settings */ function display_site_settings() { global $DB, $PREFS, $DSP; $SD = new Fieldframe_SettingsDisplay(); $r = $SD->block() . $SD->row(array($SD->label('quality_setting_label', 'quality_setting_desc'), $SD->select('quality_setting', $this->site_settings['quality_setting'], array('y' => 'yes', 'n' => 'no')))) . $SD->row(array($SD->label('thumbs_setting_label', 'thumbs_setting_desc'), $SD->select('thumbs_setting', $this->site_settings['thumbs_setting'], array('y' => 'yes', 'n' => 'no')))) . $SD->block_c(); return $r; }
/** * Display Site Settings */ function display_site_settings() { global $DB; $query = $DB->query('SELECT extension_id FROM exp_extensions WHERE class = "Sarge" AND enabled = "y" LIMIT 1'); if ($query->num_rows) { $SD = new Fieldframe_SettingsDisplay(); return $SD->block() . $SD->row(array($SD->label('convert_sarge_label'), $SD->select('convert', 'n', array('n' => 'no', 'y' => 'yes')))) . $SD->block_c(); } return FALSE; }
/** * Display Site Settings */ function display_site_settings() { global $DB, $PREFS, $DSP, $FFSD; if (!isset($FFSD)) { $FFSD = new Fieldframe_SettingsDisplay(); } $r = $FFSD->block(); $r .= $FFSD->row(array($FFSD->label('Markitup Set'), $FFSD->text('markitup_set', $this->site_settings['markitup_set']))); $r .= $FFSD->row(array($FFSD->label('Markitup Skin'), $FFSD->text('markitup_skin', $this->site_settings['markitup_skin']))); $r .= $FFSD->block_c(); return $r; }
/** * Fieldtypes Manager */ function fieldtypes_manager($standalone = TRUE, $SD = NULL) { global $DB, $DSP, $LANG, $IN, $PREFS, $SD; if (!$SD) { // initialize Fieldframe_SettingsDisplay $SD = new Fieldframe_SettingsDisplay(); } if ($standalone) { // save submitted settings if ($this->save_fieldtypes_manager()) { $DSP->body .= $DSP->qdiv('box', $DSP->qdiv('success', $LANG->line('settings_update'))); } // load language file $LANG->fetch_language_file('fieldframe'); // Breadcrumbs $DSP->crumbline = TRUE; $DSP->title = $LANG->line('fieldtypes_manager'); $DSP->crumb = $DSP->anchor(BASE . AMP . 'C=admin' . AMP . 'area=utilities', $LANG->line('utilities')) . $DSP->crumb_item($LANG->line('fieldtypes_manager')); // open form $DSP->body .= $DSP->form_open(array('action' => 'C=admin' . AMP . 'M=utilities' . AMP . 'P=fieldtypes_manager', 'name' => 'settings_subtext', 'id' => 'ffsettings'), array('name' => strtolower(FF_CLASS))); } // fieldtype settings $DSP->body .= $SD->block('fieldtypes_manager', 5); // initialize fieldtypes if ($ftypes = $this->_get_all_installed_ftypes()) { // add the headers $DSP->body .= $SD->heading_row(array($LANG->line('fieldtype'), $LANG->line('fieldtype_enabled'), $LANG->line('settings'), $LANG->line('documentation'))); $row_ids = array(); foreach ($ftypes as $class_name => $ftype) { $row_id = 'ft_' . $ftype->_class_name; $row_ids[] = '"' . $row_id . '"'; if (method_exists($ftype, 'display_site_settings')) { if (!$ftype->info['no_lang']) { $LANG->fetch_language_file($class_name); } $site_settings = $ftype->display_site_settings(); } else { $site_settings = FALSE; } $DSP->body .= $SD->row(array($SD->label($ftype->info['name'] . NBS . $DSP->qspan('xhtmlWrapperLight defaultSmall', $ftype->info['version']), $ftype->info['desc']), $ftype->_requires ? '--' : $SD->radio_group('ftypes[' . $class_name . '][enabled]', $ftype->_is_enabled ? 'y' : 'n', array('y' => 'yes', 'n' => 'no')), $site_settings ? '<a class="toggle show" id="' . $row_id . '_show"><img src="' . $PREFS->ini('theme_folder_url', 1) . 'cp_global_images/expand.gif" border="0"> ' . $LANG->line('show') . '</a>' . '<a class="toggle hide" id="' . $row_id . '_hide"><img src="' . $PREFS->ini('theme_folder_url', 1) . 'cp_global_images/collapse.gif" border="0"> ' . $LANG->line('hide') . '</a>' : '--', $ftype->info['docs_url'] ? '<a href="' . stripslashes($ftype->info['docs_url']) . '">' . $LANG->line('documentation') . '</a>' : '--'), NULL, array('id' => $row_id)); if ($ftype->_requires) { $data = '<p>' . $ftype->info['name'] . ' ' . $LANG->line('requires') . ':</p>' . '<ul>'; foreach ($ftype->_requires as $dependency => $version) { $data .= '<li class="default">' . $dependency . ' ' . $version . ' ' . $LANG->line('or_later') . '</li>'; } $data .= '</ul>'; $DSP->body .= $SD->row(array('', $data), $SD->row_class); } else { if ($site_settings) { $data = '<div class="ftsettings">' . $this->_group_ftype_inputs($ftype->_class_name, $site_settings) . $DSP->div_c(); $DSP->body .= $SD->row(array($data), '', array('id' => $row_id . '_settings', 'style' => 'display:none;')); } } } $js = '<script type="text/javascript" charset="utf-8">' . NL . ' function ffEnable(ft) {' . NL . ' ft.show.className = "toggle show";' . NL . ' ft.show.onclick = function() {' . NL . ' ft.show.style.display = "none";' . NL . ' ft.hide.style.display = "block";' . NL . ' ft.settings.style.display = "table-row";' . NL . ' };' . NL . ' ft.hide.onclick = function() {' . NL . ' ft.show.style.display = "block";' . NL . ' ft.hide.style.display = "none";' . NL . ' ft.settings.style.display = "none";' . NL . ' };' . NL . ' }' . NL . ' function ffDisable(ft) {' . NL . ' ft.show.className = "toggle show disabled";' . NL . ' ft.show.onclick = null;' . NL . ' ft.show.style.display = "block";' . NL . ' ft.hide.style.display = "none";' . NL . ' ft.settings.style.display = "none";' . NL . ' }' . NL . ' function ffInitRow(rowId) {' . NL . ' var ft = {' . NL . ' tr: document.getElementById(rowId),' . NL . ' show: document.getElementById(rowId+"_show"),' . NL . ' hide: document.getElementById(rowId+"_hide"),' . NL . ' settings: document.getElementById(rowId+"_settings")' . NL . ' };' . NL . ' if (ft.settings) {' . NL . ' ft.toggles = ft.tr.getElementsByTagName("input");' . NL . ' ft.toggles[0].onchange = function() { ffEnable(ft); };' . NL . ' ft.toggles[1].onchange = function() { ffDisable(ft); };' . NL . ' if (ft.toggles[0].checked) ffEnable(ft);' . NL . ' else ffDisable(ft);' . NL . ' }' . NL . ' }' . NL . ' var ffRowIds = [' . implode(',', $row_ids) . '];' . NL . ' for (var i = 0; i < ffRowIds.length; i++) {' . NL . ' ffInitRow(ffRowIds[i]);' . NL . ' }' . NL . '</script>'; $this->snippets['body'][] = $js; } else { if (!defined('FT_PATH')) { $DSP->body .= $SD->info_row('no_fieldtypes_path'); } else { if (in_array('bad_ft_path', $this->errors)) { $DSP->body .= $SD->info_row('bad_fieldtypes_path'); } else { $DSP->body .= $SD->info_row('no_fieldtypes'); } } } $DSP->body .= $SD->block_c(); if ($standalone) { // Close form $DSP->body .= $DSP->qdiv('itemWrapperTop', $DSP->input_submit($LANG->line('apply'))) . $DSP->form_c(); } // CSS $css = '<style type="text/css" charset="utf-8">' . NL . ' #ffsettings a.toggle { display:block; cursor:pointer; }' . NL . ' #ffsettings a.toggle.hide { display:none; }' . NL . ' #ffsettings a.toggle.disabled { color:#000; opacity:0.4; cursor:default; }' . ' #ffsettings .ftsettings { margin:-3px -1px -1px; }' . ' #ffsettings .ftsettings, #ffsettings .ftsettings * { background:#262e33; color:#999; }' . NL . ' #ffsettings .ftsettings input.input, #ffsettings .ftsettings textarea { background:#fff; color:#333; }' . NL . ' #ffsettings .ftsettings table { border:none; }' . NL . ' #ffsettings .ftsettings table tr td { border-top:1px solid #1d2326; padding-left:8px; padding-right:8px; }' . ' #ffsettings .ftsettings table tr td.tableHeading { color:#ddd; background:#232a2e; }' . NL . ' #ffsettings .ftsettings .defaultBold { color:#ccc; }' . NL . ' #ffsettings .ftsettings .box { border-color:transparent; }' . NL . ' #ffsettings .ftsettings .tableCellOne, #ffsettings .ftsettings .tableCellOneBold, #ffsettings .ftsettings .tableCellTwo, #ffsettings .ftsettings .tableCellTwoBold { border-bottom:none; }' . NL . '</style>'; $this->snippets['head'][] = $css; }
/** * Display Field Settings */ function display_field_settings($settings) { global $FF; // create a new SettingsDisplay instance $SD = new Fieldframe_SettingsDisplay(); // open the settings table $r = $SD->block(); $SD->row_count++; $rows = $this->field_settings($settings); // ------------------------------------------- // Field Conversion // ------------------------------------------- // was this previously a different fieldtype? if (isset($FF->data) && $FF->data['field_id'] && $FF->data['field_type'] != 'ftype_id_'.$this->_fieldtype_id) { array_unshift($rows, array( $SD->label('wygwam_convert_label', 'wygwam_convert_desc'), $SD->select('convert', (in_array($FF->data['field_fmt'], array('br', 'xhtml')) ? 'auto' : ''), array( '' => '--', 'auto' => 'Auto <br /> or XHTML', 'textile' => 'Textile' ) ) )); } // add the rows foreach ($rows as $row) { $r .= $SD->row($row); } // close the table $r .= $SD->block_c(); return array('rows' => array(array( '<div id="ft_wygwam" style="margin: -7px -11px -7px -7px; font-size: 12px;">'.$r.'</div>' ))); }