Skip to content

Commit

Permalink
clean up error paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Moore authored and Brian Moore committed Feb 12, 2011
1 parent 527eff3 commit b147765
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 23 deletions.
14 changes: 8 additions & 6 deletions SalesForce-Sencha/app/Saccount/saccount_controller.rb
Expand Up @@ -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

Expand Down
15 changes: 9 additions & 6 deletions SalesForce-Sencha/app/Scontact/scontact_controller.rb
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions SalesForce-Sencha/app/Settings/controller.rb
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion SalesForce-Sencha/app/templates/sfsenchalinkfield.erb
Expand Up @@ -5,7 +5,6 @@
label: '<%= @doc_def["label"].gsub(/'/,"\\'") %>',
listeners: {
focus: function() {
alert("hi!");
}
},
useClearIcon: false
Expand Down
2 changes: 1 addition & 1 deletion SalesForce-Sencha/public/app/account.js
Expand Up @@ -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'}
Expand All @@ -184,6 +183,7 @@ account.DetailPanel = new Ext.Panel({
{
text: 'Back',
handler: function() {
account.SingleStore.proxy.url = '/app/Saccount/json';
account.Page.setActiveItem(0);
}
}
Expand Down
2 changes: 1 addition & 1 deletion SalesForce-Sencha/public/app/contact.js
Expand Up @@ -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'}
Expand All @@ -184,6 +183,7 @@ contact.DetailPanel = new Ext.Panel({
{
text: 'Back',
handler: function() {
contact.SingleStore.proxy.url = '/app/Scontact/json';
contact.Page.setActiveItem(0);
}
}
Expand Down
20 changes: 16 additions & 4 deletions SalesForce-Sencha/public/app/rhodes.js
Expand Up @@ -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,
Expand All @@ -44,7 +46,7 @@ function contact_sync_finished(){
},
proxy: {
type: 'ajax',
url: '/app/Scontact/json',
url: oldurl,
reader: {
type: 'json',
root: 'contacts',
Expand All @@ -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);
}
}
}
}
Expand All @@ -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);

Expand All @@ -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,
Expand All @@ -96,7 +104,7 @@ function account_sync_finished(){
},
proxy: {
type: 'ajax',
url: '/app/Saccount/json',
url: oldurl,
reader: {
type: 'json',
root: 'accounts',
Expand All @@ -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);
}
}
}
}
Expand All @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions SalesForce-Sencha/rhoconfig.txt
Expand Up @@ -11,7 +11,7 @@ rhobundle_zip_url = ''
rhobundle_zip_pwd = nil

# Rhodes runtime properties
MinSeverity = 1
MinSeverity = 3
LogToOutput = 1
LogCategories = *
ExcludeLogCategories =
Expand All @@ -21,10 +21,10 @@ MaxLogFileSize = 0

# Sync server url. Typically this will look like 'http://<hostname>:<port>/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'
Expand Down
2 changes: 1 addition & 1 deletion SalesForce-Sencha/rholog-4.2.txt

0 comments on commit b147765

Please sign in to comment.