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 <?php if($this->step ==0) {?> 0024 <h3>Number of all not yet importetd users: <?= $this->coutAll ?></h3> 0025 0026 0027 <form action="/backend/hiveuser"> 0028 <input type="hidden" name="step" value="10"> 0029 <button>Start Import</button> 0030 </form> 0031 0032 <br/><br/><br/><br/> 0033 <p>Info: <?= $this->info ?></p> 0034 0035 0036 <?php } else if($this->step ==10) {?> 0037 0038 0039 <h3>Step 2 - Import...</h3> 0040 <h4><span id="info_text"></span></h4> 0041 <p><span id="info"></span></p> 0042 <br/><br/><br/><br/> 0043 <p>Info: <?= $this->info ?></p> 0044 0045 0046 <script type="text/javascript"> 0047 startImport(0,500); 0048 var importCounter = 0; 0049 var errorCounter = 0; 0050 function startImport(offset, limit) { 0051 0052 var url_string = '/backend/hiveuser/start-import-all-ajax?&limit='+limit+'&offset='+offset; 0053 0054 jQuery.ajax({ 0055 url: url_string, 0056 type: 'get', 0057 error: function () { 0058 //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>"); 0059 //$('#info_text').html('<b>Status: ERROR ' + results['Message'] + '</b>'); 0060 //abortTimer(); 0061 errorCounter++; 0062 if(errorCounter<100) { 0063 startImport(0,500); 0064 } else { 0065 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>"); 0066 } 0067 return false; 0068 }, 0069 success: function (results) { 0070 0071 is_done = results['IsImportDone']; 0072 newOffset = results['offset']; 0073 newLimit = results['limit']; 0074 counter = results['ImportCounter']; 0075 totalCounter = results['TotalCounter']; 0076 importCounter = importCounter + counter; 0077 //$('#info_text').html('<b>' + results['ImportCounter'] + ' projects with ' + results['ImportFileCounter'] + ' files imported!</b>'); 0078 $('#info_text').html('<b>Imported ' + importCounter + ' users. ' + totalCounter + ' users left.</b>'); 0079 if(is_done && counter>0) { 0080 0081 //abortTimer(); 0082 //alert('Done'); 0083 $('#info').html(results['Message']); 0084 startImport(0,500); 0085 } else if(is_done && counter==0) { 0086 $('#info_text').html('<b>Import Done! Imported ' + importCounter + ' projects. <p><a href="/backend/hive">Back to Start</a></p></b>'); 0087 } 0088 return false; 0089 } 0090 }); 0091 } 0092 </script> 0093 0094 <?php }?> 0095