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 av...@apache.org on 2012/06/26 14:42:14 UTC

svn commit: r1354037 - in /incubator/photark/mobile/trunk/assets/www: index.html scripts/dataAccess.js scripts/search.js scripts/utils.js

Author: avd
Date: Tue Jun 26 14:42:13 2012
New Revision: 1354037

URL: http://svn.apache.org/viewvc?rev=1354037&view=rev
Log:
PHOTARK-87: Applied patch from Prabhath Suminda

Added:
    incubator/photark/mobile/trunk/assets/www/scripts/search.js
Modified:
    incubator/photark/mobile/trunk/assets/www/index.html
    incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.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=1354037&r1=1354036&r2=1354037&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/index.html (original)
+++ incubator/photark/mobile/trunk/assets/www/index.html Tue Jun 26 14:42:13 2012
@@ -148,6 +148,12 @@
 				$("#editTime").val(getTime());
 				$("#editLocation").val(getLocation());
 				$("#editDiscription").val(getDescription());
+				var people=getPeople();
+				var s="";
+				for (var i=0; i < people.length; i++) {
+				  s=s+people[i]+',';
+				};
+				$("#editPeople").val(s);
 			});
 			
 		</script>
@@ -173,12 +179,9 @@
 				<a href="#webAlbum"
 				data-role="button" data-theme="b">Web Album</a>
 				<br>
-				<!-- <a href="#EditMetadata"
-				data-role="button" id="myButton" class="ui-disabled" data-theme="b">EditMetadata</a>
-				<br> 
 				<img id="largeImage"
-				src="images/logo.png" height="200" width="200" />-->
-				<!-- <div id="metadata"></div> -->
+				src="images/logo.png" height="200" width="200" />
+				 <div id="metadata"></div>
 			</div>
 			<!-- Page Body End -->
 			<!-- Page Footer Start -->
@@ -188,7 +191,7 @@
 				</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="#" data-role="button" data-icon="search">Search</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>
@@ -383,5 +386,51 @@
 			</div>
 			<!-- Page Footer End -->
 		</div>
+	
+	<!-- Search page -->
+		<div id="search_photoes" data-role="page">
+			<div data-role="header" data-position="fixed">
+				<h1>Search Photos</h1>
+			</div>
+			<div data-role="content">
+				<div data-role="fieldcontain">
+					<label for="search"> Enter name: </label>
+					<input type="text" name="search" id="searchName" value="" />
+				</div>
+
+				<p>
+					Date:
+				</p>
+				<div data-role="fieldcontain">
+					<label for="search">From:</label>
+					<input type="text" name="search" id="searchStartDate" value="" onclick="editDateOnClick()"/>
+					<label for="search">To:</label>
+					<input type="text" name="search" id="searchEndDate" value="" onclick="editDateOnClick()"/>
+				</div>
+
+				<div data-role="fieldcontain">
+					<label for="search"> Enter location: </label>
+					<input type="text" name="search" id="searchLocation" value="" />
+				</div>
+
+				<div data-role="fieldcontain">
+					<label for="textarea"> People: </label>
+					<textarea cols="40" rows="8" name="textarea" id="searchPeople"></textarea>
+					<a href="#ContactsPage" data-role="button" data-theme="a"  data-mini="true">Browse</a>
+				</div>
+
+			</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>
+				<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"
+				data-role="button" data-mini="true"
+				data-icon="back">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=1354037&r1=1354036&r2=1354037&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js Tue Jun 26 14:42:13 2012
@@ -26,6 +26,9 @@ var location;
 var description;
 var people=new Array();
 var db;
+var clause;
+var result;
+
 
 function getNickname(){
 	return nickname;
@@ -56,6 +59,10 @@ function openDB() {
 	db.transaction(populateDB, errorCB, successCB);
 }
 
+function getResult() {
+	return result;
+}
+
 function populateDB(tx) {
 //	tx.executeSql('DROP TABLE IF EXISTS MAIN');
 //	tx.executeSql('DROP TABLE IF EXISTS PEOPLE');
@@ -77,7 +84,8 @@ function viewData(){
 }
 
 function retriviewDB(tx){
-	tx.executeSql('SELECT * FROM MAIN ', [], querySuccess, errorCB);
+	tx.executeSql('SELECT * FROM MAIN WHERE URI="'+uri+'"', [], querySuccess, errorCB);
+	tx.executeSql('SELECT * FROM PEOPLE WHERE URI="'+uri+'"', [], queryPeopleSuccess, errorCB);
 }
 
 function querySuccess(tx, results){
@@ -86,10 +94,17 @@ 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;
+	///	location=results.rows.item(i).location;
 		description=results.rows.item(i).description;
 	}	
-	//populateMetadata(nickname,date,time,description);
+	updateHome();
+}
+
+function queryPeopleSuccess(tx, results) {
+	var len = results.rows.length;
+	for (var i=0; i<len; i++){
+		people[i]=results.rows.item(i).name;
+	}
 }
 
 function updateDB(){
@@ -104,4 +119,28 @@ function insertToDB(tx) {
 	}
 }
 
+function updateHome(){
+	$("#metadata").append("<p> Name:"+nickname+"</p>");
+	$("#metadata").append("<p> Location:"+location+"</p>");
+}
+
+
+function searchDB(s){
+	clause=s;
+	db.transaction(queryDB, errorCB, successCB);
+}
+
+function queryDB(tx){
+	tx.executeSql('SELECT * FROM MAIN WHERE'+clause, [], searchSuccess, errorCB);
+}
+
+function searchSuccess() {
+	var len = results.rows.length;
+	result=new Array();
+	for (var i=0; i<len; i++){
+		result[i]=results.rows.item(i).name;
+	}
+	clause="";
+}
+
 

Added: 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=1354037&view=auto
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/search.js (added)
+++ incubator/photark/mobile/trunk/assets/www/scripts/search.js Tue Jun 26 14:42:13 2012
@@ -0,0 +1,38 @@
+/*
+ * 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 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 showResults() {
+	var result=getResult();
+	alert(result[0]);
+	//TODO implement
+	
+}
\ 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=1354037&r1=1354036&r2=1354037&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/utils.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/utils.js Tue Jun 26 14:42:13 2012
@@ -1,3 +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.
+ */
+
+
 var fileURI;
 
 
@@ -22,4 +42,6 @@ function reset() {
 	$('#toolbar_icons').hide();
 	$('#toolbar_message').show();
 	$('#largeImage').attr("src","images/logo.png");
-}
\ No newline at end of file
+}
+
+