From 01f26652af52efc7bbddef033fdc9772ea2bf3fe Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Jun 2012 22:41:46 -0700 Subject: [PATCH 1/2] I added code to make the Do Not Map values for Accounts and Contacts work. I also made the Do Not Map checkbox on Leads work --- src/staticresources/fixedTHeader.resource | 178 +++++++++--------- .../FindNearby_2010_Account_Tidy.trigger | 7 + .../FindNearby_2010_Contact_Tidy.trigger | 7 + .../FindNearby_2010_Lead_Tidy.trigger | 10 +- 4 files changed, 112 insertions(+), 90 deletions(-) diff --git a/src/staticresources/fixedTHeader.resource b/src/staticresources/fixedTHeader.resource index 65610a3..c5a3219 100755 --- a/src/staticresources/fixedTHeader.resource +++ b/src/staticresources/fixedTHeader.resource @@ -1,90 +1,90 @@ -(function($) -{ - $.fn.freezeHeaders = function(options) { - var index = 0; - - var defaults = { - headerId : "header", - contentId : "content" - }; - - var options = $.extend(defaults, options); - - return this.each(function() { - var obj = $(this); - - var hasThead = obj.find("thead").size() > 0; - var hasTbody = obj.find("thead").size() > 0; - - if(obj.is("table") && hasThead && hasTbody) { - var widths = []; - - // capture widths before rearranging - obj.find("thead td").each(function(i) { - widths.push($(this).width()); - }); - - var id1 = false, id2 = false; - var attrId = obj.attr("id"); - - if(attrId) { - id1 = attrId + "_header"; - id2 = attrId + "_content"; - } - - var headerId = (id1 || options.headerId) + index; - var contentId = (id2 || options.contentId) + index++; - - // insert header after the current table - var header = $("
").attr("id",headerId).css("display","none").css("overflow","hidden").insertAfter(obj); - // insert content after the header - var content = $("
").attr("id",contentId).css("display","none").css("overflow-y","auto").insertAfter(header); - - // set the options - content.height(options.height); - content.width(options.width); - - var headerTable = header.find("table"); - var contentTable = content.find("table"); - - obj.find("thead").appendTo(headerTable); - obj.find("tbody").appendTo(contentTable); - header.css("display", "block"); - content.css("display", "block"); - - headerTable.width(contentTable.width()); - - copyAttributes(obj.get(0), headerTable, contentTable); - - var rowId = 0; - // find the first possible row, which has the same number - // of columns as the header. This step is to avoid rows containing - // columns that span across multiple columns. - contentTable.find("tr").each(function(i) { - if($(this).children().size() == widths.length) { - rowId = i; - return false; - } - }); - - headerTable.find("td").each(function(i) { - var selector = "#" + contentId + " tr:eq(" + rowId + ") td:eq("+ i +")"; - $(selector).wrapInner("
"); - $(selector + " div").width(widths[i]); - $(this).wrapInner('
'); - }); - } - }); - - function copyAttributes(elem, headerTable, contentTable) { - for (var i = 0; i < elem.attributes.length; i++) { - var attrib = elem.attributes[i]; - if (attrib.specified && attrib.name != "id") { - headerTable.attr(attrib.name,attrib.value); - contentTable.attr(attrib.name,attrib.value); - } - } - } - } - +(function($) +{ + $.fn.freezeHeaders = function(options) { + var index = 0; + + var defaults = { + headerId : "header", + contentId : "content" + }; + + var options = $.extend(defaults, options); + + return this.each(function() { + var obj = $(this); + + var hasThead = obj.find("thead").size() > 0; + var hasTbody = obj.find("thead").size() > 0; + + if(obj.is("table") && hasThead && hasTbody) { + var widths = []; + + // capture widths before rearranging + obj.find("thead td").each(function(i) { + widths.push($(this).width()); + }); + + var id1 = false, id2 = false; + var attrId = obj.attr("id"); + + if(attrId) { + id1 = attrId + "_header"; + id2 = attrId + "_content"; + } + + var headerId = (id1 || options.headerId) + index; + var contentId = (id2 || options.contentId) + index++; + + // insert header after the current table + var header = $("
").attr("id",headerId).css("display","none").css("overflow","hidden").insertAfter(obj); + // insert content after the header + var content = $("
").attr("id",contentId).css("display","none").css("overflow-y","auto").insertAfter(header); + + // set the options + content.height(options.height); + content.width(options.width); + + var headerTable = header.find("table"); + var contentTable = content.find("table"); + + obj.find("thead").appendTo(headerTable); + obj.find("tbody").appendTo(contentTable); + header.css("display", "block"); + content.css("display", "block"); + + headerTable.width(contentTable.width()); + + copyAttributes(obj.get(0), headerTable, contentTable); + + var rowId = 0; + // find the first possible row, which has the same number + // of columns as the header. This step is to avoid rows containing + // columns that span across multiple columns. + contentTable.find("tr").each(function(i) { + if($(this).children().size() == widths.length) { + rowId = i; + return false; + } + }); + + headerTable.find("td").each(function(i) { + var selector = "#" + contentId + " tr:eq(" + rowId + ") td:eq("+ i +")"; + $(selector).wrapInner("
"); + $(selector + " div").width(widths[i]); + $(this).wrapInner('
'); + }); + } + }); + + function copyAttributes(elem, headerTable, contentTable) { + for (var i = 0; i < elem.attributes.length; i++) { + var attrib = elem.attributes[i]; + if (attrib.specified && attrib.name != "id") { + headerTable.attr(attrib.name,attrib.value); + contentTable.attr(attrib.name,attrib.value); + } + } + } + } + })(jQuery); \ No newline at end of file diff --git a/src/triggers/FindNearby_2010_Account_Tidy.trigger b/src/triggers/FindNearby_2010_Account_Tidy.trigger index a5a5469..8dfa000 100755 --- a/src/triggers/FindNearby_2010_Account_Tidy.trigger +++ b/src/triggers/FindNearby_2010_Account_Tidy.trigger @@ -28,6 +28,13 @@ trigger FindNearby_2010_Account_Tidy on Account (before update) { reset = true; } } + // Added else if below to make Do Not Map selection able to be saved + else if (Trigger.new[k].Which_Address__c == 'Do Not Map') + { + Trigger.new[k].Which_Address__c = 'Do Not Map'; + reset=true; + } + // End edit else{ Trigger.new[k].Which_Address__c = 'Billing'; reset = true; diff --git a/src/triggers/FindNearby_2010_Contact_Tidy.trigger b/src/triggers/FindNearby_2010_Contact_Tidy.trigger index b868db7..c0e43a7 100755 --- a/src/triggers/FindNearby_2010_Contact_Tidy.trigger +++ b/src/triggers/FindNearby_2010_Contact_Tidy.trigger @@ -27,6 +27,13 @@ trigger FindNearby_2010_Contact_Tidy on Contact (before update) { reset = true; } } + // Added else if below to make Do Not Map selection able to be saved + else if (Trigger.new[k].Mapping_Address__c == 'Do Not Map') + { + Trigger.new[k].Mapping_Address__c = 'Do Not Map'; + reset=true; + } + // End edit else{ Trigger.new[k].Mapping_Address__c = 'Mailing'; reset = true; diff --git a/src/triggers/FindNearby_2010_Lead_Tidy.trigger b/src/triggers/FindNearby_2010_Lead_Tidy.trigger index 6824f2e..6cbf5a8 100755 --- a/src/triggers/FindNearby_2010_Lead_Tidy.trigger +++ b/src/triggers/FindNearby_2010_Lead_Tidy.trigger @@ -18,7 +18,15 @@ trigger FindNearby_2010_Lead_Tidy on Lead (before update) { Trigger.new[k].Lat__c = null; Trigger.new[k].Lon__c = null; } - + // Added code to make Do Not Map checkbox work + if(Trigger.new[k].Do_Not_Map__c == true) + { + reset = true; + } else + { + Trigger.new[k].Do_Not_Map__c = false; + } + // End edit if(reset){ Trigger.new[k].Mapping_Status__c = 'Not Located Yet'; Trigger.new[k].Lat__c = null; From db10ddeb33bcc4cda0dbd4f8d697e73e9974cfc5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Jun 2012 22:47:04 -0700 Subject: [PATCH 2/2] I added code to make the Do Not Map values for Accounts and Contacts work. I also made the Do Not Map checkbox on Leads work --- src/triggers/FindNearby_2010_Account_Tidy.trigger | 2 +- src/triggers/FindNearby_2010_Contact_Tidy.trigger | 2 +- src/triggers/FindNearby_2010_Lead_Tidy.trigger | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/triggers/FindNearby_2010_Account_Tidy.trigger b/src/triggers/FindNearby_2010_Account_Tidy.trigger index 8dfa000..d877c20 100755 --- a/src/triggers/FindNearby_2010_Account_Tidy.trigger +++ b/src/triggers/FindNearby_2010_Account_Tidy.trigger @@ -34,7 +34,7 @@ trigger FindNearby_2010_Account_Tidy on Account (before update) { Trigger.new[k].Which_Address__c = 'Do Not Map'; reset=true; } - // End edit + // End edit else{ Trigger.new[k].Which_Address__c = 'Billing'; reset = true; diff --git a/src/triggers/FindNearby_2010_Contact_Tidy.trigger b/src/triggers/FindNearby_2010_Contact_Tidy.trigger index c0e43a7..b6cc7d6 100755 --- a/src/triggers/FindNearby_2010_Contact_Tidy.trigger +++ b/src/triggers/FindNearby_2010_Contact_Tidy.trigger @@ -27,7 +27,7 @@ trigger FindNearby_2010_Contact_Tidy on Contact (before update) { reset = true; } } - // Added else if below to make Do Not Map selection able to be saved + // Added else if below to make Do Not Map selection able to be saved else if (Trigger.new[k].Mapping_Address__c == 'Do Not Map') { Trigger.new[k].Mapping_Address__c = 'Do Not Map'; diff --git a/src/triggers/FindNearby_2010_Lead_Tidy.trigger b/src/triggers/FindNearby_2010_Lead_Tidy.trigger index 6cbf5a8..4928591 100755 --- a/src/triggers/FindNearby_2010_Lead_Tidy.trigger +++ b/src/triggers/FindNearby_2010_Lead_Tidy.trigger @@ -18,7 +18,7 @@ trigger FindNearby_2010_Lead_Tidy on Lead (before update) { Trigger.new[k].Lat__c = null; Trigger.new[k].Lon__c = null; } - // Added code to make Do Not Map checkbox work + // Added code to make Do Not Map checkbox work if(Trigger.new[k].Do_Not_Map__c == true) { reset = true;