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,97 +72,123 @@ 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');
switch ($filtertype) {
case 'site':
if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="index.php?filtertype=site">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$site->shortname: $blogstring", "$site->fullname",
"$blogstring",'','',true,$PAGE->get_extra_header_string());
}
break;
if ($ME == 'http://yu.moodle.com/dev/blog/edit.php') { ///we are in edit mode, print editting header
case 'course':
if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$filterselect.'">'.$course->shortname.'</a> ->
<a href="index.php?filtertype=course&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$filterselect.'">'.$course->shortname."</a> ->
$blogstring",'','',true,$PAGE->get_extra_header_string());
}
break;
// 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);
}
case 'group':
if ($editid) {
$formHeading = get_string('updateentrywithid', 'blog');
} else {
$formHeading = get_string('addnewentry', 'blog');
}
$thisgroup = get_record('groups', 'id', $filterselect);
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());
if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name.'</a> ->
<a href="index.php?filtertype=group&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name."</a> ->
$blogstring",'','',true,$PAGE->get_extra_header_string());
} else { // else, we are in view mode
}
/// This is very messy atm.
break;
switch ($filtertype) {
case 'site':
if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="index.php?filtertype=site">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$site->shortname: $blogstring", "$site->fullname",
"$blogstring",'','',true,$PAGE->get_extra_header_string());
}
break;
case 'user':
$user = get_record('user', 'id', $filterselect);
$participants = get_string('participants');
if (isset($course->id) && $course->id && $course->id != SITEID) {
case 'course':
if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<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> ->
<a href="index.php?courseid='.optional_param('courseid', 0, PARAM_INT).'&amp;filtertype=user&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$filterselect.'">'.$course->shortname.'</a> ->
<a href="index.php?filtertype=course&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$filterselect.'">'.$course->shortname."</a> ->
$blogstring",'','',true,$PAGE->get_extra_header_string());
}
break;
case 'group':
$thisgroup = get_record('groups', 'id', $filterselect);
if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name.'</a> ->
<a href="index.php?filtertype=group&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<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());
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name."</a> ->
$blogstring",'','',true,$PAGE->get_extra_header_string());
}
}
//in top view
else {
break;
if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="index.php?filtertype=user&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
case 'user':
$user = get_record('user', 'id', $filterselect);
$participants = get_string('participants');
} else {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
'.$blogstring,'','',true,$PAGE->get_extra_header_string());
if (isset($course->id) && $course->id && $course->id != SITEID) {
if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<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> ->
<a href="index.php?courseid='.optional_param('courseid', 0, PARAM_INT).'&amp;filtertype=user&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$course->shortname: $blogstring", "$course->fullname",
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<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());
}
}
//in top view
else {
}
break;
if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="index.php?filtertype=user&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
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());
break;
}
} else {
print_header("$site->shortname: $blogstring", "$site->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
'.$blogstring,'','',true,$PAGE->get_extra_header_string());
}
}
break;
default: //user click on add from block
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> -> '.get_string('addentry','blog'),'','',true,$PAGE->get_extra_header_string());
break;
}
} /// close switch
$editing = false;
if ($PAGE->user_allowed_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']);