phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] Links to phpGW items


From: Tom Gasaway
Subject: Re: [Phpgroupware-developers] Links to phpGW items
Date: Wed, 18 Sep 2002 10:40:54 -0600

I implemented a feature similar to this primarily so that when calendar users
receive email about an event they have been requested to attend, the email
can contain a link directly to the Accept/Reject page.  The links look 
something like:
http://.../phpgroupware/index.php?menuaction=calendar.uicalendar.edit_status&cal_id=###&owner=###

If the user is not already logged in they first go to the login page and then 
when they 
enter their login and password they will be redirected to the desired page.
I used a cookie to pass the URL from index.php to home.php.  I also tried to 
clean
up the cookie in function check_logoutcode.  This is working for our purposes, 
but
I am not sure if this is what you are looking for.  I have included the patch 
below.

Tom

Dave Hall wrote:
> 
> Daniel & mr_e,
> 
> This is also a feature I desire.  Sime time ago I had some thoughts
> about how (but not actually tried) to implement this.  Here is my
> suggestion:
> 
> Somewhere in the login.php script file:
> 
> $server_absolute_url = ( ( !is_intger (strpos
> ($GLOBALS['phpgw_info']['server']['webserver_url'], 'http') ) && (
> strpos ($GLOBALS['phpgw_info']['server']['webserver_url'], 'http') !=0 )
> )  ? $_SERVER['SERVER_NAME'] .
> $GLOBALS['phpgw_info']['server']['webserver_url'] :
> $GLOBALS['phpgw_info']['server']['webserver_url'] );
> 
> if( !empty (trim( $_SERVER['HTTP_REFERER'] ) ) )
> {
>   $link_url = strstr( $_SERVER['HTTP_REFERER'], $server_absolute_url )
>   if( $link_url )
>   {
>     $this->t->set_var('goto', $GLOBALS['phpgw']->link($link_url);
>   }
> }
> else
> {
>   $this->t->set_var('goto', $GLOBALS['phpgw']->link($link_url);
> }
> Then somewhere in the script that checks the login:
> 
> if( !empty( $_POST['goto'] ) )
> {
>   Header('Location: ' . $GLOBALS['phpgw']->link( $_POST['goto'] ) );
>   exit;
> }
> 
> As I said I have not implemented this and it is only a concept, but it
> might give someone the inspiration to do it and I am sure people can
> improve on it.  I have not looked at that code for some time. I also
> apologie for the poor formatting ... email is not real good when you
> need the col width to be wider than 80chars :)
> 
> The other advantage is that if a user's session times out they are able
> to re login and return to where they left off.  Unfortunately they may
> still lose their very long email they were bashing out ... but they
> should have had the notify window open.
> 
> Let me know what you think.
> 
> Cheers,
> 
> skwashd
> 
> "Patrick J. Walsh (mr_e)" <address@hidden> wrote:
> >
> > Daniel,
> >
> >    You are right, there should absolutely be a mechanism for
> > redirecting to a
> > particular page after logging in.  Unfortunately, this
> > functionality does
> > not yet exist.  I've been meaning to look into making it work.
> > There's a
> > good chance there will be something that does this in CVS in the
> > near
> > future.
> >
> > ..mr_e
> >
> >
> > --On Wednesday, September 18, 2002 11:16 AM +0200,
> > --Koller Daniel <address@hidden> wrote:
> >
> > >
> > > Hello,
> > >
> > > as far as i noticed, it is at the moment not possible to provide
> > (from> outside phpgw) links, that point to links inside phpGW.
> > (For example, the
> > > new phpTree-module has a link format for downloading a certain
> > document),> but if you don't have a session, you end up with the
> > login screen (which
> > > is ok), but then you don't get redirected to where the link was
> > pointing> to.
> > >
> > > Does anybody know something about this issue, (best if somebody
> > knows> already, and can say enable this or that,...)
> > >
> > > Regards,
> > >
> > > Daniel
> > >
> > >
> > >
> > > _______________________________________________
> > > Phpgroupware-developers mailing list
> > > address@hidden
> > > http://mail.gnu.org/mailman/listinfo/phpgroupware-developers
> >
> >
> >
> >
> > _______________________________________________
> > Phpgroupware-developers mailing list
> > address@hidden
> > http://mail.gnu.org/mailman/listinfo/phpgroupware-developers
> >
diff -u ../phpgroupware.old/home.php ./home.php
--- ../phpgroupware.old/home.php        Sun Jan 13 08:34:23 2002
+++ ./home.php  Sun Aug 25 23:27:20 2002
@@ -49,6 +49,17 @@
                
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link($GLOBALS['phpgw_forward'],$extra_vars));
        }
 
+       if ($GLOBALS['HTTP_GET_VARS']['cd'] == 'yes' && 
isset($GLOBALS['HTTP_COOKIE_VARS']['REQUEST_URL']))
+       {
+               $where = 
substr(strrchr($GLOBALS['HTTP_COOKIE_VARS']['REQUEST_URL'],"/"),1);
+               if ($where != "index.php" && $where != "")
+               {
+                       
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/'.$where));
+               }
+       }
+
        if ($GLOBALS['phpgw_info']['server']['force_default_app'] && 
$GLOBALS['phpgw_info']['server']['force_default_app'] != 'user_choice')
        {
                
$GLOBALS['phpgw_info']['user']['preferences']['common']['default_app'] = 
$GLOBALS['phpgw_info']['server']['force_default_app'];
diff -u ../phpgroupware.old/index.php ./index.php
--- ../phpgroupware.old/index.php       Tue May 21 12:46:28 2002
+++ ./index.php Fri Jul 19 15:25:25 2002
@@ -15,6 +15,7 @@
        $GLOBALS['sessionid'] = @$GLOBALS['HTTP_GET_VARS']['sessionid'] ? 
@$GLOBALS['HTTP_GET_VARS']['sessionid'] : 
@$GLOBALS['HTTP_COOKIE_VARS']['sessionid'];
        if (! $GLOBALS['sessionid'])
        {
+               setcookie('REQUEST_URL',getenv(REQUEST_URI));
                Header('Location: login.php');
                exit;
        }
diff -u ../phpgroupware.old/login.php ./login.php
--- ../phpgroupware.old/login.php       Fri Feb 15 09:53:41 2002
+++ ./login.php Fri Jul 19 15:25:16 2002
@@ -93,15 +93,18 @@
                switch($code)
                {
                        case 1:
+                               Setcookie('REQUEST_URL');
                                return lang('You have been successfully logged 
out');
                                break;
                        case 2:
+                               Setcookie('REQUEST_URL');
                                return lang('Sorry, your login has expired');
                                break;
                        case 5:
                                return '<font color="FF0000">' . lang('Bad 
login or password') . '</font>';
                                break;
                        case 10:
+                               Setcookie('REQUEST_URL');
                                Setcookie('sessionid');
                                Setcookie('kp3');
                                Setcookie('domain');

reply via email to

[Prev in Thread] Current Thread [Next in Thread]