From c1735aecc6384fdd38b033c597d9b0488fe14c08 Mon Sep 17 00:00:00 2001 From: duergner Date: Sun, 30 May 2004 13:43:42 +0000 Subject: [PATCH] added getPDFEntries in sambaSamAccount; first step of pdf structure editor implementet; there is no functionallity at this point. Just a litte bit of graphic. --- lam/config/pdf-structure.xml | 3 +- lam/lib/config.inc | 2 +- lam/lib/modules.inc | 26 +++ lam/lib/modules/sambaSamAccount.inc | 20 +- lam/lib/pdfstruct.inc | 58 ++++++ lam/templates/main_header.php | 24 ++- lam/templates/pdfedit/pdfmain.php | 252 +++++++++++++++++++++++ lam/templates/pdfedit/pdfpage.php | 300 ++++++++++++++++++++++++++++ 8 files changed, 665 insertions(+), 20 deletions(-) create mode 100644 lam/lib/pdfstruct.inc create mode 100644 lam/templates/pdfedit/pdfmain.php create mode 100644 lam/templates/pdfedit/pdfpage.php diff --git a/lam/config/pdf-structure.xml b/lam/config/pdf-structure.xml index 4de08ffd..f8dddfd6 100644 --- a/lam/config/pdf-structure.xml +++ b/lam/config/pdf-structure.xml @@ -1,6 +1,6 @@ - +
@@ -41,7 +41,6 @@
-
diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 1717a861..d6809b74 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -825,7 +825,7 @@ class Config { } // returns text for user PDF files - function get_pdftext($name = "User") { + function get_pdftext($name = "user") { if ($this->pdftext) return $this->pdftext; else return ""; } diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 0bafe9a3..d1c4bef2 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -198,6 +198,17 @@ function getHelp($module,$helpID) { return call_user_func(array($module, "get_help"), $helpID); } +// $scope = user, group, host, ... +function getAvailablePDFFields($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"]->getAvailablePDFFields(); +} + class accountContainer { // Constructor @@ -988,5 +999,20 @@ class accountContainer { } return $return; } + + // Dummy implementation + function getAvailablePDFFields() { + $return = array(); + foreach($this->module as $key => $value) { + $fields = array(); + if(is_array($value->attributes)) { + foreach($value->attributes as $field_key => $field_value) { + $fields[] = $field_key; + } + } + $return[$key] = $fields; + } + return $return; + } } ?> \ No newline at end of file diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index a6798157..b8aa7c95 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -715,13 +715,19 @@ class sambaSamAccount { return array(); } - function get_pdfEntries($account_type = "User") { - return array( 'sambaDomainName' => array('' . _('Domain') . '' . $this->attributes['sambaDomainName'][0] . ''), - 'sambaHomeDrive' => array('' . _('Home drive') . '' . $this->attributes['sambaHomeDrive'][0] . ''), - 'sambaHomePath' => array('' . _('Home path') . '' . $this->attributes['sambaHomePath'][0] . ''), - 'sambaProfilePath' => array('' . _('Profile path') . '' . $this->attributes['sambaProfilePath'][0] . ''), - 'sambaLogonScript' => array('' . _('Login script') . '' . $this->attributes['sambaScriptPath'][0] . ''), - 'sambaUserWorkstations' => array('' . _('Samba workstations') . '' . $this->attributes['sambaUserWorkstations'][0] . '')); + function get_pdfEntries($account_type = "user") { + echo "sambaSamAccount:\n"; + print_r($this->attributes); + return array( 'sambaSamAccount_displayName' => array('' . _('Display name') . 'attributes['displayName'][0] . ''), + 'sambaSamAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''), + 'sambaSamAccount_sambaHomePath' => array('' . _('Home path') . '' . $this->attributes['sambaHomeDrive'][0] . ''), + 'sambaSamAccount_sambaHomeDrive' => array('' . _('Home drive') . '' . $this->attributes['sambaHomePath'][0] . ''), + 'sambaSamAccount_sambaLogonScript' => array('' . _('Logon script') . '' . $this->attributes['sambaLogonScript'][0] . ''), + 'sambaSamAccount_sambaProfilePath' => array('' . _('Profile path') . '' . $this->attributes['sambaProfilePath'][0] . ''), + 'sambaSamAccount_sambaUserWorkstations' => array('' . _('Samba workstations') . '' . $this->attributes['sambaUserWorkstations'][0] . ''), + 'sambaSamAccount_sambaDomainName' => array('' . _('Domain') . '' . $this->attributes['sambaDomainName'][0] . ''), + 'sambaSamAccount_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . ''), + 'sambaSamAccount_sambaPrimaryGroupSID' => array('' . _('Windows group') . '' . $this->attributes['sambaPrimaryGroupSID'][0] . '')); } } diff --git a/lam/lib/pdfstruct.inc b/lam/lib/pdfstruct.inc new file mode 100644 index 00000000..d0b1dc4f --- /dev/null +++ b/lam/lib/pdfstruct.inc @@ -0,0 +1,58 @@ +parse($_SESSION['lampath'] . 'config/pdf/' . $scope . '/' . $definition); + + $border = array(); + $structure = array(); + $pdf_entries = $xml[1]['PDF']; + $border[$current] = array(); + while(($index = current($pdf_entries)) != null) { + if($xml[0][$index]['attributes']['TYPE'] == $scope) { + $border['start'] = $index; + next($pdf_entries); + $border['end'] = current($pdf_entries); + } + next($pdf_entries); + } + $structure = array_slice($xml[0],$border['start'] + 1,$border['end'] - ($border['start'] + 1)); + return $structure; +} +?> \ No newline at end of file diff --git a/lam/templates/main_header.php b/lam/templates/main_header.php index 8fb4405b..5fe4dfd2 100644 --- a/lam/templates/main_header.php +++ b/lam/templates/main_header.php @@ -45,20 +45,24 @@ if ($_SESSION['config']->get_Hostsuffix() != "") $lists++; - + \n"; + echo " - - - - - - - - + server()) { + metaRefresh("../login.php"); + exit; +} + + +// check if user has pressed submit or abort button +if ($_POST['forward'] == "yes") { + // on abort go back to main page + if ($_POST['abort']) { + metaRefresh("../lists/listusers.php"); + } + // on submit forward to other pdf structure pages + else if($_POST['submit']) { + // create new user pdf structure + if ($_POST['pdf'] == "new_user") { + metaRefresh("pdfpage.php?type=user"); + } + // edit user pdf structure + elseif($_POST['pdf'] == "edit_user") { + metaRefresh("pdfpage.php?type=user&edit=" . $_POST['edit_user']); + } + // delete user pdf structure + elseif($_POST['pdf'] == "delete_user") { + metaRefresh("pdfdelete.php?type=user&delete=" . $_POST['delete_user']); + } + // create new group pdf structure + elseif ($_POST['pdf'] == "new_group") { + metaRefresh("pdfpage.php?type=group"); + } + // edit group pdf structure + elseif($_POST['pdf'] == "edit_group") { + metaRefresh("pdfpage.php?type=group&edit=" . $_POST['edit_group']); + } + // delete group pdf structure + elseif($_POST['pdf'] == "delete_group") { + metaRefresh("pdfdelete.php?type=group&delete=" . $_POST['delete_group']); + } + // create new host pdf structure + elseif ($_POST['pdf'] == "new_host") { + metaRefresh("pdfpage.php?type=host"); + } + // edit host pdf structure + elseif($_POST['pdf'] == "edit_host") { + metaRefresh("pdfpage.php?type=host&edit=" . $_POST['edit_host']); + } + // delete host pdf structure + elseif($_POST['pdf'] == "delete_host") { + metaRefresh("pdfdelete.php?type=host&delete=" . $_POST['delete_host']); + } + } + exit; +} + +// Get available user PDF structure definitions +$pdfStructDefs = getPDFStructureDefinitions('user'); +$user_pdf = ''; +for($i = 0;$i < count($pdfStructDefs); $i++) { + $user_pdf .= '\n"; +} + +// Get available group PDF structure definitions +$pdfStructDefs = getPDFStructureDefinitions('group'); +$group_pdf = ''; +for($i = 0;$i < count($pdfStructDefs); $i++) { + $group_pdf .= '\n"; +} + +// Get available host PDF structure definitions +$pdfStructDefs = getPDFStructureDefinitions('host'); +$host_pdf = ''; +for($i = 0;$i < count($pdfStructDefs); $i++) { + $host_pdf .= '\n"; +} + +echo $_SESSION['header']; +?> + LDAP Account Manager + + + +

