incubator-photark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bhargav Golla <bhargav.go...@gmail.com>
Subject Re: svn commit: r1372790 - in /incubator/photark/mobile/trunk/assets/www: css/custom.css index.html scripts/dataAccess.js scripts/facebook.js scripts/jquery.mobile.simpledialog2.js scripts/search.js scripts/tagging.js scripts/utils.js
Date Tue, 14 Aug 2012 09:21:26 GMT
Hey Prabhath,

Your last commit has modified the code for my file facebook.js as well.
Could you revert them back to its previous state?

Regards

On Tue, Aug 14, 2012 at 2:43 PM, <prabhathp@apache.org> wrote:

> Author: prabhathp
> Date: Tue Aug 14 09:13:14 2012
> New Revision: 1372790
>
> URL: http://svn.apache.org/viewvc?rev=1372790&view=rev
> Log:
> photo tagging functionlity
>
> Added:
>
> incubator/photark/mobile/trunk/assets/www/scripts/jquery.mobile.simpledialog2.js
>     incubator/photark/mobile/trunk/assets/www/scripts/tagging.js
> Modified:
>     incubator/photark/mobile/trunk/assets/www/css/custom.css
>     incubator/photark/mobile/trunk/assets/www/index.html
>     incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js
>     incubator/photark/mobile/trunk/assets/www/scripts/facebook.js
>     incubator/photark/mobile/trunk/assets/www/scripts/search.js
>     incubator/photark/mobile/trunk/assets/www/scripts/utils.js
>
> Modified: incubator/photark/mobile/trunk/assets/www/css/custom.css
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/css/custom.css?rev=1372790&r1=1372789&r2=1372790&view=diff
>
> ==============================================================================
> --- incubator/photark/mobile/trunk/assets/www/css/custom.css (original)
> +++ incubator/photark/mobile/trunk/assets/www/css/custom.css Tue Aug 14
> 09:13:14 2012
> @@ -1,15 +1,3 @@
> -/*img{
> -    padding: 5px !important;
> -}
> -
> -#gallery img {
> -       height: 100%;
> -}
> -
> -.thumbnail{
> -       padding:5px;
> -       height: 150px !important;
> -       width: 100% !important;
> -}*/
> -
> -
> +#tagPicture p {
> +    position: absolute;
> +}
> \ No newline at end of file
>
> Modified: incubator/photark/mobile/trunk/assets/www/index.html
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/index.html?rev=1372790&r1=1372789&r2=1372790&view=diff
>
> ==============================================================================
> --- incubator/photark/mobile/trunk/assets/www/index.html (original)
> +++ incubator/photark/mobile/trunk/assets/www/index.html Tue Aug 14
> 09:13:14 2012
> @@ -9,14 +9,16 @@
>                 type="text/css" />
>                 <link href="css/photoswipe.css" rel="stylesheet"
>                 type="text/css" />
> +               <link href="css/jquery.mobile.simpledialog.css"
> rel="stylesheet"
> +               type="text/css" />
>                 <link href="css/custom.css" rel="stylesheet"
>                 type="text/css" />
> -               <style>
> +               <!-- <style>
>                         .more
>                         {
>                                 text-align:right;
>                         }
> -               </style>
> +               </style> -->
>                 <script type="text/javascript"
> src="scripts/jquery-1.7.2.min.js"></script>
>                 <script type="text/javascript"
> src="scripts/jquery.mobile-1.1.0.min.js"></script>
>                 <script type="text/javascript"
> src="scripts/mobiscroll-2.0.full.min.js"></script>
> @@ -28,8 +30,10 @@
>                 <script type="text/javascript"
> src="scripts/facebook_js_sdk.js"></script><!--Facebook JS SDK-->
>                 <script type="text/javascript"
> src="scripts/facebook.js"></script><!--Facebook Implementation-->
>                 <!--For Facebook Implementation End-->
> +               <script type="text/javascript" charset="utf-8"
> src="scripts/jquery.mobile.simpledialog2.js"></script>
>                 <script type="text/javascript" charset="utf-8"
> src="scripts/contacts.js" ></script>
>                 <script type="text/javascript" charset="utf-8"
> src="scripts/utils.js" ></script>
> +               <script type="text/javascript" charset="utf-8"
> src="scripts/tagging.js" ></script>
>                 <script type="text/javascript" charset="utf-8"
> src="scripts/dataAccess.js"></script>
>                 <script type="text/javascript" charset="utf-8"
> src="scripts/search.js"></script>
>                 <!--For Flickr Implementation Start-->
> @@ -44,7 +48,7 @@
>                 <script type="text/javascript" charset="utf-8" src="
> http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true
> "></script>
>                 <script type="text/javascript" charset="utf-8"
> src="scripts/geoLocation.js" ></script>
>                 <script type="text/javascript" charset="utf-8"
> src="scripts/jquery.ui.map.js"></script>
> -               <script type="text/javascript" charset="utf-8"
> src="scripts/jquery.ui.map.services.js"></script>
> +               <!-- <script type="text/javascript" charset="utf-8"
> src="scripts/jquery.ui.map.services.js"></script> -->
>                 <script type="text/javascript" charset="utf-8"
> src="scripts/MapView.js"></script>
>                 <script type="text/javascript">
>                         var pictureSource;
> @@ -55,10 +59,15 @@
>                         var windowWidth;
>                         var windowHeight;
>
> +                       var tagObjects;
> +                       var tagObjectsSaved;
>                         // Wait for device
>                         document.addEventListener("deviceready",
> onDeviceReady, false);
>
>                         function onDeviceReady() {
> +
> +                               checkNetwork();
> +
>                                 pictureSource =
> navigator.camera.PictureSourceType;
>                                 destinationType =
> navigator.camera.DestinationType;
>                                 getContacts();
> @@ -84,14 +93,19 @@
>
>                                 //Auto complete feature of location
>                                 var options = {
> -                                       types: ['(cities)']
> -                               };
> -
> -                               var autocomplete = new
> google.maps.places.Autocomplete($("#editLocation")[0], options);
> -                   google.maps.event.addListener(autocomplete,
> 'place_changed', function() {
> -                       var place = autocomplete.getPlace();
> -                       console.log(place.address_components);
> -                   });
> +                                       types: ['(cities)'
> +                                       ]
> +                               };
> +
> +                               if(google) {
> +                                       var autocomplete = new
> google.maps.places.Autocomplete($("#editLocation")[0], options);
> +
> google.maps.event.addListener(autocomplete, 'place_changed', function() {
> +                                               var place =
> autocomplete.getPlace();
> +
> //console.log(place.address_components);
> +                                       });
> +                               } else {
> +
> +                               }
>                         }
>
>                         //Document ready function
> @@ -132,6 +146,17 @@
>                                         dateOrder : 'yymmdd',
>                                         dateFormat : "yy-mm-dd"
>                                 });
> +
> +                                $("#tagPicture").click(function(e) {
> +                                        e.preventDefault();
> +                                        var x = e.pageX - this.offsetLeft;
> +                                    var y = e.pageY - this.offsetTop;
> +                                        showDialog(e,x,y) ;
> +                           })
> +
> +                           $("#tagPicture").css({
> +                                           'position': 'relative'
> +                           });
>
>                         });
>
> @@ -144,16 +169,38 @@
>                         function onPhotoURISuccess(imageURI) {
>                                 $("#metadata").html("");
>                                 var largeImage =
> document.getElementById('largeImage');
> -                               largeImage.width=windowWidth;
> -                               largeImage.height=largeImage.width*(3/4);
> +
>                                 largeImage.style.display = 'block';
>                                 largeImage.src = imageURI;
> -
> //$('#myButton').removeClass('ui-disabled');
> -                               $('#toolbar_icons').show();
> +
> +                               $('#imageInfoButton').show();
> +                               $('#photoTagButton').show();
> +                               $('#homeButton').show();
> +                               $('#deleteButton').show();
> +                               $('#editDataButton').show();
> +
> +                               $('#captureButton').hide();
> +                               $('#galleryButton').hide();
> +                               $('#webAlbumButton').hide();
> +                               $('#searchButton').hide();
>                                 $('#toolbar_message').hide();
> +                               $('#helpButton').hide();
> +
> +
>                                 $('#toolbar').listview("create");
>                                 uri= imageURI;
>                                 window.resolveLocalFileSystemURI(imageURI,
> onFileEntryComplete, isFail);
> +
> +                               displayTagImage(imageURI) ;
> +
> +                               tagObjects=new Array();
> +
> +                           $('#largeImage').css({
> +                                 // Using jQuery CSS we write the $width
> variable we previously specified as a pixel value. We use max-width incase
> the image is smaller than our viewport it won't scale it larger. Don't
> forget to set height to auto or else it will squish your photos.
> +                                 'max-width' : windowWidth , 'height' :
> 'auto'
> +                           });
> +
> +                           tagObjectsSaved=new Array();
>                                 viewData(imageURI);
>                                 $('#largeImage').click(function() {
> fullScreen(largeImage.src); });
>                         }
> @@ -161,6 +208,9 @@
>                         function photoCaptureSuccess (uri) {
>                           onPhotoURISuccess(uri);
>                           clearMetadata();
> +                         date=getCurrentDate();
> +                         time=getCurrentTime();
> +                         updateDB();
>                           $.mobile.changePage("#ConfirmLocation");
>                         }
>
> @@ -241,6 +291,10 @@
>                                 $("#editPeople").val(s);
>                         });
>
> +                       $('#photoTag').live('pageshow', function () {
> +                               markTags(tagObjectsSaved);
> +                       });
> +
>                         function clearMetadata(){
>                             $("#nickName").val("Not defined");
>                                 $("#editDate").val("");
> @@ -270,17 +324,29 @@
>                                         <ul id="mainMenu"
> data-role="listview" data-theme="a" data-inset="false">
>                                                 <img id="largeImage"
>                                                 src="images/home.png"  />
> -                                               <li data-icon="arrow-r" >
> +                                               <li data-icon="arrow-r"
> id="captureButton">
>                                                         <a href="#"
> onclick="capturePhoto()">Capture Photo</a>
>                                                 </li>
> -                                               <li data-icon="arrow-r" >
> -                                                       <a href="#"
> onclick="getPhoto(pictureSource.PHOTOLIBRARY)">From Photo Library</a>
> +                                               <li data-icon="arrow-r"
> id="galleryButton">
> +                                                       <a href="#"
> onclick="getPhoto(pictureSource.PHOTOLIBRARY)">From Gallery</a>
>                                                 </li>
> -                                               <li data-icon="arrow-r" >
> +                                               <li data-icon="arrow-r"
> id="webAlbumButton">
>                                                         <a
> href="#webAlbum">Web Album</a>
>                                                 </li>
> -                                               <li data-icon="arrow-r" >
> -                                                       <a
> href="#imageInfo" data-rel="dialog" data-transition="pop">Image Info</a>
> +                                               <li data-icon="arrow-r"
> id="searchButton">
> +                                                       <a
> href="#search_photoes">Search</a>
> +                                               </li>
> +                                               <li id="imageInfoButton"
> data-icon="arrow-r" style="display: none">
> +                                                       <a
> href="#imageInfo" data-rel="dialog" >Image Info</a>
> +                                               </li>
> +                                               <li id="photoTagButton"
> data-icon="arrow-r" style="display: none">
> +                                                       <a
> href="#photoTag">View tags</a>
> +                                               </li>
> +                                               <li id="editDataButton"
> data-icon="arrow-r" style="display: none">
> +                                                       <a
> href="#EditMetadata">Edit image data</a>
> +                                               </li>
> +                                               <li id="deleteButton"
> data-icon="arrow-r" style="display: none" data-rel="dialog">
> +                                                       <a
> href="#ConfirmDelete">Delete Photo</a>
>                                                 </li>
>                                         </ul>
>
> @@ -296,13 +362,9 @@
>                         <!-- Page Body End -->
>                         <!-- Page Footer Start -->
>                         <div data-role="footer" data-position="fixed">
> -                               <div id="toolbar_message"
> style="text-align: center">
> -                                       <a href="#search_photoes"
> data-role="button" data-icon="search">Search</a>
> -                               </div>
> -                               <div id="toolbar_icons" style="display:
> none;text-align: center" >
> -                                       <a href="#EditMetadata"
> data-role="button" data-icon="plus" data-transition="flip">Edit Metadata</a>
> -                                       <a href="#search_photoes"
> data-role="button" data-icon="search">Search</a>
> -                                       <a href="#ConfirmDelete"
> data-role="button" data-icon="delete" data-rel="dialog"
> data-transition="pop">Delete</a>
> +                               <div id="toolbar_icons" style="text-align:
> center" >
> +                                       <a href="#" id="homeButton"
> data-role="button" data-icon="home" style="display: none"
> onclick="onHomeButtonClicked()">Home</a>
> +                                       <a href="#" id="helpButton"
> data-role="button" data-icon="info" >Help</a>
>                                 </div>
>
>                         </div>
> @@ -544,16 +606,15 @@
>                                 <h1>Add location.</h1>
>                         </div>
>                         <div data-role="content">
> -
>                                 <p>
> -                                       Are you sure you want to add
> current location to this photo?
> +                                       Do you want to add current
> location to this photo?
>                                 </p>
>                                 <a href="#"
>                                 data-role="button" onclick="addLocation()"
> -                               data-theme="b">Add</a>
> +                               data-theme="b">Yes</a>
>                                 <a href="index.html"
>                                 data-role="button"
> -                               data-theme="b">Cancel</a>
> +                               data-theme="b">No</a>
>                         </div>
>                 </div>
>                 <!-- Page End -->
> @@ -592,6 +653,28 @@
>                 </div>
>                 <!-- Page End -->
>
> +               <!-- photo tag page-->
> +               <div id="photoTag" data-role="page"
> data-add-back-btn="true"  data-theme="a">
> +                       <div data-role="header" >
> +                               <h1>Tag Photo</h1>
> +                       </div>
> +                       <div data-role="content">
> +                               <div id="tagPicture">
> +                                       <img id="tagImage"/>
> +                               </div>
> +                               <a href="#" id="enableTaggingButton"
> +                               data-role="button" data-mini="false"
> data-icon="grid" onclick='enableTagging()'>Enable Tagging</a>
> +                               <a href="#" id="saveTagsButton"
> +                               data-role="button" data-mini="false"
> data-icon="grid" style="display: none" onclick='saveTags()'>Save tags</a>
> +                               <a href="#" id="clearTagsButton"
> +                               data-role="button" data-mini="false"
> data-icon="delete" style="display: none" onclick='clearTags()'>Clear
> tags</a>
> +                               <a href="#" id="cancelTaggingButton"
> +                               data-role="button" data-mini="false"
> data-icon="grid" style="display: none" onclick='enableTagging()'>Cancel</a>
> +
> +                       </div>
> +               </div>
> +               <!-- Page End -->
> +
>
>         </body>
>  </html>
>
> Modified: incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js?rev=1372790&r1=1372789&r2=1372790&view=diff
>
> ==============================================================================
> --- incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js
> (original)
> +++ incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js Tue
> Aug 14 09:13:14 2012
> @@ -29,6 +29,7 @@ var db;
>  var clause;
>  var result=new Array();
>
> +
>  function getNickname(){
>         return nickname;
>  }
> @@ -58,7 +59,6 @@ function getURI() {
>  }
>
>
> -
>  function openDB() {
>         db = window.openDatabase("photark", "1.0", "DB", 1000000);
>         db.transaction(populateDB, errorCB, successCB);
> @@ -69,10 +69,8 @@ function getResult() {
>  }
>
>  function populateDB(tx) {
> -//     tx.executeSql('DROP TABLE IF EXISTS MAIN');
> -//     tx.executeSql('DROP TABLE IF EXISTS PEOPLE');
>         tx.executeSql('CREATE TABLE IF NOT EXISTS MAIN (uri
> unique,nickname, date,time,location,description)');
> -       tx.executeSql('CREATE TABLE IF NOT EXISTS PEOPLE (uri,name,PRIMARY
> KEY (uri, name))');
> +       tx.executeSql('CREATE TABLE IF NOT EXISTS PEOPLE
> (uri,name,x,y,PRIMARY KEY (uri, name))');
>  }
>
>  function errorCB(err) {
> @@ -107,8 +105,11 @@ function querySuccess(tx, results){
>
>  function queryPeopleSuccess(tx, results) {
>         var len = results.rows.length;
> +
>         for (var i=0; i<len; i++){
>                 people[i]=results.rows.item(i).name;
> +               var tg1=new
> TagObject(results.rows.item(i).name,results.rows.item(i).x,results.rows.item(i).y);
> +               tagObjectsSaved.push(tg1);
>         }
>  }
>
> @@ -118,7 +119,6 @@ function updateDB(){
>  }
>
>  function insertToDB(tx) {
> -       alert('REPLACE INTO MAIN (uri,nickname,
> date,time,location,description) VALUES
> ("'+uri+'","'+nickname+'","'+date+'","'+time+'","'+loc+'","'+description+'")');
>         tx.executeSql('REPLACE INTO MAIN (uri,nickname,
> date,time,location,description) VALUES
> ("'+uri+'","'+nickname+'","'+date+'","'+time+'","'+loc+'","'+description+'")');
>         for (var i = 0; i < people.length; i++) {
>                 tx.executeSql('REPLACE INTO PEOPLE (uri,name) VALUES
> ("'+uri+'","'+people[i]+'")');
> @@ -126,8 +126,22 @@ function insertToDB(tx) {
>  }
>
>  function updateHome(){
> -       $("#metadata").append("<p> Name:"+nickname+"</p>");
> -       $("#metadata").append("<p> Location:"+loc+"</p>");
> +       $("#metadata").append("<p> Name: "+nickname+"</p>");
> +       $("#metadata").append("<p> Location: "+loc+"</p>");
> +       $("#metadata").append("<p> Description: "+description+"</p>");
> +       $("#metadata").append("<p> Tags: "+people+"</p>");
> +       $("#metadata").append("<p> Date: "+date+"</p>");
> +       $("#metadata").append("<p> Time: "+time+"</p>");
> +}
> +
> +function addTag(name,x,y){
> +       db.transaction(function(tx){
> +                 saveTag(tx,uri,name,x,y);
> +       }, errorCB, successCB);
> +}
> +
> +function saveTag(tx,uri,name,x,y) {
> +       tx.executeSql('REPLACE INTO PEOPLE (uri,name,x,y) VALUES
> ("'+uri+'","'+name+'","'+x+'","'+y+'")');
>  }
>
>
> @@ -157,6 +171,14 @@ function searchSuccess(tx, results) {
>         showResults(result);
>  }
>
> +function deleteTags(){
> +       db.transaction(deleteTagRecords, errorCB, successCB);
> +}
> +
> +function deleteTagRecords(tx){
> +       tx.executeSql('DELETE FROM PEOPLE WHERE URI="'+uri+'"');
> +}
> +
>
>
>
>
> Modified: incubator/photark/mobile/trunk/assets/www/scripts/facebook.js
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/facebook.js?rev=1372790&r1=1372789&r2=1372790&view=diff
>
> ==============================================================================
> --- incubator/photark/mobile/trunk/assets/www/scripts/facebook.js
> (original)
> +++ incubator/photark/mobile/trunk/assets/www/scripts/facebook.js Tue Aug
> 14 09:13:14 2012
> @@ -1,10 +1,9 @@
> -
>  if ((typeof cordova == 'undefined') && (typeof Cordova == 'undefined'))
> alert('Cordova variable does not exist. Check that you have included
> cordova.js correctly');
>  if (typeof CDV == 'undefined') alert('CDV variable does not exist. Check
> that you have included cdv-plugin-fb-connect.js correctly');
>  if (typeof FB == 'undefined') alert('FB variable does not exist. Check
> that you have included the Facebook JS SDK file.');
>
>  FB.Event.subscribe('auth.login', function(response) {
> -       //alert('auth.login event');
> +       /*alert('auth.login event');*/
>  });
>
>  FB.Event.subscribe('auth.logout', function(response) {
> @@ -16,7 +15,7 @@ FB.Event.subscribe('auth.sessionChange',
>  });
>
>  FB.Event.subscribe('auth.statusChange', function(response) {
> -                  //alert('auth.statusChange event');
> +                  /*alert('auth.statusChange event');*/
>  });
>
>  function getLoginStatus() {
> @@ -33,18 +32,14 @@ function getLoginStatus() {
>  }
>  var fdata;
>  var count=0;
> -function me() {
> -       if(count===0)
> -       {
> -               login();
> -       }
> -       FB.api('/me/photos?limit=8&offset='+count, { fields: 'id, name,
> picture' },  function(response) {
> +function me(a) {
> +       FB.api('/me/photos?limit=8&offset='+a, { fields: 'id, name,
> picture' },  function(response) {
>         if (response.error) {
>         alert(JSON.stringify(response.error));
>         }
>         else
>         {
> -                       var data = document.getElementById('facebook');
> +                       var data = document.getElementById('data');
>                         $('#facebookMore').remove();
>                         fdata=response.data;
>                         response.data.forEach(function(item) {
> @@ -60,43 +55,27 @@ function me() {
>                                 data.appendChild(d);
>                         });
>         }
> -       count=count+8;
> -       $('#facebook').append($('<a id="facebookMore" class="more"
> data-role="button" data-icon="forward" onclick="me()" />').text('More..'));
> +       count++;
> +       $('#data').append($('<a id="facebookMore" onclick="me(count*8)"
> />').text('More..'));
>     });
>  }
>  function login() {
>         FB.login(
>                 function(response) {
> -                       if (response.session) {
> -                               alert('logged in');
> -                       }
> -                       else {
> -                               //alert('not logged in');
> -                       }
> -               },
> -               { scope: "user_photos" }
> -       );
> -       //me();
> +                if (response.session) {
> +                        alert('logged in');
> +               } else {
> +                        /*alert('not logged in');*/
> +               }
> +        },
> +        { scope: "user_photos" }
> + );
>  }
>  document.addEventListener('deviceready', function() {
>                                                   try {
>                                                           FB.init({ appId:
> "423746790989627", nativeInterface: CDV.FB, useCachedDialogs: false });
> +
> document.getElementById('data').innerHTML = "";
>                                                   } catch (e) {
>                                                           alert(e);
>                                                   }
> - }, false);
> -$(document).ready(function(){
> -       $('#facebookSwitch').off('change');
> -       $("#facebook").empty();
> -       $('#facebookSwitch').on('change', function()
> -       {
> -               if($(this).val()==="off")
> -               {
> -                       $("#facebook").empty();
> -               }
> -               else
> -               {
> -                       me();
> -               }
> -       });
> -});
> \ No newline at end of file
> + }, false);
> \ No newline at end of file
>
> Added:
> incubator/photark/mobile/trunk/assets/www/scripts/jquery.mobile.simpledialog2.js
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/jquery.mobile.simpledialog2.js?rev=1372790&view=auto
>
> ==============================================================================
> ---
> incubator/photark/mobile/trunk/assets/www/scripts/jquery.mobile.simpledialog2.js
> (added)
> +++
> incubator/photark/mobile/trunk/assets/www/scripts/jquery.mobile.simpledialog2.js
> Tue Aug 14 09:13:14 2012
> @@ -0,0 +1,380 @@
> + /*
> + * jQuery Mobile Framework : plugin to provide a dialogs Widget. ver2
> + * Copyright (c) JTSage
> + * CC 3.0 Attribution.  May be relicensed without permission/notifcation.
> + * https://github.com/jtsage/jquery-mobile-simpledialog
> + */
> +
> +(function($, undefined ) {
> +  $.widget( "mobile.simpledialog2", $.mobile.widget, {
> +       options: {
> +               version: '1.0.1-2012061300', // jQueryMobile-YrMoDaySerial
> +               mode: 'blank', // or 'button'
> +               themeDialog: 'b',
> +               themeInput: false,
> +               themeButtonDefault: false,
> +               themeHeader: 'a',
> +
> +               fullScreen: false,
> +               fullScreenForce: false,
> +               dialogAllow: false,
> +               dialogForce: false,
> +
> +               headerText: false,
> +               headerClose: false,
> +               buttonPrompt: false,
> +               buttonInput: false,
> +               buttonInputDefault: false,
> +               buttonPassword: false,
> +               blankContent: false,
> +               blankContentAdopt: false,
> +
> +               resizeListener: true,
> +               safeNuke: true,
> +               forceInput: true,
> +               showModal: true,
> +               animate: true,
> +               transition: 'pop',
> +               clickEvent: 'click',
> +               zindex: '500',
> +               width: '280px',
> +               left: false,
> +               top: false,
> +
> +               callbackOpen: false,
> +               callbackOpenArgs: [],
> +               callbackClose: false,
> +               callbackCloseArgs: []
> +       },
> +       _eventHandler: function(e,p) {
> +               // Handle the triggers
> +               var self = e.data.widget,
> +                       o = e.data.widget.options;
> +
> +               if ( ! e.isPropagationStopped() ) {
> +                       switch (p.method) {
> +                               case 'close':
> +                                       self.close();
> +                                       break;
> +                               case 'html':
> +                                       self.updateBlank(p.source);
> +                                       break;
> +                       }
> +               }
> +       },
> +       _create: function () {
> +               var self = this,
> +                       o = $.extend(this.options,
> this.element.jqmData('options')),
> +                       initDate = new Date(),
> +                       content = $("<div class='ui-simpledialog-container
> ui-overlay-shadow ui-corner-all ui-simpledialog-hidden " +
> +                                       ((o.animate === true) ?
> o.transition : '') + " ui-body-" + o.themeDialog + "'></div>");
> +
> +               if ( o.themeButtonDefault === false ) {
> o.themeButtonDefault = o.themeDialog; }
> +               if ( o.themeInput === false ) { o.themeInput =
> o.themeDialog; }
> +               $.mobile.sdCurrentDialog = self;
> +               if ( typeof $.mobile.sdLastInput !== 'undefined' ) {
> delete $.mobile.sdLastInput; }
> +               self.internalID = initDate.getTime();
> +               self.displayAnchor =
> $.mobile.activePage.children('.ui-content').first();
> +               if ( self.displayAnchor.length === 0 ) {
> self.displayAnchor = $.mobile.activePage; }
> +
> +               self.dialogPage = $("<div data-role='dialog' data-theme='"
> + o.themeDialog + "'><div data-role='header'></div><div
> data-role='content'></div></div>");
> +               self.sdAllContent =
> self.dialogPage.find('[data-role=content]');
> +
> +               content.appendTo(self.sdAllContent);
> +
> +               self.sdIntContent =
> self.sdAllContent.find('.ui-simpledialog-container');
> +               self.sdIntContent.css('width', o.width);
> +
> +               if ( o.headerText !== false || o.headerClose !== false ) {
> +                       self.sdHeader = $('<div style="margin-bottom:
> 4px;" class="ui-header ui-bar-'+o.themeHeader+'"></div>');
> +                       if ( o.headerClose === true ) {
> +                               $("<a class='ui-btn-left' rel='close'
> href='#'>Close</a>").appendTo(self.sdHeader).buttonMarkup({ theme  :
> o.themeHeader, icon   : 'delete', iconpos: 'notext', corners: true, shadow
> : true });
> +                       }
> +                       $('<h1 class="ui-title">'+((o.headerText !==
> false)?o.headerText:'')+'</h1>').appendTo(self.sdHeader);
> +                       self.sdHeader.appendTo(self.sdIntContent);
> +               }
> +
> +               if ( o.mode === 'blank' ) {
> +                       if ( o.blankContent === true ) {
> +                               if ( o.blankContentAdopt === true ) {
> +                                       o.blankContent =
> self.element.children();
> +                               } else {
> +                                       o.blankContent =
> self.element.html();
> +                               }
> +                       }
> +                       $(o.blankContent).appendTo(self.sdIntContent);
> +               } else if ( o.mode === 'button' ) {
> +                       self._makeButtons().appendTo(self.sdIntContent);
> +               }
> +
> +               self.sdIntContent.appendTo(self.displayAnchor.parent());
> +
> +               self.dialogPage.appendTo( $.mobile.pageContainer )
> +                       .page().css('minHeight', '0px').css('zIndex',
> o.zindex);
> +
> +               if ( o.animate === true ) {
> self.dialogPage.addClass(o.transition); }
> +
> +               self.screen = $("<div>", {'class':'ui-simpledialog-screen
> ui-simpledialog-hidden'})
> +                       .css('z-index', (o.zindex-1))
> +                       .appendTo(self.displayAnchor.parent())
> +                       .bind(o.clickEvent, function(event){
> +                               if ( !o.forceInput ) {
> +                                       self.close();
> +                               }
> +                               event.preventDefault();
> +                       });
> +
> +               if ( o.showModal ) {
> self.screen.addClass('ui-simpledialog-screen-modal'); }
> +
> +               $(document).bind('simpledialog.'+self.internalID,
> {widget:self}, function(e,p) { self._eventHandler(e,p); });
> +       },
> +       _makeButtons: function () {
> +               var self = this,
> +                       o = self.options,
> +                       buttonHTML = $('<div></div>'),
> +                       pickerInput = $("<div
> class='ui-simpledialog-controls'><input class='ui-simpledialog-input
> ui-input-text ui-shadow-inset ui-corner-all ui-body-"+o.themeInput+"'
> type='"+((o.buttonPassword===true)?"password":"text")+"'
> value='"+((o.buttonInputDefault!==false)?o.buttonInputDefault.replace( '"',
> "&#34;" ).replace( "'", "&#39;" ):"")+"' name='pickin' /></div>"),
> +                       pickerChoice = $("<div>", {
> "class":'ui-simpledialog-controls' });
> +
> +
> +               if ( o.buttonPrompt !== false ) {
> +                       self.buttonPromptText = $("<p
> class='ui-simpledialog-subtitle'>"+o.buttonPrompt+"</p>").appendTo(buttonHTML);
> +               }
> +
> +               if ( o.buttonInput !== false ) {
> +                       $.mobile.sdLastInput = "";
> +                       pickerInput.appendTo(buttonHTML);
> +                       pickerInput.find('input').bind('change', function
> () {
> +                               $.mobile.sdLastInput =
> pickerInput.find('input').first().val();
> +                               self.thisInput =
> pickerInput.find('input').first().val();
> +                       });
> +               }
> +
> +               pickerChoice.appendTo(buttonHTML);
> +
> +               self.butObj = [];
> +
> +               $.each(o.buttons, function(name, props) {
> +                       props = $.isFunction( props ) ? { click: props } :
> props;
> +                       props = $.extend({
> +                               text   : name,
> +                               id     : name + self.internalID,
> +                               theme  : o.themeButtonDefault,
> +                               icon   : 'check',
> +                               iconpos: 'left',
> +                               corners: 'true',
> +                               shadow : 'true',
> +                               args   : [],
> +                               close  : true
> +                       }, props);
> +
> +                       self.butObj.push($("<a href='#'>"+name+"</a>")
> +                               .appendTo(pickerChoice)
> +                               .attr('id', props.id)
> +                               .buttonMarkup({
> +                                       theme  : props.theme,
> +                                       icon   : props.icon,
> +                                       iconpos: props.iconpos,
> +                                       corners: props.corners,
> +                                       shadow : props.shadow
> +                               }).unbind("vclick click")
> +                               .bind(o.clickEvent, function() {
> +                                       if ( o.buttonInput ) {
> self.sdIntContent.find('input [name=pickin]').trigger('change'); }
> +                                       var returnValue =
> props.click.apply(self, $.merge(arguments, props.args));
> +                                       if ( returnValue !== false &&
> props.close === true ) {
> +                                               self.close();
> +                                       }
> +                               })
> +                       );
> +               });
> +
> +               return buttonHTML;
> +       },
> +       _getCoords: function(widget) {
> +               var self = widget,
> +                       docWinWidth   = $.mobile.activePage.width(),
> +                       docWinHighOff = $(window).scrollTop(),
> +                       docWinHigh    = $(window).height(),
> +                       diaWinWidth   = widget.sdIntContent.innerWidth(),
> +                       diaWinHigh    = widget.sdIntContent.outerHeight(),
> +
> +                       coords        = {
> +                               'high'    : $(window).height(),
> +                               'width'   : $.mobile.activePage.width(),
> +                               'fullTop' : $(window).scrollTop(),
> +                               'fullLeft': $(window).scrollLeft(),
> +                               'winTop'  : docWinHighOff +
> ((widget.options.top !== false) ? widget.options.top : (( docWinHigh / 2 )
> - ( diaWinHigh / 2 ) )),
> +                               'winLeft' : ((widget.options.left !==
> false) ? widget.options.left : (( docWinWidth / 2 ) - ( diaWinWidth / 2 ) ))
> +                       };
> +
> +               if ( coords.winTop < 45 ) { coords.winTop = 45; }
> +
> +               return coords;
> +       },
> +       _orientChange: function(e) {
> +               var self = e.data.widget,
> +                       o = e.data.widget.options,
> +                       coords = e.data.widget._getCoords(e.data.widget);
> +
> +               e.stopPropagation();
> +
> +               if ( self.isDialog === true ) {
> +                       return true;
> +               } else {
> +                       if ( o.fullScreen === true && ( coords.width < 400
> || o.fullScreenForce === true ) ) {
> +                               self.sdIntContent.css({'border': 'none',
> 'position': 'absolute', 'top': coords.fullTop, 'left': coords.fullLeft,
> 'height': coords.high, 'width': coords.width, 'maxWidth': coords.width
> }).removeClass('ui-simpledialog-hidden');
> +                       } else {
> +                               self.sdIntContent.css({'position':
> 'absolute', 'top': coords.winTop, 'left':
> coords.winLeft}).removeClass('ui-simpledialog-hidden');
> +                       }
> +               }
> +       },
> +       repos: function() {
> +               var bsEvent = { data: {widget:this}, stopPropagation:
> function () { return true; }};
> +               this._orientChange(bsEvent);
> +       },
> +       open: function() {
> +               var self = this,
> +                       o = this.options,
> +                       coords = this._getCoords(this);
> +
> +
> self.sdAllContent.find('.ui-btn-active').removeClass('ui-btn-active');
> +               self.sdIntContent.delegate('[rel=close]', o.clickEvent,
> function (e) { e.preventDefault(); self.close(); });
> +
> +               if ( ( o.dialogAllow === true && coords.width < 400 ) ||
> o.dialogForce ) {
> +                       self.isDialog = true;
> +
> +                       if ( o.mode === 'blank' ) { // Custom selects do
> not play well with dialog mode - so, we turn them off.
> +
> self.sdIntContent.find('select').each(function () {
> +                                       $(this).jqmData('nativeMenu',
> true);
> +                               });
> +                       }
> +
> +
> self.displayAnchor.parent().unbind("pagehide.remove");
> +                       self.sdAllContent.append(self.sdIntContent);
> +                       self.sdAllContent.trigger('create');
> +                       if ( o.headerText !== false ) {
> +
> self.sdHeader.find('h1').appendTo(self.dialogPage.find('[data-role=header]'));
> +
> self.sdIntContent.find('.ui-header').empty().removeClass();
> +                       }
> +                       if ( o.headerClose === true ) {
> +                               self.dialogPage.find('.ui-header
> a').bind('click', function () {
> +
> setTimeout("$.mobile.sdCurrentDialog.destroy();", 1000);
> +                               });
> +                       } else {
> +                               self.dialogPage.find('.ui-header
> a').remove();
> +                       }
> +
> +                       self.sdIntContent.removeClass().css({'top':
> 'auto', 'width': 'auto', 'left': 'auto', 'marginLeft': 'auto',
> 'marginRight': 'auto', 'zIndex': o.zindex});
> +                       $.mobile.changePage(self.dialogPage,
> {'transition': (o.animate === true) ? o.transition : 'none'});
> +               } else {
> +                       self.isDialog = false;
> +                       self.selects = [];
> +
> +                       if ( o.fullScreen === false ) {
> +                               if ( o.showModal === true && o.animate ===
> true ) { self.screen.fadeIn('slow'); }
> +                               else {
> self.screen.removeClass('ui-simpledialog-hidden'); }
> +                       }
> +
> +                       self.sdIntContent.addClass('ui-overlay-shadow
> in').css('zIndex', o.zindex).trigger('create');
> +
> +                       if ( o.fullScreen === true && ( coords.width < 400
> || o.fullScreenForce === true ) ) {
> +
> self.sdIntContent.removeClass('ui-simpledialog-container').css({'border':
> 'none', 'position': 'absolute', 'top': coords.fullTop, 'left':
> coords.fullLeft, 'height': coords.high, 'width': coords.width, 'maxWidth':
> coords.width }).removeClass('ui-simpledialog-hidden');
> +                       } else {
> +                               self.sdIntContent.css({'position':
> 'absolute', 'top': coords.winTop, 'left':
> coords.winLeft}).removeClass('ui-simpledialog-hidden');
> +                       }
> +
> +                       $(document).bind('orientationchange.simpledialog',
> {widget:self}, function(e) { self._orientChange(e); });
> +                       if ( o.resizeListener === true ) {
> +                               $(window).bind('resize.simpledialog',
> {widget:self}, function (e) { self._orientChange(e); });
> +                       }
> +               }
> +               if ( $.isFunction(o.callbackOpen) ) {
> +                       o.callbackOpen.apply(self, o.callbackOpenArgs);
> +               }
> +       },
> +       close: function() {
> +               var self = this, o = this.options, retty;
> +
> +               if ( $.isFunction(self.options.callbackClose) ) {
> +                       retty = self.options.callbackClose.apply(self,
> self.options.callbackCloseArgs);
> +                       if ( retty === false ) { return false; }
> +               }
> +
> +               if ( self.isDialog ) {
> +                       $(self.dialogPage).dialog('close');
> +
> self.sdIntContent.addClass('ui-simpledialog-hidden');
> +
> self.sdIntContent.appendTo(self.displayAnchor.parent());
> +                       if (
> $.mobile.activePage.jqmData("page").options.domCache != true && $.
> mobile.activePage.is(":jqmData(external-page='true')") ) {
> +
> $.mobile.activePage.bind("pagehide.remove", function () {
> +                                       $(this).remove();
> +                               });
> +                       }
> +               } else {
> +                       if ( self.options.showModal === true &&
> self.options.animate === true ) {
> +                               self.screen.fadeOut('slow');
> +                       } else {
> +
> self.screen.addClass('ui-simpledialog-hidden');
> +                       }
> +
> self.sdIntContent.addClass('ui-simpledialog-hidden').removeClass('in');
> +
> $(document).unbind('orientationchange.simpledialog');
> +                       if ( self.options.resizeListener === true ) {
> $(window).unbind('resize.simpledialog'); }
> +               }
> +
> +               if ( o.mode === 'blank' && o.blankContent !== false &&
> o.blankContentAdopt === true ) {
> +                       self.element.append(o.blankContent);
> +                       o.blankContent = true;
> +               }
> +
> +               if ( self.isDialog === true || self.options.animate ===
> true ) {
> +                       setTimeout(function(that) { return function () {
> that.destroy(); };}(self), 1000);
> +               } else {
> +                       self.destroy();
> +               }
> +       },
> +       destroy: function() {
> +               var self = this,
> +                       ele = self.element;
> +
> +               if ( self.options.mode === 'blank' ) {
> +
> $.mobile.sdCurrentDialog.sdIntContent.find('select').each(function() {
> +                               if ( $(this).data('nativeMenu') == false )
> {
> +
> $(this).data('selectmenu').menuPage.remove();
> +
> $(this).data('selectmenu').screen.remove();
> +
> $(this).data('selectmenu').listbox.remove();
> +                               }
> +                       });
> +               }
> +
> +               $(self.sdIntContent).remove();
> +               $(self.dialogPage).remove();
> +               $(self.screen).remove();
> +               $(document).unbind('simpledialog.'+self.internalID);
> +               delete $.mobile.sdCurrentDialog;
> +               $.Widget.prototype.destroy.call(self);
> +               if ( self.options.safeNuke === true &&
> $(ele).parents().length === 0 && $(ele).contents().length === 0 ) {
> +                       ele.remove();
> +               }
> +       },
> +       updateBlank: function (newHTML) {
> +               var self = this,
> +                       o = this.options;
> +
> +               self.sdIntContent.empty();
> +
> +               if ( o.headerText !== false || o.headerClose !== false ) {
> +                       self.sdHeader = $('<div class="ui-header
> ui-bar-'+o.themeHeader+'"></div>');
> +                       if ( o.headerClose === true ) {
> +                               $("<a class='ui-btn-left' rel='close'
> href='#'>Close</a>").appendTo(self.sdHeader).buttonMarkup({ theme  :
> o.themeHeader, icon   : 'delete', iconpos: 'notext', corners: true, shadow
> : true });
> +                       }
> +                       $('<h1 class="ui-title">'+((o.headerText !==
> false)?o.headerText:'')+'</h1>').appendTo(self.sdHeader);
> +                       self.sdHeader.appendTo(self.sdIntContent);
> +               }
> +
> +               $(newHTML).appendTo(self.sdIntContent);
> +               self.sdIntContent.trigger('create');
> +               $(document).trigger('orientationchange.simpledialog');
> +       },
> +       _init: function() {
> +               this.open();
> +       }
> +  });
> +})( jQuery );
>
> Modified: incubator/photark/mobile/trunk/assets/www/scripts/search.js
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/search.js?rev=1372790&r1=1372789&r2=1372790&view=diff
>
> ==============================================================================
> --- incubator/photark/mobile/trunk/assets/www/scripts/search.js (original)
> +++ incubator/photark/mobile/trunk/assets/www/scripts/search.js Tue Aug 14
> 09:13:14 2012
> @@ -32,8 +32,8 @@ function doSearch(){
>                 alert("Fill the information!");
>                 return;
>         }
> -       if( name!="" && startDate=="" && endDate=="" && location=="" &&
> temp==""){
> -               searchDB('SELECT * FROM MAIN WHERE nickname LIKE
> "%'+name+'%";');
> +       if(startDate=="" && endDate=="" && temp==""){
> +               searchDB('SELECT * FROM MAIN WHERE nickname LIKE
> "%'+name+'%" AND location LIKE "%'+location+'%";');
>         }else if(name=="" && (startDate!="" || endDate!="") &&
> location=="" && temp==""){
>                 if(startDate!="" && endDate==""){
>                         searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'");');
> @@ -46,50 +46,55 @@ function doSearch(){
>                 var temp2='SELECT * FROM PEOPLE WHERE ';
>                 for ( var int = 0; int < people.length; int++) {
>                         if (int != people.length-1) {
> -                               temp2='LIKE "%'+people[int]+'%" AND';
> +                               temp2+='name LIKE "%'+people[int]+'%" AND
> ';
>                         } else{
> -                               temp2='LIKE "%'+people[int]+'%";';
> +                               temp2+='name LIKE "%'+people[int]+'%"; ';
>                         }
> -
>                 }
> -       }else if(temp=="" && name=="" && startDate=="" && endDate=="" &&
> location!=""){
> -               searchDB('SELECT * FROM MAIN WHERE location LIKE
> "%'+location+'%";');
> -       }else if(temp=="" && name!="" && (startDate!="" || endDate!="") &&
> location==""){
> +               searchDB(temp2);
> +       }else if(temp=="" && (startDate!="" || endDate!="") && (name!=""
> || location!="")){
>                 if(startDate!="" && endDate==""){
> -                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") AND nickname LIKE "%'+name+'%";');
> +                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") AND nickname LIKE "%'+name+'%" AND location LIKE
> "%'+location+'%";');
>                 }else if(startDate=="" && endDate!=""){
> -                       searchDB('SELECT * FROM MAIN WHERE date <=
> date("'+endDate+'") AND nickname LIKE "%'+name+'%";');
> +                       searchDB('SELECT * FROM MAIN WHERE date <=
> date("'+endDate+'") AND nickname LIKE "%'+name+'%" AND location LIKE
> "%'+location+'%";');
>                 }else{
> -                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") and date <= date("'+endDate+'") AND nickname LIKE
> "%'+name+'%";');
> +                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") and date <= date("'+endDate+'") AND nickname LIKE
> "%'+name+'%" AND location LIKE "%'+location+'%";');
>                 }
> -       }else if(temp=="" && name=="" && (startDate!="" || endDate!="") &&
> location!=""){
> -               if(startDate!="" && endDate==""){
> -                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") AND location LIKE "%'+location+'%";');
> -               }else if(startDate=="" && endDate!=""){
> -                       searchDB('SELECT * FROM MAIN WHERE date <=
> date("'+endDate+'") AND location LIKE "%'+location+'%";');
> -               }else{
> -                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") and date <= date("'+endDate+'") AND location LIKE
> "%'+location+'%";');
> -               }
> -       }else if(temp!="" && name=="" && (startDate!="" || endDate!="") &&
> location==""){
> +       }else if(temp!="" && (startDate!="" || endDate!="")){
> +               var temp3='SELECT * FROM MAIN NATURAL JOIN PEOPLE WHERE
> nickname LIKE "%'+name+'%" AND location LIKE "%'+location+'%" AND';
> +               for ( var int = 0; int < people.length; int++) {
> +                               temp3+='name LIKE "%'+people[int]+'%" AND
> ';
> +               }
>                 if(startDate!="" && endDate==""){
> -                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") AND nickname LIKE "%'+name+'%";');
> +                       temp3+=' date >= date("'+startDate+'");';
>                 }else if(startDate=="" && endDate!=""){
> -                       searchDB('SELECT * FROM MAIN WHERE date <=
> date("'+endDate+'") AND nickname LIKE "%'+name+'%";');
> +                       temp3+=' date <= date("'+endDate+'");';
>                 }else{
> -                       searchDB('SELECT * FROM MAIN WHERE date >=
> date("'+startDate+'") and date <= date("'+endDate+'") AND nickname LIKE
> "%'+name+'%";');
> +                       temp3+=' date >= date("'+startDate+'") and date <=
> date("'+endDate+'");';
>                 }
> +               searchDB(temp3);
> +       }else if(temp!="" && startDate=="" && endDate==""){
> +               var temp4='SELECT * FROM MAIN NATURAL JOIN PEOPLE WHERE
> nickname LIKE "%'+name+'%" AND location LIKE "%'+location+'%" AND';
> +               for ( var int = 0; int < people.length; int++) {
> +                       if (int != people.length-1) {
> +                               temp4+='name LIKE "%'+people[int]+'%" AND
> ';
> +                       } else{
> +                               temp4+='name LIKE "%'+people[int]+'%"; ';
> +                       }
> +               }
> +               searchDB(temp4);
>         }
> -
>  }
>
>
>  function showResults(results) {
>         $("#resultGallery").html("");
>         $("#Gallery").html("");
> -       //var results=getResult();
>
>                 for ( var int = 0; int < results.length; int++) {
> -                       alert(results[int]);
> +                       if(results.length==0){
> +                               alert("Sorry, no results found");
> +                       }
>                         if (i % 2 == 0) {
>                                 $("#resultGallery").append('<div
> class="ui-block-a" ><div style="padding:5px !important;"><img
> src="'+results[int]+'"  style="height:150px !important; width:100%
> !important;" onclick=\'selectResult("'+results[int]+'")\' /></div></div>');
>                         } else {
> @@ -97,7 +102,11 @@ function showResults(results) {
>                         }
>                         $("#Gallery").append('<li><a
> href="'+results[int]+'" ><img src="'+results[int]+'"  alt="Photark"
> /></a></li>');
>                 }
> -       $.mobile.changePage($('#searchResults'));
> +               if(results.length==0){
> +                       alert("Sorry, no results found");
> +               }else{
> +                       $.mobile.changePage($('#searchResults'));
> +               }
>  }
>
>  function selectResult(uri){
> @@ -105,7 +114,8 @@ function selectResult(uri){
>         var largeImage = document.getElementById('largeImage');
>         largeImage.style.display = 'block';
>         largeImage.src = uri;
> -       //$('#myButton').removeClass('ui-disabled');
> +       $('#imageInfoButton').show();
> +       $('#photoTagButton').show();
>         $('#toolbar_icons').show();
>         $('#toolbar_message').hide();
>         $('#toolbar').listview("create");
>
> Added: incubator/photark/mobile/trunk/assets/www/scripts/tagging.js
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/tagging.js?rev=1372790&view=auto
>
> ==============================================================================
> --- incubator/photark/mobile/trunk/assets/www/scripts/tagging.js (added)
> +++ incubator/photark/mobile/trunk/assets/www/scripts/tagging.js Tue Aug
> 14 09:13:14 2012
> @@ -0,0 +1,110 @@
> +/*
> + * 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.
> + */
> +
> +var tagEnabled=false;
> +
> +function showDialog(e, x, y) {
> +       $('<div>').simpledialog2({
> +               mode : 'button',
> +               headerText : 'Tag',
> +               headerClose : true,
> +               buttonPrompt : 'Type Name',
> +               buttonInput : true,
> +               buttons : {
> +                       'OK' : {
> +                               click : function() {
> +                                       var name = $.mobile.sdLastInput;
> +                                       showTag(name, x, y);
> +                                       var tgx = new TagObject(name, x,
> y);
> +                                       tagObjects.push(tgx);
> +                               }
> +                       },
> +               }
> +       })
> +}
> +
> +function TagObject(name, x, y) {
> +       this.name = name;
> +       this.x = x;
> +       this.y = y;
> +}
> +
> +function saveTags() {
> +       for (i = 0; i < tagObjects.length; i++) {
> +               addTag(tagObjects[i].name, tagObjects[i].x,
> tagObjects[i].y);
> +       }
> +       alert("Tags Saved Successfully.");
> +}
> +
> +function markTags(tagObjectsSaved) {
> +
> +       for (i = 0; i < tagObjectsSaved.length; i++) {
> +               showTag(tagObjectsSaved[i].name,
> parseInt(tagObjectsSaved[i].x),
> +                               parseInt(tagObjectsSaved[i].y));
> +       }
> +}
> +
> +function showTag(name, x, y) {
> +       var img = $('<p>' + name + '</p>');
> +       img.css('top', y);
> +       img.css('left', x);
> +       img.css('color', 'purple');
> +       img.appendTo('#tagPicture');
> +}
> +
> +function clearTags() {
> +       deleteTags();
> +       $('#tagPicture').html('<img id="tagImage"/>');
> +       displayTagImage(getURI());
> +}
> +
> +function displayTagImage(uri) {
> +       var tagImage = document.getElementById('tagImage');
> +       tagImage.style.display = 'block';
> +       tagImage.src = uri;
> +
> +       $('#tagImage').css({
> +               // Using jQuery CSS we write the $width variable we
> previously specified
> +               // as a pixel value. We use max-width incase the image is
> smaller than
> +               // our viewport it won't scale it larger. Don't forget to
> set height to
> +               // auto or else it will squish your photos.
> +               'max-width' : (windowWidth - 30),
> +               'height' : 'auto'
> +       });
> +
> +}
> +
> +function enableTagging() {
> +       if(!tagEnabled){
> +               tagEnabled=true;
> +               $('#saveTagsButton').show();
> +               $('#clearTagsButton').show();
> +               $('#cancelTaggingButton').show();
> +
> +               $('#enableTaggingButton').hide();
> +       }else{
> +               tagEnabled=false;
> +               $('#saveTagsButton').hide();
> +               $('#clearTagsButton').hide();
> +               $('#cancelTaggingButton').hide();
> +
> +               $('#enableTaggingButton').show();
> +
> +       }
> +}
>
> Modified: incubator/photark/mobile/trunk/assets/www/scripts/utils.js
> URL:
> http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/utils.js?rev=1372790&r1=1372789&r2=1372790&view=diff
>
> ==============================================================================
> --- incubator/photark/mobile/trunk/assets/www/scripts/utils.js (original)
> +++ incubator/photark/mobile/trunk/assets/www/scripts/utils.js Tue Aug 14
> 09:13:14 2012
> @@ -17,64 +17,220 @@
>   * under the License.
>   */
>
> -
>  var fileURI;
>
> -
>  function deleteFile(filepath) {
> -       window.resolveLocalFileSystemURI(filepath, deleteEntry,
> -                       function() { alert('error: unable to resovle local
> fs uri') } );
> +       window.resolveLocalFileSystemURI(filepath, deleteEntry, function()
> {
> +               alert('error: unable to resovle local fs uri')
> +       });
>         reset();
>  }
>
>  function deleteEntry(entry) {
> -       entry.remove(function (entry) {
> -       alert('Removal succeeded');
> -       }, function (error) {
> -       alert('Error removing file: ' + error.code);
> +       entry.remove(function(entry) {
> +               alert('Removal succeeded');
> +       }, function(error) {
> +               alert('Error removing file: ' + error.code);
>         });
>  }
>
>  function reset() {
>         $('#toolbar_icons').hide();
>         $('#toolbar_message').show();
> -       $('#largeImage').attr("src","images/logo.png");
> +       $('#largeImage').attr("src", "images/logo.png");
>  }
>
> -function fullScreen(uri){
> -       $("#Gallery").html('<li><a href="'+uri+'" ><img src="'+uri+'"
>  alt="Photark" /></a></li>');
> -       var myPhotoSwipe = Code.PhotoSwipe.attach(
> window.document.querySelectorAll('#Gallery a'), { enableMouseWheel: false ,
> enableKeyboard: false } );
> +function fullScreen(uri) {
> +       $("#Gallery").html(
> +                       '<li><a href="' + uri + '" ><img src="' + uri
> +                                       + '"  alt="Photark" /></a></li>');
> +       var myPhotoSwipe = Code.PhotoSwipe.attach(window.document
> +                       .querySelectorAll('#Gallery a'), {
> +               enableMouseWheel : false,
> +               enableKeyboard : false
> +       });
>         myPhotoSwipe.show(0);
>  }
>
>  function fulllScreen() {
> -       var myPhotoSwipe = Code.PhotoSwipe.attach(
> window.document.querySelectorAll('#Gallery a'), { enableMouseWheel: false ,
> enableKeyboard: false } );
> -       myPhotoSwipe.show(0);
> +       var myPhotoSwipe = Code.PhotoSwipe.attach(window.document
> +                       .querySelectorAll('#Gallery a'), {
> +               enableMouseWheel : false,
> +               enableKeyboard : false
> +       });
> +       myPhotoSwipe.show();
>  }
>
> -function scaleImageWidth(maxWidth,width,height,image){
> -        if(width > maxWidth){
> -         var ratio = maxWidth / width;   // get ratio for scaling image
> -         image.width=maxWidth;
> -         image.height= height * ratio;  // Scale height based on ratio
> -
> -     }
> -}
> +function scaleImageWidth(maxWidth, width, height, image) {
> +       if (width > maxWidth) {
> +               var ratio = maxWidth / width; // get ratio for scaling
> image
> +               image.width = maxWidth;
> +               image.height = height * ratio; // Scale height based on
> ratio
>
> -function adjustScreenLayout() {
> -       windowWidth=$(window).width();
> -       windowHeight=$(window).height();
> -       document.getElementById('largeImage').width=windowWidth;
> -       //3:4 is the most common aspect ratio
> -       document.getElementById('largeImage').height=windowWidth*(3/4);
> -
> -       $('#map_canvas').css('width',windowWidth*(7/8));
> -       $('#map_canvas').css('height',windowHeight*(5/6));
> -       $('#map_canvas').css('margin-left','auto');
> -       $('#map_canvas').css('margin-right','auto');
> +       }
>  }
>
> +function adjustScreenLayout() {
> +       windowWidth = $(window).width();
> +       windowHeight = $(window).height();
> +       // document.getElementById('largeImage').width = windowWidth;
> +       // // 3:4 is the most common aspect ratio
> +       // document.getElementById('largeImage').height = windowWidth * (3
> / 4);
> +
> +       $('#largeImage').css({
> +               // Using jQuery CSS we write the $width variable we
> previously specified
> +               // as a pixel value. We use max-width incase the image is
> smaller than
> +               // our viewport it won't scale it larger. Don't forget to
> set height to
> +               // auto or else it will squish your photos.
> +               'max-width' : windowWidth,
> +               'height' : 'auto'
> +       });
>
> +       $('#map_canvas').css('width', windowWidth * (7 / 8));
> +       $('#map_canvas').css('height', windowHeight * (5 / 6));
> +       $('#map_canvas').css('margin-left', 'auto');
> +       $('#map_canvas').css('margin-right', 'auto');
> +}
> +
> +function showDialog(e, x, y) {
> +       $('<div>').simpledialog2({
> +               mode : 'button',
> +               headerText : 'Tag',
> +               headerClose : true,
> +               buttonPrompt : 'Type Name',
> +               buttonInput : true,
> +               buttons : {
> +                       'OK' : {
> +                               click : function() {
> +                                       var name = $.mobile.sdLastInput;
> +                                       showTag(name, x, y);
> +                                       var tgx=new TagObject(name,x,y);
> +                                       tagObjects.push(tg1);
> +                               }
> +                       },
> +               }
> +       })
> +}
> +
> +function TagObject(name, x, y) {
> +       this.name = name;
> +       this.x = x;
> +       this.y = y;
> +}
> +
> +function saveTags() {
> +       for (i = 0; i < tagObjects.length; i++) {
> +               addTag(tagObjects[i].name, tagObjects[i].x,
> tagObjects[i].y);
> +       }
> +       alert(tagObjects[0].x);
> +}
> +
> +function markTags(tagObjectsSaved) {
> +
> +       for (i = 0; i < tagObjectsSaved.length; i++) {
> +               showTag(tagObjectsSaved[i].name,
> parseInt(tagObjectsSaved[i].x),
> +                               parseInt(tagObjectsSaved[i].y));
> +       }
> +}
> +
> +function showTag(name, x, y) {
> +       var img = $('<p>' + name + '</p>');
> +       img.css('top', y);
> +       img.css('left', x);
> +       img.css('color', 'purple');
> +       img.appendTo('#tagPicture');
> +}
> +
> +function clearTags() {
> +       deleteTags();
> +       $('#tagPicture').html('<img id="tagImage"/>');
> +       displayTagImage(getURI());
> +}
> +
> +function displayTagImage(uri) {
> +       var tagImage = document.getElementById('tagImage');
> +       tagImage.style.display = 'block';
> +       tagImage.src = uri;
> +
> +       $('#tagImage').css({
> +               // Using jQuery CSS we write the $width variable we
> previously specified
> +               // as a pixel value. We use max-width incase the image is
> smaller than
> +               // our viewport it won't scale it larger. Don't forget to
> set height to
> +               // auto or else it will squish your photos.
> +               'max-width' : (windowWidth - 30),
> +               'height' : 'auto'
> +       });
>
> +}
>
> +function loadjscssfile(scriptUrl) {
> +       var head = document.getElementsByTagName("head")[0];
> +       script = document.createElement('script');
> +       script.type = 'text/javascript';
> +       script.src = scriptUrl;
> +       head.appendChild(script);
> +}
> +
> +function validate(variable) {
> +       if (variable == "") {
> +               return 'undifined';
> +       } else {
> +               return variable;
> +       }
> +}
> +
> +function getCurrentDate() {
> +       var currentTime = new Date()
> +       var month = currentTime.getMonth() + 1
> +       var day = currentTime.getDate()
> +       var year = currentTime.getFullYear()
> +       return (month + "/" + day + "/" + year);
> +}
> +
> +function getCurrentTime() {
> +       var time = "";
> +       var currentTime = new Date();
> +       var hours = currentTime.getHours();
> +       var minutes = currentTime.getMinutes();
> +       if (minutes < 10) {
> +               minutes = "0" + minutes;
> +       }
> +       var h;
> +       if (hours > 11) {
> +               h = hours - 12;
> +       } else {
> +               if (hours < 10) {
> +                       h = '0' + hours;
> +               } else {
> +                       h = hours;
> +               }
> +       }
> +       time += (h + ":" + minutes + " ");
> +       if (hours > 11) {
> +               time += ("PM");
> +       } else {
> +               time += ("AM");
> +       }
> +       return time;
> +}
> +
> +function checkNetwork() {
> +       var networkState = navigator.network.connection.type;
> +       if (networkState == Connection.NONE) {
> +               alert("Cannot connect to internet. Some functionalities
> may not available");
> +       }
> +}
>
> +function onHomeButtonClicked(){
> +       $("#largeImage").attr("src","images/home.png");
> +
> +       $('#imageInfoButton').hide();
> +       $('#photoTagButton').hide();
> +       $('#deleteButton').hide();
> +       $('#homeButton').hide();
> +
> +       $('#captureButton').show();
> +       $('#galleryButton').show();
> +       $('#webAlbumButton').show();
> +       $('#helpButton').show();
> +}
>
>
>


-- 
Bhargav Golla
B.E (Hons.) Computer Science
BITS-Pilani

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message