mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-10-28 19:51:25 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
a575714218
|
|
@ -90,6 +90,7 @@
|
||||||
- fix 2-factor authentification
|
- fix 2-factor authentification
|
||||||
- configuration variables in extension of type 'select' may have an empty option
|
- configuration variables in extension of type 'select' may have an empty option
|
||||||
- default position of documents/folders can be set in configuration (Closes #381)
|
- default position of documents/folders can be set in configuration (Closes #381)
|
||||||
|
- attribute values can be deleted from all folders, documents
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.1.5
|
Changes in version 5.1.5
|
||||||
|
|
|
||||||
|
|
@ -921,7 +921,7 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all documents and folder by a given attribute value
|
* Get all documents and folders by a given attribute value
|
||||||
*
|
*
|
||||||
* @param string $attrvalue value of attribute
|
* @param string $attrvalue value of attribute
|
||||||
* @param integer $limit limit number of documents/folders
|
* @param integer $limit limit number of documents/folders
|
||||||
|
|
@ -933,10 +933,13 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
||||||
$result = array('docs'=>array(), 'folders'=>array(), 'contents'=>array());
|
$result = array('docs'=>array(), 'folders'=>array(), 'contents'=>array());
|
||||||
if($this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_all ||
|
if($this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_all ||
|
||||||
$this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_document) {
|
$this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_document) {
|
||||||
if($this->_multiple)
|
$queryStr = "SELECT * FROM `tblDocumentAttributes` WHERE `attrdef`=".$this->_id." AND ";
|
||||||
$queryStr = "SELECT * FROM `tblDocumentAttributes` WHERE `attrdef`=".$this->_id." AND (`value` like ".$db->qstr("%".$this->getValueSetSeparator().$attrvalue.$this->getValueSetSeparator()."%")." OR `value` like ".$db->qstr("%".$this->getValueSetSeparator().$attrvalue).")";
|
if($this->getMultipleValues()) {
|
||||||
else
|
$sep = $this->getValueSetSeparator();
|
||||||
$queryStr = "SELECT * FROM `tblDocumentAttributes` WHERE `attrdef`=".$this->_id." AND `value`=".$db->qstr($attrvalue);
|
$queryStr .= "(`value` like ".$db->qstr($sep.$attrvalue.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue.$sep.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue).")";
|
||||||
|
} else {
|
||||||
|
$queryStr .= "`value`=".$db->qstr($attrvalue);
|
||||||
|
}
|
||||||
if($limit)
|
if($limit)
|
||||||
$queryStr .= " limit ".(int) $limit;
|
$queryStr .= " limit ".(int) $limit;
|
||||||
$resArr = $db->getResultArray($queryStr);
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
|
@ -951,10 +954,13 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
||||||
|
|
||||||
if($this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_all ||
|
if($this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_all ||
|
||||||
$this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_folder) {
|
$this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_folder) {
|
||||||
if($this->_multiple)
|
$queryStr = "SELECT * FROM `tblFolderAttributes` WHERE `attrdef`=".$this->_id." AND ";
|
||||||
$queryStr = "SELECT * FROM `tblFolderAttributes` WHERE `attrdef`=".$this->_id." AND (`value` like ".$db->qstr("%".$this->getValueSetSeparator().$attrvalue.$this->getValueSetSeparator()."%")." OR `value` like ".$db->qstr("%".$this->getValueSetSeparator().$attrvalue).")";
|
if($this->getMultipleValues()) {
|
||||||
else
|
$sep = $this->getValueSetSeparator();
|
||||||
$queryStr = "SELECT * FROM `tblFolderAttributes` WHERE `attrdef`=".$this->_id." AND `value`=".$db->qstr($attrvalue);
|
$queryStr .= "(`value` like ".$db->qstr($sep.$attrvalue.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue.$sep.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue).")";
|
||||||
|
} else {
|
||||||
|
$queryStr .= "`value`=".$db->qstr($attrvalue);
|
||||||
|
}
|
||||||
if($limit)
|
if($limit)
|
||||||
$queryStr .= " limit ".(int) $limit;
|
$queryStr .= " limit ".(int) $limit;
|
||||||
$resArr = $db->getResultArray($queryStr);
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
|
@ -970,6 +976,72 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
||||||
return $result;
|
return $result;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a given attribute value from all documents, versions and folders
|
||||||
|
*
|
||||||
|
* @param string $attrvalue value of attribute
|
||||||
|
* @return array array containing list of documents and folders
|
||||||
|
*/
|
||||||
|
public function removeValue($attrvalue) { /* {{{ */
|
||||||
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
|
foreach(array('document', 'documentcontent', 'folder') as $type) {
|
||||||
|
if($type == 'document') {
|
||||||
|
$tablename = "tblDocumentAttributes";
|
||||||
|
$objtype = SeedDMS_Core_AttributeDefinition::objtype_document;
|
||||||
|
} elseif($type == 'documentcontent') {
|
||||||
|
$tablename = "tblDocumentContentAttributes";
|
||||||
|
$objtype = SeedDMS_Core_AttributeDefinition::objtype_documentcontent;
|
||||||
|
} elseif($type == 'folder') {
|
||||||
|
$tablename = "tblFolderAttributes";
|
||||||
|
$objtype = SeedDMS_Core_AttributeDefinition::objtype_folder;
|
||||||
|
}
|
||||||
|
if($this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_all || $objtype) {
|
||||||
|
$queryStr = "SELECT * FROM `".$tablename."` WHERE `attrdef`=".$this->_id." AND ";
|
||||||
|
if($this->getMultipleValues()) {
|
||||||
|
$sep = $this->getValueSetSeparator();
|
||||||
|
$queryStr .= "(`value` like ".$db->qstr($sep.$attrvalue.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue.$sep.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue).")";
|
||||||
|
} else {
|
||||||
|
$queryStr .= "`value`=".$db->qstr($attrvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$resArr = $db->getResultArray($queryStr);
|
||||||
|
if($resArr) {
|
||||||
|
$db->startTransaction();
|
||||||
|
foreach($resArr as $rec) {
|
||||||
|
if($rec['value'] == $attrvalue) {
|
||||||
|
$queryStr = "DELETE FROM `".$tablename."` WHERE `id`=".$rec['id'];
|
||||||
|
} else {
|
||||||
|
if($this->getMultipleValues()) {
|
||||||
|
$sep = substr($rec['value'], 0, 1);
|
||||||
|
$vsep = $this->getValueSetSeparator();
|
||||||
|
if($sep == $vsep)
|
||||||
|
$values = explode($sep, substr($rec['value'], 1));
|
||||||
|
else
|
||||||
|
$values = array($rec['value']);
|
||||||
|
if (($key = array_search($attrvalue, $values)) !== false) {
|
||||||
|
unset($values[$key]);
|
||||||
|
}
|
||||||
|
if($values) {
|
||||||
|
$queryStr = "UPDATE `".$tablename."` SET `value`=".$db->qstr($sep.implode($sep, $values))." WHERE `id`=".$rec['id'];
|
||||||
|
} else {
|
||||||
|
$queryStr = "DELETE FROM `".$tablename."` WHERE `id`=".$rec['id'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$db->commitTransaction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate value against attribute definition
|
* Validate value against attribute definition
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1812,6 +1812,8 @@ class SeedDMS_Core_DMS {
|
||||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
|
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
|
||||||
if($valueset = $attrdef->getValueSet()) {
|
if($valueset = $attrdef->getValueSet()) {
|
||||||
if($attrdef->getMultipleValues()) {
|
if($attrdef->getMultipleValues()) {
|
||||||
|
if(is_string($attribute))
|
||||||
|
$attribute = array($attribute);
|
||||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
|
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
|
||||||
} else
|
} else
|
||||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value`='".$attribute."' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
|
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value`='".$attribute."' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
|
||||||
|
|
@ -1965,6 +1967,8 @@ class SeedDMS_Core_DMS {
|
||||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
|
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
|
||||||
if($valueset = $attrdef->getValueSet()) {
|
if($valueset = $attrdef->getValueSet()) {
|
||||||
if($attrdef->getMultipleValues()) {
|
if($attrdef->getMultipleValues()) {
|
||||||
|
if(is_string($attribute))
|
||||||
|
$attribute = array($attribute);
|
||||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
|
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
|
||||||
} else
|
} else
|
||||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."' AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
|
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."' AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
|
||||||
|
|
@ -1974,6 +1978,8 @@ class SeedDMS_Core_DMS {
|
||||||
if($attrdef->getValueSet()) {
|
if($attrdef->getValueSet()) {
|
||||||
if($attrdef->getMultipleValues()) {
|
if($attrdef->getMultipleValues()) {
|
||||||
/** @noinspection PhpUndefinedVariableInspection */
|
/** @noinspection PhpUndefinedVariableInspection */
|
||||||
|
if(is_string($attribute))
|
||||||
|
$attribute = array($attribute);
|
||||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentContentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentContentAttributes`.`document` = `tblDocumentContent`.`id`)";
|
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentContentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentContentAttributes`.`document` = `tblDocumentContent`.`id`)";
|
||||||
} else {
|
} else {
|
||||||
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value`='".$attribute."' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)";
|
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value`='".$attribute."' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)";
|
||||||
|
|
|
||||||
|
|
@ -1582,6 +1582,7 @@ returns just users which are not disabled
|
||||||
<notes>
|
<notes>
|
||||||
add SeedDMS_Core_Folder::getDocumentsMinMax()
|
add SeedDMS_Core_Folder::getDocumentsMinMax()
|
||||||
add lots of DocBlocks from merge request #8
|
add lots of DocBlocks from merge request #8
|
||||||
|
add SeedDMS_Core_AttributeDefinition::removeValue()
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
<release>
|
<release>
|
||||||
|
|
|
||||||
|
|
@ -83,5 +83,12 @@ class SeedDMS_Controller_AttributeMgr extends SeedDMS_Controller_Common {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
public function removeattrvalue() { /* {{{ */
|
||||||
|
$attrdef = $this->params['attrdef'];
|
||||||
|
$attrval = $this->params['attrval'];
|
||||||
|
//$attrdef->getObjects($attrval);
|
||||||
|
return $attrdef->removeValue($attrval);
|
||||||
|
} /* }}} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ if (!$user->isAdmin()) {
|
||||||
if (isset($_POST["action"])) $action=$_POST["action"];
|
if (isset($_POST["action"])) $action=$_POST["action"];
|
||||||
else $action=NULL;
|
else $action=NULL;
|
||||||
|
|
||||||
if(!in_array($action, array('addattrdef', 'removeattrdef', 'editattrdef')))
|
if(!in_array($action, array('addattrdef', 'removeattrdef', 'editattrdef', 'removeattrvalue')))
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_command"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_command"));
|
||||||
|
|
||||||
/* Check if the form data comes from a trusted request */
|
/* Check if the form data comes from a trusted request */
|
||||||
|
|
@ -168,6 +168,35 @@ else if ($action == "editattrdef") {
|
||||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_attribute')));
|
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_edit_attribute')));
|
||||||
|
|
||||||
add_log_line("&action=editattrdef&attrdefid=".$attrdefid);
|
add_log_line("&action=editattrdef&attrdefid=".$attrdefid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove attribute value -----------------------------------------------
|
||||||
|
else if ($action == "removeattrvalue") {
|
||||||
|
|
||||||
|
if (!isset($_POST["attrdefid"]) || !is_numeric($_POST["attrdefid"]) || intval($_POST["attrdefid"])<1) {
|
||||||
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_attrdef"));
|
||||||
|
}
|
||||||
|
$attrdefid = $_POST["attrdefid"];
|
||||||
|
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||||
|
if (!is_object($attrdef)) {
|
||||||
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_attrdef"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$attrval = $_POST["attrvalue"];
|
||||||
|
|
||||||
|
$controller->setParam('attrval', $attrval);
|
||||||
|
$controller->setParam('attrdef', $attrdef);
|
||||||
|
if (!$controller($_POST)) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>false, 'message'=>getMLText('error_occured')));
|
||||||
|
} else {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_rm_attr_value')));
|
||||||
|
}
|
||||||
|
|
||||||
|
add_log_line("&action=removeattrvalue&attrdefid=".$attrdefid);
|
||||||
|
exit;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
UI::exitError(getMLText("admin_tools"),getMLText("unknown_command"));
|
UI::exitError(getMLText("admin_tools"),getMLText("unknown_command"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ if($view) {
|
||||||
$view->setParam('folder', $folder);
|
$view->setParam('folder', $folder);
|
||||||
$view->setParam('allusers', $allUsers);
|
$view->setParam('allusers', $allUsers);
|
||||||
$view->setParam('allgroups', $allGroups);
|
$view->setParam('allgroups', $allGroups);
|
||||||
$view->setParam('strictformcheck', $settings->_strictFormCheck);
|
|
||||||
$view->setParam('accessobject', $accessop);
|
$view->setParam('accessobject', $accessop);
|
||||||
$view($_GET);
|
$view($_GET);
|
||||||
exit;
|
exit;
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ $(document).ready( function() {
|
||||||
<?php
|
<?php
|
||||||
$this->printDeleteFolderButtonJs();
|
$this->printDeleteFolderButtonJs();
|
||||||
$this->printDeleteDocumentButtonJs();
|
$this->printDeleteDocumentButtonJs();
|
||||||
|
$this->printDeleteAttributeValueButtonJs();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function info() { /* {{{ */
|
function info() { /* {{{ */
|
||||||
|
|
@ -79,11 +80,12 @@ $(document).ready( function() {
|
||||||
$content .= "<th>".getMLText("attribute_count")."</th>\n";
|
$content .= "<th>".getMLText("attribute_count")."</th>\n";
|
||||||
$content .= "<th></th>\n";
|
$content .= "<th></th>\n";
|
||||||
$content .= "</tr></thead>\n<tbody>\n";
|
$content .= "</tr></thead>\n<tbody>\n";
|
||||||
|
$separator = $selattrdef->getValueSetSeparator();
|
||||||
foreach($res['frequencies'][$type] as $entry) {
|
foreach($res['frequencies'][$type] as $entry) {
|
||||||
$value = $selattrdef->parseValue($entry['value']);
|
$value = $selattrdef->parseValue($entry['value']);
|
||||||
$content .= "<tr>";
|
$content .= "<tr>";
|
||||||
$content .= "<td>".implode(';', $value)."</td>";
|
$content .= "<td>".htmlspecialchars(implode('<span style="color: #aaa;">'.($separator ? ' '.$separator.' ' : ' ; ').'</span>', $value))."</td>";
|
||||||
$content .= "<td><a href=\"../out/out.Search.php?resultmode=".($type == 'folder' ? 2 : ($type == 'document' ? 1 : 3))."&attributes[".$selattrdef->getID()."]=".$entry['value']."\">".urlencode($entry['c'])."</a></td>";
|
$content .= "<td><a href=\"../out/out.Search.php?resultmode=".($type == 'folder' ? 2 : ($type == 'document' ? 1 : 3))."&attributes[".$selattrdef->getID()."]=".urlencode($entry['value'])."\">".urlencode($entry['c'])."</a></td>";
|
||||||
$content .= "<td>";
|
$content .= "<td>";
|
||||||
/* various checks, if the value is valid */
|
/* various checks, if the value is valid */
|
||||||
if(!$selattrdef->validate($entry['value'])) {
|
if(!$selattrdef->validate($entry['value'])) {
|
||||||
|
|
@ -99,6 +101,15 @@ $(document).ready( function() {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$content .= "</td>";
|
$content .= "</td>";
|
||||||
|
$content .= "<td>";
|
||||||
|
$content .= "<div class=\"list-action\">";
|
||||||
|
if($user->isAdmin()) {
|
||||||
|
$content .= $this->printDeleteAttributeValueButton($selattrdef, implode(';', $value), 'splash_rm_attr_value', true);
|
||||||
|
} else {
|
||||||
|
$content .= '<span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span>';
|
||||||
|
}
|
||||||
|
$content .= "</div>";
|
||||||
|
$content .= "</td>";
|
||||||
$content .= "</tr>";
|
$content .= "</tr>";
|
||||||
}
|
}
|
||||||
$content .= "</tbody></table>";
|
$content .= "</tbody></table>";
|
||||||
|
|
|
||||||
|
|
@ -2023,6 +2023,86 @@ $(document).ready( function() {
|
||||||
<?php
|
<?php
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print button with link for deleting an attribute value
|
||||||
|
*
|
||||||
|
* This button is used in document listings (e.g. on the ViewFolder page)
|
||||||
|
* for deleting a document. In seeddms version < 4.3.9 this was just a
|
||||||
|
* link to the out/out.RemoveDocument.php page which asks for confirmation
|
||||||
|
* an than calls op/op.RemoveDocument.php. Starting with version 4.3.9
|
||||||
|
* the button just opens a small popup asking for confirmation and than
|
||||||
|
* calls the ajax command 'deletedocument'. The ajax call is called
|
||||||
|
* in the click function of 'button.removedocument'. That button needs
|
||||||
|
* to have two attributes: 'rel' for the id of the document, and 'msg'
|
||||||
|
* for the message shown by notify if the document could be deleted.
|
||||||
|
*
|
||||||
|
* @param object $document document to be deleted
|
||||||
|
* @param string $msg message shown in case of successful deletion
|
||||||
|
* @param boolean $return return html instead of printing it
|
||||||
|
* @return string html content if $return is true, otherwise an empty string
|
||||||
|
*/
|
||||||
|
function printDeleteAttributeValueButton($attrdef, $value, $msg, $return=false){ /* {{{ */
|
||||||
|
$content = '';
|
||||||
|
$content .= '<a class="delete-attribute-value-btn" rel="'.$attrdef->getID().'" msg="'.getMLText($msg).'" attrvalue="'.htmlspecialchars($value, ENT_QUOTES).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_attr_value", array ("attrdefname" => $attrdef->getName())), ENT_QUOTES).'"><i class="icon-remove"></i></a>';
|
||||||
|
if($return)
|
||||||
|
return $content;
|
||||||
|
else
|
||||||
|
echo $content;
|
||||||
|
return '';
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
function printDeleteAttributeValueButtonJs(){ /* {{{ */
|
||||||
|
echo "
|
||||||
|
$(document).ready(function () {
|
||||||
|
// $('.delete-attribute-value-btn').click(function(ev) {
|
||||||
|
$('body').on('click', 'a.delete-attribute-value-btn', function(ev){
|
||||||
|
id = $(ev.currentTarget).attr('rel');
|
||||||
|
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
|
||||||
|
attrvalue = $(ev.currentTarget).attr('attrvalue');
|
||||||
|
msg = $(ev.currentTarget).attr('msg');
|
||||||
|
formtoken = '".createFormKey('removeattrvalue')."';
|
||||||
|
bootbox.dialog(confirmmsg, [{
|
||||||
|
\"label\" : \"<i class='icon-remove'></i> ".getMLText("rm_attr_value")."\",
|
||||||
|
\"class\" : \"btn-danger\",
|
||||||
|
\"callback\": function() {
|
||||||
|
$.post('../op/op.AttributeMgr.php',
|
||||||
|
{ action: 'removeattrvalue', attrdefid: id, attrvalue: attrvalue, formtoken: formtoken },
|
||||||
|
function(data) {
|
||||||
|
if(data.success) {
|
||||||
|
$('#table-row-attrvalue-'+id).hide('slow');
|
||||||
|
noty({
|
||||||
|
text: msg,
|
||||||
|
type: 'success',
|
||||||
|
dismissQueue: true,
|
||||||
|
layout: 'topRight',
|
||||||
|
theme: 'defaultTheme',
|
||||||
|
timeout: 1500,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
noty({
|
||||||
|
text: data.message,
|
||||||
|
type: 'error',
|
||||||
|
dismissQueue: true,
|
||||||
|
layout: 'topRight',
|
||||||
|
theme: 'defaultTheme',
|
||||||
|
timeout: 3500,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'json'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
\"label\" : \"".getMLText("cancel")."\",
|
||||||
|
\"class\" : \"btn-cancel\",
|
||||||
|
\"callback\": function() {
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
";
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return HTML of a single row in the document list table
|
* Return HTML of a single row in the document list table
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ $(document).ready(function() {
|
||||||
$folder = $this->params['folder'];
|
$folder = $this->params['folder'];
|
||||||
$allUsers = $this->params['allusers'];
|
$allUsers = $this->params['allusers'];
|
||||||
$allGroups = $this->params['allgroups'];
|
$allGroups = $this->params['allgroups'];
|
||||||
$strictformcheck = $this->params['strictformcheck'];
|
|
||||||
|
|
||||||
$notifyList = $folder->getNotifyList();
|
$notifyList = $folder->getNotifyList();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user