function input($objectName, $method, $object, $options = array())
{
    $attr = $object->getAttribute($method);
    switch ($attr->type) {
        case 'string':
            $str = text_field($objectName, $method, $object, $options);
            break;
        case 'text':
            $str = text_area($objectName, $method, $object, $options);
            break;
        case 'date':
            $str = date_select($objectName, $method, $object);
            break;
        case 'datetime':
            $str = date_time_select($objectName, $method, $object);
            break;
        case 'integer':
            $str = text_field($objectName, $method, $object, $options);
            break;
        case 'float':
            $str = text_field($objectName, $method, $object, $options);
            break;
        case 'boolean':
            $str = check_box($objectName, $method, $object, $options);
            break;
        default:
            $str = hidden_field($objectName, $method, $object);
            break;
    }
    return error_wrapping($str, isset($object->errors[$method]));
}
Example #2
0
    /**
     * Weave the current template and show it ready to paste.
     */
    static function export()
    {
        $f = file_get_contents(txpath . self::$template);
        foreach (self::$what as $table => $columns) {
            $tick = '`';
            $cols = empty($columns) ? '*' : $tick . join('`,`', doSlash($columns)) . $tick;
            $rs = safe_rows($cols, $table, (empty($columns) ? '1=1' : $columns[0] . ' not like \'%.min%\'') . (empty($columns) ? '' : ' ORDER BY `' . $columns[0] . '`'));
            $rows = array();
            foreach ($rs as $a) {
                // Enforce *nix new-lines
                $a = str_replace("\r\n", "\n", $a);
                // Literal backslash into corresponding MySQL literal
                foreach ($a as &$v) {
                    $v = addcslashes(addcslashes($v, '\\'), '\\');
                }
                $a = "'" . join("', '", doSlash($a)) . "'";
                $rows[] = self::$where . ' = "INSERT INTO `".PFX."' . $table . '`(' . $cols . ') VALUES(' . $a . ')";';
            }
            $f = preg_replace("#(// sql:{$table}).*(// /sql:{$table})#s", '$1' . n . join(n, $rows) . n . '$2', $f);
        }
        echo text_area('code', 600, '', $f, 'code');
        echo script_js(<<<EOS
\t\t\$('#code').focus(function() {
\t\t\tthis.select();
\t\t});
EOS
);
    }
Example #3
0
 public function simple_wysiwyg($object, $attribute, $options = array(), $with_label = true)
 {
     if ($options["class"]) {
         $options["class"] .= " widgEditor";
     } else {
         $options["class"] = "widgEditor";
     }
     return text_area($object, $attribute, $options, $with_label, "Put your content here");
 }
Example #4
0
function image_edit($message = '', $id = '')
{
    if (!$id) {
        $id = gps('id');
    }
    global $txpcfg, $img_dir;
    pagetop('image', $message);
    $categories = getTree("root", "image");
    $rs = safe_row("*", "txp_image", "id='{$id}'");
    if ($rs) {
        extract($rs);
        echo startTable('list'), tr(td('<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" />' . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'image_replace', 'image', $id))), tr(td(join('', array($thumbnail ? '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />' . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', 'image', $id))))), function_exists("imagecreatefromjpeg") ? thumb_ui($id) : '', tr(td(form(graf(gTxt('image_name') . br . fInput('text', 'name', $name, 'edit')) . graf(gTxt('image_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('alt_text') . br . fInput('text', 'alt', $alt, 'edit', '', '', 50)) . graf(gTxt('caption') . br . text_area('caption', '100', '400', $caption)) . graf(fInput('submit', '', gTxt('save'), 'publish')) . hInput('id', $id) . eInput('image') . sInput('image_save')))), endTable();
    }
}
Example #5
0
function field_html($args)
{
    switch ($args[2]) {
        case 'textarea':
            return text_area($args);
        case 'checkbox':
        case 'radio':
        case 'button':
        case 'text':
            return text_button($args);
        case 'submit':
        default:
            return text_field($args);
    }
}
 function field_html($args, $arrSlide = array())
 {
     switch ($args['type']) {
         case 'textarea':
             return text_area($args, $arrSlide);
         case 'checkbox':
             return checkbox_field($args, $arrSlide);
         case 'select':
             return select_field($args, $arrSlide);
         case 'image':
             return image_field($args, $arrSlide);
         default:
             return text_field($args, $arrSlide);
     }
 }
function field_html($args)
{
    switch ($args[2]) {
        case 'textarea':
            return text_area($args);
        case 'checkbox':
            // To Do
        // To Do
        case 'radio':
            // To Do
        // To Do
        case 'text':
        default:
            return text_field($args);
    }
}
function field_html($args)
{
    switch ($args[2]) {
        case 'textarea':
            return text_area($args);
        case 'checkbox':
            // Checkbox
            return check_box($args);
        case 'background_variant':
            // Dropmenu
            return background_variant($args);
        case 'image_url':
            // Image URL
            return image_url($args);
        case 'text':
        default:
            return text_field($args);
    }
}
Example #9
0
function field_html($args)
{
    switch ($args[2]) {
        case 'textarea':
            return text_area($args);
        case 'checkbox':
            // Checkbox
            return check_box($args);
        case 'dropmenu':
            // Checkbox
            return dropmenu_sidebaropt($args);
        case 'radio':
            // To Do
        // To Do
        case 'text':
        default:
            return text_field($args);
    }
}
Example #10
0
        <td><?php 
echo text_field_tag("tag_alias->name", array('size' => 40));
?>
</td>
      </tr>
      <tr>
        <th><label for="tag_alias_alias">Alias to</label></th>
        <td><?php 
echo text_field_tag("tag_alias->alias", array('size' => 40));
?>
</td>
      </tr>
      <tr>
        <th><label for="tag_alias_reason">Reason</label></th>
        <td><?php 
echo text_area("tag_alias->reason", array('size' => "40x2"));
?>
</td>
      </tr>
      <tr>
        <td colspan="2"><?php 
echo submit_tag("Submit");
?>
</td>
      </tr>
    </table>
  </form>
</div>

<div id="paginator">
  <?php 
Example #11
0
function file_edit($message = '', $id = '')
{
    global $txpcfg, $file_base_path, $levels, $path_from_root;
    extract(doSlash(gpsa(array('name', 'category', 'permissions', 'description'))));
    if (!$id) {
        $id = gps('id');
    }
    pagetop('file', $message);
    $categories = getTree("root", "file");
    $rs = safe_row("*", "txp_file", "id='{$id}'");
    if ($rs) {
        extract($rs);
        if ($permissions == '') {
            $permissions = '-1';
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $existing_files = get_filenames();
        $status = '<span style="color:';
        $status .= $file_exists ? 'green' : 'red';
        $status .= '">';
        $status .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $status .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, $filename, $filename) : $filename;
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf(gTxt('file_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . graf(fInput('submit', '', gTxt('save'))) . hInput('filename', $filename) . hInput('id', $id) . eInput('file') . sInput('file_save'))));
        } else {
            $form = tr(tda(hed(gTxt('file_relink'), 3) . file_upload_form(gTxt('upload_file'), 'upload', 'file_replace', $id) . form(graf(gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('description', $description) . sInput('file_save'))), ' colspan="4" style="border:0"'));
        }
        echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $status) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . (isset($downloads) ? $downloads : 0)))), $form, endTable();
    }
}
Example #12
0
 function edit_view($id = '')
 {
     global $txpcfg, $img_dir, $file_max_upload_size;
     $out = array();
     if (!$id) {
         $id = assert_int(gps('id'));
     }
     extract($this->context);
     $categories = tree_get('txp_category', NULL, "type='image'");
     $rs = safe_row("*", "txp_image", "id = {$id}");
     if ($rs) {
         extract($rs);
         if ($ext != '.swf') {
             $img = '<img src="' . hu . $img_dir . '/' . $id . $ext . '" height="' . $h . '" width="' . $w . '" alt="" "title="' . $id . $ext . ' (' . $w . ' &#215; ' . $h . ')" />';
         } else {
             $img = '';
         }
         if ($thumbnail and $ext != '.swf') {
             $thumb = '<img src="' . hu . $img_dir . '/' . $id . 't' . $ext . '" alt="" />';
         } else {
             $thumb = '';
         }
         $out[] = startTable('edit') . tr(td($img . br . upload_form(gTxt('replace_image'), 'replace_image_form', 'replace', $this->event, $id, $file_max_upload_size, 'image-replace', ''))) . tr(td(join('', array($thumbnail ? $thumb . br : '', upload_form(gTxt('upload_thumbnail'), 'upload_thumbnail', 'thumbnail_insert', $this->event, $id, $file_max_upload_size, 'upload-thumbnail', '')))));
         $out[] = check_gd($ext) ? $this->thumb_ui($id, $thumbnail) : '';
         $out[] = tr(td(form(graf('<label for="image-name">' . gTxt('image_name') . '</label>' . br . fInput('text', 'name', $name, 'edit', '', '', '', '', 'image-name')) . graf('<label for="image-category">' . gTxt('image_category') . '</label>' . br . categorySelectInput('image', 'category', $category, 'image-category')) . graf('<label for="alt-text">' . gTxt('alt_text') . '</label>' . br . fInput('text', 'alt', $alt, 'edit', '', '', 50, '', 'alt-text')) . graf('<label for="caption">' . gTxt('caption') . '</label>' . br . text_area('caption', '100', '400', $caption, 'caption')) . n . graf(fInput('submit', '', gTxt('save'), 'publish')) . n . hInput('id', $id) . n . eInput($this->event) . n . sInput('save') . n . hInput('sort', $sort) . n . hInput('dir', $dir) . n . hInput('page', $page) . n . hInput('search_method', $search_method) . n . hInput('crit', $crit)))) . endTable();
     }
     return join('', $out);
 }
