allowed multiple file selection in the new upload dialog of the code folder view.
deleted legacy form posting handling from the code folder view and the code controller
This commit is contained in:
parent
3abd8c62bb
commit
5d178b4366
@ -76,55 +76,6 @@ class Code extends Controller
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$popup_error_message = '';
|
|
||||||
|
|
||||||
$post_new_message = $this->input->post('code_folder_new_message');
|
|
||||||
$post_max_item_no = $this->input->post('code_folder_new_item_count');
|
|
||||||
$post_unzip = $this->input->post('code_folder_new_item_unzip');
|
|
||||||
if ($post_new_message !== FALSE && $post_max_item_no !== FALSE)
|
|
||||||
{
|
|
||||||
$import_files = array ();
|
|
||||||
for ($i = 0; $i < $post_max_item_no; $i++)
|
|
||||||
{
|
|
||||||
$d = $this->input->post("code_folder_new_item_dir_$i");
|
|
||||||
if (strlen($d) > 0)
|
|
||||||
{
|
|
||||||
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";
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($import_files) > 0 && $this->subversion->importFiles ($projectid, $path, $login['id'], $post_new_message, $import_files, $this->upload) === FALSE)
|
|
||||||
{
|
|
||||||
$popup_error_message = $this->subversion->getErrorMessage();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$refreshed_file = $this->subversion->getFile ($projectid, $path, $rev);
|
|
||||||
if ($refreshed_file === FALSE)
|
|
||||||
{
|
|
||||||
$data['project'] = $project;
|
|
||||||
$data['message'] = 'Failed to get file';
|
|
||||||
$this->load->view ($this->VIEW_ERROR, $data);
|
|
||||||
return; /* EXIT HERE */
|
|
||||||
}
|
|
||||||
|
|
||||||
$file = $refreshed_file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['popup_error_message'] = $popup_error_message;
|
|
||||||
if ($file['type'] == 'file')
|
if ($file['type'] == 'file')
|
||||||
{
|
{
|
||||||
$head_rev = $this->subversion->getHeadRev ($projectid, $path, $rev);
|
$head_rev = $this->subversion->getHeadRev ($projectid, $path, $rev);
|
||||||
@ -162,7 +113,6 @@ class Code extends Controller
|
|||||||
$file['created_tag'] = $this->subversion->getRevProp ($projectid, $file['created_rev'], CODEPOT_SVN_TAG_PROPERTY);
|
$file['created_tag'] = $this->subversion->getRevProp ($projectid, $file['created_rev'], CODEPOT_SVN_TAG_PROPERTY);
|
||||||
if ($file['created_tag'] === FALSE) $file['created_tag'] = '';
|
if ($file['created_tag'] === FALSE) $file['created_tag'] = '';
|
||||||
|
|
||||||
|
|
||||||
foreach ($file['content'] as &$f)
|
foreach ($file['content'] as &$f)
|
||||||
{
|
{
|
||||||
$exe = $this->subversion->getProp (
|
$exe = $this->subversion->getProp (
|
||||||
@ -183,7 +133,6 @@ class Code extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$data['project'] = $project;
|
$data['project'] = $project;
|
||||||
$data['headpath'] = $path;
|
$data['headpath'] = $path;
|
||||||
$data['file'] = $file;
|
$data['file'] = $file;
|
||||||
|
@ -206,7 +206,10 @@ var rename_last_input = {};
|
|||||||
|
|
||||||
function get_new_item_html(no, type, name)
|
function get_new_item_html(no, type, name)
|
||||||
{
|
{
|
||||||
return codepot_sprintf ('<li><input type="%s" id="code_folder_mainarea_new_item_%s_%d" name="code_folder_new_item_%s_%d" /></li>', type, name, no, name, no);
|
return codepot_sprintf (
|
||||||
|
'<li><input type="%s" id="code_folder_mainarea_new_item_%s_%d" name="code_folder_new_item_%s_%d" %s /></li>',
|
||||||
|
type, name, no, name, no, ((type == 'file')? 'multiple=""': '')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -240,8 +243,6 @@ $(function () {
|
|||||||
'<?php print $this->lang->line('OK')?>': function () {
|
'<?php print $this->lang->line('OK')?>': function () {
|
||||||
if (import_in_progress) return;
|
if (import_in_progress) return;
|
||||||
|
|
||||||
$('#code_folder_mainarea_new_item_count').val (new_item_no + 1);
|
|
||||||
|
|
||||||
if (!!window.FormData)
|
if (!!window.FormData)
|
||||||
{
|
{
|
||||||
// FormData is supported
|
// FormData is supported
|
||||||
@ -250,19 +251,43 @@ $(function () {
|
|||||||
var form_data = new FormData();
|
var form_data = new FormData();
|
||||||
|
|
||||||
form_data.append ('code_new_message', $('#code_folder_mainarea_new_message').val());
|
form_data.append ('code_new_message', $('#code_folder_mainarea_new_message').val());
|
||||||
form_data.append ('code_new_item_count', $('#code_folder_mainarea_new_item_count').val());
|
|
||||||
form_data.append ('code_new_item_unzip', $('#code_folder_mainarea_new_item_unzip').val());
|
form_data.append ('code_new_item_unzip', $('#code_folder_mainarea_new_item_unzip').val());
|
||||||
|
|
||||||
|
var f_no = 0, d_no = 0, ef_no = 0;
|
||||||
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];
|
f = $('#code_folder_mainarea_new_item_file_' + i).get(0);
|
||||||
if (f != null) form_data.append ('code_new_item_file_' + i, f);
|
if (f != null)
|
||||||
|
{
|
||||||
|
for (var n = 0; n < f.files.length; n++)
|
||||||
|
{
|
||||||
|
if (f.files[n] != null)
|
||||||
|
{
|
||||||
|
form_data.append ('code_new_item_file_' + f_no, f.files[n]);
|
||||||
|
f_no++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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_new_item_dir_' + i, d);
|
if (d != null && d != '')
|
||||||
|
{
|
||||||
|
form_data.append ('code_new_item_dir_' + d_no, d);
|
||||||
|
d_no++;
|
||||||
|
}
|
||||||
|
|
||||||
var d = $('#code_folder_mainarea_new_item_empfile_' + i).val();
|
var d = $('#code_folder_mainarea_new_item_empfile_' + i).val();
|
||||||
if (d != null && d != '') form_data.append ('code_new_item_empfile_' + i, d);
|
if (d != null && d != '')
|
||||||
|
{
|
||||||
|
form_data.append ('code_new_item_empfile_' + ef_no, d);
|
||||||
|
ef_no++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
var x_no = f_no;
|
||||||
|
if (d_no > x_no) x_no = d_no;
|
||||||
|
if (ef_no > x_no) x_no = ef_no;
|
||||||
|
|
||||||
|
form_data.append ('code_new_item_count', x_no);
|
||||||
|
|
||||||
$('#code_folder_mainarea_new_form_div').dialog('disable');
|
$('#code_folder_mainarea_new_form_div').dialog('disable');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -299,10 +324,8 @@ $(function () {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#code_folder_mainarea_new_form_div').dialog('close');
|
show_alert ('<pre>NOT SUPPORTED</pre>', "<?php print $this->lang->line('Error')?>");
|
||||||
$('#code_folder_mainarea_new_form').submit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
'<?php print $this->lang->line('Cancel')?>': function () {
|
'<?php print $this->lang->line('Cancel')?>': function () {
|
||||||
if (import_in_progress) return;
|
if (import_in_progress) return;
|
||||||
@ -387,7 +410,6 @@ $(function () {
|
|||||||
{
|
{
|
||||||
show_alert ('<pre>NOT SUPPORTED</pre>', "<?php print $this->lang->line('Error')?>");
|
show_alert ('<pre>NOT SUPPORTED</pre>', "<?php print $this->lang->line('Error')?>");
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
'<?php print $this->lang->line('Cancel')?>': function () {
|
'<?php print $this->lang->line('Cancel')?>': function () {
|
||||||
if (delete_in_progress) return;
|
if (delete_in_progress) return;
|
||||||
@ -637,10 +659,6 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
render_readme ();
|
render_readme ();
|
||||||
|
|
||||||
<?php if (strlen($popup_error_message) > 0): ?>
|
|
||||||
show_alert (<?php print codepot_json_encode('<pre>' . htmlspecialchars($popup_error_message) . '</pre>'); ?>, "<?php print $this->lang->line('Error')?>");
|
|
||||||
<?php endif; ?>
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1077,13 +1095,6 @@ $this->load->view (
|
|||||||
<?php if (isset($login['id']) && $login['id'] != ''): ?>
|
<?php if (isset($login['id']) && $login['id'] != ''): ?>
|
||||||
|
|
||||||
<div id="code_folder_mainarea_new_form_div">
|
<div id="code_folder_mainarea_new_form_div">
|
||||||
<?php
|
|
||||||
$attrs = array ('id' => 'code_folder_mainarea_new_form');
|
|
||||||
// this form posts to the head revision regardless of the revision being shown currently
|
|
||||||
print form_open_multipart("code/file/{$project->id}/".$this->converter->AsciiToHex($headpath), $attrs);
|
|
||||||
?>
|
|
||||||
<input type='hidden' name='code_folder_new_item_count' id='code_folder_mainarea_new_item_count' />
|
|
||||||
|
|
||||||
<div><?php print $this->lang->line('Message'); ?>:</div>
|
<div><?php print $this->lang->line('Message'); ?>:</div>
|
||||||
<div><textarea type='textarea' id='code_folder_mainarea_new_message' name='code_folder_new_message' style='width:100%;'></textarea></div>
|
<div><textarea type='textarea' id='code_folder_mainarea_new_message' name='code_folder_new_message' style='width:100%;'></textarea></div>
|
||||||
|
|
||||||
@ -1104,8 +1115,6 @@ $this->load->view (
|
|||||||
<div><ul id='code_folder_mainarea_new_empfile_list'></ul></div>
|
<div><ul id='code_folder_mainarea_new_empfile_list'></ul></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php print form_close();?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="code_folder_mainarea_delete_form_div">
|
<div id="code_folder_mainarea_delete_form_div">
|
||||||
|
Loading…
Reference in New Issue
Block a user