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/08/18 16:13:53 UTC
svn commit: r1374604 - in /incubator/photark/mobile/trunk/assets/www:
index.html scripts/dataAccess.js scripts/tagging.js scripts/utils.js
Author: prabhathp
Date: Sat Aug 18 16:13:53 2012
New Revision: 1374604
URL: http://svn.apache.org/viewvc?rev=1374604&view=rev
Log:
UI+dataAcess updates
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/tagging.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=1374604&r1=1374603&r2=1374604&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/index.html (original)
+++ incubator/photark/mobile/trunk/assets/www/index.html Sat Aug 18 16:13:53 2012
@@ -95,10 +95,9 @@
var windowWidth;
var windowHeight;
- var tagObjects;
- var tagObjectsSaved;
- var tagObjects;
- var tagObjectsSaved;
+ var tagObjects; //Newly added tags which not yet saved
+ var tagObjectsSaved; //Tags loaded from database
+
// Wait for device
document.addEventListener("deviceready", onDeviceReady, false);
@@ -121,8 +120,11 @@
});
adjustScreenLayout();
- //To handle menu button clicks
- document.addEventListener("menubutton", onMenuClick, false);
+ //To handle menu button presses
+ document.addEventListener("menubutton", onMenuClick, false);
+
+ //To handle back button presses
+ document.addEventListener("backbutton", onBackKeyDown, false);
}
//Document ready function
@@ -493,6 +495,10 @@
</div>
</div>
+ <!-- Page Footer Start -->
+ <div data-role="footer" data-position="fixed">
+ </div>
+ <!-- Page Footer End -->
</div>
<!-- Page End -->
@@ -543,6 +549,10 @@
<div id="map_canvas" align="center"></div>
</div>
</div>
+ <!-- Page Footer Start -->
+ <div data-role="footer" data-position="fixed">
+ </div>
+ <!-- Page Footer End -->
</div>
<!-- Page End -->
@@ -553,10 +563,10 @@
</div>
<div data-role="content">
<div id="options">
- <a href="#"
+ <!-- <a href="#"
data-role="button" data-mini="false" data-icon="grid" onclick='viewAllImages()'>View all photos</a>
<a href="#mapView"
- data-role="button" data-mini="false" data-icon="grid" onclick=''>View all in map</a>
+ data-role="button" data-mini="false" data-icon="grid" onclick=''>View all in map</a> -->
<a href="#help"
data-role="button" data-mini="false" data-icon="info" onclick=''>Help</a>
<a href="#about"
@@ -578,15 +588,19 @@
<img id="tagImage"/>
</div>
<a href="#" id="enableTaggingButton"
- data-role="button" data-mini="false" data-icon="grid" onclick='enableTagging()'>Enable Tagging</a>
+ data-role="button" data-mini="false" data-icon="grid" onclick='enableTagging()'>Add Tags</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>
+ data-role="button" data-mini="false" data-icon="delete" 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>
+ <!-- Page Footer Start -->
+ <div data-role="footer" data-position="fixed">
+ </div>
+ <!-- Page Footer End -->
</div>
<!-- Page End -->
@@ -607,6 +621,10 @@
<li>For Flickr and Picasa, one needs to copy paste the code that is displayed</li>
</ul>
</div>
+ <!-- Page Footer Start -->
+ <div data-role="footer" data-position="fixed">
+ </div>
+ <!-- Page Footer End -->
</div>
<!-- Page End -->
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=1374604&r1=1374603&r2=1374604&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/dataAccess.js Sat Aug 18 16:13:53 2012
@@ -194,6 +194,15 @@ function deleteTagRecords(tx){
tx.executeSql('DELETE FROM PEOPLE WHERE URI="'+uri+'"');
}
+function removeFromDB(){
+ db.transaction(deleteRecords, errorCB, successCB);
+}
+
+function deleteRecords(tx) {
+ tx.executeSql('DELETE FROM PEOPLE WHERE URI="'+uri+'"');
+ tx.executeSql('DELETE FROM MAIN WHERE URI="'+uri+'"');
+}
+
Modified: 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=1374604&r1=1374603&r2=1374604&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/tagging.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/tagging.js Sat Aug 18 16:13:53 2012
@@ -51,13 +51,18 @@ function TagObject(name, x, y) {
function saveTags() {
for (i = 0; i < tagObjects.length; i++) {
+ if(tagObjects.length==0){
+ alert("No new tags has been added.");
+ }
addTag(tagObjects[i].name, tagObjects[i].x, tagObjects[i].y);
+ tagObjectsSaved.push(tagObjects[i]);
}
+ tagObjects=new Array(); //buffer has to be cleared
alert("Tags Saved Successfully.");
+ enableTagging();
}
function markTags(tagObjectsSaved) {
-
for (i = 0; i < tagObjectsSaved.length; i++) {
showTag(tagObjectsSaved[i].name, parseInt(tagObjectsSaved[i].x),
parseInt(tagObjectsSaved[i].y));
@@ -73,9 +78,27 @@ function showTag(name, x, y) {
}
function clearTags() {
- deleteTags();
- $('#tagPicture').html('<img id="tagImage"/>');
- displayTagImage(getURI());
+ $('<div>').simpledialog2({
+ mode: 'button',
+ headerText: 'Delete Tags',
+ headerClose: true,
+ buttonPrompt: 'Are you sure you want to delete all the tags in this photo?',
+ buttons : {
+ 'OK': {
+ click: function () {
+ deleteTags();
+ $('#tagPicture').html('<img id="tagImage"/>');
+ displayTagImage(getURI());
+ }
+ },
+ 'Cancel': {
+ click: function () {
+ //Do nothing
+ },
+ icon: "delete",
+ }
+ }
+ })
}
function displayTagImage(uri) {
@@ -98,17 +121,14 @@ function enableTagging() {
if(!tagEnabled){
tagEnabled=true;
$('#saveTagsButton').show();
- $('#clearTagsButton').show();
- $('#cancelTaggingButton').show();
-
+ $('#clearTagsButton').hide();
+ $('#cancelTaggingButton').show();
$('#enableTaggingButton').hide();
}else{
tagEnabled=false;
$('#saveTagsButton').hide();
- $('#clearTagsButton').hide();
- $('#cancelTaggingButton').hide();
-
- $('#enableTaggingButton').show();
-
+ $('#clearTagsButton').show();
+ $('#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=1374604&r1=1374603&r2=1374604&view=diff
==============================================================================
--- incubator/photark/mobile/trunk/assets/www/scripts/utils.js (original)
+++ incubator/photark/mobile/trunk/assets/www/scripts/utils.js Sat Aug 18 16:13:53 2012
@@ -29,6 +29,7 @@ function deleteFile() {
function deleteEntry(entry) {
entry.remove(function(entry) {
alert('Removal succeeded');
+ removeFromDB();
onHomeButtonClicked();
}, function(error) {
alert('Error removing file: ' + error.code);