GO programming help

Discuss about Group-Office development here

Moderator: Developers

GO programming help

Postby gtech » Fri Jul 06, 2012 3:38 pm

I have a quick question regarding the GO programming structure which I don't understand very well.

Take for example the e-mail module.

It has all the MVC components under the controller / model directories. Those classes extend the GO base classes found in: go/base for functions like GO_Base_Mail_Imap . All that is fine and easy to understand, but then why are the same functions redefined in the classes directory ?

Right now here's what I see.

Imap functionality for example is defined twice:

1. In /usr/share/groupoffice/go/base/mail/Imap.php
2. In /usr/share/groupoffice/classes/mail/imap.class.inc

#1 is used by the e-mail module as part of the MVC ( controller / model )
#2 is used by the e-mail module directly from json.php as part of the cached_imap class

Why are there two different imap classes used here ?
gtech
 
Posts: 31
Joined: Thu Aug 05, 2010 5:44 pm

Re: GO programming help

Postby Intermesh » Tue Jul 10, 2012 8:57 am

We are currently rewriting GO.

classes/, json.php and action.php is old stuff which will be removed when we're completely ready.

All MVC stuff (controller, model) is new and you should use those classes!
Best regards,

Merijn Schering
Intermesh
User avatar
Intermesh
Site Admin
 
Posts: 7134
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch

Re: GO programming help

Postby gtech » Tue Jul 10, 2012 4:00 pm

Thank you, that makes sense!

I have one more question regarding the MVC.

Say that in our custom module we overwrite parts of the E-mail > Accounts -> preferences. We add a new drop-down selection that has to be saved into the database in a new column. How can that be executed and saved at the same time when you press 'Apply' or 'OK' in that tab ?

It would seem easy enough if we could modify the e-mail module directly, but can it be done from our own module by overriding some functions ?
gtech
 
Posts: 31
Joined: Thu Aug 05, 2010 5:44 pm

Re: GO programming help

Postby Intermesh » Wed Jul 11, 2012 11:05 am

You should not modify the e-mail module's code as it will be impossible to maintain when we release updates.

You can override the javascript stuff with this technique:

http://wiki4.group-office.com/wiki/Customizations

And the PHP functions with this:

http://wiki4.group-office.com/wiki/Event_handling
Best regards,

Merijn Schering
Intermesh
User avatar
Intermesh
Site Admin
 
Posts: 7134
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch

Re: GO programming help

Postby gtech » Wed Jul 11, 2012 3:40 pm

Thank you, that's exactly what I was looking for.

So in GO3 we had these events: http://www.group-office.com/wiki/Event_handling

save_settings, load_settings, etc. In GO4 I see you simply use 'save', 'delete', etc. I take it they have changed ?
gtech
 
Posts: 31
Joined: Thu Aug 05, 2010 5:44 pm

Re: GO programming help

Postby Intermesh » Thu Jul 12, 2012 1:05 pm

Yes, any model has a save and delete event.

The standard controllers have a submit, store, load and display event.
Best regards,

Merijn Schering
Intermesh
User avatar
Intermesh
Site Admin
 
Posts: 7134
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch


Return to Development Chats

Who is online

Users browsing this forum: No registered users and 1 guest