Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.9
-
Fix Version/s: 1.9
-
Component/s: Patch: Usernews
-
Labels:None
-
Affected Branches:MOODLE_19_STABLE
-
Fixed Branches:MOODLE_19_STABLE
Description
It's a new bulk user action that allows administrators (doanything capability) to add news on Moodle index page using Moodle user filters.
The admin user chooses if news can be hidden by users or if are fixed as well as send an email with the news.
Attachments
-
$i18n.getText("admin.common.words.hide")
- local.zip
- 27/Nov/09 1:22 AM
- 3 kB
- Anthony Borrow
-
- local/version.php 0.0 kB
- local/db/upgrade.php 0.3 kB
- local/lang/en_utf8/usernews.php 0.8 kB
- local/lang/ca_utf8/local.php 0.9 kB
- local/lang/es_utf8/local.php 0.9 kB
-
$i18n.getText("admin.common.words.hide")
- usernews_197_20091126.zip
- 30/Nov/09 11:16 PM
- 11 kB
- David Monllaó
-
- usernews/admin/user/news/README.txt 1 kB
- usernews/admin/user/news/db/install.xml 3 kB
- usernews/admin/user/news/index.php 2 kB
- usernews/admin/user/news/managenews.php 4 kB
- usernews/admin/.../news/user_bulk_news.php 2 kB
- usernews/admin/.../news/user_news_form.php 1 kB
- usernews/admin/user/news/usernews.diff 2 kB
- usernews/admin/user/news/usernewslib.php 4 kB
- usernews/local/db/upgrade.php 1 kB
- usernews/local/lang/ca_utf8/local.php 1.0 kB
- usernews/local/lang/en_utf8/local.php 0.8 kB
- usernews/local/lang/es_utf8/local.php 1.0 kB
- usernews/local/version.php 0.1 kB
$i18n.getText("admin.common.words.show")- usernews_197_20091126.zip
- 30/Nov/09 11:16 PM
- 11 kB
- David Monllaó
-
$i18n.getText("admin.common.words.hide")
- usernews_stable.zip
- 27/Nov/09 4:24 PM
- 12 kB
- David Monllaó
-
- usernews/local/version.php 0.1 kB
- usernews/local/db/upgrade.php 1 kB
- usernews/local/lang/ca_utf8/local.php 1.0 kB
- usernews/local/lang/es_utf8/local.php 1.0 kB
- usernews/local/lang/en_utf8/local.php 0.8 kB
- usernews/admin/user/news/managenews.php 4 kB
- usernews/admin/user/news/README.txt 1 kB
- usernews/admin/user/news/usernews.diff 2 kB
- usernews/admin/.../news/user_bulk_news.php 2 kB
- usernews/admin/user/news/usernewslib.php 4 kB
- usernews/admin/user/news/index.php 2 kB
- usernews/admin/.../news/user_news_form.php 1 kB
- usernews/admin/user/news/db/install.xml 3 kB
-
$i18n.getText("admin.common.words.hide")
- usernews.zip
- 26/Nov/09 11:59 PM
- 11 kB
- David Monllaó
-
- usernews/README.txt 1.0 kB
- usernews/usernews.diff 2 kB
- usernews/local/db/install.xml 3 kB
- usernews/local/lang/ca_utf8/usernews.php 0.9 kB
- usernews/local/lang/es_utf8/usernews.php 0.9 kB
- usernews/local/lang/en_utf8/usernews.php 0.8 kB
- usernews/admin/user/news/managenews.php 4 kB
- usernews/admin/.../news/user_bulk_news.php 2 kB
- usernews/admin/user/news/usernewslib.php 4 kB
- usernews/admin/user/news/index.php 2 kB
- usernews/admin/.../news/user_news_form.php 1 kB
-
$i18n.getText("admin.common.words.hide")
- usernews.zip
- 26/Nov/09 9:21 PM
- 10 kB
- David Monllaó
-
- usernews/usernews.diff 2 kB
- usernews/README 1 kB
- usernews/local/db/mysql.sql 0.9 kB
- usernews/local/lang/ca_utf8/usernews.php 0.9 kB
- usernews/local/lang/es_utf8/usernews.php 0.9 kB
- usernews/local/lang/en_utf8/usernews.php 0.8 kB
- usernews/admin/user/news/managenews.php 4 kB
- usernews/admin/.../news/user_bulk_news.php 2 kB
- usernews/admin/user/news/usernewslib.php 4 kB
- usernews/admin/user/news/index.php 2 kB
- usernews/admin/.../news/user_news_form.php 1 kB
Issue Links
| This issue will be resolved by: | ||||
| MDL-17010 | Plug-in bulk user actions architecture |
|
|
|
Activity
Hi Anthony, thanks for your quick reply.
That bulk users modularity seems pretty well, but that patch/plugin has a modification in the moodle/index.php to show the news in the frontpage that I don't know if could be avoided, anyway, when this new architecture is working I'll update the code of course. Sorry for the old mysql.sql, I've upload a new zip with install.xml.
Thanks,
David
David - Thanks for the speedy response and changing to install.xml. Just to follow more of a plugin model, I think that I will move the README.txt and usernews.diff files to /admin/user/news. That way if someone unzips and copies everything into their Moodle install it does not overwrite the README.txt file. Does that make sense? Any objection? Peace - Anthony
David - One more thing since I do not often work with the local folder, I forgot how it handles upgrades. Would you mind taking a look at http://docs.moodle.org/en/Development:Local_customisation#local.2Fdb.2Finstall.xml and see if you could get it working for a fresh install. I would go ahead and move the install.xml file from /local/db/install.xml (I told you incorrectly) to /admin/user/news/db/install.xml and then use /local/version.php and /local/db/upgrade.php to get things working. If you run into problems or have questions let me know and I'll try to better refresh my memory. Peace - Anthony
Ideally, the language strings would be defined in something like /admin/user/news/lang/en_utf8/bulkuser_news.php as a true plugin (I have comment in MDL-17010 about this); however, for the time being, we can throw it in /local/lang/en_utf8/local.php and change the get_string calls to local instead of usernews.
I am also wondering to get around the patch to index.php if you might want to create a separate activity module called usernews that would be based on the forum activity module. In that way, the site admin would simply add that activity module to the front page. I could see teacher using this in courses as well with their students if you wanted to develop it further to support course level type things. Don't let my brainstorming distract you. I am perfectly fine adding this as it is and letting you clean it and develop it futher but since CVS does not handle deleting files/directories all that nicely I try to get the file structure worked out as best as we can before I add it.
Peace - Anthony
Here is a sample local folder that implements the version, upgrade, etc. Note that I moved install.xml to /admin/user/news/install.xml and changed the name of the language files to local.php. Let me know if you have any questions and please keep in mind that my ideas are mere suggestions to be helpful. Feel free to do as you see best. I see my role only as trying to raise questions, make sometimes helpful suggestions, and hopefully improve the usability of the shared code so that others experience with it is as positive as possible. Peace - Anthony
Hi Anthony,
An activity module! that's a really good solution! Maybe could be a problem if the plugin is installed in a installation that already have a local/db or a local/lang but the activity module is the solution, and goodbye index.php modification.
Thanks for the local/ code, I've just finish the testing of the local/db/upgrade.php and the local/version.php in a new 1.9.5, it seems the same code you've uploaded.
Tomorrow I'll change string references to local/lang/en_utf/local.php
David - I think we could handle migrating things from the local version to an activity module version without too much trouble. Again, I am fine with making that a longer term solution if you like. Just upload the latest version when you get it to a point you think is ready to share and we'll work on putting it in its correct place. Because the modifications are trivial, I am almost tempted to put it into plugin; however, I try to avoid mixing things so we could start with a 1.9 version which is a patch and then work toward creating the plugin. Then when the plugin is completed we could delete the code from patches and update the download link in the Modules and Plugins database. By the way, I forgot to mention but you have probably read already http://docs.moodle.org/en/Development:Guidelines_for_contributed_code. I usually refer folks to it as a sort of checklist for getting things into CONTRIB. Keep up the great work. It is always a pleasure to work with folks who are open to suggestions. I appreciate your flexibility and patience. Peace - Anthony
Ok Anthony, we begin with a patch, and as soon as my other duties allows me I'll apply the MDL-17010 patch to a new 1.9.x and begin to work on the module and the user bulk plugin. The third part could be the course level support that you proposes, and I'm thinking that it (and other possible funcionalities) will thank some kind of course participants actions modularity to avoid core modifications, or maybe I'm thinking too much and I should go to sleep because it's too late...
Thanks for you time (I'm sure that you are very occupied man) and all your help,
David
.language strings references changed to local
.local customizations support (version dated as 2009112600)
.added installation comments for users with local customizations
Hi Anthony,
Today I've seen that the last week 1.9.7 have a new user bulk action and the patch from usernews_stable.zip, created from a 1.9.5, will crash. I've attached a new .zip from the latest 1.9.7 (20091126) tested in that 1.9.7
Thanks for your attentiveness and providing the updated code. Unfortunately at the moment I am buried in final papers and that must be my top priority but I will get back to this hopefully in the next week. Peace - Anthony
David - I installed and was looking at the diff file. Rather than modifying the index.php file (a core file), I was wondering what would happen if we created a separate theme for user_news and provide instructions for those who want to use it in a different or existing theme how to modify the header.html file such that it would display the usernews box. Once MDL-17010 is resolved then your code would truly be a plugin. I like the way it functions but am still a little torn as to whether to make it a patch or a plugin. While it is technically a patch, I really see it more as a plugin. What do you think about creating a separate theme (perhaps based off of standard) called usernews? That way the whole thing could legitimately be delivered as a plugin (with the exception of MDL-17010) with an option for folks to patch their systems accordingly. Peace - Anthony
Hi Anthony and happy new year, I began with a module but I couldn't found a way to code a condition to show/hide the activity. I'll work on the usernews theme, when it's finished I'll also change the local/ files to admin/user/actions/usernews/db, admin/user/actions/usernews/lang and admin/user/actions/usernews/version.php. Thanks, David
David - The disadvantage to having everything under /admin/user/actions/usernews is that until that is handled as a true plugin (which is currently not the case AFAIK) then it will not work for the majority of folks. At least with it being in local it is basically working. If you want me to look at the module approach send me the code and describe the behavior your want and we can see if we can get it working the way you want. A module would be ideal as that could handle the database, versioning, and language stuff. I realize that your intention was for a system wide user of the user news functionality; however, if it is a module you could make it available on the course level as well; however, then we have to look at the whole issue of adding it to the list of bulk user actions available through the participants block. Please keep in mind while I explore ideas with you that they are meant to be constructive and helpful; however, ultimately, it is your contribution so feel free to choose how you want want to share the code. I have also been thinking that there is nothing wrong with us starting out by making it a patch and then working toward making it more modular over time. In other words, I want to try avoiding this out and simply have you working on it to get it to some mythical stage of perfection. My role is to serve those who share their code and to help ensure that it is a smooth process for everyone. Because I come back to the code several times, I could see where one time I might be inclined to think and implement it one way and on another day depending on what else I may have been doing think differently so I don't want you to be the victim of my indecision. Of course if you are fine with continuing to just kick ideas around I am OK with that too but trust you to determine how you want to proceed. Peace - Anthony
Hi Anthony, first of all thanks for your ideas, you have a global view and you know the best way to share code and apply shared code without trouble, I appreciate all you help to make it shareable. Initialy my chef requirement was to show different news on moodle frontpage for different users, using moodle user filters to select which users should see what. The problema I found working on a module to avoid the .patch is that the activity shouldn't be avaiable for all users, only previously filtered users should see it, I haven't found a way to code this without modify core code, have you any idea about this?
David - Thanks for your openness. The more I have thought about it, the more I have become convinced that we will treat this as the patch that it is (for now) and if we can work toward making it a plugin then all the better. I do not want to hold up your work or cause you more unnecessary work. If we want to explore the activity module approach later we can. I am sure we could get it to work but let's go ahead and move forward with what we have and then figure where we want to go from there. I will go ahead and add the code to the patches section mostly as a regular plugin. The folks can apply the patch and have it working regardless of theme. How does that sound? Peace - Anthony
David - I am moving this issue to the newly created tracker component Patch: Usernews. You are listed as the component lead and new issues will automatically be assigned to you and you will be notified by email. I have bumped your privileges in the tracker so that you can manage issues related to the usernews patch. Do not hesitate to let me know if you have any questions about working with things in the tracker. Peace - Anthony
David - I am resolving this as fixed. As mentioned, I have created a component in the tracker and bumped your privileges. I have also added the code to CVS (contrib/patches/usernews). If you have not done so already, please apply for CVS write access by going to http://moodle.org/cvs/. Just a reminder that it is recommended and preferred that all CVS commit comments contain (usually begins with) the Moodle tracker number. This goes a long way to providing documentation for why particular code changes have been made. The obvious exception is a simple correction of a typo which you would simply put something like: fixing typo in the commit comment. The tracker then reflects the code changes that were made which I find pretty slick. It is probably a good time to review http://docs.moodle.org/en/Development:Guidelines_for_contributed_code and make sure all of the details about creating a Moodle Docs page, adding the Modules and Plugins entry, and announcing the patch on the Moodle.org forum (http://moodle.org/mod/forum/view.php?id=44) are completed. Again, please do not hesitate to let me know if you have any questions or run into any difficulties as I am happy to help out. Thanks for your patience in working through this issue with me as I struggled a little with how best to treat the code in a manner that was consistent but also reasonably efficient for users wanting to make use of it. Peace - Anthony
Hi Anthony, I've just applied for a cvs access to contrib/patches/usernews, thanks for the info about commits, tracker and contributed code, I will follow all the steps. Thank you for all your help and for your tolerance with my limited english level.
Saludos,
David
Thanks David, the attention to the detail is greatly appreciated and goes a long way toward preventing problems. Paz / Antonio
p.d. Soy bilingue, si prefiere castellano no hay problema.
David - Muchisimas gracias por compartir este patch con la comunidad de Moodle (Many thanks for sharing this patch with the Moodle community). In order to give the patch a wider audience, would you mind changing the /local/db/mysql.sql to a /local/db/install.xml file. This will allow folks with other databases to add and make use of the patch and as I understand it the preferred way of doing things now (see http://docs.moodle.org/en/Development:XMLDB_defining_an_XML_structure#Justification). Using the XMLDB editor you should be able to do this pretty quickly but if you need help just let me know. Also, I will rename the README file to README.txt because I prefer when possible to have filenames with extensions. I do think this will be a rather useful patch. I know that I have had requests for it on some production sites that I have helped out with. I look forward to reviewing the code more closely. One other thing that may delay me adding this to CVS is figuring out where to put the code. The patch portion of your code is very minimal and I would like to see if we could make it actually obsolete. To do so, requires that the bulk user actions have a more modular structure. This feature has been requested at MDL-17010. Therefore, I am going to link the issues and see if I can encourage this. We could still provide the patch file for those using the older version but we may actually add this as a CONTRIB plugin rather than a patch which I think is preferred as that would keep folks from having to modify core code on their sites. Thanks for your patience during this process. Peace - Anthony