Ignore:
Timestamp:
Oct 17, 2011, 8:27:39 PM (13 years ago)
Author:
patdenice
Message:

Update languages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/piwigo_mobile/ios/www/js/app.js

    r12411 r12473  
    44var backPage;
    55var conf = new Object;
    6 var selectedCat = '0';
    7 var logged = false;
     6var selectedCat = null;
    87var lastImageURL;
    98var pwg_token;
     
    1413var OSCode = 'IPH';
    1514
    16 // Wait for PhoneGap to connect with the device
    17 document.addEventListener("deviceready",onDeviceReady,false);
    18 
    19 // PhoneGap is ready to be used!
    20 function onDeviceReady() {
    21 
    22   pictureSource=navigator.camera.PictureSourceType;
    23   destinationType=navigator.camera.DestinationType;
    24 
    25   var reg = /(iphone|ipad|ipod)/i;
    26   if (!reg.test(device.platform)) OSCode = 'AND';
    27 
    28   if (!checkDeviceConnection ()) {
    29     message("Error", "Please check your internet connection", '#config');
    30   }
    31 }
    32 
    33 
    3415$(document).ready( function () {
     16
     17  $(document).bind("deviceready", function() {
     18 
     19    pictureSource=navigator.camera.PictureSourceType;
     20    destinationType=navigator.camera.DestinationType;
     21
     22    var reg = /(iphone|ipad|ipod)/i;
     23    if (!reg.test(device.platform)) OSCode = 'AND';
     24
     25    if (!checkDeviceConnection ()) {
     26      message("Error", "Please check your internet connection", '#config');
     27    }
     28
     29    $(document).bind("resume", pwgLogin);
     30  });
    3531
    3632  // Init
    3733  loadSettings();
    38   language = navigator.language.split("-");
    39   loadLanguage(language[0]);
     34  loadLanguage(navigator.language);
    4035
    4136  // Page events
     
    118113    },
    119114    error: function() {
    120       loadLanguage('en');
     115      loadLanguage('en-us');
    121116    }
    122117  });
     
    169164
    170165  // Log only if connection parameters have changed
    171   if (conf.url != old_conf.url || conf.username != old_conf.username || conf.password != old_conf.password || !logged) {
    172     selectedCat = '0';
     166  if (conf.url != old_conf.url || conf.username != old_conf.username || conf.password != old_conf.password || selectedCat == null) {
     167    selectedCat = null;
    173168    pwgLogin();
    174169  } else {
     
    193188
    194189
    195 function pwgLogin() {
     190function pwgLogin(callback) {
    196191
    197192  $.mobile.loadingMessage = l10n("Loging");
     
    208203    dataType: "json",
    209204    success: function(data) {
     205      $.mobile.hidePageLoadingMsg();
    210206      if (data.stat == "ok") {
    211         logged = true;
    212         $.mobile.changePage('#album');
    213207        getPwgToken();
    214         getCategories();
     208        if (selectedCat == null) {
     209          selectedCat = '0';
     210          getCategories();
     211          $.mobile.changePage('#album');
     212        }
    215213      } else {
    216         $.mobile.hidePageLoadingMsg();
    217         logged = false;
    218214        $.mobile.changePage('#config', { transition: "none" });
    219215        message("Error", data.message, '#config');
     
    222218    error: function(data) {
    223219      $.mobile.hidePageLoadingMsg();
    224       logged = false;
    225220      $.mobile.changePage('#config', { transition: "none" });
    226221      if (!checkDeviceConnection ()) {
     
    327322  }
    328323
     324  $.mobile.loadingMessage = l10n("Album creation");
     325  $.mobile.showPageLoadingMsg();
     326
    329327  $.ajax({
    330328    type: "POST",
     
    338336    async: false,
    339337    success: function(data) {
     338      $.mobile.hidePageLoadingMsg();
    340339      if (data.stat == "ok") {
    341340        selectedCat = data['result']['id'];
     
    347346    },
    348347    error: function(data) {
     348      $.mobile.hidePageLoadingMsg();
    349349      message("Error", "An error has occured", '#album', data.status, data.statusText);
    350350    }
     
    487487function removeAllPhotos() {
    488488
     489  if (queue.length == 0) return;
     490
    489491  for (i in queue) {
    490492    removePhoto(queue[i][0]);
Note: See TracChangeset for help on using the changeset viewer.