function css_edit_raw() { global $event, $step; $default_name = safe_field('css', 'txp_section', "name = 'default'"); extract(gpsa(array('name', 'newname', 'copy', 'savenew'))); if ($step == 'css_delete' || empty($name) && $step != 'pour' && !$savenew) { $name = $default_name; } elseif (($copy || $savenew) && trim(preg_replace('/[<>&"\']/', '', $newname))) { $name = $newname; } if (empty($name)) { $buttons = '<div class="edit-title">' . gTxt('name_for_this_style') . ': ' . fInput('text', 'newname', '', 'edit', '', '', 20) . hInput('savenew', 'savenew') . '</div>'; $thecss = gps('css'); } else { $buttons = '<div class="edit-title">' . gTxt('you_are_editing_css') . sp . strong(htmlspecialchars($name)) . '</div>'; $thecss = fetch("css", 'txp_css', 'name', $name); } if (!empty($name)) { $copy = '<span class="copy-as"><label for="copy-css">' . gTxt('copy_css_as') . '</label>' . sp . fInput('text', 'newname', '', 'edit', '', '', '', '', 'copy-css') . sp . fInput('submit', 'copy', gTxt('copy'), 'smallerbox') . '</span>'; } else { $copy = ''; } $right = '<div id="content_switcher">' . hed(gTxt('all_stylesheets'), 2) . graf(sLink('css', 'pour', gTxt('create_new_css')), ' class="action-create smallerbox"') . css_list($name, $default_name) . '</div>'; echo '<div id="' . $event . '_container" class="txp-container txp-edit">' . startTable('edit') . tr(td(form('<div id="main_content">' . $buttons . '<textarea id="css" class="code" name="css" cols="78" rows="32">' . htmlspecialchars($thecss) . '</textarea>' . br . fInput('submit', '', gTxt('save'), 'publish') . eInput('css') . sInput('css_save') . hInput('name', $name) . $copy . '</div>', '', '', 'post', 'edit-form', '', 'style_form'), '', 'column') . tdtl($right, ' class="column"')) . endTable() . '</div>'; }
function css_edit_raw() { global $step; $name = gps('name'); $default_name = safe_field('css', 'txp_section', "name = 'default'"); $name = (!$name or $step == 'css_delete') ? $default_name : $name; if (gps('copy') && trim(preg_replace('/[<>&"\']/', '', gps('newname')))) { $name = gps('newname'); } if ($step == 'pour') { $buttons = gTxt('name_for_this_style') . ': ' . fInput('text', 'newname', '', 'edit', '', '', 20) . hInput('savenew', 'savenew'); $thecss = ''; } else { $buttons = ''; $thecss = base64_decode(fetch("css", 'txp_css', 'name', $name)); } if ($step != 'pour') { $left = graf(gTxt('you_are_editing_css') . br . strong($name)) . graf(eLink('css', 'css_edit_form', 'name', $name, gTxt('edit_css_in_form'))) . graf(sLink('css', 'pour', gTxt('bulkload_existing_css'))); $copy = gTxt('copy_css_as') . sp . fInput('text', 'newname', '', 'edit') . sp . fInput('submit', 'copy', gTxt('copy'), 'smallerbox'); } else { $left = ' '; $copy = ''; } $right = hed(gTxt('all_stylesheets'), 2) . css_list($name, $default_name); echo startTable('edit') . tr(tdtl($left) . td(form(graf($buttons) . '<textarea id="css" class="code" name="css" cols="78" rows="32">' . htmlspecialchars($thecss) . '</textarea>' . br . fInput('submit', '', gTxt('save'), 'publish') . eInput('css') . sInput('css_save') . hInput('name', $name) . $copy)) . tdtl($right)) . endTable(); }
function css_edit_raw() { global $step; $name = !gps('name') ? 'default' : gps('name'); if ($step == 'pour') { $buttons = gTxt('name_for_this_style') . ': ' . fInput('text', 'newname', '', 'edit', '', '', 20) . hInput('savenew', 'savenew'); $thecss = ''; } else { $buttons = ''; $thecss = base64_decode(fetch("css", 'txp_css', 'name', $name)); } if ($step != 'pour') { $left = join('', array(graf(gTxt('you_are_editing_css') . br . strong($name), ' style="margin-top:3em"'), graf(eLink('css', 'css_edit_form', 'name', $name, gTxt('edit_css_in_form')), ' style="margin-top:3em"'), graf(sLink('css', 'pour', gTxt('bulkload_existing_css')), ' style="margin-top:3em"'))); $copy = graf(gTxt('copy_css_as') . br . fInput('text', 'newname', '', 'edit') . br . fInput('submit', 'copy', gTxt('copy'), 'smallerbox'), ' style="margin-top:3em;text-align:right"'); } else { $left = ' '; $copy = ''; } $right = hed(gTxt('all_stylesheets'), 2) . css_list($name); echo startTable('edit') . tr(tdtl($left) . td(form(graf($buttons) . text_area('css', '600', '500', $thecss) . br . fInput('submit', '', gTxt('save'), 'publish') . eInput('css') . sInput('css_save') . hInput('name', $name) . $copy)) . tdtl($right)) . endTable(); }
/** * The main stylesheet editor panel. * * @param string|array $message The activity message */ function css_edit($message = '') { global $event, $step; pagetop(gTxt('edit_css'), $message); $default_name = safe_field("css", 'txp_section', "name = 'default'"); extract(array_map('assert_string', gpsa(array('copy', 'save_error', 'savenew')))); $name = sanitizeForPage(assert_string(gps('name'))); $newname = sanitizeForPage(assert_string(gps('newname'))); if ($step == 'css_delete' || empty($name) && $step != 'pour' && !$savenew) { $name = $default_name; } elseif ((($copy || $savenew) && $newname || $newname && $newname != $name) && !$save_error) { $name = $newname; } $titleblock = inputLabel('new_style', fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_style', false, true), 'css_name', array('', 'instructions_style_name'), array('class' => 'txp-form-field')); if ($name === '') { $titleblock .= hInput('savenew', 'savenew'); } else { $titleblock .= hInput('name', $name); } $titleblock .= eInput('css') . sInput('css_save'); $thecss = gps('css'); if (!$save_error) { $thecss = fetch('css', 'txp_css', 'name', $name); } // Styles code columm. echo n . tag(hed(gTxt('tab_style'), 1, array('class' => 'txp-heading')) . form($titleblock . inputLabel('css', '<textarea class="code" id="css" name="css" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_LARGE . '" dir="ltr">' . txpspecialchars($thecss) . '</textarea>', 'css_code', array('', 'instructions_style_code'), array('class' => 'txp-form-field')), '', '', 'post', '', '', 'style_form'), 'div', array('class' => 'txp-layout-4col-cell-1-2-3', 'id' => 'main_content', 'role' => 'region')); // Styles create/switcher column. $buttonExtras = ''; if ($name) { $buttonExtras .= href('<span class="ui-icon ui-icon-copy"></span> ' . gTxt('duplicate'), '#', array('class' => 'txp-clone', 'data-form' => 'style_form')); } $buttons = graf(tag_void('input', array('class' => 'publish', 'type' => 'submit', 'method' => 'post', 'value' => gTxt('save'), 'form' => 'style_form')), ' class="txp-save"') . graf(sLink('css', 'pour', '<span class="ui-icon ui-extra-icon-new-document"></span> ' . gTxt('create_new_css'), 'txp-new') . $buttonExtras, array('class' => 'txp-actions')); echo n . tag($buttons . css_list($name, $default_name) . n, 'div', array('class' => 'txp-layout-4col-cell-4alt', 'id' => 'content_switcher', 'role' => 'region')); }
/** * The main stylesheet editor panel. * * @param string|array $message The activity message */ function css_edit($message = '') { global $event, $step; pagetop(gTxt('edit_css'), $message); $default_name = safe_field('css', 'txp_section', "name = 'default'"); extract(array_map('assert_string', gpsa(array('copy', 'save_error', 'savenew')))); $name = sanitizeForPage(assert_string(gps('name'))); $newname = sanitizeForPage(assert_string(gps('newname'))); if ($step == 'css_delete' || empty($name) && $step != 'pour' && !$savenew) { $name = $default_name; } elseif ((($copy || $savenew) && $newname || $newname && $newname != $name) && !$save_error) { $name = $newname; } $buttons = n . tag(gTxt('css_name'), 'label', array('for' => 'new_style')) . br . fInput('text', 'newname', $name, 'input-medium', '', '', INPUT_MEDIUM, '', 'new_style', false, true); if ($name) { $buttons .= n . span(href(gTxt('duplicate'), '#', array('id' => 'txp_clone', 'class' => 'clone', 'title' => gTxt('css_clone'))), array('class' => 'txp-actions')); } else { $buttons .= hInput('savenew', 'savenew'); } $thecss = gps('css'); if (!$save_error) { $thecss = fetch('css', 'txp_css', 'name', $name); } echo hed(gTxt('tab_style'), 1, array('class' => 'txp-heading')); echo n . tag(n . tag(form(graf($buttons) . graf(tag(gTxt('css_code'), 'label', array('for' => 'css')) . br . '<textarea class="code" id="css" name="css" cols="' . INPUT_LARGE . '" rows="' . TEXTAREA_HEIGHT_LARGE . '" dir="ltr">' . txpspecialchars($thecss) . '</textarea>') . graf(fInput('submit', '', gTxt('save'), 'publish') . eInput('css') . sInput('css_save') . hInput('name', $name)), '', '', 'post', 'edit-form', '', 'style_form') . n, 'div', array('id' => 'main_content', 'class' => 'txp-layout-cell txp-layout-3-4')) . n . tag(graf(sLink('css', 'pour', gTxt('create_new_css')), array('class' => 'action-create')) . css_list($name, $default_name) . n, 'div', array('id' => 'content_switcher', 'class' => 'txp-layout-cell txp-layout-1-4')) . n, 'div', array('id' => $event . '_container', 'class' => 'txp-layout-grid')); }