forked from googleworkspace/apps-script-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreferencedialog.html
More file actions
182 lines (162 loc) · 6.47 KB
/
referencedialog.html
File metadata and controls
182 lines (162 loc) · 6.47 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?
var possibleKinds = {
'book': 'Book',
'article': 'Journal article'
};
// If this is an empty form and we're supposed to create a new reference, add a dummy first author
// field for the user to fill in.
if (!this.authors) {
this.authors = [{'lastName': '', 'firstName': ''}];
}
// By default, we assume new references are books. The user can change this if they want.
if (!this.kind) {
this.kind = 'book';
}
?><!doctype html>
<title>Google Apps Script and Google Docs demo: Bibstro</title>
<link rel=stylesheet
href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css">
<style>
#contentPane {
bottom: 70px;
overflow: auto;
position: absolute;
top: 0;
width: 100%;
}
#actionPane {
bottom: 0;
height: 70px;
position: absolute;
width: 100%;
}
#actionPane > .form-actions {
margin-bottom: 0;
margin-top: 0;
}
</style>
<form id=referenceForm class=form-horizontal>
<fieldset id=contentPane>
<legend><? if (!this.id) { ?>Add a new<? } else { ?>Edit an existing<? } ?> source</legend>
<? if (this.id) { ?><input name=id type=hidden value="<?= id ?>"><? } ?>
<div class="control-group kind-article kind-book">
<label class=control-label for=referenceForm-kind>Kind of work:</label>
<div class=controls>
<select id=referenceForm-kind class=input-large name=kind>
<? for (var possibleKind in possibleKinds) { ?>
<option value="<?= possibleKind ?>"<? if (this.kind == possibleKind) { ?> selected<? } ?>>
<?= possibleKinds[possibleKind] ?>
</option>
<? } ?>
</select>
</div>
</div>
<? for (var i = 0; i < authors.length; ++i) { ?>
<div class="control-group kind-article kind-book">
<label class=control-label for="referenceForm-author<?= i ?>">Author:</label>
<div class=controls>
<input id="referenceForm-author<?= i ?>" class=required name="lastName[<?= i ?>]" type=text
placeholder="Last name" value="<?= authors[i].lastName ?>">
<input class=required name="firstName[<?= i ?>]" type=text placeholder="First name"
value="<?= authors[i].firstName ?>">
<button class="referenceForm-removeAuthor btn btn-danger disabled"
<? if (authors.length == 1) { ?>type=button disabled<? } ?>>
X
</button>
</div>
</div>
<? } ?>
<div class="control-group kind-article kind-book">
<div class=controls>
<button id=referenceForm-addAuthor class="btn btn-info" type=button
data-nextindex="<?= authors.length ?>">
Add Another Author
</button>
</div>
</div>
<div class="control-group kind-article kind-book">
<label class=control-label for=referenceForm-title>Title:</label>
<div class=controls>
<input id=referenceForm-title class=input-xlarge name=title type=text
value="<?= this.title || '' ?>">
</div>
</div>
<div class="control-group kind-article"
<? if (this.kind != 'article') { ?>style="display: none;"<? } ?>>
<label class=control-label for=referenceForm-publication>Publication name:</label>
<div class=controls>
<input id=referenceForm-publication class=input-xlarge name=publication type=text
value="<?= this.publication || '' ?>">
</div>
</div>
<div class="control-group kind-book"
<? if (this.kind != 'book') { ?>style="display: none;"<? } ?>>
<label class=control-label for=referenceForm-edition>Optional information:</label>
<div class=controls>
<input id=referenceForm-edition class=input-small name=edition type=text placeholder=Edition
value="<?= this.edition || '' ?>">
ed., Vol.
<input class=input-small name=volume type=text placeholder=Volume
value="<?= this.volume || '' ?>">
</div>
</div>
<div class="control-group kind-article"
<? if (this.kind != 'article') { ?>style="display: none;"<? } ?>>
<label class=control-label for=referenceForm-journalVolume>Volume and issue:</label>
<div class=controls>
<input id=referenceForm-journalVolume class=input-small name=journalVolume type=text
placeholder=Volume value="<?= this.journalVolume || '' ?>">
.
<input class=input-small name=journalIssue type=text placeholder=Issue
value="<?= this.journalIssue || '' ?>">
</div>
</div>
<div class="control-group kind-article kind-book">
<label class=control-label for=referenceForm-publicationYear>Publication year:</label>
<div class=controls>
<input id=referenceForm-publicationYear class=input-small name=publicationYear type=text
value="<?= this.publicationYear || '' ?>">
</div>
</div>
<div class="control-group kind-book"
<? if (this.kind != 'book') { ?>style="display: none;"<? } ?>>
<label class=control-label for=referenceForm-publisher>Publishing company:</label>
<div class=controls>
<input id=referenceForm-publisher class=input-xlarge name=publisher type=text
value="<?= this.publisher || '' ?>">
</div>
</div>
<div class="control-group kind-book"
<? if (this.kind != 'book') { ?>style="display: none;"<? } ?>>
<label class=control-label for=referenceForm-publisherCity>City of publication:</label>
<div class=controls>
<input id=referenceForm-publisherCity class=input-xlarge name=publisherCity type=text
value="<?= this.publisherCity || '' ?>">
</div>
</div>
<div class="control-group kind-article"
<? if (this.kind != 'article') { ?>style="display: none;"<? } ?>>
<label class=control-label for=referenceForm-startPage>Pages cited:</label>
<div class=controls>
<input id=referenceForm-startPage class=input-small name=startPage type=text
placeholder=Start value="<?= this.startPage || '' ?>">
–
<input class=input-small name=endPage type=text placeholder=End
value="<?= this.endPage || '' ?>">
</div>
</div>
</fieldset>
<div id=actionPane><div class=form-actions>
<button class="btn btn-success" type=submit>
<? if (!this.id) { ?>Add<? } else { ?>Update<? } ?> Source
</button>
<button id=cancel class=btn type=button>Cancel</button>
</div></div>
</form>
<script>
document.write(
<?!=
JSON.stringify(HtmlService.createHtmlOutputFromFile('referencedialog_js.html').
getContent()).replace(/\//g, '\\/')
?>);
</script>