+ + +
+ + + +
+ + + + + + + + + +
+
\n"; ?> LDAP Account Manager
+ + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + +
+ +

+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + +
+
+

+ + +
+ + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + +
+
+ + +

+ + + "> + "> +

+ + + + \ No newline at end of file diff --git a/lam/templates/pdfedit/pdfpage.php b/lam/templates/pdfedit/pdfpage.php new file mode 100644 index 00000000..abe8f3cc --- /dev/null +++ b/lam/templates/pdfedit/pdfpage.php @@ -0,0 +1,300 @@ +server()) { + metaRefresh("../login.php"); + exit; +} + +if($_GET['edit']) { + $currentStructure = loadPDFStructureDefinitions($_GET['type'],$_GET['edit']); +} +else { + $currentStructure = loadPDFStructureDefinitions($_GET['type']); +} + +$availableFields = getAvailablePDFFields($_GET['type']); + +// print header +echo $_SESSION['header']; +?> + LDAP Account Manager + + + +
+
+ + + + + + + + +
+
+ + + + +\n\t\t\t\t\t\t\t\t\t\t" . _('Up') . "\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n"; + $uplink = 'pdfpage.php?type=' . $_GET['type'] . '&up=' . $i . (($_GET['edit']) ? 'edit=' . $_GET['edit'] : ''); + $downlink = 'pdfpage.php?type=' . $_GET['type'] . '&down=' . urlencode($entry['tag']) . (($_GET['edit']) ? 'edit=' . $_GET['edit'] : ''); + // We have a new section to start + if($entry['tag'] == "SECTION" && $entry['type'] == "open") { + $name = $entry['attributes']['NAME']; + if(preg_match("/^\_[a-zA-Z\_]+/",$name)) { + $section_headline = substr($name,1); + } + else { + $section_headline = $name; + } + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t" . _('Down') . "\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t" . _('Remove') . "\n\t\t\t\t\t\t\t\t\t
+ + + + +
+
+
+ + + +
+ + + +
+ + + +
+ + + +
+ + + + +
+
+
+ + +
+ + + + + $fields) { + ?> + + + + + + + + + + + +
+ +
+ + +
+
+
+
+
+

 

+ + + + + + + + + + + + + + +
+ : + + + + +
+   +
+ "> + + "> + "> + +   +
+ +
+ + + \ No newline at end of file