Conditional activities: Latest Activity Locking Release

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Number of replies: 15
Hi Chardelle

1. I've probably made some silly mistake in the code.

2. It was never an option to show activity completion after an activity. The two options were
  • Show activity completion before each activity
  • Show prerequisites after a locked activity
These haven't changed, except you can now select the option for each activity.
I take your point about them going out of line if you choose to show the box on some but not on others. Like you say, I think the best option is to print a spacer image.

3. These give more flexibility over how locked/complete activities are displayed. Up until now, a locked activity used the "dimmed" css class. This option now allows you to use a different css class for locked or completed activities. This allows you to display locked items differently to other screen elements using the "dimmed" css class.

The attached file should fix points 1 & 2.

I'm considering doing a full re-write of activity locking. The code is starting to get a bit ugly. I suppose it's all down to time.
In reply to Stuart Mayor

Ang: Re: Latest Activity Locking Release

by Jens Gammelgaard -
Picture of Translators

Hi Stuart,

Well, you can count on me in respect of testing your new following releases.

And I am sure you can count on the others too.

We are very happy that you take your time to this project.

Kind Regards

Jens

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Chardelle Busch -
Picture of Core developers
FANTASTIC Stuart,

The locked and hidden now works and the spacer is in place!!!

It never occured to me that the styles were actually css styles blush.

Love it--great workkiss
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Roel Cantada -
Hi Stuart,

I installed the above rar file on a Moodle 1.5.2+, version 2005060223 running on a LAMP server.  PHP debugging is set to high. I just want to share the result.  Are those notices in the attached screenshot normal?

And is it possible to ask for patches instead of fully patched files for files that are to be overwritten?  It seems that there are differences in this versions file like moodlelib.php from the one you hacked.

I'm new to this feature but I think it would be great to use.

Roel
Attachment editon.png
In reply to Roel Cantada

Re: Conditional activities: Latest Activity Locking Release

by Nicholas Stevens -

Hi Roel:

I'm getting the exact same 2 errors you are: undefined variables activitycomplete and unlock in the  ../course/lib.php file.  I don't understand enough about PHP and the Moodle architecture yet to figure it out. 

For example, during my activity_locking installation, I got a new ../moodle/course/lib.php file, but I did not get new lib.php files for the mod subdirectories (e.g., ../moodle/mod/assignment/lib.php).   These lib.php files in the mod subdirectories don't refer to activitylocking or unlock variables.  Is this right?  I don't know. 

Anyway,  if I find a solution I'll let you know; you do the same.  Thanks.

In reply to Nicholas Stevens

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
That is correct. Activity locking uses a replacement course/lib.php but does not need to change anything in the mod folder.

Just fyi, files in the mod folders link in to activity locking using a modified "require_login" function.
In reply to Roel Cantada

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Yes. Those notices are normal. They are a result of my sloppy programming.

The next release I'm working on will be much neater, with hopefully no notices. So far, features have been added mainly with quick-and-dirty methods, resulting in those nasty errors.

They will, of course, disappear if you turn debugging off.

If you could recommend how I create/modify/install patch files within a windows installation I would be more then happy to create some. As you say, it would be a much neater way of distribution.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Nicholas Stevens -

Thanks Stuart.   I didn't realize I could safely ignore these 2 error messages. (undefined variables activitycomplete and unlock).  Once I do that, I see that AL does in fact work on my install.  I've turned debug off and moved on.

As for your comment If you could recommend how I create/modify/install patch files within a windows installation, I don't think I have a windows installation.  My moodle host runs linux. My PC runs Windows XP.  I had to unzip the AL files (from the .rar)  on my PC b/c I don't know how to unpack a .rar file using linux commands. 

Anyway, the only suggestion I can make about the AL install process is to include a README in the .rar that talks about the common errors, like the two I've made (so far):

  • It is OK to ignore the 2 undefined variable messages.
  • Create the new activity_locking directory only below your existing blocks directory, not above it as well, even though the results of the AL .rar unpack process (creates the directory hierarchy activity_locking\blocks\activity_locking) might suggest this to you.

Great work and thanks a lot. 

In reply to Nicholas Stevens

Re: Conditional activities: Latest Activity Locking Release

by Roel Cantada -

To unpack a rar file in your linux box, see to it that you have the unrar package installed.  Then type the following on a console. 

unrar x filename.rar

Heres a link to additional info on unrar.  But if your using KDE or GNOME desktop to work with your  linux box I don't know if there is a GUI interface to rar/unrar.

The following links may help regarding creating patch files on windows:

diff/patch port to native Win32

Unfortunately I have not tested this port to Windows, but I have used something similar to it.  I open a DOS box and go to where the port is installed then type linux commands like those below.  I just don't know whether they also changed the sytax for directories, in the ports of Linux utilities I have used I was able to use forward slashes to refer to directories instead of backslashes in DOS.

How to create and use a patch in Linux

Roel

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Roel Cantada -

Finally had the time to remove debug and test it as a student.  Its works sang-ayon. Can't wait to try it in actual teaching.

Thanks for the contrib Stuart.

Roel

In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Dan Hilke -

Is this the latest version? (activity_locking_2005101901.rar)

I tried to download and install this but it's only a 94k file, and while cPanel says it can unpack it, nothing seems to happen...  Am I missing something?

Is there a zip file??  And are there any installation instructions?

Thanks for any help,

Dan

In reply to Dan Hilke

Re: Conditional activities: Latest Activity Locking Release

by Chardelle Busch -
Picture of Core developers
Hi Dan,

I haven't unpacked anything with cPanel for a long time, but if I remember correctly, I think it prefers .tar files (zip files will work, but cPanel does funny things to permissions while unpacking a zip). So, if you want to unpack things directly to the cPanel file manager, you might have to re-package the file as a tar. I use a program called 7Zip that I got from Sourceforge.

As for installation--you simply add the files and folders to their corresponding folders in your Moodle install. Most of the files are new, a few contain changes to existing Moodle files.  After everything has been added, you need to click on the Admin link from your site homepage to install the new data tables.
In reply to Chardelle Busch

Re: Conditional activities: Latest Activity Locking Release

by Dan Hilke -

I'm just now getting the chance to actually do the install, and as I go to "Admin" for the first time after unpacking the files in the \blocks directory, I get the following warning: 

Warning: file(/home/.../public_html/blocks/activity_locking/block_activity_locking.php): failed to open stream: No such file or directory in /home/.../public_html/lib/blocklib.php on line 21

In reply to Dan Hilke

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Apologies for using rar as a compressed file format.
It is slightly more efficient than a zip file, which would be slightly larger than 100kb and hence I wouldn't be able to upload it to this forum.

I do try and keep it updated on CVS but I've has firewall issues here recently and not been able to connect.
In reply to Stuart Mayor

Re: Conditional activities: Latest Activity Locking Release

by Bill Weinheimer -

Hi Stuart,

I'm wondering if your rewrite timetable is soon enough for me to forego another attempt to install the last version and wait for your next release?  I've tried to reinstall the block after a deletion due to not having things function correctly.  What now happens on visiting the /admin page is a page full of

Error

Error

Error

Error

Error

Error

Error

Error

followd by database tables were not created successfully, then the Continue button.

I'm fairly new at customizing Moodle, but I have gotten the certificate module to work.

Any assistance is welcome.

Thanks,

Bill Weinheimer

In reply to Bill Weinheimer

Re: Conditional activities: Latest Activity Locking Release

by Stuart Mayor -
Don't worry. If you try and install activity locking twice you will get those error messages.

What is happening is that Moodle is trying to create a number of fields and tables that already exist. It should still work.

The next release won't be for a while - I've got 'real' work to do at the moment tongueout.