enhanced the code folder view to be able to create new empty files

This commit is contained in:
hyung-hwan 2015-08-27 13:02:00 +00:00
parent 5bb0583aa0
commit c5ba6ef358
8 changed files with 72 additions and 21 deletions

View File

@ -87,12 +87,17 @@ class Code extends Controller
for ($i = 0; $i < $post_max_item_no; $i++) for ($i = 0; $i < $post_max_item_no; $i++)
{ {
$d = $this->input->post("code_folder_new_item_dir_$i"); $d = $this->input->post("code_folder_new_item_dir_$i");
if (strlen($d) > 0) if (strlen($d) > 0)
{ {
array_push ($import_files, array ('type' => 'dir', 'name' => $d)); array_push ($import_files, array ('type' => 'dir', 'name' => $d));
} }
$d = $this->input->post("code_folder_new_item_empfile_$i");
if (strlen($d) > 0)
{
array_push ($import_files, array ('type' => 'empfile', 'name' => $d));
}
$fid = "code_folder_new_item_file_$i"; $fid = "code_folder_new_item_file_$i";
if (array_key_exists($fid, $_FILES) && $_FILES[$fid]['name'] != '') if (array_key_exists($fid, $_FILES) && $_FILES[$fid]['name'] != '')
{ {
@ -416,22 +421,27 @@ class Code extends Controller
} }
else else
{ {
$post_new_message = $this->input->post('code_folder_new_message'); $post_new_message = $this->input->post('code_new_message');
$post_max_item_no = $this->input->post('code_folder_new_item_count'); $post_max_item_no = $this->input->post('code_new_item_count');
$post_unzip = $this->input->post('code_folder_new_item_unzip'); $post_unzip = $this->input->post('code_new_item_unzip');
if ($post_new_message !== FALSE && $post_max_item_no !== FALSE) if ($post_new_message !== FALSE && $post_max_item_no !== FALSE)
{ {
$import_files = array (); $import_files = array ();
for ($i = 0; $i < $post_max_item_no; $i++) for ($i = 0; $i < $post_max_item_no; $i++)
{ {
$d = $this->input->post("code_folder_new_item_dir_$i"); $d = $this->input->post("code_new_item_dir_$i");
if (strlen($d) > 0) if (strlen($d) > 0)
{ {
array_push ($import_files, array ('type' => 'dir', 'name' => $d)); array_push ($import_files, array ('type' => 'dir', 'name' => $d));
} }
$fid = "code_folder_new_item_file_$i"; $d = $this->input->post("code_new_item_empfile_$i");
if (strlen($d) > 0)
{
array_push ($import_files, array ('type' => 'empfile', 'name' => $d));
}
$fid = "code_new_item_file_$i";
if (array_key_exists($fid, $_FILES) && $_FILES[$fid]['name'] != '') if (array_key_exists($fid, $_FILES) && $_FILES[$fid]['name'] != '')
{ {
array_push ($import_files, array ('type' => 'file', 'name' => $_FILES[$fid]['name'], 'fid' => $fid, 'unzip' => $post_unzip)); array_push ($import_files, array ('type' => 'file', 'name' => $_FILES[$fid]['name'], 'fid' => $fid, 'unzip' => $post_unzip));
@ -487,14 +497,14 @@ class Code extends Controller
} }
else else
{ {
$post_delete_message = $this->input->post('code_folder_delete_message'); $post_delete_message = $this->input->post('code_delete_message');
$post_delete_file_count = $this->input->post('code_folder_delete_file_count'); $post_delete_file_count = $this->input->post('code_delete_file_count');
if ($post_delete_message !== FALSE && $post_delete_file_count !== FALSE) if ($post_delete_message !== FALSE && $post_delete_file_count !== FALSE)
{ {
$delete_files = array (); $delete_files = array ();
for ($i = 0; $i < $post_delete_file_count; $i++) for ($i = 0; $i < $post_delete_file_count; $i++)
{ {
$d = $this->input->post("code_folder_delete_file_$i"); $d = $this->input->post("code_delete_file_$i");
if (strlen($d) > 0) if (strlen($d) > 0)
{ {

View File

@ -14,4 +14,6 @@ $lang['CODE_SEARCH_RECURSIVELY'] = 'Search recursively to sub-directories';
$lang['CODE_SEARCH_IN_NAME'] = 'Search in file names'; $lang['CODE_SEARCH_IN_NAME'] = 'Search in file names';
$lang['CODE_SEARCH_IS_REGEX'] = 'Search string is a regular expression'; $lang['CODE_SEARCH_IS_REGEX'] = 'Search string is a regular expression';
$lang['CODE_SEARCH_WILDCARD'] = 'Enter a wildcard pattern'; $lang['CODE_SEARCH_WILDCARD'] = 'Enter a wildcard pattern';
$lang['CODE_FMT_DELETE_X_SELECTED_FILES'] = 'Delete %d selected file(s)';
?> ?>

View File

@ -29,6 +29,7 @@ $lang['Difference'] = 'Diff';
$lang['Directory'] = 'Directory'; $lang['Directory'] = 'Directory';
$lang['Download'] = 'Download'; $lang['Download'] = 'Download';
$lang['Edit'] = 'Edit'; $lang['Edit'] = 'Edit';
$lang['Empty file'] = 'Empty file';
$lang['Enstyle'] = 'Enstyle'; $lang['Enstyle'] = 'Enstyle';
$lang['Error'] = 'Error'; $lang['Error'] = 'Error';
$lang['Failure'] = 'Failure'; $lang['Failure'] = 'Failure';
@ -106,6 +107,7 @@ $lang['Type'] = 'Type';
$lang['Undo'] = 'Undo'; $lang['Undo'] = 'Undo';
$lang['Unzip a zip file'] = 'Unzip a zip file'; $lang['Unzip a zip file'] = 'Unzip a zip file';
$lang['Update'] = 'Update'; $lang['Update'] = 'Update';
$lang['Upload'] = 'Upload';
$lang['Username'] = 'Username'; $lang['Username'] = 'Username';
$lang['Wiki'] = 'Wiki'; $lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wikis'; $lang['Wikis'] = 'Wikis';

View File

@ -29,6 +29,7 @@ $lang['Difference'] = 'Beda';
$lang['Directory'] = 'Direktori'; $lang['Directory'] = 'Direktori';
$lang['Download'] = 'Download'; $lang['Download'] = 'Download';
$lang['Edit'] = 'Rubah'; $lang['Edit'] = 'Rubah';
$lang['Empty file'] = 'Empty file';
$lang['Enstyle'] = 'Enstyle'; $lang['Enstyle'] = 'Enstyle';
$lang['Error'] = 'Error'; $lang['Error'] = 'Error';
$lang['Failure'] = 'Failure'; $lang['Failure'] = 'Failure';
@ -105,6 +106,7 @@ $lang['Type'] = 'Type';
$lang['Undo'] = 'Undo'; $lang['Undo'] = 'Undo';
$lang['Unzip a zip file'] = 'Unzip a zip file'; $lang['Unzip a zip file'] = 'Unzip a zip file';
$lang['Update'] = 'Memperbaharui'; $lang['Update'] = 'Memperbaharui';
$lang['Upload'] = 'Upload';
$lang['Username'] = 'Nama pemakai'; $lang['Username'] = 'Nama pemakai';
$lang['Wiki'] = 'Wiki'; $lang['Wiki'] = 'Wiki';
$lang['Wikis'] = 'Wiki'; $lang['Wikis'] = 'Wiki';

View File

@ -14,4 +14,7 @@ $lang['CODE_SEARCH_RECURSIVELY'] = '서브디렉토리를 포함하여 검색합
$lang['CODE_SEARCH_IN_NAME'] = '파일이름을 검색합니다'; $lang['CODE_SEARCH_IN_NAME'] = '파일이름을 검색합니다';
$lang['CODE_SEARCH_IS_REGEX'] = '검색어가 정규식입니다'; $lang['CODE_SEARCH_IS_REGEX'] = '검색어가 정규식입니다';
$lang['CODE_SEARCH_WILDCARD'] = '와일드카드 패턴을 입력하세요'; $lang['CODE_SEARCH_WILDCARD'] = '와일드카드 패턴을 입력하세요';
$lang['CODE_FMT_DELETE_X_SELECTED_FILES'] = '선택된 파일 %d개를 삭제합니다';
?> ?>

View File

@ -29,6 +29,7 @@ $lang['Difference'] = '차이';
$lang['Directory'] = '디렉토리'; $lang['Directory'] = '디렉토리';
$lang['Download'] = '내려받음'; $lang['Download'] = '내려받음';
$lang['Edit'] = '수정'; $lang['Edit'] = '수정';
$lang['Empty file'] = '빈파일';
$lang['Enstyle'] = '모양새내기'; $lang['Enstyle'] = '모양새내기';
$lang['Error'] = '오류'; $lang['Error'] = '오류';
$lang['Failure'] = '실패'; $lang['Failure'] = '실패';
@ -106,6 +107,7 @@ $lang['Type'] = '종류';
$lang['Undo'] = '되돌림'; $lang['Undo'] = '되돌림';
$lang['Unzip a zip file'] = 'zip파일 풀기'; $lang['Unzip a zip file'] = 'zip파일 풀기';
$lang['Update'] = '수정'; $lang['Update'] = '수정';
$lang['Upload'] = '올리기';
$lang['Username'] = '사용자명'; $lang['Username'] = '사용자명';
$lang['Wiki'] = '위키'; $lang['Wiki'] = '위키';
$lang['Wikis'] = '위키'; $lang['Wikis'] = '위키';

View File

@ -355,6 +355,17 @@ class SubversionModel extends Model
return FALSE; return FALSE;
} }
} }
else if ($f['type'] == 'empfile')
{
if (@touch($xname) === FALSE ||
@svn_add ($xname, TRUE, TRUE) === FALSE)
{
restore_error_handler ();
codepot_delete_files ($actual_tfname, TRUE);
@unlink ($tfname);
return FALSE;
}
}
else if ($f['type'] == 'file') else if ($f['type'] == 'file')
{ {
$config['allowed_types'] = '*'; $config['allowed_types'] = '*';

View File

@ -214,6 +214,7 @@ $(function () {
new_item_no = 0; new_item_no = 0;
$('#code_folder_mainarea_new_file_form_item_list').append (get_new_item_html(new_item_no, 'file', 'file')); $('#code_folder_mainarea_new_file_form_item_list').append (get_new_item_html(new_item_no, 'file', 'file'));
$('#code_folder_mainarea_new_dir_form_item_list').append (get_new_item_html(new_item_no, 'text', 'dir')); $('#code_folder_mainarea_new_dir_form_item_list').append (get_new_item_html(new_item_no, 'text', 'dir'));
$('#code_folder_mainarea_new_empfile_form_item_list').append (get_new_item_html(new_item_no, 'text', 'empfile'));
$("#code_folder_mainarea_new_form_tabs").tabs (); $("#code_folder_mainarea_new_form_tabs").tabs ();
@ -232,6 +233,7 @@ $(function () {
++new_item_no; ++new_item_no;
$('#code_folder_mainarea_new_file_form_item_list').append (get_new_item_html(new_item_no, 'file', 'file')); $('#code_folder_mainarea_new_file_form_item_list').append (get_new_item_html(new_item_no, 'file', 'file'));
$('#code_folder_mainarea_new_dir_form_item_list').append (get_new_item_html(new_item_no, 'text', 'dir')); $('#code_folder_mainarea_new_dir_form_item_list').append (get_new_item_html(new_item_no, 'text', 'dir'));
$('#code_folder_mainarea_new_empfile_form_item_list').append (get_new_item_html(new_item_no, 'text', 'empfile'));
}, },
'<?php print $this->lang->line('OK')?>': function () { '<?php print $this->lang->line('OK')?>': function () {
if (import_in_progress) return; if (import_in_progress) return;
@ -245,16 +247,19 @@ $(function () {
var form_data = new FormData(); var form_data = new FormData();
form_data.append ('code_folder_new_message', $('#code_folder_mainarea_new_message').val()); form_data.append ('code_new_message', $('#code_folder_mainarea_new_message').val());
form_data.append ('code_folder_new_item_count', $('#code_folder_mainarea_new_item_count').val()); form_data.append ('code_new_item_count', $('#code_folder_mainarea_new_item_count').val());
form_data.append ('code_folder_new_item_unzip', $('#code_folder_mainarea_new_item_unzip').val()); form_data.append ('code_new_item_unzip', $('#code_folder_mainarea_new_item_unzip').val());
for (var i = 0; i <= new_item_no; i++) for (var i = 0; i <= new_item_no; i++)
{ {
var f = $('#code_folder_mainarea_new_item_file_' + i).get(0).files[0]; var f = $('#code_folder_mainarea_new_item_file_' + i).get(0).files[0];
if (f != null) form_data.append ('code_folder_new_item_file_' + i, f); if (f != null) form_data.append ('code_new_item_file_' + i, f);
var d = $('#code_folder_mainarea_new_item_dir_' + i).val(); var d = $('#code_folder_mainarea_new_item_dir_' + i).val();
if (d != null && d != '') form_data.append ('code_folder_new_item_dir_' + i, d); if (d != null && d != '') form_data.append ('code_new_item_dir_' + i, d);
var d = $('#code_folder_mainarea_new_item_empfile_' + i).val();
if (d != null && d != '') form_data.append ('code_new_item_empfile_' + i, d);
} }
$('#code_folder_mainarea_new_form_div').dialog('disable'); $('#code_folder_mainarea_new_form_div').dialog('disable');
@ -332,18 +337,18 @@ $(function () {
var form_data = new FormData(); var form_data = new FormData();
form_data.append ('code_folder_delete_message', $('#code_folder_mainarea_delete_message').val()); form_data.append ('code_delete_message', $('#code_folder_mainarea_delete_message').val());
var xi = 0; var xi = 0;
for (var i = 0; i < <?php print $file_count; ?>; i++) for (var i = 0; i < <?php print $file_count; ?>; i++)
{ {
var f = $('#code_folder_mainarea_result_table_file_selector_' + i); var f = $('#code_folder_mainarea_result_table_file_selector_' + i);
if (f != null && f.is(':checked')) if (f != null && f.is(':checked'))
{ {
form_data.append ('code_folder_delete_file_' + xi, f.val()); form_data.append ('code_delete_file_' + xi, f.val());
xi++; xi++;
} }
} }
form_data.append ('code_folder_delete_file_count', xi); form_data.append ('code_delete_file_count', xi);
$('#code_folder_mainarea_delete_form_div').dialog('disable'); $('#code_folder_mainarea_delete_form_div').dialog('disable');
$.ajax({ $.ajax({
@ -403,6 +408,15 @@ $(function () {
}); });
$('#code_folder_mainarea_delete_button').button().click (function() { $('#code_folder_mainarea_delete_button').button().click (function() {
var xi = 0;
for (var i = 0; i < <?php print $file_count; ?>; i++)
{
var f = $('#code_folder_mainarea_result_table_file_selector_' + i);
if (f != null && f.is(':checked')) xi++;
}
$('#code_folder_mainarea_delete_display_message').text (
codepot_sprintf ("<?php print addslashes($this->lang->line('CODE_FMT_DELETE_X_SELECTED_FILES')) ?>", xi)
);
$('#code_folder_mainarea_delete_form_div').dialog('open'); $('#code_folder_mainarea_delete_form_div').dialog('open');
}); });
@ -945,8 +959,9 @@ $this->load->view (
<div id="code_folder_mainarea_new_form_tabs" style="width:100%;"> <div id="code_folder_mainarea_new_form_tabs" style="width:100%;">
<ul> <ul>
<li><a href="#code_folder_mainarea_new_file_div">File</a></li> <li><a href="#code_folder_mainarea_new_file_div"><?php print $this->lang->line('Upload'); ?></a></li>
<li><a href="#code_folder_mainarea_new_dir_div">Directory</a></li> <li><a href="#code_folder_mainarea_new_dir_div"><?php print $this->lang->line('Directory'); ?></a></li>
<li><a href="#code_folder_mainarea_new_empfile_div"><?php print $this->lang->line('File'); ?></a></li>
</ul> </ul>
<div id="code_folder_mainarea_new_file_div"> <div id="code_folder_mainarea_new_file_div">
<div><input type='checkbox' id='code_folder_mainarea_new_item_unzip' name='code_folder_new_item_unzip' value='yes'/><?php print $this->lang->line('Unzip a zip file'); ?></div> <div><input type='checkbox' id='code_folder_mainarea_new_item_unzip' name='code_folder_new_item_unzip' value='yes'/><?php print $this->lang->line('Unzip a zip file'); ?></div>
@ -955,14 +970,18 @@ $this->load->view (
<div id="code_folder_mainarea_new_dir_div"> <div id="code_folder_mainarea_new_dir_div">
<div><ul id='code_folder_mainarea_new_dir_form_item_list'></ul></div> <div><ul id='code_folder_mainarea_new_dir_form_item_list'></ul></div>
</div> </div>
<div id="code_folder_mainarea_new_empfile_div">
<div><ul id='code_folder_mainarea_new_empfile_form_item_list'></ul></div>
</div>
</div> </div>
<?php print form_close();?> <?php print form_close();?>
</div> </div>
<div id="code_folder_mainarea_delete_form_div"> <div id="code_folder_mainarea_delete_form_div">
<div><span id='code_folder_mainarea_delete_display_message'></span><br />&nbsp;</div>
<div><?php print $this->lang->line('Message'); ?>:</div> <div><?php print $this->lang->line('Message'); ?>:</div>
<div><textarea type='textarea' id='code_folder_mainarea_delete_message' name='code_folder_delete_message' style='width:100%;'></textarea></div> <div><textarea type='textarea' id='code_folder_mainarea_delete_message' name='code_folder_delete_message' style='width:100%;' ></textarea></div>
</div> </div>
<?php endif; ?> <?php endif; ?>