CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by aggelos panagiotakis -
Number of replies: 8
In the CMS PLUGIN there are many redirecting problems after adding/editing/hiding/showing/moving resources and activities
these actions force you to go to the main course page and browsing back to the correct place using the cms navigation menu.
how can we solve these problems?
I am trying to find a solution so please if you can help me.

i think we must edit the file
course/mod.php
and change all instances of
redirect("view.php?id=$cm->course#section-$sectionreturn");
to something like
redirect("view.php?id=$cm->course&section=$sectionreturn");

then parse all pages and find the page where this section appears ({#section__$sectionreturn__}) and redirectiong to that one that contains the section.

Is this the best solution ?- i think it will take much time to finish searching the page containing that section.
Does anyone have any ideas on how to implement it?
I think the best solution is that Maybe we can add for each page an database record pointing to the correct section(s).

thanks in advance.

Average of ratings: -
In reply to aggelos panagiotakis

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by aggelos panagiotakis -
i think i fixed much of the problems conserning the redirects using THE BUTTONS FOR RESOURCE AND ACTIVITIES (move, edit ,delete , visible on/off and the extra dublicate/copy ) for each one and for new ones. I also added an extra button for dublicating resources and editing them.
I enclose in a zip file all my changes here.
files changed in folders
[your moodle path]/course/
lib.php
mod.php
view.php
[your moodle path]/cms/
view.php
pageupdate.php
pageadd.php
cmslib.php
view.php
[your moodle path]/blocks/cmsnavigation/block_cmsnavigation.php
In reply to aggelos panagiotakis

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by Peter Birdsall -

Hi Aggelos

Can only find /course and /cms in your zip, and of /cms there are not all files..

Or am I missing something?

In reply to Peter Birdsall

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by aggelos panagiotakis -
I thought i uploaded the correct file ...
but i get the error
"Uploaded file exceeded the maximum size limit set by the form"
anyway, sorry!
here is the correct one.
beacause of the file size limit of 100kb i post my version without the files from /cms/pix/* So please find them on the standar cms plugin package.
I am about to correct some bugs of that package . So if you wait you will get a new version with less bugs. The main problem is the redirects are bad if an error occures.
I will need some help from a developer. I am not sure if the method i used is the correct one-it is very intesive in searching for : which cms page the current section is in. I also have bad sql queries and it will not work if you have other that the prefix _mdl in your database.I will try to fix those issues.Any help is appreciated.Excuse my bad english.

In reply to aggelos panagiotakis

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by aggelos panagiotakis -
i think it is beter to use the file attached instead of the one included in the previous attachment.So place it under:
[your_moodle_path]/course/mod.php

It actualy tries to fix redirecting problems after an error occurs.
In reply to aggelos panagiotakis

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by aggelos panagiotakis -
i am currently fixing problem issues of the cms plugin. I think all redirects work
fine now.
i found many broken links in the administrator side block and i fixed them.
i use the pid for the navigation and i removed the pagename from almost everywhere.
i also found problems in the administration and calendar blocks if cms pluing is displaying something. any ideas on how to fix them for from inside cms ? other wise the cms plugin will be badly maintained.
any ideas on how to fix the "student view" for the cms plugin, it forbids moodle to display the buttons corectly.
i changed the code to see if "student view" is off not to display the cms plugin editing icons.

i share my files for programmers to check them for better solutions.
thank you.
In reply to aggelos panagiotakis

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by aggelos panagiotakis -
ok now fixed the student view problem, and i also added a branch for not displaying page icons on editing mode.

i am now working on a new toolbar button for publishing or not the current page.
In reply to aggelos panagiotakis

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by Peter Birdsall -

Hello Aggelos

I'm afraid that after installing your fixes, the menus no longer show - they are a mess. Have tried also with other themes than ours. (See attatched jpg)

Attachment cms-bug-after-fix.jpg
In reply to Peter Birdsall

Re: CMS integrations: CMS PLUGIN: redirecting problems after editing resources and activities and how to solve them

by aggelos panagiotakis -
i will try to install the cms into a brand new moodle 1.6.3+
i did not untill now. i will tommorow. i am only giving files out for a developer to help understand what i did wrong or right. I am not suggesting to anyone to install it. i am just anxius to see cms plugin with better collab with the rest of moodle.
Notice that beacause of the file upload limit in this forum (100KB) i erased folders like cms\pix AND cms\db and cms\js (i dont remember anything else).
so download the original cms plugin then ovewrite the files included in that compressed file after extraction with the ones in my attachment.
thank you.


i used a different compression format in this one (find the programm for extracting here: http://prdownloads.sourceforge.net/sevenzip/7z442.exe?use_mirror=kent )