You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-commits@incubator.apache.org by pr...@apache.org on 2012/07/21 18:45:17 UTC
svn commit: r1364146 - in /incubator/photark/mobile/trunk/assets/www:
index.html scripts/contacts.js scripts/dataAccess.js scripts/geoLocation.js
scripts/search.js scripts/utils.js
Author: prabhathp
Date: Sat Jul 21 18:45:17 2012
New Revision: 1364146
URL: http://svn.apache.org/viewvc?rev=1364146&view=rev
Log:
UI + other improvements
Modified:
incubator/photark/mobile/trunk/assets/www/index.html
incubator/photark/mobile/trunk/assets/www/scripts/contacts.js
incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js
incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.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/index.html
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/index.html?rev=1364146&r1=1364145&r2=1364146&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/index.html (original)
+++ incubator/photark/mobile/trunk/assets/www/index.html Sat Jul 21 18:45:17 2012
@@ -6,29 +6,28 @@
type="text/css" />
<link href="css/mobiscroll-2.0.full.min.css" rel="stylesheet"
type="text/css" />
- <style>
- #facebookMore{
- border:2px solid;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- }
- </style>
+ <link href="css/custom.css" rel="stylesheet"
+ type="text/css" />
<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>
<script type="text/javascript" charset="utf-8" src="scripts/cordova-1.8.0.js" ></script>
- <script src="scripts/cdv-plugin-fb-connect.js"></script><!--Facebook Connect Plugin-->
- <script src="scripts/facebook_js_sdk.js"></script><!--Facebook JS SDK-->
+ <script type="text/javascript" src="scripts/cdv-plugin-fb-connect.js"></script><!--Facebook Connect Plugin-->
+ <script type="text/javascript" src="scripts/facebook_js_sdk.js"></script><!--Facebook JS SDK-->
<script type="text/javascript" charset="utf-8" src="scripts/contacts.js" ></script>
<script type="text/javascript" charset="utf-8" src="scripts/geoLocation.js" ></script>
<script type="text/javascript" charset="utf-8" src="scripts/utils.js" ></script>
<script type="text/javascript" charset="utf-8" src="scripts/dataAccess.js"></script>
- <script type="text/javascript" charset="utf-8" src="scripts/facebook.js"></script>
+ <script type="text/javascript" charset="utf-8" src="scripts/search.js"></script>
+
<script type="text/javascript">
var pictureSource;
// picture source
var destinationType;
// sets the format of returned value
+
+ var windowWidth;
+ var windowHeight;
// Wait for device
document.addEventListener("deviceready", onDeviceReady, false);
@@ -43,6 +42,12 @@
});
getLocation();
openDB();
+ 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);
+
}
//Document ready function
@@ -51,14 +56,11 @@
$('#editDate').scroller({
preset : 'date',
- invalid : {
- daysOfWeek : [0, 6],
- daysOfMonth : ['5/1', '12/24', '12/25']
- },
theme : 'default',
display : 'modal',
mode : 'scroller',
- dateOrder : 'mmD ddy'
+ dateOrder : 'yymmdd',
+ dateFormat : "yy-mm-dd"
});
//Handler for time picker
@@ -68,6 +70,25 @@
display : 'modal',
mode : 'scroller'
});
+
+ $('#searchStartDate').scroller({
+ preset : 'date',
+ theme : 'default',
+ display : 'modal',
+ mode : 'scroller',
+ dateOrder : 'yymmdd',
+ dateFormat : "yy-mm-dd"
+ });
+
+ $('#searchEndDate').scroller({
+ preset : 'date',
+ theme : 'default',
+ display : 'modal',
+ mode : 'scroller',
+ dateOrder : 'yymmdd',
+ dateFormat : "yy-mm-dd"
+ });
+
});
@@ -78,7 +99,10 @@
}
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');
@@ -131,11 +155,11 @@
alert('Failed because: ' + message);
}
- function editDateOnClick() {
- $('#editDate').scroller('show');
+ function editDateOnClick(parent) {
+ parent.scroller('show');
}
- function editTimeOnClick() {
+ function editTimeOnClick(parent) {
$('#editTime').scroller('show');
}
@@ -143,7 +167,7 @@
nickname = $("#nickName").val();
date = $("#editDate").val();
time = $("#editTime").val();
- locaton = $("#editLocation").val();
+ loc= $("#editLocation").val();
people=$("#editPeople").val().split(",");
description=$("#editDiscription").val();
updateDB();
@@ -167,39 +191,45 @@
</head>
<body>
<!-- Page Start-->
- <div id="main" data-role="page" data-theme="b">
+ <div id="main" data-role="page" data-theme="a">
<!-- Page Header Start -->
<div data-role="header" data-position="fixed">
<h1>PhotArc Mobile</h1>
</div>
<!-- Page Header End -->
<!-- Page Body Start -->
- <div id="a" data-role="content" align="center">
- <a href="#" data-role="button" onclick="capturePhoto()"
- data-theme="b">Capture Photo</a>
- <br>
- <a href="#"
- data-role="button" onclick="getPhoto(pictureSource.PHOTOLIBRARY)"
- data-theme="b">From Photo Library</a>
- <br>
- <a href="#webAlbum"
- data-role="button" data-theme="b">Web Album</a>
- <br>
- <img id="largeImage"
- src="images/logo.png" height="200" width="200" />
- <div id="metadata"></div>
+ <div id="a" data-role="content" align="justify">
+
+ <ul id="mainMenu" data-role="listview" data-theme="a" data-inset="false">
+ <img id="largeImage"
+ src="images/logo.png" />
+ <li data-icon="arrow-r" >
+ <a href="#" onclick="capturePhoto()">Capture Photo</a>
+ </li>
+ <li data-icon="arrow-r" >
+ <a href="#" onclick="getPhoto(pictureSource.PHOTOLIBRARY)">From Photo Library</a>
+ </li>
+ <li data-icon="arrow-r" >
+ <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>
+ </ul>
+
</div>
<!-- Page Body End -->
<!-- Page Footer Start -->
- <div data-role="footer" data-position="fixed" >
+ <div data-role="footer" >
<div id="toolbar_message" style="text-align: center">
- <a href="#" data-role="button" data-icon="search">Search</a>
+ <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>
+
</div>
<!-- Page Footer End -->
</div>
@@ -221,12 +251,12 @@
<div data-role="fieldcontain">
<label for="name"> Date: </label>
<input type="text" name="name"
- id="editDate" value="" onclick="editDateOnClick()" />
+ id="editDate" value="" onclick='editDateOnClick($("#editDate"))' />
</div>
<div data-role="fieldcontain">
<label for="name"> Time: </label>
<input type="text" name="name"
- id="editTime" value="" onclick="editTimeOnClick()" />
+ id="editTime" value="" onclick='editTimeOnClick($("#editTime"))' />
</div>
<div data-role="fieldcontain">
<label for="textarea"> People: </label>
@@ -240,7 +270,7 @@
</div>
<div data-role="fieldcontain">
<label for="search"> Location </label>
- <input type="search" name="searchbox" id="locationSearch" value="" />
+ <input type="text" name="searchbox" id="editLocation" value="" />
</div>
</div>
<div data-role="footer" data-position="fixed" style="text-align: center">
@@ -352,9 +382,9 @@
</p>
<div data-role="fieldcontain">
<label for="search">From:</label>
- <input type="text" name="search" id="searchStartDate" value="" onclick="editDateOnClick()"/>
+ <input type="text" name="search" id="searchStartDate" value="" onclick='editDateOnClick($("#searchStartDate"))'/>
<label for="search">To:</label>
- <input type="text" name="search" id="searchEndDate" value="" onclick="editDateOnClick()"/>
+ <input type="text" name="search" id="searchEndDate" value="" onclick='editDateOnClick($("#searchEndDate"))'/>
</div>
<div data-role="fieldcontain">
@@ -371,7 +401,7 @@
</div>
<div data-role="footer" data-position="fixed" style="text-align: center">
<a href="#"
- data-role="button" data-mini="true" data-icon="search" onclick="search()">Search</a>
+ data-role="button" data-mini="true" data-icon="search" onclick='doSearch()'>Search</a>
<a href="#"
data-role="button" data-rel="dialog" data-transition="pop" data-icon="grid" onclick="getPhoto(pictureSource.PHOTOLIBRARY)">Shaw all</a>
<a href="index.html"
@@ -380,6 +410,32 @@
</div>
</div>
<!-- Page End -->
+
+ <!-- Search Results page-->
+ <div id="searchResults" data-role="page">
+ <div data-role="header">
+ <h1>Results</h1>
+ </div>
+ <div data-role="content">
+
+ <div class="ui-grid-a" id="resultGallery" style="padding=5px !important">
+ <!-- To be added dinamically -->
+ </div>
+
+ </div>
+ </div>
+ <!-- Page End -->
+
+ <!-- Image Info page-->
+ <div id="imageInfo" data-role="page">
+ <div data-role="header">
+ <h1>Image Info</h1>
+ </div>
+ <div data-role="content">
+ <div id="metadata"></div>
+ </div>
+ </div>
+ <!-- Page End -->
</body>
</html>
Modified: incubator/photark/mobile/trunk/assets/www/scripts/contacts.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/contacts.js?rev=1364146&r1=1364145&r2=1364146&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/contacts.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/contacts.js Sat Jul 21 18:45:17 2012
@@ -1,4 +1,23 @@
-//////////////////////////////////////////////
+/*
+ * 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.
+ */
+
+
function getContacts() {
var optFilter = new ContactFindOptions();
optFilter.filter = "";
@@ -17,7 +36,6 @@ function gcsError(contactError) {
}
function gcsSuccess(contacts) {
- alert('loaded');
if (contacts.length != 0) {
// get formatted names and sort
var names = new Array();
@@ -42,14 +60,14 @@ function gcsSuccess(contacts) {
.append('<li data-role="list-divider">' + divider
+ '</li>');
list
- .append('<li><a href="#EditMetadata"><img src="images/contactIcon.png" class="ui-li-icon" alt="Contact" onclick="onContactsClick()"/>'
+ .append('<li><a href="#"><img src="images/contactIcon.png" class="ui-li-icon" alt="Contact" onclick=\'onContactsClick("'+names[i]+'")\'/>'
+ names[i] + '</a></li>');
} else {
if (i == 0)
list.append('<li data-role="list-divider">' + divider
+ '</li>');
list
- .append('<li><a href="#EditMetadata"><img src="images/contactIcon.png" class="ui-li-icon" alt="Contact" onclick="onContactsClick()"/>'
+ .append('<li><a href="#"><img src="images/contactIcon.png" class="ui-li-icon" alt="Contact" onclick=\'onContactsClick("'+names[i]+'")\'/>'
+ names[i] + '</a></li>');
}
}
@@ -61,7 +79,10 @@ function gcsSuccess(contacts) {
}
function onContactsClick(name){
- $('#editPeople').append(name+',');
+ var temp=$('#editPeople').val();
+ temp=temp+name;
+ people=temp.split(",");
+ $.mobile.changePage( $("#EditMetadata") );
}
-// ////////////////////////////////////////////////////////////////
+
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=1364146&r1=1364145&r2=1364146&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js Sat Jul 21 18:45:17 2012
@@ -19,15 +19,15 @@
var uri=0;
-var nickname;
+var nickname="Not defined.";
var date;
var time;
-var location;
+var loc;
var description;
var people=new Array();
var db;
var clause;
-var result;
+var result=new Array();
function getNickname(){
@@ -43,7 +43,7 @@ function getTime(){
}
function getLocation(){
- return location;
+ return loc;
}
function getDescription(){
@@ -54,6 +54,10 @@ function getPeople(){
return people;
}
+function getURI() {
+ return uri;
+}
+
function openDB() {
db = window.openDatabase("photark", "1.0", "DB", 1000000);
db.transaction(populateDB, errorCB, successCB);
@@ -78,8 +82,8 @@ function successCB() {
//Do nothing
}
-function viewData(){
-// var db = window.openDatabase("photark", "1.0", "DB", 1000000);
+function viewData(img){
+ uri=img;
db.transaction(retriviewDB, errorCB, successCB);
}
@@ -94,7 +98,7 @@ function querySuccess(tx, results){
nickname=results.rows.item(i).nickname;
date=results.rows.item(i).date;
time=results.rows.item(i).time;
- /// location=results.rows.item(i).location;
+ loc=results.rows.item(i).location;
description=results.rows.item(i).description;
}
updateHome();
@@ -113,7 +117,8 @@ function updateDB(){
}
function insertToDB(tx) {
- tx.executeSql('REPLACE INTO MAIN (uri,nickname, date,time,location,description) VALUES ("'+uri+'","'+nickname+'","'+date+'","'+time+'","'+location+'","'+description+'")');
+ 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]+'")');
}
@@ -121,7 +126,7 @@ function insertToDB(tx) {
function updateHome(){
$("#metadata").append("<p> Name:"+nickname+"</p>");
- $("#metadata").append("<p> Location:"+location+"</p>");
+ $("#metadata").append("<p> Location:"+loc+"</p>");
}
@@ -130,17 +135,27 @@ function searchDB(s){
db.transaction(queryDB, errorCB, successCB);
}
+//To search photos using people names
+function searchPeople(s) {
+ clause=s;
+ db.transaction(queryDB, errorCB, successCB);
+}
+
function queryDB(tx){
- tx.executeSql('SELECT * FROM MAIN WHERE'+clause, [], searchSuccess, errorCB);
+ alert(clause);
+ tx.executeSql(clause,[], searchSuccess, errorCB);
}
-function searchSuccess() {
+function searchSuccess(tx, results) {
var len = results.rows.length;
result=new Array();
for (var i=0; i<len; i++){
- result[i]=results.rows.item(i).name;
+ result[i]=results.rows.item(i).uri;
}
clause="";
+ showResults(result);
}
+
+
Modified: incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js
URL: http://svn.apache.org/viewvc/incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js?rev=1364146&r1=1364145&r2=1364146&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/geoLocation.js Sat Jul 21 18:45:17 2012
@@ -1,3 +1,24 @@
+/*
+ * 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.
+ */
+
+//<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
+
function onGeoSuccess(position) {
alert( 'success' );
@@ -10,11 +31,12 @@ function onGeoError(error) {
}
-function getLocation(){
+function getGeoLocation(){
+ alert("called");
try{
navigator.geolocation.getCurrentPosition(onGeoSuccess,onGeoError,{ enableHighAccuracy: true });
}
catch(error){
- alert('fail')
+ alert('fail');
}
}
\ No newline at end of file
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=1364146&r1=1364145&r2=1364146&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/search.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/search.js Sat Jul 21 18:45:17 2012
@@ -17,22 +17,103 @@
* under the License.
*/
-function search(){
- var name=$("searchName").value();
- var startDate=$("searchStartDate").value();
- var endDate=$("searchEndDate").value();
- var location=$("searchLocation").value();
- var people=$("searchPeople").value().split(",");
-
- if(name!===undefined && name!=""){
- searchDB('WHERE name LIKE "%'+name+'%"');
+function doSearch(){
+ var name=$("#searchName").val();
+ var startDate=$("#searchStartDate").val();
+ var endDate=$("#searchEndDate").val();
+ var location=$("#searchLocation").val();
+ var temp=$("#searchPeople").val();
+ var people=new Array();
+ if(temp!=undefined && temp!=""){
+ people=temp.split(",");
+ }
+ if(name=="" && startDate=="" && endDate=="" && location=="" && temp==""){
+ alert("Fill the information!");
+ return;
+ }
+ if( name!="" && startDate=="" && endDate=="" && location=="" && temp==""){
+ searchDB('SELECT * FROM MAIN WHERE nickname LIKE "%'+name+'%";');
+ }else if(name=="" && (startDate!="" || endDate!="") && location=="" && temp==""){
+ if(startDate!="" && endDate==""){
+ searchDB('SELECT * FROM MAIN WHERE date >= date("'+startDate+'");');
+ }else if(startDate=="" && endDate!=""){
+ searchDB('SELECT * FROM MAIN WHERE date <= date("'+endDate+'");');
+ }else{
+ searchDB('SELECT * FROM MAIN WHERE date >= date("'+startDate+'") and date <= date("'+endDate+'");');
+ }
+ }else if(temp!=undefined && temp!="" && name=="" && startDate=="" && endDate=="" && location==""){
+ var temp2='SELECT * FROM PEOPLE WHERE ';
+ for ( var int = 0; int < people.length; int++) {
+ if (int != people.length-1) {
+ temp2='LIKE "%'+people[int]+'%" AND';
+ } else{
+ temp2='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==""){
+ if(startDate!="" && endDate==""){
+ searchDB('SELECT * FROM MAIN WHERE date >= date("'+startDate+'") AND nickname LIKE "%'+name+'%";');
+ }else if(startDate=="" && endDate!=""){
+ searchDB('SELECT * FROM MAIN WHERE date <= date("'+endDate+'") AND nickname LIKE "%'+name+'%";');
+ }else{
+ searchDB('SELECT * FROM MAIN WHERE date >= date("'+startDate+'") and date <= date("'+endDate+'") AND nickname LIKE "%'+name+'%";');
+ }
+ }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==""){
+ if(startDate!="" && endDate==""){
+ searchDB('SELECT * FROM MAIN WHERE date >= date("'+startDate+'") AND nickname LIKE "%'+name+'%";');
+ }else if(startDate=="" && endDate!=""){
+ searchDB('SELECT * FROM MAIN WHERE date <= date("'+endDate+'") AND nickname LIKE "%'+name+'%";');
+ }else{
+ searchDB('SELECT * FROM MAIN WHERE date >= date("'+startDate+'") and date <= date("'+endDate+'") AND nickname LIKE "%'+name+'%";');
+ }
}
+
}
-function showResults() {
- var result=getResult();
- alert(result[0]);
- //TODO implement
-
-}
\ No newline at end of file
+function showResults(results) {
+ $("#resultGallery").html("");
+ $("#Gallery").html("");
+ //var results=getResult();
+
+ for ( var int = 0; int < results.length; int++) {
+ alert(results[int]);
+ 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 {
+ $("#resultGallery").append('<div class="ui-block-b" ><div style="padding:5px !important;"><img src="'+results[int]+'" style="height:150px !important; width:100% !important;" onclick=\'selectResult("'+results[int]+'")\' /></div></div>');
+ }
+ $("#Gallery").append('<li><a href="'+results[int]+'" ><img src="'+results[int]+'" alt="Photark" /></a></li>');
+ }
+ $.mobile.changePage($('#searchResults'));
+}
+
+function selectResult(uri){
+ $("#metadata").html("");
+ var largeImage = document.getElementById('largeImage');
+ largeImage.style.display = 'block';
+ largeImage.src = uri;
+ //$('#myButton').removeClass('ui-disabled');
+ $('#toolbar_icons').show();
+ $('#toolbar_message').hide();
+ $('#toolbar').listview("create");
+ window.resolveLocalFileSystemURI(uri, onFileEntryComplete, isFail);
+ viewData(uri);
+ $('#largeImage').click(function() { fullScreen(largeImage.src); });
+ $.mobile.changePage( $("#main") );
+
+}
+
+
+
\ No newline at end of file
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=1364146&r1=1364145&r2=1364146&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/utils.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/utils.js Sat Jul 21 18:45:17 2012
@@ -21,18 +21,15 @@
var fileURI;
-function deleteFile() {
- window.resolveLocalFileSystemURI(fileURI, deleteEntry,
+function deleteFile(filepath) {
+ window.resolveLocalFileSystemURI(filepath, deleteEntry,
function() { alert('error: unable to resovle local fs uri') } );
reset();
}
-
-
-
function deleteEntry(entry) {
entry.remove(function (entry) {
- alert(fileURI+'removal succeeded');
+ alert('Removal succeeded');
}, function (error) {
alert('Error removing file: ' + error.code);
});
@@ -44,4 +41,27 @@ function reset() {
$('#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 } );
+ myPhotoSwipe.show(0);
+}
+
+function fulllScreen() {
+ var myPhotoSwipe = Code.PhotoSwipe.attach( window.document.querySelectorAll('#Gallery a'), { enableMouseWheel: false , enableKeyboard: false } );
+ myPhotoSwipe.show(0);
+}
+
+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
+
+ }
+}
+
+
+
+