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