moodle/blog/edit.html

165 lines
5.6 KiB
HTML
Executable File

<?php //$Id$
// find all the tags this post uses
$usedtags = array();
if (!empty($post->id)) {
if ($tagsused = get_records('blog_tag_instance', 'entryid', $post->id)) {
foreach ($tagsused as $usedtag) {
$usedtags[] = $usedtag -> tagid;
}
}
}
if ($usehtmleditor) {
// clean and convert to html before editting
$options = new object();
$options->smiley = false;
$options->filter = false;
$options->nocache = true;
$post->summary = format_text($post->summary, $post->format, $options);
}
?>
<form name="entry" method="post" action="edit.php" >
<table border="0" cellpadding="5">
<tr valign="top">
<td align="right">&nbsp;
</td>
<td colspan="2"><strong><?php echo $strformheading; ?></strong>
</td>
</tr>
<tr valign="top">
<td align="right"><strong><?php print_string('entrytitle', 'blog'); ?>:</strong></td>
<td colspan="2">
<input type="text" name="subject" size="60" value="<?php p($post->subject) ?>" />
<?php if (isset($errors["subject"])) formerr($errors["subject"]); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><strong>
<?php
print_string('entrybody', 'blog');
?>:
</strong><br /><br />
<small><small>
<?php
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
echo '<br />';
if ($usehtmleditor) {
helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
} else {
emoticonhelpbutton('entry', 'body');
}
?>
</small></small>
</td>
<td align="left" colspan="2">
<?php print_textarea($usehtmleditor, 25, 62, 500, 600, 'summary', $post->summary); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><strong><?php print_string('formattexttype'); ?>:</strong></td>
<td colspan="2">
<?php
if ($usehtmleditor) { /// Trying this out for a while
print_string('formathtml');
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
choose_from_menu(format_text_menu(), 'format', $post->format, '');
}
?>
<small><small>
<?php
helpbutton('textformat', get_string('helpformatting'));
?>
</small></small>
<?php if (isset($errors["summary"])) formerr($errors["summary"]); ?>
</td>
</tr>
<tr valign="top">
<td align="right">
<strong><?php print_string('tags'); echo ':';?></strong>
</td>
<td>
<table width="100%">
<tr>
<td>
<b><?php print_string('otags','blog'); ?></b>
</td>
<td>
<b><?php print_string('ptags','blog'); ?></b>
</td>
</tr>
<tr>
<td>
<select name="otags[]" multiple="multiple" size="8">
<?php
$otags = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'official\' ORDER by text ASC');
foreach ($otags as $otag) {
if (in_array($otag->id, $usedtags)) {
echo '<option value="'.$otag->id.'" selected="selected">'.$otag->text.'</option>';
} else {
echo '<option value="'.$otag->id.'">'.$otag->text.'</option>';
}
}
?>
</select>
&nbsp;&nbsp;</td>
<td>
<select name="ptags[]" multiple="multiple" size="8">
<?php
$ptags = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'personal\' ORDER by text ASC');
foreach ($ptags as $ptag) {
if (in_array($ptag->id, $usedtags)) {
echo '<option value="'.$ptag->id.'" selected="selected">'.$ptag->text.'</option>';
} else {
echo '<option value="'.$ptag->id.'">'.$ptag->text.'</option>';
}
}
?>
</select>
<?php link_to_popup_window("/blog/tags.php",'popup',get_string('tagmanagement')); ?>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td align="right">
<strong><?php print_string('publishto', 'blog'); ?>:</strong>
</td>
<td colspan="2">
<?php
$options = blog_applicable_publish_states(); //$blogEntry may be null
choose_from_menu($options, 'publishstate', $post->publishstate, '');
?>
<?php
helpbutton('publish_state', get_string('helppublish', 'blog'), 'blog');
?>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
<input type="hidden" name="action" value="<?php echo $action; ?>" />
<input type="hidden" name="courseid" value="<?php echo $courseid; ?>" />
<?php
if ($action == 'add') {
?>
<input type="hidden" name="action" value="add" />
<input type="submit" value="<?php print_string('add'); ?>" />&nbsp;
<input type="button" value="<?php print_string('cancel'); ?>" onclick="javascript:history.go(-1)" />
<?php
} else { ?>
<input type="hidden" name="id" value="<?php echo $post->id; ?>" />
<input type="submit" value="<?php print_string('savechanges'); ?>" />&nbsp;
<input type="button" value="<?php print_string('cancel'); ?>" onclick="javascript:history.go(-1)" />
<?php } ?>
</td>
</tr>
</table>
</form>