* @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ //require_once("class.Bootstrap.php"); /** * Class which outputs the html page for AttributeMgr view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_AttributeMgr extends SeedDMS_Theme_Style { function js() { /* {{{ */ $selattrdef = $this->params['selattrdef']; header('Content-Type: application/javascript; charset=UTF-8'); parent::jsTranslations(array('js_form_error', 'js_form_errors', 'cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder')); ?> function runValidation() { $("#form1").validate({ rules: { name: { required: true } }, messages: { name: "", }, }); } $(document).ready( function() { $( "#selector" ).change(function() { $('div.ajax').trigger('update', {attrdefid: $(this).val()}); window.history.pushState({"html":"","pageTitle":""},"", '../out/out.AttributeMgr.php?attrdefid=' + $(this).val()); }); }); printDeleteFolderButtonJs(); $this->printDeleteDocumentButtonJs(); $this->printDeleteAttributeValueButtonJs(); $this->printClickDocumentJs(); $this->printClickFolderJs(); } /* }}} */ function info() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $conversionmgr = $this->params['conversionmgr']; $attrdefs = $this->params['attrdefs']; $selattrdef = $this->params['selattrdef']; $cachedir = $this->params['cachedir']; $previewwidth = $this->params['previewWidthList']; $enableRecursiveCount = $this->params['enableRecursiveCount']; $maxRecursiveCount = $this->params['maxRecursiveCount']; $timeout = $this->params['timeout']; $xsendfile = $this->params['xsendfile']; if($selattrdef) { $this->contentHeading(getMLText("attrdef_info")); $res = $selattrdef->getStatistics(30); if(!empty($res['frequencies']['document']) ||!empty($res['frequencies']['folder']) ||!empty($res['frequencies']['content'])) { foreach(array('document', 'folder', 'content') as $type) { $content = ''; if(isset($res['frequencies'][$type]) && $res['frequencies'][$type]) { $content .= ""; $content .= "\n\n"; $content .= "\n"; $content .= "\n"; $content .= "\n"; $content .= "\n"; $content .= "\n\n"; $separator = $selattrdef->getValueSetSeparator(); foreach($res['frequencies'][$type] as $entry) { if(is_array($entry['value'])) { $values = $entry['value']; } else { $values = [$entry['value']]; } $value = []; foreach($values as $v) { if(is_object($v)) $value[] = $v->getId(); else $value[] = $v; } // $value = $selattrdef->parseValue($entry['value']); $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; } $content .= "
".getMLText("attribute_value")."".getMLText("attribute_count")."
".htmlspecialchars(implode(''.($separator ? ' '.$separator.' ' : ' ; ').'', $value))."getType() == SeedDMS_Core_AttributeDefinition::type_date) $content .= "attributes[".$selattrdef->getID()."][from]=".urlencode($entry['value'])."&attributes[".$selattrdef->getID()."][to]=".urlencode($entry['value']); else $content .= "attributes[".$selattrdef->getID()."]=".urlencode($value[0]); $content .= "\">".urlencode($entry['c']).""; /* various checks, if the value is valid */ if(!$selattrdef->validate($entry['value'])) { $content .= getAttributeValidationText($selattrdef->getValidationError(), $selattrdef->getName(), $entry['value'], $selattrdef->getRegex()); } /* Check if value is in value set */ /* if($selattrdef->getValueSet()) { foreach($value as $v) { if(!in_array($v, $selattrdef->getValueSetAsArray())) $content .= getMLText("attribute_value_not_in_valueset"); } } */ $content .= ""; $content .= "
"; if($user->isAdmin()) { $content .= $this->printDeleteAttributeValueButton($selattrdef, implode(';', $value), 'splash_rm_attr_value', true); } else { $content .= ''; } $content .= "
"; $content .= "
"; } if($content) $this->printAccordion(getMLText('attribute_value')." (".getMLText($type).")", $content); } } $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile); if($conversionmgr) $previewer->setConversionMgr($conversionmgr); if($res['folders'] || $res['docs']) { print $this->folderListHeader(); print "\n"; foreach($res['folders'] as $subFolder) { $extracontent = array(); $extracontent['below_title'] = $this->getListRowPath($subFolder); echo $this->folderListRow($subFolder, false, $extracontent); } foreach($res['docs'] as $document) { $extracontent = array(); $extracontent['below_title'] = $this->getListRowPath($document); echo $this->documentListRow($document, $previewer, false, 0, $extracontent); } echo "\n\n"; } if($res['contents']) { print ""; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n\n"; foreach($res['contents'] as $content) { $doc = $content->getDocument(); $extracontent = array(); $extracontent['below_title'] = $this->getListRowPath($doc); echo $this->documentListRow($doc, $previewer, false, 0, $extracontent); } print "
".getMLText("name")."".getMLText("status")."".getMLText("action")."
"; } } } /* }}} */ function actionmenu() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $selattrdef = $this->params['selattrdef']; if($selattrdef && !$selattrdef->isUsed()) { ?>
formSubmit(' '.getMLText('rm_attrdef'),'','','secondary');?>
contentContainerStart(); $this->formField( getMLText("attrdef_name"), array( 'element'=>'input', 'type'=>'text', 'name'=>'name', 'value'=>($attrdef ? htmlspecialchars($attrdef->getName()) : '') ) ); $options = array(); $options[] = array(SeedDMS_Core_AttributeDefinition::objtype_all, getMLText('all')); $options[] = array(SeedDMS_Core_AttributeDefinition::objtype_folder, getMLText('folder'), $attrdef && $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder); $options[] = array(SeedDMS_Core_AttributeDefinition::objtype_document, getMLText('document'), $attrdef && $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document); $options[] = array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, getMLText('documentcontent'), $attrdef && $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent); $this->formField( getMLText("attrdef_objtype"), array( 'element'=>'select', 'name'=>'objtype', 'options'=>$options ) ); $options = array(); $options[] = getMLText('types_generic'); $options[] = array(SeedDMS_Core_AttributeDefinition::type_int, getMLText('attrdef_type_int'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int); $options[] = array(SeedDMS_Core_AttributeDefinition::type_float, getMLText('attrdef_type_float'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_float); $options[] = array(SeedDMS_Core_AttributeDefinition::type_string, getMLText('attrdef_type_string'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_string); $options[] = array(SeedDMS_Core_AttributeDefinition::type_boolean, getMLText('attrdef_type_boolean'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_boolean); $options[] = array(SeedDMS_Core_AttributeDefinition::type_date, getMLText('attrdef_type_date'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date); $options[] = array(SeedDMS_Core_AttributeDefinition::type_email, getMLText('attrdef_type_email'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_email); $options[] = array(SeedDMS_Core_AttributeDefinition::type_url, getMLText('attrdef_type_url'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_url); $options[] = 'SeedDMS'; $options[] = array(SeedDMS_Core_AttributeDefinition::type_folder, getMLText('attrdef_type_folder'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_folder); $options[] = array(SeedDMS_Core_AttributeDefinition::type_document, getMLText('attrdef_type_document'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_document); $options[] = array(SeedDMS_Core_AttributeDefinition::type_user, getMLText('attrdef_type_user'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_user); $options[] = array(SeedDMS_Core_AttributeDefinition::type_group, getMLText('attrdef_type_group'), $attrdef && $attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_group); if($moreoptions = $this->callHook('additionalTypes', $attrdef)) { foreach($moreoptions as $option) { if(is_string($option)) $options[] = $option; elseif(is_array($option)) $options[] = array((int) $option['value'], $option['name'], $attrdef && $attrdef->getType() == $option['value']); } } $this->formField( getMLText("attrdef_type"), array( 'element'=>'select', 'name'=>'type', 'options'=>$options ) ); $this->formField( getMLText("attrdef_multiple"), array( 'element'=>'input', 'type'=>'checkbox', 'name'=>'multiple', 'value'=>1, 'checked'=>($attrdef && $attrdef->getMultipleValues()) ) ); $this->formField( getMLText("attrdef_minvalues"), array( 'element'=>'input', 'type'=>'text', 'name'=>'minvalues', 'value'=>($attrdef ? $attrdef->getMinValues() : ''), ), ['help'=>getMLText('attrdef_minvalues_help')] ); $this->formField( getMLText("attrdef_maxvalues"), array( 'element'=>'input', 'type'=>'text', 'name'=>'maxvalues', 'value'=>($attrdef ? $attrdef->getMaxValues() : ''), ) ); $this->formField( getMLText("attrdef_valueset"), (($attrdef && strlen($attrdef->getValueSet()) > 30) ? array( 'element'=>'textarea', 'name'=>'valueset', 'rows'=>5, 'value'=>(($attrdef && $attrdef->getValueSet()) ? $attrdef->getValueSetSeparator().implode("\n".$attrdef->getValueSetSeparator(), $attrdef->getValueSetAsArray()) : ''), ) : array( 'element'=>'input', 'type'=>'text', 'name'=>'valueset', 'value'=>($attrdef ? $attrdef->getValueSet() : ''), )), ['help'=>getMLText('attrdef_valueset_help')] ); $this->formField( getMLText("attrdef_regex"), array( 'element'=>'input', 'type'=>'text', 'name'=>'regex', 'placeholder'=>'/[0-9]+abc.-*/', 'value'=>($attrdef ? $attrdef->getRegex() : ''), ), ['help'=>getMLText('attrdef_regex_help')] ); $this->contentContainerEnd(); $this->formSubmit(' '.getMLText('save')); ?>
params['selattrdef']; $this->showAttributeForm($selattrdef); } /* }}} */ function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $attrdefs = $this->params['attrdefs']; $selattrdef = $this->params['selattrdef']; $accessop = $this->params['accessobject']; $this->htmlAddHeader(''."\n", 'js'); $this->htmlAddHeader(''."\n", 'js'); $this->htmlStartPage(getMLText("admin_tools")); $this->globalNavigation(); $this->contentStart(); $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); $this->contentHeading(getMLText("attrdef_management")); $this->rowStart(); $this->columnStart(6); ?>
getID()."\"" : "") ?>>
check_view_access($this, array('action'=>'info'))) { ?>
getID()."\"" : "") ?>>
columnEnd(); $this->columnStart(6); ?> check_view_access($this, array('action'=>'form'))) { ?>
getID()."\"" : "") ?>>
columnEnd(); $this->rowEnd(); $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ }