Mailing List Archive

Question regarding bug 1437 (Advanced search reverting to simple search)
So if we look at the top of the files used to do the searches
(search/story.html, media.html, etc) we see

my $advanced_search = $state->{advanced_search};
$advanced_search = get_pref('Default Search')
unless defined $advanced_search;
my $initial_search_type = 'simple';
$initial_search_type = 'advanced' if $advanced_search;

So whether or not we use advanced search depends entirely on what the
state data says about advanced search, and then if that is not defined
we go to defaults.

This wouldn't be a problem except if we look at what happens in the
onclick of "Show more options", the state data never gets updated, and
if the default search is simple, the fact that we used advanced search
never gets stored on an empty advanced search.

My question is, how do I update the state data within the onclick of
that link? Here is the current onclick code (from search/story.html,
but I believe it is uniform throughout all the search files):

<a href="#" class="small" style="margin-left: 10px;"
onclick="$('search_title').value = $('search_simple').value;
$('search-button').name = 'advanced_search';
$('search-button').onclick = $('search-type').value = 'advanced';
$('basic-search', 'advanced-search', 'clear-button').invoke('toggle');
$('button-wrap').setStyle({margin: '0 0 0 0'}); return false">Show
more options &raquo;</a>

Thanks,
Sarah Mercier
Re: Question regarding bug 1437 (Advanced search reverting to simple search) [ In reply to ]
On Apr 21, 2009, at 5:17 AM, mercie_s@denison.edu wrote:

> My question is, how do I update the state data within the onclick of
> that link? Here is the current onclick code (from search/
> story.html, but I believe it is uniform throughout all the search
> files):
>
> <a href="#" class="small" style="margin-left: 10px;" onclick="$
> ('search_title').value = $('search_simple').value; $('search-
> button').name = 'advanced_search'; $('search-button').onclick = $
> ('search-type').value = 'advanced'; $('basic-search', 'advanced-
> search', 'clear-button').invoke('toggle'); $('button-
> wrap').setStyle({margin: '0 0 0 0'}); return false">Show more
> options &raquo;</a>

You'd need to send a request to a callback on the server to store it.

Best,

David
Re: Question regarding bug 1437 (Advanced search reverting to simple search) [ In reply to ]
On Tue, 21 Apr 2009, David E. Wheeler wrote:
> On Apr 21, 2009, at 5:17 AM, mercie_s@denison.edu wrote:
>> My question is, how do I update the state data within the onclick of that
>> link? Here is the current onclick code (from search/story.html, but I
>> believe it is uniform throughout all the search files):
>>
>> <a href="#" class="small" style="margin-left: 10px;"
>> onclick="$('search_title').value = $('search_simple').value;
>> $('search-button').name = 'advanced_search'; $('search-button').onclick =
>> $('search-type').value = 'advanced'; $('basic-search', 'advanced-search',
>> 'clear-button').invoke('toggle'); $('button-wrap').setStyle({margin: '0 0 0
>> 0'}); return false">Show more options &raquo;</a>
>
> You'd need to send a request to a callback on the server to store it.

That was my first thought too,
and I was also thinking you might try changing it to use a cookie.
Re: Question regarding bug 1437 (Advanced search reverting to simple search) [ In reply to ]
On Apr 21, 2009, at 10:21 AM, Scott Lanning wrote:

> That was my first thought too,
> and I was also thinking you might try changing it to use a cookie.

Yeah, then you could probably update it with JavaScript.

David
Re: Question regarding bug 1437 (Advanced search reverting to simple search) [ In reply to ]
>> That was my first thought too,
>> and I was also thinking you might try changing it to use a cookie.
>
> Yeah, then you could probably update it with JavaScript.

So I was trying to create a cookie for this and I was just wondering,
after looking at how the other cookies being created (BRICOLAGE_AUTH,
BRICOLAGE, BRICOLAGE_MENUS) exactly where and how I should go about
creating the cookie for the search?

I was trying to do something like what is being done with the other
cookies by using the make_cookie function at the top of the
search/story.html file:

my $cookie = make_cookie->('ADV_SEARCH', 1)
unless defined $cookie;

And then trying to update it with javascript in the onclick by doing
something with document.cookie:

document.cookie = "ADV_SEARCH =" + 1;

But I must be doing something wrong because I just get logged out when
I try to view the search page. I am sorry if this is completely
wrong, I've never worked with cookies before so this is all new to me.

Suggestions? Comments? Any sort of help would be great, because I am
feeling a little lost here.

Thanks so much!
Sarah
Re: Question regarding bug 1437 (Advanced search reverting to simple search) [ In reply to ]
Hi Sarah,

Only 4 months late responding -- sorry!

On Apr 22, 2009, at 6:58 AM, mercie_s@denison.edu wrote:

>>> That was my first thought too,
>>> and I was also thinking you might try changing it to use a cookie.
>>
>> Yeah, then you could probably update it with JavaScript.
>
> So I was trying to create a cookie for this and I was just
> wondering, after looking at how the other cookies being created
> (BRICOLAGE_AUTH, BRICOLAGE, BRICOLAGE_MENUS) exactly where and how I
> should go about creating the cookie for the search?
>
> I was trying to do something like what is being done with the other
> cookies by using the make_cookie function at the top of the search/
> story.html file:
>
> my $cookie = make_cookie->('ADV_SEARCH', 1)
> unless defined $cookie;
>
> And then trying to update it with javascript in the onclick by doing
> something with document.cookie:
>
> document.cookie = "ADV_SEARCH =" + 1;
>
> But I must be doing something wrong because I just get logged out
> when I try to view the search page. I am sorry if this is
> completely wrong, I've never worked with cookies before so this is
> all new to me.
>
> Suggestions? Comments? Any sort of help would be great, because I
> am feeling a little lost here.

Can you send a patch with what you've done so far, so that I can try
to replicate the issue?

Thanks,

David
Re: Question regarding bug 1437 (Advanced search reverting to simple search) [ In reply to ]
On Aug 17, 2009, at 3:33 PM, David E. Wheeler wrote:

>> Suggestions? Comments? Any sort of help would be great, because I
>> am feeling a little lost here.
>
> Can you send a patch with what you've done so far, so that I can try
> to replicate the issue?

BTW, I believe that bug report is now here:

http://bricolage.lighthouseapp.com/projects/29601/tickets/74

Best,

David