From 4b5108723914fec810ec72de266c12d7239218fe Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 28 Aug 2004 11:53:40 +0000 Subject: [PATCH] added/updated get_uploadColumns() --- lam/docs/modules-specification.htm | 31 +++++++++++++++++ lam/lib/baseModule.inc | 4 +-- lam/lib/modules.inc | 49 +++++++++++++++++++++++++++ lam/lib/modules/posixGroup.inc | 38 +++++++++++++++++++++ lam/lib/modules/sambaGroupMapping.inc | 24 +++++++++++++ 5 files changed, 144 insertions(+), 2 deletions(-) diff --git a/lam/docs/modules-specification.htm b/lam/docs/modules-specification.htm index f46e351a..716c5342 100644 --- a/lam/docs/modules-specification.htm +++ b/lam/docs/modules-specification.htm @@ -437,6 +437,37 @@ user to decide which fields are to be displayed on the PDF file. The format of the array to be returned is described in section 5. "PDF syntax".

+

2.2.8. get_uploadColumns

+
+ + + + + + +
function get_uploadColumns()
+
+
+Returns a list of column entries for the upload .csv-file.
+Each column entry is an array containing these values:
+ +

*: These functions do not need to be implemented if meta data is supplied. See 6 for a list of meta data diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index 14d7085b..17800976 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -342,8 +342,8 @@ class baseModule { * Syntax: *
array( *
string: name, // fixed non-translated name which is used as column name (should be of format: _) - *
string: descriptive name, // short descriptive name - *
string: help entry, // help ID + *
string: description, // short descriptive name + *
string: help, // help ID *
string: example, // example value *
boolean: required // true, if user must set a value for this column *
) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 43a9510f..b49aee15 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -340,6 +340,32 @@ function getAvailableScopes() { return array('user','group','host'); } +/** +* Returns an array containing all input columns for the file upload. +* +* Syntax: +*
array( +*
string: name, // fixed non-translated name which is used as column name (should be of format: _) +*
string: description, // short descriptive name +*
string: help, // help ID +*
string: example, // example value +*
boolean: required // true, if user must set a value for this column +*
) +* +* @param string $scope account type +* @return array column list +*/ +function get_uploadColumns($scope) { + // create new account container if needed + if (! isset($_SESSION["profile_account_$scope"])) { + $_SESSION["profile_account_$scope"] = new accountContainer($scope, "profile_account_$scope"); + $_SESSION["profile_account_$scope"]->new_account(); + } + // get options + return $_SESSION["profile_account_$scope"]->get_uploadColumns(); +} + + /** * This class includes all modules and attributes of an account. * @@ -1186,5 +1212,28 @@ class accountContainer { } return $return; } + + /** + * Returns an array containing all input columns for the file upload. + * + * Syntax: + *
array( + *
string: name, // fixed non-translated name which is used as column name (should be of format: _) + *
string: description, // short descriptive name + *
string: help, // help ID + *
string: example, // example value + *
boolean: required // true, if user must set a value for this column + *
) + * + * @return array column list + */ + function get_uploadColumns() { + $return = array(); + foreach($this->module as $moduleName => $module) { + $return[$moduleName] = $module->get_uploadColumns(); + } + return $return; + } + } ?> \ No newline at end of file diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index ae4cfa22..b7a64e81 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -126,6 +126,44 @@ class posixGroup extends baseModule { 'gidNumber', 'memberUid', 'description'); + // upload fields + $return['upload_columns'] = array( + array( + 'name' => 'posixGroup_cn', + 'description' => _('Group name'), + 'help' => 'TODO', + 'example' => _('adminstrators'), + 'required' => true + ), + array( + 'name' => 'posixGroup_gid', + 'description' => _('GID number'), + 'help' => 'TODO', + 'example' => _('2034'), + 'required' => false + ), + array( + 'name' => 'posixGroup_description', + 'description' => _('Group description'), + 'help' => 'TODO', + 'example' => _('Administrators group'), + 'required' => false + ), + array( + 'name' => 'posixGroup_members', + 'description' => _('Group members'), + 'help' => 'TODO', + 'example' => _('user01,user02,user03'), + 'required' => false + ), + array( + 'name' => 'posixGroup_password', + 'description' => _('Group password'), + 'help' => 'TODO', + 'example' => _('secret'), + 'required' => false + ) + ); return $return; } diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 5ff45d24..a530cc2b 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -73,6 +73,30 @@ class sambaGroupMapping extends baseModule { 'displayName', 'sambaGroupType', 'description'); + // upload fields + $return['upload_columns'] = array( + array( + 'name' => 'sambaGroupMapping_domain', + 'description' => _('Samba 3 domain name'), + 'help' => 'TODO', + 'example' => _('domain1'), + 'required' => true + ), + array( + 'name' => 'sambaGroupMapping_name', + 'description' => _('Samba 3 display name'), + 'help' => 'TODO', + 'example' => _('Domain administrators'), + 'required' => false + ), + array( + 'name' => 'sambaGroupMapping_rid', + 'description' => _('Samba 3 rid number'), + 'help' => 'TODO', + 'example' => 'DOMAIN_ADMINS', + 'required' => false + ) + ); return $return; }