improved usability of some code views a bit
This commit is contained in:
parent
3666d1f737
commit
887941baad
@ -102,7 +102,7 @@ class Code extends Controller
|
|||||||
|
|
||||||
if (count($import_files) > 0 && $this->subversion->importFiles ($projectid, $path, $login['id'], $post_new_message, $import_files, $this->upload) === FALSE)
|
if (count($import_files) > 0 && $this->subversion->importFiles ($projectid, $path, $login['id'], $post_new_message, $import_files, $this->upload) === FALSE)
|
||||||
{
|
{
|
||||||
$popup_error_message = '<pre>' . htmlspecialchars($this->subversion->import_files_errmsg) . '</pre>';
|
$popup_error_message = $this->subversion->import_files_errmsg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -31,6 +31,7 @@ $lang['Download'] = 'Download';
|
|||||||
$lang['Edit'] = 'Edit';
|
$lang['Edit'] = 'Edit';
|
||||||
$lang['Enstyle'] = 'Enstyle';
|
$lang['Enstyle'] = 'Enstyle';
|
||||||
$lang['Error'] = 'Error';
|
$lang['Error'] = 'Error';
|
||||||
|
$lang['Failure'] = 'Failure';
|
||||||
$lang['File'] = 'File';
|
$lang['File'] = 'File';
|
||||||
$lang['Files'] = 'Files';
|
$lang['Files'] = 'Files';
|
||||||
$lang['Filter'] = 'Filter';
|
$lang['Filter'] = 'Filter';
|
||||||
@ -96,6 +97,7 @@ $lang['Size'] = 'Size';
|
|||||||
$lang['Source'] = 'Source';
|
$lang['Source'] = 'Source';
|
||||||
$lang['Status'] = 'Status';
|
$lang['Status'] = 'Status';
|
||||||
$lang['Summary'] = 'Summary';
|
$lang['Summary'] = 'Summary';
|
||||||
|
$lang['Success'] = 'Success';
|
||||||
$lang['System'] = 'System';
|
$lang['System'] = 'System';
|
||||||
$lang['Tag'] = 'Tag';
|
$lang['Tag'] = 'Tag';
|
||||||
$lang['Text'] = 'Text';
|
$lang['Text'] = 'Text';
|
||||||
|
@ -31,6 +31,7 @@ $lang['Download'] = 'Download';
|
|||||||
$lang['Edit'] = 'Rubah';
|
$lang['Edit'] = 'Rubah';
|
||||||
$lang['Enstyle'] = 'Enstyle';
|
$lang['Enstyle'] = 'Enstyle';
|
||||||
$lang['Error'] = 'Error';
|
$lang['Error'] = 'Error';
|
||||||
|
$lang['Failure'] = 'Failure';
|
||||||
$lang['File'] = 'File';
|
$lang['File'] = 'File';
|
||||||
$lang['Files'] = 'File';
|
$lang['Files'] = 'File';
|
||||||
$lang['Filter'] = 'Filter';
|
$lang['Filter'] = 'Filter';
|
||||||
@ -94,6 +95,7 @@ $lang['Sites'] = 'Sites';
|
|||||||
$lang['Size'] = 'Ukuran';
|
$lang['Size'] = 'Ukuran';
|
||||||
$lang['Source'] = 'Sumber';
|
$lang['Source'] = 'Sumber';
|
||||||
$lang['Status'] = 'Status';
|
$lang['Status'] = 'Status';
|
||||||
|
$lang['Success'] = 'Success';
|
||||||
$lang['Summary'] = 'Rangkuman';
|
$lang['Summary'] = 'Rangkuman';
|
||||||
$lang['System'] = 'Sistem';
|
$lang['System'] = 'Sistem';
|
||||||
$lang['Tag'] = 'Label';
|
$lang['Tag'] = 'Label';
|
||||||
|
@ -31,6 +31,7 @@ $lang['Download'] = '내려받음';
|
|||||||
$lang['Edit'] = '수정';
|
$lang['Edit'] = '수정';
|
||||||
$lang['Enstyle'] = '모양새내기';
|
$lang['Enstyle'] = '모양새내기';
|
||||||
$lang['Error'] = '오류';
|
$lang['Error'] = '오류';
|
||||||
|
$lang['Failure'] = '실패';
|
||||||
$lang['File'] = '파일';
|
$lang['File'] = '파일';
|
||||||
$lang['Files'] = '파일';
|
$lang['Files'] = '파일';
|
||||||
$lang['Filter'] = '필터';
|
$lang['Filter'] = '필터';
|
||||||
@ -95,6 +96,7 @@ $lang['Sites'] = '사이트';
|
|||||||
$lang['Size'] = '크기';
|
$lang['Size'] = '크기';
|
||||||
$lang['Status'] = '상태';
|
$lang['Status'] = '상태';
|
||||||
$lang['Source'] = '소스';
|
$lang['Source'] = '소스';
|
||||||
|
$lang['Success'] = '성공';
|
||||||
$lang['Summary'] = '요약';
|
$lang['Summary'] = '요약';
|
||||||
$lang['System'] = '시스템';
|
$lang['System'] = '시스템';
|
||||||
$lang['Tag'] = '태그';
|
$lang['Tag'] = '태그';
|
||||||
|
@ -54,8 +54,10 @@ function show_alert (outputMsg, titleMsg)
|
|||||||
{
|
{
|
||||||
$("#code_edit_mainarea_alert").html(outputMsg).dialog({
|
$("#code_edit_mainarea_alert").html(outputMsg).dialog({
|
||||||
title: titleMsg,
|
title: titleMsg,
|
||||||
resizable: false,
|
resizable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
|
width: 'auto',
|
||||||
|
height: 'auto',
|
||||||
buttons: {
|
buttons: {
|
||||||
"OK": function () {
|
"OK": function () {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
@ -68,6 +70,7 @@ var ace_modes = null;
|
|||||||
var editor_changed = false;
|
var editor_changed = false;
|
||||||
var save_button = null;
|
var save_button = null;
|
||||||
var return_button = null;
|
var return_button = null;
|
||||||
|
var saving_in_progress = false;
|
||||||
|
|
||||||
function set_editor_changed (changed)
|
function set_editor_changed (changed)
|
||||||
{
|
{
|
||||||
@ -145,27 +148,31 @@ $(function () {
|
|||||||
editor.getSession().setMode ($(this).val());
|
editor.getSession().setMode ($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#code_edit_mainarea_save_form').dialog ({
|
||||||
$("#code_edit_mainarea_save_form").dialog ({
|
|
||||||
title: '<?php print $this->lang->line('Save')?>',
|
title: '<?php print $this->lang->line('Save')?>',
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
width: '60%',
|
width: '60%',
|
||||||
buttons: {
|
buttons: {
|
||||||
'<?php print $this->lang->line('OK')?>': function () {
|
'<?php print $this->lang->line('OK')?>': function () {
|
||||||
|
if (saving_in_progress) return;
|
||||||
|
|
||||||
var save_message = $("#code_edit_mainarea_save_message").val();
|
var save_message = $("#code_edit_mainarea_save_message").val();
|
||||||
if (save_message == '') return false;
|
if (save_message == '') return false;
|
||||||
|
|
||||||
editor.setReadOnly (true);
|
editor.setReadOnly (true);
|
||||||
save_button.button ("disable");
|
save_button.button ("disable");
|
||||||
|
saving_in_progress = true;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: codepot_merge_path('<?php print site_url() ?>', '<?php print "/code/enjson_save/{$project->id}/{$hex_headpath}"; ?>'),
|
url: codepot_merge_path('<?php print site_url() ?>', '<?php print "/code/enjson_save/{$project->id}/{$hex_headpath}"; ?>'),
|
||||||
data: { "message": save_message, "text": editor.getValue() },
|
data: { "message": save_message, "text": editor.getValue() },
|
||||||
|
|
||||||
success: function(json) {
|
success: function(json, textStatus, jqXHR) {
|
||||||
|
saving_in_progress = false;
|
||||||
|
$('#code_edit_mainarea_save_form').dialog('enable');
|
||||||
|
$('#code_edit_mainarea_save_form').dialog('close');
|
||||||
if (json.status == "ok")
|
if (json.status == "ok")
|
||||||
{
|
{
|
||||||
set_editor_changed (false);
|
set_editor_changed (false);
|
||||||
@ -173,30 +180,39 @@ $(function () {
|
|||||||
// once the existing document is saved, arrange to return
|
// once the existing document is saved, arrange to return
|
||||||
// to the the head revision regardless of the original revision.
|
// to the the head revision regardless of the original revision.
|
||||||
return_button.attr ('href', base_return_anchor);
|
return_button.attr ('href', base_return_anchor);
|
||||||
show_alert ('Saved', '');
|
show_alert ('Saved', "<?php print $this->lang->line('Success')?>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
show_alert ('Not saved - ' + codepot_htmlspecialchars(json.status), '');
|
show_alert ('<pre>' + codepot_htmlspecialchars(json.status) + '</pre>', "<?php print $this->lang->line('Error')?>");
|
||||||
save_button.button ("enable");
|
save_button.button ("enable");
|
||||||
}
|
}
|
||||||
editor.setReadOnly (false);
|
editor.setReadOnly (false);
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function(data) {
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
show_alert ('Not saved', '');
|
saving_in_progress = false;
|
||||||
|
$('#code_edit_mainarea_save_form').dialog('enable');
|
||||||
|
$('#code_edit_mainarea_save_form').dialog('close');
|
||||||
|
show_alert ('Not saved - ' + errorThrown, "<?php print $this->lang->line('Error')?>");
|
||||||
editor.setReadOnly (false);
|
editor.setReadOnly (false);
|
||||||
save_button.button ("enable");
|
save_button.button ("enable");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(this).dialog('close');
|
|
||||||
|
$('#code_edit_mainarea_save_form').dialog('disable');
|
||||||
},
|
},
|
||||||
|
|
||||||
'<?php print $this->lang->line('Cancel')?>': function () {
|
'<?php print $this->lang->line('Cancel')?>': function () {
|
||||||
|
if (saving_in_progress) return;
|
||||||
$(this).dialog('close');
|
$(this).dialog('close');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
close: function() { }
|
|
||||||
|
beforeClose: function() {
|
||||||
|
// if saving is in progress, prevent dialog closing
|
||||||
|
return !saving_in_progress;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,11 +57,12 @@
|
|||||||
|
|
||||||
function show_alert (outputMsg, titleMsg)
|
function show_alert (outputMsg, titleMsg)
|
||||||
{
|
{
|
||||||
$("#code_folder_mainarea_alert").html(outputMsg).dialog({
|
$('#code_folder_mainarea_alert').html(outputMsg).dialog({
|
||||||
title: titleMsg,
|
title: titleMsg,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 500,
|
width: 'auto',
|
||||||
|
height: 'auto',
|
||||||
buttons: {
|
buttons: {
|
||||||
"OK": function () {
|
"OK": function () {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
@ -198,7 +199,7 @@ function render_readme()
|
|||||||
}
|
}
|
||||||
|
|
||||||
var new_item_no = 0;
|
var new_item_no = 0;
|
||||||
var import_in_progress = 0;
|
var import_in_progress = false;
|
||||||
|
|
||||||
function get_new_item_html(no, type, name)
|
function get_new_item_html(no, type, name)
|
||||||
{
|
{
|
||||||
@ -220,25 +221,26 @@ $(function () {
|
|||||||
title: '<?php print $this->lang->line('New');?>',
|
title: '<?php print $this->lang->line('New');?>',
|
||||||
resizable: true,
|
resizable: true,
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
width: 500,
|
width: 'auto',
|
||||||
|
height: 'auto',
|
||||||
modal: true,
|
modal: true,
|
||||||
buttons: {
|
buttons: {
|
||||||
'More': function () {
|
'More': function () {
|
||||||
if (import_in_progress > 0) return;
|
if (import_in_progress) return;
|
||||||
|
|
||||||
++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'));
|
||||||
},
|
},
|
||||||
'<?php print $this->lang->line('OK')?>': function () {
|
'<?php print $this->lang->line('OK')?>': function () {
|
||||||
if (import_in_progress > 0) return;
|
if (import_in_progress) return;
|
||||||
|
|
||||||
$('#code_folder_mainarea_new_item_count').val (new_item_no + 1);
|
$('#code_folder_mainarea_new_item_count').val (new_item_no + 1);
|
||||||
|
|
||||||
if (!!window.FormData)
|
if (!!window.FormData)
|
||||||
{
|
{
|
||||||
// FormData is supported
|
// FormData is supported
|
||||||
import_in_progress = 1;
|
import_in_progress = true;
|
||||||
|
|
||||||
var form_data = new FormData();
|
var form_data = new FormData();
|
||||||
|
|
||||||
@ -265,17 +267,22 @@ $(function () {
|
|||||||
cache: false,
|
cache: false,
|
||||||
|
|
||||||
success: function (data, textStatus, jqXHR) {
|
success: function (data, textStatus, jqXHR) {
|
||||||
import_in_progress = 0;
|
import_in_progress = false;
|
||||||
$('#code_folder_mainarea_new_form_div').dialog('enable');
|
$('#code_folder_mainarea_new_form_div').dialog('enable');
|
||||||
$('#code_folder_mainarea_new_form_div').dialog('close');
|
$('#code_folder_mainarea_new_form_div').dialog('close');
|
||||||
if (data == 'ok')
|
if (data == 'ok')
|
||||||
|
{
|
||||||
|
// refresh the page to the head revision
|
||||||
$(location).attr ('href', codepot_merge_path('<?php print site_url(); ?>', '<?php print "/code/file/{$project->id}/{$hex_headpath}"; ?>'));
|
$(location).attr ('href', codepot_merge_path('<?php print site_url(); ?>', '<?php print "/code/file/{$project->id}/{$hex_headpath}"; ?>'));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
show_alert ('<pre>' + codepot_htmlspecialchars(data) + '</pre>', '');
|
{
|
||||||
|
show_alert ('<pre>' + codepot_htmlspecialchars(data) + '</pre>', "<?php print $this->lang->line('Error')?>");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
import_in_progress = 0;
|
import_in_progress = false;
|
||||||
$('#code_folder_mainarea_new_form_div').dialog('enable');
|
$('#code_folder_mainarea_new_form_div').dialog('enable');
|
||||||
$('#code_folder_mainarea_new_form_div').dialog('close');
|
$('#code_folder_mainarea_new_form_div').dialog('close');
|
||||||
show_alert ('Failed - ' + errorThrown, "<?php print $this->lang->line('Error')?>");
|
show_alert ('Failed - ' + errorThrown, "<?php print $this->lang->line('Error')?>");
|
||||||
@ -290,12 +297,16 @@ $(function () {
|
|||||||
|
|
||||||
},
|
},
|
||||||
'<?php print $this->lang->line('Cancel')?>': function () {
|
'<?php print $this->lang->line('Cancel')?>': function () {
|
||||||
if (import_in_progress > 0) return;
|
if (import_in_progress) return;
|
||||||
$('#code_folder_mainarea_new_form_div').dialog('close');
|
$('#code_folder_mainarea_new_form_div').dialog('close');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
clsoe: function() {}
|
|
||||||
|
beforeClose: function() {
|
||||||
|
// if importing is in progress, prevent dialog closing
|
||||||
|
return !import_in_progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -395,20 +406,8 @@ $(function () {
|
|||||||
render_readme ();
|
render_readme ();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php if (strlen($popup_error_message) > 0): ?>
|
<?php if (strlen($popup_error_message) > 0): ?>
|
||||||
$("#code_folder_popup_error_div").dialog( {
|
show_alert (<?php print codepot_json_encode('<pre>' . htmlspecialchars($popup_error_message) . '</pre>'); ?>, "<?php print $this->lang->line('Error')?>");
|
||||||
title: '<?php print $this->lang->line('Error')?>',
|
|
||||||
width: 'auto',
|
|
||||||
height: 'auto',
|
|
||||||
modal: true,
|
|
||||||
autoOpen: true,
|
|
||||||
buttons: {
|
|
||||||
"<?php print $this->lang->line('OK')?>": function() {
|
|
||||||
$( this ).dialog( "close" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -872,12 +871,6 @@ $this->load->view (
|
|||||||
|
|
||||||
<!-- ================================================================== -->
|
<!-- ================================================================== -->
|
||||||
|
|
||||||
<?php if (strlen($popup_error_message) > 0): ?>
|
|
||||||
<div id="code_folder_popup_error_div">
|
|
||||||
<?php print $popup_error_message?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -23,6 +23,22 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function show_alert (outputMsg, titleMsg)
|
||||||
|
{
|
||||||
|
$('#code_revision_mainarea_alert').html(outputMsg).dialog({
|
||||||
|
title: titleMsg,
|
||||||
|
resizable: true,
|
||||||
|
modal: true,
|
||||||
|
width: 'auto',
|
||||||
|
height: 'auto',
|
||||||
|
buttons: {
|
||||||
|
"OK": function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
<?php $review_count = count($reviews); ?>
|
<?php $review_count = count($reviews); ?>
|
||||||
<?php $is_loggedin = ($login['id'] != ''); ?>
|
<?php $is_loggedin = ($login['id'] != ''); ?>
|
||||||
<?php $can_edit = ($is_loggedin && $login['id'] == $file['history']['author']); ?>
|
<?php $can_edit = ($is_loggedin && $login['id'] == $file['history']['author']); ?>
|
||||||
@ -164,23 +180,6 @@ $(function() {
|
|||||||
});
|
});
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (strlen($popup_error_message) > 0): ?>
|
|
||||||
$(function() {
|
|
||||||
$("#code_revision_popup_error_div").dialog( {
|
|
||||||
title: '<?php print $this->lang->line('Error')?>',
|
|
||||||
width: 'auto',
|
|
||||||
height: 'auto',
|
|
||||||
modal: true,
|
|
||||||
autoOpen: true,
|
|
||||||
buttons: {
|
|
||||||
"<?php print $this->lang->line('OK')?>": function() {
|
|
||||||
$( this ).dialog( "close" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
function render_wiki()
|
function render_wiki()
|
||||||
{
|
{
|
||||||
<?php
|
<?php
|
||||||
@ -228,8 +227,9 @@ $(function() {
|
|||||||
hide_unneeded_divs ();
|
hide_unneeded_divs ();
|
||||||
render_wiki ();
|
render_wiki ();
|
||||||
|
|
||||||
|
<?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>
|
||||||
@ -560,6 +560,8 @@ $history = $file['history'];
|
|||||||
|
|
||||||
</div> <!-- code_revision_mainarea_result -->
|
</div> <!-- code_revision_mainarea_result -->
|
||||||
|
|
||||||
|
<div id='code_revision_mainarea_alert'></div>
|
||||||
|
|
||||||
</div> <!-- code_revision_mainarea -->
|
</div> <!-- code_revision_mainarea -->
|
||||||
|
|
||||||
<div class='footer-pusher'></div> <!-- for sticky footer -->
|
<div class='footer-pusher'></div> <!-- for sticky footer -->
|
||||||
@ -640,11 +642,6 @@ $history = $file['history'];
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?> <!-- $is_loggedin -->
|
<?php endif; ?> <!-- $is_loggedin -->
|
||||||
|
|
||||||
<?php if (strlen($popup_error_message) > 0): ?>
|
|
||||||
<div id="code_revision_popup_error_div">
|
|
||||||
<?php print $popup_error_message?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user