new type API

This commit is contained in:
Roland Gruber 2017-05-20 10:55:26 +02:00
parent 824d3df9f9
commit d3d6dfc032
12 changed files with 34 additions and 70 deletions

View File

@ -19,6 +19,7 @@
@ -69,6 +70,9 @@ This is a list of API changes for all LAM releases.
<li>getManagedAttributes()</li>
<li>getLDAPAliases() <br>
</li>
<li>get_uploadColumns()<br>
</li>
</ul>
<li>baseType-&gt;doUploadPostActions(): new parameter $selectedModules<br>
</li>

View File

@ -1,6 +1,7 @@
<?php
use \LAM\PDF\PDFLabelValue;
use \LAM\PDF\PDFTable;
use LAM\TYPES\ConfiguredType;
/*
$Id$
@ -856,11 +857,12 @@ abstract class baseModule {
* <br> )
*
* @param array $selectedModules list of selected account modules
* @param ConfiguredType $type account type
* @return array column list
*
* @see baseModule::get_metaData()
*/
public function get_uploadColumns($selectedModules) {
public function get_uploadColumns($selectedModules, &$type) {
if (isset($this->meta['upload_columns'])) return $this->meta['upload_columns'];
else return array();
}

View File

@ -455,7 +455,7 @@ function getUploadColumns(&$type, $selectedModules) {
$return = array();
for ($i = 0; $i < sizeof($selectedModules); $i++) {
$module = moduleCache::getModule($selectedModules[$i], $type->getScope());
$return[$selectedModules[$i]] = $module->get_uploadColumns($selectedModules);
$return[$selectedModules[$i]] = $module->get_uploadColumns($selectedModules, $type);
}
return $return;
}

View File

@ -248,22 +248,11 @@ class account extends baseModule {
}
/**
* Returns an array containing all input columns for the file upload.
*
* Syntax:
* <br> array(
* <br> string: name, // fixed non-translated name which is used as column name (should be of format: <module name>_<column name>)
* <br> string: description, // short descriptive name
* <br> string: help, // help ID
* <br> string: example, // example value
* <br> boolean: required // true, if user must set a value for this column
* <br> )
*
* @param array $selectedModules list of selected account modules
* @return array column list
* {@inheritDoc}
* @see baseModule::get_uploadColumns()
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
if (!in_array('posixAccount', $selectedModules)) {
$return[] = array(
'name' => 'account_uid',

View File

@ -2136,8 +2136,8 @@ class inetOrgPerson extends baseModule implements passwordService {
* {@inheritDoc}
* @see baseModule::getManagedAttributes()
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
// cn and uid for upload (only if posixAccount is not selected)
if (!$this->isUnixActive($selectedModules)) {
$return[] = array(

View File

@ -331,8 +331,8 @@ class kolabGroup extends baseModule {
* {@inheritDoc}
* @see baseModule::getManagedAttributes()
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
if ($this->manageMail($selectedModules)) {
$return[] = array(
'name' => 'kolabGroup_mail',

View File

@ -2106,8 +2106,8 @@ class posixAccount extends baseModule implements passwordService {
* {@inheritDoc}
* @see baseModule::getManagedAttributes()
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
if (($this->get_scope() == 'user') && $this->manageCn($selectedModules)) {
array_unshift($return['upload_columns'], array(
'name' => 'posixAccount_cn',

View File

@ -55,8 +55,8 @@ class posixGroup extends baseModule implements passwordService {
* {@inheritDoc}
* @see baseModule::getManagedAttributes()
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
if ($this->manageCnAndDescription($selectedModules)) {
array_unshift($return,
array(

View File

@ -379,8 +379,8 @@ class pykotaGroup extends baseModule {
* {@inheritDoc}
* @see baseModule::getManagedAttributes()
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
if ($this->isUnixOrGonInactive($selectedModules)) {
$return[] = array(
'name' => 'pykotaGroup_cn',

View File

@ -733,8 +733,8 @@ class pykotaUser extends baseModule {
* {@inheritDoc}
* @see baseModule::getManagedAttributes()
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
if ($this->manageUid($selectedModules)) {
$return[] = array(
'name' => 'pykotaUser_uid',

View File

@ -655,21 +655,10 @@ class quota extends baseModule {
}
/**
* Returns an array containing all input columns for the file upload.
*
* Syntax:
* <br> array(
* <br> string: name, // fixed non-translated name which is used as column name (should be of format: <module name>_<column name>)
* <br> string: description, // short descriptive name
* <br> string: help, // help ID
* <br> string: example, // example value
* <br> boolean: required // true, if user must set a value for this column
* <br> )
*
* @param array $selectedModules list of selected account modules
* @return array column list
* {@inheritDoc}
* @see baseModule::get_uploadColumns()
*/
function get_uploadColumns($selectedModules) {
function get_uploadColumns($selectedModules, &$type) {
$this->initQuotas();
if (!isset($this->quota) || !is_array($this->quota)) return array();
$return = array();

View File

@ -213,31 +213,11 @@ class sambaGroupMapping extends baseModule {
}
/**
* Returns an array containing all input columns for the file upload.
*
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br>
* <br>
* This funtion returns an array which contains subarrays which represent an upload column.
* <b>Syntax of column arrays:</b>
* <br>
* <br> array(
* <br> string: name, // fixed non-translated name which is used as column name (should be of format: <module name>_<column name>)
* <br> string: description, // short descriptive name
* <br> string: help, // help ID
* <br> string: example, // example value
* <br> string: values, // possible input values (optional)
* <br> string: default, // default value (optional)
* <br> boolean: required // true, if user must set a value for this column
* <br> boolean: unique // true if all values of this column must be different values (optional, default: "false")
* <br> )
*
* @param array $selectedModules list of selected account modules
* @return array column list
*
* @see baseModule::get_metaData()
* {@inheritDoc}
* @see baseModule::get_uploadColumns()
*/
public function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
public function get_uploadColumns($selectedModules, &$type) {
$return = parent::get_uploadColumns($selectedModules, $type);
$domains = $this->getDomains();
$domainNames = array();
for ($i = 0; $i < sizeof($domains); $i++) $domainNames[] = $domains[$i]->name;