various small changes

This commit is contained in:
toyomoyo 2006-04-18 01:59:13 +00:00
parent 7077ca8399
commit f4c85f469a
5 changed files with 121 additions and 80 deletions

View File

@ -114,12 +114,8 @@
</strong><br /><br />
<small><small>
<?php
helpbutton('reading', get_string('helpreading'), 'moodle', true, true);
echo '<br />';
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
echo '<br />';
helpbutton('questions', get_string('helpquestions'), 'moodle', true, true);
echo '<br />';
if ($usehtmleditor) {
helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
} else {

View File

@ -167,7 +167,7 @@ function do_delete($postid) {
// check ownership
$blogEntry = get_record('post','id',$postid);
if (blog_user_can_edit($blogEntry)) {
if (blog_user_can_edit_post($blogEntry)) {
if (delete_records('post','id',$postid)) {
//echo "bloginfo_arg:"; //debug
@ -188,7 +188,7 @@ function do_delete($postid) {
//comment out this redirect to debug the deletion of entries
redirect($CFG->wwwroot .'/blog/index.php?userid='. $post->userid);
redirect($CFG->wwwroot .'/blog/index.php?userid='. $blogEntry->userid);
}
/**

View File

@ -72,9 +72,34 @@ if (!isset($filtertype)) {
/// course blogs - sitefullname -> course fullname ->blogs ->(?tag)
/// group blogs - sitefullname -> course fullname ->group ->(?tag)
/// user blogs - sitefullname -> (?coursefullname) -> participants -> blogs -> (?tag)
$blogstring = get_string('blogs','blog');
$tagstring = get_string('tag');
if ($ME == 'http://yu.moodle.com/dev/blog/edit.php') { ///we are in edit mode, print editting header
// first we need to identify the user
if ($editid) { // if we are editting a post
$blogEntry = get_record('post','id',$editid);
$user = get_record('user','id',$blogEntry->userid);
} else {
$user = get_record('user','id',$filterselect);
}
if ($editid) {
$formHeading = get_string('updateentrywithid', 'blog');
} else {
$formHeading = get_string('addnewentry', 'blog');
}
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.$blogstring.'</a> -> '. $formHeading,'','',true,$PAGE->get_extra_header_string());
} else { // else, we are in view mode
/// This is very messy atm.
switch ($filtertype) {
case 'site':
if ($tagid || !empty($tag)) {
@ -135,7 +160,6 @@ switch ($filtertype) {
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'&amp;course='.$course->id.'">'.fullname($user).'</a> ->
'.$blogstring,'','',true,$PAGE->get_extra_header_string());
}
}
@ -159,11 +183,13 @@ switch ($filtertype) {
default: //user click on add from block
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'&amp;course='.$course->id.'">'.fullname($user).'</a> ->
'.$blogstring,'','',true,$PAGE->get_extra_header_string());
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.$blogstring.'</a> -> '.get_string('addentry','blog'),'','',true,$PAGE->get_extra_header_string());
break;
}
} /// close switch
$editing = false;
if ($PAGE->user_allowed_editing()) {
$editing = $PAGE->user_is_editing();

View File

@ -119,10 +119,14 @@ switch ($filtertype) {
error ('Blogs is not enabled');
}
blog_user_can_view_user_post($filterselect);
if ($CFG->bloglevel == BLOG_USER_LEVEL and $USER->id != $filterselect and !isadmin()) {
error ('Under this setting, you can only view your own blogs');
}
/// check to see if the viewer is sharing no_group, visible group course.
/// if not , check if the viewer is in any spg group as the user
blog_user_can_view_user_post($filterselect);
break;
default:
break;
@ -133,8 +137,6 @@ if ($limit == 'none') {
$limit = get_user_preferences('blogpagesize',10);
}
//$blogFilter =& new BlogFilter($userid, $postid, $limit, $start,$filtertype, $filterselect, $tagid, $tag);
include($CFG->dirroot .'/blog/header.php');
//prints the tabs

View File

@ -168,6 +168,23 @@
echo '</td><td class="content">'."\n";
switch ($template['publishstate']) {
case 'draft':
$blogtype = get_string('publishtonoone', 'blog');
break;
case 'site':
$blogtype = get_string('publishtosite', 'blog');
break;
case 'public':
$blogtype = get_string('publishtoworld', 'blog');
break;
default:
break;
}
echo '<div class="">'.$blogtype.'</div>'; /// martin please fill in the class and css
// Print whole message
echo format_text($template['body']);