Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2025-07-23 23:15:30 +02:00
commit bef7c173ce
11 changed files with 290 additions and 148 deletions

View File

@ -335,6 +335,7 @@
- action when clicking on a thumbnail can be set (download or view online) - action when clicking on a thumbnail can be set (download or view online)
- major update of polish translation - major update of polish translation
- fix getting access rights in getMandatoryApprovers() and getMandatoryReviewers() - fix getting access rights in getMandatoryApprovers() and getMandatoryReviewers()
- better checking for attribute definition when build a search query
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.40 Changes in version 5.1.40

View File

@ -0,0 +1,123 @@
<?php
/**
* Implementation of EditAttributes controller
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which does the busines logic for editing the version attributes
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2025 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_EditAttributes extends SeedDMS_Controller_Common {
public function run() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$document = $this->params['document'];
$version = $this->params['version'];
if(false === $this->callHook('preEditAttributes')) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preEditAttributes_failed';
return null;
}
$result = $this->callHook('editAttributes', $version);
if($result === null) {
$attributes = $this->params['attributes'];
$oldattributes = $version->getAttributes();
if($attributes) {
foreach($attributes as $attrdefid=>$attribute) {
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
if($attribute) {
switch($attrdef->getType()) {
case SeedDMS_Core_AttributeDefinition::type_date:
if(is_array($attribute))
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute);
else
$attribute = date('Y-m-d', makeTsFromDate($attribute));
break;
case SeedDMS_Core_AttributeDefinition::type_folder:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
else
$attribute = $dms->getFolder((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_document:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
else
$attribute = $dms->getDocument((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_user:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
else
$attribute = $dms->getUser((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_group:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
else
$attribute = $dms->getGroup((int) $attribute);
break;
}
if(!$attrdef->validate($attribute, $version, false)) {
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
return false;
}
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
if(!$version->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) {
//UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
return false;
}
}
} elseif($attrdef->getMinValues() > 0) {
$this->errormsg = array("attr_min_values", array("attrname"=>$attrdef->getName()));
return false;
} elseif(isset($oldattributes[$attrdefid])) {
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
// UI::exitError(getMLText("document_title", array("documentname" => $folder->getName())),getMLText("error_occured"));
return false;
}
} else {
if($ret === false)
return false;
}
}
}
}
foreach($oldattributes as $attrdefid=>$oldattribute) {
if(!isset($attributes[$attrdefid])) {
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
return false;
}
}
} elseif($result === false) {
if(empty($this->errormsg))
$this->errormsg = 'hook_editAttributes_failed';
return false;
}
if(false === $this->callHook('postEditAttributes')) {
}
return true;
}
}

View File

@ -10,25 +10,27 @@ regular ldap server, e.g. openldap
The location of the ldap server is specified in two parameters: `host` and The location of the ldap server is specified in two parameters: `host` and
`port`. `host` can be either a plain hostname or an ldap URI, including the `port`. `host` can be either a plain hostname or an ldap URI, including the
protocol, the host and optionally the port, e.g. ldap://localhost:389. In case protocol, the host and optionally the port, e.g. `ldap://localhost:389`. In case
of an URI the port in the configuration must remain empty. of an URI the port in the configuration must remain empty.
The authentication itself is a two step process which differs, depending on how The authentication itself is a two step process which differs, depending on how
to bind to the server. If the configuration sets 'bindDN' and 'bindPW', those to bind to the server. If the configuration sets `bindDN` and `bindPW`, those
values will be used for a initial non anonymous bind to the ldap server values will be used for a initial non anonymous bind to the ldap server
otherwise an anonymous bind is executed. otherwise an anonymous bind is executed.
After the initial bind, a ldap search for either 'uid=<username>' (ldap) or After the initial bind, a ldap search for either `uid=<username>` (ldap) or
'sAMAccountName=<username>' (AD) below basedn is done. The purpose of this `sAMAccountName=<username>` (AD) below basedn is done. The purpose of this
search is to retrieve a working bindDN which is then used to actually search is to retrieve a working bindDN which is then used to actually
authenticate the user. In case of an anonymous first bind the search will authenticate the user. In case of a successful anonymous first bind but a
likely fail and the bindDN for the second bind will be either failed search (this seems to be the case when connecting to an AD), a second
'uid=<username>,<basedn>' (ldap) or '<username>@<accountDomainName>' (AD). If non anonymous bind is tried. The bindDN for that second bind will be either
the search succeeds the bindDN will be taken from the user's data in the ldap `uid=<username>,<basedn>` (ldap) or `<username>@<accountDomainName>` (AD).
If the search after the first anonymous bind succeeds, the bindDN will be
taken from the user's data in the ldap
server. This bindDN will be used for a second bind using the users password. server. This bindDN will be used for a second bind using the users password.
If the second bind succeeds the user could be successfully authenticated. If the second bind succeeds the user is successfully authenticated.
The data from the ldap server can be used to create an account in SeedDMS The data from the ldap server can be used to create or update an account in SeedDMS
if the user trying to login does not exist yet, but was able to authenticate. if the user trying to login does not exist yet, but was able to authenticate.
This will only be done if 'authentication->restricted' in the configuration This will only be done if 'authentication->restricted' in the configuration
is set to false. In that case the common name (cn) and email address is taken is set to false. In that case the common name (cn) and email address is taken
@ -41,12 +43,37 @@ can be set with the attribute `mailField`. If it is not set it defaults to `mail
Since version 5.1.34 and 6.0.27 the groups of a user stored in the ldap directory Since version 5.1.34 and 6.0.27 the groups of a user stored in the ldap directory
can be synchronised with the groups in SeedDMS. The ldap field storing can be synchronised with the groups in SeedDMS. The ldap field storing
the groups can be configured with the attribute `mailField`. This will add the groups can be configured with the attribute `mailField`. This will add
new groups in SeedDMS and aѕsign them to the user. new groups in SeedDMS and assign them to the user.
Using email address for authentication
---------------------------------------
Since version 5.1.34 and 6.0.27 the email can be used for authentication
(requires `enableLoginByEmail` to be set in the configuration).
This only works if the search after the first bind succeeds, which is usually
only the case if it is a none anonymous bind.
Notes on connecting to an AD
-----------------------------
The ldap authentication was originally implemented for classic LDAP servers
like openldap. Before doing the actual authentication the user was searched
by combining the user's login name and the configured baseDN. This search was
preceded an anonymous or non anonymous bind (depending on wether bindDN and
bindPWD are set). The only purpose of that search was to retrieve the
distinguished name of the user, which was used in a second non anonymous bind
for authenticating the user. If that search fails or didn't return a record
(which seems to be always the case for an anonymous bind to an AD)
a second non anonymous bind with the user's credentials is tried. That bind
uses a dn which is quite different for classic ldap and AD (see examples
below). The dn for an AD is of the form '<username>@<domain>'. '<domain>' is
the string configured in the parameter `accountDomainName`.
Examples Examples
--------- ---------
Anonymous bind to openldap on localhost, port 389 ### Anonymous bind to openldap on localhost, port 389
- type = "ldap" - type = "ldap"
- baseDN = "ou=users,dc=mycompany,dc=de" - baseDN = "ou=users,dc=mycompany,dc=de"
- host = "ldap://localhost" - host = "ldap://localhost"
@ -55,12 +82,37 @@ During authentication as user 'admin' the following steps are executed
1. connect to ldap server at localhost:389 1. connect to ldap server at localhost:389
2. do an anonymous bind 2. do an anonymous bind
3. search for 'uid=admin' below basedn 3.1 if the bind succeeds, search for `uid=admin` below basedn
3.2 if the bind fails use `uid=admin,<basedn>` as dn and continue with step 5
4.1. if search succeeds use the dn from the user 4.1. if search succeeds use the dn from the user
4.2. if search fails use 'uid=admin,<basedn>' as dn 4.2. if search fails use `uid=admin,<basedn>` as dn
5. do a non anonymous bind with dn and password entered by user 5. do a non anonymous bind with dn and password entered by user
6. if step 5. succeeds the use is authenticated 6. if step 5. succeeds the user is authenticated
7. if `restricted` in the settings is *not* set another ldap search for the
user is executed to retrieve the full name, and the email and if
8.1 the user doesn't exist in SeedDMS, the user will be created or
8.2 the user exists in SeedDMS, the use will be updated
If bindDN and bindPW are specified in the configuration, the second step If bindDN and bindPW are specified in the configuration, the second step
will be a non anonymous bind. will be a non anonymous bind.
### Connecting to an AD
- type = "AD"
- baseDN = "ou=users,dc=mycompany,dc=de"
- accountDomainName=mycompany
- host = "ldap://localhost"
During authentication as user 'admin' the following steps are executed
1. connect to AD server at localhost:389
2. do an anonymous bind (which usually succeeds)
3. search for `uid=admin` below basedn (which usually returns an empty record)
4. if search returns no data use `admin@<accountDomainName>` as dn
5. do a non anonymous bind with dn and password entered by user
6. if step 5. succeeds the user is authenticated
7. if `restricted` in the settings is *not* set another ldap search for the
user is executed to retrieve the full name, and the email and if
8.1 the user doesn't exist in SeedDMS, the user will be created or
8.2 the user exists in SeedDMS, the use will be updated

View File

@ -233,7 +233,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
} }
/* Check if user already exists in the database. Return with an error /* Check if user already exists in the database. Return with an error
* only if the sql statements fails, but not if no user was found. * only if the sql statements fails, but not if the user wasn't found.
* The username may not be the one passed to this function anymore. It * The username may not be the one passed to this function anymore. It
* could have been overwritten by uid (or sAMAccountName) derived from * could have been overwritten by uid (or sAMAccountName) derived from
* the above ldap search. * the above ldap search.

View File

@ -685,6 +685,64 @@ class SeedDMS_NotificationService {
} }
} /* }}} */ } /* }}} */
public function sendChangedVersionAttributesMail($version, $user, $oldattributes) { /* {{{ */
$document = $version->getDocument();
$dms = $document->getDMS();
$folder = $document->getFolder();
$notifyList = $document->getNotifyList();
$newattributes = $version->getAttributes();
if($oldattributes) {
foreach($oldattributes as $attrdefid=>$attribute) {
if(!isset($newattributes[$attrdefid]) || $newattributes[$attrdefid]->getValueAsArray() !== $oldattributes[$attrdefid]->getValueAsArray()) {
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['attribute_name'] = $attribute->getAttributeDefinition()->getName();
$params['attribute_old_value'] = $oldattributes[$attrdefid]->getValue();
$params['attribute_new_value'] = isset($newattributes[$attrdefid]) ? $newattributes[$attrdefid]->getValue() : '';
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
/* Check for new attributes which didn't have a value before */
if($newattributes) {
foreach($newattributes as $attrdefid=>$attribute) {
if(!isset($oldattributes[$attrdefid]) && $attribute) {
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['attribute_name'] = $dms->getAttributeDefinition($attrdefid)->getName();
$params['attribute_old_value'] = '';
$params['attribute_new_value'] = $attribute->getValue();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
} /* }}} */
public function sendChangedFolderAttributesMail($folder, $user, $oldattributes) { /* {{{ */ public function sendChangedFolderAttributesMail($folder, $user, $oldattributes) { /* {{{ */
$dms = $folder->getDMS(); $dms = $folder->getDMS();
$notifyList = $folder->getNotifyList(); $notifyList = $folder->getNotifyList();

View File

@ -1880,16 +1880,17 @@ class SeedDMS_Search { /* {{{ */
$attributes = array(); $attributes = array();
foreach($attributes as $attrdefid=>$attribute) { foreach($attributes as $attrdefid=>$attribute) {
$attrdef = $this->dms->getAttributeDefinition($attrdefid);
if($attribute) { if($attribute) {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { if($attrdef = $this->dms->getAttributeDefinition($attrdefid)) {
if(is_array($attribute)) { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
if(!empty($attributes[$attrdefid]['from'])) if(is_array($attribute)) {
$attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from'])); if(!empty($attributes[$attrdefid]['from']))
if(!empty($attributes[$attrdefid]['to'])) $attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from']));
$attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to'])); if(!empty($attributes[$attrdefid]['to']))
} else { $attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to']));
$attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute)); } else {
$attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute));
}
} }
} }
} }

View File

@ -27,8 +27,12 @@ include("../inc/inc.Init.php");
include("../inc/inc.Extension.php"); include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php"); include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.ClassController.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
/* Check if the form data comes from a trusted request */ /* Check if the form data comes from a trusted request */
if(!checkFormKey('editattributes')) { if(!checkFormKey('editattributes')) {
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_request_token"))),getMLText("invalid_request_token")); UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_request_token"))),getMLText("invalid_request_token"));
@ -51,7 +55,6 @@ if (!is_object($document)) {
} }
$folder = $document->getFolder(); $folder = $document->getFolder();
$docPathHTML = getFolderPathHTML($folder, true). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".$document->getName()."</a>";
if ($document->getAccessMode($user, 'editDocumentContentAttributes') < M_READWRITE) { if ($document->getAccessMode($user, 'editDocumentContentAttributes') < M_READWRITE) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
@ -73,120 +76,25 @@ foreach($version->getAttributes() as $ai=>$aa)
$oldattributes[$ai] = clone $aa; $oldattributes[$ai] = clone $aa;
$attributes = $_POST["attributes"]; $attributes = $_POST["attributes"];
if($attributes) { $controller->setParam('document', $document);
foreach($attributes as $attrdefid=>$attribute) { $controller->setParam('version', $version);
if($attrdef = $dms->getAttributeDefinition($attrdefid)) { $controller->setParam('attributes', $attributes);
if($attribute) { if(!$controller()) {
switch($attrdef->getType()) { $err = $controller->getErrorMsg();
case SeedDMS_Core_AttributeDefinition::type_date: if(is_string($err))
if(is_array($attribute)) $errmsg = getMLText($err);
$attribute = array_map(fn($value): string => date('Y-m-d', makeTsFromDate($value)), $attribute); elseif(is_array($err)) {
else $errmsg = getMLText($err[0], $err[1]);
$attribute = date('Y-m-d', makeTsFromDate($attribute)); } else {
break; $errmsg = $err;
case SeedDMS_Core_AttributeDefinition::type_folder:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getFolder((int) $value), $attribute);
else
$attribute = $dms->getFolder((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_document:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getDocument((int) $value), $attribute);
else
$attribute = $dms->getDocument((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_user:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getUser((int) $value), $attribute);
else
$attribute = $dms->getUser((int) $attribute);
break;
case SeedDMS_Core_AttributeDefinition::type_group:
if(is_array($attribute))
$attribute = array_map(fn($value): object => $dms->getGroup((int) $value), $attribute);
else
$attribute = $dms->getGroup((int) $attribute);
break;
}
if(!$attrdef->validate($attribute, $version, false)) {
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
}
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
if(!$version->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}
}
} elseif($attrdef->getMinValues() > 0) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
} elseif(isset($oldattributes[$attrdefid])) {
if(!$version->removeAttribute($dms->getAttributeDefinition($attrdefid)))
UI::exitError(getMLText("document_title", array("documentname" => $folder->getName())),getMLText("error_occured"));
}
}
} }
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
} }
$newattributes = $version->getAttributes(); if($notifier) {
if($oldattributes) { $notifier->sendChangedVersionAttributesMail($version, $user, $oldattributes);
foreach($oldattributes as $attrdefid=>$attribute) {
if(!isset($newattributes[$attrdefid]) || $newattributes[$attrdefid]->getValueAsArray() !== $oldattributes[$attrdefid]->getValueAsArray()) {
if($notifier) {
$notifyList = $document->getNotifyList();
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['attribute_name'] = $attribute->getAttributeDefinition()->getName();
$params['attribute_old_value'] = $oldattributes[$attrdefid]->getValue();
$params['attribute_new_value'] = isset($newattributes[$attrdefid]) ? $newattributes[$attrdefid]->getValue() : '';
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
}
/* Check for new attributes which didn't have a value before */
if($newattributes) {
foreach($newattributes as $attrdefid=>$attribute) {
if(!isset($oldattributes[$attrdefid]) && $attribute) {
if($notifier) {
$notifyList = $document->getNotifyList();
$subject = "attribute_changed_email_subject";
$message = "attribute_changed_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = '';
$params['attribute_name'] = $dms->getAttributeDefinition($attrdefid)->getName();
$params['attribute_old_value'] = '';
$params['attribute_new_value'] = $attribute->getValue();
$params['folder_path'] = $folder->getFolderPathPlain();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
foreach ($notifyList["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
}
}
}
} }
add_log_line("?documentid=".$documentid); add_log_line("?documentid=".$documentid);
header("Location:../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$versionid); header("Location:../out/out.DocumentVersionDetail.php?documentid=".$documentid."&version=".$versionid);
?>

View File

@ -53,7 +53,6 @@ if (!is_object($document)) {
} }
$folder = $document->getFolder(); $folder = $document->getFolder();
$docPathHTML = getFolderPathHTML($folder, true). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".$document->getName()."</a>";
if ($document->getAccessMode($user, 'editDocument') < M_READWRITE) { if ($document->getAccessMode($user, 'editDocument') < M_READWRITE) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
@ -129,7 +128,6 @@ $oldexpires = $document->getExpires();
$oldattributes = array(); $oldattributes = array();
foreach($document->getAttributes() as $ai=>$aa) foreach($document->getAttributes() as $ai=>$aa)
$oldattributes[$ai] = clone $aa; $oldattributes[$ai] = clone $aa;
//$oldattributes = $document->getAttributes();
$controller->setParam('fulltextservice', $fulltextservice); $controller->setParam('fulltextservice', $fulltextservice);
$controller->setParam('document', $document); $controller->setParam('document', $document);

View File

@ -566,16 +566,17 @@ if($fullsearch) {
$attributes = array(); $attributes = array();
foreach($attributes as $attrdefid=>$attribute) { foreach($attributes as $attrdefid=>$attribute) {
$attrdef = $dms->getAttributeDefinition($attrdefid);
if($attribute) { if($attribute) {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) { if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
if(is_array($attribute)) { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
if(!empty($attributes[$attrdefid]['from'])) if(is_array($attribute)) {
$attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from'])); if(!empty($attributes[$attrdefid]['from']))
if(!empty($attributes[$attrdefid]['to'])) $attributes[$attrdefid]['from'] = date('Y-m-d', makeTsFromDate($attribute['from']));
$attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to'])); if(!empty($attributes[$attrdefid]['to']))
} else { $attributes[$attrdefid]['to'] = date('Y-m-d', makeTsFromDate($attribute['to']));
$attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute)); } else {
$attributes[$attrdefid] = date('Y-m-d', makeTsFromDate($attribute));
}
} }
} }
} }

View File

@ -182,7 +182,7 @@ $(document).ready( function() {
foreach($res['contents'] as $content) { foreach($res['contents'] as $content) {
$document = $content->getDocument(); $document = $content->getDocument();
$extracontent = array(); $extracontent = array();
$extracontent['below_title'] = $this->getListRowPath($doc); $extracontent['below_title'] = $this->getListRowPath($document);
$txt = $this->callHook('documentListItem', $document, $previewer, false, 'attributemgr', $extracontent); $txt = $this->callHook('documentListItem', $document, $previewer, false, 'attributemgr', $extracontent);
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;

View File

@ -251,7 +251,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
echo "</td>"; echo "</td>";
echo "<td>".$extconf['title']; echo "<td>".$extconf['title'];
echo "<br /><small>".$extconf['description']."</small>"; echo "<br /><small>".$extconf['description']."</small>";
echo "<br /><small>".getMLText('author').": <a href=\"mailto:".htmlspecialchars($extconf['author']['email'])."\">".$extconf['author']['name']."</a>, ".$extconf['author']['company']."</small>"; echo "<br /><small>".getMLText('author').": <a href=\"mailto:".htmlspecialchars($extconf['author']['email'])."\">".$extconf['author']['name']."</a>, ".(!empty($extconf['author']['company']) ? $extconf['author']['company'] : '')."</small>";
if($errmsgs) if($errmsgs)
echo "<div><img src=\"".$this->getImgPath("attention.gif")."\"> ".implode('<br /><img src="'.$this->getImgPath("attention.gif").'"> ', $errmsgs)."</div>"; echo "<div><img src=\"".$this->getImgPath("attention.gif")."\"> ".implode('<br /><img src="'.$this->getImgPath("attention.gif").'"> ', $errmsgs)."</div>";
echo "</td>"; echo "</td>";