summaryrefslogtreecommitdiff
path: root/www/js/MontageCtrl.js
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-07-16 11:23:38 -0400
committerPliablePixels <pliablepixels@gmail.com>2015-07-16 11:23:38 -0400
commit61afc8d7011f8a741b2583708ac1834e8eec44c2 (patch)
tree436d709de6ba9e9ffd845a83c01c45ee342e8ad1 /www/js/MontageCtrl.js
parent82a0ec7a39ec49fb028876368014600a665f253c (diff)
moved saveImageToPhone to Modal - it was not working because button range was out of scope of modal controller range.
Diffstat (limited to 'www/js/MontageCtrl.js')
-rw-r--r--www/js/MontageCtrl.js91
1 files changed, 1 insertions, 90 deletions
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 420b6f12..1ba0c235 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -407,6 +407,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$ionicModal.fromTemplateUrl('templates/monitors-modal.html', {
scope: $scope,
animation: 'slide-in-up'
+
})
.then(function (modal) {
$scope.modal = modal;
@@ -593,96 +594,6 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
});
- function SaveSuccess() {
- $ionicLoading.show({
- template: "done!",
- noBackdrop: true,
- duration: 1000
- });
- console.log("***SUCCESS");
- }
-
- function SaveError(e) {
- $ionicLoading.show({
- template: "error - could not save",
- noBackdrop: true,
- duration: 2000
- });
- ZMDataModel.zmLog("Error saving image: " + e.message);
- console.log("***ERROR");
- }
-
- //-----------------------------------------------------------------------
- // Saves a snapshot of the monitor image to phone storage
- //-----------------------------------------------------------------------
-
-
- $scope.saveImageToPhone = function (mid) {
- $ionicLoading.show({
- template: "saving snapshot..",
- noBackdrop: true,
- duration: zm.httpTimeout
- });
-
- console.log("IMAGE CAPTURE");
- var canvas, context, imageDataUrl, imageData;
- var loginData = ZMDataModel.getLogin();
- var url = loginData.streamingurl +
- '/cgi-bin/zms?mode=single&monitor=' + $rootScope.tempmid +
- '&user=' + loginData.username +
- '&pass=' + loginData.password;
- ZMDataModel.zmLog("SavetoPhone:Trying to save image from " + url);
-
- var img = new Image();
- img.onload = function () {
- canvas = document.createElement('canvas');
- canvas.width = img.width;
- canvas.height = img.height;
- context = canvas.getContext('2d');
- context.drawImage(img, 0, 0);
- try {
- imageDataUrl = canvas.toDataURL('image/jpeg', 1.0);
- imageData = imageDataUrl.replace(/data:image\/jpeg;base64,/, '');
- cordova.exec(
- SaveSuccess,
- SaveError,
- 'Canvas2ImagePlugin',
- 'saveImageDataToLibrary', [imageData]
- );
- } catch (e) {
-
- SaveError(e.message);
- }
- };
- try {
- img.src = url;
- } catch (e) {
- SaveError(e.message);
-
- }
- };
-
-
-
-
-
- $scope.doRefresh = function () {
- console.log("***Pull to Refresh");
- $scope.monitors = [];
-
- var refresh = ZMDataModel.getMonitors(1);
- refresh.then(function (data) {
- $scope.monitors = data;
- $scope.$broadcast('scroll.refreshComplete');
- });
-
- };
-
- $scope.scaleImage = function () {
- console.log("Switching image style");
- $scope.imageStyle = !$scope.imageStyle;
-
- };
}]);