Form-Validierung angepasst

This commit is contained in:
Carsten Hilmer 2016-01-07 23:03:01 +01:00
parent 307d5a772c
commit a2b2b6b37e
64 changed files with 198 additions and 67 deletions

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main"><source path="C:\Ionic\Ionic\wollerosenkaufen\platforms\android\CordovaLib\assets"/></dataSet><dataSet config="debug"><source path="C:\Ionic\Ionic\wollerosenkaufen\platforms\android\CordovaLib\src\debug\assets"/></dataSet></merger>
<merger version="3"><dataSet config="main"><source path="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\CordovaLib\assets"/></dataSet><dataSet config="debug"><source path="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\CordovaLib\src\debug\assets"/></dataSet></merger>

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main"><source path="C:\Ionic\Ionic\wollerosenkaufen\platforms\android\CordovaLib\res"/><source path="C:\Ionic\Ionic\wollerosenkaufen\platforms\android\CordovaLib\build\generated\res\rs\debug"/><source path="C:\Ionic\Ionic\wollerosenkaufen\platforms\android\CordovaLib\build\generated\res\generated\debug"/></dataSet><dataSet config="debug"><source path="C:\Ionic\Ionic\wollerosenkaufen\platforms\android\CordovaLib\src\debug\res"/></dataSet><mergedItems/></merger>
<merger version="3"><dataSet config="main"><source path="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\CordovaLib\res"/><source path="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\CordovaLib\build\generated\res\rs\debug"/><source path="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\CordovaLib\build\generated\res\generated\debug"/></dataSet><dataSet config="debug"><source path="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\CordovaLib\src\debug\res"/></dataSet><mergedItems/></merger>

View File

@ -25,7 +25,7 @@
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="starter">
<body ng-app="starter" class="platform-android platform-cordova platform-webview">
<!--
The nav bar that will be updated as we navigate between views.
-->

View File

