mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +00:00
Merge branch 'seeddms-4.3.4' into develop
Conflicts: op/op.Login.php
This commit is contained in:
commit
a14c6b85e4
|
@ -1,3 +1,9 @@
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
Changes in version 4.3.4
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
- clean up and test ldap authentication code
|
||||||
|
- fix handling of multivalue attributes
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 4.3.3
|
Changes in version 4.3.3
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
|
@ -105,16 +105,23 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
/**
|
/**
|
||||||
* Returns an attribute of the object for the given attribute definition
|
* Returns an attribute of the object for the given attribute definition
|
||||||
*
|
*
|
||||||
* @return object object of class SeedDMS_Core_Attribute or false
|
* @return array|string value of attritbute or false. The value is an array
|
||||||
|
* if the attribute is defined as multi value
|
||||||
*/
|
*/
|
||||||
function getAttributeValue($attrdef) { /* {{{ */
|
function getAttributeValue($attrdef) { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->_attributes[$attrdef->getId()]))
|
if (isset($this->_attributes[$attrdef->getId()])) {
|
||||||
return $this->_attributes[$attrdef->getId()]->getValue();
|
$value = $this->_attributes[$attrdef->getId()]->getValue();
|
||||||
else
|
if($attrdef->getMultipleValues()) {
|
||||||
|
$sep = substr($value, 0, 1);
|
||||||
|
return(explode($sep, substr($value, 1)));
|
||||||
|
} else {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
@ -122,6 +129,9 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
/**
|
/**
|
||||||
* Set an attribute of the object for the given attribute definition
|
* Set an attribute of the object for the given attribute definition
|
||||||
*
|
*
|
||||||
|
* @param object $attrdef definition of attribute
|
||||||
|
* @param array|sting $value value of attribute, for multiple values this
|
||||||
|
* must be an array
|
||||||
* @return boolean true if operation was successful, otherwise false
|
* @return boolean true if operation was successful, otherwise false
|
||||||
*/
|
*/
|
||||||
function setAttributeValue($attrdef, $value) { /* {{{ */
|
function setAttributeValue($attrdef, $value) { /* {{{ */
|
||||||
|
@ -129,6 +139,10 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
}
|
}
|
||||||
|
if($attrdef->getMultipleValues() && is_array($value)) {
|
||||||
|
$sep = substr($attrdef->getValueSet(), 0, 1);
|
||||||
|
$value = $sep.implode($sep, $value);
|
||||||
|
}
|
||||||
if(!isset($this->_attributes[$attrdef->getId()])) {
|
if(!isset($this->_attributes[$attrdef->getId()])) {
|
||||||
switch(get_class($this)) {
|
switch(get_class($this)) {
|
||||||
case "SeedDMS_Core_Document":
|
case "SeedDMS_Core_Document":
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
<date>2014-02-01</date>
|
<date>2014-02-01</date>
|
||||||
<time>16:19:34</time>
|
<time>16:19:34</time>
|
||||||
<version>
|
<version>
|
||||||
<release>4.3.3</release>
|
<release>4.3.4</release>
|
||||||
<api>4.3.3</api>
|
<api>4.3.4</api>
|
||||||
</version>
|
</version>
|
||||||
<stability>
|
<stability>
|
||||||
<release>stable</release>
|
<release>stable</release>
|
||||||
|
@ -24,10 +24,7 @@
|
||||||
</stability>
|
</stability>
|
||||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
<notes>
|
<notes>
|
||||||
- SeedDMS_Folder::getDocuments() and SeedDMS_Folder::getSubFolders() do not
|
- fix handling of multivalue attributes
|
||||||
do any sorting if $orderby is not set.
|
|
||||||
- database hostname can have port seperated by ':'
|
|
||||||
- make all functions in SeedDMS_Core_File static (fixes problem with php 5.5.x)
|
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="SeedDMS" name="/">
|
<dir baseinstalldir="SeedDMS" name="/">
|
||||||
|
@ -586,5 +583,24 @@ New release
|
||||||
- new methods SeedDMS_Core_DMS::checkFolders() and SeedDMS_Core_DMS::checkDocuments()
|
- new methods SeedDMS_Core_DMS::checkFolders() and SeedDMS_Core_DMS::checkDocuments()
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
|
</release>
|
||||||
|
<date>2014-02-01</date>
|
||||||
|
<time>16:19:34</time>
|
||||||
|
<version>
|
||||||
|
<release>4.3.3</release>
|
||||||
|
<api>4.3.3</api>
|
||||||
|
</version>
|
||||||
|
<stability>
|
||||||
|
<release>stable</release>
|
||||||
|
<api>stable</api>
|
||||||
|
</stability>
|
||||||
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
|
<notes>
|
||||||
|
- SeedDMS_Folder::getDocuments() and SeedDMS_Folder::getSubFolders() do not
|
||||||
|
do any sorting if $orderby is not set.
|
||||||
|
- database hostname can have port seperated by ':'
|
||||||
|
- make all functions in SeedDMS_Core_File static (fixes problem with php 5.5.x)
|
||||||
|
</notes>
|
||||||
|
</release>
|
||||||
</changelog>
|
</changelog>
|
||||||
</package>
|
</package>
|
||||||
|
|
|
@ -58,6 +58,13 @@ if ($action == "addattrdef") {
|
||||||
if (is_object($dms->getAttributeDefinitionByName($name))) {
|
if (is_object($dms->getAttributeDefinitionByName($name))) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("attrdef_exists"));
|
UI::exitError(getMLText("admin_tools"),getMLText("attrdef_exists"));
|
||||||
}
|
}
|
||||||
|
if($minvalues > 1 && $multiple == 0) {
|
||||||
|
UI::exitError(getMLText("admin_tools"),getMLText("attrdef_must_be_multiple"));
|
||||||
|
}
|
||||||
|
if($minvalues > $maxvalues) {
|
||||||
|
UI::exitError(getMLText("admin_tools"),getMLText("attrdef_min_greater_max"));
|
||||||
|
}
|
||||||
|
|
||||||
$newAttrdef = $dms->addAttributeDefinition($name, $objtype, $type, $multiple, $minvalues, $maxvalues, $valueset, $regex);
|
$newAttrdef = $dms->addAttributeDefinition($name, $objtype, $type, $multiple, $minvalues, $maxvalues, $valueset, $regex);
|
||||||
if (!$newAttrdef) {
|
if (!$newAttrdef) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
||||||
|
@ -124,6 +131,14 @@ else if ($action == "editattrdef") {
|
||||||
$maxvalues = intval($_POST["maxvalues"]);
|
$maxvalues = intval($_POST["maxvalues"]);
|
||||||
$valueset = trim($_POST["valueset"]);
|
$valueset = trim($_POST["valueset"]);
|
||||||
$regex = trim($_POST["regex"]);
|
$regex = trim($_POST["regex"]);
|
||||||
|
|
||||||
|
if($minvalues > 1 && $multiple == 0) {
|
||||||
|
UI::exitError(getMLText("admin_tools"),getMLText("attrdef_must_be_multiple"));
|
||||||
|
}
|
||||||
|
if($minvalues > $maxvalues) {
|
||||||
|
UI::exitError(getMLText("admin_tools"),getMLText("attrdef_min_greater_max"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!$attrdef->setName($name)) {
|
if (!$attrdef->setName($name)) {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,8 +231,8 @@ if($categories) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oldattributes = $document->getAttributes();
|
||||||
if($attributes) {
|
if($attributes) {
|
||||||
$oldattributes = $document->getAttributes();
|
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
|
@ -251,6 +251,13 @@ if($attributes) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach($oldattributes as $attrdefid=>$oldattribute) {
|
||||||
|
if(!isset($attributes[$attrdefid])) {
|
||||||
|
if(!$document->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
||||||
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if($sequence != "keep") {
|
if($sequence != "keep") {
|
||||||
if($document->setSequence($sequence)) {
|
if($document->setSequence($sequence)) {
|
||||||
|
|
|
@ -153,8 +153,8 @@ if(($oldcomment = $folder->getComment()) != $comment) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oldattributes = $folder->getAttributes();
|
||||||
if($attributes) {
|
if($attributes) {
|
||||||
$oldattributes = $folder->getAttributes();
|
|
||||||
foreach($attributes as $attrdefid=>$attribute) {
|
foreach($attributes as $attrdefid=>$attribute) {
|
||||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||||
if($attribute) {
|
if($attribute) {
|
||||||
|
@ -173,6 +173,13 @@ if($attributes) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach($oldattributes as $attrdefid=>$oldattribute) {
|
||||||
|
if(!isset($attributes[$attrdefid])) {
|
||||||
|
if(!$folder->removeAttribute($dms->getAttributeDefinition($attrdefid)))
|
||||||
|
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(strcasecmp($sequence, "keep")) {
|
if(strcasecmp($sequence, "keep")) {
|
||||||
if($folder->setSequence($sequence)) {
|
if($folder->setSequence($sequence)) {
|
||||||
|
|
125
op/op.Login.php
125
op/op.Login.php
|
@ -70,6 +70,10 @@ if ((!isset($pwd) || strlen($pwd)==0) && ($login != $guestUser->getLogin())) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialy set $user to false. It will contain a valid user record
|
||||||
|
* if authentication against ldap succeeds.
|
||||||
|
* _ldapHost will only have a value if the ldap connector has been enabled
|
||||||
|
*/
|
||||||
$user = false;
|
$user = false;
|
||||||
|
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) {
|
||||||
|
@ -83,78 +87,70 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_bool($user)) {
|
if (is_bool($user)) {
|
||||||
//
|
if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
|
||||||
// LDAP Sign In
|
if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) {
|
||||||
//
|
$ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort);
|
||||||
|
} else {
|
||||||
/* new code by doudoux - TO BE TESTED */
|
$ds = ldap_connect($settings->_ldapHost);
|
||||||
if (isset($settings->_ldapBaseDN)) {
|
|
||||||
$ldapSearchAttribut = "uid=";
|
|
||||||
$tmpDN = "uid=".$login.",".$settings->_ldapBaseDN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($settings->_ldapType)) {
|
if (!is_bool($ds)) {
|
||||||
if ($settings->_ldapType==1) {
|
/* Check if ldap base dn is set, and use ldap server if it is */
|
||||||
$ldapSearchAttribut = "sAMAccountName=";
|
if (isset($settings->_ldapBaseDN)) {
|
||||||
$tmpDN = $login.'@'.$settings->_ldapAccountDomainName;
|
$ldapSearchAttribut = "uid=";
|
||||||
|
$tmpDN = "uid=".$login.",".$settings->_ldapBaseDN;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* end of new code */
|
|
||||||
|
|
||||||
if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
|
/* Active directory has a different base dn */
|
||||||
if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) {
|
if (isset($settings->_ldapType)) {
|
||||||
$ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort);
|
if ($settings->_ldapType==1) {
|
||||||
}
|
$ldapSearchAttribut = "sAMAccountName=";
|
||||||
else {
|
$tmpDN = $login.'@'.$settings->_ldapAccountDomainName;
|
||||||
$ds = ldap_connect($settings->_ldapHost);
|
|
||||||
}
|
|
||||||
if (!is_bool($ds)) {
|
|
||||||
// Ensure that the LDAP connection is set to use version 3 protocol.
|
|
||||||
// Required for most authentication methods, including SASL.
|
|
||||||
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
|
|
||||||
|
|
||||||
// try an anonymous bind first. If it succeeds, get the DN for the user.
|
|
||||||
if (isset($settings->_ldapBindDN)) {
|
|
||||||
$bind = @ldap_bind($ds, $settings->_ldapBindDN, $settings->_ldapBindPw);
|
|
||||||
} else {
|
|
||||||
$bind = @ldap_bind($ds);
|
|
||||||
}
|
}
|
||||||
$dn = false;
|
}
|
||||||
|
|
||||||
/* new code by doudoux - TO BE TESTED */
|
// Ensure that the LDAP connection is set to use version 3 protocol.
|
||||||
if ($bind) {
|
// Required for most authentication methods, including SASL.
|
||||||
$search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut.$login);
|
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||||
if (!is_bool($search)) {
|
|
||||||
$info = ldap_get_entries($ds, $search);
|
// try an authenticated/anonymous bind first.
|
||||||
if (!is_bool($info) && $info["count"]>0) {
|
// If it succeeds, get the DN for the user and use it for an authentication
|
||||||
$dn = $info[0]['dn'];
|
// with the users password.
|
||||||
}
|
$bind = false;
|
||||||
}
|
if (isset($settings->_ldapBindDN)) {
|
||||||
}
|
$bind = @ldap_bind($ds, $settings->_ldapBindDN, $settings->_ldapBindPw);
|
||||||
/* end of new code */
|
} else {
|
||||||
|
$bind = @ldap_bind($ds);
|
||||||
/* old code */
|
}
|
||||||
if ($bind) {
|
$dn = false;
|
||||||
$search = ldap_search($ds, $settings->_ldapBaseDN, "uid=".$login);
|
/* If bind succeed, then get the dn of for the user */
|
||||||
if (!is_bool($search)) {
|
if ($bind) {
|
||||||
$info = ldap_get_entries($ds, $search);
|
$search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut.$login);
|
||||||
if (!is_bool($info) && $info["count"]>0) {
|
if (!is_bool($search)) {
|
||||||
$dn = $info[0]['dn'];
|
$info = ldap_get_entries($ds, $search);
|
||||||
}
|
if (!is_bool($info) && $info["count"]>0) {
|
||||||
|
$dn = $info[0]['dn'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* end of old code */
|
}
|
||||||
|
|
||||||
|
/* If the previous bind failed, try it with the users creditionals
|
||||||
if (is_bool($dn)) {
|
* by simply setting $dn to a default string
|
||||||
// This is the fallback position, in case the anonymous bind does not
|
*/
|
||||||
// succeed.
|
if (is_bool($dn)) {
|
||||||
|
$dn = $tmpDN;
|
||||||
/* new code by doudoux - TO BE TESTED */
|
}
|
||||||
$dn = $tmpDN;
|
|
||||||
/* old code */
|
/* No do the actual authentication of the user */
|
||||||
//$dn = "uid=".$login.",".$settings->_ldapBaseDN;
|
$bind = @ldap_bind($ds, $dn, $pwd);
|
||||||
|
if ($bind) {
|
||||||
|
// Successfully authenticated. Now check to see if the user exists within
|
||||||
|
// the database. If not, add them in if _restricted is not set,
|
||||||
|
// but do not add their password.
|
||||||
|
$user = $dms->getUserByLogin($login);
|
||||||
|
if (is_bool($user) && !$settings->_restricted) {
|
||||||
|
// Retrieve the user's LDAP information.
|
||||||
|
$search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut . $login);
|
||||||
}
|
}
|
||||||
$bind = @ldap_bind($ds, $dn, $pwd);
|
$bind = @ldap_bind($ds, $dn, $pwd);
|
||||||
if ($bind) {
|
if ($bind) {
|
||||||
|
@ -185,6 +181,7 @@ if (is_bool($user)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_bool($user)) {
|
if (is_bool($user)) {
|
||||||
//
|
//
|
||||||
|
|
|
@ -186,7 +186,11 @@ function showAttributeDefinitions(selectObj) {
|
||||||
print "<td><a href=\"../out/out.ViewDocument.php?documentid=".$doc->getID()."\">" . htmlspecialchars($doc->getName()) . "</a></td>\n";
|
print "<td><a href=\"../out/out.ViewDocument.php?documentid=".$doc->getID()."\">" . htmlspecialchars($doc->getName()) . "</a></td>\n";
|
||||||
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
||||||
print "<td>".getOverallStatusText($status["status"])."</td>";
|
print "<td>".getOverallStatusText($status["status"])."</td>";
|
||||||
print "<td>".$doc->getAttributeValue($attrdef)."</td>";
|
$value = $doc->getAttributeValue($attrdef);
|
||||||
|
if(is_array($value))
|
||||||
|
print "<td>".implode('; ', $value)."</td>";
|
||||||
|
else
|
||||||
|
print "<td>".$value."</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print "<a href='../out/out.EditDocument.php?documentid=".$doc->getID()."' class=\"btn btn-mini\"><i class=\"icon-edit\"></i> ".getMLText("edit")."</a>";
|
print "<a href='../out/out.EditDocument.php?documentid=".$doc->getID()."' class=\"btn btn-mini\"><i class=\"icon-edit\"></i> ".getMLText("edit")."</a>";
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
@ -209,7 +213,11 @@ function showAttributeDefinitions(selectObj) {
|
||||||
print "<td><i class=\"icon-folder-close-alt\"></i></td>";
|
print "<td><i class=\"icon-folder-close-alt\"></i></td>";
|
||||||
print "<td><a href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\">" . htmlspecialchars($folder->getName()) . "</a></td>\n";
|
print "<td><a href=\"../out/out.ViewFolder.php?folderid=".$folder->getID()."\">" . htmlspecialchars($folder->getName()) . "</a></td>\n";
|
||||||
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
||||||
print "<td>".$folder->getAttributeValue($attrdef)."</td>";
|
$value = $folder->getAttributeValue($attrdef);
|
||||||
|
if(is_array($value))
|
||||||
|
print "<td>".implode('; ', $value)."</td>";
|
||||||
|
else
|
||||||
|
print "<td>".$value."</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print "<a href='../out/out.EditFolder.php?folderid=".$folder->getID()."' class=\"btn btn-mini\"><i class=\"icon-edit\"></i> ".getMLText("edit")."</a>";
|
print "<a href='../out/out.EditFolder.php?folderid=".$folder->getID()."' class=\"btn btn-mini\"><i class=\"icon-edit\"></i> ".getMLText("edit")."</a>";
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
@ -237,7 +245,11 @@ function showAttributeDefinitions(selectObj) {
|
||||||
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
print "<td>".htmlspecialchars($owner->getFullName())."</td>";
|
||||||
print "<td>".$content->getMimeType()."</td>";
|
print "<td>".$content->getMimeType()."</td>";
|
||||||
print "<td>".$content->getVersion()."</td>";
|
print "<td>".$content->getVersion()."</td>";
|
||||||
print "<td>".$content->getAttributeValue($attrdef)."</td>";
|
$value = $content->getAttributeValue($attrdef);
|
||||||
|
if(is_array($value))
|
||||||
|
print "<td>".implode('; ', $value)."</td>";
|
||||||
|
else
|
||||||
|
print "<td>".$value."</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print "<a href='../out/out.EditDocument.php?documentid=".$doc->getID()."' class=\"btn btn-mini\"><i class=\"icon-edit\"></i> ".getMLText("edit")."</a>";
|
print "<a href='../out/out.EditDocument.php?documentid=".$doc->getID()."' class=\"btn btn-mini\"><i class=\"icon-edit\"></i> ".getMLText("edit")."</a>";
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
|
@ -878,13 +878,21 @@ function folderSelected<?php echo $formName ?>(id, name) {
|
||||||
|
|
||||||
function printAttributeEditField($attrdef, $objvalue, $fieldname='attributes') { /* {{{ */
|
function printAttributeEditField($attrdef, $objvalue, $fieldname='attributes') { /* {{{ */
|
||||||
if($valueset = $attrdef->getValueSetAsArray()) {
|
if($valueset = $attrdef->getValueSetAsArray()) {
|
||||||
echo "<select name=\"".$fieldname."[".$attrdef->getId()."]\">";
|
echo "<select name=\"".$fieldname."[".$attrdef->getId()."]";
|
||||||
if($attrdef->getMinValues() < 1) {
|
if($attrdef->getMultipleValues()) {
|
||||||
|
echo "[]\" multiple";
|
||||||
|
} else {
|
||||||
|
echo "\"";
|
||||||
|
}
|
||||||
|
echo ">";
|
||||||
|
if(!$attrdef->getMultipleValues()) {
|
||||||
echo "<option value=\"\"></option>";
|
echo "<option value=\"\"></option>";
|
||||||
}
|
}
|
||||||
foreach($valueset as $value) {
|
foreach($valueset as $value) {
|
||||||
echo "<option value=\"".htmlspecialchars($value)."\"";
|
echo "<option value=\"".htmlspecialchars($value)."\"";
|
||||||
if($value == $objvalue)
|
if(is_array($objvalue) && in_array($value, $objvalue))
|
||||||
|
echo " selected";
|
||||||
|
elseif($value == $objvalue)
|
||||||
echo " selected";
|
echo " selected";
|
||||||
echo ">".htmlspecialchars($value)."</option>";
|
echo ">".htmlspecialchars($value)."</option>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user