Remove file & folder count

Remove build up of vars, data, functions and triggering the update of
this on load
This commit is contained in:
Matt Pass
2013-03-02 18:14:04 +00:00
parent d122c83535
commit 5898ebb5f0
4 changed files with 1 additions and 41 deletions

View File

@@ -36,7 +36,7 @@ $activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat"
</style>
</head>
<body onLoad="top.ICEcoder.updateFileFolderCount()" style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
<body style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
<?php if ($ICEcoder['demoMode']) {?>
<div style="position: absolute; display: inline-block; width: 99px; height: 50px; top: 0; right: 30px; background: url('images/big-arrow.gif') 0 -10px no-repeat; text-align: center; font-family: arial; font-size: 10px; padding-top: 60px"><b>Click logo<br>for help &amp;<br>usage info</b></div>
@@ -75,8 +75,6 @@ $activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat"
}
}
;?>
<span style="color:#888">File & folder count:</span><br>
<div id="fileFolderCounts"></div><br><br><br>
</div>
<div style="clear: both">

View File

@@ -20,18 +20,6 @@ include("lib/get-branch.php");
?>
</ul>
<?php
// Output the JS vars
echo "<script>\n";
echo "top.ICEcoder.dirCount=";
echo $dirCount ? $dirCount : "0";
echo ";\ntop.ICEcoder.fileCount=";
echo $fileCount ? $fileCount : "0";
echo ";\ntop.ICEcoder.fileBytes=";
echo $fileBytes ? $fileBytes : "0";
echo ";\n</script>";
?>
<iframe name="fileControl" style="display: none"></iframe>
</body>

View File

@@ -6,9 +6,6 @@ if (!isset($ICEcoder['root'])) {
if (!$_SESSION['loggedIn']) {
header("Location: ../");
}
$fileCount=0;
$fileBytes=0;
$dirCount=0;
// If we're just getting a branch, get that and set as the finalArray
$scanDir = $docRoot.$iceRoot;
@@ -38,9 +35,7 @@ $finalArray = array_merge($dirArray,$filesArray);
for ($i=0;$i<count($finalArray);$i++) {
$fileFolderName = str_replace("\\","/",$finalArray[$i]);
$type = is_dir($docRoot.$iceRoot.$fileFolderName) ? "folder" : "file";
$type=="folder" ? $dirCount++ : $fileCount++;
if ($type=="file") {
$fileBytes+=filesize($docRoot.$iceRoot.$fileFolderName);
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
$ext = "ext-".pathinfo($docRoot.$iceRoot.$fileFolderName, PATHINFO_EXTENSION);
}

View File

@@ -1419,27 +1419,6 @@ var ICEcoder = {
document.getElementById('results').style.display = showHide=="show" ? 'inline-block' : 'none';
},
// Show file & folder count in server info screen
updateFileFolderCount: function() {
var fileText, dirText, unitSize, unitText, dContainer;
dirText = top.ICEcoder.dirCount > 1 ? "folders" : "folder";
fileText = top.ICEcoder.fileCount > 1 ? "files" : "file";
// Change into kilobytes
unitSize = Math.ceil(top.ICEcoder.fileBytes/1024);
unitText = "kb";
// Maybe we should show in megabytes?
if (unitSize >= 1024) {
unitSize = (unitSize / 1024).toFixed(2);
unitText = "mb";
}
// Update the display
dContainer = top.ICEcoder.content.contentWindow.document.getElementById('fileFolderCounts');
if (dContainer) {
dContainer.innerHTML = top.ICEcoder.fileCount+" "+fileText+", "+top.ICEcoder.dirCount+" "+dirText+"<br>~ "+unitSize+" "+unitText;
}
},
// Toggle full screen on/off
fullScreenSwitcher: function() {
// Future use