Skip to content

Instantly share code, notes, and snippets.

View fractastical's full-sized avatar

Joel Dietz fractastical

View GitHub Profile
public with sharing class TaskWrapper {
public Boolean markedComplete { get; set; }
public Boolean markedIncomplete { get; set; }
public Boolean markedReviewed { get; set; }
public Boolean created { get; set; }
public String assignedTo { get; set; }
//public Boolean markedReviewedIncomplete { get; set; }
public NewsFeed taskFeedItem { get; set; }
public Integer commentCount { get; set; }
public void getLabelsAndWidthsfromFields(List<String> fieldNames, String objectName)
{
labels = new List<String>();
widths = new List<String>();
try {
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
SObjectType sot = gd.get(objectName);
Map<String, SObjectField> fields = sot.getDescribe().fields.getMap();
List<SObjectField> fieldtokens = fields.values();
//prototype only. Does not actually work yet...
public with sharing class SObjectUtils {
//Does not support fields with multiple reference object types
public SObject deepClone(SObject so) {
SObject newSO = so.clone(false,true);
host = ApexPages.currentPage().getHeaders().get('Host');
Integer startIndex = siteUrl.indexOf(host) + host.length() + 1;
Integer endIndex = siteUrl.lastIndexOf('/');
System.debug('si:' + startIndex + 'ei: ' + endIndex);
if(startIndex < endIndex && startIndex != -1)
extension = siteUrl.substring(startIndex,endIndex);
else
extension = '';
if(extension != 'apex')
testUrl2 = siteUrl.substring(0, startIndex) + extension + System.Page.largeLookup.getUrl();
// The step is the distance between each label on the y axis
public Integer calculateStepSize(Integer highestVal)
{
//calculates the appropriate step to display on the y axis
List<Integer> possibleSteps = New Integer[]{1,2,5,10,20,50};
for(Integer i= (possibleSteps.size() - 1);i >= 0; i--) {
System.debug('HIGH DIV 6:' + (highestVAl / 6) + ' POSS STEP:' + possibleSteps[i]);
if ((highestVal / 6) > possibleSteps[i])
return possibleSteps[i];
}
<div id="addTask" style="display: none" >
<apex:outputpanel id="atd">
<h2>New Task</h2>
<apex:form >
<apex:panelGrid columns="2" width="85%">
// see: http://community.salesforce.com/t5/Apex-Code-Development/Building-a-reusable-JSON-component/m-p/172428
// and: http://joe-ferraro.com/2009/04/extjs-vf-json/
public static String getJsonFromObject(String objectName, List<String> columns, String filterString)
{
if(filterString == null)
filterString = '';
String jsonData = '[ ';
try {
/* Joel Dietz
jdietz@gmail.com
03/26/2010
*/
public class TaskController {
public TaskPage activePage { get; set; }
public List<TaskPage> pages { get; set; }
public List<TaskPage> activePages { get; set; }
<apex:pageBlock id="recordsection" >
<div id="myrecordsection">
<apex:pageBlockSection title="All Assigned Tasks" columns="1">
<apex:pageBlockTable value="{!activePage.pageTasks}" title="Tasks to Review" var="td" id="ttr">
<apex:column headerValue="Name">
<apex:outputField value="{!td.name}"/>
</apex:column>
<script type="text/javascript" src="{!URLFOR($Resource.JQAutocomplete11,'jquery-autocomplete/jquery.autocomplete.pack.js')}"></script>