Feng Forum
Other Topics => Development => Applications => : mirko November 24, 2008, 02:10:46 PM
-
I try to write a new application the first time and now I want share my knowledge, because I don't find something like that in the forum or somewhere else. I think when it's clear how to write a extension, more peple will do it and can extend the software faster. It will be nice, if you get suggestions for improvement!!!
New controller:
Create a new file called HelloworldController.class.php in the application/controllers folder. This controller will be loaded automatically and have one or more actions (here only one: index). You can set some variables to use they in the view template.
class HelloworldController extends ApplicationController {
function __construct() {
parent::__construct();
prepare_company_website_controller($this, 'website');
}
function index() {
$my_var = 'World';
tpl_assign('world', $my_var);
}
}
New view:
Create a file which is called equal to the action name, here index.php, in the application/views folder to show the output of the controller.
Hello <?php echo $world ?> !
Show the new application near the others as a tab:
Add it to the constructor of the TabPanel class to the items array in public/assets/javascript/og/layout.js :
var tab_panel = new Ext.TabPanel({
id: 'tabs-panel',
region:'center',
activeTab: 0,
enableTabScroll: true,
items: [
...
new og.ContentPanel({
title: lang('helloworld'),
id: 'helloworld-panel',
iconCls: 'ico-helloworld',
refreshOnWorkspaceChange: true,
defaultContent: {
type: "url",
data: og.getUrl('helloworld','index')
}
}),
Set a tab-label for the application:
For the English translation add a new item called helloword (see above) to the array in the javascript file language/en_us/lang.js.
...
'completed on': 'Completed on',
/* Hello World */
'helloworld': 'Hello World'
Now reload your opengoo and you will see your Hello World! application at the top.
Set an icon for the application:
The icon must set by the used theme, so for the default theme you save your icon by default in the public/assets/themes/default/images/16x16 folder.
Now connect the CSS class ico-helloworld to your image in the CSS file public/assets/themes/default/stylesheets/general/layout.css
.ico-helloworld {
background-image: url(../../images/16x16/helloworld.png) !important;
}
-
Hi mirko,
Nice work figuring out OpenGoo's architecture! Lack of decent development documentation is one of our weak points. I was thinking on setting up a wiki so that we can all build up some nice manuals so as to encourage people to develop for OpenGoo.
I'll keep you informed.
-
making any changes to lang.js will display Missing lang.js beside menu items. any help
-
There must be some syntax error on the file. Check that all single quotes in the strings are preceded by a backslash. E.g.: 'Escap\'d quote'
Also, check that all translation keys are followed by a colon ( : ) and all translation strings are followed by a comma ( , ) EXCEPT for the last one (this breaks IE).
-
Hello,
Is it possible to call a different script in that window. So that the new script will show inside the tab. I tried to add the script in the folder eg"helloworld" however i keep getting page not found. Is there a certain way to code it to call the script? The script is an inventory software im trying to add so that the users don't have to go out of the page. The script calls its own db and so on.
-
You have to change mirko's example like this:
new og.ContentPanel({
title: lang('helloworld'),
id: 'helloworld-panel',
iconCls: 'ico-helloworld',
autoScroll: false,
defaultContent: {
type: "html",
notbar: true,
data: '<iframe style="width:100%;height:100%;border:0" src="http://www.opengoo.org"></iframe>'
}
})
If you get an extra vertical scrollbar you can remove it by changing the iframe's height to 99% (this will be fixed for version 1.2).
In this case it will show you opengoo.org. You can change it to point to your script.
-
Hi , I just want to share the code that i used for creating the HelloWorld application using 1.3-beta version.
everything is the same except for the changes that need to be done in layout.js file.
......
og.panels.reporting = new og.ContentPanel({
title: lang('reporting'),
id: 'reporting-panel',
iconCls: 'ico-reporting',
refreshOnWorkspaceChange: false,
defaultContent: {
type: "url",
data: og.getUrl('reporting','index')
}
}),
/** New HelloWorld Tab Here **/
og.panels.helloworld = new og.ContentPanel({
title: lang('helloworld'),
id: 'helloworld-panel',
iconCls: 'ico-helloworld',
refreshOnWorkspaceChange: true,
defaultContent: {
type: "url",
data: og.getUrl('helloworld','index')
}
})
thanks to everyone
-
how do use extjs in "Hello World" application
-
Hm, I add a extjs-tab widget by changing the layout.js an add a new item.
When you have you own application in og, you can use extjs in you view files normally like anywhere - "Ext.MessageBox.show(...)" for example.
-
oh sorry for my bad question, i meaning how to add extjs tools and how to handle event in helloworld application or how to setting up ajax request of used extjs tools
-
Thank you for this! It took some digging and some updating (Feng Office has changed somewhat) but I was able to use this to create two new tabs, one for Announcements, and one for Labs, where we'll be building and playing with the Google Chart and Google Visualization APIs without fear of messing up the other tabs in the meantime.
-
Nice example and useful replies.
Can this be stickied. Be useful for new developers, like me :)
Cheers
-
Any chance of updating the instructions for 1.7.4 (and beyond).
I tried the following, but got nothing...
EDIT: Caching problem, sorry - Everything works fine!
application/controllers/HelloworldController.class.php
<?php
/**
* Hello World
* @version 1.0
*/
class HelloworldController extends ApplicationController {
function __construct() {
parent::__construct();
prepare_company_website_controller($this, 'website');
}
function index() {
$my_planet = 'Earth';
tpl_assign('planet', $my_planet);
}
}
?>
application/views/helloworld/index.php:
Hello <?php echo $planet ?> !
public/assets/javascript/og/layout.js :
. . .
// SETUP PANEL LAYOUT
og.panels = {};
var panels = [
. . .
og.panels.helloworld = new og.ContentPanel({
title: lang('helloworld'),
id: 'helloworld-panel',
iconCls: 'ico-helloworld',
refreshOnWorkspaceChange: true,
defaultContent: {
type: "url",
data: og.getUrl('helloworld','index')
}
})
];
. . .
language/en_us/lang.js:
. . .
/* Hello World tab */
'helloworld': 'Hello World',
. . .
public/assets/themes/default/stylesheets/general/layout.css
. . .
.ico-helloworld {
background: transparent url(../../images/16x16/helloworld.png) no-repeat scroll 0 0 !important;
}
. . .
...and uploaded the required helloworld.png
Is there anything more that needs to be set up for the app to run under 1.7.4? EDIT: everything works fine in 1.7.4
Denis
-
Maybe you can help me...i followed this steps, and new tab is showing, but it shows the first (before overview tab)...how can i move it to the back?
-
Hi Guys,
I've finished with Feng2 Plugin documentation and updated the wiki !
Here is the link:
http://www.fengoffice.com/web/wiki/doku.php/feng_office_2_plugin_engine
-
Hello Admins, dear PHPepe, dear developers,
I tried to write a plugin for the FengOffice Engine 2.0 - I failed!
Is there one working tutorial for a database supported plugin?
PHPepe your link is broken!
The hello world application plugin tutorial is not working...
...so what happend with fengoffice support/documentation? I used the old opengoo - changed to fengoffice but now...
I need help to write some plugins...
Please help
-
See updated documentation here:
/web/wiki/doku.php/plugins_documentation
(sorry, my status on this board is too lowly to post links)