示例#1
0
文件: edit.php 项目: rair/yacs
 $panels = array();
 //
 // information tab
 //
 $text = '';
 // the file itself
 $label = i18n::s('File');
 $input = '';
 // a member is creating a new file entry
 if (!isset($item['id']) && Surfer::is_member()) {
     // several options to consider
     $input = '<dl>';
     // the upload entry requires rights to upload
     if (Surfer::may_upload()) {
         // an upload entry
         $input .= '<dt><input type="radio" name="file_type" value="upload" checked="checked" onclick="$(\'#href_panel\').slideUp();$(\'#upload_panel\').slideDown();" />&nbsp;' . i18n::s('Add a file') . ' (&lt;&nbsp;' . $context['file_maximum_size'] . i18n::s('bytes') . ')' . '</dt>' . '<dd id="upload_panel">' . skin::build_input_file('upload', 'if(/\\.zip$/i.test($(this).val())){$(\'#upload_option\').slideDown();}else{$(\'#upload_option\').slideUp();}') . '<div id="upload_option" style="display: none;" >' . '<input type="checkbox" name="explode_files" checked="checked" /> ' . i18n::s('Extract files from the archive') . '</div>' . '</dd>' . "\n";
         // or
         $input .= '<dt><div style="margin: 1em">-- ' . i18n::s('or') . ' --</div></dt>';
     }
     // a reference
     $input .= '<dt><input type="radio" name="file_type" value="href" onclick="$(\'#href_panel\').slideDown();$(\'#upload_panel\').slideUp();" />&nbsp;' . i18n::s('Share a reference to a file (ftp://, http://, ...)') . '</dt>' . '<dd id="href_panel" style="display: none;">' . '<input type="text" name="file_href" id="file_href" size="45" value="' . encode_field(isset($item['file_href']) ? $item['file_href'] : '') . '" maxlength="255" />' . BR . i18n::s('File size') . ' <input type="text" name="file_size" size="12" value="' . encode_field(isset($item['file_size']) ? $item['file_size'] : '') . '" maxlength="12" /> ' . i18n::s('bytes') . '</dd>' . "\n";
     $input .= '</dl>';
     // an anonymous surfer is creating a new file entry
 } elseif (!isset($item['id'])) {
     // the upload entry requires rights to upload
     if (Surfer::may_upload()) {
         // an upload entry
         $input = '<input type="hidden" name="file_type" value="upload" />' . '<input type="file" name="upload" id="upload" size="30" />' . ' (&lt;&nbsp;' . $context['file_maximum_size'] . i18n::s('bytes') . ')' . "\n";
     }
     // update an existing entry
 } elseif (!isset($item['file_href']) || !$item['file_href']) {