Forums / Developer / Skipping last accessed URI setting

Skipping last accessed URI setting

Author Message

Piotrek Karaś

Friday 15 August 2008 5:06:11 am

In /index.php file there is this piece of code responsible for storing last accessed URIs, probably mostly for redirection purposes:

// Store the last URI for access history for login redirection
// Only if database is connected and only if there was no error or no redirects happen
if ( is_object( $db ) and $db->isConnected() and
     $module->exitStatus() == eZModule::STATUS_OK )
{
    $currentURI = $completeRequestedURI;
    if ( strlen( $currentURI ) > 0 and $currentURI[0] != '/' )
        $currentURI = '/' . $currentURI;

    $lastAccessedURI = "";
    $lastAccessedViewURI = "";

    $http = eZHTTPTool::instance();

    // Fetched stored session variables
    if ( $http->hasSessionVariable( "LastAccessesURI" ) )
    {
        $lastAccessedViewURI = $http->sessionVariable( "LastAccessesURI" );
    }
    if ( $http->hasSessionVariable( "LastAccessedModifyingURI" ) )
    {
        $lastAccessedURI = $http->sessionVariable( "LastAccessedModifyingURI" );
    }

    // Update last accessed view page
    if ( $currentURI != $lastAccessedViewURI and
         !in_array( $module->uiContextName(), array( 'edit', 'administration', 'browse', 'authentication' ) ) )
    {
        $http->setSessionVariable( "LastAccessesURI", $currentURI );
    }

    // Update last accessed non-view page
    if ( $currentURI != $lastAccessedURI )
    {
        $http->setSessionVariable( "LastAccessedModifyingURI", $currentURI );
    }
}

What I can't figure out is whether there is actually any way of skipping that, for example for one particular custom module view, without modifying the index.php file itself, of course.

Wouldn't a module declaration or in-view setting to turn off the above mechanism be a good idea in general? So that I can choose for which custom views I can skip it?

The problem I'm encountering is with an IFRAME, which is displayed in the module result part and which is loaded after the result itself, which means that IFRAME's URI is stored as last. Then, come a function that makes use of that stored URI (for example: clear cache), I get redirected to a view that is only supposed to be displayed in the IFRAME. I'm most likely to cope with that, but there could be similar problematic scenarios.

Greatly appreciate any thoughts on this.

Thanks,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

André R.

Friday 15 August 2008 12:02:52 pm

stop the execution in the end of the view is the best way at the moment for ajax views, a bit faster to (saves the rest of the code in index.php and pagelayout)

eZDB::checkTransactionCounter();
eZExecution::cleanExit();

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Friday 15 August 2008 11:25:13 pm

Yup, that should do it, thanks!
By the way - worth submitting this as an enhancement?

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

André R.

Saturday 16 August 2008 5:40:57 am

If you have a new take on it, yes.

Here are some prior attempts:
http://issues.ez.no/IssueView.php?Id=12621&activeItem=10

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Piotrek Karaś

Saturday 16 August 2008 11:41:20 pm

Nope, that should do it. Just a question: why is that issue closed? Has that been resolved in a stable release?

EDIT: <b>Won't Implement</b> status... why? ;)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

André R.

Sunday 17 August 2008 7:17:52 am

> EDIT: Won't Implement status... why? ;)

I closed my own issue since I thought I could solve it in a extension.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom