Various improvements to Examview input.
[moodle-linuxchix.git] / blog / edit.html
bloba91e26a8df94bc42483093cb3ad21f644b8e66b9
1 <?php //$Id$
3 // find all the tags this post uses
4 $usedtags = array();
5 if (!empty($post->id)) {
6 if ($tagsused = get_records('blog_tag_instance', 'entryid', $post->id)) {
7 foreach ($tagsused as $usedtag) {
8 $usedtags[] = $usedtag -> tagid;
13 if ($usehtmleditor) {
14 // clean and convert to html before editting
15 $options = new object();
16 $options->smiley = false;
17 $options->filter = false;
18 $options->nocache = true;
19 $post->summary = format_text($post->summary, $post->format, $options);
23 <form name="entry" method="post" action="edit.php" enctype="multipart/form-data">
25 <table border="0" cellpadding="5">
26 <tr valign="top">
27 <td align="right">&nbsp;
28 </td>
29 <td colspan="2"><strong><?php echo $strformheading; ?></strong>
30 </td>
31 </tr>
32 <tr valign="top">
33 <td align="right"><strong><?php print_string('entrytitle', 'blog'); ?>:</strong></td>
34 <td colspan="2">
35 <input type="text" name="subject" size="60" value="<?php p($post->subject) ?>" />
36 <?php if (isset($errors["subject"])) formerr($errors["subject"]); ?>
37 </td>
38 </tr>
39 <tr valign="top">
40 <td align="right"><strong>
41 <?php
42 print_string('entrybody', 'blog');
43 ?>:
44 </strong><br /><br />
45 <small><small>
46 <?php
47 helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
48 echo '<br />';
49 if ($usehtmleditor) {
50 helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
51 } else {
52 emoticonhelpbutton('entry', 'body');
55 </small></small>
56 </td>
57 <td align="left" colspan="2">
58 <?php print_textarea($usehtmleditor, 25, 62, 500, 600, 'summary', $post->summary); ?>
59 </td>
60 </tr>
61 <tr valign="top">
62 <td align="right"><strong><?php print_string('formattexttype'); ?>:</strong></td>
63 <td colspan="2">
64 <?php
65 if ($usehtmleditor) { /// Trying this out for a while
66 print_string('formathtml');
67 echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
68 } else {
69 choose_from_menu(format_text_menu(), 'format', $post->format, '');
72 <small><small>
73 <?php
74 helpbutton('textformat', get_string('helpformatting'));
76 </small></small>
77 <?php if (isset($errors["summary"])) formerr($errors["summary"]); ?>
78 </td>
79 </tr>
80 <tr valign="top">
81 <td align="right">
82 <strong><?php print_string('tags'); echo ':';?></strong>
83 </td>
85 <td>
86 <table width="100%">
87 <tr>
88 <td>
89 <b><?php print_string('otags','blog'); ?></b>
90 </td>
91 <td>
92 <b><?php print_string('ptags','blog'); ?></b>
93 </td>
94 </tr>
95 <tr>
96 <td>
97 <select name="otags[]" multiple="multiple" size="8">
98 <?php
99 $otags = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'official\' ORDER by text ASC');
100 foreach ($otags as $otag) {
101 if (in_array($otag->id, $usedtags)) {
102 echo '<option value="'.$otag->id.'" selected="selected">'.$otag->text.'</option>';
103 } else {
104 echo '<option value="'.$otag->id.'">'.$otag->text.'</option>';
108 </select>
109 &nbsp;&nbsp;</td>
111 <td>
112 <?php
113 if (!empty($post->id)) {
114 $idsql = " AND bti.entryid = {$post->id}";
115 } else {
116 $idsql = " AND bti.entryid = 0";
119 $pptag = '';
120 if ($ptags = get_records_sql("SELECT t.* FROM
121 {$CFG->prefix}tags t,
122 {$CFG->prefix}blog_tag_instance bti
123 WHERE t.id = bti.tagid
124 AND t.type = 'personal'
125 $idsql")) {
127 foreach ($ptags as $ptag) {
128 $pptag .= $ptag->text.',';
130 $pptag = rtrim($pptag, ",");
135 <input type="text" name="ptags" value="<?php echo $pptag;?>"/>
136 <?php
137 $sitecontext = get_context_instance(CONTEXT_SYSTEM);
138 // only make sense to link if the user has capablity
139 if (has_capability('moodle/blog:managepersonaltags', $sitecontext) || has_capability('moodle/blog:manageofficialtags', $sitecontext)) {
140 echo "<br/>";
141 link_to_popup_window("/blog/tags.php",'popup',get_string('tagmanagement'));
144 </td>
145 </tr>
146 </table>
147 </td>
148 </tr>
149 <tr valign="top">
150 <td align="right"><b><?php print_string("attachment", "forum") ?>:<br />(<?php print_string("optional") ?>)&nbsp;</b></td>
151 <td>
152 <?php $maxbytes = get_max_upload_file_size($CFG->maxbytes); ?>
153 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxbytes ?>" />
154 <input type="file" name="attachment" size="40" alt="<?php print_string("attachment", "forum") ?>" />
155 <?php
156 print_string("maxsize", "", display_size($maxbytes));
158 </td>
159 </tr>
160 <tr valign="top">
161 <td align="right">
162 <strong><?php print_string('publishto', 'blog'); ?>:</strong>
163 </td>
164 <td colspan="2">
165 <?php
166 $options = blog_applicable_publish_states(); //$blogEntry may be null
167 choose_from_menu($options, 'publishstate', $post->publishstate, '');
169 <?php
170 helpbutton('publish_state', get_string('helppublish', 'blog'), 'blog');
172 </td>
173 </tr>
174 <tr>
175 <td align="center" colspan="3">
176 <input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
177 <input type="hidden" name="action" value="<?php echo $action; ?>" />
178 <input type="hidden" name="courseid" value="<?php echo $courseid; ?>" />
179 <?php
180 if ($action == 'add') {
182 <input type="hidden" name="action" value="add" />
183 <input type="submit" value="<?php print_string('add'); ?>" />&nbsp;
184 <input type="button" value="<?php print_string('cancel'); ?>" onclick="javascript:history.go(-1)" />
185 <?php
186 } else { ?>
187 <input type="hidden" name="id" value="<?php echo $post->id; ?>" />
188 <input type="submit" value="<?php print_string('savechanges'); ?>" />&nbsp;
189 <input type="button" value="<?php print_string('cancel'); ?>" onclick="javascript:history.go(-1)" />
190 <?php } ?>
191 </td>
192 </tr>
193 </table>
194 </form>