HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/templates/maintenance.view.tpl
{template="header"}
<style>
.LabelColumn {
	height:25px;
	padding:6px 10px 0;
	width:170px;
}

.InfoColumn {
	padding-bottom:6px;
	padding-left:0;
	padding-right:0;
	padding-top:6px;
	height:25px;
}
</style>

<script type="text/javascript">

var DatabaseTableList = [];

$(document).ready(function() {	//	dom ready
	$('.fileCheckButton').click(function(){	//	on click
		$('.fileCheckButton').attr('disabled', true);
		$('.fileCheckResults').html('');
		$('.fileCheckProgress').html('<img src="images/loading.gif" /> '+ {$lang.FileCheckInProgress|iwp_FilterJavascriptString});
		$.ajax({
			url: 'remote.php?section=maintenance&action=filecheckrun',
			dataType: 'xml',
			error: function () {	//	on ajax error
				$('.fileCheckProgress').text({$lang.FileCheckError|iwp_FilterJavascriptString});
			},
			success: function (data) {	//	on ajax success
				$('.fileCheckProgress').html('');
				var success = $('success', data).text();
				if (success == '1') {
					$('.fileCheckProgress').text({$lang.FileCheckSuccess|iwp_FilterJavascriptString});
					return;
				} else if (success == '0') {
					//	there are file errors to show, generate the html list
					var resultsContainer = $('.fileCheckResults').html('<br />').css('height', '').css('overflow-y', '');
					$('<div></div>').text({$lang.FileCheckErrorHeader|iwp_FilterJavascriptString}).appendTo(resultsContainer);
					
					var resultsList = $('<ul></ul>').appendTo(resultsContainer);
					$('fileerrors fileerror', data).each(function(){
						$('<li>'+ $(this).attr('path') +' ('+ $(this).text() +')</li>').appendTo(resultsList);
					});
					
					if (resultsContainer.height() > 200) {
						resultsContainer.css('height', '200px').css('overflow-y', 'scroll');
					}
				}
				
				var message = $('message', data).text();
				if (message) {
					$('.fileCheckProgress').text(message);
				}
			},
			complete: function () {	//	on ajax complete
				//	success or error, re-enable the button
				$('.fileCheckButton').attr('disabled', false);
			}
		});
	});


	$('.dbCheckButton').click(function(){	//	on click
		$('.dbCheckButton').attr('disabled', true);
		DatabaseCheck.RunChecks();
		$('.dbCheckButton').attr('disabled', false);
	});
	
	// init the tabs
	$("#tabMenu").tabs({ selected: 0 });

});

/**
 * All functions related to the database table checking and repairing section of the maintenance page
 */
