From b94907d7e0d190e2255285f90379b3942631dca2 Mon Sep 17 00:00:00 2001
From: ands <ands@andspad.(none)>
Date: Sun, 12 Dec 2010 00:25:04 +0100
Subject: [PATCH] =?UTF-8?q?Prepaid-widget=20(ohne=20Datenbank,=20sondern?=
 =?UTF-8?q?=20textfile)=20hinzugef=C3=BCgt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 webroot/config.php                          |   4 +-
 webroot/css/marvin.css                      |   1 +
 webroot/css/widget.css                      |   1 +
 webroot/css/widget_dark.css                 |   3 ++
 webroot/css/widget_light.css                |  27 +++++++++++++
 webroot/widgets/Prepaid/Prepaid.js          |  42 ++++++++++++++++++++
 webroot/widgets/Prepaid/Prepaid.php         |  20 ++++++++++
 webroot/widgets/Prepaid/ajax.php            |  29 ++++++++++++++
 webroot/widgets/Prepaid/img/cross.png       | Bin 0 -> 1251 bytes
 webroot/widgets/Prepaid/karten.txt          |   2 +
 webroot/widgets/TwitterWall/TwitterWall.php |   2 +-
 11 files changed, 128 insertions(+), 3 deletions(-)
 create mode 100644 webroot/widgets/Prepaid/Prepaid.js
 create mode 100644 webroot/widgets/Prepaid/Prepaid.php
 create mode 100644 webroot/widgets/Prepaid/ajax.php
 create mode 100644 webroot/widgets/Prepaid/img/cross.png
 create mode 100644 webroot/widgets/Prepaid/karten.txt

diff --git a/webroot/config.php b/webroot/config.php
index 4fc3198..ba2d461 100644
--- a/webroot/config.php
+++ b/webroot/config.php
@@ -12,9 +12,9 @@
 		array("RSSFeed",			"widget_light",		0,1,	3,2),
 		array("Wettervorhersage",	"widget_light",		3,1,	1,2),
 		array("TwitterWall",		"widget_light",		4,1,	2,4),
-		array("Dummy",				"widget_light",		0,3,	2,2),
+		array("Prepaid",			"widget_light",		0,3,	2,3),
 		array("Dummy",				"widget_dark",		2,3,	2,2),
-		array("Dummy",				"widget_light",		0,5,	4,1),
+		array("Dummy",				"widget_light",		2,5,	2,1),
 		array("Marvin",				"widget_light",		4,5,	2,1)
 	);
 ?>
diff --git a/webroot/css/marvin.css b/webroot/css/marvin.css
index 427ed5b..225809c 100644
--- a/webroot/css/marvin.css
+++ b/webroot/css/marvin.css
@@ -3,4 +3,5 @@ body
 	background-color:#261C13;
 	font-family:Lucida Grande, Lucida Sans Unicode, Calibri, Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
 	font-size:15pt;
+	cursor:default;
 }
diff --git a/webroot/css/widget.css b/webroot/css/widget.css
index 30d6cc1..2314a0a 100644
--- a/webroot/css/widget.css
+++ b/webroot/css/widget.css
@@ -1,4 +1,5 @@
 .widget, .widget td, .widget div {
 	font-family: inherit;
 	color:#000000;
+	cursor:default;
 }
diff --git a/webroot/css/widget_dark.css b/webroot/css/widget_dark.css
index 032f046..a94e660 100644
--- a/webroot/css/widget_dark.css
+++ b/webroot/css/widget_dark.css
@@ -3,10 +3,12 @@
 	background-color:#362C23;
 	font-family: inherit;
 	color:#ffffff;
+	cursor:default;
 }
 .widget_dark td, .widget_dark div {
 	font-family: inherit;
 	color:#ffffff;
+	cursor:default;
 }
 .widget_dark a, .widget_dark a:hover, .widget_dark a:visited, .widget_dark a:active {
 	text-decoration:none;
@@ -14,4 +16,5 @@
 	font-size: 1em;
 	font-style: normal;
 	color: #aaaaaa;
+	cursor:default;
 }
diff --git a/webroot/css/widget_light.css b/webroot/css/widget_light.css
index 6ff0091..22ce0d6 100644
--- a/webroot/css/widget_light.css
+++ b/webroot/css/widget_light.css
@@ -4,12 +4,30 @@
 	font-family: inherit;
 	color:#000000;
 	overflow:hidden;
+	cursor:default;
 }
 
 .widget_light td, .widget_light div {
 	font-family: inherit;
 	margin: 0;
 	position:relative;
+	cursor:default;
+}
+
+.widget_light .invisiblebox {
+	font-family: inherit;
+	margin: 10;
+	padding: 0;
+	cursor:default;
+}
+
+.widget_light .table {
+	border: 1px dashed #F2EFE5;
+	background-color:#95897E;
+	font-family: inherit;
+	margin: 0;
+	padding: 2;
+	cursor:default;
 }
 
 .widget_light .box {
@@ -19,6 +37,7 @@
 	color:#000000;
 	margin: 10;
 	position:relative;
+	cursor:default;
 }
 
 .widget_light h1 {
@@ -28,6 +47,7 @@
 	padding: 0;
 	font-family: inherit;
 	font-size: 1.0em;
+	cursor:default;
 }
 .widget_light h2 {
 	margin: 0;
@@ -35,6 +55,7 @@
 	font-family: inherit;
 	font-size: 0.8em;
 	color: #111111;
+	cursor:default;
 }
 .widget_light h3 {
 	margin: 0;
@@ -42,6 +63,7 @@
 	font-family: inherit;
 	font-size: 0.6em;
 	color: #222222;
+	cursor:default;
 }
 
 .widget_light ul {
@@ -52,6 +74,7 @@
 	overflow:hidden;
 	position:relative;
 	height:auto;
+	cursor:default;
 }
 .widget_light li {
 	background-color:#95897E;
@@ -59,9 +82,11 @@
 	border-bottom: 1px dashed #F2EFE5;
 	width: 100%;
 	color: #333333;
+	cursor:default;
 }
 .widget_light li img {
 	padding: 4;
+	cursor:default;
 }
 
 .widget_light a, .widget_light a:hover, .widget_light a:visited, .widget_light a:active {
@@ -70,9 +95,11 @@
 	font-size: 1em;
 	font-style: normal;
 	color: #333333;
+	cursor:default;
 }
 
 .widget_light img
 {
 	float:left;
+	cursor:default;
 }
