1var SponsorFilterDataHandlers = SponsorFilterDataHandlers || function(rootOb) { 2 var me = this; 3 4 me.sponsorAjax = null; 5 6 var dataHandler = { 7 syncToQueryObject: function() { 8 rootOb.query.remove_advanced('sponsor_id'); 9 //include 10 for (var item in rootOb.selectedContent) { 11 if (!rootOb.selectedContent.hasOwnProperty(item)) { 12 continue 13 } 14 rootOb.query.add_advanced('sponsor_id', item, rootOb.selectedContent[item]? '=':'!='); 15 } 16 }, 17 addSponsorEntry: function(sponsor, callback) { 18 //add to selected entry 19 rootOb.selectedContent[sponsor] = rootOb.currentContext.itemValue; 20 //check selected entry number to display/hide clear button 21 rootOb.renderer.renderButtonByStatus(); 22 //add to query 23 dataHandler.syncToQueryObject(); 24 //if call back then call back 25 if (typeof(callback) == 'function') { 26 callback(); 27 } 28 }, 29 removeSponsorEntry: function(sponsor, callback) { 30 //remove from selected entry 31 if (typeof(rootOb.selectedContent[sponsor]) != 'undefined') { 32 delete rootOb.selectedContent[sponsor]; 33 } 34 //check selected entry number to display/hide clear button 35 rootOb.renderer.renderButtonByStatus(); 36 //remove from query 37 dataHandler.syncToQueryObject(); 38 //if call back then call back 39 if (typeof(callback) == 'function') { 40 callback(); 41 } 42 }, 43 loadSponsorPage: function(page, beforeCallback, successCallback, noDataCallback, errorCallback, completeCallback, parentId, parentName, direction) { 44 if ( direction == '__top__' ){ 45 rootOb.cacheLevel = 0; 46 }else{ 47 if (direction == 'down') { 48 rootOb.cacheLevel++; 49 } else if (direction == 'up') { 50 rootOb.cacheLevel--; 51 } 52 } 53 if (direction) { 54 if (direction == '__top__' || direction == 'up') { 55 rootOb.filterQuery = rootOb.cache[rootOb.cacheLevel].submitData; 56 parentName = rootOb.cache[rootOb.cacheLevel].parentName; 57 page = rootOb.cache[rootOb.cacheLevel].page || 1; 58 } else { 59 rootOb.filterQuery = { 60 parent_id: parentId, 61 alphabet: '', 62 negative: '', 63 positive: '', 64 sname: '', 65 } 66 } 67 rootOb.elm('popup.filter.type').val(rootOb.filterQuery.positive); 68 rootOb.elm('popup.filter.name').val(rootOb.filterQuery.sname); 69 } 70 rootOb.filterQuery.offset = (page - 1) * rootOb.config.SPONSOR_PER_PAGE; 71 //save cache 72 rootOb.cache[rootOb.cacheLevel] = { 73 submitData: rootOb.filterQuery, 74 parentName: parentName, 75 page: page 76 }; 77 rootOb.renderer.renderChildNav(); 78 79 if ( me.sponsorAjax !== null ){ 80 me.sponsorAjax.abort(); 81 } 82 83 me.sponsorAjax = $.ajax({ 84 type: "GET", 85 url: "/sponsor/get_sponsor_list", 86 data: { 87 inputData: JSON.stringify({ 88 offset: rootOb.filterQuery.offset || 0, 89 limit: rootOb.config.SPONSOR_PER_PAGE || 5, 90 parent_id: rootOb.filterQuery.parent_id || '', 91 alphabet: rootOb.filterQuery.alphabet || '', 92 negative: rootOb.filterQuery.negative || '', 93 positive: rootOb.filterQuery.positive || '', 94 name: rootOb.filterQuery.sname || '', 95 }) 96 }, 97 beforeSend: function() { 98 if (typeof(beforeCallback) == 'function') { 99 beforeCallback(); 100 } 101 }, 102 dataType: 'json', 103 success: function(response) { 104 if (response.status==1 && response.items && response.items.length > 0) { //1 means success 105 if (typeof(successCallback) == 'function') { 106 successCallback(response.items, response.count, page); 107 } 108 } else { 109 //failure_code 110 if (typeof(noDataCallback) == 'function') { 111 noDataCallback(); 112 } 113 } 114 }, 115 error: function() { 116 //error_code 117 if (typeof(errorCallback) == 'function') { 118 errorCallback(); 119 } 120 }, 121 complete: function() { 122 if (typeof(completeCallback) == 'function') { 123 completeCallback(); 124 } 125 } 126 }); 127 }, 128 removeAll: function() { 129 var keepList = {}; 130 for (var item in rootOb.selectedContent) { 131 if (!rootOb.selectedContent.hasOwnProperty(item)) { 132 continue; 133 } 134 if (rootOb.selectedContent[item] != rootOb.currentContext.
134itemValue) { 135 keepList[item] = rootOb.selectedContent[item]; 136 } 137 } 138 rootOb.selectedContent = jQuery.extend(true, {}, keepList); 139 rootOb.renderer.renderAllTags(); 140 //check selected entry number to display/hide clear button 141 rootOb.renderer.renderButtonByStatus(); 142 dataHandler.syncToQueryObject(); 143 }, 144 resetSponsorPageState: function() { 145 rootOb.cacheLevel = 0; 146 rootOb.cache = []; 147 rootOb.filterQuery = { 148 sname: '', 149 negative: '', 150 alphabet: '', 151 positive: '', 152 parent_id: '' 153 } 154 } 155 }; 156 return dataHandler; 157};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.