File indexing completed on 2025-05-04 05:29:02
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 ?> 0023 <div class="messages"> 0024 <?php foreach (Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger') 0025 ->getCurrentMessages() as $message) : ?> 0026 <p><?php echo $this->escape($message); ?></p> 0027 <?php endforeach; ?> 0028 </div> 0029 <div class="filtering"> 0030 <form> 0031 Title: <input type="text" name="filter_title" id="filter_title"/> 0032 Project ID: <input type="text" name="filter_project_id" id="filter_project_id"/> 0033 Member ID: <input type="text" name="filter_member_id" id="filter_member_id"/><br/> 0034 0035 <div style="display:inline-block; text-align: right;width: 95%;"> 0036 <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button> 0037 <button type="reset" id="RemoveFilterButton"><?= $this->translate('Remove filter'); ?></button> 0038 </div> 0039 </form> 0040 </div> 0041 <div id="TableContainer"></div> 0042 0043 <div id="dialog-form" title="Member Info"></div> 0044 0045 <script type="text/javascript"> 0046 $(document).ready(function () { 0047 0048 $("#dialog-form").dialog({ 0049 autoOpen: false, 0050 //height: 350, 0051 width: 600, 0052 modal: true, 0053 buttons: { 0054 Close: function () { 0055 $(this).dialog("close"); 0056 } 0057 } 0058 }); 0059 0060 $('#TableContainer').jtable({ 0061 jqueryuiTheme: true, 0062 paging: true, 0063 sorting: true, 0064 defaultSorting: 'mail asc', 0065 title: 'Table for claimed products', 0066 actions: { 0067 listAction: '/backend/claim/list' 0068 // createAction: '/backend/claim/create', 0069 // updateAction: '/backend/claim/update', 0070 // deleteAction: '/backend/claim/delete' 0071 }, 0072 fields: { 0073 project_id: { 0074 title: 'project_id', 0075 key: true, 0076 create: false, 0077 edit: false, 0078 list: true, 0079 width: '5%' 0080 }, 0081 member_id: { 0082 title: 'member_id', 0083 width: '5%', 0084 list: true, 0085 create: true 0086 }, 0087 content_type: { 0088 title: 'content_type', 0089 list: false 0090 }, 0091 project_category_id: { 0092 title: 'category_id', 0093 list: false, 0094 sorting: false //This column is not sortable! 0095 }, 0096 status: { 0097 title: 'status', 0098 width: '5%', 0099 sorting: false //This column is not sortable! 0100 }, 0101 pid: { 0102 title: 'pid', 0103 list: false 0104 }, 0105 type_id: { 0106 title: 'type_id', 0107 list: false 0108 }, 0109 title: { 0110 title: 'title', 0111 width: '15%', 0112 list: true, 0113 display: function (data) { 0114 if (data.record.title) { 0115 return data.record.title + ' <a href="/p/' + data.record.project_id + '/" class="btn btn-info btn-xs" role="button" style="color: white" target="_blank">show</a>'; 0116 } 0117 } 0118 0119 }, 0120 description: { 0121 title: 'description', 0122 list: false 0123 }, 0124 image_big: { 0125 title: 'image_big', 0126 list: false 0127 }, 0128 image_small: { 0129 title: 'image_small', 0130 list: false 0131 }, 0132 content_url: { 0133 title: 'content_url', 0134 list: false 0135 }, 0136 created_at: { 0137 title: 'Created', 0138 width: '7%', 0139 type: 'date', 0140 create: false, 0141 edit: false 0142 }, 0143 changed_at: { 0144 title: 'Changed', 0145 width: '12%', 0146 type: 'date', 0147 list: false, 0148 create: false, 0149 edit: false 0150 }, 0151 deleted_at: { 0152 title: 'Deleted', 0153 width: '12%', 0154 type: 'date', 0155 list: false, 0156 create: false, 0157 edit: false 0158 }, 0159 creator_id: { 0160 title: 'creator_id', 0161 width: '5%' 0162 }, 0163 facebook_code: { 0164 title: 'facebook_code', 0165 list: false 0166 }, 0167 twitter_code: { 0168 title: 'twitter_code', 0169 list: false 0170 }, 0171 google_code: { 0172 title: 'google_code', 0173 list: false 0174 }, 0175 link_1: { 0176 title: 'link_1', 0177 list: false 0178 }, 0179 embed_code: { 0180 title: 'embed_code', 0181 list: false 0182 }, 0183 ppload_collection_id: { 0184 title: 'ppload_collection_id', 0185 list: false 0186 }, 0187 validated: { 0188 title: 'validated', 0189 list: false 0190 }, 0191 validated_at: { 0192 title: 'validated_at', 0193 type: 'date', 0194 list: false 0195 }, 0196 featured: { 0197 title: 'featured', 0198 list: false 0199 }, 0200 amount: { 0201 title: 'amount', 0202 width: '5%', 0203 list: false, 0204 sorting: false //This column is not sortable! 0205 }, 0206 claimed_by_member: { 0207 title: 'claimed_by_member', 0208 width: '10%', 0209 list: true, 0210 display: function (data) { 0211 if (data.record.claimed_by_member) { 0212 return data.record.claimed_by_member 0213 + ' <a role="button" title="show member info" class="btn btn-info btn-xs member-info" style="color:white;" data-record="' + data.record.claimed_by_member + '"><span>info</span></a>' 0214 + ' <a role="button" title="delete claim request" class="btn btn-warning btn-xs remove-claim" style="color:white;" data-record="' + data.record.project_id + '">delete</a>' 0215 + ' <a role="button" title="transfer product" class="btn btn-warning btn-xs transfer-claim" style="color:white;" data-record="' + data.record.project_id + '">transfer</a>' 0216 ; 0217 } 0218 } 0219 }, 0220 claimable: { 0221 title: 'claimable', 0222 width: '5%', 0223 list: true, 0224 display: function (data) { 0225 if (data.record.claimable == 1) { 0226 return data.record.claimable 0227 + ' <a role="button" title="remove claimable" class="btn btn-warning btn-xs toggle-claim" style="color:white" data-record="' + data.record.project_id + '">remove</a>'; 0228 } else { 0229 return data.record.claimable; 0230 } 0231 } 0232 } 0233 0234 } 0235 }); 0236 0237 $('body').on("click", 'a.remove-claim', function (event) { 0238 event.preventDefault(); 0239 event.stopImmediatePropagation(); 0240 0241 if (!confirm('This will delete the claim request. There is no way back. Do you wish to proceed?')) { 0242 return; 0243 } 0244 0245 var elementRecord = $(this).data("record"); 0246 0247 jQuery.ajax({ 0248 data: {'project_id': elementRecord}, 0249 url: '/backend/claim/removeclaim/', 0250 type: 'post', 0251 error: function () { 0252 alert("<span class='error'>Service is temporarily unavailable. Our engineers are working quickly to resolve this issue. <br/>Find out why you may have encountered this error.</span>"); 0253 return false; 0254 }, 0255 success: function (results) { 0256 $('#TableContainer').jtable('reload'); 0257 return false; 0258 } 0259 }); 0260 0261 return false; 0262 }); 0263 0264 $('body').on("click", 'a.toggle-claim', function (event) { 0265 event.preventDefault(); 0266 event.stopImmediatePropagation(); 0267 0268 if (!confirm('This will remove claim option for this product. Do you wish to proceed?')) { 0269 return; 0270 } 0271 0272 var elementRecord = $(this).data("record"); 0273 0274 jQuery.ajax({ 0275 data: {'project_id': elementRecord}, 0276 url: '/backend/claim/toggleclaim/', 0277 type: 'post', 0278 error: function () { 0279 alert("<span class='error'>Service is temporarily unavailable. Our engineers are working quickly to resolve this issue. <br/>Find out why you may have encountered this error.</span>"); 0280 return false; 0281 }, 0282 success: function (results) { 0283 $('#TableContainer').jtable('reload'); 0284 return false; 0285 } 0286 }); 0287 0288 return false; 0289 }); 0290 0291 $('body').on("click", 'a.member-info', function (event) { 0292 event.preventDefault(); 0293 event.stopImmediatePropagation(); 0294 0295 var elementRecord = $(this).data("record"); 0296 0297 jQuery.ajax({ 0298 data: {'member_id': elementRecord}, 0299 url: '/backend/claim/memberinfo/', 0300 type: 'post', 0301 error: function () { 0302 alert("<span class='error'>Service is temporarily unavailable. Our engineers are working quickly to resolve this issue. <br/>Find out why you may have encountered this error.</span>"); 0303 return false; 0304 }, 0305 success: function (results) { 0306 $('#dialog-form').html(results.ViewRecord).dialog('open'); 0307 return false; 0308 } 0309 }); 0310 0311 return false; 0312 }); 0313 0314 $('body').on("click", 'a.transfer-claim', function (event) { 0315 event.preventDefault(); 0316 event.stopImmediatePropagation(); 0317 0318 if (!confirm('This will finalize transfer to the member who has claimed the product. Do you wish to proceed?')) { 0319 return; 0320 } 0321 0322 var elementRecord = $(this).data("record"); 0323 0324 jQuery.ajax({ 0325 data: {'project_id': elementRecord}, 0326 url: '/backend/claim/transfer/', 0327 type: 'post', 0328 error: function () { 0329 alert("<span class='error'>Service is temporarily unavailable. Our engineers are working quickly to resolve this issue. <br/>Find out why you may have encountered this error.</span>"); 0330 return false; 0331 }, 0332 success: function (results) { 0333 $('#TableContainer').jtable('reload'); 0334 return false; 0335 } 0336 }); 0337 0338 return false; 0339 }); 0340 0341 //Re-load records when user click 'load records' button. 0342 $('#LoadRecordsButton').click(function (e) { 0343 e.preventDefault(); 0344 $('#TableContainer').jtable('load', { 0345 filter_title: $('#filter_title').val(), 0346 filter_project_id: $('#filter_project_id').val(), 0347 filter_member_id: $('#filter_member_id').val() 0348 0349 }); 0350 }); 0351 0352 //Re-load records when user click 'remove filter' button. 0353 $('#RemoveFilterButton').click(function (e) { 0354 e.preventDefault(); 0355 $('#TableContainer').jtable('load', { 0356 filter_title: null, 0357 filter_project_id: null, 0358 filter_member_id: null 0359 }); 0360 }); 0361 0362 $('#TableContainer').jtable('load', { 0363 filter_title: $('#filter_title').val(), 0364 filter_project_id: $('#filter_project_id').val(), 0365 filter_member_id: $('#filter_member_id').val() 0366 }); 0367 }); 0368 </script>