コード例 #1
0
ファイル: txp_image.php プロジェクト: bgarrels/textpattern
 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);
 }
コード例 #2
0
ファイル: txp_article.php プロジェクト: bgarrels/textpattern
function category_popup($name, $val, $id)
{
    return categorySelectInput('article', $name, $val, $id);
}
コード例 #3
0
ファイル: txplib_misc.php プロジェクト: bgarrels/textpattern
/**
 * PEDRO:
 * Helper functions for common textpattern event files actions.
 * Code refactoring from original files. Intended to do easy and less error
 * prone the future build of new textpattern extensions, and to add new
 * events to multiedit forms.
 */
function event_category_popup($type, $cat = '', $id = '')
{
    return categorySelectInput($type, 'category', $cat, $id);
}
コード例 #4
0
ファイル: txp_file.php プロジェクト: bgarrels/textpattern
 function edit_view($id = '')
 {
     global $txpcfg, $file_base_path, $levels;
     extract(gpsa(array('name', 'category', 'permissions', 'description', 'sort', 'dir', 'page', 'crit', 'method', 'publish_now')));
     if (!$id) {
         $id = gps('id');
     }
     $categories = tree_get('txp_category', NULL, "type='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));
         $existing_files = $this->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 ? $this->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 = '';
         #categorySelectInput($type, $name, $val, $id
         $form = tr(td(form(graf(gTxt('file_category') . br . categorySelectInput('file', 'category', $category, 'file_category')) . graf(gTxt('filename') . br . fInput('text', 'filename', $filename, 'edit')) . graf(gTxt('description') . br . text_area('description', '100', '400', $description)) . fieldset(radio_list('status', $this->file_statuses(), $status, 4), gTxt('status'), 'file-status') . fieldset($created, gTxt('timestamp'), 'file-created') . graf(fInput('submit', '', gTxt('save'))) . eInput($this->event) . sInput('save') . hInput('id', $id) . hInput('sort', $sort) . hInput('dir', $dir) . hInput('page', $page) . hInput('crit', $crit) . hInput('method', $method))));
         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, tr(td($this->file_upload_form(gTxt('file_replace'), 'file_replace', 'new_replace', $id))), endTable();
     }
 }