Cleanup the search code in preparation for removal of the shim-layer,
use a static button and don't send extraneous GET parameters - Legacy-Id: 5464
This commit is contained in:
parent
833437aa8d
commit
a43ccee911
|
@ -1,37 +0,0 @@
|
|||
{% comment %}
|
||||
Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of the Nokia Corporation and/or its
|
||||
subsidiary(-ies) nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{% endcomment %}
|
||||
{% load ietf_filters %}<td class="date">{% if not doc.rfc %}{{ doc.publication_date }}{% else %}{{ doc.publication_date|date:"Y-m" }}{% endif %}
|
||||
{% if doc.publication_date|timesince_days|new_enough:request %}<br/><span class="ietf-small ietf-highlight-y">{% if not doc.rfc%}<a href="http:{{rfcdiff_prefix}}?url2={{doc.id.draft_name_and_revision}}">new</a>{%else%}new{%endif%}</span>{%endif%}
|
||||
{% if doc.id and doc.id.expected_expiration_date and doc.id.expected_expiration_date|timesince_days|expires_soon:request %}<br/><span class="ietf-small ietf-highlight-y">expires soon</span>{%endif%}
|
||||
</td>
|
|
@ -77,11 +77,6 @@ about:
|
|||
{% endif %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
{% block scripts %}
|
||||
YAHOO.util.Event.onContentReady("search_submit_button", function () {
|
||||
var oButton = new YAHOO.widget.Button("search_submit_button", {});
|
||||
});
|
||||
{% endblock scripts %}
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript" src="/js/doc-search.js"></script>
|
||||
|
|
|
@ -32,54 +32,46 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
{% endcomment %}
|
||||
|
||||
<form name="search_form" id="search_form" class="search_form" action="/doc/search/" method="get" {# onsubmit="submitSearch();return false;" #}>
|
||||
<form id="search_form" class="search_form" action="/doc/search/" method="get">
|
||||
|
||||
<div class="search_field">
|
||||
<label>Name/number/title:</label> {{ form.name }}
|
||||
</div>
|
||||
|
||||
<div class="search_field">
|
||||
<label>Types:</label>
|
||||
<table id="search_types">
|
||||
<tr><td>{{ form.rfcs }} RFCs</td></tr>
|
||||
<tr><td>{{ form.activeDrafts }} Internet-Drafts (active)</td></tr>
|
||||
<tr><td>{{ form.oldDrafts }} Internet-Drafts (expired/replaced/withdrawn)</td></tr>
|
||||
</table>
|
||||
<label>Types:</label>
|
||||
<table id="search_types">
|
||||
<tr><td><label>{{ form.rfcs }} RFCs</label></td></tr>
|
||||
<tr><td><label>{{ form.activeDrafts }} Internet-Drafts (active)</label></td></tr>
|
||||
<tr><td><label>{{ form.oldDrafts }} Internet-Drafts (expired/replaced/withdrawn)</label></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<span class="toggle_advanced"><b><img src="/images/{% if meta.advanced %}minus{% else %}plus{% endif %}.png" alt="" id="search_advanced-img" /> Advanced</b></span>
|
||||
<b class="toggle_advanced"><img src="/images/{% if meta.advanced %}minus{% else %}plus{% endif %}.png" alt="" /> Advanced</b>
|
||||
|
||||
<div id="search_advanced" style="{% if not meta.advanced %}display:none;{%endif%}margin-top:1em;">
|
||||
<div id="search_advanced" style="{% if not meta.advanced %}display:none;{%endif%}">
|
||||
Additional search criteria:
|
||||
|
||||
<div class="search_field">
|
||||
<label><input type="radio" class="radio" name="by" value="author" {% ifequal meta.by "author" %}checked="checked"{% endifequal %}/> Author (last name):</label> {{ form.author }}
|
||||
<label><input type="radio" class="radio" name="by" value="author" {% if meta.by == "author" %}checked="checked"{% endif %}/> Author (last name):</label> {{ form.author }}
|
||||
</div>
|
||||
<div class="search_field">
|
||||
<label><input type="radio" class="radio" name="by" value="group" {% ifequal meta.by "group" %}checked="checked"{% endifequal %}/> WG:</label> {{ form.group }}
|
||||
<label><input type="radio" class="radio" name="by" value="group" {% if meta.by == "group" %}checked="checked"{% endif %}/> WG:</label> {{ form.group }}
|
||||
</div>
|
||||
<div class="search_field">
|
||||
<label><input type="radio" class="radio" name="by" value="area" {% ifequal meta.by "area" %}checked="checked"{% endifequal %}/> Area:</label> {{ form.area }}
|
||||
<label><input type="radio" class="radio" name="by" value="area" {% if meta.by == "area" %}checked="checked"{% endif %}/> Area:</label> {{ form.area }}
|
||||
</div>
|
||||
<div class="search_field">
|
||||
<label><input type="radio" class="radio" name="by" value="ad" {% ifequal meta.by "ad" %}checked="checked"{% endifequal %}/> Responsible AD:</label> {{ form.ad }}
|
||||
<label><input type="radio" class="radio" name="by" value="ad" {% if meta.by == "ad" %}checked="checked"{% endif %}/> Responsible AD:</label> {{ form.ad }}
|
||||
</div>
|
||||
<div class="search_field">
|
||||
<label><input type="radio" class="radio" name="by" value="state" {% ifequal meta.by "state" %}checked="checked"{% endifequal %}/> IESG State:</label> {{ form.state }} :: {{ form.subState }}
|
||||
<label><input type="radio" class="radio" name="by" value="state" {% if meta.by == "state" %}checked="checked"{% endif %}/> IESG State:</label> {{ form.state }} :: {{ form.subState }}
|
||||
</div>
|
||||
{% comment %}
|
||||
<div class="search_field" style="text-decoration:line-through;color:#808080;">
|
||||
<label>Ballot position:</label> {{ form.positionAd }} has position {{ form.positionValue }}
|
||||
</div>
|
||||
{% endcomment %}
|
||||
|
||||
</div><!-- end of advanced -->
|
||||
|
||||
<div style="padding-top:0.5em;">
|
||||
{# <input type="hidden" name="ajax" value="" /> #}
|
||||
<span class="first-child">
|
||||
<button type="submit" name="search_submit" id="id_search_submit">Search</button>
|
||||
</span>
|
||||
<div class="submit">
|
||||
<input type="submit" class="button" value="Search"/>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
|
@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% block content %}
|
||||
<h1>Internet-Drafts and RFCs</h1>
|
||||
|
||||
<div class="ietf-box search_form_box">
|
||||
<div class="ietf-box search-form-box">
|
||||
{% include "idrfc/search_form.html" %}
|
||||
</div>
|
||||
|
||||
|
@ -48,32 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% endif %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
{% block scripts %}
|
||||
YAHOO.util.Event.onContentReady("search_submit_button", function () {
|
||||
var oButton = new YAHOO.widget.Button("search_submit_button", {});
|
||||
});
|
||||
{% if meta.searching %}
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
$('.addtolist a').click(function() {
|
||||
var trigger = $(this);
|
||||
$.ajax({
|
||||
url: trigger.attr('href'),
|
||||
type: 'GET',
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function(response){
|
||||
if (response.success) {
|
||||
trigger.replaceWith('added');
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
{% endif %}
|
||||
{% endblock scripts %}
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript" src="/js/doc-search.js"></script>
|
||||
|
|
|
@ -35,7 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% load ietf_filters %}
|
||||
{% load ballot_icon %}
|
||||
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
|
||||
{% if user.is_authenticated and show_add_to_list %}
|
||||
{% if show_add_to_list and user.is_authenticated %}
|
||||
<td class="addtolist">
|
||||
{% if doc.id %}
|
||||
<a href="{% url community_add_document doc.id.draft_name %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a>
|
||||
|
@ -51,7 +51,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% endif %}
|
||||
</td>
|
||||
<td class="title">{{ doc.title }}</td>
|
||||
{% include "idrfc/date_column.html" %}
|
||||
|
||||
<td class="date">{% if not doc.rfc %}{{ doc.publication_date }}{% else %}{{ doc.publication_date|date:"Y-m" }}{% endif %}
|
||||
{% if doc.publication_date|timesince_days|new_enough:request %}<br/><span class="ietf-small ietf-highlight-y">{% if not doc.rfc%}<a href="http:{{rfcdiff_prefix}}?url2={{doc.id.draft_name_and_revision}}">new</a>{%else%}new{%endif%}</span>{%endif%}
|
||||
{% if doc.id and doc.id.expected_expiration_date and doc.id.expected_expiration_date|timesince_days|expires_soon:request %}<br/><span class="ietf-small ietf-highlight-y">expires soon</span>{%endif%}
|
||||
</td>
|
||||
|
||||
{% include "idrfc/status_columns.html" %}
|
||||
{% include "idrfc/ipr_column.html" %}
|
||||
{# <td class="ad">{% if doc.ad_name %}{{ doc.ad_name }}{% else %} {% endif %}</td> #}
|
||||
|
|
|
@ -38,19 +38,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
{% if not docs %}
|
||||
<p><b>No documents match your query.</b></p>
|
||||
{% else %}
|
||||
{% regroup docs by view_sort_group as grouped_docs %}
|
||||
|
||||
<table class="ietf-table ietf-doctable">
|
||||
<tr>{% if user.is_authenticated %}<th></th>{% endif %}
|
||||
{% for hdr in meta.hdrs %}
|
||||
{% include "idrfc/table_header.html" %}
|
||||
{% endfor %}
|
||||
<tr>
|
||||
{% if user.is_authenticated %}<th></th>{% endif %}
|
||||
|
||||
{% for hdr in meta.hdrs %}
|
||||
<th class="{{ hdr.htype }}" {% if hdr.colspan %}colspan="{{ hdr.colspan }}"{% endif %}>
|
||||
{{ hdr.htitle }}
|
||||
|
||||
<a href="{{ meta.rqps }}&sortBy={{hdr.htype}}"><img src="/images/sort-header-{% if hdr.selected %}filled{% else %}clear{% endif %}.png"/></a>
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
<!-- <tr><th></th><th class="doc">Document</th><th class="title">Title</th><th class="date">Date</th><th class="status" colspan="2">Status</th><th class="ad">Area Director</th></tr> -->
|
||||
{% for doc_group in grouped_docs %}
|
||||
<tr class="header"><td colspan="7">{{doc_group.grouper}}s</td></tr>
|
||||
{% regroup docs by view_sort_group as grouped_docs %}
|
||||
{% for doc_group in grouped_docs %}
|
||||
<tr class="header"><td colspan="7">{{ doc_group.grouper }}s</td></tr>
|
||||
|
||||
{% with 1 as show_add_to_list %}
|
||||
{% for doc in doc_group.list %}
|
||||
{% include "idrfc/search_result_row.html" %}
|
||||
{% include "idrfc/search_result_row.html" %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
{# Copyright The IETF Trust 2011, All Rights Reserved #}
|
||||
|
||||
<th class="{{hdr.htype}}"{% if hdr.colspan %}colspan="{{ hdr.colspan }}" {% endif %}
|
||||
onclick="location=unescape('{{ meta.rqps }}&sortBy={{hdr.htype}}');"
|
||||
style="white-space: nowrap;"
|
||||
>
|
||||
<span>
|
||||
<label>{{hdr.htitle}}</label>
|
||||
{% if hdr.selected %}
|
||||
<img style="border-style: none;vertical-align:top" src="/images/sort-header-filled.png"/>
|
||||
{% else %}
|
||||
<img style="border-style: none;vertical-align:top" src="/images/sort-header-clear.png"/>
|
||||
{% endif %}
|
||||
</span>
|
||||
</th>
|
|
@ -10,7 +10,7 @@ label { float:left; width: 200px; }
|
|||
|
||||
<h1>IPR Search</h1>
|
||||
<h2>Document Search</h2>
|
||||
<div class="ietf-box search_form_box">
|
||||
<div class="ietf-box search-form-box">
|
||||
<form method="get">
|
||||
<input type="hidden" name="option" value="document_search">
|
||||
|
||||
|
|
|
@ -82,13 +82,16 @@ body { margin: 0; }
|
|||
.ietf-stream .entry-title .entry-date { float: right; }
|
||||
.ietf-stream .entry-comment { background: #eeeeee; margin: 1em 0px; padding: 1em; }
|
||||
|
||||
.search_form_box {width: 99.5%; margin-top:8px; padding:4px; margin-bottom:1em; padding-left:8px;}
|
||||
.search-form-box { width: 99.5%; margin-top:8px; padding:4px; margin-bottom:1em; padding-left:8px; }
|
||||
form#search_form { padding-top: 4px; padding-bottom: 4px; }
|
||||
#search_form .submit { padding-top: 0.5em; }
|
||||
#search_form .submit .button { padding: 0.2em 0.5em; border: 1px solid #999; }
|
||||
#search_form input { padding: 0; padding-left: 2px; border: 1px solid #89d;}
|
||||
#search_form input.radio { padding-left: 0; border: 0; }
|
||||
#search_form input.radio { padding-left: 0; border: 0; }
|
||||
#search_form select { border: 1px solid #89d; }
|
||||
#search_form div.search_field { margin-top:2px; clear:both;}
|
||||
#search_form label { width: 170px; float: left; }
|
||||
#search_form .search_field > label { width: 170px; float: left; }
|
||||
#search_form #search_advanced { margin-top: 1em; }
|
||||
/* checkboxes for document types */
|
||||
#search_form table#search_types { border-collapse:collapse;}
|
||||
#search_form #search_types td { padding:0; }
|
||||
|
@ -106,12 +109,13 @@ table.ietf-table { border-collapse:collapse; border:1px solid #7f7f7f; }
|
|||
.ietf-table tr.evenrow { background-color: #EDF5FF; }
|
||||
.ietf-table tr.oddrow { background-color: white; }
|
||||
.ietf-table td { border-right: 1px solid #cbcbcb; padding:3px 6px; vertical-align: top; }
|
||||
.ietf-table th { color:white; background: #2647A0; text-align:left; padding:3px 6px; border-right: 1px solid #7f7f7f; }
|
||||
.ietf-table th { color: #fff; background: #2647A0; text-align: left; padding:3px 6px; border-right: 1px solid #7f7f7f; }
|
||||
|
||||
.ietf-doctable tr.header { border-top: 1px solid #7f7f7f; border-bottom: 1px solid #7f7f7f; border-left: 1px solid white; border-right:2px solid white;}
|
||||
.ietf-doctable tr.header td {padding: 6px 6px; font-weight: bold; }
|
||||
.ietf-doctable table { max-width: 1200px; }
|
||||
.ietf-doctable th { cursor: pointer }
|
||||
.ietf-doctable th { cursor: pointer; white-space: nowrap; }
|
||||
.ietf-doctable th img { border-style: none; vertical-align: top; }
|
||||
.ietf-doctable th.doc, .ietf-doctable td.doc { min-width:20em; max-width: 35em; }
|
||||
.ietf-doctable th.title, .ietf-doctable td.title { min-width: 20em; max-width: 35em; }
|
||||
.ietf-doctable th.date, .ietf-doctable td.date { white-space:nowrap; min-width: 6em;}
|
||||
|
@ -206,12 +210,13 @@ table.milestones .doc { display: block; padding-left: 1em; }
|
|||
|
||||
.stream-state .milestone { display: inline-block; font-size: smaller; background-color: #d5dde6; padding: 0 0.2em; margin-left: 0.3em; }
|
||||
|
||||
.button {
|
||||
.button, .button:hover:disabled {
|
||||
display: inline-block; padding: 4px 12px; margin-right: 0.3em;
|
||||
color: #222; font-weight: normal; text-align: center; text-decoration: none; outline: none; cursor: pointer;
|
||||
background: #eee; background: linear-gradient(#fff, #ddd); background: -webkit-linear-gradient(#fff, #ddd); background: -moz-linear-gradient(#fff, #ddd);
|
||||
background: #eee; background: linear-gradient(#fff, #e0e0e0); background: -webkit-linear-gradient(#fff, #e0e0e0); background: -moz-linear-gradient(#fff, #e0e0e0);
|
||||
border: 1px solid #666; border-radius: 3px;
|
||||
transition-duration: 0.2s;
|
||||
}
|
||||
.button:hover { color: #111; background: #ddd; background: linear-gradient(#eee, #ccc); background: -webkit-linear-gradient(#eee, #ccc); background: -moz-linear-gradient(#eee, #ccc); }
|
||||
.button:active { color: #000; background: #ccc; }
|
||||
.button:disabled, .button:hover:disabled { color: #999; cursor: default; }
|
||||
|
|
|
@ -1,86 +1,77 @@
|
|||
$(function () {
|
||||
var form = jQuery("#search_form");
|
||||
|
||||
form.find(".search_field input[name=by]").parents("label").click(changeBy);
|
||||
|
||||
form.find(".search_field").find("input,select")
|
||||
.change(toggleSubmit).click(toggleSubmit).keyup(toggleSubmit);
|
||||
|
||||
form.find(".toggle_advanced").click(function () {
|
||||
togglePlusMinus("search_advanced");
|
||||
form.find('.search_field input[type="radio"]').attr("checked", false);
|
||||
changeBy();
|
||||
});
|
||||
|
||||
changeBy();
|
||||
|
||||
// we want to disable our submit button if we have no search text,
|
||||
// we want to disable our submit button if we have no search text,
|
||||
// and we have no advanced options selected
|
||||
function toggleSubmit() {
|
||||
var button = document.getElementById("id_search_submit");
|
||||
var by = findCheckedSearchBy();
|
||||
var value = findSearchByValue(by);
|
||||
var text = document.getElementById("id_name");
|
||||
if ((value == "") && (text.value == "")) {
|
||||
button.disabled = true;
|
||||
} else {
|
||||
button.disabled = false;
|
||||
}
|
||||
var nameSearch = $.trim($("#id_name").val());
|
||||
|
||||
var noAdvanced = true;
|
||||
|
||||
var by = form.find("input[name=by]:checked");
|
||||
if (by.length > 0)
|
||||
by.closest(".search_field").find("input,select").not("input[name=by]").each(function () {
|
||||
if ($.trim(this.value))
|
||||
noAdvanced = false;
|
||||
});
|
||||
|
||||
form.find("input[type=submit]").get(0).disabled = !nameSearch && noAdvanced;
|
||||
}
|
||||
|
||||
function togglePlusMinus(id) {
|
||||
var el = document.getElementById(id);
|
||||
var imgEl = document.getElementById(id+"-img");
|
||||
if (el.style.display == 'none') {
|
||||
el.style.display = 'block';
|
||||
imgEl.src = "/images/minus.png";
|
||||
function togglePlusMinus(toggler, toggled) {
|
||||
var img = toggler.find("img").get(0);
|
||||
if (toggled.is(":hidden")) {
|
||||
toggled.show();
|
||||
img.src = "/images/minus.png";
|
||||
} else {
|
||||
el.style.display = 'none';
|
||||
imgEl.src = "/images/plus.png";
|
||||
toggled.hide();
|
||||
img.src = "/images/plus.png";
|
||||
}
|
||||
}
|
||||
|
||||
function findCheckedSearchBy() {
|
||||
var by='';
|
||||
var f = document.search_form;
|
||||
for (var i = 0; i < f.by.length; i++) {
|
||||
if (f.by[i].checked) {
|
||||
by = f.by[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return by;
|
||||
}
|
||||
function updateBy() {
|
||||
form.find("input[name=by]:checked").closest(".search_field").find("input,select").not("input[name=by]").each(function () {
|
||||
this.disabled = false;
|
||||
});
|
||||
|
||||
function findSearchByValue(by) {
|
||||
if (by == 'author') { return document.getElementById("id_author").value; }
|
||||
if (by == 'group') { return document.getElementById("id_group").value; }
|
||||
if (by == 'area') { return document.getElementById("id_area").value; }
|
||||
if (by == 'ad') { return document.getElementById("id_ad").value; }
|
||||
if (by == 'state') {
|
||||
// state might be state...
|
||||
state_value = document.getElementById("id_state").value;
|
||||
if (state_value) { return state_value; }
|
||||
// ...or sub-state
|
||||
return document.getElementById("id_subState").value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function changeBy() {
|
||||
var by = findCheckedSearchBy();
|
||||
var f = document.search_form;
|
||||
f.author.disabled=true;
|
||||
f.group.disabled=true;
|
||||
f.area.disabled=true;
|
||||
f.ad.disabled=true;
|
||||
f.state.disabled=true; f.subState.disabled=true;
|
||||
if (by=='author') { f.author.disabled=false;}
|
||||
if (by=='group') { f.group.disabled=false;}
|
||||
if (by=='area') { f.area.disabled=false;}
|
||||
if (by=='ad') { f.ad.disabled=false; }
|
||||
if (by=='state') { f.state.disabled=false; f.subState.disabled=false; }
|
||||
form.find("input[name=by]").not(":checked").closest(".search_field").find("input,select").not("input[name=by]").each(function () {
|
||||
this.disabled = true;
|
||||
});
|
||||
|
||||
toggleSubmit();
|
||||
}
|
||||
|
||||
form.find(".search_field input[name=by]").closest("label").click(updateBy);
|
||||
|
||||
form.find(".search_field input,select")
|
||||
.change(toggleSubmit).click(toggleSubmit).keyup(toggleSubmit);
|
||||
|
||||
form.find(".toggle_advanced").click(function () {
|
||||
var advanced = $(this).next();
|
||||
advanced.find('.search_field input[type="radio"]').attr("checked", false);
|
||||
togglePlusMinus($(this), advanced);
|
||||
updateBy();
|
||||
});
|
||||
|
||||
updateBy();
|
||||
|
||||
$("#search_results th").click(function (e) {
|
||||
window.location = $(this).find("a").attr("href");
|
||||
})
|
||||
|
||||
$('#search_results .addtolist a').click(function(e) {
|
||||
e.preventDefault();
|
||||
var trigger = $(this);
|
||||
$.ajax({
|
||||
url: trigger.attr('href'),
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function(response){
|
||||
if (response.success) {
|
||||
trigger.replaceWith('added');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue