PageRenderTime 24ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/administrator/components/com_flexicontent/views/search/tmpl/indexer.php

http://flexicontent.googlecode.com/
PHP | 115 lines | 93 code | 3 blank | 19 comment | 5 complexity | 0dd5fbc6dac55f3ff1399be3e7655894 MD5 | raw file
Possible License(s): MIT, GPL-2.0, Apache-2.0
  1. <?php
  2. /**
  3. * @version 1.5 stable $Id: indexer.php 1782 2013-10-08 22:47:51Z ggppdk $
  4. * @package Joomla
  5. * @subpackage FLEXIcontent
  6. * @copyright (C) 2009 Emmanuel Danan - www.vistamedia.fr
  7. * @license GNU/GPL v2
  8. *
  9. * FLEXIcontent is a derivative work of the excellent QuickFAQ component
  10. * @copyright (C) 2008 Christoph Lukes
  11. * see www.schlu.net for more information
  12. *
  13. * FLEXIcontent is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. */
  18. defined('_JEXEC') or die('Restricted access');
  19. $search_task = FLEXI_J16GE ? 'task=search.' : 'controller=search&task=';
  20. ?>
  21. <div style="heading">Indexer Running ... <br/><br/><b>NOTE:</b><br/> Only the <b>execution time</b> of indexing process is displayed below, <br/> the <b>network request / reply time</b> is NOT included</div>
  22. <script type="text/javascript">
  23. jQuery(document).ready(function() {
  24. var items_per_call = 50;
  25. var width = 0;
  26. var looper = 0;
  27. var onesector = 1000;
  28. var fields_length = 0;
  29. var items_length = 0;
  30. var number = 0;
  31. function updateprogress() {
  32. if(looper>=number && looper) {
  33. jQuery('div#statuscomment').html( jQuery('div#statuscomment').text() + ' , INDEXING FINISHED. You may close this window');
  34. return;
  35. }
  36. jQuery.ajax({
  37. url: "index.php?option=com_flexicontent&<?php echo $search_task; ?>index&items_per_call="+items_per_call+"&itemcnt="+looper+"&indexer=<?php echo JRequest::getVar('indexer','advanced');?>"+"&rebuildmode=<?php echo JRequest::getVar('rebuildmode','');?>",
  38. success: function(response, status2, xhr2) {
  39. var arr = response.split('|');
  40. if(arr[0]=='fail') {
  41. jQuery('div#statuscomment').html(arr[1]);
  42. looper = number;
  43. return;
  44. }
  45. width = onesector*looper;
  46. if (width>300) width = 300;
  47. percent = width/3;
  48. jQuery('div#insideprogress').css('width', width+'px');
  49. jQuery('div#updatepercent').text(' '+percent.toFixed(2)+' %');
  50. jQuery('div#statuscomment').html((looper<number?looper:number)+' / '+number+' items '+response);
  51. setTimeout(updateprogress, 20); // milliseconds to delay updating the HTML display
  52. }
  53. });
  54. looper=looper+items_per_call;
  55. }
  56. jQuery.ajax({
  57. url: "index.php?option=com_flexicontent&<?php echo $search_task; ?>countrows"+"&indexer=<?php echo JRequest::getVar('indexer','advanced');?>",
  58. success: function(response, status, xhr) {
  59. var arr = response.split('|');
  60. if(arr[0]=='fail') {
  61. jQuery('div#statuscomment').html(arr[1]);
  62. return;
  63. }
  64. //items = jQuery.parseJSON(arr[1]);
  65. //fields = jQuery.parseJSON(arr[2]);
  66. //number = fields.length*items.length;
  67. items_length = arr[1];
  68. fields_length = arr[2];
  69. number = items_length;
  70. onesector = (number==0)?300:(300/number);
  71. looper = 0;
  72. updateprogress();
  73. }
  74. });
  75. });
  76. window.parent.SqueezeBox.addEvent('onClose',function(){
  77. window.parent.location.reload(true);
  78. });
  79. </script>
  80. <style>
  81. div#advancebar{
  82. width:302px;
  83. height:17px;
  84. border:1px solid #000;
  85. padding:0px;
  86. margin:0px;
  87. float:left;
  88. clear:left;
  89. }
  90. div#insideprogress{
  91. width:0px;
  92. height:15px;
  93. background-color:#000;
  94. padding:0px;
  95. margin:1px;
  96. }
  97. div#updatepercent{
  98. clear:right;
  99. }
  100. div#statuscomment{
  101. color:red;
  102. margin-top:30px;
  103. }
  104. </style>
  105. <div class="clr"></div>
  106. <div>&nbsp;</div>
  107. <div>&nbsp;</div>
  108. <div id="advancebar"><div id="insideprogress"></div></div>
  109. <div id="updatepercent">0 %</div>
  110. <div class="clr"></div>
  111. <div id="statuscomment"></div>
  112. <div class="clr"></div>