From 96094547dd793868092dda4c2699a839287fa175 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 6 Mar 2016 14:51:50 +0100 Subject: Add image view, controller. --- client/partials/image/image.html | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 client/partials/image/image.html (limited to 'client/partials/image/image.html') diff --git a/client/partials/image/image.html b/client/partials/image/image.html new file mode 100644 index 0000000..586f003 --- /dev/null +++ b/client/partials/image/image.html @@ -0,0 +1,8 @@ +
+
+ Image +
+
+ Main Content +
+
-- cgit v1.2.3 From b0b2dc9a6451fc1a2d41b255600094da1ece6485 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 6 Mar 2016 15:04:47 +0100 Subject: Avalaible images can be display --- client/js/controllers/image/image.js | 10 +++++++--- client/js/services/Image.js | 29 +++++++++++++++++++++++++++-- client/partials/image/image.html | 8 +++++--- 3 files changed, 39 insertions(+), 8 deletions(-) (limited to 'client/partials/image/image.html') diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js index 036dec3..a8346b3 100644 --- a/client/js/controllers/image/image.js +++ b/client/js/controllers/image/image.js @@ -3,7 +3,11 @@ * * @param {$scope} $scope The $scope service from angular */ -mainApp.controller('imageCtrl', function ($scope) +mainApp.controller('imageCtrl', ['$scope', 'Image', function ($scope, Image) { - $scope.title="Test"; -}); + var callbackTest=function(){ + $scope.images=Image.getData().images; + }; + + Image.getImages(callbackTest); +}]); diff --git a/client/js/services/Image.js b/client/js/services/Image.js index eccd4af..2e8c56f 100644 --- a/client/js/services/Image.js +++ b/client/js/services/Image.js @@ -1,10 +1,31 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){ + var data={}; + data.images=null; var parseUploadImageAnswer=function(response, failedToSendRequest){ - console.log(response.data.Images[0]) + + // Defined return object + var requestParserResult={}; + requestParserResult.status=1; + requestParserResult.failReason=null; + + + if (typeof response.data.Images !== 'undefined') { + // Set status code + requestParserResult.status=0; + data.images=response.data.Images; + + } + else if(failedToSendRequest){ + requestParserResult.failReason="Failed to send request"; + } + else{ + requestParserResult.failReason="Error"; + } + return requestParserResult; }; @@ -24,10 +45,14 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){ }; + var getData=function(response){ + return data; + }; // Return services objects return { - getImages:getImages + getImages:getImages, + getData:getData }; diff --git a/client/partials/image/image.html b/client/partials/image/image.html index 586f003..8af8af5 100644 --- a/client/partials/image/image.html +++ b/client/partials/image/image.html @@ -1,8 +1,10 @@ -
+
- Image + Images disponibles
- Main Content +
+ {{image.name}} +
-- cgit v1.2.3 From 8ad216dedf017f3d6de047a25d08db3b98e16361 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 9 Mar 2016 15:33:52 +0100 Subject: test --- client/index.html | 2 +- client/js/controllers/image/image.js | 6 +++++- client/js/services/Image.js | 20 +++++++++++++++++++- client/partials/image/image.html | 7 +++++++ 4 files changed, 32 insertions(+), 3 deletions(-) (limited to 'client/partials/image/image.html') diff --git a/client/index.html b/client/index.html index a06994c..7ff859d 100644 --- a/client/index.html +++ b/client/index.html @@ -66,7 +66,7 @@ - + diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js index e298fcc..d499acb 100644 --- a/client/js/controllers/image/image.js +++ b/client/js/controllers/image/image.js @@ -3,7 +3,7 @@ * * @param {$scope} $scope The $scope service from angular */ -mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', function ($scope, Image, Loading) +mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading',function ($scope, Image, Loading) { var callbackTest=function(){ $scope.images=Image.getData().images; @@ -17,5 +17,9 @@ mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', function ($scope, else{ callbackTest(); } + + $scope.doUpload = function () { + Image.uploadImage($scope.myFile,function(){}); + }; }]); diff --git a/client/js/services/Image.js b/client/js/services/Image.js index 2e8c56f..decb5b2 100644 --- a/client/js/services/Image.js +++ b/client/js/services/Image.js @@ -44,6 +44,23 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){ }; + var uploadImage=function(fileToUpload, callback) { + + + var result=$http.post('../server/index.php', + $.param({"token" : Identity.getToken(), "task" : "image", 'action':'uploadImage', 'filename':fileToUpload, 'id':'6564'})); + + // Wait and handle the response + result.then(function (response){ + callback(parseUploadImageAnswer(response, false)); + },function(response){ + callback(parseUploadImageAnswer(response, true)); + }); + + + + } + var getData=function(response){ return data; @@ -52,7 +69,8 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){ // Return services objects return { getImages:getImages, - getData:getData + getData:getData, + uploadImage:uploadImage }; diff --git a/client/partials/image/image.html b/client/partials/image/image.html index 8af8af5..3f597fb 100644 --- a/client/partials/image/image.html +++ b/client/partials/image/image.html @@ -6,5 +6,12 @@
{{image.name}}
+
+ + +
+ + +
-- cgit v1.2.3 From 004dc2acdd2dea2dff8af670f855c40b54f38f4b Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 16 Mar 2016 15:36:12 +0100 Subject: Test --- client/partials/image/image.html | 23 +++++++++++++++++++---- index.php | 3 +++ 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'client/partials/image/image.html') diff --git a/client/partials/image/image.html b/client/partials/image/image.html index 8af8af5..620eda8 100644 --- a/client/partials/image/image.html +++ b/client/partials/image/image.html @@ -1,10 +1,25 @@
- Images disponibles + Image Manager
-
- {{image.name}} -
+ + + + + + + + + + + + + + + + + +
NameSizeAction
{{ image.name }}000actions
diff --git a/index.php b/index.php index e69de29..cf60860 100644 --- a/index.php +++ b/index.php @@ -0,0 +1,3 @@ + -- cgit v1.2.3 From f01cfa2ec71672e2b178c06f87037d8b793ddd67 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 16 Mar 2016 16:05:24 +0100 Subject: Make image manager --- client/partials/image/image.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'client/partials/image/image.html') diff --git a/client/partials/image/image.html b/client/partials/image/image.html index 471ce3c..c90cbe0 100644 --- a/client/partials/image/image.html +++ b/client/partials/image/image.html @@ -4,6 +4,14 @@
+ + + +
+ + +
+

@@ -15,13 +23,16 @@ - - + + - - +
{{ image.name }}000actions{{ (image.size / 1048576).toFixed(2) }} MB
+ + + +
-- cgit v1.2.3 From 0ce2b2fa301dde1c5b9c50c826d3ed44b00a5c44 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 16 Mar 2016 18:01:03 +0100 Subject: Add overlay upload --- client/index.html | 2 +- client/partials/image/image.html | 8 ++++---- client/partials/image/upload.html | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 client/partials/image/upload.html (limited to 'client/partials/image/image.html') diff --git a/client/index.html b/client/index.html index 7ff859d..08be038 100644 --- a/client/index.html +++ b/client/index.html @@ -23,7 +23,7 @@
- +
diff --git a/client/partials/image/image.html b/client/partials/image/image.html index c90cbe0..886a11d 100644 --- a/client/partials/image/image.html +++ b/client/partials/image/image.html @@ -1,14 +1,14 @@ -
+ + +
Image Manager
- -
- +

diff --git a/client/partials/image/upload.html b/client/partials/image/upload.html new file mode 100644 index 0000000..9049abf --- /dev/null +++ b/client/partials/image/upload.html @@ -0,0 +1,25 @@ +