function _sed_si_inject_section_admin($page) { global $DB, $prefs, $_sed_si_l18n, $step, $mlp; if (!isset($DB)) { $DB = new db(); } if (!isset($prefs)) { $prefs = get_prefs(); } $mlp = new sed_lib_mlp('sed_section_fields', $_sed_si_l18n, '', 'admin'); $section_index = ''; $rows = safe_rows_start('*', 'txp_section', "name != 'default' order by name"); $c = @mysql_num_rows($rows); if ($rows && $c > 0) { while ($row = nextRow($rows)) { $name = $row['name']; #$title = $row['title']; #$title = strtr( $title , array( "'"=>''' , '"'=>'"' ) ); # Build the list of sections for the section-tab index $section_index .= '<li id="sed_section-' . $name . '"><a href="#section-' . $name . '" class="sed_si_hide_all_but_one">' . $name . '</a></li>'; } # # Insert a JS variable holding the index of sections... # $newsection = ''; if ($step == 'section_create' || $step == 'section_save') { $newsection = ps('name'); } $filter = ''; $limit = $prefs[_sed_si_prefix_key('filter_limit')]; if (!is_numeric($limit)) { $limit = 18; } if ($c >= $limit) { $filter = '<label for="sed_si_section_index_filter">' . $mlp->gTxt('filter_label') . '</label><br /><input id="sed_si_section_index_filter" type="text" class="edit" />'; } $section_index = '<div id="sed_si_section_index_div">' . '<form id="sed_si_filter_form">' . $filter . '</form>' . '<ol id="sed_si_section_index" class="sed_si_section_index">' . '<li id="sed_section-default"><a href="#section-default" class="sed_si_hide_all_but_one">default</a></li>' . $section_index . '</ol>' . '</div>'; $section_index = str_replace('"', '\\"', $section_index); $r = '<script type=\'text/javascript\'> var sed_si_new_section = "#section-' . $newsection . '"; var sed_si_section_index = "' . $section_index . '";</script>'; $f = '<script src=\'' . hu . 'textpattern/index.php?sed_resources=sed_si_section_js\' type=\'text/javascript\'></script>'; $page = str_replace($f, $r . n . $f, $page); } return $page; }
function _sed_sf_inject_section_admin($page) { # # Inserts the name text inputs into each sections' edit controls # current implementation uses output buffer... # global $DB, $prefs, $_sed_sf_l18n, $step, $mlp; if (!isset($DB)) { $DB = new db(); } if (!isset($prefs)) { $prefs = get_prefs(); } $mlp = new sed_lib_mlp('sed_section_fields', $_sed_sf_l18n, '', 'admin'); $write_tab_header = $mlp->gTxt('write_tab_heading'); $section_index = ''; $rows = safe_rows_start('*', 'txp_section', "name != 'default' order by name"); $c = @mysql_num_rows($rows); if ($rows && $c > 0) { while ($row = nextRow($rows)) { $name = $row['name']; $title = $row['title']; $title = strtr($title, array("'" => ''', '"' => '"')); # Build the list of sections for the section-tab index $section_index .= '<li id="sed_section-' . $name . '"><a href="#section-' . $name . '" class="sed_sf_hide_all_but_one">' . $name . '</a></li>'; $data = _sed_sf_get_data($name); $data_array = sed_lib_extract_name_value_pairs($data); $f = '<input type="text" name="name" value="' . $name . '" size="20" class="edit" tabindex="1" /></td></tr>' . n . n . '<tr><td class="noline" style="text-align: right; vertical-align: middle;">' . gTxt('section_longtitle') . ': </td><td class="noline"><input type="text" name="title" value="' . $title . '" size="20" class="edit" tabindex="1" /></td></tr>'; # Insert custom field visibility controls... $cf_names = @$data_array['cf']; $r = n . n . '<tr><td colspan="2">' . $write_tab_header . '</td></tr>' . n; $max = _sed_sf_get_max_field_number(); $count = 0; $showhideall = ''; for ($x = 1; $x <= $max; $x++) { $value = $cf_names[$x - 1]; $field_name = 'cf_' . $x . '_set'; $global_label = $prefs['custom_' . $x . '_set']; $args = array('{global_label}' => $global_label, '{cfnum}' => $x); $label = $mlp->gTxt('hide_cf', $args); if (!empty($global_label)) { # Only bother showing the show/hide radio buttons if the global field label exists. $count += 1; $r .= '<tr><td class="noline" style="text-align: right; vertical-align: middle;">' . $label . '</td><td class="noline">'; $r .= _sed_sf_showhide_radio($name . '_cf_' . $x . '_visible', $value, '', $field_name); if ($count === 2) { $showhideall = '<tr><td colspan="2" class="noline" style="text-align: right; vertical-align: middle;">'; $showhideall .= '<a class="sed_sf_normal" onclick="_sed_sf_showhideall(\'' . $name . '\',\'0\')">' . $mlp->gTxt('show_all_text') . '</a> / <a class="sed_sf_normal" onclick="_sed_sf_showhideall(\'' . $name . '\',\'1\')">' . $mlp->gTxt('hide_all_text') . '</a>'; $showhideall .= '</td></tr>' . n; } $r .= '</td></tr>' . n; } } $r .= $showhideall . n . '<tr><td colspan="2"></td></tr>' . n; # Insert row to control visibility of this section in the write-tab section selector $ss = @$data_array['ss']; $r .= '<tr><td class="noline" style="text-align: right; vertical-align: middle;">' . $mlp->gTxt('hide_section') . '</td><td class="noline">'; $r .= _sed_sf_showhide_radio('hide_' . $name . '_ss', $ss[0] ? $ss[0] : '0'); $r .= '</td></tr>' . n; $r .= n . '<tr><td colspan="2"></td></tr>' . n . n; $page = str_replace($f, $f . $r, $page); } # # Insert a JS variable holding the index of sections... # $newsection = ''; if ($step == 'section_create' || $step == 'section_save') { $newsection = ps('name'); } $filter = ''; $limit = $prefs[_sed_sf_prefix_key('filter_limit')]; if (!is_numeric($limit)) { $limit = 18; } if ($c >= $limit) { $filter = '<label for="sed_sf_section_index_filter">' . $mlp->gTxt('filter_label') . '</label><br /><input id="sed_sf_section_index_filter" type="text" class="edit" />'; } $section_index = '<div id="sed_sf_section_index_div">' . '<form id="sed_sf_filter_form">' . $filter . '</form>' . '<ol id="sed_sf_section_index" class="sed_sf_section_index">' . '<li id="sed_section-default"><a href="#section-default" class="sed_sf_hide_all_but_one">default</a></li>' . $section_index . '</ol>' . '</div>'; $section_index = str_replace('"', '\\"', $section_index); $r = '<script type=\'text/javascript\'> var sed_sf_new_section = "#section-' . $newsection . '"; var sed_sf_section_index = "' . $section_index . '";</script>'; $f = '<script src=\'' . hu . 'textpattern/index.php?sed_resources=sed_sf_section_js\' type=\'text/javascript\'></script>'; $page = str_replace($f, $r . n . $f, $page); } return $page; }