Skip to content

Commit

Permalink
making blogs respect global tags flag
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Aug 30, 2007
1 parent 061f14b commit 93bbdd5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 38 deletions.
2 changes: 1 addition & 1 deletion blocks/blog_tags/block_blog_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function get_content() {

global $CFG, $SITE, $COURSE, $USER;

if (empty($CFG->bloglevel)) {
if (empty($CFG->usetags) || empty($CFG->bloglevel)) {
$this->content->text = '';
return $this->content;
}
Expand Down
75 changes: 39 additions & 36 deletions blog/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,46 @@ function definition() {
$mform->addElement('select', 'publishstate', get_string('publishto', 'blog'), blog_applicable_publish_states());
$mform->setHelpButton('publishstate', array('publish_state', get_string('helppublish', 'blog'), 'blog'));

$mform->addElement('header', 'tagshdr', get_string('tags', 'blog'));

$mform->createElement('select', 'otags', get_string('otags','blog'));

$js_escape = array(
"\r" => '\r',
"\n" => '\n',
"\t" => '\t',
"'" => "\\'",
'"' => '\"',
'\\' => '\\\\'
);

$otagsselEl =& $mform->addElement('select', 'otags', get_string('otags', 'blog'), array(), 'size="5"');
$otagsselEl->setMultiple(true);
$this->otags_select_setup();

if (has_capability('moodle/blog:manageofficialtags', $sitecontext)){
$deleteotagsmsg = strtr(get_string('deleteotagswarn', 'blog'), $js_escape);
$mform->registerNoSubmitButton('deleteotags');
$mform->addElement('submit', 'deleteotags', get_string('delete'),
array('onclick'=>"return confirm('$deleteotagsmsg');"));
$mform->disabledIf('deleteotags', 'otags[]', 'noitemselected');
$mform->setAdvanced('deleteotags');

$mform->registerNoSubmitButton('addotags');
$otagsgrp = array();
$otagsgrp[] =& $mform->createElement('text', 'otagsadd', get_string('addotags', 'blog'));
$otagsgrp[] =& $mform->createElement('submit', 'addotags', get_string('add'));
$mform->addGroup($otagsgrp, 'otagsgrp', get_string('addotags','blog'), array(' '), false);
$mform->setType('otagsadd', PARAM_NOTAGS);
$mform->setAdvanced('otagsgrp');


if (!empty($CFG->usetags)) {
$mform->addElement('header', 'tagshdr', get_string('tags', 'blog'));
$mform->createElement('select', 'otags', get_string('otags','blog'));

$js_escape = array(
"\r" => '\r',
"\n" => '\n',
"\t" => '\t',
"'" => "\\'",
'"' => '\"',
'\\' => '\\\\'
);

$otagsselEl =& $mform->addElement('select', 'otags', get_string('otags', 'blog'), array(), 'size="5"');
$otagsselEl->setMultiple(true);
$this->otags_select_setup();

if (has_capability('moodle/blog:manageofficialtags', $sitecontext)){
$deleteotagsmsg = strtr(get_string('deleteotagswarn', 'blog'), $js_escape);
$mform->registerNoSubmitButton('deleteotags');
$mform->addElement('submit', 'deleteotags', get_string('delete'),
array('onclick'=>"return confirm('$deleteotagsmsg');"));
$mform->disabledIf('deleteotags', 'otags[]', 'noitemselected');
$mform->setAdvanced('deleteotags');

$mform->registerNoSubmitButton('addotags');
$otagsgrp = array();
$otagsgrp[] =& $mform->createElement('text', 'otagsadd', get_string('addotags', 'blog'));
$otagsgrp[] =& $mform->createElement('submit', 'addotags', get_string('add'));
$mform->addGroup($otagsgrp, 'otagsgrp', get_string('addotags','blog'), array(' '), false);
$mform->setType('otagsadd', PARAM_NOTAGS);
$mform->setAdvanced('otagsgrp');
}

$mform->addElement('textarea', 'ptags', get_string('ptags', 'blog'), array('cols'=>'40', 'rows'=>'5'));
$mform->setType('ptagsadd', PARAM_NOTAGS);
}

$mform->addElement('textarea', 'ptags', get_string('ptags', 'blog'), array('cols'=>'40', 'rows'=>'5'));
$mform->setType('ptagsadd', PARAM_NOTAGS);


$this->add_action_buttons();

$mform->addElement('hidden', 'action');
Expand Down
2 changes: 1 addition & 1 deletion blog/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function blog_print_entry($blogEntry, $viewtype='full', $filtertype='', $filters
WHERE t.id = ti.tagid
AND ti.entryid = '.$blogEntry->id)) {
*/
if ($blogtags = get_item_tags('blog', $blogEntry->id)) {
if (!empty($CFG->usetags) && ($blogtags = get_item_tags('blog', $blogEntry->id))) {
echo '<div class="tags">';
if ($blogtags) {
print_string('tags');
Expand Down

0 comments on commit 93bbdd5

Please sign in to comment.