bulkImport.smarty 2.98 KB
{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Base.js')}
{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Async.js')}
{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/Iter.js')}
{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DateTime.js')}
{$context->oPage->requireJSResource('thirdpartyjs/MochiKit/DOM.js')}

{$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) {
    alert('failed');
}

function swapElementFromRequest(elementId, url) {
    var deff = doSimpleXMLHttpRequest(url);
    var cp = getElement(elementId);
    cp.innerHTML=_("loading...");
    deff.addCallback(partial(swapInItem, elementId));
    
    
}

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();
}

addLoadEvent(startupMetadata);
{/literal}
{/capture}
{$context->oPage->requireJSStandalone($sJavascript)}

<h2>{i18n arg_foldername=$foldername}Import files into "#foldername#"{/i18n}</h2>

<form method="POST" action="{$smarty.server.PHP_SELF}" enctype="multipart/form-data">
<fieldset><legend>{i18n}Import from Server Location{/i18n}</legend>
<p class="descriptiveText">{i18n}The bulk import facility allows for a number
of documents to be added to the document management system easily.
Provide a path on the <strong>server</strong>, and all documents and
folders within that path will be added to the document management
system.{/i18n}</p>

<input type="hidden" name="action" value="import">
<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 />


<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}Import{/i18n}">
</div>
</form>