add.smarty
3.15 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
<!-- unforunate, but (currently) necessary -->
{$context->oPage->requireJSResource('resources/js/taillog.js')}
{$context->oPage->requireJSResource('resources/js/conditional_usage.js')}
{$context->oPage->requireCSSResource('resources/css/kt-treewidget.css')}
{capture assign=sJavascript}
{literal}
function swapInItem(elementId, req) {
var cp = getElement(elementId);
cp.innerHTML = req.responseText;
initialiseConditionalFieldsets();
}
function xmlFailure(err) {
; // bad me - fail silently.
}
function handleErrorsInResponse(req) {
; // bad me - fail silently.
}
function swapElementFromRequest(elementId, url) {
var deff = doSimpleXMLHttpRequest(url);
var cp = getElement(elementId);
cp.innerHTML="loading...";
deff.addCallback(partial(swapInItem, elementId));
deff.addErrback(handleErrorsInResponse);
}
function getMetadataForType(id) {
swapElementFromRequest('type_metadata_fields', '{/literal}{$rootUrl}{literal}/presentation/lookAndFeel/knowledgeTree/documentmanagement/getTypeMetadataFields.php?fDocumentTypeID=' + id);
}
function document_type_changed() {
typeselect = getElement('add-document-type');
getMetadataForType(typeselect.value);
}
function startupMetadata() {
typeselect = getElement('add-document-type');
addToCallStack(typeselect, "onchange", document_type_changed, false);
document_type_changed();
}
function progressIndicator(){
var indicator = document.getElementById();
indicator.style.display = "block";
}
addLoadEvent(startupMetadata);
{/literal}
{/capture}
{$context->oPage->requireJSStandalone($sJavascript)}
<h2>{i18n}Add a document{/i18n}</h2>
<form method="POST" action="{$smarty.server.PHP_SELF|addQueryString:"postExpected=1&fFolderId="}{$context->oFolder->getId()}" enctype="multipart/form-data">
<fieldset><legend>{i18n}Add a document{/i18n}</legend>
<input type="hidden" name="action" value="upload">
<input type="hidden" name="fFolderId" value="{$context->oFolder->getId()}">
{foreach from=$add_fields item=oWidget }
{$oWidget->render()}
{/foreach}
<p class="descriptiveText">{i18n}If you do not need to modify any the metadata
for this document (see below), then you can simply click "Add" here to finish the
process and add the document.{/i18n}</p>
<input type="submit" name="submit" value="{i18n}Add{/i18n}" />
<hr />
<h3>{i18n}Additional Information about this Document{/i18n}</h3>
<p class="descriptiveText">{i18n}Document Metadata allows you to provide additional,
important information about this document that can be used to classify and report
on its contents. The exact information required depends on the <strong>Document Type</strong>
you selected above. Some of this information may be <strong>required</strong>, so please
review the list of requested information carefully before finishing the process.{/i18n}</p>
<div id="generic_metadata_fields">
{foreach item=oFieldset from=$generic_fieldsets}
{$oFieldset->renderEdit($document_data)}
{/foreach}
</div>
<div id="type_metadata_fields">
{$type_metadata_fields}
</div>
<div class="form_actions">
<input type="submit" name="submit" value="{i18n}Add{/i18n}" />
</div>
<input type="hidden" name="postReceived" value="1" />
</form>