forked from ArctosDB/arctos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublication.cfm
713 lines (707 loc) · 29.9 KB
/
Publication.cfm
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
<cfinclude template="includes/_header.cfm">
<cfif action is "nothing" and isdefined("publication_id") and isnumeric(publication_id)>
<cfoutput><cflocation url="Publication.cfm?action=edit&publication_id=#publication_id#" addtoken="false"></cfoutput>
</cfif>
<!---------------------------------------------------------------------------------------------------------->
<cfif action is "edit">
<cfset title = "Edit Publication">
<cfoutput>
<a href="/SpecimenUsage.cfm?action=search&publication_id=#publication_id#">Publication Details</a>
<br>
<cfquery name="ctpublication_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select publication_type from ctpublication_type order by publication_type
</cfquery>
<cfquery name="pub" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select * from publication where publication_id=#publication_id#
</cfquery>
<cfquery name="auth" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
publication_agent_id,
publication_agent.agent_id,
agent_name,
author_role
from
publication_agent,
preferred_agent_name
where
publication_agent.agent_id=preferred_agent_name.agent_id and
publication_id=#publication_id#
order by agent_name
</cfquery>
<cfquery name="ctmedia_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select media_type from ctmedia_type order by media_type
</cfquery>
<cfquery name="ctmime_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select mime_type from ctmime_type order by mime_type
</cfquery>
<form name="editPub" method="post" action="Publication.cfm">
<br><input type="button" value="save" class="savBtn" onclick="editPub.action.value='saveEdit';editPub.submit();">
<input type="hidden" name="publication_id" value="#pub.publication_id#">
<input type="hidden" name="action" value="saveEdit">
<table>
<tr>
<td>
<label for="full_citation" onclick="getDocs('publication','full_citation')" class="likeLink">Full Citation</label>
<textarea name="full_citation" id="full_citation" class="reqdClr" rows="3" cols="80">#pub.full_citation#</textarea>
</td>
<td>
<span class="infoLink" onclick="italicize('full_citation')">italicize selected text</span>
<br><span class="infoLink" onclick="bold('full_citation')">bold selected text</span>
<br><span class="infoLink" onclick="superscript('full_citation')">superscript selected text</span>
<br><span class="infoLink" onclick="subscript('full_citation')">subscript selected text</span>
<br><span class="infoLink" onclick="toProperCase('full_citation')">Proper Case selected text</span>
</td>
</tr>
</table>
<label for="short_citation" onclick="getDocs('publication','short_citation')" class="likeLink">Short Citation</label>
<input type="text" id="short_citation" name="short_citation" value="#pub.short_citation#" size="80">
<table>
<tr>
<td>
<label for="publication_type" onclick="getDocs('publication','type')" class="likeLink">Publication Type</label>
<select name="publication_type" id="publication_type" class="reqdClr">
<option value=""></option>
<cfloop query="ctpublication_type">
<option <cfif publication_type is pub.publication_type> selected="selected" </cfif>
value="#publication_type#">#publication_type#</option>
</cfloop>
</select>
</td>
<td>
<label for="is_peer_reviewed_fg" onclick="getDocs('publication','peer_review')" class="likeLink">Peer Reviewed?</label>
<select name="is_peer_reviewed_fg" id="is_peer_reviewed_fg" class="reqdClr">
<option <cfif pub.is_peer_reviewed_fg is 1> selected="selected" </cfif>value="1">yes</option>
<option <cfif pub.is_peer_reviewed_fg is 0> selected="selected" </cfif>value="0">no</option>
</select>
</td>
<td>
<label for="published_year" onclick="getDocs('publication','published_year')" class="likeLink">Published Year</label>
<input type="text" name="published_year" id="published_year" value="#pub.published_year#">
</td>
</tr>
</table>
<label for="doi" onclick="getDocs('publication','doi')" class="likeLink">Digital Object Identifier (DOI)</label>
<input type="text" id="doi" name="doi" value="#pub.doi#" size="80">
<cfif len(pub.doi) gt 0>
<a class="infoLink external" target="_blank" href="http://dx.doi.org/#pub.doi#">[ open DOI ]</a>
<cfelse>
<a id="addadoiplease" class="red likeLink" onclick="findDOI('#URLEncodedFormat(pub.full_citation)#')">Bah! No DOI! Click this!</a>
</cfif>
<label for="pmid" onclick="getDocs('publication','doi')" class="likeLink">PubMed ID (PMID)</label>
<input type="text" id="pmid" name="pmid" value="#pub.pmid#" size="80">
<cfif len(pub.pmid) gt 0>
<a class="infoLink external" target="_blank" href="http://www.ncbi.nlm.nih.gov/pubmed/#pub.pmid#">[ open PubMed ]</a>
</cfif>
<label for="publication_loc">Storage Location</label>
<input type="text" name="publication_loc" id="publication_loc" size="80" value="#pub.publication_loc#">
<label for="publication_remarks">Remark</label>
<textarea name="publication_remarks" id="publication_remarks" class="largetextarea">#pub.publication_remarks#</textarea>
<p></p>
<span class="likeLink" onclick="getDocs('publication','author')">Current Authors</span>
<table border id="authTab">
<tr>
<th>Role</th>
<th>Name</th>
<th></th>
</tr>
<cfset i=0>
<cfloop query="auth">
<cfset i=i+1>
<input type="hidden" name="agent_id#i#" id="agent_id#i#" value="#agent_id#">
<input type="hidden" name="publication_agent_id#i#" id="publication_agent_id#i#" value="#publication_agent_id#">
<tr id="authortr#i#">
<td>
<select name="author_role#i#" id="author_role#i#">
<option <cfif author_role is "author"> selected="selected" </cfif>value="author">author</option>
<option <cfif author_role is "editor"> selected="selected" </cfif>value="editor">editor</option>
</select>
</td>
<td>
<input type="text" name="author_name#i#" id="author_name#i#" class="reqdClr" size="50"
onchange="getAgent('agent_id#i#',this.name,'editPub',this.value)"
onkeypress="return noenter(event);"
value="#agent_name#">
</td>
<td>
<span class="infoLink" onclick="deleteAgent(#i#)">Delete</span>
</td>
</tr>
</cfloop>
<input type="hidden" name="numberAuthors" id="numberAuthors" value="#i#">
</table>
<span class="likeLink" onclick="getDocs('publication','author')">Add Authors</span>
<table border id="authTab" class="newRec">
<tr>
<th>Role</th>
<th>Name</th>
<th></th>
</tr>
<cfset numNewAuths="3">
<cfloop from="1" to="#numNewAuths#" index="i">
<input type="hidden" name="n_agent_id#i#" id="n_agent_id#i#">
<tr id="n_authortr#i#">
<td>
<select name="n_author_role#i#" id="n_author_role#i#">
<option value="author">author</option>
<option value="editor">editor</option>
</select>
</td>
<td>
<input type="text" name="n_author_name#i#" id="n_author_name#i#" class="reqdClr" size="50"
onchange="getAgent('n_agent_id#i#',this.name,'editPub',this.value)"
onkeypress="return noenter(event);">
</td>
<td>
-
</td>
</tr>
</cfloop>
<input type="hidden" name="numNewAuths" id="numNewAuths" value="#numNewAuths#">
</table>
<cfquery name="media" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select distinct
media.media_id,
media.media_uri,
media.mime_type,
media.media_type,
media.preview_uri
from
media,
media_relations,
media_labels
where
media.media_id=media_relations.media_id and
media.media_id=media_labels.media_id (+) and
media_relations.media_relationship like '%publication' and
media_relations.related_primary_key = #publication_id#
</cfquery>
<cfif media.recordcount gt 0>
Click Media Details to edit Media or remove the link to this Publication.
<div class="thumbs">
<div class="thumb_spcr"> </div>
<cfloop query="media">
<cfinvoke component="/component/functions" method="getMediaPreview" returnVariable="puri">
<cfinvokeargument name="preview_uri" value="#preview_uri#">
<cfinvokeargument name="media_type" value="#media_type#">
</cfinvoke>
<cfquery name="labels" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select
media_label,
label_value
from
media_labels
where
media_id=#media_id#
</cfquery>
<cfquery name="desc" dbtype="query">
select label_value from labels where media_label='description'
</cfquery>
<cfset alt="Media Preview Image">
<cfif desc.recordcount is 1>
<cfset alt=desc.label_value>
</cfif>
<div class="one_thumb">
<a href="/media/#media_id#?open" target="_blank"><img src="#puri#" alt="#alt#" class="theThumb"></a>
<p>
#media_type# (#mime_type#)
<br><a href="/media/#media_id#" target="_blank">Media Details</a>
<br>#alt#
</p>
</div>
</cfloop>
<div class="thumb_spcr"> </div>
</div>
</cfif>
<div class="cellDiv">
Add Media:
<div style="font-size:small">
Yellow cells are only required if you supply or create a URI. You may leave this section blank.
<br>Find Media and create a relationship to link existing Media to this Publication.
</div>
<label for="media_uri">Media URI</label>
<input type="text" name="media_uri" id="media_uri" size="90" class="reqdClr"><span class="infoLink" id="uploadMedia">Upload</span>
<label for="preview_uri">Preview URI</label>
<input type="text" name="preview_uri" id="preview_uri" size="90">
<label for="mime_type">MIME Type</label>
<select name="mime_type" id="mime_type" class="reqdClr">
<option value=""></option>
<cfloop query="ctmime_type">
<option value="#mime_type#">#mime_type#</option>
</cfloop>
</select>
<label for="media_type">Media Type</label>
<select name="media_type" id="media_type" class="reqdClr">
<option value=""></option>
<cfloop query="ctmedia_type">
<option value="#media_type#">#media_type#</option>
</cfloop>
</select>
<label for="media_desc">Media Description</label>
<input type="text" name="media_desc" id="media_desc" size="80" class="reqdClr">
</div>
<input type="hidden" name="origNumberLinks" id="origNumberLinks" value="#i#">
<input type="hidden" name="numberLinks" id="numberLinks" value="#i#">
<br><input type="button" value="save" class="savBtn" onclick="editPub.action.value='saveEdit';editPub.submit();">
<input type="button" value="Delete Publication" class="delBtn" onclick="editPub.action.value='deletePub';confirmDelete('editPub');">
</form>
</cfoutput>
</cfif>
<!---------------------------------------------------------------------------------------------------------->
<cfif action is "deletePub">
<cftransaction>
<cfquery name="dpublication_agent" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from publication_agent where publication_id=#publication_id#
</cfquery>
<cfquery name="dpublication" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from publication where publication_id=#publication_id#
</cfquery>
</cftransaction>
it's gone.
</cfif>
<!---------------------------------------------------------------------------------------------------------->
<cfif action is "saveEdit">
<cfoutput>
<cftransaction>
<cfif len(doi) gt 0>
<cfinvoke component="/component/functions" method="checkDOI" returnVariable="isok">
<cfinvokeargument name="doi" value="#doi#">
</cfinvoke>
<cfif isok is not "true">
<cfthrow message = "DOI #doi# failed validation with StatusCode #isok#">
</cfif>
</cfif>
<cfquery name="pub" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
update publication set
published_year=<cfif len(published_year) gt 0>#published_year#<cfelse>NULL</cfif>,
publication_type='#publication_type#',
publication_loc='#publication_loc#',
full_citation='#escapeQuotes(full_citation)#',
short_citation='#escapeQuotes(short_citation)#',
publication_remarks='#escapeQuotes(publication_remarks)#',
is_peer_reviewed_fg=#is_peer_reviewed_fg#,
doi='#doi#',
pmid='#pmid#'
where publication_id=#publication_id#
</cfquery>
<cfif len(media_uri) gt 0>
<cfquery name="mid" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select sq_media_id.nextval nv from dual
</cfquery>
<cfset media_id=mid.nv>
<cfquery name="makeMedia" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into media (media_id,media_uri,mime_type,media_type,preview_uri)
values (#media_id#,'#escapeQuotes(media_uri)#','#mime_type#','#media_type#','#preview_uri#')
</cfquery>
<cfquery name="makeRelation" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into media_relations (
media_id,
media_relationship,
related_primary_key
) values (
#media_id#,
'shows publication',
#publication_id#
)
</cfquery>
<cfquery name="makeRelation" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into media_labels (
media_id,
media_label,
label_value)
values (#media_id#,'description','#media_desc#')
</cfquery>
</cfif>
<cfloop from="1" to="#numberAuthors#" index="n">
<cfset publication_agent_id = evaluate("publication_agent_id" & n)>
<cfset agent_id = evaluate("agent_id" & n)>
<cfset author_role = evaluate("author_role" & n)>
<cfset author_name = evaluate("author_name" & n)>
<cfif author_name is "deleted">
<cfquery name="delAuth" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
delete from publication_agent where
publication_agent_id=#publication_agent_id#
</cfquery>
<cfelse>
<cfquery name="uAuth" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
update publication_agent set
agent_id=#agent_id#,
author_role='#author_role#'
where
publication_agent_id=#publication_agent_id#
</cfquery>
</cfif>
</cfloop>
<cfloop from="1" to="#numNewAuths#" index="n">
<cfset agent_id = evaluate("n_agent_id" & n)>
<cfset author_role = evaluate("n_author_role" & n)>
<cfif len(agent_id) gt 0>
<cfquery name="insAuth" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into publication_agent (
publication_id,
agent_id,
author_role
) values (
#publication_id#,
#agent_id#,
'#author_role#'
)
</cfquery>
</cfif>
</cfloop>
</cftransaction>
<cflocation url="Publication.cfm?action=edit&publication_id=#publication_id#" addtoken="false">
</cfoutput>
</cfif>
<!---------------------------------------------------------------------------------------------------------->
<cfif action is "newPub">
<cfset title = "Create Publication">
<cfquery name="ctpublication_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select publication_type from ctpublication_type order by publication_type
</cfquery>
<cfquery name="ctmedia_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select media_type from ctmedia_type order by media_type
</cfquery>
<cfquery name="ctmime_type" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select mime_type from ctmime_type order by mime_type
</cfquery>
<style>
.missing {
border:2px solid red;
}
</style>
<script>
function confirmpub() {
var r=true;
var msg='';
$('.missing').removeClass('missing');
$('.reqdClr').each(function() {
var thisel=$("#" + this.id)
if ($(thisel).val().length==0){
msg += this.id + ' is required\n';
$(thisel).addClass('missing');
}
});
if (msg.length>0){
alert(msg);
return false;
} else {
if ($("#doi").val().length==0 && $("#pmid").val().length==0){
msg = 'Please enter a DOI or PMID if one is available for this article is available\n';
msg+='Click OK to enter a DOI or PMID before creating this article, or Cancel to proceed.\n';
msg+='There are also tools on the next page to help find DOI.';
var r = confirm(msg);
if (r == true) {
return false;
} else {
return true;
}
}
return true;
}
}
function toggleMedia() {
if($('#media').css('display')=='none') {
$('#mediaToggle').html('[ Remove Media ]');
$('#media').show();
$('#media_uri').addClass('reqdClr');
$('#preview_uri').addClass('reqdClr');
$('#mime_type').addClass('reqdClr');
$('#media_type').addClass('reqdClr');
$('#media_desc').addClass('reqdClr');
} else {
$('#mediaToggle').html('[ Add Media ]');
$('#media').hide();
$('#media_uri').val('').removeClass('reqdClr');
$('#preview_uri').val('').removeClass('reqdClr');
$('#mime_type').val('').removeClass('reqdClr');
$('#media_type').val('').removeClass('reqdClr');
$('#media_desc').val('').removeClass('reqdClr');
}
}
function useThisAuthor (i,name,id) {
$("#n_agent_id" + i).val(id);
$("#n_author_name" + i).val(name);
}
function getPubMeta(idtype){
$("#doilookup").html('<image src="/images/indicator.gif">');
$("#pmidlookup").html('<image src="/images/indicator.gif">');
$('#doi').val($('#doi').val().trim());
$('#pmid').val($('#pmid').val().trim());
if (idtype=='DOI'){
var identifier=$('#doi').val();
} else {
var identifier=$('#pmid').val();
}
jQuery.getJSON("/component/functions.cfc",
{
method : "getPublication",
identifier : identifier,
idtype: idtype,
returnformat : "json",
queryformat : 'column'
},
function (d) {
if(d.DATA.STATUS=='success'){
$("#full_citation").val(d.DATA.LONGCITE);
$("#short_citation").val(d.DATA.SHORTCITE);
$("#publication_type").val(d.DATA.PUBLICATIONTYPE);
$("#is_peer_reviewed_fg").val(1);
$("#published_year").val(d.DATA.YEAR);
$("#short_citation").val(d.DATA.SHORTCITE);
for (i = 1; i<5; i++) {
$("#authSugg" + i).html('');
var thisAuthStr=eval("d.DATA.AUTHOR"+i);
thisAuthStr=String(thisAuthStr);
if (thisAuthStr.length>0){
thisAuthAry=thisAuthStr.split("|");
for (z = 0; z<thisAuthAry.length; z++) {
var thisAuthRec=thisAuthAry[z].split('@');
var thisAgentName=thisAuthRec[0];
var thisAgentID=thisAuthRec[1];
var thisSuggest='<span class="infoLink" onclick="useThisAuthor(';
thisSuggest += "'" + i + "','" + thisAgentName + "','" + thisAgentID + "'" + ');"> [ ' + thisAgentName + " ] </span>";
try {
$("#authSugg" + i).append(thisSuggest);
} catch(err){}
}
}
}
$("#doilookup").html(' [ crossref ] ');
$("#pmidlookup").html(' [ pubmed ] ');
} else {
$("#doilookup").text(' [ crossref ] ');
$("#pmidlookup").text(' [ pubmed ] ');
alert(d.DATA.STATUS);
}
}
);
}
</script>
<style>
#pleaseusethis {
border:1px solid orange;
padding:1em;
margin:1em;
display: inline-block;
</style>
<cfoutput>
<form name="newpub" method="post" onsubmit="if (!confirmpub()){return false;}" action="Publication.cfm">
<div id="pleaseusethis">
<p>
Please enter a DOI (preferred) or PMID if there is one available. DOIs are extremely valuable in
documenting collection usage.
</p>
<div style="float:right;border:2px solid green;max-width:40%;padding:1em;font-size:smaller;margin:.5em;">
Paste a DOI (the ID only - no prefix) or PubMed ID in and click the appropriate link to look up
article metadata. Note that this returns only what was reported by the publisher and that is often imperfect; you are ultimately
responsible for the Publications you create. (Try DOI=<span class="likeLink" onclick="$('##doi').val('10.1006/mpev.1994.1005');">10.1006/mpev.1994.1005</span>
vs. PMID=<span class="likeLink" onclick="$('##pmid').val('8025728');">80257285</span>
for an example of potential differences.)
<p>
Agent suggestions may be provided. Click them to accept.
</p>
<p>
Shift-reload the page to start over.
</p>
</div>
<label for="doi" onclick="getDocs('publication','doi')" class="likeLink">Digital Object Identifier (DOI)</label>
<input type="text" id="doi" name="doi" value="" size="80">
<span class="likeLink" id="doilookup" onclick="getPubMeta('DOI');"> [ crossref ] </span>
<label for="pmid" onclick="getDocs('publication','doi')" class="likeLink">PubMed ID (PMID)</label>
<input type="text" id="pmid" name="pmid" value="" size="80">
<span class="likeLink" id="pmidlookup" onclick="getPubMeta('PMID');"> [ pubmed ] </span>
<input type="hidden" name="action" value="createPub">
</div>
<table>
<tr>
<td>
<label for="full_citation" onclick="getDocs('publication','full_citation')" class="likeLink">Full Citation</label>
<textarea name="full_citation" id="full_citation" class="reqdClr" rows="3" cols="80"></textarea>
</td>
<td>
<span class="infoLink" onclick="italicize('full_citation')">italicize selected text</span>
<br><span class="infoLink" onclick="bold('full_citation')">bold selected text</span>
<br><span class="infoLink" onclick="superscript('full_citation')">superscript selected text</span>
<br><span class="infoLink" onclick="subscript('full_citation')">subscript selected text</span>
<br><span class="infoLink" onclick="toProperCase('full_citation')">Proper Case selected text</span>
</td>
</tr>
</table>
<label for="short_citation" onclick="getDocs('publication','short_citation')" class="likeLink">Short Citation</label>
<input type="text" id="short_citation" name="short_citation" class="reqdClr" value="" size="80">
<table>
<tr>
<td>
<label for="publication_type" onclick="getDocs('publication','type')" class="likeLink">Publication Type</label>
<select name="publication_type" id="publication_type" class="reqdClr">
<option value=""></option>
<cfloop query="ctpublication_type">
<option value="#publication_type#">#publication_type#</option>
</cfloop>
</select>
</td>
<td>
<label for="is_peer_reviewed_fg" onclick="getDocs('publication','peer_review')" class="likeLink">Peer Reviewed?</label>
<select name="is_peer_reviewed_fg" id="is_peer_reviewed_fg" class="reqdClr">
<option value="1">yes</option>
<option value="0">no</option>
</select>
</td>
<td>
<label for="published_year" onclick="getDocs('publication','published_year')" class="likeLink">Published Year</label>
<input type="text" name="published_year" id="published_year" value="">
</td>
</tr>
</table>
<label for="publication_loc">Storage Location</label>
<input type="text" name="publication_loc" id="publication_loc" size="80" value="">
<label for="publication_remarks">Remark</label>
<input type="text" name="publication_remarks" id="publication_remarks" size="80" value="">
<p></p>
<span class="likeLink" onclick="getDocs('publication','author')">Add Authors</span>
<table border id="authTab" class="newRec">
<tr>
<th>Role</th>
<th>Name</th>
<th></th>
</tr>
<cfset numNewAuths="5">
<cfloop from="1" to="#numNewAuths#" index="i">
<input type="hidden" name="n_agent_id#i#" id="n_agent_id#i#">
<tr id="n_authortr#i#">
<td>
<select name="n_author_role#i#" id="n_author_role#i#">
<option value="author">author</option>
<option value="editor">editor</option>
</select>
</td>
<td>
<input type="text" name="n_author_name#i#" id="n_author_name#i#" size="50"
onchange="getAgent('n_agent_id#i#',this.name,'newpub',this.value)"
onkeypress="return noenter(event);">
</td>
<td id="authSugg#i#">
</td>
</tr>
</cfloop>
</table>
<input type="hidden" name="numNewAuths" id="numNewAuths" value="#numNewAuths#">
<span class="likeLink" id="mediaToggle" onclick="toggleMedia()">[ Add Media ]</span>
<div class="cellDiv" id="media" style="display:none">
Media:
<label for="media_uri">Media URI</label>
<input type="text" name="media_uri" id="media_uri" size="90"><span class="infoLink" id="uploadMedia">Upload</span>
<label for="preview_uri">Preview URI</label>
<input type="text" name="preview_uri" id="preview_uri" size="90">
<label for="mime_type">MIME Type</label>
<select name="mime_type" id="mime_type">
<option value=""></option>
<cfloop query="ctmime_type">
<option value="#mime_type#">#mime_type#</option>
</cfloop>
</select>
<label for="media_type">Media Type</label>
<select name="media_type" id="media_type">
<option value=""></option>
<cfloop query="ctmedia_type">
<option value="#media_type#">#media_type#</option>
</cfloop>
</select>
<label for="media_desc">Media Description</label>
<input type="text" name="media_desc" id="media_desc" size="80">
</div>
<br><input type="submit" value="create publication" class="insBtn">
</form>
</cfoutput>
</cfif>
<!---------------------------------------------------------------------------------------------------------->
<cfif action is "createPub">
<cfoutput>
<cftransaction>
<cfquery name="p" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select sq_publication_id.nextval p from dual
</cfquery>
<cfset pid=p.p>
<cfif len(doi) gt 0>
<cfinvoke component="/component/functions" method="checkDOI" returnVariable="isok">
<cfinvokeargument name="doi" value="#doi#">
</cfinvoke>
<cfif isok is not "true">
<cfthrow message = "DOI #doi# failed validation with StatusCode #isok#">
</cfif>
</cfif>
<cfquery name="pub" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into publication (
publication_id,
published_year,
publication_type,
publication_loc,
full_citation,
short_citation,
publication_remarks,
is_peer_reviewed_fg,
doi,
pmid
) values (
#pid#,
<cfif len(published_year) gt 0>#published_year#<cfelse>NULL</cfif>,
'#publication_type#',
'#publication_loc#',
'#escapeQuotes(full_citation)#',
'#escapeQuotes(short_citation)#',
'#publication_remarks#',
#is_peer_reviewed_fg#,
'#doi#',
'#pmid#'
)
</cfquery>
<cfloop from="1" to="#numNewAuths#" index="n">
<cfset agent_id = evaluate("n_agent_id" & n)>
<cfset author_role = evaluate("n_author_role" & n)>
<cfif len(agent_id) gt 0>
<cfquery name="insAuth" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into publication_agent (
publication_id,
agent_id,
author_role
) values (
#pid#,
#agent_id#,
'#author_role#'
)
</cfquery>
</cfif>
</cfloop>
<cfif len(media_uri) gt 0>
<cfquery name="mid" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
select sq_media_id.nextval nv from dual
</cfquery>
<cfset media_id=mid.nv>
<cfquery name="makeMedia" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into media (media_id,media_uri,mime_type,media_type,preview_uri)
values (#media_id#,'#escapeQuotes(media_uri)#','#mime_type#','#media_type#','#preview_uri#')
</cfquery>
<cfquery name="makeRelation" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into media_relations (
media_id,
media_relationship,
related_primary_key
) values (
#media_id#,
'shows publication',
#pid#
)
</cfquery>
<cfquery name="makeRelation" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
insert into media_labels (
media_id,
media_label,
label_value)
values (#media_id#,'description','#media_desc#')
</cfquery>
</cfif>
</cftransaction>
<cflocation url="Publication.cfm?action=edit&publication_id=#pid#" addtoken="false">
</cfoutput>
</cfif>
<cfinclude template="includes/_footer.cfm">