Portlet view for phpbb3

Discuss about Group-Office development here

Moderator: Developers

carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Portlet view for phpbb3

Postby carlos.camacho » Tue Jul 07, 2009 11:04 pm

Hi, im making a portlet for the phpbb3 module, its almost done, i have the last 5 updated posts, but i want to click the post and go to the phpbb3 tab and automaticly show this post.
This is my code to open the phpbb3 tab, ¿there is a way to open the post when the tab is doble clicked?

This is the event to open the tab

this.on("rowdblclick", function(grid, rowClicked, e){
GO.mainLayout.tabPanel.setActiveTab(9);

}, this);
Regards
mschering
Site Admin
Site Admin
Posts: 8281
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Wed Jul 08, 2009 7:30 am

Edit modules/phpbb3/MainPanel.js and add the id parameter:

Code: Select all

GO.moduleManager.addModule('phpbb3', GO.panel.IFrameComponent, {
	title : GO.phpbb3.lang.forum,
	iconCls : 'go-tab-icon-forum',
	url:GO.settings.modules.phpbb3.url+'redirect.php',
	border:false,
	id:'phpbb3'
});
Now the iframe has a id attribute and you can do:

Ext.get('phpbb3').document.location='post.php?id=1';

(Syntax might be different of this last line, just did this out of my head).
Best regards,

Merijn Schering
Intermesh
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Wed Jul 08, 2009 3:26 pm

This last line where it should be putted? in the Main pannel or the portlet.js file (where is defined the doubleclick event)
mschering
Site Admin
Site Admin
Posts: 8281
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Wed Jul 08, 2009 3:44 pm

in the dblclick event. You have tu use the correct phpbb3 url of course.
Best regards,

Merijn Schering
Intermesh
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Wed Jul 08, 2009 4:36 pm

I get this error but i really dont understand what i have to do to open a tab with an specific url, in the file redirect.php i can open the url i want when you click the tab, but from my portlet i want to call the same url something like if i have a new redirect.php but whit another parameters.


Error: Ext.get("phpbb3") is null
Archivo de origen: https://server/ciensnet/local/cache/8-1 ... e405551.js

Regards
mschering
Site Admin
Site Admin
Posts: 8281
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Wed Jul 08, 2009 5:54 pm

Make sure the tab is rendered before you call it. So you should set the tab active first.
Best regards,

Merijn Schering
Intermesh
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Wed Jul 08, 2009 6:22 pm

Yes, iknow but i have this.

Portlet.js

GO.phpbb3.Phpbb3Grid = function(config){
if(!config){
config = {};
}

config.store = new GO.data.JsonStore({
url: GO.settings.modules.phpbb3.url+ 'json.php',
baseParams: {
task: 'foros'
},
root: 'results',
id: 'forum_id',
totalProperty:'total',
fields: ['post_subject','post_time']
});

var Phpbb3ColumnModel = new Ext.grid.ColumnModel(
[{
header: 'Actualidad Universitaria',
dataIndex: 'post_subject',
sortable: false,
width: 420
},{
header: 'Fecha',
dataIndex: 'post_time',
sortable: false,
width: 150
}]
);

Phpbb3ColumnModel.defaultSortable= true;
config.cm=Phpbb3ColumnModel;

config.view=new Ext.grid.GridView({
emptyText: 'No hay temas para mostrar',
forceFit: true
});

config.sm=new Ext.grid.RowSelectionModel();
config.loadMask=true;
config.autoHeight=true;

/*
* explicitly call the superclass constructor
*/
GO.phpbb3.Phpbb3Grid.superclass.constructor.call(this, config);

};


Ext.extend(GO.phpbb3.Phpbb3Grid, GO.grid.GridPanel,{

loaded : false,
afterRender : function()
{
this.on("rowdblclick", function(grid, rowClicked, e){
GO.mainLayout.tabPanel.setActiveTab(9);
Ext.get('phpbb3').document.location='viewtopic.php?f=31&t=25';
}, this);

if(this.isVisible()){
this.onGridShow();
}
},

onGridShow : function(){
if(!this.loaded && this.rendered)
{
this.store.load();
//this.loaded=true;
}
}

});

GO.mainLayout.onReady(function(){
if(GO.summary)
{
var phpbb = new GO.phpbb3.Phpbb3Grid();

GO.summary.portlets['portlet-foros']=new GO.summary.Portlet({
id: 'portlet-foros',
title: 'Foros',
layout:'fit',
tools: [{
id:'close',
handler: function(e, target, panel){
panel.removePortlet();
}
}],
items: phpbb,
autoHeight:true
});
}
});

