"field_name"); $aColumnsEditable = array(0,0,1); $aColumnsVisible = array(0,1,1); $aColumnDisplayTypes = array(1,1,4); $aColumnDatabaseTypes = array(4,0,1); $oPatternTableSqlQuery = & new PatternEditableTableSqlQuery($sQuery, "document_fields_link", $aStoreColumnNames, $aDisplayColumnNames, $aColumnsEditable, $aColumnsVisible, $aColumnDisplayTypes, $aColumnDatabaseTypes); $oPatternTableSqlQuery->setTableCaption("Generic Meta Data"); $oPatternTableSqlQuery->setUniqueName("gmd"); $oPatternTableSqlQuery->setRequiredColumnNames(array("value")); $oPatternTableSqlQuery->setMetaDataFields($aMetaDataColumnNames); $oPatternTableSqlQuery->setEmptyTableMessage("No Generic Meta Data"); $oPatternTableSqlQuery->setRenderJavascriptValidation(false); return $oPatternTableSqlQuery; } /** * Displays the type specific meta data fields form */ function getTypeSpecificMetaDataForm($iFolderID, $iDocumentTypeID) { global $default; /*ok*/ $sQuery = array("SELECT DISTINCT -1 AS document_id, DF.id AS document_field_id, DF.name AS field_name, DTFL.is_mandatory AS is_mandatory, -1 AS id " . "FROM document_type_fields_link AS DTFL INNER JOIN document_fields AS DF ON DTFL.field_id = DF.id " . "LEFT OUTER JOIN document_fields_link AS DFL ON DFL.document_field_id = DTFL.field_id " . "WHERE DF.is_generic = 0 " . "AND DTFL.document_type_id = ?", $iDocumentTypeID); $aStoreColumnNames = array("document_id", "document_field_id", "value"); $aDisplayColumnNames = array("document_id", "field_name", "value"); $aColumnsEditable = array(0,0,1); $aColumnsVisible = array(0,1,1); $aColumnDisplayTypes = array(1,1,4); $aColumnDatabaseTypes = array(4,0,1); $aMetaDataColumnNames = array(2=>"field_name"); $oPatternTableSqlQuery = & new PatternEditableTableSqlQuery($sQuery, "document_fields_link", $aStoreColumnNames, $aDisplayColumnNames, $aColumnsEditable, $aColumnsVisible, $aColumnDisplayTypes, $aColumnDatabaseTypes); $oPatternTableSqlQuery->setTableCaption("Type specific meta data"); $oPatternTableSqlQuery->setEmptyTableMessage("No Type Specific Meta Data"); $oPatternTableSqlQuery->setUniqueName("tsmd"); $oPatternTableSqlQuery->setMetaDataFields($aMetaDataColumnNames); $oPatternTableSqlQuery->setRenderJavascriptValidation(false); return $oPatternTableSqlQuery; } function getMetaDataForm($iFolderID, $iDocumentTypeID) { $oGenericPattern = getGenericMetaDataForm(); $oTypeSpecificPattern = getTypeSpecificMetaDataForm($iFolderID, $iDocumentTypeID); $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= ""; $sToRender .= "
Document Meta Data
" . $oGenericPattern->render() . "" . $oTypeSpecificPattern->render() . "
"; // validation starts $sToRender .= "\n\n\n\n"; return $sToRender; } function getDocumentType($iFolderID) { global $default; $sWhereClause = "FDL.folder_id = $iFolderID"; $oPatternListBox = & new PatternListBox("$default->document_types_table", "name", "id", "fDocumentTypeID",$sWhereClause); $oPatternListBox->setIncludeDefaultValue(false); $oPatternListBox->setFromClause("INNER JOIN $default->folder_doctypes_table AS FDL ON ST.id = FDL.document_type_id"); $oPatternListBox->setEmptyErrorMessage(_("No document types defined") . "! " . _("Please contact an Administrator")); $sHeading = "Please select the document type:"; $sToRender = "
$sHeading
" . $oPatternListBox->render() . "
"; return $sToRender; } function getChooseDocumentTypePage($iFolderID) { global $default; $oFolder = Folder::get($iFolderID); if (Permission::userHasFolderWritePermission($oFolder)) { $sToRender .= getDocumentType($iFolderID); $sActionButtons .= getCancelButton($iFolderID); $sActionButtons .= ""; $sToRender .= "\n"; $sToRender .= ""; $sToRender .= "
$sActionButtons
"; } // display subfolders, if any $sToRender .= getSubfolderBrowser($iFolderID, $iDocumentTypeID); return $sToRender; } // display subfolders, if any function getSubfolderBrowser($iFolderID, $iDocumentTypeID) { $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\t\n"; $sToRender .= "\n"; $sToRender .= ""; $sToRender .= "
" . renderFolderList($iFolderID, generateControllerUrl("bulkUpload", "fDocumentTypeID=$iDocumentTypeID", false)) . "\n"; $sToRender .= "

\n"; return $sToRender; } function getPage($iFolderID, $iDocumentTypeID) { global $default; $sToRender .= renderFolderPath($iFolderID, generateControllerUrl("bulkUpload", "fDocumentTypeID=$iDocumentTypeID", false), true); $sToRender .= ""; $sToRender .= ""; $sToRender .= ""; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "
" . _("Bulk Upload Zipfile") . ":
File:
(" . _("Note: file should be a ZIP file without subdirectories. Details entered below apply to ALL documents to be added.") . ")
\n"; $sToRender .= "
" . _("Document Type") . "
" . lookupName($default->document_types_table, $iDocumentTypeID) . "
"; $sToRender .= getMetaDataForm($iFolderID, $iDocumentTypeID); // create "BACK" button (to go back to choose document type id) $sToRender .= getBackButton($iFolderID); // create "CANCEL" button (to go back to browsing) $sToRender .= getCancelButton($iFolderID); // create "SUBMIT" button (to actually do the upload) $sToRender .= ""; // display subfolders, if any $sToRender .= getSubfolderBrowser($iFolderID, $iDocumentTypeID); return $sToRender; } function getStatusPage ($iFolderID, $aFileStatus) { global $default; $sToRender = sprintf(_("Bulk Upload completed for %s documents.
"), count($aFileStatus)); if ($aFileStatus) { $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; foreach ($aFileStatus as $sDocumentName => $sUploadStatus) { $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "\n"; } $sToRender .= "
" . _("Document") . "   " . _("Status") . "
$sDocumentName : $sUploadStatus
\n"; } // create "DONE" button (to go back to browsing) $sToRender .= getDoneButton($iFolderID); return $sToRender; } function getInvalidBulkUploadErrorMsg() { return _("You did not select a valid document to upload") . ".
\n" . _("Bulk upload currently only supports .ZIP files without subdirectories") . ".
\n"; } // image link ... BACK (try bulk upload again) function getRetryUploadButton($iFolderID, $iDocumentTypeID) { global $default; $sQueryString = "fFolderID=$iFolderID"."&"."fDocumentTypeID=$iDocumentTypeID"; return generateControllerLink("bulkUpload", $sQueryString, ""); } // image link ... BACK (choose document type id again) function getBackButton($iFolderID) { global $default; return generateControllerLink("bulkUpload", "fFolderID=$iFolderID", ""); } // image link ... DONE, return to browsing function getDoneButton($iFolderID) { global $default; return generateControllerLink("browse", "fFolderID=$iFolderID", ""); } // image link ... return to browsing function getCancelButton($iFolderID) { global $default; return generateControllerLink("browse", "fFolderID=$iFolderID", ""); } ?>