FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Force.com-JavaScript-REST-Toolkit/example.page at master · rajaraodv/Force.com-JavaScript-REST-Toolkit · GitHub
rajaraodv
/
Force.com-JavaScript-REST-Toolkit
Public
forked from
developerforce/Force.com-JavaScript-REST-Toolkit
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Force.com-JavaScript-REST-Toolkit
/
example.page
Copy path
More file actions
More file actions
Latest commit
History
History
History
150 lines (135 loc) · 6.22 KB
Breadcrumbs
Force.com-JavaScript-REST-Toolkit
/
example.page
Copy path
File metadata and controls
150 lines (135 loc) · 6.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!--
Copyright (c) 2011, salesforce.com, inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-->
<!--
Sample Visualforce page for Force.com JavaScript REST Toolkit
-->
<apex:page standardStylesheets="false" showHeader="false" sidebar="false">
<head>
<title>
Force.com JavaScript REST Toolkit
</title>
<!--
You will need to download jQuery, jQuery UI and Trimpath Template,
and put them in a static resource bundle!
-->
<apex:stylesheet value="{!URLFOR($Resource.sample, '/style.css')}" />
<apex:stylesheet value="{!URLFOR($Resource.static, '/static/jquery-ui.css')}" />
<apex:includeScript value="{!URLFOR($Resource.static, '/static/jquery.js')}" />
<apex:includeScript value="{!URLFOR($Resource.static, '/static/jquery-ui.js')}" />
<apex:includeScript value="{!URLFOR($Resource.static, '/static/template.js')}" />
<apex:includeScript value="{!URLFOR($Resource.sample, '/forcetk.js')}" />
<apex:includeScript value="{!URLFOR($Resource.sample, '/app.js')}" />
<script type="text/javascript">
/*
* This is the Visualforce-specific JavaScript code for our sample app.
* It must go in the VF page so that merge variables are processed.
*/
// Get a reference to jQuery that we can work with
$j = jQuery.noConflict();
// Get an instance of the REST API client and set the session ID
var client = new forcetk.Client();
client.setSessionToken('{!$Api.Session_ID}');
var ajaxgif = "<img src='{!URLFOR($Resource.sample, '/ajax.gif')}' />";
var $dialog = null;
$j(document).ready(function() {
// Set up the dialog
$dialog = $j('<div></div>')
.dialog({
autoOpen: false,
width: 450
});
// Kick things off by doing a describe on Account...
$j('#prompt').html(ajaxgif+" loading metadata...");
client.describe('Account', metadataCallback);
});
</script>
</head>
<body>
<div class="ui-widget" id="main">
<div id="prompt">
</div>
<div id="list">
</div>
</div>
<textarea id="prompt_jst" style="display:none;">
<form>
<h3 style="display:inline;">Filter on</h3>
<select id="field">
{for f in fields}
{if f.type == 'string'}
<option value="${f.name}">${f.label}</option>
{/if}
{/for}
</select>
<input type="text" id="value" />
<input type="submit" id="go" name="search" value="Search" />
</form>
<form>
<input type="submit" id="new" name="new" value="New" />
</form>
</textarea>
<textarea id="accounts_jst" style="display:none;">
<table class="main" id="accounts">
{for r in records}
<tr><td class="id" id="${r.Id}">${r.Name}</td></tr>
{/for}
</table>
<br/>
<a href="#" id="logout">Logout</a>
<p>
<i>Running jQuery <span id="version">0.0.0</span>, jQuery UI <span id="uiversion">0.0.0</span></i>
</p>
</textarea>
<textarea id="detail_jst" style="display:none;">
<table>
{if Website != null}
<tr><td>Name:</td><td><a href="${Website}">${Name}</a></td></tr>
{else}
<tr><td>Name:</td><td>${Name}</td></tr>
{/if}
{if Industry != null}
<tr><td>Industry:</td><td><a href="#" id="industry">${Industry}</a></td></tr>
{/if}
{if TickerSymbol != null}
<tr><td>Ticker Symbol:</td><td><a href="http://www.google.com/finance?q=${TickerSymbol}">${TickerSymbol}</a></td></tr>
{/if}
</table>
<br/>
<form>
<input type="hidden" name="id" id="id" value="${Id}" />
<button id="delete">Delete</button>
<button id="edit">Edit</button>
</form>
</textarea>
<textarea id="edit_jst" style="display:none;">
<form id="editform">
<input type="hidden" name="id" id="id" value="${Id}" />
<table>
<tr><td>Name:</td><td><input name="Name" id="Name" value="${Name}"/></td></tr>
<tr><td>Industry:</td><td><input name="Industry" id="Industry" value="${Industry}"/></td></tr>
<tr><td>Ticker Symbol:</td><td><input name="TickerSymbol" id="TickerSymbol" value="${TickerSymbol}"/></td></tr>
</table>
<br/>
<button id="action" />
</form>
</textarea>
</body>
</apex:page>
Back
|
FazBrowse Home
|
New Git URL