and my Mainpanel.js is this

GO.moduleManager.addModule('phpbb3', GO.panel.IFrameComponent, {
title : GO.phpbb3.lang.forum,
iconCls : 'go-tab-icon-forum',
url:GO.settings.modules.phpbb3.url+'redirect.php',
border:false,
id:'phpbb3'
});

Regards
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Wed Jul 08, 2009 7:38 pm

Im trying this, i open the tab number 9 and change the url but i cant refresh the page.
Ideas?
Regards.

this.on("rowdblclick", function(grid, rowClicked, e){
//Ext.MessageBox.alert('Foro');

GO.mainLayout.tabPanel.setActiveTab(9);
GO.mainLayout.tabPanel.getActiveTab().url = '/ciensnet/modules/phpbb3/redirect2.php';
GO.mainLayout.tabPanel.getActiveTab().refresh(true);
var p = GO.mainLayout.tabPanel.getActiveTab();
alert(p.url);

}, this);
mschering
Site Admin
Site Admin
Posts: 8281
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Wed Jul 08, 2009 9:33 pm

Try GO.mainLayout.tabPanel.getActiveTab().document.location instead of .url
Best regards,

Merijn Schering
Intermesh
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Wed Jul 08, 2009 9:48 pm

It says that the element is undefined. :(
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Thu Jul 09, 2009 2:47 am

Hi, im thinking if this could help.

Event handling
Group-Office modules can interact with eachother with event handling. For example you might want to do something in a custom module when a particular thing happens in another module.

Ideas?
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Thu Jul 09, 2009 3:24 pm

Well after a lot effort.. it does not work.. jejeje... But im thinking this what happend whe i click the phpbb3 tab? it loads the phpbb3 foum page in a iframe and loads the redirect.php file....

I want to do exactly the same but instead doing clik in the tab i want to double click the forum portlet how or where is this code in GO? (the code that loads the page in GO), so i can load the page from 0 and call the same redirect.php file to give some parameters to open the post.

Regards.
mschering
Site Admin
Site Admin
Posts: 8281
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Thu Jul 09, 2009 3:39 pm

They you must edit redirect.php. It shouldn't be so hard right?
Best regards,

Merijn Schering
Intermesh
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Thu Jul 09, 2009 4:03 pm

No no i want to load a new page in the phpbb3 tab, i want when i double click a post remove anything in the phpbb3 tab, in my case it will be a new different redirect.php that loads an especific forum but it alllways loads the same or im my case i cant reload the page.
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Thu Jul 09, 2009 10:41 pm

Hi, i already know what the problem is, when you click a tab module (email, calendar, phpbb3, etc), creates a instance of the panel in this module in the case of phpbb3 module it executes the constructor in MainPanel.js, but if you click another module and click the phpbb3 module again it is already instanciated. ¿there is a way to clear, delete or destroy this instance when you click another module (When i click the phpbb3 module for first time i see the module loading but the second time it is already loaded i want that every time i click the module start from scrach)?

I think this will be easy, but is a pain in the a....

this is what i have in my Portlet.js

this.on("rowdblclick", function(grid, rowClicked, e){
GO.mainLayout.tabPanel.setActiveTab(9); // i open the phpbb3 tab
var p = GO.mainLayout.getModulePanel('phpbb3'); //i get the panel created in the MainPanel.js file
p.destroy(); //here i kill the panel

//at this point it works because the panel is distroyed, but when i try to create a panel with google inside
//nothing happends, maybe some its wrong.... help

//This is the same code as MainPanel.js file but with the difference of the redirect2.php
GO.moduleManager.addModule('phpbb3', GO.panel.IFrameComponent, {
title : GO.phpbb3.lang.forum,
iconCls : 'go-tab-icon-forum',
url:GO.settings.modules.phpbb3.url+'redirect2.php',
border:false,
id:'phpbb3'
});
}, this);

and this is my redirect2.php

//the redirect.php has the location of phpbb3
<?php
require('../../Group-Office.php');
header('Location: http://www.google.co.ve');
?>


So if i click directly in the phpbb3 tab it will be open the phpbb3 forum page, with an redirect.php, if i click the post in the portlet i will be opened the phpbb3 tab but with google... My code does not work and i dont have idea why not work.

Regards.

Who is online

Users browsing this forum: No registered users and 2 guests