| | 27 | } |
| | 28 | |
| | 29 | function toggleFilter() { |
| | 30 | var filterActive = getByID("filter-title"); |
| | 31 | if (filterActive.style.display == "none") { |
| | 32 | filterActive.style.display = "block"; |
| | 33 | getByID("filter-select").style.display = "none"; |
| | 34 | } else { |
| | 35 | filterActive.style.display = "none"; |
| | 36 | getByID("filter-select").style.display = "block"; |
| | 37 | <mt:unless name="filter">setFilterCol('status');</mt:unless> |
| | 38 | } |
| | 39 | } |
| | 40 | |
| | 41 | function setFilterCol(choice) { |
| | 42 | var sel = getByID('filter-select'); |
| | 43 | if (!sel) return; |
| | 44 | sel.className = "filter-" + choice; |
| | 45 | if (choice != 'none') { |
| | 46 | var fld = getByID('filter-col'); |
| | 47 | if (choice == 'status') |
| | 48 | fld.selectedIndex = 0; |
| | 49 | else if (choice == 'author_id') |
| | 50 | fld.selectedIndex = 1; |
| | 51 | else if (choice == 'exacttag') |
| | 52 | fld.selectedIndex = 2; |
| | 53 | else if (choice == 'normalizedtag') |
| | 54 | fld.selectedIndex = 3; |
| | 55 | else if (choice == 'category_id') |
| | 56 | fld.selectedIndex = 4; |
| | 57 | else if (choice == 'asset_id') |
| | 58 | fld.selectedIndex = <mt:if name="category_loop">5<mt:else>4</mt:if>; |
| | 59 | col_span = getByID("filter-text-col"); |
| | 60 | if (fld.selectedIndex > -1 && col_span) |
| | 61 | col_span.innerHTML = '<strong>' + fld.options[fld.selectedIndex].text + '</strong>'; |
| | 62 | } |
| | 63 | } |
| | 64 | |
| | 65 | function enableFilterButton(fld) { |
| | 66 | if (fld && (fld.id == "author_id-val" || fld.id == "asset_id-val")) { |
| | 67 | var opt = fld.options[fld.selectedIndex]; |
| | 68 | if (opt.id == 'filter-user-search') { |
| | 69 | <mt:if name="object_type" eq="entry"> |
| | 70 | window.location = ScriptURI + '?__mode=search_replace&_type=author&entry_type=entry'; |
| | 71 | <mt:else> |
| | 72 | window.location = ScriptURI + '?__mode=search_replace&_type=author&entry_type=page'; |
| | 73 | </mt:if> |
| | 74 | } |
| | 75 | else if (opt.id == 'filter-asset-search') { |
| | 76 | window.location = ScriptURI + '?__mode=search_replace&_type=asset'; |
| | 77 | } |
| | 78 | else { |
| | 79 | if (opt.value == "") { |
| | 80 | getByID("filter-button").style.display = "none"; |
| | 81 | return; |
| | 82 | } |
| | 83 | } |
| | 84 | } else if (fld && (fld.id == "filter-col")) { |
| | 85 | var opt = fld.options[fld.selectedIndex]; |
| | 86 | if (opt.value == 'author_id') { |
| | 87 | var authfld = getByID("author_id-val"); |
| | 88 | var authopt = authfld.options[authfld.selectedIndex]; |
| | 89 | if (authopt.value == "") { |
| | 90 | getByID("filter-button").style.display = "none"; |
| | 91 | return; |
| | 92 | } |
| | 93 | } |
| | 94 | } |
| | 95 | getByID("filter-button").style.display = "inline"; |
| | 175 | |
| | 176 | <div class="listing-filter"> |
| | 177 | <div class="listing-filter-inner inner pkg"> |
| | 178 | <form id="filter-form" method="get" action="<mt:var name="mt_url">"> |
| | 179 | <input type="hidden" name="__mode" value="<mt:var name="mode">" /> |
| | 180 | <mt:if name="id"> |
| | 181 | <input type="hidden" name="id" value="<mt:var name="id">" /> |
| | 182 | </mt:if> |
| | 183 | <mt:if name="is_power_edit"> |
| | 184 | <input type="hidden" name="is_power_edit" value="1" /> |
| | 185 | </mt:if> |
| | 186 | <input id="filter" type="hidden" name="filter" value="" /> |
| | 187 | <input id="filter_val" type="hidden" name="filter_val" value="" /> |
| | 188 | </form> |
| | 189 | <form id="filter-select-form" method="get" onsubmit="return execFilter(this)"> |
| | 190 | <div class="filter"> |
| | 191 | <div id="filter-title"> |
| | 192 | <mt:if name="filter_key"> |
| | 193 | <strong>Showing only: <mt:var name="filter_label" escape="html"></strong> |
| | 194 | <a class="filter-link" href="<mt:var name="script_url">?__mode=<mt:var name="mode">&id=<mt:var name="id">">[ Remove filter ]</a> |
| | 195 | <mt:else> |
| | 196 | <mt:if name="filter"> |
| | 197 | <mt:else> |
| | 198 | <strong>All stream actions</strong> |
| | 199 | <a class="filter-link" href="javascript:void(0)" onclick="toggleFilter()">[ change ]</a> |
| | 200 | </mt:if> |
| | 201 | </mt:if> |
| | 202 | </div> |
| | 203 | <div id="filter-select" class="page-title" style="display: none"> |
| | 204 | Show only actions where |
| | 205 | <select id="filter-col" name="filter" onchange="setFilterCol(this.options[this.selectedIndex].value); enableFilterButton(this)"> |
| | 206 | <!-- option value="stream">stream</option --> |
| | 207 | <option value="service">service</option> |
| | 208 | </select> |
| | 209 | is |
| | 210 | <span id="filter-service"> |
| | 211 | <select id="service-val" name="filter_val" onchange="enableFilterButton()"> |
| | 212 | <mt:loop name="services"> |
| | 213 | <option value="<mt:var name="service_id">"><mt:var name="service_name"></option> |
| | 214 | </mt:loop> |
| | 215 | </select> |
| | 216 | </span> |
| | 217 | |
| | 218 | <span class="buttons"> |
| | 219 | <a href="javascript:void(0)" |
| | 220 | id="filter-button" |
| | 221 | onclick="return execFilter(getByID('filter-select-form'))" |
| | 222 | type="submit" |
| | 223 | >Filter</a> |
| | 224 | <a href="javascript:void(0)" |
| | 225 | onclick="toggleFilter(); return false" |
| | 226 | type="submit" |
| | 227 | >Cancel</a> |
| | 228 | </span> |
| | 229 | </div> |
| | 230 | </div> |
| | 231 | </form> |
| | 232 | </div> |
| | 233 | </div> |