Example #13
0
 function prefs($event, $step)
 {
     pagetop('hak_tinymce ' . gTxt('preferences'), $step == 'update' ? gTxt('preferences_saved') : '');
     if ($step == 'install') {
         // Install the preferences table.
         hak_tinymce::install();
     }
     if ($step == 'uninstall') {
         //remove table
         safe_query("DROP TABLE " . PFX . "txp_hak_tinymce");
     }
     if ($step == 'update') {
         extract(doSlash(gpsa(array('hak_show_toggle', 'hak_hide_on_textile_edit', 'hak_tinymce_path', 'hak_tinymce_body_init', 'hak_tinymce_excerpt_init', 'hak_tinymce_callbacks', 'hak_hide_textile_select', 'hak_enable_body', 'hak_enable_excerpt', 'hak_use_compressor', 'hak_tinymce_compressor_init'))));
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_show_toggle}'", "pref_name = 'show_toggle'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_hide_on_textile_edit}'", "pref_name = 'hide_on_textile_edit'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_tinymce_path}'", "pref_name = 'tinymce_path'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_tinymce_body_init}'", "pref_name = 'body_init'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_tinymce_excerpt_init}'", "pref_name = 'excerpt_init'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_tinymce_callbacks}'", "pref_name = 'callbacks'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_hide_textile_select}'", "pref_name = 'hide_textile_select'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_enable_body}'", "pref_name = 'enable_body'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_enable_excerpt}'", "pref_name = 'enable_excerpt'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_use_compressor}'", "pref_name = 'use_compressor'");
         safe_update('txp_hak_tinymce', "pref_value = '{$hak_tinymce_compressor_init}'", "pref_name = 'compressor_init'");
     }
     if (hak_tinymce::check_install()) {
         extract(hak_tinymce::getPrefs());
         echo n . t . '<div style="margin: auto; width:40%;">' . n . t . t . hed('hak_tinymce ' . gTxt('Preferences'), '1') . n . n . form(n . eInput('hak_tinymce_prefs') . n . sInput('update') . n . fInput('submit', 'update', 'Update', 'smallerbox') . n . graf(hak_tinymce::mce_gTxt('hak_show_toggle') . br . n . yesnoRadio('hak_show_toggle', $show_toggle) . br . n . tag(tag(hak_tinymce::mce_gTxt('auto_disable'), "em"), "small")) . n . graf(hak_tinymce::mce_gTxt('hak_hide_on_textile_edit') . br . n . yesnoRadio('hak_hide_on_textile_edit', $hide_on_textile_edit)) . n . graf(hak_tinymce::mce_gTxt('hak_hide_textile_select') . br . n . yesnoRadio('hak_hide_textile_select', $hide_textile_select)) . n . graf(hak_tinymce::mce_gTxt('hak_tinymce_path') . br . n . finput('text', 'hak_tinymce_path', $tinymce_path, '', '', '', 60, '', 'hak_tinymce_path') . hak_tinymce::file_exists($tinymce_path)) . n . graf(hak_tinymce::mce_gTxt('enable_body') . br . n . yesnoRadio('hak_enable_body', $enable_body)) . n . graf(hak_tinymce::mce_gTxt('hak_tinymce_body_init') . br . tag(tag("(" . hak_tinymce::mce_gTxt('line_end') . ")", "em"), "small") . n . href(hak_tinymce::mce_gTxt('documentation'), "http://tinymce.moxiecode.com/documentation.php") . br . n . text_area('hak_tinymce_body_init', 200, 400, $body_init)) . n . graf(hak_tinymce::mce_gTxt('enable_excerpt') . br . n . yesnoRadio('hak_enable_excerpt', $enable_excerpt)) . n . graf(hak_tinymce::mce_gTxt('hak_tinymce_excerpt_init') . br . tag(tag("(" . hak_tinymce::mce_gTxt('line_end') . ")", "em"), "small") . n . href(hak_tinymce::mce_gTxt('documentation'), "http://tinymce.moxiecode.com/documentation.php") . br . n . text_area('hak_tinymce_excerpt_init', 200, 400, $excerpt_init)) . n . graf(hak_tinymce::mce_gTxt('hak_tinymce_callbacks') . br . n . text_area('hak_tinymce_callbacks', 200, 400, $callbacks)) . n . graf(hak_tinymce::mce_gTxt('use_compressor') . br . n . yesnoRadio('hak_use_compressor', $use_compressor) . hak_tinymce::file_exists(hak_compressor_path($tinymce_path), "compressor_not_found")) . n . graf(hak_tinymce::mce_gTxt('hak_tinymce_compressor_init') . br . tag(tag("(" . hak_tinymce::mce_gTxt('compressor_line_end') . ")", "em"), "small") . n . href(hak_tinymce::mce_gTxt('documentation'), "http://wiki.moxiecode.com/index.php/TinyMCE:Compressor/PHP") . br . n . text_area('hak_tinymce_compressor_init', 200, 400, $compressor_init)) . n . n . fInput('submit', 'update', 'Update', 'smallerbox')) . '</div>';
         echo n . t . '<div style="margin: 60px auto 0; width:40%;">' . n . hed(hak_tinymce::mce_gTxt('uninstall'), '1') . n . t . t . graf(hak_tinymce::mce_gTxt('uninstall_message')) . n . n . form(n . eInput('hak_tinymce_prefs') . n . sInput('uninstall') . n . n . fInput('submit', 'uninstall', 'Uninstall ', 'smallerbox'), "", "confirm('" . hak_tinymce::mce_gTxt('uninstall_confirm') . "')") . '</div>';
     } else {
         echo n . t . '<div style="margin: auto; width:40%;">' . n . t . t . hed('hak_tinymce ' . gTxt('Preferences'), '1') . n . graf(hak_tinymce::mce_gTxt('install_message')) . n . n . form(n . eInput('hak_tinymce_prefs') . n . sInput('install') . n . n . fInput('submit', 'install', 'Install ', 'smallerbox')) . '</div>';
     }
 }
Example #14
0
/**
 * Renders description partial.
 *
 * The rendered widget can be customised via the 'article_ui > description'
 * pluggable UI callback event.
 *
 * @param  array  $rs Article data
 * @return string HTML
 */
function article_partial_description($rs)
{
    $out = graf('<label for="description">' . gTxt('description') . '</label>' . popHelp('description') . br . text_area('description', 0, 0, article_partial_description_value($rs), 'description', TEXTAREA_HEIGHT_SMALL, INPUT_LARGE), ' class="description"');
    return pluggable_ui('article_ui', 'description', $out, $rs);
}
Example #15
0
function image_edit($message = '', $id = '')
{
    global $prefs, $file_max_upload_size, $txp_user, $event, $all_image_cats;
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $rs = safe_row("*, unix_timestamp(date) as uDate", "txp_image", "id = {$id}");
    if ($rs) {
        extract($rs);
        if (!has_privs('image.edit') && !($author === $txp_user && has_privs('image.edit.own'))) {
            image_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('edit_image'), $message);
        extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method')));
        if ($ext != '.swf') {
            $aspect = $h == $w ? ' square' : ($h > $w ? ' portrait' : ' landscape');
            $img_info = $id . $ext . ' (' . $w . ' &#215; ' . $h . ')';
            $img = '<div class="fullsize-image"><img class="content-image" src="' . imagesrcurl($id, $ext) . "?{$uDate}" . '" alt="' . $img_info . '" title="' . $img_info . '" /></div>';
        } else {
            $img = $aspect = '';
        }
        if ($thumbnail and $ext != '.swf') {
            $thumb_info = $id . 't' . $ext . ' (' . $thumb_w . ' &#215; ' . $thumb_h . ')';
            $thumb = '<img class="content-image" src="' . imagesrcurl($id, $ext, true) . "?{$uDate}" . '" alt="' . $thumb_info . '" ' . ($thumb_w ? 'width="' . $thumb_w . '" height="' . $thumb_h . '" title="' . $thumb_info . '"' : '') . ' />';
        } else {
            $thumb = '';
            if ($thumb_w == 0) {
                $thumb_w = get_pref('thumb_w', 0);
            }
            if ($thumb_h == 0) {
                $thumb_h = get_pref('thumb_h', 0);
            }
        }
        echo n . '<div id="' . $event . '_container" class="txp-container">';
        echo pluggable_ui('image_ui', 'fullsize_image', $img, $rs), '<section class="txp-edit">', hed(gTxt('edit_image'), 2), pluggable_ui('image_ui', 'image_edit', wrapGroup('image_edit_group', upload_form('', '', 'image_replace', 'image', $id, $file_max_upload_size, 'image_replace', 'image-replace'), 'replace_image', 'replace-image', 'replace_image_form'), $rs), pluggable_ui('image_ui', 'thumbnail_image', '<div class="thumbnail-edit">' . ($thumbnail ? $thumb . n . dLink('image', 'thumbnail_delete', 'id', $id, '', '', '', '', array($page, $sort, $dir, $crit, $search_method)) : '') . '</div>', $rs), pluggable_ui('image_ui', 'thumbnail_edit', wrapGroup('thumbnail_edit_group', upload_form('', '', 'thumbnail_insert', 'image', $id, $file_max_upload_size, 'upload_thumbnail', 'thumbnail-upload'), 'upload_thumbnail', 'thumbnail-upload', 'upload_thumbnail'), $rs), check_gd($ext) ? pluggable_ui('image_ui', 'thumbnail_create', wrapGroup('thumbnail_create_group', form(graf(n . '<label for="width">' . gTxt('thumb_width') . '</label>' . fInput('text', 'width', @$thumb_w, 'input-xsmall', '', '', INPUT_XSMALL, '', 'width') . n . '<label for="height">' . gTxt('thumb_height') . '</label>' . fInput('text', 'height', @$thumb_h, 'input-xsmall', '', '', INPUT_XSMALL, '', 'height') . n . '<label for="crop">' . gTxt('keep_square_pixels') . '</label>' . checkbox('crop', 1, @$prefs['thumb_crop'], '', 'crop') . fInput('submit', '', gTxt('Create')), ' class="edit-alter-thumbnail"') . hInput('id', $id) . eInput('image') . sInput('thumbnail_create') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'thumbnail_alter_form'), 'create_thumbnail', 'thumbnail-alter', 'create_thumbnail'), $rs) : '', '<div class="image-detail">', form(inputLabel('image_name', fInput('text', 'name', $name, '', '', '', INPUT_REGULAR, '', 'image_name'), 'image_name') . inputLabel('image_category', treeSelectInput('category', $all_image_cats, $category, 'image_category'), 'image_category') . inputLabel('image_alt_text', fInput('text', 'alt', $alt, '', '', '', INPUT_REGULAR, '', 'image_alt_text'), 'alt_text') . inputLabel('image_caption', text_area('caption', 0, 0, $caption, 'image_caption', TEXTAREA_HEIGHT_SMALL, INPUT_LARGE), 'caption', '', '', '') . pluggable_ui('image_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . hInput('id', $id) . eInput('image') . sInput('image_save') . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('search_method', $search_method) . hInput('crit', $crit), '', '', 'post', 'edit-form', '', 'image_details_form'), '</div>', '</section>' . n . '</div>';
    }
}
function unterkategorien_form($kat_id)
{
    $kat_name = get_kategorie_name($kat_id);
    $db_abfrage = "SELECT UNTERKATEGORIE_NAME FROM DETAIL_UNTERKATEGORIEN WHERE KATEGORIE_ID='{$kat_id}' ORDER BY UNTERKATEGORIE_NAME ASC";
    $resultat = mysql_query($db_abfrage) or die(mysql_error());
    erstelle_formular(NULL, NULL);
    erstelle_hiddenfeld("kat_name", "{$kat_name}");
    echo "<tr><td>";
    echo "<select name=\"detail_ukat_name\" size=1>\n";
    while (list($UNTERKATEGORIE_NAME) = mysql_fetch_row($resultat)) {
        echo "<option value=\"{$UNTERKATEGORIE_NAME}\">{$UNTERKATEGORIE_NAME}</option>\n";
    }
    echo "</select>\n";
    echo "</td></tr>";
    echo "<tr><td>";
    text_area("Bemerkung", "30", "6");
    echo "</td></tr>";
    echo "<tr><td>";
    erstelle_submit_button("submit_ukat", "Eintragen");
    echo "</td></tr>";
    ende_formular();
}
Example #17
0
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 = '&nbsp;';
        $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();
}
Example #18
0
function file_edit($message = '', $id = '')
{
    global $txpcfg, $file_base_path, $levels, $file_statuses;
    pagetop(gTxt('file'), $message);
    extract(gpsa(array('name', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'search_method', 'publish_now')));
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $categories = getTree('root', 'file');
    $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = {$id}");
    if ($rs) {
        extract($rs);
        if ($permissions == '') {
            $permissions = '-1';
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $replace = $file_exists ? tr(td(file_upload_form(gTxt('replace_file'), 'upload', 'file_replace', $id))) : '';
        $existing_files = get_filenames();
        $condition = '<span class="';
        $condition .= $file_exists ? 'ok' : 'not-ok';
        $condition .= '">';
        $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $condition .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
        $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp')) . n . graf(gtxt('date') . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created'])) . n . graf(gTxt('time') . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']));
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf(gTxt('file_category') . br . treeSelectInput('category', $categories, $category)) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . fieldset(radio_list('status', $file_statuses, $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . graf(fInput('submit', '', gTxt('save'))) . eInput('file') . sInput('file_save') . hInput('filename', $filename) . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method))));
        } else {
            $form = tr(tda(hed(gTxt('file_relink'), 3) . file_upload_form(gTxt('upload_file'), 'upload', 'file_replace', $id) . form(graf(gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . sInput('file_save') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('description', $description) . hInput('status', $status) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method))), ' colspan="4" style="border:0"'));
        }
        echo startTable('list'), tr(td(graf(gTxt('file_status') . br . $condition) . graf(gTxt('file_name') . br . $downloadlink) . graf(gTxt('file_download_count') . br . $downloads))), $form, $replace, endTable();
    }
}
Example #19
0
function tdb($thing)
{
    return n . graf(text_area('tag', '100', '300', $thing), ' id="tagbuilder-output"');
}
Example #20
0
 
 $tool_content .= "
     <div class='form-wrapper'>
         <form class='form-horizontal' role='form' action='$edit_url' method='post'>
           $html_id
            <div class='form-group".(Session::getError('term') ? " has-error" : "")."'>
                 <label for='term' class='col-sm-2 control-label'>$langGlossaryTerm: </label>
                 <div class='col-sm-10'>
                     <input type='text' class='form-control' id='term' name='term' placeholder='$langGlossaryTerm' value='$term'>
                     <span class='help-block'>".Session::getError('term')."</span>
                 </div>
            </div>
            <div class='form-group".(Session::getError('definition') ? " has-error" : "")."'>
                 <label for='term' class='col-sm-2 control-label'>$langGlossaryDefinition: </label>
                 <div class='col-sm-10'>
                     " . @text_area('definition', 4, 60, $definition) . "
                     <span class='help-block'>".Session::getError('definition')."</span>    
                 </div>
            </div>
            <div class='form-group".(Session::getError('url') ? " has-error" : "")."'>
                 <label for='url' class='col-sm-2 control-label'>$langGlossaryUrl: </label>
                 <div class='col-sm-10'>
                     <input type='text' class='form-control' id='url' name='url' value='$url'>
                     <span class='help-block'>".Session::getError('url')."</span>     
                 </div>
            </div>
            <div class='form-group'>
                 <label for='notes' class='col-sm-2 control-label'>$langCategoryNotes: </label>
                 <div class='col-sm-10'>
                     " . @rich_text_editor('notes', 4, 60, $notes) . "
                 </div>
