Module with Admin, and other questions

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
brady

Module with Admin, and other questions

Post by brady »

I have been trying to write a module I would like to be under the site admin menu. So I added

Code: Select all

		function GetAdminSection(){
			return 'admin';
		}
However, it won't show up. But if a put content in there it shows up fine. What do I need to change?

Question #2: What does this code do?

Code: Select all

			$this->modmisc = false;//Don't know what this does...
			$this->modform = false;//This either...
I added to the constructor function of my class, to stop notices, but I don't know what it does.
Question #3: When I visit the admin page of the module it complains that the class of my module has already been declared. What it up with that? I added if(!class_exists.... for now, but I shouldn't have to do that I think.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Module with Admin, and other questions

Post by Ted »

#1.

Code: Select all

return 'siteadmin';
#2. The module class is split off into several helper classes in order to cut down on the amount of loaded code at once.  We load those auxillary classes on the fly as we use various methods.  If you're extending CMSModule, you shouldn't have to redeclare any of that stuff.

#3. Are you sure you changed the name of your class that extends CMSModule?  Are you sure that module doesn't exist somehwere else?  It should tell you where the class was previously defined...  is it the same spot?  Because we use include_once in most places, so a file shouldn't be included twice.
brady

Re: Module with Admin, and other questions

Post by brady »

Thanks for the response Ted! Are the module API docs up to date? They say it should have been 'admin'. Oh well, it's working now. The only problem I have left is this
Fatal error: Cannot redeclare class configgui in C:\Program Files\server\http\Apache2\htdocs\music\live\modules\ConfigGUI\ConfigGUI.module.php on line 122
Line 122 is the closing brace of my class. When I add if(!class_exists('ConfigGUI'){...} the module works fine(so far)

The notices I was getting about those two variables being undefined have disappeared. I don't know why.

By the way, I have submitted this module to the Forge, hopefully you think it is a good idea.
brady

Re: Module with Admin, and other questions

Post by brady »

Some more info. I got the notice about modform again.
Notice: Undefined property: ConfigGUI::$modform in C:\Program Files\server\http\Apache2\htdocs\music\live\lib\classes\class.module.inc.php on line 131
I checked that file, and it looked like isset needs to be used.
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm
Location: Finland

Re: Module with Admin, and other questions

Post by tsw »

please file these as bugs in forge, its much easier to keep up with bugs when they are centralized in forge, posts about bugs tend to get forgotten...

or if you want to participate in module development post patches in the forge and request joining on projects.

ps. nice work with the config module :)
brady

Re: Module with Admin, and other questions

Post by brady »

Okay, I posted it in the bug tracker(I hope I did it right) http://dev.cmsmadesimple.org/tracker/in ... 6&atid=101
I posted it here because I assumed I had done something wrong(like I did with my first question), instead of it being an actual bug.

Another question, how do I post patches? and How do I make patches? I know how to fix these errors, I just don't know how to submit the fix.
Last edited by brady on Sun Nov 26, 2006 8:54 pm, edited 1 time in total.
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm
Location: Finland

Re: Module with Admin, and other questions

Post by tsw »

great, thanks for your input


creating patches is quite easy, best way to do patches is to have a seperate svn installation to do the patches.

first checkout the svn trunk and install it (installation is done the same way as normal installation) I dont recommend using svn version on live sites tho..

check that you are doing the patch against current svn version by typing "svn update" do your fix, test it, and say svn update again (if someone else has committed some new code meanwhile you were fixing yours this is the step youll get notified about it and if there are any parts that overlap with your fix you have to check those parts manually. then just type "svn diff > fix_for_something_against_svn_rev_[revnumber].diff" and you have a patch ready. (svn tells you the current revision number everytime you do a update)

then post that patch to forge and a dev will check it out and if it works for them too it will be committed.

You can also do patches against 1.0.2 but applying those patches is a lot harder for developers.

If you have any questions about the process, please ask.

and please stop by at #cms @ freenode we will also answer questions there (if we are awake ;)


Happy patching ;)
Post Reply

Return to “Developers Discussion”