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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 03:37:45
Script start
Timing: Jan 31 2025 03:37:45
Module start 'layout'
Timing: Jan 31 2025 03:37:45
Module start 'content'
Timing: Jan 31 2025 03:37:45
Module end 'content'
Timing: Jan 31 2025 03:37:45
Script end

Main resources:

Total runtime0.0271 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 588.1406151.2109
Module start 'layout' 0.00640.0053 739.3516220.7031
Module start 'content' 0.01170.0137 960.05471,009.9297
Module end 'content' 0.02540.0016 1,969.984441.9922
Script end 0.0271  2,011.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00259.3980140.0002
Check MTime0.00103.8149140.0001
Mysql Total
Database connection0.00072.474110.0007
Mysqli_queries0.005219.060630.0017
Looping result0.00000.073910.0000
Template Total0.00124.410.0012
Template load0.00093.201210.0009
Template processing0.00031.150910.0003
Override
Cache load0.00062.094310.0006
General
dbfile0.00176.438580.0002
String conversion0.00000.033440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs