More configurability through config.php

This commit is contained in:
sandbender 2010-11-13 23:15:03 +01:00
parent cd979d0bf6
commit 5098db94eb
8 changed files with 291 additions and 324 deletions

View File

@ -1,5 +0,0 @@
Addtype application/octet-stream .ttf .otf
AddType application/vnd.ms-fontobject .eot
RewriteRule (.*).php $1
RewriteRule (.*).hmtl $1

View File

@ -1,50 +0,0 @@
<?php
require_once("lib/trans.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pamela</title>
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<link rel="stylesheet" href="pamela.css" type="text/css" media="screen" />
</head>
<body>
<header id="hdr">
<div>
<img src="img/pamela-logo.png" alt="Pamela" />
</div>
</header>
<h1>Name your macs</h1>
<p>If you want to have a name shown instead of your mac, enter your mac and desired name below.</p>
<form method="post">
<table>
<thead>
<th>Mac</th>
<th>Name</th>
<th>Visible</th>
</thead>
<tbody>
<?php
$known_macs = known_macs_get();
$counter = 0;
foreach ($known_macs as $mac => $name) {
?>
<tr>
<td><input name="mac-<?=$counter?>" type="text" value="<?=$mac?>" /></td>
<td><input name="name-<?=$counter?>" type="text" value="<?=$name?>" /></td>
<td><input name="show-<?=$counter?>" type="checkbox" <?=$name==NULL?"":"checked"?> /></td>
</tr>
<?php
$counter++;
}
?>
<tr>
<td><input name="mac-<?=$counter?>" type="text" /></td>
<td><input name="name-<?=$counter?>" type="text" /></td>
<td><input name="show-<?=$counter?>" type="checkbox" /></td>
</tr>
</tbody>
</table>
<input type="submit" value="submit" name="submit" />
</form>
</body>
</html>

View File

@ -1,14 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pamela</title>
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script src="js/pamela-buttons.js" type="text/javascript"></script>
<script src="js/pamela-nodes.js" type="text/javascript"></script>
<script src="js/pamela-matrices.js" type="text/javascript"></script>
<script src="js/pamela.js" type="text/javascript"></script>
<style type="text/css">* {margin:0; padding:0} body { background-color: #fff; }</style>
</head>
<body>
<canvas id="pamela"></canvas>
</body>
</html>

24
index.php Normal file
View File

@ -0,0 +1,24 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pamela</title>
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script src="js/pamela-conf.php" type="text/javascript"></script>
<script src="js/pamela-buttons.js" type="text/javascript"></script>
<script src="js/pamela-nodes.js" type="text/javascript"></script>
<script src="js/pamela-matrices.js" type="text/javascript"></script>
<script src="js/pamela.js" type="text/javascript"></script>
<style type="text/css">
* {
margin:0;
padding:0;
}
body {
background-color: <?php echo PAM_BGCOLOR; ?>;
}
</style>
</head>
<body>
<canvas id="pamela"></canvas>
</body>
</html>

View File

@ -98,7 +98,8 @@ function DownloadScriptButton(x, y) {
DownloadScriptButton.prototype.draw = function() {
if (this.isHover) {
context.fillStyle = 'rgb(192,192,192)';
//context.fillStyle = 'rgb(192,192,192)';
context.fillStyle = config.buttonColor;
context.font = "18pt sans-serif";
context.fillText("Download pamela scanner script", this.x, this.y - 10);
context.drawImage(this.dlCol, this.x, this.y);

10
js/pamela-conf.php Normal file
View File

@ -0,0 +1,10 @@
<?php
require_once("../config.php");
header('Content-Type: application/javascript');
?>
config = new function() {
this.bgcolor = "<?php echo PAM_BGCOLOR; ?>";
this.image = "<?php echo PAM_IMAGE; ?>";
this.buttonColor = "<?php echo PAM_BUT_COLOR; ?>";
this.buttonShow = <?php echo PAM_BUT_SHOW=="TRUE"?"true":"false"; ?>;
}

View File

@ -174,22 +174,22 @@ Node.prototype.draw = Node.prototype.normal.draw;
// Class NorbertNode
jQuery.extend(NorbertNode.prototype, Node.prototype);
function NorbertNode() {
parent = this;
this.norbert = new Image();
this.norbert.src = "img/whitespace-logo-square-transp-drop.png";
self = this;
this.norbertLoaded = false;
this.norbert.onload=function() { self.norbertLoaded = true; }
$(this.norbert).load(function() {
parent.norbertLoaded = true;
parent.width = parent.norbert.width;
parent.height = parent.norbert.height;
});
this.norbert.src = config.image;
this.position = new Vector(0, 0, 0);
}
NorbertNode.prototype.draw = function() {
var s = Math.abs(this.projection.z / (width / 2));
s *= 2;
var x = Math.floor(this.projection.x - (280 / s));
var y = Math.floor(this.projection.y - (240 / s));
//var x = Math.floor(this.projection.x - (192 / s));
//var y = Math.floor(this.projection.y - (180 / s));
if (this.norbertLoaded)
if (!this.norbertLoaded) return;
var x = this.projection.x - this.width / 2;
var y = this.projection.y - this.height / 2;
context.drawImage(this.norbert, x, y);
};

View File

@ -166,7 +166,7 @@ Pamela.prototype.draw = function() {
});
context.save();
context.fillStyle = "#fff";
context.fillStyle = config.bgcolor;
context.fillRect( 0, 0, width, height );
context.translate(width / 2, height / 2);
for (var i = 0; i < this.nodes.length; i++) {
@ -174,6 +174,7 @@ Pamela.prototype.draw = function() {
}
context.restore();
if (config.buttonShow)
this.buttons.draw();
this.fire();