v1.x
avatar phproberto
phproberto
2 Feb 2014

I'm sure you have noticed that when you navigate through issues and apply some filters you receive some "Expired document" errors.

The problem

Filters are sent through POST so when you click back to a page that has received a POST form you get a expired error.

Example:
Go to issues > Click on Closed > then click on an issue > then click back on browser > ERROR

Solutions

I see these solutions:

1.- Listing detects POST form

Detect POST on Listing controller and redirect to self after updating the state of the model.

We can detect the form checking if a field has been sent (example filter-status):

        // Received post form > reload to avoid expired pages
        $status = $application->input->post->get('filter-status');

        if (null != $status)
        {
            $application->redirect(
                $application->get('uri.base.path')
                . 'tracker/' . $project->alias
            );
        }

or directly any POST form:

        // Received post form > reload to avoid expired pages
        if (!empty($_POST))
        {
            $application->redirect(
                $application->get('uri.base.path')
                . 'tracker/' . $project->alias
            );
        }

2.- Send filter form to another controller

The filter form is sent to tracker/:project_alias/filter and after setting the state it redirects back to Listing

In this point we would need to move the code that populates the model state to ¿the model? Because it will be called from both Listing and Filter controllers.

I'm not sure if the populateState method is not in the framework to avoid dealing with requests on models so advice here would be appreciated.

3.- Convert filter forms to GET

The benefits here would be being able to copy&paste any filter on skype, save searches as bookmarks (i.e. you search "code style")....

