mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
made some changes so that if a user has any roles assigned in context_module or context_block with moodle/site:manageblocks or moodle/course:manageactivities, he will see the "turn editting on" button without needing to have a role assigned at context_course with moodle/course:manageactivies capability. Of course this user would not be able to edit any blocks or modules he/she is not supposed to edit. Ajax for these users with partial editing privilages are locked. Please report bugs asap as we are looking at backporting this change to 1.8. Cheers.
This commit is contained in:
parent
12ce9ea2ee
commit
217a8ee950
13 changed files with 149 additions and 62 deletions
|
@ -108,7 +108,7 @@ if ($thissection->summary or $thissection->sequence or isediting($course->id)) {
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo '<a title="'.$streditsummary.'" '.
|
||||
' href="editsection.php?id='.$thissection->id.'"><img src="'.$CFG->pixpath.'/t/edit.gif" '.
|
||||
' class="iconsmall" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
|
@ -263,7 +263,7 @@ while ($section <= $course->numsections) {
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ while ($section <= $course->numsections) {
|
|||
'<img src="'.$CFG->pixpath.'/i/one.gif" height="16" width="16" border="0" alt="'.$strshowonlytopic.'" /></a><br />';
|
||||
}
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if ($course->marker == $section) { // Show the "light globe" on/off
|
||||
echo '<a href="view.php?id='.$course->id.'&marker=0&sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strmarkedthistopic.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/marked.gif" height="16" width="16" border="0" alt="'.$strmarkedthistopic.'" /></a><br />';
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo '<a title="'.$streditsummary.'" '.
|
||||
' href="editsection.php?id='.$thissection->id.'"><img src="'.$CFG->pixpath.'/t/edit.gif" '.
|
||||
' alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
|
@ -213,7 +213,7 @@
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
|
@ -237,7 +237,7 @@
|
|||
'<img src="'.$CFG->pixpath.'/i/one.gif" alt="'.$strshowonlytopic.'" /></a><br />';
|
||||
}
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if ($course->marker == $section) { // Show the "light globe" on/off
|
||||
echo '<a href="view.php?id='.$course->id.'&marker=0&sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strmarkedthistopic.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/marked.gif" alt="'.$strmarkedthistopic.'" /></a><br />';
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo '<a title="'.$streditsummary.'" '.
|
||||
' href="editsection.php?id='.$thissection->id.'"><img src="'.$CFG->pixpath.'/t/edit.gif" '.
|
||||
'class="iconsmall edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
|
@ -226,7 +226,7 @@
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
|
@ -251,7 +251,7 @@
|
|||
'<img src="'.$CFG->pixpath.'/i/one.gif" class="icon wkone" alt="'.$strshowonlyweek.'" /></a><br />';
|
||||
}
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if ($thissection->visible) { // Show the hide/show eye
|
||||
echo '<a href="view.php?id='.$course->id.'&hide='.$section.'&sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekhide.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/hide.gif" class="icon hide" alt="'.$strweekhide.'" /></a><br />';
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo '<p><a title="'.$streditsummary.'" '.
|
||||
' href="editsection.php?id='.$thissection->id.'"><img src="'.$CFG->pixpath.'/t/edit.gif" '.
|
||||
' class="icon edit" alt="'.$streditsummary.'" /></a></p>';
|
||||
|
@ -212,7 +212,7 @@
|
|||
'<img src="'.$CFG->pixpath.'/i/one.gif" class="icon wkone" alt="'.$strshowonlyweek.'" /></a><br />';
|
||||
}
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
if ($thissection->visible) { // Show the hide/show eye
|
||||
echo '<a href="view.php?id='.$course->id.'&hide='.$section.'&sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekhide.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/hide.gif" class="icon hide" alt="'.$strweekhide.'" /></a><br />';
|
||||
|
@ -243,7 +243,7 @@
|
|||
$summaryformatoptions->noclean = true;
|
||||
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
if (isediting($course->id) && has_capability('moodle/course:update', $course->id)) {
|
||||
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/t/edit.gif" class="icon edit" alt="'.$streditsummary.'" /></a><br /><br />';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue