I place these files in course/format/weeks
and add a link to layout.php in course/format/weeks/format.php
that shows up when editing.
Something like below (line 67 or there about)
Change:
/// Start main column
echo '<td id="middle-column">';
print_heading_block(get_string('weeklyoutline'), 'outline');
To:
/// Start main column
echo '<td id="middle-column">'
$extra = '';
if (isediting($course->id)) {
$extra = ' <a title="Rearange layout"
href="layout.php?id='.$course->id.'">Layout</a>';
}
print_heading_block(get_string('weeklyoutline').$extra, 'outline');
Place this file in the same directory as layout.php
A small error in code of layout.php
On line 556 it should read:
print ' <form name="myform" id="myform" method=post action="'.$CFG->wwwroot.'/course/format/weeks/layout.php?id='.$id.'">
There are also two images missing (trash and calender). Can you post these images as well?
Lastly, it would be a good idea to seperate the CSS into a seperate file to allow for users to customize their own styles relevant to their sites.
Thanks
I have repackaged the file created by Audun Hauge to make installation a little easier. I hope I have not offended Audun by doing so as he is onto a great idea here.
Installation instructions are included as well as a couple of small code fixes. The CSS has also been extracted to allow for modification by those wishing to do so.
The editor has now been packaged in such a way that it now sits independant of any particular course format allowing for application to one or multiple formats as dictated by the need of the moodle installation.
A demonstration of this function has been placed in the Playpen. You can login as teacher:teacher to see this in action.
I've let this thing slip a bit, and just posted the code as is with no review. It has been working nicely for my teachers so the motivation for improving it has been lacking.
I see that quite a few things could be improved ... the list of external recources placed below unused blocks gets pushed too far down the screen (at least when you have as many sideblocks installed as Julian).
Hi Julian,
Your Playpen was great.
Can you advise where I can dounload the Kubrick Theme.
I love the way the blocks appear.
Thanks
Garry
By the way, I haven't been able to figure out how to test Audun's layout editor. I got in your Playpen and I turned editing on but I didn't see any obvious way to test this new functionality.
Josep M.
Firstly, yes it is a Kubrick theme variation.
Secondly, I have set up a course to edit in Course Layouts>>Course Layout Editor.
Once in log in as a teacher and turn editing on. Up the top you will now have a text link called "Rearrange Layout". Clicking on this will activate the feature.
Suggestions
A couple of suggestions to make the function a little easier to use would include:
- Breaking the screen up into a table to visualy create different editing spaces. Especialy on the right side. A breakdown of blocks and activities into two distinct sections would make things easier
- Having activities list their name when sitting on the right hand staging area.
- The text link is lost in the layout. Creating a graphical button for this would make it stand out a little more.
When I hit save changes I am taken to a page not found on your college site. Is it just me?
No I was also taken to a non existing page.
And yes, I would also like to express my gratitude for a nice block and a very good looking testing area.
Julian,
Thanks for the link to your Playground. Looks great, and a great place to try some modules I've downloaded but haven't unzipped and added yet (and some I have). So, a few questions:
- When I tried your copy of the layout editor I could only drop a selected activity to the bottom of the list in the topic, no matter where I placed it. Is that correct, or should I be able to drop it between two activities? How close it it to being usable on a (small) production site?
- Where do I get the version with the bug fixed? Or was that a site implementation error rather than a bug in the code?
- You have Zig's Exam/Homework module. Is it fairly robust? I have not seen anything since the initial "Don't use on a production site" version. But my school is mostly off-line activities, so I would be interested to know if anyone has tested it further and feels it's ready to use for real.
- I had thought checked boxes (in front) in Activity Locking only mark previous viewing or completion with required grade. It hasn't appeared to me that you are prevented from entering the activity again, did I miss a setting somewhere?
Thanks for setting up such a great try-it-and-see site! And thanks Audun for a "must have" addition to Moodle!
Jim.
P.S. I kind of miss Mike W, but I guess it's just as well -- I've come to associate the character with the Moodler and I expect Julian would rather I didn't begin imagining he supports his Moodle habit by acting on the side for Pixar.
I'm using it for my school, teachers use it to update and rearange section order when
importing old courses. Seems stable - but then this is on the site where I developed it.
80 teachers with around 300 courses.
I have a question, is it possible or could it be possible with little additional work to make copies of activities, resources and labels besides moving them around?
Josep M.
$sql = 'SELECT r.id,r.name,c.shortname
FROM '.$CFG->prefix. $thismod->name . ' r
,'.$CFG->prefix.'course c
WHERE r.course = c.id and r.course != '.$course->id.'
AND ( INSTR(r.name,"[PUBLIC_COPY]")
OR r.course IN ('.$mycourseidlist.') ) ORDER BY c.shortname';
Remove the text in red.
Then mods/resources from the course you are editing will show
up in the list of external resources.
If you instead change != to = you will only get resources from the course you are editing.
Sorry if I sound like an ignorant (which is what I am in this domain), but was your message an answer to my question? I mean, making the changes you suggest would allow one to copy labels and resources in addition to moving them?
Josep M.
Without these changes you can copy in resources/mods from other courses.
With the changes - the list of resources/mods you can copy from will
include resources/mods found in the course you are editing.
This could of course be achieved by using the standard ctrl+drag for copying
that users are accustomed to from other GUIs, but this would be a bit more code ...
Josep M.
Hello Audun,
I installed the layout editor and when I clicked on the layout link I get a set of error messages as follows:
Notice: Use of undefined constant gregoriantojd - assumed 'gregoriantojd' in C:\websites\moodle\course\layout\locallib.php on line 6
Notice: Undefined variable: nodragmoduledivs in C:\websites\moodle\course\layout\layout.php on line 364
Warning: array_merge() [function.array-merge]: Argument #4 is not an array in C:\websites\moodle\course\layout\layout.php on line 364
Warning: implode() [function.implode]: Bad arguments. in C:\websites\moodle\course\layout\layout.php on line 365
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 366
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 366
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 366
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 367
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 367
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 367
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 367
Any idea!!
Fawaz
The messages you see are warnings about possibly unsafe code.
In my code I test if 'gregoriantojd' is defined. If it is not defined I
include a definition (some sites haven't got this function loaded).
These warning messages can be turned off if you insert a @ before expressions
that cause them. Edit locallib.php and change line 6 from
if (!function_exists(gregoriantojd)) {
to
if (@!function_exists(gregoriantojd)) {
Edit layout.php and change line ~367 from
$leftlist = implode(',',$leftlist);
$rightlist = implode(',',$rightlist);
$modlist = implode(',',$moduledivs);
to
$leftlist = @implode(',',$leftlist);
$rightlist = @implode(',',$rightlist);
$modlist = @implode(',',$moduledivs);
This should remove the warnings
audun
Notice: Use of undefined constant gregoriantojd - assumed
'gregoriantojd' in C:\websites\moodle\course\layout\locallib.php on
line 6
This happens because the string "gregoriantojd" is not in quotes. Put single quotes around it and the warning goes.
Notice: Undefined variable: nodragmoduledivs in
C:\websites\moodle\course\layout\layout.php on line 364
I haven't looked at the code, but this sounds like a variable being used before being initialized. Solution: initialize the variable, e.g. if it's a string $nodragmoduledivs = '';
Warning:
array_merge() [function.array-merge]: Argument #4 is not an array in
C:\websites\moodle\course\layout\layout.php on line 364
This sounds more serious, as it is not a notice but a warning.
Warning: implode() [function.implode]: Bad arguments. in C:\websites\moodle\course\layout\layout.php on line 365
Same as above.
Notice: Object of class stdClass to string conversion in C:\websites\moodle\course\layout\layout.php on line 366
This sounds like it will cause a problem. PHP does not complain when it implicitly converts e.g. strings to integers or the reverse, but the string representation of an object is IIRC "Object", which has no meaning at all. Therefore if this happens it indicates either a bug or an operation which is not needed, and that's why PHP brings it to our attention.The errors on line 364 where as you say caused by nodragmoduledivs being uninitialized. Being unset it was also not an array -- yah.
(hadn't tested on course with no summary for any section).
The next errors are caused by me not checking for changes in block-lib ,
a function that used to return array of string, now returns array of objects.
The code was deadwood anyway, should have been removed ...
(the result of merging the objects as strings was never used)
I think I'll keep debug on from now on
Decided against Ctrl + Click as this brings up a context menu on mac.
Shift+Click a mod and a copy is added to the section. The copy can
be moved (or deleted) as original mods.
I'm not sure that sections should have the same behaviour, does anyone need to duplicate a whole section with all mods ?
I see your original zip file and Julian's repackaging of it, but where do I look for this updated version (with various bug fixes)?
Thanks, Jim.
Fixing bugs and adding shift+click copying (mods and sections).
I`ll post a new zip (bugfixes + new features + separate css) this weekend.
Hi Audun,
Yhe module is great.
I am confused where the change in th Ssql ....
is to be done shall be grateful for your help.
Thanks once again
Garry
Audun, can you please explain what these icons are on the bottom right and how to handle these?
The select is like this:
$sql = 'SELECT r.id,r.name,c.shortname
FROM '.$CFG->prefix. $thismod->name . ' r
,'.$CFG->prefix.'course c
WHERE r.course = c.id and r.course != '.$course->id.'
AND ( INSTR(r.name,"[PUBLIC_COPY]")
OR r.course IN ('.$mycourseidlist.') ) ORDER BY c.shortname';
Thus any course where you are a teacher or any course with [PUBLIC_COPY] in
the name will yield a list of modules.
Each icon contains a list of external resources. To avoid a too heavy
javascript load on loading the page I only show four (max) draggable
divs for each mod-type.
The rest are available thru the drop down list. Selecting an item from the list will
take over the topmost draggable div and update it with the selected item.
This means you'll have to reload the page to copy in more than four items of
the same type (like 5 forums). This doesn't seem unreasonable ....
The icons have the following behavior:
Click once --> move to the left and expand list of available mods
Click again --> collapse and move back to orig pos.
( the code allows you to open more than one on top of each other ... )
You can drag a mod from a list and drop onto a section.
A shallow copy will be made (only top level tabel, no files etc).
--- exception ---
lesson is copied in full
You can delete a mod by dropping it on the thrash can.
You can update startdate/starttime by moving a mod to a week and
clicking on the calendar. Click on day/h/m as needed. Click on any timed
mod and they should go all pink (mouseover will show new time).
While in calendar mode you can not move mods/sections.
Click on calendar again to revert to normal mode.
The date is taken from the week you place the mod in + calendar selection.
All of this is a hack that needs some reworking. Espesially the interface
could do with some usability reworking. I just haven't had time ...
A great module Audun.
Can you advise wher the above changes are to be made??
Garry
When I use this editor for my UTF-8 course (I'm using ja_utf8), I see all module names are (maybe) urlendode'd like the attached screenshot. Section titles don't have such a problem. How can I fix this problem?
Thanks.
Hiroto
$modname = substr($m->name,0,10);
to
$modname = urldecode($m->name);
$modname = format_string($modname, true, $course->id);
This is the same code as used in course/lib.php
This version allows duplication of mods (activities) by Shift+Click.
Also you can choose to show unused sideblocks or available resources for copying. (less cluttered display). You can now insert new sections by Shift+Clicking on a section. Bug in copying of lessons fixed.
Hi Auden,
I may have missed out.
Can you advise where are the installation /readme file for installation.
I had a look in the folder that you have uploaded I was not there.
Thanks
Garry
This version expects to be installed into a course/format/xxx directory.
Install into format/weeks or a copy of this directory.
Unzip the layout.zip - the README will tell you the rest.
The animations for sections that drop to the end or float up to the
top are improved. I think these animations are neccessary as the user
needs some feedback telling what happens when a section is dropped
on the left or right side. Without animation the section just disappears and
the user might not notice that it has moved to the top/bottom.
I was unable to run the application after placing the file / folder.
I must be doing something terribly wrong??
Any suggestions
Garry
If you followed the instructions you should be able to choose a new format for the course, unless you made the change to weeks format.
Anyway, check that you have chosen the new format and turn on editing.
You should now see a new link named Rearange Layout (go over to julians playpen to see how it looks, see link above).
If the link shows, check the adress - it should be something like
http://playpen.monte.nsw.edu.au/course/xxx/layout.php?id=23
where xxx is the format you made the changes to, or weeks if you edited that.
If you have checked all the above -
do you get an error when clicking the link?
Give some feedback on this and I think we should be able to get this thing afloat.
I went back to Julian's playpen and I saw the label you had created ('This is a label (by audun)'). As you might notice, I was able to move it (now it is in the first block). That is, I was able to visualize it and move it by clicking the link 'rearange layout' without any problem (great!).
However, I'm still unable to visualize the label I created, the one that says 'This is a label'. You can check that yourself and probably find out that you cannot visualize it, either. What I'm noticing, though, is that I introduced some little "extra" formatting to the label I created (I centered it or indented it). Perhaps this is what's causing the problem, the reason why it is not visible in the 'rearange layout' mode?
Josep M.
The version in Julians playpen hasn't been updated ....
Josep M.
Hi Audun,
I have been able to get it going.
One small point the movement of items are in an up and down manner. Is is possible to move them between blocks that is in the weekl format.
Is there any way to move a block. It moves between the outer two columns and does not move into the central column. The BLOCKS also move up and down in the column in which they are placed..
Garry
Sideblocks can not be placed on the central column. The central column is only for activities. Sideblocks must be either on the right or on the left. There is an extra pile of unused sideblocks at the far right. These can be dragged and dropped on either the left or right side. Sideblocks can be arranged by dragging a block to the desired position and letting go. The other blocks will shift out of the way.
At the top (above the save changes button) there is a drop-down where you can select to show either unused sideblocks (default) or external resources.
The list of external resources is taken from courses where you are a teacher.
The icon used shows the type. Clicking on this icon (perhaps twice the first time) will expand a list of elements that can be copied into your course.
Thanks Audun,
Shall relook and get back to you.
Garry
Hi Audun,
I am not getting the layout editor Any suggestions.
Garry
Hi Audun,
What does the link for layout Editor look like.
When I turn editing on I get no additional link.
Garry
Now, I wonder whether it would be possible to be able to duplicate 'labels' as well as activities. I find myself having to create multiple labels (for instance 'Exercises for Week 1', 'Exercises for Week 2'... up to 10 weeks). Doing this in the way you have to do it now is a bit of a pain. It would be nice if you could just copy and paste labels as well as activities. Is this technically very difficult to implement? I would have thought that copying activities would be much more of a problem.
Josep M.
Section summaries can't be copied or dragged.
I tried this in Julian's playpen and the labels don't appear in the layout editor.
I created a label that says "This is a label" in the 25 September - 1 October week block and when you click the "rearange layout" link it doesn't appear among the activities listed there.
Josep M.
Worked OK. Not sure why it didn´t work for you.
Can you move other mods?
Julians version doesn´t have the code for duplicating mods - it´s really neat
Superb. Thank you very much indeed Audun,
Some very minor niggles...
1) On line 24 of the help file there is
To:
/// Start main column
echo '(td id="middle-column")';
which is missing the semi-colon in red. I have replaced the greater than and less than with brackets.
2) my utf-ja and the playpen are being shown (in IE) bunched up at the top
with the drop down menu overlapping the return to course link.
3) In ja_utf8 I have to reset the encoding to utf8 before it works. Perhaps other moodle pages put a meta tag into themselves to remind the browser of the encoding. Hence perhaps it would be better to include the header in the layout page? That should take care of it.
4) Stuff put in the trash can overlaps the list of blocks on both sides.
5) Often I want to move things beyond the end of the screen. This does not seem to be possible. It would be nice if the wheel of the mouse worked even when dragging.
I very much look forward to the time when this comes as standard.
Timothy
With regard to (2) above I think that the problem was that my stylesheet (which seems to be being called) was adding a margin at the top, so that the "return to course" and drop down menu and help button were being pushed down to overlap with the blocks and save button.
If the "return to course" drop down menu, and help button are put in a div with an absolute setting then this pushes them to the top of the screen again so they do not overlap.
I think that this div and the div for the submit button should go in the stylesheet, which is where I have put them.
I also think that the main layout area should be put in a div wrapper with a top margin rather than usig top$ = 40; or top$ =70; in layout.php
The version that I have going is attached.
You can move the trash before dropping stuff into it. Clicking on the can will also minimize the contents.
You should be able to drag things beyond the screen. All mods and sections have the property SCROLL set. If you drag a mod towards the edge of the screen the window should scroll automagically.
I'll have a look at including the header (think I did once, but took it away as it added a bit more stuff than I wanted).
Thank you Audun,
Yes, sorry, I realise now that while the scroll wheel does not work, putting things near the edge of the screen gets it to scroll dow.
I did not know that the trash can can be moved.
I am not sure about the header. I added it but I would have to have moved
everything down the page, and it takes up a lot of real estate. I wonder if there is a way of just including the character set meta tag. Anyway this is only a problem for a minority of users, and changing the encoding manually worked.
This is going to save me hours. I paid moodle trust a mere $100 in gratitude for this but if I have some more money I will contribute again. Honestly this is a godsend.
Tim
This is brilliant and solves many problems that I have at the moment.
I found a small bug when I installed it on my test server (runnning the latest 1.5.2+ downloaded earlier tonight).
One of the resources I had was a word document called "AS_Comp_test_xmas_2004_Mark_Scheme" and when I selected "Rearrange layout" everything appeared as expected except for this one resource. The icon appeared for the resource but the name was blank. When I renamed it without the underscores it worked correctly. When I put the underscores back the problem reoccured. This was the only resource in which underscores appeared in teh name.
The file was . Strangely when I left only the underscore between AS and Comp it didn't mind.
Thanks
John Ryan
white-space:nowrap;
to div.module
/* course content */
div.module {
white-space:nowrap;
border:1px solid #000099;
height:16px;
left:187px;
background:#aaaa30;
layer-background-color:#aaaa30;
}
The label was ' asd_wer_wer_wer_wer_ertert_werwer'
The div was set to have overflow hidden, the browser breaks the label on the space before the label ==> no visible label text.
Wonderful stuff, im little bit confused about how to use it, but making some tests already. Does anybody made some help, some tutorial how to use this editor?
Its there any possibility to copy whole topic from one of my courses at once? Or i have to place one resource after another?
Anyway, great work, thx Audun
Petr
It would be nice to be able to move several activities at once too.
I use this all the time and with a lot of activities (see image)!
Place them into trash, drag the can along, pull them out of the can and drop on the new destination. Also the list in trash can be made smaller by clicking on the trash icon ( seems you´ve done this in the snapshot).
Are you really about to trash all those activities?
I am posting to say thanks again because now at the beginning of a new term, this block once again saved me a lot of time. Thank you. I hope that the layout editor continues.
Tim
And just to confirm that it does work in 1.6. I have just installed in 1.6 and it worked like a dream (when i used the version attached to my post above "layout2.zip")
Tim
I can't seem to find where I posted layout2.zip so I have posted it here.
Tim
I was able to use it to create a more formal package and store it in a more standard location
http://moodle.org/mod/data/view.php?d=13&rid=491
p.s. I made tiny changes to allow easier installation:
the code is stored into course/layout and so i changed the URLs calling up config.php and layout.php in a couple of places
you may consider to put meta tag about charset to layout.php, so it works also with non-english pages. It helped to me to add to line 496 something like:
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
I included it and uploaded it to the modules and plugins area (and credited you in the README)