[22201] | 1 | <div class="titrePage"> |
---|
| 2 | <h2>RV Autocomplete {$TABSHEET_TITLE}</h2> |
---|
| 3 | </div> |
---|
| 4 | |
---|
| 5 | <div id="acFormContainer" style="text-align:left"> |
---|
| 6 | <form> |
---|
| 7 | <table> |
---|
| 8 | <tr> |
---|
| 9 | <td> |
---|
[22375] | 10 | <label for=ac_name style="min-width:100px">{'Query:'|@translate}</label> |
---|
[22201] | 11 | </td> |
---|
| 12 | <td> |
---|
| 13 | <input id="ac_name" type="text" size="48"> |
---|
| 14 | </td> |
---|
| 15 | </tr> |
---|
| 16 | <tr> |
---|
| 17 | <td colspan=2> |
---|
[22375] | 18 | <small>{'Use <b>\</b> to break search (e.g. Central Park\, NY will not match NY but it will display it)'|@translate} |
---|
[22201] | 19 | </small> |
---|
| 20 | </td> |
---|
| 21 | </tr> |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | <tr> |
---|
| 25 | <td> |
---|
[22375] | 26 | <label for=ac_counter>{'Weight:'|@translate}</label> |
---|
[22201] | 27 | </td> |
---|
| 28 | <td> |
---|
| 29 | <input id="ac_counter" type="text" size="3"> |
---|
| 30 | </td> |
---|
| 31 | </tr> |
---|
| 32 | |
---|
| 33 | <tr> |
---|
| 34 | <td> |
---|
[27564] | 35 | <label for=ac_level>{'Privacy level'|@translate}:</label> |
---|
| 36 | </td> |
---|
| 37 | <td> |
---|
| 38 | <select id="ac_level"> |
---|
| 39 | {foreach $available_permission_levels as $level=>$label} |
---|
| 40 | <option value="{$level}">{$label}</option> |
---|
| 41 | {/foreach} |
---|
| 42 | </select> |
---|
| 43 | </td> |
---|
| 44 | </tr> |
---|
| 45 | |
---|
| 46 | <tr> |
---|
| 47 | <td> |
---|
[22375] | 48 | <label for=ac_url>{'Url:'|@translate}</label> |
---|
[22201] | 49 | </td> |
---|
| 50 | <td> |
---|
| 51 | <input id="ac_url" type="text" size="48"> |
---|
| 52 | </td> |
---|
| 53 | </tr> |
---|
| 54 | |
---|
| 55 | <tr> |
---|
| 56 | <td colspan=2> |
---|
[22375] | 57 | <small>{'Leave empty for automatic gallery search <br>OR enter an url ($r/ at the start of url means this gallery)<br>OR enter q=Term to search for a specific term'|@translate} |
---|
[22201] | 58 | </small> |
---|
| 59 | </td> |
---|
| 60 | </tr> |
---|
| 61 | </table> |
---|
| 62 | </form> |
---|
| 63 | </div> |
---|
| 64 | |
---|
[22375] | 65 | <p><a class="openAddNew">{'Create a new suggestion'|@translate}</a></p> |
---|
[22201] | 66 | <table id="csTable" class="table2"> |
---|
| 67 | <thead> |
---|
| 68 | <tr class="throw"> |
---|
[27564] | 69 | <th class="dtc_Name">{'Name'|@translate}</th> |
---|
| 70 | <th class="dtc_Weight">{'Weight'|@translate}</th> |
---|
| 71 | <th class="dtc_Level">{'Privacy level'|@translate}</th> |
---|
| 72 | <th class="dtc_Url">{'URL'|@translate}</th> |
---|
| 73 | <th class="dtc_Actions">{'Actions'|@translate}</th> |
---|
[22201] | 74 | </tr> |
---|
| 75 | </thead> |
---|
| 76 | <tbody> |
---|
| 77 | </tbody> |
---|
| 78 | </table> |
---|
| 79 | |
---|
[22375] | 80 | <p><a class="openAddNew">{'Create a new suggestion'|@translate}</a></p> |
---|
[22201] | 81 | |
---|
| 82 | {include file='include/colorbox.inc.tpl'} |
---|
| 83 | |
---|
| 84 | {combine_css path="themes/default/js/ui/theme/jquery.ui.core.css"} |
---|
| 85 | {combine_css path="themes/default/js/ui/theme/jquery.ui.button.css"} |
---|
| 86 | {combine_css path="themes/default/js/ui/theme/jquery.ui.dialog.css"} |
---|
| 87 | {combine_css path="themes/default/js/ui/theme/jquery.ui.theme.css"} |
---|
| 88 | |
---|
| 89 | {combine_script id="jquery.ui.dialog" load="footer" require="jquery.ui.button"} |
---|
| 90 | {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} |
---|
| 91 | |
---|
| 92 | |
---|
[25546] | 93 | {combine_script id="jquery.dataTables" load="footer" path="themes/default/js/plugins/jquery.dataTables.js"} |
---|
[22201] | 94 | |
---|
| 95 | {html_style}{literal} |
---|
| 96 | .ui-accordion-header-icon {display: none} |
---|
| 97 | |
---|
| 98 | .dtBar { |
---|
| 99 | text-align: right; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | .dtBar DIV { |
---|
| 103 | display: inline; |
---|
| 104 | padding-right: 10px; |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | #csTable_filter { |
---|
| 108 | display: block; |
---|
| 109 | float: left; |
---|
| 110 | padding-left: 10px; |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | .dataTables_paginate A { |
---|
| 114 | padding-left: 3px; |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | #csTable TH { |
---|
| 118 | cursor: pointer; |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | .sorting_asc:after { content: " \2193" } |
---|
| 122 | .sorting_desc:after { content: " \2191" } |
---|
| 123 | {/literal}{/html_style} |
---|
| 124 | |
---|
| 125 | {footer_script} |
---|
[27564] | 126 | var SHelper = { |
---|
[22201] | 127 | |
---|
| 128 | rowFromNode: function(node) { |
---|
| 129 | return $(node).parents("tr"); |
---|
| 130 | }, |
---|
| 131 | |
---|
| 132 | zoom: function(url){ |
---|
| 133 | jQuery.colorbox( { |
---|
| 134 | href: url, |
---|
| 135 | iframe: 1, |
---|
| 136 | width: "90%", height: "90%" |
---|
| 137 | }); |
---|
| 138 | return false; |
---|
| 139 | }, |
---|
| 140 | |
---|
| 141 | del: function(node){ |
---|
| 142 | if (!confirm("Are you sure?")) return false; |
---|
| 143 | var row = SHelper.rowFromNode(node) |
---|
[27564] | 144 | , item=dataTable.fnGetData(row[0]); |
---|
[22201] | 145 | |
---|
| 146 | row.fadeTo(500, 0.4); |
---|
| 147 | (new PwgWS("")).callService( |
---|
[27564] | 148 | "rvac.delCustom", { id: item.id}, |
---|
[22201] | 149 | { |
---|
| 150 | method: "POST", |
---|
| 151 | onFailure: function(num, text) { row.stop(); row.fadeTo(0,1); alert(num + " " + text); }, |
---|
| 152 | onSuccess: function(result) { |
---|
| 153 | dataTable.fnDeleteRow( row[0] ); |
---|
| 154 | } |
---|
| 155 | } |
---|
| 156 | ); |
---|
| 157 | |
---|
| 158 | return false; |
---|
| 159 | }, |
---|
| 160 | |
---|
| 161 | add: function() { |
---|
| 162 | $("#ac_name,#ac_counter,#ac_url").val( "" ); |
---|
[27564] | 163 | $("#ac_level").val("0"); |
---|
[22201] | 164 | $("#acFormContainer") |
---|
[27564] | 165 | .dialog("option", "buttons", [{ text: "Create", click: function() { |
---|
[22201] | 166 | (new PwgWS("")).callService( |
---|
[27564] | 167 | "rvac.addCustom", { name:$("#ac_name").val(), counter:$("#ac_counter").val(), level:$("#ac_level").val(), url:$("#ac_url").val() }, |
---|
[22201] | 168 | { |
---|
| 169 | method: "POST", |
---|
| 170 | onFailure: function(num, text) { |
---|
| 171 | alert(num + " " + text); |
---|
| 172 | }, |
---|
| 173 | onSuccess: function(result) { |
---|
[27564] | 174 | dataTable.fnAddData(result); |
---|
[22201] | 175 | $("#ac_name,#ac_counter,#ac_url").val( "" ); |
---|
| 176 | } |
---|
| 177 | } |
---|
| 178 | ); |
---|
| 179 | } |
---|
| 180 | }, { text: "Close", click: function(){ $(this).dialog("close") }} ]) |
---|
| 181 | .dialog("open"); |
---|
| 182 | }, |
---|
| 183 | |
---|
| 184 | edit: function(node) { |
---|
| 185 | var row = SHelper.rowFromNode(node) |
---|
[27564] | 186 | , item=dataTable.fnGetData(row[0]); |
---|
[22201] | 187 | |
---|
| 188 | $("#ac_name").val( item.name ); |
---|
| 189 | $("#ac_counter").val( item.counter ); |
---|
[27564] | 190 | $("#ac_level").val( item.level ); |
---|
[22201] | 191 | $("#ac_url").val( item.url ); |
---|
| 192 | |
---|
| 193 | $("#acFormContainer") |
---|
[27564] | 194 | .dialog("option", "buttons", [{ text: "Modify", click: function() { |
---|
[22201] | 195 | (new PwgWS("")).callService( |
---|
[27564] | 196 | "rvac.modCustom", { id: item.id, name:$("#ac_name").val(), counter:$("#ac_counter").val(), level:$("#ac_level").val(), url:$("#ac_url").val() }, |
---|
[22201] | 197 | { |
---|
| 198 | method: "POST", |
---|
| 199 | onFailure: function(num, text) { |
---|
| 200 | alert(num + " " + text); |
---|
| 201 | }, |
---|
| 202 | onSuccess: function(result) { |
---|
[27564] | 203 | dataTable.fnUpdate(result, row[0]); |
---|
[22201] | 204 | $("#acFormContainer").dialog("close"); |
---|
| 205 | } |
---|
| 206 | } |
---|
| 207 | ); |
---|
| 208 | } |
---|
| 209 | }, { text: "Close", click: function(){ $(this).dialog("close") }} ]) |
---|
| 210 | .dialog("open"); |
---|
| 211 | |
---|
| 212 | return false; |
---|
| 213 | } |
---|
| 214 | } |
---|
| 215 | |
---|
| 216 | $().ready( function() { |
---|
| 217 | var table = $("#csTable"); |
---|
| 218 | dataTable = table.dataTable( { |
---|
| 219 | sDom : '<"dtBar"filp>rt<"dtBar"ilp>', |
---|
| 220 | iDisplayLength: 100, |
---|
[27564] | 221 | aaData: [{foreach from=$suggestions item=s name=sloop} |
---|
| 222 | {ldelim}id:{$s.id},name:"{$s.name|@escape:javascript}",counter:{$s.counter},level:{$s.level},url:"{$s.url|@escape:javascript}",U_LINK:"{$s.U_LINK|@escape:javascript}"{rdelim}{if !$smarty.foreach.sloop.last},{/if} |
---|
| 223 | {/foreach} |
---|
| 224 | ], |
---|
| 225 | aoColumnDefs: [ { |
---|
| 226 | aTargets: ["dtc_Name"], |
---|
| 227 | mData: function(item) { |
---|
| 228 | return item.name; |
---|
| 229 | } |
---|
| 230 | },{ |
---|
| 231 | aTargets: ["dtc_Weight"], |
---|
| 232 | bSearchable: false, |
---|
| 233 | mData: function(item) { |
---|
| 234 | return item.counter; |
---|
| 235 | } |
---|
| 236 | },{ |
---|
| 237 | aTargets: ["dtc_Level"], |
---|
| 238 | mData: function(item, type) { |
---|
| 239 | if ("sort"===type) |
---|
| 240 | return item.level; |
---|
| 241 | switch (item.level) { |
---|
| 242 | {foreach $available_permission_levels as $level=>$label} |
---|
| 243 | case {$level}: |
---|
| 244 | case "{$level}": |
---|
| 245 | return "{$label|escape:'javascript'}"; |
---|
| 246 | {/foreach} |
---|
| 247 | } |
---|
| 248 | return item.level; |
---|
| 249 | } |
---|
| 250 | },{ |
---|
| 251 | aTargets: ["dtc_Url"], |
---|
[27571] | 252 | mData: function(item, type) { |
---|
| 253 | if ("sort"===type || "filter"==type) |
---|
| 254 | item.url ? item.url : item.U_LINK; |
---|
[27564] | 255 | return "<a href=\""+item.U_LINK+"\" onclick=\"return SHelper.zoom(this.href)\">" |
---|
| 256 | + (item.url ? item.url : "show" ) |
---|
| 257 | + "</a>" |
---|
| 258 | } |
---|
| 259 | },{ |
---|
| 260 | aTargets: ["dtc_Actions"], |
---|
| 261 | bSearchable: false, |
---|
| 262 | bSortable: false, |
---|
| 263 | mData: function(item) { |
---|
[27571] | 264 | return "<a href=\"\" onclick=\"return SHelper.edit(this)\" class=icon-pencil title=Edit></a>" |
---|
| 265 | + " <a href=\"\" onclick=\"return SHelper.del(this)\" class=icon-cancel-circled title=Delete></a>"; |
---|
[27564] | 266 | } |
---|
| 267 | } |
---|
[22201] | 268 | ], |
---|
| 269 | asStripeClasses: ["row1", "row2"], |
---|
| 270 | bAutoWidth: false, |
---|
| 271 | aaSorting: [] |
---|
| 272 | }); |
---|
| 273 | |
---|
| 274 | $("#acFormContainer").dialog({ |
---|
| 275 | autoOpen: false, |
---|
| 276 | modal: true, |
---|
| 277 | width: "auto" |
---|
| 278 | }); |
---|
| 279 | $(".openAddNew").click( SHelper.add ).button(); |
---|
| 280 | |
---|
| 281 | $("tr", table).hover( |
---|
| 282 | function() { |
---|
| 283 | $(this).addClass("ui-state-highlight"); |
---|
| 284 | }, |
---|
| 285 | function() { |
---|
| 286 | $(this).removeClass("ui-state-highlight"); |
---|
| 287 | } |
---|
| 288 | ); |
---|
| 289 | }); |
---|
[27564] | 290 | {/footer_script} |
---|