added preview buttons to various edit pages

This commit is contained in:
hyung-hwan 2014-06-15 17:16:06 +00:00
parent 61be4c7695
commit 1efb57fed8
9 changed files with 417 additions and 261 deletions

View File

@ -6,6 +6,36 @@
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/file.css')?>" />
<script type="text/javascript" src="<?=base_url_make('/js/creole.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript">
function render_wiki(input_text)
{
creole_render_wiki_with_input_text (
input_text,
"file_edit_mainarea_description_preview",
"<?=site_url()?>/wiki/show/<?=$project->id?>/",
"<?=site_url()?>/wiki/attachment0/<?=$project->id?>/"
);
}
$(function () {
$("#file_edit_mainarea_description_preview_button").button().click(
function () {
render_wiki ($("#file_edit_mainarea_description").val());
}
);
});
</script>
<title><?=htmlspecialchars($file->name)?></title>
</head>
@ -38,18 +68,14 @@ $this->load->view (
<!---------------------------------------------------------------------------->
<div class="mainarea" id="file_edit_mainarea">
<div class="mainarea" id="file_mainarea">
<?php if ($message != "") print '<div id="file_edit_message" class="form_message">'.htmlspecialchars($message).'</div>'; ?>
<?php if ($message != "") print '<div id="file_message" class="form_message">'.htmlspecialchars($message).'</div>'; ?>
<?=form_open_multipart("file/$mode/{$project->id}/" . $this->converter->AsciiToHex($file->name))?>
<?=form_fieldset()?>
<div>
<div>
<div class='form_input_field'>
<?=form_label($this->lang->line('Name').': ', 'file_name')?>
<?=form_error('file_name');?>
</div>
<div>
<?php
$extra = ($mode == 'update')? 'readonly="readonly"': '';
$extra .= 'maxlength="255" size="40"';
@ -58,58 +84,49 @@ $this->load->view (
else
print form_upload('file_name', set_value('file_name', $file->name), $extra);
?>
</div>
<?=form_error('file_name');?>
</div>
<div>
<div>
<div class='form_input_field'>
<?=form_label($this->lang->line('Tag').': ', 'file_tag')?>
<?=form_error('file_tag');?>
</div>
<div>
<?php
$extra = 'maxlength="50" size="25"';
?>
<?=form_input('file_tag', set_value('file_tag', $file->tag), $extra)?>
</div>
<?=form_error('file_tag');?>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Summary').': ', 'file_summary')?>
<?=form_error('file_summary');?>
</div>
<div>
<div class='form_input_field'>
<?php
$extra = 'maxlength="255" size="80"';
?>
<?=form_input('file_summary', set_value('file_summary', $file->summary), $extra)?>
</div>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Description').': ', 'file_description')?>
<a href='#' id='file_edit_mainarea_description_preview_button'>Preview</a>
<?=form_error('file_description');?>
</div>
<div>
<?=form_textarea('file_description', set_value('file_description', $file->description))?>
</div>
<div class='form_input_field'>
<?=form_textarea('file_description', set_value('file_description', $file->description), 'id=file_edit_mainarea_description')?>
</div>
<div id='file_edit_mainarea_description_preview' class='form_input_preview'></div>
<div>
<?=form_hidden('file_projectid', set_value('file_projectid', $file->projectid))?>
</div>
<div>
<?php $caption = ($mode == 'update')? $this->lang->line('Update'): $this->lang->line('Create'); ?>
<?=form_submit('file', $caption)?>
</div>
<?=form_fieldset_close()?>
<?=form_close();?>
</div> <!-- file_edit_mainarea -->
</div> <!-- file_mainarea -->
<!---------------------------------------------------------------------------->

View File

@ -6,6 +6,35 @@
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/issue.css')?>" />
<script type="text/javascript" src="<?=base_url_make('/js/creole.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript">
function render_wiki(input_text)
{
creole_render_wiki_with_input_text (
input_text,
"issue_edit_mainarea_description_preview",
"<?=site_url()?>/wiki/show/<?=$project->id?>/",
"<?=site_url()?>/wiki/attachment0/<?=$project->id?>/"
);
}
$(function () {
$("#issue_edit_mainarea_description_preview_button").button().click(
function () {
render_wiki ($("#issue_edit_mainarea_description").val());
}
);
});
</script>
<title><?=htmlspecialchars($issue->id)?></title>
</head>
@ -59,7 +88,7 @@ $this->load->view (
<?=form_hidden('issue_owner', set_value('issue_owner', $issue->owner))?>
</div>
<div id='issue_edit_mainarea_type'>
<div id='issue_edit_mainarea_type' class='form_input_field'>
<?php
if ($mode == 'update')
{
@ -72,48 +101,45 @@ $this->load->view (
'issue_type',
$issue_type_array,
set_value('issue_type', $issue->type),
'id="project_issue_type"');
'id="issue_edit_mainarea_type"');
print form_error('issue_type');
}
?>
</div>
<div id='issue_edit_mainarea_summary'>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Summary').': ', 'issue_summary')?>
<?=form_error('issue_summary');?>
</div>
<div>
<div class='form_input_field'>
<?=form_input('issue_summary',
set_value('issue_summary', $issue->summary),
'size="80" id="project_issue_summary"')
'size="80" id="issue_edit_mainarea_summary"')
?>
</div>
</div>
<div id='issue_edit_mainarea_description'>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Description').': ', 'issue_description')?>
<a href='#' id='issue_edit_mainarea_description_preview_button'>Preview</a>
<?=form_error('issue_description');?>
</div>
<div>
<div class='form_input_field'>
<?php
$xdata = array (
'name' => 'issue_description',
'value' => set_value ('issue_description', $issue->description),
'id' => 'project_issue_description',
'id' => 'issue_edit_mainarea_description',
'rows' => 20,
'cols' => 80
);
print form_textarea ($xdata);
?>
</div>
</div>
<div id='issue_edit_mainarea_description_preview' class='form_input_preview'></div>
<div id='issue_edit_mainarea_buttons'>
<?php $caption = ($mode == 'update')? $this->lang->line('Update'): $this->lang->line('Create'); ?>
<?=form_submit('issue', $caption)?>
</div>
<?=form_fieldset_close()?>
<?=form_close();?>

View File

@ -6,6 +6,32 @@
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/project.css')?>" />
<script type="text/javascript" src="<?=base_url_make('/js/creole.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript">
function render_wiki(input_text)
{
creole_render_wiki_with_input_text (
input_text,
"project_edit_mainarea_description_preview",
"<?=site_url()?>/wiki/show/<?=$project->id?>/",
"<?=site_url()?>/wiki/attachment0/<?=$project->id?>/"
);
}
$(function() {
$("#project_edit_mainarea_description_preview_button").button().click(
function () {
render_wiki ($("#project_edit_mainarea_description").val());
}
);
});
</script>
<title><?=$project->name?></title>
</head>
@ -48,49 +74,40 @@ $this->load->view (
<?=form_open($formurl)?>
<?=form_fieldset()?>
<div>
<div>
<div class='form_input_field'>
<?=form_label($this->lang->line('ID').': ', 'project_id')?>
<?=form_error('project_id')?>
</div>
<div>
<?php
$extra = ($mode == 'update')? 'readonly="readonly"': '';
$extra .= 'maxlength="32" size="16"';
?>
<?=form_input('project_id', set_value('project_id', $project->id), $extra)?>
</div>
<?=form_error('project_id')?>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Name').': ', 'project_name')?>
<?=form_error('project_name')?>
</div>
<div>
<div class='form_input_field'>
<?php $extra = 'maxlength="80" size="40"'; ?>
<?=form_input('project_name', set_value('project_name', $project->name), $extra)?>
</div>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Summary').': ', 'project_summary')?>
<?=form_error('project_summary')?>
</div>
<div>
<div class='form_input_field'>
<?php $extra = 'maxlength="80" size="50"'; ?>
<?=form_input('project_summary', set_value('project_summary', $project->summary), $extra)?>
</div>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Description').': ', 'project_description')?>
<a href='#' id='project_edit_mainarea_description_preview_button'>Preview</a>
<?=form_error('project_description')?>
</div>
<div>
<div class='form_input_field'>
<?php
$xdata = array (
'name' => 'project_description',
@ -102,10 +119,9 @@ $this->load->view (
print form_textarea ($xdata);
?>
</div>
</div>
<div id='project_edit_mainarea_description_preview' class='form_input_preview'></div>
<div>
<div>
<div class='form_input_field'>
<?=form_label($this->lang->line('Commitable').': ', 'project_commitable')?>
<?=form_checkbox('project_commitable', 'Y', set_checkbox('project_commitable', $project->commitable, $project->commitable == 'Y'))?>
<?=form_error('project_commitable')?>
@ -114,14 +130,12 @@ $this->load->view (
<?=form_checkbox('project_public', 'Y', set_checkbox('project_public', $project->public, $project->public == 'Y'))?>
<?=form_error('project_public')?>
</div>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Members').': ', 'project_members')?>
<?=form_error('project_members')?>
</div>
<div>
<div class='form_input_field'>
<?php
$xdata = array (
'name' => 'project_members',
@ -133,12 +147,9 @@ $this->load->view (
print form_textarea ($xdata);
?>
</div>
</div>
<div>
<?php $caption = ($mode == 'update')? $this->lang->line('Update'): $this->lang->line('Create'); ?>
<?=form_submit('project', $caption)?>
</div>
<?=form_fieldset_close()?>
<?=form_close();?>

View File

@ -6,6 +6,36 @@
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/site.css')?>" />
<script type="text/javascript" src="<?=base_url_make('/js/creole.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript">
function render_wiki(input_text)
{
creole_render_wiki_with_input_text (
input_text,
"site_edit_mainarea_text_preview",
"<?=site_url()?>/site/wiki/",
"<?=site_url()?>/site/image/"
);
}
$(function () {
$("#site_edit_mainarea_text_preview_button").button().click(
function () {
render_wiki ($("#site_edit_mainarea_text").val());
}
);
});
</script>
<title><?=htmlspecialchars($site->name)?></title>
</head>
@ -48,12 +78,8 @@ $this->load->view (
<?=form_open($formurl, 'id="site_edit_form"')?>
<?=form_fieldset()?>
<div>
<div>
<div class='form_input_field'>
<?=form_label($this->lang->line('Language').': ', 'site_id')?>
<?=form_error('site_id')?>
</div>
<div>
<?php
$extra = ($mode == 'update')? 'readonly="readonly"': '';
$extra .= 'maxlength="32" size="16" class="id"';
@ -63,40 +89,34 @@ $this->load->view (
set_value('site_id', $site->id),
$extra)
?>
</div>
<?=form_error('site_id')?>
</div>
<div>
<div>
<div class='form_input_field'>
<?=form_label($this->lang->line('Name').': ', 'site_name')?>
<?=form_error('site_name')?>
</div>
<div>
<?=form_input('site_name',
set_value('site_name', $site->name),
'maxlength="80" size="40" class="name"');
?>
</div>
<?=form_error('site_name')?>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Text').': ', 'site_text')?>
<a href='#' id='site_edit_mainarea_text_preview_button'>Preview</a>
<?=form_error('site_text')?>
</div>
<div>
<div class='form_input_field'>
<?=form_textarea('site_text',
set_value('site_text', $site->text),
'class="text"')
'class="text" id="site_edit_mainarea_text"')
?>
</div>
</div>
<div id='site_edit_mainarea_text_preview' class='form_input_preview'></div>
<div>
<?php $caption = ($mode == 'update')? $this->lang->line('Update'): $this->lang->line('Create'); ?>
<?=form_submit('site', $caption)?>
</div>
<?=form_fieldset_close()?>
<?=form_close();?>

View File

@ -6,12 +6,28 @@
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/wiki.css')?>" />
<script type="text/javascript" src="<?=base_url_make('/js/creole.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript">
function render_wiki(input_text)
{
creole_render_wiki_with_input_text (
input_text,
"wiki_edit_mainarea_text_preview",
"<?=site_url()?>/wiki/show/<?=$project->id?>/",
"<?=site_url()?>/wiki/attachment0/<?=$project->id?>/"
);
}
var new_attachment_no = 0;
$(function () {
$('#wiki_edit_more_new_attachment').button().click (
function () {
@ -24,6 +40,12 @@ $(function () {
return false;
}
);
$("#wiki_edit_mainarea_text_preview_button").button().click(
function () {
render_wiki ($("#wiki_edit_mainarea_text").val());
}
);
});
</script>
@ -65,26 +87,24 @@ $this->load->view (
<?=form_open_multipart("wiki/{$mode}/{$project->id}/".$this->converter->AsciiToHex($wiki->name))?>
<?=form_fieldset()?>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Name').': ', 'wiki_name')?>
<?=form_error('wiki_name');?>
</div>
<div>
<div class='form_input_field'>
<?php
$extra = ($mode == 'update')? 'readonly="readonly"': '';
$extra .= 'maxlength="80" size="40" id="wiki_edit_mainarea_name"';
?>
<?=form_input('wiki_name', set_value('wiki_name', $wiki->name), $extra)?>
</div>
</div>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('Text').': ', 'wiki_text')?>
<a href='#' id='wiki_edit_mainarea_text_preview_button'>Preview</a>
<?=form_error('wiki_text');?>
</div>
<div>
<div class='form_input_field'>
<?php
$xdata = array (
'name' => 'wiki_text',
@ -96,15 +116,15 @@ $this->load->view (
print form_textarea ($xdata);
?>
</div>
</div>
<div id='wiki_edit_mainarea_text_preview' class='form_input_preview'></div>
<?php if (!empty($wiki->attachments)): ?>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('WIKI_ATTACHMENTS').': ', 'wiki_edit_attachment_list')?>
<?=form_error('wiki_attachment_list');?>
</div>
<div class='form_input_field'>
<ul id='wiki_edit_attachment_list'>
<?php
foreach ($wiki->attachments as $att)
@ -122,12 +142,10 @@ $this->load->view (
}
?>
</ul>
</div>
<?php endif; ?>
<div>
<div>
<div class='form_input_label'>
<?=form_label($this->lang->line('WIKI_NEW_ATTACHMENTS').': ', 'wiki_edit_new_attachment_list')?>
<a href='#' id='wiki_edit_more_new_attachment'>
<?=$this->lang->line('WIKI_MORE_NEW_ATTACHMENTS')?>
@ -135,6 +153,7 @@ $this->load->view (
<?=form_error('wiki_edit_new_attachment_list');?>
</div>
<div class='form_input_field'>
<ul id='wiki_edit_new_attachment_list'>
<li>
<input type='file' name='wiki_new_attachment_0' />

View File

@ -217,12 +217,39 @@ body {
font-size: inherit;
}
.content .mainarea .form_input_label {
margin-bottom: 0.2em;
}
.content .mainarea .form_input_label .ui-button {
font-size: 80%;
font-style: italic;
}
.content .mainarea .form_input_field {
margin-bottom: 0.5em;
}
.content .mainarea .form_input_preview {
width: 100%;
/*border: 1px solid #DDDDDD;*/
background-color: #FFFFF0;
font-size: 90%;
}
.content .mainarea .form_input_preview pre {
background-color: inherit;
/*background-color: #FDF5D6;*/
/*border: none;*/
}
.content .mainarea .icon {
border: 0;
}
.content .mainarea pre {
padding: .3em .3em .3em .3em;
/*padding: .3em .3em .3em .3em;*/
border: 1px dashed #BBCCDD;
background-color: #F1F1FF;
overflow: auto;

View File

@ -11,3 +11,8 @@
}
#file_edit_mainarea_description {
width: 100%;
}

View File

@ -50,6 +50,7 @@
width: 100%;
}
/*-----------------------------------------------
* project catalog view
*-----------------------------------------------*/

View File

@ -536,3 +536,33 @@ function creole_render_wiki (inputid, outputid, linkbase, imgbase)
output.innerHTML = '';
creole.parse (output, xinput);
}
function creole_render_wiki_with_input_text (input_text, outputid, linkbase, imgbase)
{
function $(id) { return document.getElementById(id); }
function decodeEntities(str)
{
return str.replace(/&amp;/g, '&').
replace(/&lt;/g, '<').
replace(/&gt;/g, '>').
replace(/&quot;/g, '"');
}
//var input = $(inputid);
var output = $(outputid);
var creole = new Parse.Simple.Creole(
{
forIE: document.all,
/*interwiki: {
WikiCreole: 'http://www.wikicreole.org/wiki/',
Wikipedia: 'http://en.wikipedia.org/wiki/'
},*/
linkFormat: linkbase,
imgFormat: imgbase
} );
var xinput = decodeEntities(input_text);
output.innerHTML = '';
creole.parse (output, xinput);
}