CMS integrations: Content Pages using Moodle 1.9

CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Number of replies: 55
Hey everyone,

Moodle is great for handling courses and testing, but it seems to lack in providing a simple front-page Content Management System. The only way to get "pages" is to create a course, type content into the first summary area, and hide all of the other topics. Messy to say the least.

My school has been using Moodle for over a year now, and we wanted to launch 1.9 with some added features, including support for pages that could easily be updated through the Moodle interface.

You can see an example at http://www.thomashaney.ca/page/1/.

This uses its own page type (defined in pagelib.php) and grabs data from a table in the database (mdl_page).

I want to make the code available for everyone, but I'm wondering what the best way to do so would be. It does involve editing a few lib files and the admin sidebar, as well as a new database table.
Should I zip the files up, provide a diff patch, or both?
評比平均分數:Useful (1)
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

A. T. Wyatt發表於
Greetings, Darryl!

I would say "both". As a potential user, I would welcome all the detail and instructions I could get! Once you get a few people to try it out and give you feedback, then you probably would want to upload the files to the modules and plugins database. You will be able to reference this discussion as part of your documentation.

atw
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Okay, so at this point, a little manual hacking will be required.

Enter the following SQL into your database to create a new table.

CREATE TABLE IF NOT EXISTS `mdl_page` (
`id` bigint(10) unsigned NOT NULL auto_increment,
`fullname` varchar(254) NOT NULL default '',
`shortname` varchar(100) NOT NULL default '',
`content` text,
`visible` tinyint(1) unsigned NOT NULL default '1',
`lang` varchar(30) NOT NULL default '',
`theme` varchar(50) NOT NULL default '',
`timecreated` bigint(10) unsigned NOT NULL default '0',
`timemodified` bigint(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `mdl_page_sho_ix` (`shortname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Central page table';

Add the following lines to /admin/settings/top.php. These are needed to create the link on the admin sidebar.

$ADMIN->add('root', new admin_category('pages', get_string('pages','admin')));
$ADMIN->add('pages', new admin_externalpage('pagemgmt', get_string('pagemgmt', 'admin'), "$CFG->wwwroot/page/index.php", 'moodle/course:update'));

The page.zip file contains folders which must be extracted to the root Moodle dir.

My instructions probably make no sense to anyone other than myself, so let me know if you have any questions. Ask either here, or send me an email. This was much more tied to Moodle's core on my production site, and I'm trying to make it easier to add as an extension. However, they may be lingering errors due to strings or roles. Please complain, and I'll get them fixed.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Okay. my first attempt at getting this released was pretty pathetic and full of errors and bugs.

I've got another version here that should work drag and drop into any existing 1.9 installation, and doesn't require any edits to existing files.

There is a file included (database.txt) that contains the SQL code to create the table.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Kath Teb發表於
Hi Darryl

This looks pretty interesting to me.

But I need some help to implement this. Can you please give some more instructions as to where these files need to go?

Thanks so much.

In reply to Kath Teb

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
When you download the .zip file, there are three folders (admin, lang, and page).

Go to your root Moodle directory (the folder that contains config.php).

Drag those 3 folders from the .zip file into that root folder. It should request to overwrite one file (admin/settings/courses.php) in order to add the links to the admin sidebar.

note: If you're on a Mac, you might have issues where it will overwrite the entire folder leaving you with a lot of missing files. I'm not sure what causes the issue, but you might need to move things manually.

Hopefully you have phpMyAdmin installed (or some other method of editing your database). Open the database.txt file and copy the SQL code into phpMyAdmin to create the necessary tables.

Visit http://<your moodle>/page/index.php to double check that everything worked. You should be able to add a page.

Let me know if you have any trouble 微笑
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

It looks like this thread has been 'dormant' for a while so I'm not sure if I'll get a response but...

Just wanted to check/confirm that this 'Content pages' modification is not compatible with 1.8? I gave it a try and couldn't get it to work and am thus assuming that it's not compatible but thought I'd check.

I know, the subject line says 1.9 微笑 but I was hopeful.

When I installed everything (including the database table) and then visit my site (and login as admin) I get a broken front page (i.e. only a minor portion of the front page is displayed - it appears to stop when it gets to the 'admin' block that should appear on the front page).

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Ah, I think I may see the problem. When I set this up for my school, I integrated it quite heavily into the Moodle core (special roles for adding and editing pages, permissions, editors, etc.). When I was making the release for the Moodle community, I have to strip most of those roles and replace them with their "course" equivalents. It seems that I missed one in the admin page, which still tries to react to the capability "moodle/page:update".

If you manually edit /admin/settings/course.php and replace page:update with course:update it should work. I was hoping that this feature might make it into the 2.0 release as a contribution so that the page capabilities and roles would be available.

If you have any issues, and I don't seem to be replying in a timely fashion, send me an email with a link to this thread. The Moodle forums (unfortunately) are not a site that I check routinely.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

Thanks but unfortunately the change didn't fix the problem. But again, I am trying to make it work in 1.8 so there may be other compatibility issues?

I am planning upgrade our production site to 1.9 soon and have verified that it works fine for us under 1.9 so making it work on 1.8 is not a crucial issue for us.

Thanks for the help and the e-mail.

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
I honestly have no idea if these will work on 1.8, they were only tested on 1.9.

Let me know if you have any other problems and I'll do my best to fix any remaining issues.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

Thanks again for the reply. I have finally managed to get upgraded to 1.9 and am using the Pages addon. I'm wondering if it is possible to tweak it so that no blocks appear on the pages that are created with this addon?

I'm trying to make the pages as clean as possible and have already removed the edited date and title from view.php for a slightly sleeker look. If I can turn off blocks too I'm thinking that might be even nicer. I haven't started picking at the code yet as I don't want to mess it up. Thought I'd check here first and see if I could get some advice 微笑

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
The easiest way would be to turn on editing and simply delete all of the default blocks. If you're creating a number of pages though, it's a bit tiresome.

In pagelib.php there's a setting somewhere in the file that contains an array of the default blocks on a newly created page. Easiest way to find it would be to search for the string "calendar". If you make the array empty, it shouldn't add blocks to newly created pages.

In theory, you could also disable the code where blocks are actually printed to the page, but that gets messy if you ever want a block on a specific page.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Wow! Thanks for the very speedy reply. 微笑

I went in pagelib.php and on line 155 changed:

$blocknames = 'admin_tree,site_news:login,messages,calendar_month';

to

$blocknames = '';

and that did the trick! Thanks! Now I can work on customizing the drop down menus in the college_blue theme and have some of them sent to some clean static pages created with the 'content pages' addon. big grin

Thanks again for your help.

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Kieran Bailey發表於
Hi, I hope that somebody can help me here. I am using the Pages add-on, but want to know how I can set it up to so it is only accessible to logged in users?
In reply to Kieran Bailey

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Currently there isn't a way to do that, but it should be easy enough to add a check in the view.php file that checks if the user is a guest and redirects them. Something along the lines of:

if(isguestuser()) {
redirect($CFG->wwwroot);
}

Another (probably more elegant) option would be to add a new moodle/page:view capability, and require that capability in order to view the page.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Kieran Bailey發表於
Thanks Darryl. I'll try out the first one.

How would I go about implementing the latter?
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

I just experienced a problem after upgrading from 1.9.3 to 1.9.4+ in which I could not turn editing on when viewing my course list when logged in as admin. (detailed explanation in another forum)

It took me some time to figure out that the cause lies somewhere in the courses.php file included in the Content Pages package. I overwrote the file with the one from the Moodle core and the problem was resolved.

I'd like to be able to continue to use the Content Pages feature so I thought I'd bring up the issue here and see if you were already aware of it...?

If so, maybe there is already a fix for this issue?

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

I thought I'd try and see if I could get things working and compared the two courses.php files and the only code in the one customized for the Content Pages modification (that I could see was)

$ADMIN->add('root', new admin_category('pages', get_string('pages','page')));
$ADMIN->add('pages', new admin_externalpage('pagemgmt', get_string('pagemgmt', 'page'), "$CFG->wwwroot/page/index.php", 'moodle/page:update'));

so I tried adding those two lines in roughly the same location as they were before but when I gave the file a try I didn't get anything. No errors but no "Pages" folder in the Site Admin block either....

Oh well it was worth a try.

I noticed that you are working with Anthony on getting this feature included for 2.0. Any plans on patching it for 1.9.4?

Jason

P.S. Strangely, I can edit the pages that I have already created but I cannot create new ones because when I try to access mysite/page/index.php I get a "Section Error!".
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Looks like a bit of shuffling happened in the courses.php file... you should be able to add those lines to top.php in the same folder and have access to everything.

Let me know if that doesn't work.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Thanks Anthony & Darryl,

I tried adding the two lines I mentioned above to the top.php file but that did not have any effect.

I looked through the contrib page that Anthony referenced and downloaded the diff file and picked out the two new lines (almost the same as the ones posted in my previous post) and tried them in the top.php file but had no luck there either. I'm not getting any errors from the front page but the "Pages" folder does not show up in the Site Admin block and if I try to navigate to mysite/pages/index.php I get and "Access denied" error.

Any ideas?

Jason

P.S. The diff file that Anthony referenced involves several core files. Is the information in that file for 2.0 compatibility? I only made changes to top.php.
評比平均分數:Useful (1)
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Anthony Borrow發表於
Core developers的相片 Plugin developers的相片 Testers的相片
Jason - Now that you mention it, I may have been testing the pages stuff with 2.0. Most of CONTRIB code I end up testing with 1.9 but I think you are right that the pages stuff may have been an exception. Peace - Anthony
In reply to Anthony Borrow

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Anthony and/or Darryl,

Any ideas on what it might take to get Pages to work with 1.9.4+ ?

As Darryl pointed out, it looks like some code has been shuffled around between a few files in the /admin/settings folder.

I don't know enough, unfortunately, to be able to start poking around extensively without breaking something 傷心

With a little direction I'm willing to test stuff and experiment though 微笑

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Anthony Borrow發表於
Core developers的相片 Plugin developers的相片 Testers的相片
Jason - The changes were many - mostly related to how database calls are made. I went through and updated everything and it should be functional. Check out CONTRIB-870 for the patch for Moodle 1.9 and let me know how that works for you. Peace - Anthony
In reply to Anthony Borrow

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Anthony,

Thank you very much for the personal communication via e-mail. I ended up taking the 'easy' route and installed the Pages block from the zipped file you posted in the tracker in CONTRIB-870.

The only issue for me was an error that the mdl_page table already exists. I dumped the contents of the table, renamed the table temporarily, and then initiated the install of the block again by clicking on the Notifications link in the Site Admin block. Then imported the dumped SQL file from my old mdl_pages table into the newly created table. Everything was in order with the pages I had previously created displayed correctly so I then deleted the 'old' renamed table.

Just wanted to outline the process for others like me that are 'lower' tech 微笑

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Hello all,

This is a brief explanation of a low tech method of how to get Pages up and running on 1.9.4+ using the package provided by Anthony. (link in previous post)

If you didn't already have the Pages 'extension' installed, you should be able to add the contents of the package provided by Anthony to your current instance of Moodle (overwrite the files that are already in your Moodle directory with those found in the package) and then visit your Moodle page and login as Admin. Click on the 'notifications' link in the Site Admin block and everything will be setup.

If you already had Pages installed please see my previous post.

The contents of the package should go in the directories indicated by their location(s) in the package and you won't need to reboot the server.

The contents of the package (and locations where they should be placed) provided by Anthony are as follows:

/admin/roles/tabs.php
/admin/settings/top.php
/blocks/page (the entire page directory should be placed in your blocks directory)
/lib/accesslib.php

The low tech way to do this is place the files 'manually' using ftp, cpannel, or whatever method you use to access your server. Once you have them all in the correct location then login as Admin as I mentioned above and click on 'notifications'.

Hope this helps a little.

Jason

P.S. The method I have described here is not the best way in terms of avoiding versioning issues but is a quick and easy way to get it done if you are not familiar with how to use the 'patch' command and need to get Pages up and running asap. (that was my case 微笑 I'll be familiarizing myself with how to use 'patch' now that I've got a little time to work with)
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Anthony Borrow發表於
Core developers的相片 Plugin developers的相片 Testers的相片
Jason - I am glad you were able to get things working. Yes, it does assumed a fresh install. Let me know if you run into any issues. I thought I tried most things (creating, editing, deleting) but there may be something I overlooked in patching it for 1.9. Peace - Anthony
In reply to Anthony Borrow

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Anthony,

I've been using the patch for a while now and have just run into what looks like an issue.

I am trying to assign roles to the pages but when I click on Assign Roles I just get a white page. Sorry, I haven't checked the error log on my server....I'll do that.

Just thought I'd throw this out real quick in case it was something that you may already be aware of.

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Anthony Borrow發表於
Core developers的相片 Plugin developers的相片 Testers的相片
Jason - Sorry for the delayed response. I was finishing off the semester and needed a chance to recreate the patch file since it was not cleanly being applied to the latest Moodle 1.9. I have confirmed the issue and have created CONTRIB-1303 which you can watch, comment and/or vote on. I'll let Daryl work on this but it looks like we need to provide a case for when the contextlevel is the page. Thanks for helping to test this code. Peace - Anthony
In reply to Anthony Borrow

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Anthony & Darryl,

Just posted this in the Tracker (Contrib-1303) as well but thought I'd throw it out here too.

I just upgraded to 1.9.5+ and now cannot use Pages at all 傷心 When I try to navigate to a page previously created....for example

http://www.nuelp.com/blocks/page/view.php?id=6

I get the following error

Error: get_context_instance() called with incorrect context level "CONTEXT_PAGE"

I tried adding the CONTEXT_PAGE case from the tabs.diff file but that didn't have any affect.

Any ideas? My site is a little handicapped now 傷心

Jason
In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Anthony & Darryl,

Sorry, I had a rather rocky upgrade (cvs didn't work) and thought I had restored everything from my www directory but apparently I managed to get the Page block all screwed up. I reinstalled everything and it works fine now.

Sorry again for the false alarm.

Jason
In reply to Anthony Borrow

Re: CMS integrations: Content Pages using Moodle 1.9

Eduardo Rodrigues發表於

Hello Antony,

  I have installed recently page block (by installing the moodle195-pages.zip) on 1.9.5+ and it works well ... until I have tried to do the same as Jason did:

  - Tried to assign some roles to a page.

  On my case the behaviour is different because it is coorectly evoqued the admin/roles/assign.php and appears the assign role page but with 0 Potential users to assign.

  Can you help me to understand whts happening and potentially correct it ?

Thanks in advance!

In reply to Eduardo Rodrigues

Re: CMS integrations: Content Pages using Moodle 1.9

Eduardo Rodrigues發表於
Anthony & Darryl,

   I am replyng myself here in order to inform that I had detected (and fixed .. at least I believe so 眨眼) a small BUG on the lib/accesslib.php patch file as follows:
  • As previously informed when I tried to assign roles on any page, I detected the "0 Potential users";
  • And when I tried to "override roles", it gave me the error:
    • "You have an error in your SQL syntax ..."
    • This error was on 3671 line of accesslib.php, on fetch_context_capabilities() function because the SQL string created under CONTEXT_PAGE was:
      • SELECT * FROM {capabilities} WHERE ...
    • So, I realized, that the bug was dure to the lack of the prefix "mdl_", and the correct SQL string should be:
      • SELECT * FROM mdl_capabilities WHERE ...
  • As result of this debugging analysis results, and in order to Fix the detected BUG, I have changed the /lib/accesslib.php file, as follows on the line 3604:

case CONTEXT_PAGE: // course context and bellow
    $SQL = "SELECT *
                FROM {$CFG->prefix}capabilities
                WHERE contextlevel IN (".CONTEXT_BLOCK.",".CONTEXT_PAGE.")";
    //
    // XXX - BUG FIX 11Jan2010
    // THE original patch following lines have a small bug ...
    // $SQL = "SELECT *
    //          FROM {capabilities}
    //         WHERE contextlevel IN (".CONTEXT_PAGE.",".CONTEXT_BLOCK.")";
    break;

   I have also changed the positions of CONTEXT_PAGE and CONTEXT_BLOCK., in order to appear (80, 90) and not (90, 80), but I don't know it it is really necessary ...

  Could you test it and add it to the HEAD version in order to be present on the next version of this excellent patch ?

I hope that it helps to improve this excellent Content Pages Block 

In reply to Eduardo Rodrigues

Re: CMS integrations: Content Pages using Moodle 1.9

Eduardo Rodrigues發表於
Anthony & Darryl,

  Doing a deeper accesslib.php check on the SQL FROM clauses building searching for possible missing of {$CFG->prefix}, I noted the following lines:
   page line    Existing code                       Possible correction needed ?
  2386          INSERT INTO {context}          INSERT INTO {$CFG->prefix}context
  2388          FROM {page} p                     FROM {$CFG->prefix}page p
  2390          FROM {context} cx                FROM {$CFG->prefix}context cx
  2447          FROM {context}                    FROM {$CFG->prefix}context
  Could you check it, please ?
In reply to Eduardo Rodrigues

Re: CMS integrations: Content Pages using Moodle 1.9

Anthony Borrow發表於
Core developers的相片 Plugin developers的相片 Testers的相片
Eduardo - Thanks for sharing your experiences with the page block patch. The best way to get your suggested changes reviewed and checked in is to file an issue in the Moodle tracker (http://tracker.moodle.org) which if you have not already used, will require that you create an account. The tracker what we use to report bugs, make feature requests, etc. For those coding, it serves as a bit of a to do list. The project will be CONTRIB and the component will be Patch: Page block. Feel free to copy the URL to this forum discussion into the tracker issue so that Darryl can refer to it if needed. If you have any questions or need any help just let me know. Peace - Anthony
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Richard Dykes發表於

Darryl,

I got the following error when I copied the files from page.zip from your contribution on this page.  There is no "update" page in the page folder.

I've copied the full error message below.

regards,
Richard mixed

PHP Notice: Capability "moodle/page:update" was not found! This should be fixed in code.

  • line 382 of lib\accesslib.php: call to debugging()
  • line 32 of page\index.php: call to has_capability()
in C:\Inetpub\wwwroot\moodle\lib\weblib.php on line 6939 PHP Notice: Stack trace:
  • line 5772 of lib\weblib.php: call to debugging()
  • line 4248 of lib\adminlib.php: call to print_error()
  • line 50 of page\index.php: call to admin_externalpage_setup()
in C:\Inetpub\wwwroot\moodle\lib\weblib.php on line 6939
In reply to Richard Dykes

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Hi Richard,

The patches provided by the .zip files in this thread are outdated, this has been implemented as a patch in Moodle contrib for the latest version of Moodle (1.9.5).

You should download the patch file from http://cvs.moodle.org/contrib/patches/block_page/block_page.patch?revision=1.1.2.4&view=markup and (on linux) use the patch -p1 command from the root of your Moodle installation.

Make sure that you get rid of the files from the .zip folder first (everything in the pages folder of your Moodle installation). If you have a mdl_pages database table, you will need to delete that in order for the patch to install properly.

I'll be gone for a week, but please report any issues in the Moodle Tracker.

~Darryl

PS - Is there a way to remove the attachments from those earlier posts to prevent future confusion?
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

James Simpson發表於

Hi Darryl,

I can't use CVS with my server, would it be possible to release the latest version as a ZIP package?

Cheers,

James

In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Richard Dykes發表於

Darryl,

Thanks for getting back to me.  Forgive my complete ignorance, but I'm not sure what to do with this patch.  What do I do once I follow the link you provided?

regards,
richard

In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
For James, I've packaged up a zip file containing only the changed files for Moodle 1.9.5(+).
This might work for Richard as well.

Simply extract the files into the root of your Moodle installation, it should ask to overwrite 3 files.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Richard Dykes發表於

Darryl,

Thanks for that.  I've unzipped your file, and copied across the new files.  Where to from there?  Should this appear as a new type of block, or do I change the page settings?

Also ... do I need to re-create the mdl_pages table in the database.  I previously deleted this.

regards,
Richard

In reply to Richard Dykes

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Open the notifications page on the admin sidebar and it should install (including creation of the database table.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

We have been enjoying the Content Pages 'hack' (block) now for some time and I just ran into a little hitch that I'm wondering how to work around.

I tried to embed (link to) a Flash movie but for some reason the multimedia plugin in Moodle is not identifying it in the Page. I can do the same thing in a News post, forums etc. and the movie is displayed correctly but it's not working on a page created with the Content Pages addition. I'm assuming that the Moodle core multimedia plugin isn't called but not sure if that's a correct assumption...or even if I'm wording it correctly.

Any help would be appreciated. We'd like to add some more flashy (excuse the pun) content in the pages we've created. 微笑

Jason
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Eduardo Rodrigues發表於

Hello, I’m quite new to Moodle and are very interested on this block!

   I'm using Moodle 1.9.5+ and I will try this block on it.

   So, looking into the zip contents I detected one thing that I believe that could be a bug:

On line 57 of file tabs.php, there is:

$navlinks[] = array('name' => get_string('roles'), 'link' => "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=$context->id", 'type' => 'misc');

The second "$CFG->" is correct ?

I whish to you, Darryl and all, a very good yr 2010!

In reply to Eduardo Rodrigues

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Yes, the second $CFG-> is correct.

$CFG->admin stores the string 'admin' in a normal installation, but I suppose there might be times when the admin directory is elsewhere. It's safest to use $CFG->admin rather than hardcoding the value.

微笑
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Eduardo Rodrigues發表於

Thanks Darryl, for your prompt feedback, which shows how newbie I am smile concerning moodle programming!

 I have also some doubts concernig the CONTEXT_GROUP:

  • Why it is removed (from $CFG/admin/roles/tabs.php, $CFG/lib/accesslib.php, as example) on the implementation of this block al the referrences to CONTEXT_GROUP ?
  • What could be the implications of this removings on the overall Moodle?

  Many thanks in advance for any replies it

In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

You helped me, some time back, to change a setting that removes all blocks from pages created by the Content Pages block. For some reason though, with a newer version of Moodle and changes that have taken place since then, I have blocks on my pages (messages and the calendar) that I want to remove. Do you have any idea how I might go about getting these to disappear?

I went back and checked the setting that you pointed me to before:

$blocknames = 'admin_tree,site_news:login,messages,calendar_month';

to

$blocknames = '';

but it no longer successfully removes the blocks.

Thanks in advance for any help you can provide.

Jason


In reply to Jason Hollowell

Re: CMS integrations: Content Pages using Moodle 1.9

Darryl Pogue發表於
Do you want to entirely prevent blocks from showing on any pages?


Look in block/page/view.php for

if (blocks_have_content(...)...) {
...
}

and remove (or comment out) those two sections to stop blocks from being printed out.
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於
Darryl,

Thanks so much for the reply. I guess I was close but since I'm still a novice when it comes to php, it was right in front of me and I didn't even realize it.

I just commented out the entire 'right column' portion as follows:

// The right column
//if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing || $PAGE->user_allowed_editing()) {
// echo '<td id="right-column">';
// print_container_start();
// blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
// print_container_end();
// echo '</td>';
// }
// break;

I don't think this is going to cause any issues for us. We are using the Content Pages block to add content to our front page and don't want the blocks to appear just for cleanliness purposes. Also, I've noticed on some older browsers that the appearance of the blocks causes the formatting to be very strange. I know, we should upgrade our browsers but the tech office is slow at getting things done unless there is a BIG problem. 傷心

On a different note, I noticed a while back that mp3 files, flv files, etc. embedded into one of the pages made by the Content Pages block do not get interpreted by Moodle's multimedia plugin. Is this by design, something that was missed, or something that would be difficult to accomplish?

Thanks again for your help.

Jason
In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Jason Hollowell發表於

Darryl,

I notice that it has been some time since there was any activity here so I suspect that maintenance of this block has been ceased but I wanted to ask anyway, are there any plans to upgrade this for Moodle 2.X? I am now solidly in Moodle 2, as I'm sure are more and more users, but don't see this functionality in the new version of Moodle 傷心  Maybe this is already compatible with Moodle 2 and I just haven't realized it...?

Jason

In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Eduardo Rodrigues發表於

Darryl,

   This is to report a small bug on index.php, line 53:

   The variable $site need to be corrected to uppercase $SITE.

Hope that it helps.

Eduardo

In reply to Darryl Pogue

Re: Content Pages HTTP 500 - Internal Server Error

Ben Botfield發表於

Hello, I’m quite new to Moodle and would appreciate some help!

I’ve installed Contents Page as per ftp drag and drop instruction posted above, I clicked on notifications, click on continue and got the message that Content Page had been successfully installed – On accessing Contents Page from the Admin menu when the page loads (moodle/blocks/page/index.php) I get a HTTP 500 internal server error – can anyone please help?

I’m using Moodle 1.9.2

Thanks

In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Grant Brott發表於
I installed this as stated but when I click on add/edit pages it tells me Access Denied and then the reason is:

This error is encountered if you do not have admin privileges or if you are not logged in. This means that you are not authorized to enter such an area or run such scripts.

But I am logged in as the administrator and just did this installation with moodle 1.9.5 so am totally lost on the cause for this. Any help?


In reply to Darryl Pogue

Re: CMS integrations: Content Pages using Moodle 1.9

Gufy Daze發表於
This is a very good modules... Infact this features should be built in core, as page creation is an essential/important part. It will be great to include this kind of simple CMS features in future release of Moodle. You people are doing a great job, keep up the good! Thanks.