@ -1,6 +1,6 @@
angular.module('starter.controllers', [])
.controller('DashCtrl', function($scope,$ionicPopup) {
.controller('DashCtrl', function($scope,$ionicPopup,$http) {
$scope.preis="";
$scope.name="";
@ -18,7 +18,16 @@ angular.module('starter.controllers', [])
if (showAlert==1){
$scope.showAlert();
return;
}
var link = 'http://api.raataar.de/rosen/vorschau.php';
$http.post(link, {name : $scope.name, freitext: $scope.freitext, rosen: $scope.preis}).then(function (res){
$scope.response = res.data;
window.open($scope.response, '_system', 'location=yes');
return false;
});
};

View File

@ -39,8 +39,8 @@
<div class="row">
<div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-click="validate()">Vorschau</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-click="buyAdFree()">Jetzt Kaufen</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-disabled="!$parent.preis || !$parent.name || !$parent.freitext" ng-click="validate()">Vorschau</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-disabled="!$parent.preis || !$parent.freitext || !$parent.name" ng-click="buyAdFree()">Jetzt Kaufen</button></div>
</div>

View File

@ -1,6 +1,6 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Original file: C:\\Ionic\\Ionic\\wollerosenkaufen\\platforms\\android\\src\\com\\android\\vending\\billing\\IInAppBillingService.aidl
* Original file: C:\\Ionic\\Ionic\\git\\wolle-rosen-kaufen\\platforms\\android\\src\\com\\android\\vending\\billing\\IInAppBillingService.aidl
*/
package com.android.vending.billing;
/**

View File

@ -11,8 +11,11 @@ public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
public static final int screen=0x7f020001;
public static final int ic_action_next_item=0x7f020000;
public static final int ic_action_previous_item=0x7f020001;
public static final int ic_action_remove=0x7f020002;
public static final int icon=0x7f020003;
public static final int screen=0x7f020004;
}
public static final class string {
public static final int activity_name=0x7f040000;

View File

@ -46,6 +46,15 @@ module.exports = [
"cordova.plugins.Keyboard"
],
"runs": true
},
{
"file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js",
"id": "cordova-plugin-inappbrowser.inappbrowser",
"pluginId": "cordova-plugin-inappbrowser",
"clobbers": [
"cordova.InAppBrowser.open",
"window.open"
]
}
];
module.exports.metadata =
@ -57,7 +66,8 @@ module.exports.metadata =
"cordova-plugin-splashscreen": "3.0.0",
"cordova-plugin-statusbar": "2.0.0",
"cordova-plugin-whitelist": "1.2.0",
"ionic-plugin-keyboard": "1.0.8"
"ionic-plugin-keyboard": "1.0.8",
"cordova-plugin-inappbrowser": "1.1.1"
}
// BOTTOM OF METADATA
});

View File

@ -1,6 +1,6 @@
angular.module('starter.controllers', [])
.controller('DashCtrl', function($scope,$ionicPopup) {
.controller('DashCtrl', function($scope,$ionicPopup,$http) {
$scope.preis="";
$scope.name="";
@ -18,7 +18,16 @@ angular.module('starter.controllers', [])
if (showAlert==1){
$scope.showAlert();
return;
}
var link = 'http://api.raataar.de/rosen/vorschau.php';
$http.post(link, {name : $scope.name, freitext: $scope.freitext, rosen: $scope.preis}).then(function (res){
$scope.response = res.data;
window.open($scope.response, '_system', 'location=yes');
return false;
});
};
@ -32,7 +41,11 @@ angular.module('starter.controllers', [])
});
};
function successHandler (result) {
function buysuccessHandler (result) {
inappbilling.consumePurchase(successHandler, errorHandler, "3xrose");
}
function successHandler (result) {
var strResult = "";
if(typeof result === 'object') {
strResult = JSON.stringify(result);
@ -40,25 +53,18 @@ angular.module('starter.controllers', [])
strResult = result;
}
alert("SUCCESS: \r\n"+strResult );
}
}
function errorHandler (error) {
function errorHandler (error) {
alert("ERROR: \r\n"+error );
}
$scope.buyAdFree = function() {
alert($scope.preis);
if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") {
alert($scope.preis);
inappbilling.buy(successHandler, errorHandler,"3xrose");
inappbilling.consumePurchase(successHandler, errorHandler, "3xrose");
inappbilling.buy(buysuccessHandler, errorHandler,"3xrose");
}
}

View File

@ -0,0 +1,112 @@
cordova.define("cordova-plugin-inappbrowser.inappbrowser", function(require, exports, module) { /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
// special patch to correctly work on Ripple emulator (CB-9760)
if (window.parent && !!window.parent.ripple) { // https://gist.github.com/triceam/4658021
module.exports = window.open.bind(window); // fallback to default window.open behaviour
return;
}
var exec = require('cordova/exec');
var channel = require('cordova/channel');
var modulemapper = require('cordova/modulemapper');
var urlutil = require('cordova/urlutil');
function InAppBrowser() {
this.channels = {
'loadstart': channel.create('loadstart'),
'loadstop' : channel.create('loadstop'),
'loaderror' : channel.create('loaderror'),
'exit' : channel.create('exit')
};
}
InAppBrowser.prototype = {
_eventHandler: function (event) {
if (event && (event.type in this.channels)) {
this.channels[event.type].fire(event);
}
},
close: function (eventname) {
exec(null, null, "InAppBrowser", "close", []);
},
show: function (eventname) {
exec(null, null, "InAppBrowser", "show", []);
},
addEventListener: function (eventname,f) {
if (eventname in this.channels) {
this.channels[eventname].subscribe(f);
}
},
removeEventListener: function(eventname, f) {
if (eventname in this.channels) {
this.channels[eventname].unsubscribe(f);
}
},
executeScript: function(injectDetails, cb) {
if (injectDetails.code) {
exec(cb, null, "InAppBrowser", "injectScriptCode", [injectDetails.code, !!cb]);
} else if (injectDetails.file) {
exec(cb, null, "InAppBrowser", "injectScriptFile", [injectDetails.file, !!cb]);
} else {
throw new Error('executeScript requires exactly one of code or file to be specified');
}
},
insertCSS: function(injectDetails, cb) {
if (injectDetails.code) {
exec(cb, null, "InAppBrowser", "injectStyleCode", [injectDetails.code, !!cb]);
} else if (injectDetails.file) {
exec(cb, null, "InAppBrowser", "injectStyleFile", [injectDetails.file, !!cb]);
} else {
throw new Error('insertCSS requires exactly one of code or file to be specified');
}
}
};
module.exports = function(strUrl, strWindowName, strWindowFeatures, callbacks) {
// Don't catch calls that write to existing frames (e.g. named iframes).
if (window.frames && window.frames[strWindowName]) {
var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open');
return origOpenFunc.apply(window, arguments);
}
strUrl = urlutil.makeAbsolute(strUrl);
var iab = new InAppBrowser();
callbacks = callbacks || {};
for (var callbackName in callbacks) {
iab.addEventListener(callbackName, callbacks[callbackName]);
}
var cb = function(eventname) {
iab._eventHandler(eventname);
};
strWindowFeatures = strWindowFeatures || "";
exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
return iab;
};
});

View File

@ -20,9 +20,9 @@
<div style="padding-bottom:15px;">
<div class="item item-divider oswald">Wählen Sie Ihre Rosen aus</div>
<ion-list>
<ion-radio ng-model="preis" ng-value="'1xrose'" class="item item-thumbnail-left item-text-wrap"><img src="img/rose1.png"><h2 class="lobster">1 Rose </h2><p>Preis: 0,50 €</p></ion-radio>
<ion-radio ng-model="preis" ng-value="'3xrose'" class="item item-thumbnail-left item-text-wrap"><img src="img/rose3.png"><h2 class="lobster">3 Rosen</h2><p>Preis: 1,00 €</p></ion-radio>
<ion-radio ng-model="preis" ng-value="'9xrose'" class="item item-thumbnail-left item-text-wrap"><img src="img/rose10.png"><h2 class="lobster">9 Rosen</h2><p>Preis: 2,00 €</p></ion-radio>
<ion-radio ng-model="$parent.preis" ng-value="'1xrose'" class="item item-thumbnail-left item-text-wrap"><img src="img/rose1.png"><h2 class="lobster">1 Rose </h2><p>Preis: 0,50 € (inkl. Mwst 0,59 €)</p></ion-radio>
<ion-radio ng-model="$parent.preis" ng-value="'3xrose'" class="item item-thumbnail-left item-text-wrap"><img src="img/rose3.png"><h2 class="lobster">3 Rosen</h2><p>Preis: 1,00 € (inkl. Mwst 1,19 €)</p></ion-radio>
<ion-radio ng-model="$parent.preis" ng-value="'9xrose'" class="item item-thumbnail-left item-text-wrap"><img src="img/rose10.png"><h2 class="lobster">9 Rosen</h2><p>Preis: 2,00 € (inkl. Mwst 2,38 €)</p></ion-radio>
</ion-list>
<label class="item item-input item-select">
<div class="input-label">
@ -37,14 +37,14 @@
</div>
<div class="item item-divider oswald">Rosen kaufen?</div>
<div class="row">
<div class="col"><h1 class="lobster">Preis: <span>{{preis}} €</span></h1></div>
<div class="col"><br>
<button class="button button-small icon-left ion-image button-custom" ng-click="validate()">Vorschau</button>
<button class="button button-small icon-left ion-social-euro button-custom" ng-click="buyAdFree()">Jetzt Kaufen</button>
</div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-disabled="!$parent.preis || !$parent.name || !$parent.freitext" ng-click="validate()">Vorschau</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-disabled="!$parent.preis || !$parent.freitext || !$parent.name" ng-click="buyAdFree()">Jetzt Kaufen</button></div>
</div>
</div>
</div>
</ion-content>

View File

@ -15,5 +15,12 @@
sha1="565e3f24555b91a41efb1022e4b38d97307ce180">
<dex dex="C:\Ionic\Ionic\wollerosenkaufen\platforms\android\build\intermediates\pre-dexed\debug\classes-a0342bad41111596f8436cda33b5a5ee045fab74.jar" />
</item>
<item
jar="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\build\intermediates\exploded-aar\android\CordovaLib\unspecified\debug\classes.jar"
jumboMode="false"
revision="22.0.1"
sha1="4f9f240b09f2d9809f6abebda225eb2ae574c59a">
<dex dex="C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\build\intermediates\pre-dexed\debug\classes-ec055bf14dc687da3d1b2ed76b77548ddec8270d.jar" />
</item>
</items>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/C:/Ionic/Ionic/wollerosenkaufen/platforms/android/res/values/strings.xml -->
<!-- From: file:/C:/Ionic/Ionic/git/wolle-rosen-kaufen/platforms/android/res/values/strings.xml -->
<eat-comment/>
<string name="activity_name">@string/launcher_name</string>
<string name="app_name">Wolle Rosen kaufen</string>
<!-- From: file:/C:/Ionic/Ionic/wollerosenkaufen/platforms/android/res/values/billing_key_param.xml -->
<!-- From: file:/C:/Ionic/Ionic/git/wolle-rosen-kaufen/platforms/android/res/values/billing_key_param.xml -->
<eat-comment/>
<string name="billing_key_param">MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnmmtV3BOmcyoYAGFakzJWpM07n3F2SmaQnjyaZsENaAq6vb7ziam6bS5LqZgMTaXSO2T4QeYoi3UZEIwuQiQ0N6BYCUca3tCa/aT1pbvVOD67cIpM+Z14UFYBnOo1RVvf4KKGZ8zJ6qUm5vsDuIboZ7P4dyXzpxRBSO3R1jDWhVCT8dyAdfQwf1Dp6mPg0sv5Q6UjAO3Jg4sMjOZID6WcAHQFxB1lDgVGmf70WZwWuGh7gQy2SvnuFcDAxT73hGjSH1j1xZB0Wr0T/vvoGpcBwj+Tjt3BbqwY2R3VbbImsuBCrkbFTIojQ8hyqxSrhftCfLyn4h/2mauo8IRVi+RrwIDAQAB</string>
<!-- From: file:/C:/Ionic/Ionic/wollerosenkaufen/platforms/android/res/values/strings.xml -->
<!-- From: file:/C:/Ionic/Ionic/git/wolle-rosen-kaufen/platforms/android/res/values/strings.xml -->
<eat-comment/>
<string name="launcher_name">@string/app_name</string>
</resources>

View File

@ -23,6 +23,9 @@
<param name="android-package" value="io.ionic.keyboard.IonicKeyboard" />
<param name="onload" value="true" />
</feature>
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
@ -58,4 +61,4 @@
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
</widget>
<!-- From: file:/C:/Ionic/Ionic/wollerosenkaufen/platforms/android/res/xml/config.xml -->
<!-- From: file:/C:/Ionic/Ionic/git/wolle-rosen-kaufen/platforms/android/res/xml/config.xml -->

View File

@ -1,5 +1,8 @@
int drawable icon 0x7f020000
int drawable screen 0x7f020001
int drawable ic_action_next_item 0x7f020000
int drawable ic_action_previous_item 0x7f020001
int drawable ic_action_remove 0x7f020002
int drawable icon 0x7f020003
int drawable screen 0x7f020004
int string activity_name 0x7f040000
int string app_name 0x7f040001
int string billing_key_param 0x7f040002

View File

@ -1,2 +1,2 @@
C:\Ionic\Ionic\wollerosenkaufen\platforms\android\build\intermediates\classes\debug
C:\Ionic\Ionic\wollerosenkaufen\platforms\android\build\intermediates\pre-dexed\debug\classes-a0342bad41111596f8436cda33b5a5ee045fab74.jar
C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\build\intermediates\classes\debug
C:\Ionic\Ionic\git\wolle-rosen-kaufen\platforms\android\build\intermediates\pre-dexed\debug\classes-ec055bf14dc687da3d1b2ed76b77548ddec8270d.jar

View File

@ -5,21 +5,8 @@ angular.module('starter.controllers', [])
$scope.preis="";
$scope.name="";
$scope.freitext="";
var showAlert=0;
$scope.validate = function() {
showAlert=0;
if ($scope.name.length < 1){
showAlert=1;
}
if ($scope.freitext.length < 1){
showAlert=1;
}
if (showAlert==1){
$scope.showAlert();
return;
}
var link = 'http://api.raataar.de/rosen/vorschau.php';
@ -31,18 +18,9 @@ angular.module('starter.controllers', [])
};
$scope.showAlert = function() {
var alertPopup = $ionicPopup.alert({
title: 'Uuuupppsssiii',
template: 'Bitte prüfe deine Eingaben.'
});
alertPopup.then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
};
function buysuccessHandler (result) {
inappbilling.consumePurchase(successHandler, errorHandler, "3xrose");
inappbilling.consumePurchase(successHandler, errorHandler, $scope.preis);
}
function successHandler (result) {
@ -64,7 +42,7 @@ angular.module('starter.controllers', [])
alert($scope.preis);
if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") {
inappbilling.buy(buysuccessHandler, errorHandler,"3xrose");
inappbilling.buy(buysuccessHandler, errorHandler, $scope.preis);
}
}

View File

@ -39,8 +39,8 @@
<div class="row">
<div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-click="validate()">Vorschau</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-click="buyAdFree()">Jetzt Kaufen</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-disabled="!$parent.preis || !$parent.name || !$parent.freitext" ng-click="validate()">Vorschau</button></div>
<div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-disabled="!$parent.preis || !$parent.freitext || !$parent.name" ng-click="buyAdFree()">Jetzt Kaufen</button></div>
</div>