diff --git a/webroot/widgets/Prepaid/Prepaid.js b/webroot/widgets/Prepaid/Prepaid.js
new file mode 100644
index 0000000..bfd84ea
--- /dev/null
+++ b/webroot/widgets/Prepaid/Prepaid.js
@@ -0,0 +1,42 @@
+function fillPrepaid(response) {
+  var content = '<h1>Warpzone Prepaid</h1>';
+  jQuery.each(response, function(k,v) {
+    content += '<table class="invisiblebox" style="margin-top:0;margin-bottom:0;">';
+    content += '<tr><td colspan="7"><h2>'+k+':</h2></td><td colspan="3" align="right"><h2 onclick="setPrepaid(\''+k+'\',0)">Neue Karte</h2></td></tr>';
+    content += '<tr>';
+    for(var i=0; i<v; i++) {
+      content += '<td class="table" style="background-image:url(widgets/Prepaid/img/cross.png);background-position:center center;">50c</td>';
+    }
+    for(var i=v; i<10; i++) {
+      var value = i;
+      value++;
+      content += '<td class="table" onclick="setPrepaid(\''+k+'\','+value+')">50c</td>';
+    }
+    content += '</tr>';
+    content += '</table>';
+  });
+  $("#Prepaid").html(content);
+}
+
+function setPrepaid(k,v) {
+  $.getJSON("widgets/Prepaid/ajax.php?name="+k+"&value="+v, function (response) 
+    {
+      fillPrepaid(response);
+    });
+}
+
+function updatePrepaid() {
+  $.getJSON("widgets/Prepaid/ajax.php", function (response) 
+    {
+      fillPrepaid(response);
+    });
+}
+
+$(document).ready(function()
+  {
+    addFunctionToMinuteTimer(updatePrepaid);
+    updatePrepaid();
+  }
+);
+
+
diff --git a/webroot/widgets/Prepaid/Prepaid.php b/webroot/widgets/Prepaid/Prepaid.php
new file mode 100644
index 0000000..10e3f07
--- /dev/null
+++ b/webroot/widgets/Prepaid/Prepaid.php
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'widgets/iWidget.php';
+
+class Prepaid implements iWidget
+{
+  public function __construct($width, $height)
+  {
+
+  }
+
+  public function giveOutput() 
+  {
+    $widgetOutput = '<script src="widgets/Prepaid/Prepaid.js" type="text/javascript"></script>'."\n";
+    $widgetOutput .= '<span id="Prepaid"></span>'."\n";
+    return $widgetOutput;
+  }
+}
+
+?>
diff --git a/webroot/widgets/Prepaid/ajax.php b/webroot/widgets/Prepaid/ajax.php
new file mode 100644
index 0000000..9fb81d0
--- /dev/null
+++ b/webroot/widgets/Prepaid/ajax.php
@@ -0,0 +1,29 @@
+<?php
+  $infile = fopen("karten.txt","r");
+  if($infile)
+  {
+    while(!feof($infile))
+    {
+      $name = trim(fgets($infile, 256));
+      $value = trim(fgets($infile, 256));
+      if($name && isset($value))
+        $antwortArray[$name] = $value;
+    }
+    fclose($infile);
+  }
+
+  if(isset($_GET["name"],$_GET["value"]))
+  {
+    $antwortArray[$_GET["name"]] = $_GET["value"];
+
+    $file = fopen("karten.txt","w");
+    foreach($antwortArray as $name => $value)
+    {
+      fputs($file, $name."\n");
+      fputs($file, $value."\n");
+    }
+    fclose($file);
+  }
+
+  print(json_encode($antwortArray));
+?>
diff --git a/webroot/widgets/Prepaid/img/cross.png b/webroot/widgets/Prepaid/img/cross.png
new file mode 100644
index 0000000000000000000000000000000000000000..4621e50e9cba51c2451d62bd86009542f43a3d3d
GIT binary patch
literal 1251
zcmV<91RVQ`P)<h;3K|Lk000e1NJLTq001fg001fo1^@s6#ly*400001b5ch_0Itp)
z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ign^
z6a@?dZcHlx0013nR9JLFZ*6U5Zgc<u0000(a%Ew3Wn>_CX>@2HM@dakWG-a~000C!
zNkl<ZSi{AcTZmRw6vuz()HFhq%}kVToh&LsqBNH%T_mcPdh^AX=tc=$7$)i=6jAWO
zii$$1)b0fhSWyo>^;AI-hVoBI3sMJ@;*g}%q}ex4G(F6oIDCF*@BLlI*4vzY`+sZw
z*MF_OC&QbWeF&@~Y|A9=rUPbXD}XO6h9`jx*dggIfV?y~2%Pkjs_Zi}yQl*o=K`Nb
zrkwzWrvLa4sHCI7L;jak*#*Ee9dPLL!1;mk40u4&Z_^*nDUTLKvCla-A6OdLWT|uR
z>!K(|TJ+{BU{hq;E0SI)f5;n5S`UnsxYCF}pO{&Hiy_|;*cae9u(5vd44|F@v80*>
zJlBFlx70_mfvqfuykY1|6c};NT?Q;EWnh^<lYlwrb{9o)Akmw50~;FbSI+WRC2eiA
zJ`e2uByc)%{;&^c4CLj&_Q<qxU`^FvB~VGnfRz<0F#YX9;MoL+ZU%bl*4FQLr=+o}
z4T5|risGPiZeBzM7CYyDD2if#g*S(QCn7)OB}v;t6Y>OatONcGj86h@nAyb*Kwj#T
zE>uLuJa=gesHec~0lCV2A$YOD*qdG<vVa_|2!%W;^d$=X;+$ImSRiW`JLe7;MX}d=
za}DrtB+Iu-dM5=#)`VF1croq@P+%0e)_ZZUPoSzZYCx}~@s#uPRG^Yh0=Gmc(C_Q`
z>z)pwkl&CBGCA}m3jCZvfknU-2_b*0nX_}6w;|wEL|;RCIhr6>?E{r`3b;8yfsl*=
zESGe8#({dUdw_RKbw34U25ggbu$412S~N53@+#1ixa7E`mTw1ns|zJf0Cyx#{~Nfe
zohw03d-itXysv;C{}-TU_B3#HB1dlpmbU{mYZ2rCZ~*9TVvlj4Ptsp!)1x~B%|=z$
zcLT4Twa}Z{MqqxE8agdw_n6tT84tag^#R8c)=mb-CxF?KYBS<dGs}Qo9za#IQS*29
zEN~_60$!fU(60lo3;@W0?UFY5hB*sRV6~ZD*YVK%E5#w;+`yVWl9rSxatP=R%>M%z
zkaVJx9^K_b77F>jrK&XwJQAV6>}KAv@&s?L1?EITzD3f$x)S>V@Lq%hgQ+TzML_nK
zvb@T^m1Gs`9k3th3n)R&7lK+#9`)VPH<8D(e}MY~jY|PM8j-PCDHI5We$Z!ms9WDG
z>AOgm^*%6M!Pn`1A2+jwO^4pU6^%rwu~X8GiK;ON_z5^KaF03)Tveq4d4o-Jrry>=
zASb-XQ+wB6fz^?F)+NB&W<viMFhKaRb(17D*=P?l^@tlRDpe|w)p>I+P{cG<QcJz1
znJoamXX^dFN(Fug=GC`@d1;ew;PXh9!_+?{TD`s;0q%>aK(8;?m7#wSSQyFjr~D0+
zHo$%id=ycE^=5X>83Sgv$iEeZ><dY^(E;;?;ILPLs%m!xxZamz{sr>*e)t;!?8E>7
N002ovPDHLkV1kM;F6ICL

literal 0
HcmV?d00001

diff --git a/webroot/widgets/Prepaid/karten.txt b/webroot/widgets/Prepaid/karten.txt
new file mode 100644
index 0000000..627eb3a
--- /dev/null
+++ b/webroot/widgets/Prepaid/karten.txt
@@ -0,0 +1,2 @@
+ands
+0
diff --git a/webroot/widgets/TwitterWall/TwitterWall.php b/webroot/widgets/TwitterWall/TwitterWall.php
index b4172cd..ef25b4d 100644
--- a/webroot/widgets/TwitterWall/TwitterWall.php
+++ b/webroot/widgets/TwitterWall/TwitterWall.php
@@ -20,7 +20,7 @@ class TwitterWall implements iWidget
       <script type="text/javascript">
         $(document).ready(function(){
           $(".tweet").tweet({
-            avatar_size: 55,
+            avatar_size: 53,
             count: '.$this->lines.',
             loading_text: "loading tweets...",
             query: "#warpzone",
-- 
GitLab