Example #21
0
 function field_html($args)
 {
     switch ($args[3]) {
         case 'textarea':
             return text_area($args);
         case 'information_box':
             return information_box($args);
         default:
             return text_field($args);
     }
 }
Example #22
0
echo form_tag("#create");
?>
      <?php 
$forum_post->parent_id && (print hidden_field_tag("forum_post->parent_id"));
?>
      <table>
        <tr>
          <td><label for="forum_post_title">Title</label></td>
          <td><?php 
echo text_field_tag("forum_post->title", array('size' => 60));
?>
</td>
        </tr>
        <tr>
          <td colspan="2"><?php 
echo text_area("forum_post->body", array('rows' => 20, 'cols' => 80));
?>
</td>
        </tr>
        <tr>
          <td colspan="2"><?php 
echo submit_tag("Post");
?>
<input name="preview" onclick="new Ajax.Updater('preview', '/forum/preview', {asynchronous:true, evalScripts:true, method:'get', onSuccess:function(request){$('preview').show()}, parameters:Form.serialize(this.form)});" type="button" value="Preview"/></td>
        </tr>
      </table>
    </form>
  </div>
  
</div>
 public function testTextarea()
 {
     $this->assertDomEqual(text_area('post', 'body', $this->post), '<textarea cols="40" id="post_body" name="post[body]" rows="20">PHP is a general-purpose scripting language...</textarea>');
     $this->post = 'Hello <b>world</b>';
     $this->assertDomEqual(text_area('post', 'body', $this->post), '<textarea cols="40" id="post_body" name="post[body]" rows="20">Hello &lt;b&gt;world&lt;/b&gt;</textarea>');
 }
