This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation. |
Difference between revisions of "Customizations"
(→Server side code) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
It's very easy to customize Group-Office without modifying the existing sourcecode. This way you don't have to redo all the customizations each time you upgrade to a newer version. | It's very easy to customize Group-Office without modifying the existing sourcecode. This way you don't have to redo all the customizations each time you upgrade to a newer version. | ||
+ | |||
+ | ==Client side code== | ||
This example will add a dummy tab to the e-mail account dialog. Please read "Creating a module" first to get started. You need to enable debugging mode. | This example will add a dummy tab to the e-mail account dialog. Please read "Creating a module" first to get started. You need to enable debugging mode. | ||
1. Create the folder modules/mymodule | 1. Create the folder modules/mymodule | ||
+ | |||
2. Create modules/mymodule/scripts.txt with: | 2. Create modules/mymodule/scripts.txt with: | ||
Line 17: | Line 20: | ||
Ext.override(GO.email.AccountDialog, { | Ext.override(GO.email.AccountDialog, { | ||
initComponent : GO.email.AccountDialog.prototype.initComponent.createSequence(function(){ | initComponent : GO.email.AccountDialog.prototype.initComponent.createSequence(function(){ | ||
− | this.tabPanel.add(new Ext.Panel({title:'A dummy tab', html:'Just an example'}); | + | this.tabPanel.add(new Ext.Panel({ |
− | } | + | title:'A dummy tab', |
− | }) | + | html:'Just an example' |
+ | })); | ||
+ | //make dialog a little bit wider | ||
+ | this.width+=100; | ||
+ | }) | ||
+ | }); | ||
}); | }); | ||
</pre> | </pre> | ||
Line 26: | Line 34: | ||
E-mail -> Administration -> E-mail accounts -> Accounts | E-mail -> Administration -> E-mail accounts -> Accounts | ||
+ | |||
+ | |||
+ | Here are some other useful overrides: | ||
+ | |||
+ | <pre> | ||
+ | GO.moduleManager.onModuleReady('calendar', function(){ | ||
+ | //Make row height larger in the calendar. | ||
+ | Ext.override(GO.grid.CalendarGrid,{ | ||
+ | hourHeight : 80, | ||
+ | minRows : 1 | ||
+ | }); | ||
+ | |||
+ | //send invitation to participants by default | ||
+ | Ext.override(GO.calendar.ParticipantsPanel, { | ||
+ | setEventId : GO.calendar.ParticipantsPanel.prototype.setEventId.createSequence(function(){ | ||
+ | this.inviteCheckbox.setValue(true); | ||
+ | }) | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | |||
+ | //start java upload right away in the files module | ||
+ | GO.moduleManager.onModuleReady('files',function(){ | ||
+ | Ext.override(GO.files.FileBrowser, { | ||
+ | initComponent : GO.files.FileBrowser.prototype.initComponent.createSequence(function(){ | ||
+ | this.uploadButton.handler=function(){ | ||
+ | window.open(GO.settings.modules.files.url | ||
+ | + 'jupload/index.php?id=' | ||
+ | + this.folder_id); | ||
+ | } | ||
+ | }) | ||
+ | }) | ||
+ | }); | ||
+ | </pre> | ||
+ | |||
+ | ==Server side code== | ||
+ | |||
+ | You can add your own functionality to existing controllers in the PHP backend too. Take a look at the [[Event handling]] page. |
Latest revision as of 12:07, 11 July 2012
It's very easy to customize Group-Office without modifying the existing sourcecode. This way you don't have to redo all the customizations each time you upgrade to a newer version.
Client side code
This example will add a dummy tab to the e-mail account dialog. Please read "Creating a module" first to get started. You need to enable debugging mode.
1. Create the folder modules/mymodule
2. Create modules/mymodule/scripts.txt with:
modules/mymodule/Plugin.js
Create modules/mymodule/Plugin.js and put this in it:
GO.moduleManager.onModuleReady('email',function(){ Ext.override(GO.email.AccountDialog, { initComponent : GO.email.AccountDialog.prototype.initComponent.createSequence(function(){ this.tabPanel.add(new Ext.Panel({ title:'A dummy tab', html:'Just an example' })); //make dialog a little bit wider this.width+=100; }) }); });
Install the module and you should have a dummy tab in the account dialog at:
E-mail -> Administration -> E-mail accounts -> Accounts
Here are some other useful overrides:
GO.moduleManager.onModuleReady('calendar', function(){ //Make row height larger in the calendar. Ext.override(GO.grid.CalendarGrid,{ hourHeight : 80, minRows : 1 }); //send invitation to participants by default Ext.override(GO.calendar.ParticipantsPanel, { setEventId : GO.calendar.ParticipantsPanel.prototype.setEventId.createSequence(function(){ this.inviteCheckbox.setValue(true); }) }); }); //start java upload right away in the files module GO.moduleManager.onModuleReady('files',function(){ Ext.override(GO.files.FileBrowser, { initComponent : GO.files.FileBrowser.prototype.initComponent.createSequence(function(){ this.uploadButton.handler=function(){ window.open(GO.settings.modules.files.url + 'jupload/index.php?id=' + this.folder_id); } }) }) });
Server side code
You can add your own functionality to existing controllers in the PHP backend too. Take a look at the Event handling page.