diff --git a/ktwebservice/KTDownloadManager.inc.php b/ktwebservice/KTDownloadManager.inc.php
index 81870aa..c1f319e 100644
--- a/ktwebservice/KTDownloadManager.inc.php
+++ b/ktwebservice/KTDownloadManager.inc.php
@@ -197,6 +197,66 @@ class KTDownloadManager
return true;
}
+
+ function multipart_download($document_id, $hash, $version = null, $apptype = 'ws', $chunkSize = NULL, $part = 0) {
+ $oConfig =& KTConfig::getSingleton();
+
+ $sql = "SELECT 1 FROM download_files WHERE hash=? AND session=? AND document_id=?";
+ $rows = DBUtil::getResultArray ( array ($sql, array ($hash, $this->session, $document_id ) ) );
+ if (PEAR::isError ( $rows )) {
+ return $rows;
+ }
+
+ if (count ( $rows ) == 0) {
+ return new PEAR_Error ( 'Invalid session.' );
+ }
+
+ // If document is being downloaded by an external user bypass the session checking
+ $check = strstr ( $this->session, 'ktext_' . $document_id );
+ if ($check == 0 && $check !== false) {
+ // Use external download function
+ return $this->download_ext ( $document_id, $hash, $version = null );
+ }
+
+ $storage = & KTStorageManagerUtil::getSingleton ();
+
+ $ktapi = &new KTAPI ( );
+ $res = $ktapi->get_active_session ( $this->session, null, $apptype );
+ if (PEAR::isError ( $res )) {
+ return $res;
+ }
+
+ $document = $ktapi->get_document_by_id ( $document_id );
+ if (PEAR::isError ( $document )) {
+ return $document;
+ }
+
+ if (! empty ( $version )) {
+ $version = KTDocumentContentVersion::get ( $version );
+ $res = $storage->downloadVersion ( $document->document, $version );
+ } else {
+ $res = $storage->download ( $document->document );
+ }
+ if (PEAR::isError ( $res )) {
+ return $res;
+ }
+
+ // Set Default Chunk Size (in KB)
+ $chunkSize=(int)$chunkSize;
+ if($chunkSize<1024)$chunkSize=1024;
+
+ //Make sure part is set
+ $part=(int)$part;
+
+ $fileSize=$document->getFileSize();
+ $fileName=$document->getFileName();
+ $path=$oConfig->get('urls/documentRoot').'/'.$document->getStoragePath();
+
+// $sql = "DELETE FROM download_files WHERE hash='$hash' AND session='$this->session' AND document_id=$document_id";
+// $result = DBUtil::runQuery ( $sql );
+
+ return true;
+ }
function download_ext($document_id, $hash, $version = null)
{
diff --git a/plugins/ktcore/KTValidators.php b/plugins/ktcore/KTValidators.php
index 6306f7d..de800e3 100644
--- a/plugins/ktcore/KTValidators.php
+++ b/plugins/ktcore/KTValidators.php
@@ -589,8 +589,17 @@ class KTDateValidator extends KTValidator {
$results = array();
$errors = array();
- // very simple if we're required and not present, fail
+ // very simple if we're required and not present, fail
// otherwise, its ok.
+ $pMetaKey = array_keys($data);
+ $fieldId = str_replace('metadata_', '', $pMetaKey);
+ $oField = new DocumentField();
+ $oField->load($fieldId);
+
+ if (!$oField->getIsMandatory()) {
+ return;
+ }
+
$val = KTUtil::arrayGet($data, $this->sInputVariable);
if ($this->bTrim) {
diff --git a/plugins/multiselect/BulkImport.php b/plugins/multiselect/BulkImport.php
index 7abeedc..7aa40bd 100644
--- a/plugins/multiselect/BulkImport.php
+++ b/plugins/multiselect/BulkImport.php
@@ -106,6 +106,22 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction {
function getBulkImportForm() {
$this->oPage->setBreadcrumbDetails(_kt("bulk import"));
+ //Adding the required Bulk Upload javascript includes
+ $aJavascript[] = 'resources/js/taillog.js';
+ $aJavascript[] = 'resources/js/conditional_usage.js';
+ $aJavascript[] = 'resources/js/kt_bulkupload.js';
+
+ //Loading the widget js libraries to support dynamic "Ajax Loaded" widget rendering
+ //FIXME: The widgets can support this via dynamic call to place libs in the head if they aren't loaded
+ // jQuery can do this but need time to implement/test.
+
+ $aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
+ $aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js';
+ $aJavascript[] = 'resources/js/kt_tinymce_init.js';
+ $aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/jquery.tinymce.js';
+
+ $this->oPage->requireJSResources($aJavascript);
+
$oForm = new KTForm;
$oForm->setOptions(array(
'identifier' => 'ktcore.folder.bulkUpload',
@@ -139,22 +155,21 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction {
'description' => _kt('The path containing the documents to be added to the document management system.'),
));
- $aTypes = array();
- foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
- if(!$oDocumentType->getDisabled()) {
- $aTypes[] = $oDocumentType;
- }
- }
-
+ $aVocab = array('' => _kt('- Please select a document type -'));
+ foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
+ if(!$oDocumentType->getDisabled()) {
+ $aVocab[$oDocumentType->getId()] = $oDocumentType->getName();
+ }
+ }
+
//Adding document type lookup widget
- $widgets[] = $oWF->get('ktcore.widgets.entityselection',array(
+ $widgets[] = $oWF->get('ktcore.widgets.selection',array(
'label' => _kt('Document Type'),
'id' => 'add-document-type',
'description' => _kt('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'),
'name' => 'fDocumentTypeId',
'required' => true,
- 'vocab' => $aTypes,
- 'initial_string' => _kt('- Please select a document type -'),
+ 'vocab' => $aVocab,
'id_method' => 'getId',
'label_method' => 'getName',
'simple_select' => false,
@@ -172,16 +187,22 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction {
));
$oFReg =& KTFieldsetRegistry::getSingleton();
-
+
$activesets = KTFieldset::getGenericFieldsets();
foreach ($activesets as $oFieldset) {
$widgets = kt_array_merge($widgets, $oFReg->widgetsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
$validators = kt_array_merge($validators, $oFReg->validatorsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
}
-
+
+ //Adding the type_metadata_fields layer to be updated via ajax for non generic metadata fieldsets
+ $widgets[] = $oWF->get('ktcore.widgets.layer',array(
+ 'value' => '',
+ 'id' => 'type_metadata_fields',
+ ));
+
$oForm->setWidgets($widgets);
$oForm->setValidators($validators);
-
+
// Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
global $default;
$iFolderId = $this->oFolder->getId();
diff --git a/setup/migrate/migrateWizard.php b/setup/migrate/migrateWizard.php
index 0b099e7..0bb58d0 100644
--- a/setup/migrate/migrateWizard.php
+++ b/setup/migrate/migrateWizard.php
@@ -261,7 +261,7 @@ class MigrateWizard {
}
} else {
// TODO: Die gracefully
- $this->util->error("System has been migrated Goto Login");
+ $this->util->error("System has been migrated Goto Login");
}
}
}
diff --git a/setup/upgrade/templates/complete.tpl b/setup/upgrade/templates/complete.tpl
index 52eb513..6d7f1fa 100644
--- a/setup/upgrade/templates/complete.tpl
+++ b/setup/upgrade/templates/complete.tpl
@@ -9,5 +9,5 @@
Your database has been upgraded to systemVersion; ?>
- Goto Login
+ Goto Login
\ No newline at end of file
diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php
index 72adbf1..a090336 100644
--- a/setup/wizard/installWizard.php
+++ b/setup/wizard/installWizard.php
@@ -296,7 +296,7 @@ class InstallWizard {
}
} else {
// TODO: Die gracefully
- $this->util->error("System has been installed Goto Login");
+ $this->util->error("System has been installed Goto Login");
}
}
}
diff --git a/setup/wizard/resources/css/wizard.css b/setup/wizard/resources/css/wizard.css
index 3abad14..c32b210 100644
--- a/setup/wizard/resources/css/wizard.css
+++ b/setup/wizard/resources/css/wizard.css
@@ -361,7 +361,7 @@ select {
.onclick {
cursor: pointer;
color: #EC7725;
- width: 130px;
+ width: 150px;
}
.description {
diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl
index dfe48f8..611bf4b 100644
--- a/setup/wizard/templates/complete.tpl
+++ b/setup/wizard/templates/complete.tpl
@@ -136,7 +136,7 @@
Goto Database Upgrade
- Goto Login
+ Goto Login
getMessage();
- $this->addDebug("download_document - cannot get $document_id - " . $document->getMessage(), $session_id);
+ //$this->addDebug("download_document - cannot get $document_id - " . $document->getMessage(), $session_id);
// $this->setResponse(new SOAP_Value('$this->response=',"{urn:$this->namespace}kt_response", $response));
$this->setResponse($response);
@@ -900,7 +900,7 @@ class kt extends client_service {
$document=$kt->get_document_by_id($document_id);
if(isset($special['__title'])) {
- $this->debug("Renaming to {$special['__title']}");
+ $this->addDebug("Renaming to {$special['__title']}");
$res=$document->rename($special['__title']);
}
}
diff --git a/webservice/clienttools/services/mdownload.php b/webservice/clienttools/services/mdownload.php
new file mode 100644
index 0000000..2202817
--- /dev/null
+++ b/webservice/clienttools/services/mdownload.php
@@ -0,0 +1,84 @@
+.
+ *
+ * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+ * California 94120-7775, or email info@knowledgetree.com.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "Powered by
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
+ * Contributor( s): ______________________________________
+ *
+ */
+
+if (!array_key_exists('code',$_GET))
+{
+ $msg = urlencode('Code not specified.');
+ print "status_code=1&msg=$msg";
+ exit;
+}
+
+$hash = $_GET['code'];
+
+if (!array_key_exists('d',$_GET))
+{
+ $msg = urlencode('Document not specified.');
+ print "status_code=2&msg=$msg";
+ exit;
+}
+
+$document_id = $_GET['d'];
+
+if (!array_key_exists('u',$_GET))
+{
+ $msg = urlencode('Session not specified.');
+ print "status_code=3&msg=$msg";
+ exit;
+}
+
+$session = $_GET['u'];
+$apptype = (isset($_GET['apptype'])) ? $_GET['apptype'] : 'ws';
+
+require_once('../../../config/dmsDefaults.php');
+require_once('../../../ktapi/ktapi.inc.php');
+require_once('../../../ktwebservice/KTDownloadManager.inc.php');
+
+$download_manager = new KTDownloadManager();
+$download_manager->set_session($session);
+
+$response = $download_manager->multipart_download($document_id, $hash, null, $apptype,1024,$_GET['part']);
+if (PEAR::isError($response))
+{
+ $msg = urlencode($response->getMessage());
+ print "status_code=4&msg=$msg:".$_GET["u"].":".$_GET["d"].":".$_GET["code"].":".$_GET["apptype"].":";
+ exit;
+}
+
+?>
\ No newline at end of file