mirror of
https://github.com/moodle/moodle.git
synced 2025-02-13 12:34:28 +01:00
195 lines
6.9 KiB
HTML
Executable File
195 lines
6.9 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" enctype="multipart/form-data">
|
|
|
|
<table border="0" cellpadding="5">
|
|
<tr valign="top">
|
|
<td align="right">
|
|
</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>
|
|
</td>
|
|
|
|
<td>
|
|
<?php
|
|
if (!empty($post->id)) {
|
|
$idsql = " AND bti.entryid = {$post->id}";
|
|
} else {
|
|
$idsql = " AND bti.entryid = 0";
|
|
}
|
|
|
|
$pptag = '';
|
|
if ($ptags = get_records_sql("SELECT t.* FROM
|
|
{$CFG->prefix}tags t,
|
|
{$CFG->prefix}blog_tag_instance bti
|
|
WHERE t.id = bti.tagid
|
|
AND t.type = 'personal'
|
|
$idsql")) {
|
|
|
|
foreach ($ptags as $ptag) {
|
|
$pptag .= $ptag->text.',';
|
|
}
|
|
$pptag = rtrim($pptag, ",");
|
|
}
|
|
|
|
|
|
?>
|
|
<input type="text" name="ptags" value="<?php echo $pptag;?>"/>
|
|
<?php
|
|
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
|
// only make sense to link if the user has capablity
|
|
if (has_capability('moodle/blog:managepersonaltags', $sitecontext) || has_capability('moodle/blog:manageofficialtags', $sitecontext)) {
|
|
echo "<br/>";
|
|
link_to_popup_window("/blog/tags.php",'popup',get_string('tagmanagement'));
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td align="right"><b><?php print_string("attachment", "forum") ?>:<br />(<?php print_string("optional") ?>) </b></td>
|
|
<td>
|
|
<?php $maxbytes = get_max_upload_file_size($CFG->maxbytes); ?>
|
|
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxbytes ?>" />
|
|
<input type="file" name="attachment" size="40" alt="<?php print_string("attachment", "forum") ?>" />
|
|
<?php
|
|
print_string("maxsize", "", display_size($maxbytes));
|
|
?>
|
|
</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'); ?>" />
|
|
<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'); ?>" />
|
|
<input type="button" value="<?php print_string('cancel'); ?>" onclick="javascript:history.go(-1)" />
|
|
<?php } ?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|