Skip to content
Snippets Groups Projects
Commit b94907d7 authored by ands's avatar ands
Browse files

Prepaid-widget (ohne Datenbank, sondern textfile) hinzugefügt

parent 7ce159ea
No related branches found
No related tags found
No related merge requests found
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
array("RSSFeed", "widget_light", 0,1, 3,2), array("RSSFeed", "widget_light", 0,1, 3,2),
array("Wettervorhersage", "widget_light", 3,1, 1,2), array("Wettervorhersage", "widget_light", 3,1, 1,2),
array("TwitterWall", "widget_light", 4,1, 2,4), 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_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) array("Marvin", "widget_light", 4,5, 2,1)
); );
?> ?>
...@@ -3,4 +3,5 @@ body ...@@ -3,4 +3,5 @@ body
background-color:#261C13; background-color:#261C13;
font-family:Lucida Grande, Lucida Sans Unicode, Calibri, Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati; font-family:Lucida Grande, Lucida Sans Unicode, Calibri, Arial, Helvetica, Sans, FreeSans, Jamrul, Garuda, Kalimati;
font-size:15pt; font-size:15pt;
cursor:default;
} }
.widget, .widget td, .widget div { .widget, .widget td, .widget div {
font-family: inherit; font-family: inherit;
color:#000000; color:#000000;
cursor:default;
} }
...@@ -3,10 +3,12 @@ ...@@ -3,10 +3,12 @@
background-color:#362C23; background-color:#362C23;
font-family: inherit; font-family: inherit;
color:#ffffff; color:#ffffff;
cursor:default;
} }
.widget_dark td, .widget_dark div { .widget_dark td, .widget_dark div {
font-family: inherit; font-family: inherit;
color:#ffffff; color:#ffffff;
cursor:default;
} }
.widget_dark a, .widget_dark a:hover, .widget_dark a:visited, .widget_dark a:active { .widget_dark a, .widget_dark a:hover, .widget_dark a:visited, .widget_dark a:active {
text-decoration:none; text-decoration:none;
...@@ -14,4 +16,5 @@ ...@@ -14,4 +16,5 @@
font-size: 1em; font-size: 1em;
font-style: normal; font-style: normal;
color: #aaaaaa; color: #aaaaaa;
cursor:default;
} }
...@@ -4,12 +4,30 @@ ...@@ -4,12 +4,30 @@
font-family: inherit; font-family: inherit;
color:#000000; color:#000000;
overflow:hidden; overflow:hidden;
cursor:default;
} }
.widget_light td, .widget_light div { .widget_light td, .widget_light div {
font-family: inherit; font-family: inherit;
margin: 0; margin: 0;
position:relative; 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 { .widget_light .box {
...@@ -19,6 +37,7 @@ ...@@ -19,6 +37,7 @@
color:#000000; color:#000000;
margin: 10; margin: 10;
position:relative; position:relative;
cursor:default;
} }
.widget_light h1 { .widget_light h1 {
...@@ -28,6 +47,7 @@ ...@@ -28,6 +47,7 @@
padding: 0; padding: 0;
font-family: inherit; font-family: inherit;
font-size: 1.0em; font-size: 1.0em;
cursor:default;
} }
.widget_light h2 { .widget_light h2 {
margin: 0; margin: 0;
...@@ -35,6 +55,7 @@ ...@@ -35,6 +55,7 @@
font-family: inherit; font-family: inherit;
font-size: 0.8em; font-size: 0.8em;
color: #111111; color: #111111;
cursor:default;
} }
.widget_light h3 { .widget_light h3 {
margin: 0; margin: 0;
...@@ -42,6 +63,7 @@ ...@@ -42,6 +63,7 @@
font-family: inherit; font-family: inherit;
font-size: 0.6em; font-size: 0.6em;
color: #222222; color: #222222;
cursor:default;
} }
.widget_light ul { .widget_light ul {
...@@ -52,6 +74,7 @@ ...@@ -52,6 +74,7 @@
overflow:hidden; overflow:hidden;
position:relative; position:relative;
height:auto; height:auto;
cursor:default;
} }
.widget_light li { .widget_light li {
background-color:#95897E; background-color:#95897E;
...@@ -59,9 +82,11 @@ ...@@ -59,9 +82,11 @@
border-bottom: 1px dashed #F2EFE5; border-bottom: 1px dashed #F2EFE5;
width: 100%; width: 100%;
color: #333333; color: #333333;
cursor:default;
} }
.widget_light li img { .widget_light li img {
padding: 4; padding: 4;
cursor:default;
} }
.widget_light a, .widget_light a:hover, .widget_light a:visited, .widget_light a:active { .widget_light a, .widget_light a:hover, .widget_light a:visited, .widget_light a:active {
...@@ -70,9 +95,11 @@ ...@@ -70,9 +95,11 @@
font-size: 1em; font-size: 1em;
font-style: normal; font-style: normal;
color: #333333; color: #333333;
cursor:default;
} }
.widget_light img .widget_light img
{ {
float:left; float:left;
cursor:default;
} }
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();
}
);
<?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;
}
}
?>
<?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));
?>
webroot/widgets/Prepaid/img/cross.png

1.22 KiB

ands
0
...@@ -20,7 +20,7 @@ class TwitterWall implements iWidget ...@@ -20,7 +20,7 @@ class TwitterWall implements iWidget
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$(".tweet").tweet({ $(".tweet").tweet({
avatar_size: 55, avatar_size: 53,
count: '.$this->lines.', count: '.$this->lines.',
loading_text: "loading tweets...", loading_text: "loading tweets...",
query: "#warpzone", query: "#warpzone",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment