From b147765c05f6167bdcd913f35f1a9ab2eaa343e7 Mon Sep 17 00:00:00 2001 From: Brian Moore Date: Sat, 12 Feb 2011 11:38:00 -0800 Subject: [PATCH] clean up error paths --- .../app/Saccount/saccount_controller.rb | 14 +++++++------ .../app/Scontact/scontact_controller.rb | 15 ++++++++------ SalesForce-Sencha/app/Settings/controller.rb | 6 ++++++ .../app/templates/sfsenchalinkfield.erb | 1 - SalesForce-Sencha/public/app/account.js | 2 +- SalesForce-Sencha/public/app/contact.js | 2 +- SalesForce-Sencha/public/app/rhodes.js | 20 +++++++++++++++---- SalesForce-Sencha/rhoconfig.txt | 6 +++--- SalesForce-Sencha/rholog-4.2.txt | 2 +- 9 files changed, 45 insertions(+), 23 deletions(-) diff --git a/SalesForce-Sencha/app/Saccount/saccount_controller.rb b/SalesForce-Sencha/app/Saccount/saccount_controller.rb index 8fe1176..5ef99da 100644 --- a/SalesForce-Sencha/app/Saccount/saccount_controller.rb +++ b/SalesForce-Sencha/app/Saccount/saccount_controller.rb @@ -111,12 +111,14 @@ def create # POST /Saccount/{1}/update def update - account = {} - account["name"] = @params["name"] - account["phone"] = @params["phone"] - account["email"] = @params["email"] - @saccount = Saccount.find(@params['id']) - @saccount.update_attributes(account) if @saccount + @saccount = Saccount.find(@params['object']) + + @params.reject! do |k,v| + k == "object" + end + + @saccount.update_attributes(@params) if @saccount + SyncEngine.dosync render :string => "0" end diff --git a/SalesForce-Sencha/app/Scontact/scontact_controller.rb b/SalesForce-Sencha/app/Scontact/scontact_controller.rb index 19ab49b..07af413 100644 --- a/SalesForce-Sencha/app/Scontact/scontact_controller.rb +++ b/SalesForce-Sencha/app/Scontact/scontact_controller.rb @@ -111,12 +111,15 @@ def create # POST /Scontact/{1}/update def update - contact = {} - contact["name"] = @params["name"] - contact["phone"] = @params["phone"] - contact["email"] = @params["email"] - @scontact = Scontact.find(@params['id']) - @scontact.update_attributes(contact) if @scontact + @scontact = Scontact.find(@params['object']) + + @params.reject! do |k,v| + k == "object" + end + + @scontact.update_attributes(@params) if @scontact + SyncEngine.dosync + render :string => "0" end diff --git a/SalesForce-Sencha/app/Settings/controller.rb b/SalesForce-Sencha/app/Settings/controller.rb index 2d73ebb..1e8cc31 100644 --- a/SalesForce-Sencha/app/Settings/controller.rb +++ b/SalesForce-Sencha/app/Settings/controller.rb @@ -49,6 +49,12 @@ def sync_notify WebView.navigate Rho::RhoConfig.start_path end end + + if @params['status'] == "error" + SyncEngine.stop_sync + Rhom::Rhom.database_fullclient_reset_and_logout + WebView.navigate Rho::RhoConfig.start_path + end end def do_login diff --git a/SalesForce-Sencha/app/templates/sfsenchalinkfield.erb b/SalesForce-Sencha/app/templates/sfsenchalinkfield.erb index 1302201..d19dc30 100644 --- a/SalesForce-Sencha/app/templates/sfsenchalinkfield.erb +++ b/SalesForce-Sencha/app/templates/sfsenchalinkfield.erb @@ -5,7 +5,6 @@ label: '<%= @doc_def["label"].gsub(/'/,"\\'") %>', listeners: { focus: function() { - alert("hi!"); } }, useClearIcon: false diff --git a/SalesForce-Sencha/public/app/account.js b/SalesForce-Sencha/public/app/account.js index 78c70e1..1b8c4f2 100644 --- a/SalesForce-Sencha/public/app/account.js +++ b/SalesForce-Sencha/public/app/account.js @@ -161,7 +161,6 @@ account.SaveButton = new Ext.Button({ handler: function() { if(account.DetailForm.user){ account.FormPanel.updateRecord(account.DetailForm.user, true); - setTimeout(function(){rho_sync();},250); } account.FormPanel.submit({ waitMsg : {message:'Submitting', cls : 'demos-loading'} @@ -184,6 +183,7 @@ account.DetailPanel = new Ext.Panel({ { text: 'Back', handler: function() { + account.SingleStore.proxy.url = '/app/Saccount/json'; account.Page.setActiveItem(0); } } diff --git a/SalesForce-Sencha/public/app/contact.js b/SalesForce-Sencha/public/app/contact.js index 51855ad..e6b34af 100644 --- a/SalesForce-Sencha/public/app/contact.js +++ b/SalesForce-Sencha/public/app/contact.js @@ -161,7 +161,6 @@ contact.SaveButton = new Ext.Button({ handler: function() { if(contact.DetailForm.user){ contact.FormPanel.updateRecord(contact.DetailForm.user, true); - setTimeout(function(){rho_sync();},250); } contact.FormPanel.submit({ waitMsg : {message:'Submitting', cls : 'demos-loading'} @@ -184,6 +183,7 @@ contact.DetailPanel = new Ext.Panel({ { text: 'Back', handler: function() { + contact.SingleStore.proxy.url = '/app/Scontact/json'; contact.Page.setActiveItem(0); } } diff --git a/SalesForce-Sencha/public/app/rhodes.js b/SalesForce-Sencha/public/app/rhodes.js index 9bbd0ce..0bdada7 100644 --- a/SalesForce-Sencha/public/app/rhodes.js +++ b/SalesForce-Sencha/public/app/rhodes.js @@ -32,6 +32,8 @@ function contact_sync_finished(){ Ext.regModel('SingleContact', { fields: contactfields }); + + oldurl = contact.SingleStore.proxy.url; contact.SingleStore = new Ext.data.JsonStore({ autoDestroy: true, @@ -44,7 +46,7 @@ function contact_sync_finished(){ }, proxy: { type: 'ajax', - url: '/app/Scontact/json', + url: oldurl, reader: { type: 'json', root: 'contacts', @@ -57,7 +59,9 @@ function contact_sync_finished(){ fn: function(store,array,success) { contact.DetailForm.user = store.data.items[0]; contact.FormPanel.loadModel(contact.DetailForm.user); - contact.Page.setActiveItem(1); + if(contact.SingleStore.proxy.url.indexOf('?') != -1) { + contact.Page.setActiveItem(1); + } } } } @@ -74,6 +78,8 @@ function contact_sync_finished(){ contact.DetailPanel.doLayout(); contact.DataStore.load(); + contact.SingleStore.load(); + contact.ContactList.refresh(); contact.ContactList.setLoading(false,true); @@ -84,6 +90,8 @@ function account_sync_finished(){ Ext.regModel('SingleAccount', { fields: accountfields }); + + oldurl = account.SingleStore.proxy.url; account.SingleStore = new Ext.data.JsonStore({ autoDestroy: true, @@ -96,7 +104,7 @@ function account_sync_finished(){ }, proxy: { type: 'ajax', - url: '/app/Saccount/json', + url: oldurl, reader: { type: 'json', root: 'accounts', @@ -109,7 +117,9 @@ function account_sync_finished(){ fn: function(store,array,success) { account.DetailForm.user = store.data.items[0]; account.FormPanel.loadModel(account.DetailForm.user); - account.Page.setActiveItem(1); + if(account.SingleStore.proxy.url.indexOf('?') != -1) { + account.Page.setActiveItem(1); + } } } } @@ -126,6 +136,8 @@ function account_sync_finished(){ account.DetailPanel.doLayout(); account.DataStore.load(); + account.SingleStore.load(); + account.AccountList.refresh(); account.AccountList.setLoading(false,true); diff --git a/SalesForce-Sencha/rhoconfig.txt b/SalesForce-Sencha/rhoconfig.txt index 64388cd..50645f3 100644 --- a/SalesForce-Sencha/rhoconfig.txt +++ b/SalesForce-Sencha/rhoconfig.txt @@ -11,7 +11,7 @@ rhobundle_zip_url = '' rhobundle_zip_pwd = nil # Rhodes runtime properties -MinSeverity = 1 +MinSeverity = 3 LogToOutput = 1 LogCategories = * ExcludeLogCategories = @@ -21,10 +21,10 @@ MaxLogFileSize = 0 # Sync server url. Typically this will look like 'http://:/application' # For example: 'http://localhost:9292/application' -syncserver = 'http://192.168.1.103:9292/application' +syncserver = 'http://salesforce-rhosync.rhohub.com/application' # To disable auto sync, uncomment the following line. -# sync_poll_interval=0 +sync_poll_interval=0 logserver = 'http://rhologs.heroku.com' logname='SalesForce' diff --git a/SalesForce-Sencha/rholog-4.2.txt b/SalesForce-Sencha/rholog-4.2.txt index 1d6541c..82c85d9 120000 --- a/SalesForce-Sencha/rholog-4.2.txt +++ b/SalesForce-Sencha/rholog-4.2.txt @@ -1 +1 @@ -/Users/brian/Library/Application Support/iPhone Simulator/4.2/Applications/6FA52525-4581-4EE3-B272-A938E820A772/Documents/RhoLog.txt \ No newline at end of file +/Users/brian/Library/Application Support/iPhone Simulator/4.2/Applications/DA4B73F9-85D3-4B05-9288-6F223FCE1BF9/Documents/RhoLog.txt \ No newline at end of file