var DatabaseCheck = {
	/**
	 * The list of tables still left to check. This is reset for each round of checking.
	 */
	TableList: [],

	/**
	 * The resets the table list and checks all the tables.
	 */
	RunChecks: function() {
		DatabaseCheck.TableList = DatabaseTableList.slice(0);
		DatabaseCheck.CheckNextTable();
	},
	
	/**
	 * This calls and ajax request to check a particular table
	 *
	 * @param string tableName The name of the table to check
	 */
	CheckTable: function(tableName){
		$('#table_row_' + tableName + ' .status').html('<img src="images/loading.gif" /> '+ {$lang.DbChecking|iwp_FilterJavascriptString});
	
		$.getJSON('remote.php?section=maintenance&action=checktable&table='+tableName,
			function (data) {	//	on ajax success

				if(data.success) {
					$('#table_row_' + tableName + ' .status').html('<span style="color: green; font-weight: bold;">' + {$lang.dbCheckSuccess|iwp_FilterJavascriptString}+ '</span>');
					$('#table_row_' + tableName).addClass('QuickView');

				}else{
					$('#table_row_' + tableName).addClass('ErrorRow');

					if(data.errortype == 'crashed') {
						$('#table_row_' + tableName + ' .status').html('<span style="color: red; font-weight: bold;">'+{$lang.dbTableCrashed|iwp_FilterJavascriptString}+ '</span> (<a href="#" onclick="DatabaseCheck.RepairTable(\'' + tableName + '\');">' + {$lang.dbRepairTable|iwp_FilterJavascriptString} + '</a>)');
					}else if(data.errortype == 'badtable') {
						$('#table_row_' + tableName + ' .status').html('<span style="color: red; font-weight: bold;">'+{$lang.dbBadTable|iwp_FilterJavascriptString}+ '</span> (<a href="#" onclick="DatabaseCheck.RepairTable(\'' + tableName + '\');">' + {$lang.dbRepairTable|iwp_FilterJavascriptString} + '</a>)');
					}else{
						$('#table_row_' + tableName + ' .status').html('<span style="color: red; font-weight: bold;">'+{$lang.dbTableError|iwp_FilterJavascriptString}+ '</span> (<a href="#" onclick="DatabaseCheck.RepairTable(\'' + tableName + '\');">' + {$lang.dbRepairTable|iwp_FilterJavascriptString} + '</a>)');
					}

					if(typeof data.message != 'undefined') {
						$('#table_row_' + tableName + ' .message').text(data.message);
					}else{
						$('#table_row_' + tableName + ' .message').text({$lang.NA|iwp_FilterJavascriptString});
					}
				}
				DatabaseCheck.CheckNextTable();
			}
		);
		
	},

	/**
	 * This calls and ajax request to reapir a particular table
	 *
	 * @param string tableName The name of the table to repair
	 */
	RepairTable: function (tableName) {
		$('#table_row_' + tableName + ' .status').html('<img src="images/loading.gif" /> '+ {$lang.dbRepairing|iwp_FilterJavascriptString});
	
		$.getJSON('remote.php?section=maintenance&action=repairtable&table='+tableName,
			function (data) {	//	on ajax success

				if(data.success) {
					$('#table_row_' + tableName + ' .status').html('<span style="color: green; font-weight: bold;">' + {$lang.dbRepairSuccess|iwp_FilterJavascriptString}+ '</span>');
					$('#table_row_' + tableName).addClass('QuickView');

				}else{
					$('#table_row_' + tableName).addClass('ErrorRow');
					$('#table_row_' + tableName + ' .status').html('<span style="color: red; font-weight: bold;">'+{$lang.dbTableError|iwp_FilterJavascriptString}+ '</span>');


					if(typeof data.message != 'undefined') {
						$('#table_row_' + tableName + ' .message').text(data.message);
					}else{
						$('#table_row_' + tableName + ' .message').text({$lang.NA|iwp_FilterJavascriptString});
					}
				}
			}
		);
	},

	/**
	 * This grabs the table list, chops the first table out of the list and passes it to the CheckTable function.
	 */
	CheckNextTable: function() {
		if(DatabaseCheck.TableList.length < 1) {
			return;
		}
		tableName = DatabaseCheck.TableList.shift();
		DatabaseCheck.CheckTable(tableName);
	}

};

</script>

<div class="BodyContainer">
	<div class="Heading1">{$lang.Maintenance}</div>
	<div class="Intro"><div>{$lang.MaintenanceIntro}</div></div>

	<div id="tabMenu">
		<ul class="tabnav" id="tabList">
			<li id="filecheckTab" class=""><a href="#filecheck">File Check</a></li>
			<li id="dbcheckTab" class=""><a href="#dbcheck">Database Check</a></li>
		</ul>

		<div id="filecheck">
			<table class="Panel">
				<tr>
					<td class="Heading2" colspan="2">{$lang.FileCheck}</td>
				</tr>
				
				<tr>
					<td class="LabelColumn" valign="top">{$lang.FileCheck}</td>
					<td class="InfoColumn" valign="top">
						<div>{$lang.FileCheckIntro}</div>
						<button class="fileCheckButton">{$lang.RunFileCheck}</button> <span class="fileCheckProgress"></span><br />
						<div class="fileCheckResults"></div>
					</td>
				</tr>
			</table>
		</div>
		
		<div id="dbcheck">
			<table class="Panel">
				<tr>
					<td class="Heading2" colspan="2">{$lang.DatabaseCheck}</td>
				</tr>
				
				<tr>
					<td class="LabelColumn" valign="top">{$lang.DatabaseCheck}</td>
					<td class="InfoColumn" valign="top">
						<div>{$lang.DBCheckIntro}</div>
						<button class="dbCheckButton">{$lang.RunDatabaseTableCheck}</button>
					</td>
				</tr>
			</table>


			<table class="Panel">
				<tr  class="Heading2">
					<td style="width: 20px;">  </td>
					<td width="30%">{$lang.TableName}</td>
					<td width="30%">{$lang.Status}</td>
					<td>{$lang.Message}</td>
				</tr>
				
				{foreach from=%admin_maintenance.GetDatabaseTableList key=k item=table id=tableLoop}
					<tr class="GridRow "  onmouseover="$(this).addClass('GridRowOver');" onmouseout="$(this).removeClass('GridRowOver');" id="table_row_{$table}">
						<td style="text-align: center; width: 20px;" class="icon">
							<script type="text/javascript">
							<!--
								DatabaseTableList.push('{$table}');
							//-->
							</script>
							<img src="images/task.gif" alt=""/>
						</td>
						<td class="name" width="30%">{$table}</td>
						<td class="status" width="30%">{$lang.NotRunYet}</td>
						<td class="message">{$lang.NA}</td>
					</tr>
				{/foreach}
			</table>
		</div>
	</div>
</div>

{template="footer"}