Sammlung
This commit is contained in:
47
Sammlung/Praktikum/3/ias_p2_b0.1/js/bot/bot.js
Normal file
47
Sammlung/Praktikum/3/ias_p2_b0.1/js/bot/bot.js
Normal file
@ -0,0 +1,47 @@
|
||||
var bot1ID = 0;
|
||||
var bot2ID = 0;
|
||||
|
||||
function randomizer(los_nr){
|
||||
return (Math.random() * (charge_data[los_nr]['startPreis'] - charge_data[los_nr]['minPreis']) + charge_data[los_nr]['minPreis']);
|
||||
};
|
||||
function buyBot(bot){
|
||||
los_nr = document.getElementById('los_nr').value;
|
||||
var bet = randomizer(los_nr);
|
||||
|
||||
if(charge_data[los_nr]['vkPreis'] < bet){
|
||||
setBotButtonStyle(bot, 'buyAction');
|
||||
var botname = 'Bot' + bot;
|
||||
kaufen(botname);
|
||||
|
||||
}
|
||||
};
|
||||
function botStart(bot){
|
||||
setBotButtonStyle(bot, 'active');
|
||||
|
||||
if(bot == 1){
|
||||
bot1ID = setInterval(function(){buyBot(1)}, 1000);
|
||||
}
|
||||
else if(bot == 2){
|
||||
bot2ID = setInterval(function(){buyBot(2)}, 1000);
|
||||
}
|
||||
else{
|
||||
alert("Fehler beim Aktivieren eines Bots");
|
||||
}
|
||||
|
||||
};
|
||||
function botStop(bot){
|
||||
setBotButtonStyle(bot, 'inactive');
|
||||
|
||||
if(bot == 1){
|
||||
clearInterval(bot1ID);
|
||||
bot1ID = 0;
|
||||
|
||||
}
|
||||
else if(bot == 2){
|
||||
clearInterval(bot2ID);
|
||||
bot2ID = 0;
|
||||
}
|
||||
else{
|
||||
alert("Fehler beim Aktivieren eines Bots");
|
||||
}
|
||||
};
|
56
Sammlung/Praktikum/3/ias_p2_b0.1/js/bot/botButtonStyle.js
Normal file
56
Sammlung/Praktikum/3/ias_p2_b0.1/js/bot/botButtonStyle.js
Normal file
@ -0,0 +1,56 @@
|
||||
function setBotButtonStyle(bot, style){
|
||||
var htmlID = 0;
|
||||
if(bot == 1){
|
||||
if(style == 'active'){
|
||||
document.getElementById('bot1Button').className = "botButtonActiveStyle";
|
||||
document.getElementById('bot1Button').onclick = function onclick(event){ botStop(1);};
|
||||
}
|
||||
else if(style == 'inactive'){
|
||||
document.getElementById('bot1Button').className = "botButtonInactiveStyle";
|
||||
document.getElementById('bot1Button').onclick = function onclick(event){ botStart(1);};
|
||||
}
|
||||
else if(style == 'buyAction'){
|
||||
document.getElementById('bot1Button').className = "botButtonBuyActionStyle";
|
||||
setTimeout(function(){ botButtonStyleCheck() }, 500);
|
||||
}
|
||||
else{
|
||||
alert("Fehler beim Stylen von Botbutton");
|
||||
}
|
||||
}
|
||||
|
||||
else if(bot == 2){
|
||||
if(style == 'active'){
|
||||
document.getElementById('bot2Button').className = "botButtonActiveStyle";
|
||||
document.getElementById('bot2Button').onclick = function onclick(event){ botStop(2);};
|
||||
}
|
||||
else if(style == 'inactive'){
|
||||
document.getElementById('bot2Button').className = "botButtonInactiveStyle";
|
||||
document.getElementById('bot2Button').onclick = function onclick(event){ botStart(2);};
|
||||
}
|
||||
else if(style == 'buyAction'){
|
||||
document.getElementById('bot2Button').className = "botButtonBuyActionStyle";
|
||||
setTimeout(function(){ botButtonStyleCheck() }, 500);
|
||||
}
|
||||
else{
|
||||
alert("Fehler beim Stylen von Botbutton");
|
||||
}
|
||||
}
|
||||
|
||||
else{
|
||||
alert("Fehler Auswahl eines Botbuttons f<>r Styling");
|
||||
}
|
||||
};
|
||||
function botButtonStyleCheck(){
|
||||
if(bot1ID != 0){
|
||||
setBotButtonStyle(1, 'active');
|
||||
}
|
||||
else{
|
||||
setBotButtonStyle(1, 'inactive');
|
||||
}
|
||||
if(bot2ID !=0){
|
||||
setBotButtonStyle(2, 'active');
|
||||
}
|
||||
else{
|
||||
setBotButtonStyle(2, 'inactive');
|
||||
}
|
||||
};
|
91
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/es.js
Normal file
91
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/es.js
Normal file
@ -0,0 +1,91 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Event-Service: asynchroner Nachrichtenaustausch
|
||||
//------------------------------------------------------------------------------
|
||||
// depends-on:
|
||||
// jquery
|
||||
// inheritance
|
||||
// underscore
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function defer_p (notifier_ppl, entry_opl, message_spl, data_opl) {
|
||||
return setTimeout(function() {
|
||||
return notifier_ppl.apply(entry_opl, [entry_opl, message_spl, data_opl]);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function each(object_opl, iterator, context) {
|
||||
for (var key in object_opl) {
|
||||
iterator.call(context, object_opl[key], key);
|
||||
}
|
||||
}
|
||||
|
||||
function findAll(object_opl, iterator, context) {
|
||||
var results = [];
|
||||
each(object_opl, function(value, index) {
|
||||
if (iterator.call(context, value, index))
|
||||
results.push(value);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
function compact(object_opl) {
|
||||
return findAll(object_opl, function(value) {
|
||||
return value != null;
|
||||
});
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
var EventService_cl = Class.create({
|
||||
//------------------------------------------------------------------------------
|
||||
initialize: function () {
|
||||
this.Data_o = null;
|
||||
this.Subscriber_o = {};
|
||||
this.Method_o = null;
|
||||
},
|
||||
subscribe_px: function (Subscriber_opl, Message_spl) {
|
||||
if (Message_spl in this.Subscriber_o) {
|
||||
// Message bekannt, Liste der Subscriber untersuchen
|
||||
if (this.Subscriber_o[Message_spl].indexOf(Subscriber_opl) == -1) {
|
||||
this.Subscriber_o[Message_spl].push(Subscriber_opl);
|
||||
}
|
||||
} else {
|
||||
// Message noch nicht vorhanden, neu eintragen
|
||||
this.Subscriber_o[Message_spl] = [Subscriber_opl];
|
||||
}
|
||||
},
|
||||
unSubscribe_px: function (Subscriber_opl, Message_spl) {
|
||||
if (Message_spl in this.Subscriber_o) {
|
||||
// Message bekannt, Liste der Subscriber untersuchen
|
||||
var Entry_a = this.Subscriber_o[Message_spl];
|
||||
var index_i = Entry_a.indexOf(Subscriber_opl);
|
||||
if (index_i >= 0) {
|
||||
// Eintrag entfernen
|
||||
Entry_a[index_i] = null;
|
||||
Entry_a = compact(Entry_a); // compact liefert Kopie!
|
||||
if (Entry_a.length == 0) {
|
||||
// keine Subscriber mehr, kann entfernt werden
|
||||
delete this.Subscriber_o[Message_spl];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Message nicht vorhanden, falsche Anforderung
|
||||
}
|
||||
},
|
||||
publish_px: function (Message_spl, Data_opl) {
|
||||
console.info('es - publish ' + Message_spl);
|
||||
each(this.Subscriber_o, function (value_apl, key_spl) {
|
||||
// geliefert wird jeweils ein Wert, hier ein Array, und der Key
|
||||
if (key_spl == Message_spl) {
|
||||
// an alle Subscriber weitergeben
|
||||
each(value_apl, function (entry_opl, index_ipl) {
|
||||
// geliefert wird hier das Element und der Index
|
||||
//_.defer(entry_opl.notify_px, entry_opl, Message_spl, Data_opl);
|
||||
defer_p(entry_opl.notify_px, entry_opl, Message_spl, Data_opl);
|
||||
}, this
|
||||
);
|
||||
}
|
||||
}, this
|
||||
)
|
||||
}
|
||||
});
|
||||
// EOF
|
122
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/inheritance.js
Normal file
122
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/inheritance.js
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
Class, version 2.7
|
||||
Copyright (c) 2006, 2007, 2008, Alex Arnell <alex@twologic.com>
|
||||
Licensed under the new BSD License. See end of file for full license terms.
|
||||
*/
|
||||
|
||||
var Class = (function() {
|
||||
var __extending = {};
|
||||
|
||||
return {
|
||||
extend: function(parent, def) {
|
||||
if (arguments.length == 1) { def = parent; parent = null; }
|
||||
var func = function() {
|
||||
if (arguments[0] == __extending) { return; }
|
||||
this.initialize.apply(this, arguments);
|
||||
};
|
||||
if (typeof(parent) == 'function') {
|
||||
func.prototype = new parent( __extending);
|
||||
}
|
||||
var mixins = [];
|
||||
if (def && def.include) {
|
||||
if (def.include.reverse) {
|
||||
// methods defined in later mixins should override prior
|
||||
mixins = mixins.concat(def.include.reverse());
|
||||
} else {
|
||||
mixins.push(def.include);
|
||||
}
|
||||
delete def.include; // clean syntax sugar
|
||||
}
|
||||
if (def) Class.inherit(func.prototype, def);
|
||||
for (var i = 0; (mixin = mixins[i]); i++) {
|
||||
Class.mixin(func.prototype, mixin);
|
||||
}
|
||||
return func;
|
||||
},
|
||||
mixin: function (dest, src, clobber) {
|
||||
clobber = clobber || false;
|
||||
if (typeof(src) != 'undefined' && src !== null) {
|
||||
for (var prop in src) {
|
||||
if (clobber || (!dest[prop] && typeof(src[prop]) == 'function')) {
|
||||
dest[prop] = src[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
},
|
||||
inherit: function(dest, src, fname) {
|
||||
if (arguments.length == 3) {
|
||||
var ancestor = dest[fname], descendent = src[fname], method = descendent;
|
||||
descendent = function() {
|
||||
var ref = this.parent; this.parent = ancestor;
|
||||
var result = method.apply(this, arguments);
|
||||
ref ? this.parent = ref : delete this.parent;
|
||||
return result;
|
||||
};
|
||||
// mask the underlying method
|
||||
descendent.valueOf = function() { return method; };
|
||||
descendent.toString = function() { return method.toString(); };
|
||||
dest[fname] = descendent;
|
||||
} else {
|
||||
for (var prop in src) {
|
||||
if (dest[prop] && typeof(src[prop]) == 'function') {
|
||||
Class.inherit(dest, src, prop);
|
||||
} else {
|
||||
dest[prop] = src[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
},
|
||||
singleton: function() {
|
||||
var args = arguments;
|
||||
if (args.length == 2 && args[0].getInstance) {
|
||||
var klass = args[0].getInstance(__extending);
|
||||
// we're extending a singleton swap it out for it's class
|
||||
if (klass) { args[0] = klass; }
|
||||
}
|
||||
|
||||
return (function(args){
|
||||
// store instance and class in private variables
|
||||
var instance = false;
|
||||
var klass = Class.extend.apply(args.callee, args);
|
||||
return {
|
||||
getInstance: function () {
|
||||
if (arguments[0] == __extending) return klass;
|
||||
if (instance) return instance;
|
||||
return (instance = new klass());
|
||||
}
|
||||
};
|
||||
})(args);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
// finally remap Class.create for backward compatability with prototype
|
||||
Class.create = function() {
|
||||
return Class.extend.apply(this, arguments);
|
||||
};
|
||||
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
* Neither the name of typicalnoise.com nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
9597
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/jquery-1.9.1.js
vendored
Normal file
9597
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/jquery-1.9.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
308
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/te.js
Normal file
308
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/te.js
Normal file
@ -0,0 +1,308 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Template-Engine
|
||||
//------------------------------------------------------------------------------
|
||||
// depends-on:
|
||||
// inheritance
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// String-Methoden ergänzen
|
||||
|
||||
APPCO = {};
|
||||
|
||||
APPCO.apply = function(o, c, defaults){
|
||||
// no "this" reference for friendly out of scope calls
|
||||
if (defaults) {
|
||||
APPCO.apply(o, defaults);
|
||||
}
|
||||
if (o && c && typeof c == 'object') {
|
||||
for (var p in c) {
|
||||
o[p] = c[p];
|
||||
}
|
||||
}
|
||||
return o;
|
||||
};
|
||||
|
||||
// quick and dirty! Manche Autoren lehnen solche Erweiterungen ab
|
||||
|
||||
APPCO.apply(String.prototype, {
|
||||
include: function (pattern) {
|
||||
return this.indexOf(pattern) > -1;
|
||||
},
|
||||
startsWith: function (pattern) {
|
||||
return this.lastIndexOf(pattern, 0) === 0;
|
||||
},
|
||||
endsWith: function (pattern) {
|
||||
var d = this.length - pattern.length;
|
||||
return d >= 0 && this.indexOf(pattern, d) === d;
|
||||
}
|
||||
});
|
||||
|
||||
APPCO.apply(String, {
|
||||
interpret: function(value) {
|
||||
return value == null ? '' : String(value);
|
||||
}
|
||||
});
|
||||
|
||||
// Namensraum
|
||||
|
||||
var TELIB = {};
|
||||
|
||||
TELIB.Generator_cl = Class.create({
|
||||
initialize: function () {
|
||||
this.reset_px();
|
||||
},
|
||||
reset_px: function () {
|
||||
this.code_a = ['var result_a = [];\n'];
|
||||
},
|
||||
write_px: function (text_spl) {
|
||||
// Escape-Zeichen bei Strings ergänzen
|
||||
var text_s = text_spl.replace(/"/g, '\\"');
|
||||
text_s = text_s.replace(/'/g, "\\'");
|
||||
this.code_a.push('result_a.push("' + text_s + '");\n');
|
||||
},
|
||||
code_px: function (code_spl) {
|
||||
if (code_spl.startsWith('if')) {
|
||||
this.code_a.push('if (' + code_spl.substr(2) + ') {\n');
|
||||
} else if (code_spl.startsWith('else')) {
|
||||
this.code_a.push('} else {\n');
|
||||
} else if (code_spl.startsWith('endif')) {
|
||||
this.code_a.push('}\n');
|
||||
} else if (code_spl.startsWith('for')) {
|
||||
this.code_a.push('for (' + code_spl.substr(3) + ') {\n');
|
||||
} else if (code_spl.startsWith('endfor')) {
|
||||
this.code_a.push('}\n');
|
||||
} else {
|
||||
this.code_a.push(code_spl + '\n');
|
||||
}
|
||||
},
|
||||
substitute_px: function (subst_spl) {
|
||||
this.code_a.push('result_a.push(' + String.interpret(subst_spl) + ');\n');
|
||||
},
|
||||
generate_px: function () {
|
||||
var result_s = this.code_a.join('') + ' return result_a.join("");';
|
||||
var f_o = new Function ('context', result_s);
|
||||
return f_o;
|
||||
}
|
||||
});
|
||||
|
||||
TELIB.TemplateCompiler_cl = Class.create({
|
||||
initialize: function () {
|
||||
this.gen_o = new TELIB.Generator_cl();
|
||||
this.reset_px();
|
||||
},
|
||||
reset_px: function () {
|
||||
this.gen_o.reset_px();
|
||||
this.preservePreWS_b = false;
|
||||
this.preservePostWS_b = false;
|
||||
},
|
||||
setPreWS_px: function (on_bpl) {
|
||||
if ((on_bpl == undefined) || (on_bpl == false)) {
|
||||
this.preservePreWS_b = false;
|
||||
} else {
|
||||
this.preservePreWS_b = true;
|
||||
}
|
||||
},
|
||||
setPostWS_px: function (on_bpl) {
|
||||
if ((on_bpl == undefined) || (on_bpl == false)) {
|
||||
this.preservePostWS_b = false;
|
||||
} else {
|
||||
this.preservePostWS_b = true;
|
||||
}
|
||||
},
|
||||
compile_px: function (source_spl) {
|
||||
var state_i = 0;
|
||||
var pos_i = 0;
|
||||
var len_i = source_spl.length;
|
||||
var text_s = '';
|
||||
var code_s = '';
|
||||
var subst_s = '';
|
||||
this.gen_o.reset_px();
|
||||
|
||||
var doubletest_f = function (char_spl) {
|
||||
var status_b = false;
|
||||
if ((pos_i + 1) < len_i) {
|
||||
if ((source_spl[pos_i] == char_spl) && (source_spl[pos_i+1] == char_spl)) {
|
||||
status_b = true;
|
||||
}
|
||||
}
|
||||
return status_b;
|
||||
}
|
||||
|
||||
while (pos_i < len_i) {
|
||||
switch (state_i) {
|
||||
case 0:
|
||||
// outside
|
||||
if (source_spl[pos_i] == '@') { // ECMA 5!
|
||||
if (doubletest_f('@') == false) {
|
||||
state_i = 2;
|
||||
code_s = '';
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
state_i = 1;
|
||||
text_s = '@';
|
||||
pos_i++;
|
||||
}
|
||||
} else if (source_spl[pos_i] == '#') {
|
||||
if (doubletest_f('#') == false) {
|
||||
state_i = 3;
|
||||
subst_s = '';
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
state_i = 1;
|
||||
text_s = '#';
|
||||
pos_i++;
|
||||
}
|
||||
} else if ((source_spl[pos_i] == ' ') || (source_spl[pos_i] == '\t')) {
|
||||
state_i = 4;
|
||||
text_s = '';
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
} else {
|
||||
state_i = 1;
|
||||
text_s = '';
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// inText
|
||||
if (source_spl[pos_i] == '@') {
|
||||
if (doubletest_f('@') == false) {
|
||||
// Textende, neuer Code
|
||||
state_i = 0;
|
||||
this.gen_o.write_px(text_s);
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
text_s += '@';
|
||||
pos_i++;
|
||||
}
|
||||
} else if (source_spl[pos_i] == '#') {
|
||||
if (doubletest_f('#') == false) {
|
||||
// Textende, neue Substitution
|
||||
state_i = 0;
|
||||
this.gen_o.write_px(text_s);
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
// Textende, neuer Code
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
text_s += '#';
|
||||
pos_i++;
|
||||
}
|
||||
} else if ((source_spl[pos_i] == ' ') || (source_spl[pos_i] == '\t')) {
|
||||
// Textende
|
||||
state_i = 0;
|
||||
this.gen_o.write_px(text_s);
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
} else {
|
||||
// sammeln
|
||||
if ((source_spl[pos_i] != '\n') && (source_spl[pos_i] != '\r')) {
|
||||
text_s += source_spl[pos_i];
|
||||
} else if (source_spl[pos_i] == '\n') {
|
||||
text_s += '\\n';
|
||||
} else {
|
||||
text_s += '\\r';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// inCode
|
||||
if (source_spl[pos_i] == '@') {
|
||||
if (doubletest_f('@') == false) {
|
||||
// zu Ende, erzeugen
|
||||
this.gen_o.code_px(code_s);
|
||||
state_i = 5; //0
|
||||
} else {
|
||||
// als normales Zeichen verarbeiten, ein Zeichen überlesen
|
||||
code_s += '@';
|
||||
pos_i++;
|
||||
}
|
||||
} else {
|
||||
// sammeln
|
||||
code_s += source_spl[pos_i];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// inSubst
|
||||
// Verdopplung # hier nicht zulässig!
|
||||
if (source_spl[pos_i] == '#') {
|
||||
// zu Ende, erzeugen
|
||||
this.gen_o.substitute_px(subst_s);
|
||||
state_i = 0;
|
||||
} else {
|
||||
// sammeln
|
||||
subst_s += source_spl[pos_i];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// pre-code-whitespace
|
||||
switch (source_spl[pos_i]) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
// sammeln
|
||||
text_s += source_spl[pos_i];
|
||||
break;
|
||||
default:
|
||||
state_i = 0;
|
||||
if (source_spl[pos_i] != '@') {
|
||||
this.gen_o.write_px(text_s);
|
||||
} else {
|
||||
if (doubletest_f('@') == false) {
|
||||
// Whitespace vor Code-Beginn erkannt
|
||||
if (this.preservePreWS_b == true) {
|
||||
// trotzdem ausgeben
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
} // ansonsten wie normales Zeichen behandeln
|
||||
}
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// post-code-whitespace
|
||||
switch (source_spl[pos_i]) {
|
||||
case '\n':
|
||||
text_s += '\\n';
|
||||
state_i = 0;
|
||||
break;
|
||||
case '\r':
|
||||
text_s += '\\r';
|
||||
state_i = 0;
|
||||
break;
|
||||
case ' ':
|
||||
case '\t':
|
||||
// ggf. sammeln
|
||||
text_s += source_spl[pos_i];
|
||||
break;
|
||||
default:
|
||||
// Whitespace nach Code erkannt
|
||||
if (this.preservePostWS_b == true) {
|
||||
// trotzdem ausgeben
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
state_i = 0;
|
||||
pos_i--; // Zeichen erneut verarbeiten
|
||||
}
|
||||
break;
|
||||
}
|
||||
pos_i++;
|
||||
}
|
||||
// welcher Zustand liegt abschließend vor?
|
||||
if (state_i == 1) {
|
||||
this.gen_o.write_px(text_s);
|
||||
} else if (state_i == 2) {
|
||||
this.gen_o.code_px(code_s);
|
||||
} else if (state_i == 3) {
|
||||
this.gen_o.substitute_px(subst_s);
|
||||
} else if (state_i == 4) {
|
||||
if (this.preservePreWS_b == true) {
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
} else if (state_i == 5) {
|
||||
if (this.preservePostWS_b == true) {
|
||||
this.gen_o.write_px(text_s);
|
||||
}
|
||||
}
|
||||
|
||||
return this.gen_o.generate_px();
|
||||
}
|
||||
});
|
||||
// EOF
|
61
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/tm.js
Normal file
61
Sammlung/Praktikum/3/ias_p2_b0.1/js/import/tm.js
Normal file
@ -0,0 +1,61 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Template-Manager
|
||||
// - Laden und Bereitstellen von Template-Quellen oder anderen Textquellen
|
||||
//------------------------------------------------------------------------------
|
||||
// depends-on:
|
||||
// jquery
|
||||
// inheritance
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Namensraum TELIB verwenden
|
||||
|
||||
TELIB.TemplateManager_cl = Class.create({
|
||||
initialize: function () {
|
||||
this.templates_o = {};
|
||||
this.compiled_o = {};
|
||||
this.teCompiler_o = new TELIB.TemplateCompiler_cl();
|
||||
// Templates als Ressource anfordern und speichern
|
||||
var path_s = "/template/";
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: path_s,
|
||||
type: 'GET',
|
||||
context: this
|
||||
})
|
||||
.done(function (data_opl) {
|
||||
this.templates_o = data_opl['templates'];
|
||||
// Benachrichtigung senden
|
||||
//+++ Bezeichnung Namensraum korrigieren
|
||||
//SHOP.eventService.publish_px('app', ['artikelliste', null]);
|
||||
})
|
||||
.fail(function(jqXHR_opl, textStatus_spl) {
|
||||
alert( "[TELIB.tm] Fehler bei Anforderung: " + textStatus_spl );
|
||||
});
|
||||
},
|
||||
get_px: function (name_spl) {
|
||||
if (name_spl in this.templates_o) {
|
||||
return this.templates_o[name_spl];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
execute_px: function (name_spl, data_opl) {
|
||||
var compiled_o = null;
|
||||
if (name_spl in this.compiled_o) {
|
||||
compiled_o = this.compiled_o[name_spl];
|
||||
} else {
|
||||
// Übersetzen und ausführen
|
||||
if (name_spl in this.templates_o) {
|
||||
this.teCompiler_o.reset_px();
|
||||
compiled_o = this.teCompiler_o.compile_px(this.templates_o[name_spl]);
|
||||
this.compiled_o[name_spl] = compiled_o;
|
||||
}
|
||||
}
|
||||
if (compiled_o != null) {
|
||||
return compiled_o(data_opl);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
// EOF
|
37
Sammlung/Praktikum/3/ias_p2_b0.1/js/kaufen.js
Normal file
37
Sammlung/Praktikum/3/ias_p2_b0.1/js/kaufen.js
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
function startNaechsteAuktion(los_nr){
|
||||
clearInterval(interval_id);
|
||||
los_nr++;
|
||||
if(los_nr <= charge_data['info']['anzAuk']){
|
||||
document.getElementById('los_nr').value = los_nr;
|
||||
los(los_nr);
|
||||
}
|
||||
else{
|
||||
viewLetzteAuktion(los_nr);
|
||||
viewAktuelleAuktion(los_nr);
|
||||
viewCanvasData(los_nr);
|
||||
|
||||
document.getElementById('los_nr').value == -1;
|
||||
charge();
|
||||
}
|
||||
};
|
||||
|
||||
function runden2Nachkomma(zahl){
|
||||
Ergebnis = Math.round(zahl *100) / 100;
|
||||
return Ergebnis;
|
||||
};
|
||||
|
||||
function calcVkPreis(los_nr){
|
||||
tmp = charge_data[los_nr]['startPreis']
|
||||
- (((charge_data[los_nr]['startPreis'] - charge_data[los_nr]['minPreis'])
|
||||
/ charge_data[los_nr]['auktionDauer'])
|
||||
* charge_data[los_nr]['auktionLaufzeit']);
|
||||
|
||||
charge_data[los_nr]['vkPreis'] = runden2Nachkomma(tmp);
|
||||
};
|
||||
|
||||
function kaufen(buyguy){
|
||||
los_nr = document.getElementById('los_nr').value;
|
||||
startNaechsteAuktion(los_nr);
|
||||
sendLog(buyguy, los_nr);
|
||||
};
|
46
Sammlung/Praktikum/3/ias_p2_b0.1/js/main.js
Normal file
46
Sammlung/Praktikum/3/ias_p2_b0.1/js/main.js
Normal file
@ -0,0 +1,46 @@
|
||||
var interval_id;
|
||||
var charge_data = {};
|
||||
var TPL = {};
|
||||
|
||||
function auktion(los_nr){
|
||||
if(charge_data[los_nr]['auktionLaufzeit'] <= charge_data[los_nr]['auktionDauer']){
|
||||
|
||||
viewCanvasData(los_nr);
|
||||
|
||||
calcVkPreis(los_nr);
|
||||
viewAktuelleAuktion(los_nr);
|
||||
viewNaechsteAuktion(los_nr);
|
||||
viewLetzteAuktion(los_nr);
|
||||
|
||||
charge_data[los_nr]['auktionLaufzeit']++;
|
||||
}
|
||||
};
|
||||
|
||||
function los(los_nr){
|
||||
calcVkPreis(los_nr);
|
||||
viewLetzteAuktion(los_nr);
|
||||
viewNaechsteAuktion(los_nr);
|
||||
viewAktuelleAuktion(los_nr);
|
||||
|
||||
|
||||
interval_id = setInterval( function() {auktion(los_nr)}, 1000);
|
||||
};
|
||||
|
||||
function charge(){
|
||||
// if( Number(document.getElementById('los_nr').value) == -1){
|
||||
// alert("neu");
|
||||
neueCharge();
|
||||
// }
|
||||
// else{
|
||||
// alert("gebr");
|
||||
// los(document.getElementById('los_nr').value);
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(
|
||||
function(){
|
||||
TPL.engine = new TELIB.TemplateManager_cl();
|
||||
charge();
|
||||
}
|
||||
);
|
@ -0,0 +1,16 @@
|
||||
function neueCharge(){
|
||||
/*der Server stellt die n<>chste Charge zur Verf<72>gung*/
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: '/chargen',
|
||||
type: 'NEXT'
|
||||
})
|
||||
.done(function(newCharge){
|
||||
charge_data = eval("(" + newCharge + ")");
|
||||
los('1');
|
||||
document.getElementById('los_nr').value = 1;
|
||||
})
|
||||
.fail(function(error){
|
||||
alert("R<>ckgabe von NEXT fehlerhaft");
|
||||
});
|
||||
};
|
30
Sammlung/Praktikum/3/ias_p2_b0.1/js/transfer/log.js
Normal file
30
Sammlung/Praktikum/3/ias_p2_b0.1/js/transfer/log.js
Normal file
@ -0,0 +1,30 @@
|
||||
function sendLog(buyguy, los_nr){
|
||||
|
||||
/*var log = '{' +
|
||||
'buyer: ' + buyguy + ', ' +
|
||||
'charge: ' + charge_data['info']['name'] + ', ' +
|
||||
'los: ' + los_nr + ', ' +
|
||||
'preis: ' + charge_data[los_nr]['vkPreis']
|
||||
+ '}';*/
|
||||
/*var log = {};
|
||||
log['buyer'] = buyguy;
|
||||
log['charge'] = charge_data['info']['name'];
|
||||
log['los'] = los_nr;
|
||||
log['preis'] = charge_data[los_nr]['vkPreis'];*/
|
||||
|
||||
var path = "/log";
|
||||
path += '/' + buyguy;
|
||||
path += '/' + charge_data['info']['name'];
|
||||
path += '/' + los_nr;
|
||||
path += '/' + charge_data[los_nr]['vkPreis'];
|
||||
|
||||
$.ajax({
|
||||
// url: "/log",
|
||||
url: path,
|
||||
type: 'SEND'//,
|
||||
// data: gelogen
|
||||
})
|
||||
.fail(function(){
|
||||
alert("Übertragung des Logeintrags fehlgeschlagen");
|
||||
});
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
function loadLosData(){};
|
||||
function sendChargendata(chargendata, neu){
|
||||
var path = '/manager/' + chargendata + '/' + neu;
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'RECEIVE',
|
||||
})
|
||||
.fail(function(){
|
||||
alert("Chargendaten konnten nicht an den Server <20>bertragen werden");
|
||||
});
|
||||
};
|
54
Sammlung/Praktikum/3/ias_p2_b0.1/js/view/viewAuktion.js
Normal file
54
Sammlung/Praktikum/3/ias_p2_b0.1/js/view/viewAuktion.js
Normal file
@ -0,0 +1,54 @@
|
||||
//ajax krempel hier hin pasten von main.js
|
||||
|
||||
function viewLetzteAuktion(los_nr){
|
||||
try{
|
||||
var markup = '<p>' + charge_data[(Number(los_nr) - 1)]['beschreibung'] + '</p>' +
|
||||
'<p>verkauft f<>r: ' + charge_data[(Number(los_nr) - 1)]['vkPreis'] + '</p>';
|
||||
|
||||
$('#letzteAuktion').html(markup);
|
||||
}
|
||||
catch(e){
|
||||
$('#letzteAuktion').html('<p>keine Auktion beendet</p>');
|
||||
}
|
||||
};
|
||||
|
||||
function viewNaechsteAuktion(los_nr){
|
||||
try{
|
||||
var markup = '<p>' + charge_data[(Number(los_nr) + 1)]['beschreibung'] + '</p>' +
|
||||
'<p>Startpreis: ' + charge_data[(Number(los_nr) + 1)]['startPreis'] + '</p>';
|
||||
|
||||
$('#naechsteAuktion').html(markup);
|
||||
}
|
||||
catch(e){
|
||||
$('#naechsteAuktion').html('<p>letzte Auktion l<>uft bereits!</p>');
|
||||
}
|
||||
};
|
||||
|
||||
function viewAktuelleAuktion(los_nr){
|
||||
try{
|
||||
var markup = '<p>' + charge_data[los_nr]['beschreibung'] + '</p>' +
|
||||
'<p>aktueller Preis: ' + charge_data[los_nr]['vkPreis'] + '</p>';
|
||||
|
||||
$('#aktuelleAuktion').html(markup);
|
||||
}
|
||||
catch(e){
|
||||
$('#aktuelleAuktion').html('<p>aktuell keine Auktionen eingestellt</p>');
|
||||
}
|
||||
};
|
||||
|
||||
function viewCanvasData(los_nr){
|
||||
try{
|
||||
renderCanvas((charge_data[los_nr]['auktionDauer'] - charge_data[los_nr]['auktionLaufzeit']),(((charge_data[los_nr]['auktionDauer'] - charge_data[los_nr]['auktionLaufzeit']) / charge_data[los_nr]['auktionDauer']) * 360));
|
||||
}
|
||||
catch(e){
|
||||
$('#canvas').html('<p>aktuell keine Auktionen eingestellt</p>');
|
||||
}
|
||||
}
|
||||
function viewAuktionen(){
|
||||
$.get('templates/html/auktionsansicht.html', function(markup){
|
||||
$('#content').html(markup);
|
||||
})
|
||||
|
||||
var los_nr = document.getElementById('los_nr').value;
|
||||
los(los_nr);
|
||||
};
|
96
Sammlung/Praktikum/3/ias_p2_b0.1/js/view/viewCanvas.js
Normal file
96
Sammlung/Praktikum/3/ias_p2_b0.1/js/view/viewCanvas.js
Normal file
@ -0,0 +1,96 @@
|
||||
function deg2Rad(degree){
|
||||
var factor = Math.PI/180;
|
||||
return degree * factor;
|
||||
};
|
||||
|
||||
function degreeConverter(degree){
|
||||
if(degree > 0){
|
||||
degree--;
|
||||
}
|
||||
else{
|
||||
degree = 1;
|
||||
}
|
||||
return degree;
|
||||
};
|
||||
|
||||
function color8Tor(requestType, degree){
|
||||
switch(requestType){
|
||||
case 'strokeStyle':
|
||||
if(degree > 180){
|
||||
return 'green';
|
||||
}
|
||||
if(degree <= 181 && degree > 120){
|
||||
return 'yellow';
|
||||
}
|
||||
if(degree <= 121 && degree > 37){
|
||||
return 'orange';
|
||||
}
|
||||
if(degree <= 36){
|
||||
return 'red';
|
||||
}
|
||||
break;
|
||||
case 'shadowColor':
|
||||
if(degree > 180){
|
||||
return 'lightgreen';
|
||||
}
|
||||
if(degree <= 181 && degree > 120){
|
||||
return 'blue';
|
||||
}
|
||||
if(degree <= 121 && degree > 60){
|
||||
return 'orange';
|
||||
}
|
||||
if(degree <= 61){
|
||||
return 'red';
|
||||
}
|
||||
break;
|
||||
case 'fillStyle':
|
||||
if(degree > 180){
|
||||
return 'green';
|
||||
}
|
||||
if(degree <= 181 && degree > 120){
|
||||
return 'yellow';
|
||||
}
|
||||
if(degree <= 121 && degree > 37){
|
||||
return 'orange';
|
||||
}
|
||||
if(degree <= 36){
|
||||
return 'red';
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
function renderCanvas(countDown, degree){
|
||||
var canvas = document.getElementById('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
//ctx.strokeStyle = 'green';
|
||||
ctx.strokeStyle = color8Tor('strokeStyle', degree);
|
||||
ctx.lineWidth = 17;
|
||||
ctx.lineCap = 'round';
|
||||
ctx.shadowBlur = 15;
|
||||
//ctx.shadowColor = 'lightgreen';
|
||||
ctx.shadowColor = color8Tor('shadowColor', degree);
|
||||
|
||||
|
||||
|
||||
gradient = ctx.createRadialGradient(150, 150, 5, 150, 150, 100);
|
||||
gradient.addColorStop(0, 'lightblue');
|
||||
gradient.addColorStop(1, 'white');
|
||||
ctx.fillStyle = gradient;
|
||||
|
||||
|
||||
ctx.fillRect(0, 0, 300, 300);
|
||||
|
||||
ctx.beginPath();
|
||||
|
||||
degree = degreeConverter(degree);
|
||||
ctx.arc(150, 150, 100, deg2Rad(270), deg2Rad(degree - 90));
|
||||
|
||||
ctx.stroke();
|
||||
|
||||
ctx.font = "30px Arial";
|
||||
//ctx.fillStyle = 'green';
|
||||
ctx.fillStyle = color8Tor('fillStyle', degree);
|
||||
ctx.fillText(countDown, 145, 160);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
function viewChargenubersicht(){
|
||||
clearInterval(interval_id);
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: '/manager',
|
||||
type: 'LIST'
|
||||
})
|
||||
.done(function(liste){
|
||||
markup = TPL.engine.execute_px('chargenubersicht.tpl', liste);
|
||||
$("#content").html(markup);
|
||||
$('#content').append('<p><button class = "bigbutton" onclick = viewAuktionen()>zurück</button><button class = "wizardButtonNeu"onclick = wizardStart()>NEU</button></p>');
|
||||
})
|
||||
.fail(function(){
|
||||
alert("Chargenliste konnte nicht geladen werden");
|
||||
});
|
||||
}
|
||||
|
||||
function viewLosData(chargenNr, losNr){
|
||||
|
||||
}
|
16
Sammlung/Praktikum/3/ias_p2_b0.1/js/view/viewLog.js
Normal file
16
Sammlung/Praktikum/3/ias_p2_b0.1/js/view/viewLog.js
Normal file
@ -0,0 +1,16 @@
|
||||
function viewLogfile(){
|
||||
clearInterval(interval_id);
|
||||
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: '/log',
|
||||
type: 'REQ'
|
||||
})
|
||||
.done(function(log){
|
||||
var markup = TPL.engine.execute_px('log.tpl', log);
|
||||
$('#content').html(markup);
|
||||
})
|
||||
.fail(function(){});
|
||||
var markup = '<h1>Logfile</h1><p><button onclick = viewAuktionen()>zur<75>ck</button></p>';
|
||||
$('#content').append(markup);
|
||||
}
|
132
Sammlung/Praktikum/3/ias_p2_b0.1/js/wizard.js
Normal file
132
Sammlung/Praktikum/3/ias_p2_b0.1/js/wizard.js
Normal file
@ -0,0 +1,132 @@
|
||||
var wizardData = {};
|
||||
function wizardDelete(nr){
|
||||
var path = '/manager/' + nr;
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE'
|
||||
})
|
||||
.done(function(){
|
||||
viewChargenubersicht();
|
||||
})
|
||||
.fail(function(){
|
||||
alert("Charge konnte nicht gel<65>scht werden");
|
||||
});
|
||||
|
||||
};
|
||||
function wizardSend(){
|
||||
//wizardData -> ajax -> server -> fuckoff
|
||||
var path = '/manager/' + JSON.stringify(wizardData);
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'RECEIVE'
|
||||
})
|
||||
.done(function(){
|
||||
viewChargenubersicht();
|
||||
})
|
||||
.fail(function(){
|
||||
alert("die <20>bertragung der Chargendaten zum Server ist fehlgeschlagen");
|
||||
});
|
||||
};
|
||||
function wizardLosDataSave(los_nr, next_los_nr){
|
||||
wizardData[los_nr]['beschreibung'] = document.getElementById('beschreibung').value;
|
||||
wizardData[los_nr]['anzGebinde'] = parseInt(document.getElementById('anzGebinde').value);
|
||||
wizardData[los_nr]['auktionDauer'] = parseInt(document.getElementById('auktionDauer').value);
|
||||
wizardData[los_nr]['auktionLaufzeit'] = 0;
|
||||
wizardData[los_nr]['startPreis'] = parseInt(document.getElementById('startPreis').value);
|
||||
wizardData[los_nr]['minPreis'] = parseInt(document.getElementById('minPreis').value);
|
||||
wizardData[los_nr]['auktionPreis'] = -1;
|
||||
wizardData[los_nr]['vkPreis'] = -1;
|
||||
|
||||
if(next_los_nr == 0){
|
||||
wizardSend();
|
||||
}
|
||||
else if(next_los_nr > wizardData['info']['anzAuk']){
|
||||
wizardLosData(next_los_nr, 1);
|
||||
}
|
||||
else{
|
||||
wizardLosData(next_los_nr, 0);
|
||||
}
|
||||
};
|
||||
function wizardLosData(los_nr, neu){
|
||||
$('#content').html('<h1>Los ' + los_nr + '</h1>');
|
||||
if(neu){
|
||||
wizardData['info']['anzAuk']++;
|
||||
wizardData[los_nr] = {};
|
||||
|
||||
$.get('templates/html/losLeerForm.html', function(markup){
|
||||
$('#content').append(markup);
|
||||
if(los_nr > 9){
|
||||
$('#content').append('<button class = "bigbutton" onclick = wizardLosDataSave('+los_nr+','+(los_nr - 1)+') >zur<75>ck</button><button class = "wizardButtonFertig" onclick = wizardLosDataSave('+los_nr+',' +0+ ')>Fertig</button>');
|
||||
}
|
||||
else if(los_nr == 1){
|
||||
$('#content').append('<button class = "bigbutton" onclick = wizardChargenname(0) >zur<75>ck</button><button class = "wizardButtonFertig" onclick = wizardLosDataSave('+los_nr+',' +0+ ')>Fertig</button><button class = "wizardButtonNeu" onclick = wizardLosDataSave('+los_nr+','+(los_nr + 1)+')>neu</button>');
|
||||
}
|
||||
else{
|
||||
$('#content').append('<button class = "bigbutton" onclick = wizardLosDataSave('+los_nr+','+(los_nr - 1)+') >zur<75>ck</button><button class = "wizardButtonFertig" onclick = wizardLosDataSave('+los_nr+',' +0+ ')>Fertig</button><button class = "wizardButtonNeu" onclick = wizardLosDataSave('+los_nr+','+(los_nr + 1)+')>neu</button>');
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
markup = TPL.engine.execute_px('losFilledForm.tpl',wizardData[los_nr]);
|
||||
$('#content').append(markup);
|
||||
if(los_nr > 9){
|
||||
$('#content').append('<button class = "bigbutton" onclick = wizardLosDataSave('+los_nr+','+(los_nr - 1)+') >zur<75>ck</button><button class = "wizardButtonFertig" onclick = wizardLosDataSave('+los_nr+',' +0+ ')>Fertig</button>');
|
||||
}
|
||||
else if(los_nr == 1){
|
||||
$('#content').append('<button class = "bigbutton" onclick = wizardChargenname(0) >zur<75>ck</button><button class = "wizardButtonFertig" onclick = wizardLosDataSave('+los_nr+',' +0+ ')>Fertig</button><button class = "bigbutton" onclick = wizardLosDataSave('+los_nr+','+(los_nr + 1)+')>weiter</button>');
|
||||
}
|
||||
else{
|
||||
$('#content').append('<button class = "bigbutton" onclick = wizardLosDataSave('+los_nr+','+(los_nr - 1)+') >zur<75>ck</button><button class = "wizardButtonFertig" onclick = wizardLosDataSave('+los_nr+',' +0+ ')>Fertig</button><button class = "bigbutton" onclick = wizardLosDataSave('+los_nr+','+(los_nr + 1)+')>weiter</button>');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function wizardChargennameSave(neu){
|
||||
wizardData['info']['name'] = document.getElementById('chargenname').value;
|
||||
if(neu){
|
||||
wizardLosData(1, 1);
|
||||
}
|
||||
else{
|
||||
wizardLosData(1, 0);
|
||||
}
|
||||
};
|
||||
|
||||
function wizardChargenname(neu){
|
||||
if(neu){
|
||||
$('#content').html('<h1>neue Charge</h1>');
|
||||
$('#content').append('<p><input type = "text" id = "chargenname"></p>');
|
||||
$('#content').append('<p><button class = "bigbutton" onclick = viewChargenubersicht() >zur<75>ck</button><button class = "bigbutton" onclick = wizardChargennameSave(1)>speichern und weiter</button></p>');
|
||||
}
|
||||
else{
|
||||
$('#content').html('<h1>Charge bearbeiten</h1>');
|
||||
$('#content').append('<p><input type = "text" id = "chargenname" value = '+wizardData['info']['name']+'></p>');
|
||||
$('#content').append('<p><button class = "bigbutton" onclick = viewChargenubersicht()>zur<75>ck</button><button class = "bigbutton" onclick = wizardChargennameSave(0)>speichern und weiter</button></p>');
|
||||
}
|
||||
};
|
||||
|
||||
function wizardStart(chargenNr = 0){
|
||||
if(chargenNr != 0){
|
||||
var path = '/manager/' + chargenNr;
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: path,
|
||||
type: 'GET'
|
||||
})
|
||||
.done(function(data){
|
||||
wizardData = eval("(" + data + ")");
|
||||
wizardChargenname(0);
|
||||
})
|
||||
.fail(function(){
|
||||
alert("Charge konnte nicht geladen werden");
|
||||
});
|
||||
}
|
||||
else{
|
||||
wizardData = {};
|
||||
wizardData['info'] = {};
|
||||
wizardData['info']['anzAuk'] = 0;
|
||||
wizardData['info']['chargenNr'] = -1;
|
||||
|
||||
wizardChargenname(1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user