cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lorinb...@apache.org
Subject [1/2] spec commit: [CB-2793] added definition and display of default values for camera.getPicture test
Date Fri, 29 Mar 2013 13:50:49 GMT
Updated Branches:
  refs/heads/master b3caa3e87 -> f08af16ad


[CB-2793] added definition and display of default values for camera.getPicture test


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/826d4433
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/826d4433
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/826d4433

Branch: refs/heads/master
Commit: 826d4433e7c174bbcc563c5aa73e5abb091b0acd
Parents: dbf631c
Author: lorinbeer <lorin@adobe.com>
Authored: Wed Mar 27 14:18:05 2013 -0700
Committer: lorinbeer <lorin@adobe.com>
Committed: Wed Mar 27 14:18:05 2013 -0700

----------------------------------------------------------------------
 camera/index.html |   50 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/826d4433/camera/index.html
----------------------------------------------------------------------
diff --git a/camera/index.html b/camera/index.html
index d0285df..09b08f3 100644
--- a/camera/index.html
+++ b/camera/index.html
@@ -39,6 +39,17 @@
     var fileObj = null;
     var fileEntry = null;
     var pageStartTime = +new Date();
+    
+    //default camera options
+    var camQualityDefault = ['quality value', 50];
+    var camDestinationTypeDefault = ['FILE_URI', 1];
+    var camPictureSourceTypeDefault = ['CAMERA', 1];
+    var camAllowEditDefault = ['allowEdit', false];
+    var camEncodingTypeDefault = ['JPEG', 0];
+    var camMediaTypeDefault = ['mediaType', 0];
+    var camCorrectOrientationDefault = ['correctOrientation', false];
+    var camSaveToPhotoAlbumDefault = ['saveToPhotoAlbum', true];
+    
 
     //-------------------------------------------------------------------------
     // Camera
@@ -276,25 +287,37 @@
         return ret;
     }
 
-    function createOptionsEl(name, values) {
+    function createOptionsEl(name, values, selectionDefault) {
         var container = document.createElement('div');
         container.style.display = 'inline-block';
         container.appendChild(document.createTextNode(name + ': '));
         var select = document.createElement('select');
         select.keyName = name;
         container.appendChild(select);
-        var opt = document.createElement('option');
-        opt.value = '';
-        opt.textContent = '<default>';
-        select.appendChild(opt);
+        
+        // if we didn't get a default value, insert the blank <default> entry
+        if (selectionDefault == undefined) {
+            var opt = document.createElement('option');
+            opt.value = '';
+            opt.text = '<default>';
+            select.appendChild(opt);
+        }
+        
         select.isBool = typeof values == 'boolean';
         if (select.isBool) {
             values = {'true': 1, 'false': 0};
         }
+        
         for (var k in values) {
+            console.log(name + " value = " + k);
             var opt = document.createElement('option');
             opt.value = values[k];
             opt.textContent = k;
+            if (selectionDefault) {
+                if (selectionDefault[0] == k) {
+                    opt.selected = true;
+                }
+            }
             select.appendChild(opt);
         }
         var optionsDiv = document.getElementById('image-options');
@@ -308,17 +331,18 @@
         document.addEventListener("deviceready", function() {
             deviceReady = true;
             console.log("Device="+device.platform+" "+device.version);
-            createOptionsEl('sourceType', Camera.PictureSourceType);
-            createOptionsEl('destinationType', Camera.DestinationType);
-            createOptionsEl('encodingType', Camera.EncodingType);
-            createOptionsEl('mediaType', Camera.MediaType);
-            createOptionsEl('quality', {'0': 0, '50': 50, '80': 80, '100': 100});
+            createOptionsEl('sourceType', Camera.PictureSourceType, camPictureSourceTypeDefault);
+            createOptionsEl('destinationType', Camera.DestinationType, camDestinationTypeDefault);
+            createOptionsEl('encodingType', Camera.EncodingType, camEncodingTypeDefault);
+            createOptionsEl('mediaType', Camera.MediaType, camMediaTypeDefault);
+            createOptionsEl('quality', {'0': 0, '50': 50, '80': 80, '100': 100}, camQualityDefault);
             createOptionsEl('targetWidth', {'50': 50, '200': 200, '800': 800, '2048': 2048});
             createOptionsEl('targetHeight', {'50': 50, '200': 200, '800': 800, '2048': 2048});
-            createOptionsEl('allowEdit', true);
-            createOptionsEl('correctOrientation', true);
-            createOptionsEl('saveToPhotoAlbum', true);
+            createOptionsEl('allowEdit', true, camAllowEditDefault);
+            createOptionsEl('correctOrientation', true, camCorrectOrientationDefault);
+            createOptionsEl('saveToPhotoAlbum', true, camSaveToPhotoAlbumDefault);
             createOptionsEl('cameraDirection', Camera.Direction);
+                          
         }, false);
         window.setTimeout(function() {
             if (!deviceReady) {


Mime
View raw message