The only problem are the ugly URLs (example: http://jissues.local/tracker/joomla-cms?filter-search=code+style&filter-sort=0&filter-stage=0&filter-priority=3&filter-status=0 ) but if Google can live with it maybe we too ? If we go for this I suggest to change the name of the vars to remove filter-

So what do you think is the best solution?

I think the GET forms is the more practical solution.

avatar phproberto phproberto - open - 2 Feb 2014
avatar b2z
b2z - comment - 2 Feb 2014

I think that GET is the very good option, but thinking about personal filters may be we should hold on option 1?

avatar phproberto
phproberto - comment - 2 Feb 2014

Are those personal filters intended to be private? I mean I save a filter for "code style" but can I share it? If yes the GET conversion will be good too

avatar b2z
b2z - comment - 3 Feb 2014

Are those personal filters intended to be private?

Something like this. See #1

avatar elkuku
elkuku - comment - 6 Feb 2014

I think we should go with option 3.
About the "ugly" URLs: I think we could add a "save query" option that stores the parameters to a table to generate "nice" URLS like ?search-query=123 or even ?search-query=my-search-alias

Does that make sense ?

avatar b2z
b2z - comment - 7 Feb 2014

I am not in favor for using DB to generate URLs...

avatar allenzhaocn
allenzhaocn - comment - 8 Mar 2014

I've met that problem too and I'm for option 3, I think it's good for users too.
BTW, what about changing this to AJAX with jQuery?

avatar b2z
b2z - comment - 8 Mar 2014

what about changing this to AJAX with jQuery?

I was thinking about it, but it's not so easy to implement.

avatar allenzhaocn
allenzhaocn - comment - 9 Mar 2014

@b2z What do you think if I put switching to AJAX as part of my GSoC proposal?

avatar b2z
b2z - comment - 9 Mar 2014

@allenzhaocn that could be great. Are you thinkg about the same approach that GitHub have?

avatar allenzhaocn
allenzhaocn - comment - 9 Mar 2014

@b2z Actually I don't know how github finishes that. Do you mean the Ajax way they're using or just the ui and auto-complete features?

Cheers,
Allen

在 2014年3月9日,下午6:45,Dmitry Rekun notifications@github.com 写道:

@allenzhaocn that could be great. Are you thinkg about the same approach that GitHub have?


Reply to this email directly or view it on GitHub.

avatar b2z
b2z - comment - 9 Mar 2014

I mean the way how they udpate the list on filters' change.

avatar allenzhaocn
allenzhaocn - comment - 13 Mar 2014

OK I get that, sorry I had a little misunderstanding up there, it's like we are always talking about the two things...

avatar b2z b2z - change - 13 Jul 2014
Description <p>I'm sure you have noticed that when you navigate through issues and apply some filters you receive some "Expired document" errors.</p> <h2>The problem</h2> <p>Filters are sent through POST so when you click back to a page that has received a POST form you get a expired error. </p> <p><strong>Example</strong>:<br> Go to issues &gt; Click on <em>Closed</em> &gt; then click on an issue &gt; then click back on browser &gt; ERROR</p> <h2>Solutions</h2> <p>I see these solutions:</p> <h3>1.- <code>Listing</code> detects POST form</h3> <p>Detect POST on <code>Listing</code> controller and redirect to self after updating the state of the model. </p> <p>We can detect the form checking if a field has been sent (example filter-status):</p> <div class="highlight highlight-php"><pre> <span class="c1">// Received post form &gt; reload to avoid expired pages</span> <span class="nv">$status</span> <span class="o">=</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">input</span><span class="o">-&gt;</span><span class="na">post</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'filter-status'</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="k">null</span> <span class="o">!=</span> <span class="nv">$status</span><span class="p">)</span> <span class="p">{</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">(</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'uri.base.path'</span><span class="p">)</span> <span class="o">.</span> <span class="s1">'tracker/'</span> <span class="o">.</span> <span class="nv">$project</span><span class="o">-&gt;</span><span class="na">alias</span> <span class="p">);</span> <span class="p">}</span> </pre></div> <p>or directly any POST form:</p> <div class="highlight highlight-php"><pre> <span class="c1">// Received post form &gt; reload to avoid expired pages</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">empty</span><span class="p">(</span><span class="nv">$_POST</span><span class="p">))</span> <span class="p">{</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">(</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'uri.base.path'</span><span class="p">)</span> <span class="o">.</span> <span class="s1">'tracker/'</span> <span class="o">.</span> <span class="nv">$project</span><span class="o">-&gt;</span><span class="na">alias</span> <span class="p">);</span> <span class="p">}</span> </pre></div> <h3>2.- Send filter form to another controller</h3> <p>The filter form is sent to <code>tracker/:project_alias/filter</code> and after setting the state it redirects back to <code>Listing</code></p> <p>In this point we would need to move the code that populates the model state to ¿the model? Because it will be called from both <code>Listing</code> and <code>Filter</code> controllers. </p> <p>I'm not sure if the <code>populateState</code> method is not in the framework to avoid dealing with requests on models so advice here would be appreciated.</p> <h3>3.- Convert filter forms to GET</h3> <p>The benefits here would be being able to copy&amp;paste any filter on skype, save searches as bookmarks (i.e. you search "code style")....</p> <p>The only problem are the ugly URLs (example: <a href="http://jissues.local/tracker/joomla-cms?filter-search=code+style&amp;filter-sort=0&amp;filter-stage=0&amp;filter-priority=3&amp;filter-status=0">http://jissues.local/tracker/joomla-cms?filter-search=code+style&amp;filter-sort=0&amp;filter-stage=0&amp;filter-priority=3&amp;filter-status=0</a> ) but if Google can live with it maybe we too <img class="emoji" title=":dancers:" alt=":dancers:" src="https://assets-cdn.github.com/images/icons/emoji/dancers.png" height="20" width="20" align="absmiddle"> If we go for this I suggest to change the name of the vars to remove <code>filter-</code></p> <p>So what do you think is the best solution?</p> <p>I think the GET forms is the more practical solution.</p> <p>I'm sure you have noticed that when you navigate through issues and apply some filters you receive some "Expired document" errors.</p> <h2>The problem</h2> <p>Filters are sent through POST so when you click back to a page that has received a POST form you get a expired error. </p> <p><strong>Example</strong>:<br> Go to issues &gt; Click on <em>Closed</em> &gt; then click on an issue &gt; then click back on browser &gt; ERROR</p> <h2>Solutions</h2> <p>I see these solutions:</p> <h3>1.- <code>Listing</code> detects POST form</h3> <p>Detect POST on <code>Listing</code> controller and redirect to self after updating the state of the model. </p> <p>We can detect the form checking if a field has been sent (example filter-status):</p> <div class="highlight highlight-php"><pre> <span class="c1">// Received post form &gt; reload to avoid expired pages</span> <span class="nv">$status</span> <span class="o">=</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">input</span><span class="o">-&gt;</span><span class="na">post</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'filter-status'</span><span class="p">);</span> <span class="k">if</span> <span class="p">(</span><span class="k">null</span> <span class="o">!=</span> <span class="nv">$status</span><span class="p">)</span> <span class="p">{</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">(</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'uri.base.path'</span><span class="p">)</span> <span class="o">.</span> <span class="s1">'tracker/'</span> <span class="o">.</span> <span class="nv">$project</span><span class="o">-&gt;</span><span class="na">alias</span> <span class="p">);</span> <span class="p">}</span> </pre></div> <p>or directly any POST form:</p> <div class="highlight highlight-php"><pre> <span class="c1">// Received post form &gt; reload to avoid expired pages</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">empty</span><span class="p">(</span><span class="nv">$_POST</span><span class="p">))</span> <span class="p">{</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">redirect</span><span class="p">(</span> <span class="nv">$application</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">'uri.base.path'</span><span class="p">)</span> <span class="o">.</span> <span class="s1">'tracker/'</span> <span class="o">.</span> <span class="nv">$project</span><span class="o">-&gt;</span><span class="na">alias</span> <span class="p">);</span> <span class="p">}</span> </pre></div> <h3>2.- Send filter form to another controller</h3> <p>The filter form is sent to <code>tracker/:project_alias/filter</code> and after setting the state it redirects back to <code>Listing</code></p> <p>In this point we would need to move the code that populates the model state to ¿the model? Because it will be called from both <code>Listing</code> and <code>Filter</code> controllers. </p> <p>I'm not sure if the <code>populateState</code> method is not in the framework to avoid dealing with requests on models so advice here would be appreciated.</p> <h3>3.- Convert filter forms to GET</h3> <p>The benefits here would be being able to copy&amp;paste any filter on skype, save searches as bookmarks (i.e. you search "code style")....</p> <p>The only problem are the ugly URLs (example: <a href="http://jissues.local/tracker/joomla-cms?filter-search=code+style&amp;filter-sort=0&amp;filter-stage=0&amp;filter-priority=3&amp;filter-status=0">http://jissues.local/tracker/joomla-cms?filter-search=code+style&amp;filter-sort=0&amp;filter-stage=0&amp;filter-priority=3&amp;filter-status=0</a> ) but if Google can live with it maybe we too <img class="emoji" title=":dancers:" alt=":dancers:" src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f46f.png" height="20" width="20" align="absmiddle"> If we go for this I suggest to change the name of the vars to remove <code>filter-</code></p> <p>So what do you think is the best solution?</p> <p>I think the GET forms is the more practical solution.</p>
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-07-13 16:11:41
avatar b2z b2z - close - 13 Jul 2014

Add a Comment

Login with GitHub to post a comment