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>getManagedAttributes()</li>
<li>getLDAPAliases() <br> <li>getLDAPAliases() <br>
</li> </li>
<li>get_uploadColumns()<br>
</li>
</ul> </ul>
<li>baseType-&gt;doUploadPostActions(): new parameter $selectedModules<br> <li>baseType-&gt;doUploadPostActions(): new parameter $selectedModules<br>
</li> </li>

View File

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

View File

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

View File

@ -248,22 +248,11 @@ class account extends baseModule {
} }
/** /**
* Returns an array containing all input columns for the file upload. * {@inheritDoc}
* * @see baseModule::get_uploadColumns()
* Syntax: */
* <br> array( function get_uploadColumns($selectedModules, &$type) {
* <br> string: name, // fixed non-translated name which is used as column name (should be of format: <module name>_<column name>) $return = parent::get_uploadColumns($selectedModules, $type);
* <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
*/
function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
if (!in_array('posixAccount', $selectedModules)) { if (!in_array('posixAccount', $selectedModules)) {
$return[] = array( $return[] = array(
'name' => 'account_uid', 'name' => 'account_uid',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -655,21 +655,10 @@ class quota extends baseModule {
} }
/** /**
* Returns an array containing all input columns for the file upload. * {@inheritDoc}
* * @see baseModule::get_uploadColumns()
* Syntax: */
* <br> array( function get_uploadColumns($selectedModules, &$type) {
* <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
*/
function get_uploadColumns($selectedModules) {
$this->initQuotas(); $this->initQuotas();
if (!isset($this->quota) || !is_array($this->quota)) return array(); if (!isset($this->quota) || !is_array($this->quota)) return array();
$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. * {@inheritDoc}
* * @see baseModule::get_uploadColumns()
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> */
* <br> public function get_uploadColumns($selectedModules, &$type) {
* This funtion returns an array which contains subarrays which represent an upload column. $return = parent::get_uploadColumns($selectedModules, $type);
* <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()
*/
public function get_uploadColumns($selectedModules) {
$return = parent::get_uploadColumns($selectedModules);
$domains = $this->getDomains(); $domains = $this->getDomains();
$domainNames = array(); $domainNames = array();
for ($i = 0; $i < sizeof($domains); $i++) $domainNames[] = $domains[$i]->name; for ($i = 0; $i < sizeof($domains); $i++) $domainNames[] = $domains[$i]->name;