Portlet view for phpbb3

Discuss about Group-Office development here

Moderator: Developers

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

Re: Portlet view for phpbb3

Postby mschering » Fri Jul 10, 2009 12:07 pm

Why do you want to destroy it? YOu can simply change the location of the already loaded page.

Do you use firebug?

You should use console.log(p) to see what's available in this object.
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 » Fri Jul 10, 2009 2:54 pm

Im trying to destroy it because i cant make it to refresh i see the dom with firebug (really good app) and do this

this.on("rowdblclick", function(grid, rowClicked, e){
GO.mainLayout.tabPanel.setActiveTab(9);
var p = GO.mainLayout.getModulePanel('phpbb3');
p.url=GO.settings.modules.phpbb3.url+'redirect2.php';
console.log(p);
}, this);

I attach 2 screenshots the before and the after of doing this
p.url=GO.settings.modules.phpbb3.url+'redirect2.php';

after i do this how can i refresh the page?


redirect.php has this

<?php
//start session
require('../../Group-Office.php');

$tmp_file = $GO_CONFIG->tmpdir.'/'.md5(uniqid(time())).'txt';
file_put_contents($tmp_file, $GO_SECURITY->user_id);


if(empty($GO_CONFIG->phpbb3_url))
{
exit('Error: you must configure phpbb3_url in your config.php file');
}

$url = $GO_CONFIG->phpbb3_url.'?goauth='.base64_encode($tmp_file).'&sid='.md5(uniqid(time()));

header('Location: '.$url);
?>


and redirect2.php

<?php
//start session
require('../../Group-Office.php');
header('Location: http://www.google.co.ve');
?>
Attachments
1.gif
1.gif (7.99 KiB) Viewed 3946 times
2.gif
2.gif (7.23 KiB) Viewed 3946 times
mschering
Site Admin
Site Admin
Posts: 8284
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Fri Jul 10, 2009 3:13 pm

Ok I dug into this and added this simple button to the summary startpage to make this work:

Code: Select all

{
		text:'test',
		handler:function(){
			var p = GO.mainLayout.getModulePanel('phpbb3');
			p.show();
			p.el.dom.contentDocument.location='http://www.intermesh.nl';
		}
	}
I used firebug to discover that the iframe document object is in p.el.dom.contentDocument. Try it yourself.
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 » Fri Jul 10, 2009 6:36 pm

Thanks!!!! its done, in my case we have to authenticate and then we can see the post, JS is asynchronous and sometimes a request arrives earlier than the other it is because sometimes works and other times dont, the problem is resolved with a time out os 100ms do you want the code of the full portlet of the phpbb3 module??
mschering
Site Admin
Site Admin
Posts: 8284
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Fri Jul 10, 2009 8:20 pm

Yes please post the code. You don't have to wait 100ms. That's not a very safe way. You must send the request and load the page in a callback.
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 » Sat Jul 11, 2009 3:27 pm

Hi, there is the code, im out of town for a few days.

I have an very specific phpbb portlet because i only have a main forum and all the post are there ( General Index ‹ Actualidad Universitaria)

I dont modify anything in the original module just add the files in the rar file.

In the file Portlet.js: you must change the url of your phpbb3 site

setTimeout("document.getElementById('go-module-panel-phpbb3').src='http://YOUR PHPBB3 URL HERE/viewtopic.php?t="+id+"';",100);

Please if you can modify the portlet to add the callback will be great.

In the file phpbb3.class.inc.php: You have to configure the db were phpbb3 is installed

You have to add the portlet in the MainPanel.js of the summary module, see the portlet-foros added

if(!state)
{
this.activePortlets=['portlet-announcements', 'portlet-tasks', 'portlet-calendar','portlet-note','portlet-foros'];
state=[{id:'portlet-announcements', col:0},{id:'portlet-tasks', col:0},{id:'portlet-calendar', col:1},{id:'portlet-note', col:1},{id:'portlet-foros', col:1}];
}

Please if you change something in the code dont remove the initial comment.

Regards.
Attachments
phpbb3.rar
(2.62 KiB) Downloaded 335 times
carlos.camacho
Posts: 62
Joined: Thu Mar 05, 2009 8:02 pm

Re: Portlet view for phpbb3

Postby carlos.camacho » Tue Jul 14, 2009 12:42 pm

Another thing with the phpbb3 module, when an user loggins and click the phpbb3 module write some posts and then logouts from the GO and another user logins in the same browser without closing it, the sesion of the phpbb3 is the previous user not the actual, any know how to make autologout phpbb3 when the user logout of the GO?
mschering
Site Admin
Site Admin
Posts: 8284
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: Portlet view for phpbb3

Postby mschering » Tue Jul 14, 2009 1:34 pm

You might want to search the phpbb support forums on this topic.

I will add a logout event you can destroy the phpbb session at logout time

In classes/base/security.class.inc.php change the function logout line 125 into:

Code: Select all

function logout()
	{
		$username = isset($_SESSION['GO_SESSION']['username']) ? $_SESSION['GO_SESSION']['username'] : 'notloggedin';
		go_log(LOG_DEBUG, 'LOGOUT Username: '.$username.'; IP: '.$_SERVER['REMOTE_ADDR']);
		
		SetCookie("GO_UN","",time()-3600,"/","",!empty($_SERVER['HTTPS']),false);
		SetCookie("GO_PW","",time()-3600,"/","",!empty($_SERVER['HTTPS']),false);

		$old_session = $_SESSION;

		unset($_SESSION, $_COOKIE['GO_UN'], $_COOKIE['GO_PW']);
		
		session_destroy();
		$this->user_id = 0;
		
		global $GO_MODULES;		
		if(isset($GO_MODULES))
		{
			$GO_MODULES->load_modules();
		}

		global $GO_EVENTS;
		$GO_EVENTS->fire_event('logout', $old_session);
	}
Now you can add an event listener in a phpbb3.class.inc.php class file. Read this:

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

Merijn Schering
Intermesh

Who is online

Users browsing this forum: No registered users and 1 guest

cron