Example #24
0
 function field_html($args)
 {
     switch ($args[3]) {
         case 'textarea':
             return text_area($args);
         case 'checkbox':
             return sp_checkbox($args);
         case 'select':
             return sp_select($args);
         default:
             return text_field($args);
     }
 }
Example #25
0
/**
 * The editor for sections.
 */
function section_edit()
{
    global $event, $step, $all_pages, $all_styles;
    require_privs('section.edit');
    extract(gpsa(array('page', 'sort', 'dir', 'crit', 'search_method', 'name')));
    $is_edit = $name && $step == 'section_edit';
    $caption = gTxt('create_section');
    $is_default_section = false;
    if ($is_edit) {
        $rs = safe_row('*', 'txp_section', "name = '" . doSlash($name) . "'");
        if ($name == 'default') {
            $caption = gTxt('edit_default_section');
            $is_default_section = true;
        } else {
            $caption = gTxt('edit_section');
        }
    } else {
        // Pulls defaults for the new section from the 'default'.
        $rs = safe_row('*', 'txp_section', "name = 'default'");
        if ($rs) {
            $rs['name'] = $rs['title'] = '';
        }
    }
    if (!$rs) {
        sec_section_list(array(gTxt('unknown_section'), E_ERROR));
        return;
    }
    extract($rs, EXTR_PREFIX_ALL, 'sec');
    pagetop(gTxt('tab_sections'));
    $out = array();
    $out[] = n . tag_start('section', array('class' => 'txp-edit')) . hed($caption, 2);
    if ($is_default_section) {
        $out[] = hInput('name', 'default');
    } else {
        $out[] = inputLabel('section_name', fInput('text', 'name', $sec_name, '', '', '', INPUT_REGULAR, '', 'section_name'), 'section_name') . inputLabel('section_title', fInput('text', 'title', $sec_title, '', '', '', INPUT_REGULAR, '', 'section_title'), 'section_longtitle');
    }
    $out[] = inputLabel('section_description', text_area('description', 0, 0, $sec_description, 'section_description', TEXTAREA_HEIGHT_SMALL, INPUT_LARGE), 'section_description');
    $out[] = inputLabel('section_page', selectInput('section_page', $all_pages, $sec_page, '', '', 'section_page'), 'uses_page', 'section_uses_page') . inputLabel('section_css', selectInput('css', $all_styles, $sec_css, '', '', 'section_css'), 'uses_style', 'section_uses_css');
    if (!$is_default_section) {
        $out[] = inputLabel('on_front_page', yesnoradio('on_frontpage', $sec_on_frontpage, '', $sec_name), '', 'section_on_frontpage') . inputLabel('syndicate', yesnoradio('in_rss', $sec_in_rss, '', $sec_name), '', 'section_syndicate') . inputLabel('include_in_search', yesnoradio('searchable', $sec_searchable, '', $sec_name), '', 'section_searchable');
    }
    $out[] = pluggable_ui('section_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('section') . sInput('section_save') . hInput('old_name', $sec_name) . hInput('search_method', $search_method) . hInput('crit', $crit) . hInput('page', $page) . hInput('sort', $sort) . hInput('dir', $dir) . n . tag_end('section');
    echo n . tag_start('div', array('id' => $event . '_container', 'class' => 'txp-container')) . form(join('', $out), '', '', 'post', 'edit-form', '', 'section_details') . n . tag_end('div');
}
Example #26
0
function file_edit($message = '', $id = '')
{
    global $file_base_path, $levels, $file_statuses, $txp_user, $event;
    extract(gpsa(array('name', 'title', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'search_method', 'publish_now')));
    if (!$id) {
        $id = gps('id');
    }
    $id = assert_int($id);
    $categories = getTree('root', 'file');
    $rs = safe_row('*, unix_timestamp(created) as created, unix_timestamp(modified) as modified', 'txp_file', "id = {$id}");
    if ($rs) {
        extract($rs);
        $filename = sanitizeForFile($filename);
        if (!has_privs('file.edit') && !($author == $txp_user && has_privs('file.edit.own'))) {
            file_list(gTxt('restricted_area'));
            return;
        }
        pagetop(gTxt('file'), $message);
        if ($permissions == '') {
            $permissions = '-1';
        }
        if (!has_privs('file.publish') && $status >= 4) {
            $status = 3;
        }
        $file_exists = file_exists(build_file_path($file_base_path, $filename));
        $replace = $file_exists ? tr(td(file_upload_form(gTxt('replace_file'), 'file_replace', 'file_replace', $id, 'file-replace')), ' class="replace-file"') : '';
        $existing_files = get_filenames();
        $condition = '<span class="';
        $condition .= $file_exists ? 'ok' : 'not-ok';
        $condition .= '">';
        $condition .= $file_exists ? gTxt('file_status_ok') : gTxt('file_status_missing');
        $condition .= '</span>';
        $downloadlink = $file_exists ? make_download_link($id, htmlspecialchars($filename), $filename) : htmlspecialchars($filename);
        $created = n . graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now') . '<label for="publish_now">' . gTxt('set_to_now') . '</label>', ' class="publish-now"') . n . graf(gTxt('or_publish_at') . sp . popHelp('timestamp'), ' class="publish-at"') . n . graf('<span class="label">' . gtxt('date') . '</span>' . sp . tsi('year', '%Y', $rs['created']) . ' / ' . tsi('month', '%m', $rs['created']) . ' / ' . tsi('day', '%d', $rs['created']), ' class="date posted created"') . n . graf('<span class="label">' . gTxt('time') . '</span>' . sp . tsi('hour', '%H', $rs['created']) . ' : ' . tsi('minute', '%M', $rs['created']) . ' : ' . tsi('second', '%S', $rs['created']), ' class="time posted created"');
        $form = '';
        if ($file_exists) {
            $form = tr(td(form(graf('<label for="file_title">' . gTxt('title') . '</label>: ' . fInput('text', 'title', $title, '', '', '', 40, '', 'file_title'), ' class="title"') . graf('<label for="category">' . gTxt('file_category') . '</label>' . br . treeSelectInput('category', $categories, $category), ' class="category"') . graf('<label for="description">' . gTxt('description') . '</label>' . br . text_area('description', '100', '400', $description, 'description'), ' class="description text"') . fieldset(radio_list('status', $file_statuses, $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . graf(fInput('submit', '', gTxt('save'), 'publish')) . eInput('file') . sInput('file_save') . hInput('filename', $filename) . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method), '', '', 'post', 'edit-form', '', 'file_details')), ' class="file-detail exists"');
        } else {
            $ef_select = empty($existing_files) ? '' : gTxt('existing_file') . ' ' . selectInput('filename', $existing_files, "", 1);
            $form = tr(tda(hed(gTxt('file_relink'), 3) . file_upload_form(gTxt('upload_file'), 'file_reassign', 'file_replace', $id, 'file-reassign') . form(graf($ef_select . pluggable_ui('file_ui', 'extend_detail_form', '', $rs) . fInput('submit', '', gTxt('Save'), 'smallerbox') . eInput('file') . sInput('file_save') . hInput('id', $id) . hInput('category', $category) . hInput('perms', $permissions == '-1' ? '' : $permissions) . hInput('title', $title) . hInput('description', $description) . hInput('status', $status) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('search_method', $search_method)), '', '', 'post', 'edit-form', '', 'assign_file'), ' colspan="4" style="border:0"'), ' class="file-detail not-exists"');
        }
        echo n . '<div id="' . $event . '_container" class="txp-container txp-edit">';
        echo startTable('list', '', 'edit-pane'), tr(td(graf(gTxt('file_status') . ': ' . $condition, ' class="condition"') . graf(gTxt('file_name') . ': ' . $downloadlink, ' class="name"') . graf(gTxt('file_download_count') . ': ' . $downloads, ' class="downloads"')), ' class="file-info"'), $form, $replace, endTable() . n . '</div>';
    }
}
Example #27
0
/**
 * Renders a HTML &lt;textarea&gt; element.
 *
 * @param  string $name HTML name of the textarea
 * @param  string $val  Initial (or current) content of the textarea
 * @param  int    $size Number of rows the textarea has
 * @return string HTML
 */
function pref_longtext_input($name, $val, $size = '')
{
    return text_area($name, '', '', $val, '', $size);
}
Example #28
0
 /**
  * Renders a textarea to hold the built content.
  *
  * @param  string $thing Content
  * @return string HTML
  */
 private function tdb($thing)
 {
     return graf(text_area('txp-tagbuilder-output', '', '', $thing, 'txp-tagbuilder-output', TEXTAREA_HEIGHT_SMALL, INPUT_LARGE));
 }
Example #29
0
function tdb($thing)
{
    return hed(gTxt('tag') . ':', 3) . text_area('tag', '100', '300', $thing);
}
Example #30
0
function plugin_form()
{
    return '<form action="index.php" method="post">' . gTxt('install_plugin') . ': ' . text_area('plugin', 30, 400, '') . popHelp('install_plugin') . sp . fInput('submit', 'install_new', gTxt('upload'), 'smallerbox') . eInput('plugin') . sInput('plugin_verify') . '</form>';
}