new type API
This commit is contained in:
parent
50468a1fef
commit
ed31fe6dd4
|
@ -1,4 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace LAM\TOOLS\PDF_EDITOR;
|
||||||
|
use \htmlTable;
|
||||||
|
use \htmlTitle;
|
||||||
|
use \htmlStatusMessage;
|
||||||
|
use \LAMCfgMain;
|
||||||
|
use \htmlSubTitle;
|
||||||
|
use \htmlSelect;
|
||||||
|
use \htmlImage;
|
||||||
|
use \htmlSpacer;
|
||||||
|
use \htmlButton;
|
||||||
|
use \htmlLink;
|
||||||
|
use \htmlOutputText;
|
||||||
|
use \htmlInputFileUpload;
|
||||||
|
use \htmlHelpLink;
|
||||||
|
use \htmlInputField;
|
||||||
|
use \htmlHiddenInput;
|
||||||
|
use \htmlDiv;
|
||||||
/*
|
/*
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
@ -70,19 +87,20 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
|
||||||
|
|
||||||
// check if new template should be created
|
// check if new template should be created
|
||||||
if(isset($_POST['createNewTemplate'])) {
|
if(isset($_POST['createNewTemplate'])) {
|
||||||
metaRefresh('pdfpage.php?type=' . htmlspecialchars($_POST['scope']));
|
metaRefresh('pdfpage.php?type=' . htmlspecialchars($_POST['typeId']));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$scopes = $_SESSION['config']->get_ActiveTypes();
|
$typeManager = new \LAM\TYPES\TypeManager();
|
||||||
$sortedScopes = array();
|
$types = $typeManager->getConfiguredTypes();
|
||||||
for ($i = 0; $i < sizeof($scopes); $i++) {
|
$sortedTypes = array();
|
||||||
if (isAccountTypeHidden($scopes[$i]) || !checkIfWriteAccessIsAllowed($scopes[$i])) {
|
foreach ($types as $type) {
|
||||||
|
if ($type->isHidden() || !checkIfWriteAccessIsAllowed($type->getId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$sortedScopes[$scopes[$i]] = LAM\TYPES\getTypeAlias($scopes[$i]);
|
$sortedTypes[$type->getId()] = $type->getAlias();
|
||||||
}
|
}
|
||||||
natcasesort($sortedScopes);
|
natcasesort($sortedTypes);
|
||||||
|
|
||||||
$container = new htmlTable();
|
$container = new htmlTable();
|
||||||
$container->addElement(new htmlTitle(_('PDF editor')), true);
|
$container->addElement(new htmlTitle(_('PDF editor')), true);
|
||||||
|
@ -90,12 +108,12 @@ $container->addElement(new htmlTitle(_('PDF editor')), true);
|
||||||
if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) {
|
if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) {
|
||||||
// delete structure
|
// delete structure
|
||||||
if (deletePDFStructureDefinition($_POST['profileDeleteType'], $_POST['profileDeleteName'])) {
|
if (deletePDFStructureDefinition($_POST['profileDeleteType'], $_POST['profileDeleteName'])) {
|
||||||
$message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
$message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), \LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
||||||
$message->colspan = 10;
|
$message->colspan = 10;
|
||||||
$container->addElement($message, true);
|
$container->addElement($message, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
$message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), \LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
|
||||||
$message->colspan = 10;
|
$message->colspan = 10;
|
||||||
$container->addElement($message, true);
|
$container->addElement($message, true);
|
||||||
}
|
}
|
||||||
|
@ -104,12 +122,12 @@ if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) {
|
||||||
if (isset($_POST['importexport']) && ($_POST['importexport'] === '1')) {
|
if (isset($_POST['importexport']) && ($_POST['importexport'] === '1')) {
|
||||||
$cfg = new LAMCfgMain();
|
$cfg = new LAMCfgMain();
|
||||||
$impExpMessage = null;
|
$impExpMessage = null;
|
||||||
if (isset($_POST['importProfiles_' . $_POST['scope']])) {
|
if (isset($_POST['importProfiles_' . $_POST['typeId']])) {
|
||||||
// check master password
|
// check master password
|
||||||
if (!$cfg->checkPassword($_POST['passwd_' . $_POST['scope']])) {
|
if (!$cfg->checkPassword($_POST['passwd_' . $_POST['typeId']])) {
|
||||||
$impExpMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!'));
|
$impExpMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!'));
|
||||||
}
|
}
|
||||||
elseif (copyPdfProfiles($_POST['importProfiles_' . $_POST['scope']], $_POST['scope'])) {
|
elseif (copyPdfProfiles($_POST['importProfiles_' . $_POST['typeId']], $_POST['typeId'])) {
|
||||||
$impExpMessage = new htmlStatusMessage('INFO', _('Import successful'));
|
$impExpMessage = new htmlStatusMessage('INFO', _('Import successful'));
|
||||||
}
|
}
|
||||||
} else if (isset($_POST['exportProfiles'])) {
|
} else if (isset($_POST['exportProfiles'])) {
|
||||||
|
@ -117,7 +135,7 @@ if (isset($_POST['importexport']) && ($_POST['importexport'] === '1')) {
|
||||||
if (!$cfg->checkPassword($_POST['passwd'])) {
|
if (!$cfg->checkPassword($_POST['passwd'])) {
|
||||||
$impExpMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!'));
|
$impExpMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!'));
|
||||||
}
|
}
|
||||||
elseif (copyPdfProfiles($_POST['exportProfiles'], $_POST['scope'], $_POST['destServerProfiles'])) {
|
elseif (copyPdfProfiles($_POST['exportProfiles'], $_POST['typeId'], $_POST['destServerProfiles'])) {
|
||||||
$impExpMessage = new htmlStatusMessage('INFO', _('Export successful'));
|
$impExpMessage = new htmlStatusMessage('INFO', _('Export successful'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,24 +159,26 @@ if (isset($_POST['delLogo'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get list of account types
|
// get list of account types
|
||||||
$availableScopes = '';
|
$availableTypes = array();
|
||||||
$templateClasses = array();
|
$templateClasses = array();
|
||||||
foreach ($sortedScopes as $scope => $title) {
|
foreach ($sortedTypes as $typeId => $title) {
|
||||||
|
$type = $typeManager->getConfiguredType($typeId);
|
||||||
$templateClasses[] = array(
|
$templateClasses[] = array(
|
||||||
'scope' => $scope,
|
'typeId' => $type->getId(),
|
||||||
|
'scope' => $type->getScope(),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'templates' => "");
|
'templates' => "");
|
||||||
$availableScopes[$title] = $scope;
|
$availableTypes[$title] = $type->getId();
|
||||||
}
|
}
|
||||||
// get list of templates for each account type
|
// get list of templates for each account type
|
||||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||||
$templateClasses[$i]['templates'] = getPDFStructureDefinitions($templateClasses[$i]['scope']);
|
$templateClasses[$i]['templates'] = getPDFStructureDefinitions($templateClasses[$i]['typeId']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if a template should be edited
|
// check if a template should be edited
|
||||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||||
if (isset($_POST['editTemplate_' . $templateClasses[$i]['scope']]) || isset($_POST['editTemplate_' . $templateClasses[$i]['scope'] . '_x'])) {
|
if (isset($_POST['editTemplate_' . $templateClasses[$i]['typeId']]) || isset($_POST['editTemplate_' . $templateClasses[$i]['typeId'] . '_x'])) {
|
||||||
metaRefresh('pdfpage.php?type=' . htmlspecialchars($templateClasses[$i]['scope']) . '&edit=' . htmlspecialchars($_POST['template_' . $templateClasses[$i]['scope']]));
|
metaRefresh('pdfpage.php?type=' . htmlspecialchars($templateClasses[$i]['typeId']) . '&edit=' . htmlspecialchars($_POST['template_' . $templateClasses[$i]['typeId']]));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,13 +196,13 @@ include '../main_header.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// new template
|
// new template
|
||||||
if (!empty($availableScopes)) {
|
if (!empty($availableTypes)) {
|
||||||
$container->addElement(new htmlSubTitle(_('Create a new PDF structure')), true);
|
$container->addElement(new htmlSubTitle(_('Create a new PDF structure')), true);
|
||||||
$newPDFContainer = new htmlTable();
|
$newPDFContainer = new htmlTable();
|
||||||
$newScopeSelect = new htmlSelect('scope', $availableScopes);
|
$newProfileSelect = new htmlSelect('typeId', $availableTypes);
|
||||||
$newScopeSelect->setHasDescriptiveElements(true);
|
$newProfileSelect->setHasDescriptiveElements(true);
|
||||||
$newScopeSelect->setWidth('15em');
|
$newProfileSelect->setWidth('15em');
|
||||||
$newPDFContainer->addElement($newScopeSelect);
|
$newPDFContainer->addElement($newProfileSelect);
|
||||||
$newPDFContainer->addElement(new htmlSpacer('10px', null));
|
$newPDFContainer->addElement(new htmlSpacer('10px', null));
|
||||||
$newPDFContainer->addElement(new htmlButton('createNewTemplate', _('Create')));
|
$newPDFContainer->addElement(new htmlButton('createNewTemplate', _('Create')));
|
||||||
$container->addElement($newPDFContainer, true);
|
$container->addElement($newPDFContainer, true);
|
||||||
|
@ -203,29 +223,29 @@ include '../main_header.php';
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$existingContainer->addElement(new htmlOutputText($templateClasses[$i]['title']));
|
$existingContainer->addElement(new htmlOutputText($templateClasses[$i]['title']));
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$select = new htmlSelect('template_' . $templateClasses[$i]['scope'], $templateClasses[$i]['templates']);
|
$select = new htmlSelect('template_' . $templateClasses[$i]['typeId'], $templateClasses[$i]['templates']);
|
||||||
$select->setWidth('15em');
|
$select->setWidth('15em');
|
||||||
$existingContainer->addElement($select);
|
$existingContainer->addElement($select);
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$exEditButton = new htmlButton('editTemplate_' . $templateClasses[$i]['scope'], 'edit.png', true);
|
$exEditButton = new htmlButton('editTemplate_' . $templateClasses[$i]['typeId'], 'edit.png', true);
|
||||||
$exEditButton->setTitle(_('Edit'));
|
$exEditButton->setTitle(_('Edit'));
|
||||||
$existingContainer->addElement($exEditButton);
|
$existingContainer->addElement($exEditButton);
|
||||||
$deleteLink = new htmlLink(null, '#', '../../graphics/delete.png');
|
$deleteLink = new htmlLink(null, '#', '../../graphics/delete.png');
|
||||||
$deleteLink->setTitle(_('Delete'));
|
$deleteLink->setTitle(_('Delete'));
|
||||||
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['scope'] . "', '" . 'template_' . $templateClasses[$i]['scope'] . "');");
|
$deleteLink->setOnClick("profileShowDeleteDialog('" . _('Delete') . "', '" . _('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['typeId'] . "', '" . 'template_' . $templateClasses[$i]['typeId'] . "');");
|
||||||
$existingContainer->addElement($deleteLink);
|
$existingContainer->addElement($deleteLink);
|
||||||
|
|
||||||
if (count($configProfiles) > 1) {
|
if (count($configProfiles) > 1) {
|
||||||
$importLink = new htmlLink(null, '#', '../../graphics/import.png');
|
$importLink = new htmlLink(null, '#', '../../graphics/import.png');
|
||||||
$importLink->setTitle(_('Import PDF structures'));
|
$importLink->setTitle(_('Import PDF structures'));
|
||||||
$importLink->setOnClick("showDistributionDialog('" . _("Import PDF structures") . "', '" .
|
$importLink->setOnClick("showDistributionDialog('" . _("Import PDF structures") . "', '" .
|
||||||
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['scope'] . "', 'import');");
|
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['typeId'] . "', 'import');");
|
||||||
$existingContainer->addElement($importLink);
|
$existingContainer->addElement($importLink);
|
||||||
}
|
}
|
||||||
$exportLink = new htmlLink(null, '#', '../../graphics/export.png');
|
$exportLink = new htmlLink(null, '#', '../../graphics/export.png');
|
||||||
$exportLink->setTitle(_('Export PDF structure'));
|
$exportLink->setTitle(_('Export PDF structure'));
|
||||||
$exportLink->setOnClick("showDistributionDialog('" . _("Export PDF structure") . "', '" .
|
$exportLink->setOnClick("showDistributionDialog('" . _("Export PDF structure") . "', '" .
|
||||||
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['scope'] . "', 'export', '" . 'template_' . $templateClasses[$i]['scope'] . "', '" . $_SESSION['config']->getName() . "');");
|
_('Ok') . "', '" . _('Cancel') . "', '" . $templateClasses[$i]['typeId'] . "', 'export', '" . 'template_' . $templateClasses[$i]['typeId'] . "', '" . $_SESSION['config']->getName() . "');");
|
||||||
$existingContainer->addElement($exportLink);
|
$existingContainer->addElement($exportLink);
|
||||||
$existingContainer->addNewLine();
|
$existingContainer->addNewLine();
|
||||||
}
|
}
|
||||||
|
@ -263,11 +283,11 @@ include '../main_header.php';
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
for ($i = 0; $i < sizeof($templateClasses); $i++) {
|
||||||
$scope = $templateClasses[$i]['scope'];
|
$typeId = $templateClasses[$i]['typeId'];
|
||||||
$tmpArr = array();
|
$tmpArr = array();
|
||||||
foreach ($configProfiles as $profile) {
|
foreach ($configProfiles as $profile) {
|
||||||
if ($profile != $_SESSION['config']->getName()) {
|
if ($profile != $_SESSION['config']->getName()) {
|
||||||
$accountProfiles = getPDFStructureDefinitions($scope, $profile);
|
$accountProfiles = getPDFStructureDefinitions($typeId, $profile);
|
||||||
for ($p = 0; $p < sizeof($accountProfiles); $p++) {
|
for ($p = 0; $p < sizeof($accountProfiles); $p++) {
|
||||||
$tmpArr[$profile][$accountProfiles[$p]] = $profile . '##' . $accountProfiles[$p];
|
$tmpArr[$profile][$accountProfiles[$p]] = $profile . '##' . $accountProfiles[$p];
|
||||||
}
|
}
|
||||||
|
@ -275,13 +295,13 @@ include '../main_header.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//import dialog
|
//import dialog
|
||||||
echo "<div id=\"importDialog_$scope\" class=\"hidden\">\n";
|
echo "<div id=\"importDialog_$typeId\" class=\"hidden\">\n";
|
||||||
echo "<form id=\"importDialogForm_$scope\" method=\"post\" action=\"pdfmain.php\">\n";
|
echo "<form id=\"importDialogForm_$typeId\" method=\"post\" action=\"pdfmain.php\">\n";
|
||||||
|
|
||||||
$container = new htmlTable();
|
$container = new htmlTable();
|
||||||
$container->addElement(new htmlOutputText(_('PDF structures')), true);
|
$container->addElement(new htmlOutputText(_('PDF structures')), true);
|
||||||
|
|
||||||
$select = new htmlSelect('importProfiles_' . $scope, $tmpArr, array(), count($tmpArr, 1) < 15 ? count($tmpArr, 1) : 15);
|
$select = new htmlSelect('importProfiles_' . $typeId, $tmpArr, array(), count($tmpArr, 1) < 15 ? count($tmpArr, 1) : 15);
|
||||||
$select->setMultiSelect(true);
|
$select->setMultiSelect(true);
|
||||||
$select->setHasDescriptiveElements(true);
|
$select->setHasDescriptiveElements(true);
|
||||||
$select->setContainsOptgroups(true);
|
$select->setContainsOptgroups(true);
|
||||||
|
@ -293,12 +313,12 @@ include '../main_header.php';
|
||||||
$container->addElement(new htmlSpacer(null, '10px'), true);
|
$container->addElement(new htmlSpacer(null, '10px'), true);
|
||||||
|
|
||||||
$container->addElement(new htmlOutputText(_("Master password")), true);
|
$container->addElement(new htmlOutputText(_("Master password")), true);
|
||||||
$exportPasswd = new htmlInputField('passwd_' . $scope);
|
$exportPasswd = new htmlInputField('passwd_' . $typeId);
|
||||||
$exportPasswd->setIsPassword(true);
|
$exportPasswd->setIsPassword(true);
|
||||||
$container->addElement($exportPasswd);
|
$container->addElement($exportPasswd);
|
||||||
$container->addElement(new htmlHelpLink('236'));
|
$container->addElement(new htmlHelpLink('236'));
|
||||||
$container->addElement(new htmlHiddenInput('importexport', '1'));
|
$container->addElement(new htmlHiddenInput('importexport', '1'));
|
||||||
$container->addElement(new htmlHiddenInput('scope', $scope), true);
|
$container->addElement(new htmlHiddenInput('typeId', $typeId), true);
|
||||||
addSecurityTokenToMetaHTML($container);
|
addSecurityTokenToMetaHTML($container);
|
||||||
|
|
||||||
parseHtml(null, $container, array(), false, $tabindex, 'user');
|
parseHtml(null, $container, array(), false, $tabindex, 'user');
|
||||||
|
|
|
@ -1,10 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace LAM\TOOLS\PDF_EDITOR;
|
||||||
|
use \htmlTable;
|
||||||
|
use \htmlTitle;
|
||||||
|
use \htmlTableExtendedInputField;
|
||||||
|
use \htmlSpacer;
|
||||||
|
use \htmlTableExtendedSelect;
|
||||||
|
use \htmlButton;
|
||||||
|
use \htmlOutputText;
|
||||||
|
use \htmlGroup;
|
||||||
|
use \htmlSelect;
|
||||||
|
use \htmlInputField;
|
||||||
|
use \htmlSubTitle;
|
||||||
|
use \htmlFieldset;
|
||||||
|
use \htmlInputTextarea;
|
||||||
|
use \htmlHiddenInput;
|
||||||
/*
|
/*
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2006 Michael Duergner
|
Copyright (C) 2003 - 2006 Michael Duergner
|
||||||
2007 - 2015 Roland Gruber
|
2007 - 2016 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -66,15 +81,17 @@ if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write $_POST variables to $_GET when form was submitted via post
|
// Write $_POST variables to $_GET when form was submitted via post
|
||||||
if(isset($_POST['type'])) {
|
if (isset($_POST['type'])) {
|
||||||
$_GET = $_POST;
|
$_GET = $_POST;
|
||||||
if($_POST['pdfname'] == '') {
|
if ($_POST['pdfname'] == '') {
|
||||||
unset($_GET['pdfname']);
|
unset($_GET['pdfname']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAccountTypeHidden($_GET['type']) || !checkIfWriteAccessIsAllowed($_GET['type'])) {
|
$typeManager = new \LAM\TYPES\TypeManager();
|
||||||
logNewMessage(LOG_ERR, 'User tried to access hidden PDF structure: ' . $_GET['type']);
|
$type = $typeManager->getConfiguredType($_GET['type']);
|
||||||
|
if ($type->isHidden() || !checkIfWriteAccessIsAllowed($type->getId())) {
|
||||||
|
logNewMessage(LOG_ERR, 'User tried to access hidden PDF structure: ' . $type->getId());
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +129,7 @@ if(isset($_GET['submit'])) {
|
||||||
$saveErrors[] = array('ERROR', _('PDF structure name not valid'), _('The name for that PDF-structure you submitted is not valid. A valid name must consist of the following characters: \'a-z\',\'A-Z\',\'0-9\',\'_\',\'-\'.'));
|
$saveErrors[] = array('ERROR', _('PDF structure name not valid'), _('The name for that PDF-structure you submitted is not valid. A valid name must consist of the following characters: \'a-z\',\'A-Z\',\'0-9\',\'_\',\'-\'.'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return = savePDFStructureDefinitions($_GET['type'],$_GET['pdfname']);
|
$return = savePDFStructureDefinitions($type->getId(), $_GET['pdfname']);
|
||||||
if($return == 'ok') {
|
if($return == 'ok') {
|
||||||
metaRefresh('pdfmain.php?savedSuccessfully=' . $_GET['pdfname']);
|
metaRefresh('pdfmain.php?savedSuccessfully=' . $_GET['pdfname']);
|
||||||
exit;
|
exit;
|
||||||
|
@ -339,14 +356,14 @@ foreach ($_GET as $key => $value) {
|
||||||
if(!isset($_SESSION['currentPDFStructure'])) {
|
if(!isset($_SESSION['currentPDFStructure'])) {
|
||||||
// Load structure file to be edit
|
// Load structure file to be edit
|
||||||
if(isset($_GET['edit'])) {
|
if(isset($_GET['edit'])) {
|
||||||
$load = loadPDFStructureDefinitions($_GET['type'],$_GET['edit']);
|
$load = loadPDFStructureDefinitions($type->getId(), $_GET['edit']);
|
||||||
$_SESSION['currentPDFStructure'] = $load['structure'];
|
$_SESSION['currentPDFStructure'] = $load['structure'];
|
||||||
$_SESSION['currentPageDefinitions'] = $load['page_definitions'];
|
$_SESSION['currentPageDefinitions'] = $load['page_definitions'];
|
||||||
$_GET['pdfname'] = $_GET['edit'];
|
$_GET['pdfname'] = $_GET['edit'];
|
||||||
}
|
}
|
||||||
// Load default structure file when creating a new one
|
// Load default structure file when creating a new one
|
||||||
else {
|
else {
|
||||||
$load = loadPDFStructureDefinitions($_GET['type']);
|
$load = loadPDFStructureDefinitions($type->getId());
|
||||||
$_SESSION['currentPDFStructure'] = $load['structure'];
|
$_SESSION['currentPDFStructure'] = $load['structure'];
|
||||||
$_SESSION['currentPageDefinitions'] = $load['page_definitions'];
|
$_SESSION['currentPageDefinitions'] = $load['page_definitions'];
|
||||||
}
|
}
|
||||||
|
@ -354,7 +371,7 @@ if(!isset($_SESSION['currentPDFStructure'])) {
|
||||||
|
|
||||||
// Load available fields from modules when not set in session
|
// Load available fields from modules when not set in session
|
||||||
if(!isset($_SESSION['availablePDFFields'])) {
|
if(!isset($_SESSION['availablePDFFields'])) {
|
||||||
$_SESSION['availablePDFFields'] = getAvailablePDFFields($_GET['type']);
|
$_SESSION['availablePDFFields'] = getAvailablePDFFields($type->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the values for the dropdown boxes for section headline defined by
|
// Create the values for the dropdown boxes for section headline defined by
|
||||||
|
@ -365,7 +382,7 @@ $section_items = '';
|
||||||
$sortedModules = array();
|
$sortedModules = array();
|
||||||
foreach($_SESSION['availablePDFFields'] as $module => $fields) {
|
foreach($_SESSION['availablePDFFields'] as $module => $fields) {
|
||||||
if ($module != 'main') {
|
if ($module != 'main') {
|
||||||
$title = getModuleAlias($module, $_GET['type']);
|
$title = getModuleAlias($module, $type->getScope());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$title = _('Main');
|
$title = _('Main');
|
||||||
|
@ -472,7 +489,7 @@ $structureContent = new htmlTable();
|
||||||
for ($key = 0; $key < sizeof($_SESSION['currentPDFStructure']); $key++) {
|
for ($key = 0; $key < sizeof($_SESSION['currentPDFStructure']); $key++) {
|
||||||
$entry = $_SESSION['currentPDFStructure'][$key];
|
$entry = $_SESSION['currentPDFStructure'][$key];
|
||||||
// create the up/down/remove links
|
// create the up/down/remove links
|
||||||
$linkBase = 'pdfpage.php?type=' . $_GET['type'] . '&pdfname=' . $structureName . '&headline=' . $headline . '&logoFile=' . $selectedLogo[0] . '&foldingmarks=' . $foldingMarks;
|
$linkBase = 'pdfpage.php?type=' . $type->getId() . '&pdfname=' . $structureName . '&headline=' . $headline . '&logoFile=' . $selectedLogo[0] . '&foldingmarks=' . $foldingMarks;
|
||||||
$linkUp = new htmlButton('up_' . $key, 'up.gif', true);
|
$linkUp = new htmlButton('up_' . $key, 'up.gif', true);
|
||||||
$linkUp->setTitle(_("Up"));
|
$linkUp->setTitle(_("Up"));
|
||||||
$linkDown = new htmlButton('down_' . $key, 'down.gif', true);
|
$linkDown = new htmlButton('down_' . $key, 'down.gif', true);
|
||||||
|
@ -484,7 +501,7 @@ for ($key = 0; $key < sizeof($_SESSION['currentPDFStructure']); $key++) {
|
||||||
if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
|
if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
|
||||||
$name = $entry['attributes']['NAME'];
|
$name = $entry['attributes']['NAME'];
|
||||||
if(preg_match("/^_[a-zA-Z0-9_]+_[a-zA-Z0-9_]+/",$name)) {
|
if(preg_match("/^_[a-zA-Z0-9_]+_[a-zA-Z0-9_]+/",$name)) {
|
||||||
$section_headline = translateFieldIDToName(substr($name,1), $_GET['type']);
|
$section_headline = translateFieldIDToName(substr($name,1), $type->getScope());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$section_headline = $name;
|
$section_headline = $name;
|
||||||
|
@ -496,7 +513,7 @@ for ($key = 0; $key < sizeof($_SESSION['currentPDFStructure']); $key++) {
|
||||||
if(preg_match("/^_[a-zA-Z0-9_]+_[a-zA-Z0-9_]+/",$name)) {
|
if(preg_match("/^_[a-zA-Z0-9_]+_[a-zA-Z0-9_]+/",$name)) {
|
||||||
$headlineElements = array();
|
$headlineElements = array();
|
||||||
foreach($section_items_array as $item) {
|
foreach($section_items_array as $item) {
|
||||||
$headlineElements[translateFieldIDToName($item, $_GET['type'])] = '_' . $item;
|
$headlineElements[translateFieldIDToName($item, $type->getScope())] = '_' . $item;
|
||||||
}
|
}
|
||||||
$sectionHeadlineSelect = new htmlSelect('section_' . $key, $headlineElements, array($name));
|
$sectionHeadlineSelect = new htmlSelect('section_' . $key, $headlineElements, array($name));
|
||||||
$sectionHeadlineSelect->setHasDescriptiveElements(true);
|
$sectionHeadlineSelect->setHasDescriptiveElements(true);
|
||||||
|
@ -566,7 +583,7 @@ for ($key = 0; $key < sizeof($_SESSION['currentPDFStructure']); $key++) {
|
||||||
// Get name of current entry
|
// Get name of current entry
|
||||||
$name = $entry['attributes']['NAME'];
|
$name = $entry['attributes']['NAME'];
|
||||||
$structureContent->addElement(new htmlSpacer('10px', null));
|
$structureContent->addElement(new htmlSpacer('10px', null));
|
||||||
$fieldOutput = new htmlOutputText(translateFieldIDToName($name, $_GET['type']));
|
$fieldOutput = new htmlOutputText(translateFieldIDToName($name, $type->getScope()));
|
||||||
$structureContent->addElement($fieldOutput);
|
$structureContent->addElement($fieldOutput);
|
||||||
if ($_SESSION['currentPDFStructure'][$key - 1]['tag'] != 'SECTION') {
|
if ($_SESSION['currentPDFStructure'][$key - 1]['tag'] != 'SECTION') {
|
||||||
$structureContent->addElement($linkUp);
|
$structureContent->addElement($linkUp);
|
||||||
|
@ -644,13 +661,13 @@ $cancelButton->setIconClass('cancelButton');
|
||||||
$buttonContainer->addElement($saveButton);
|
$buttonContainer->addElement($saveButton);
|
||||||
$buttonContainer->addElement($cancelButton);
|
$buttonContainer->addElement($cancelButton);
|
||||||
$buttonContainer->addElement(new htmlHiddenInput('modules', $modules));
|
$buttonContainer->addElement(new htmlHiddenInput('modules', $modules));
|
||||||
$buttonContainer->addElement(new htmlHiddenInput('type', $_GET['type']));
|
$buttonContainer->addElement(new htmlHiddenInput('type', $type->getId()));
|
||||||
|
|
||||||
$container->addElement($buttonContainer, true);
|
$container->addElement($buttonContainer, true);
|
||||||
addSecurityTokenToMetaHTML($container);
|
addSecurityTokenToMetaHTML($container);
|
||||||
|
|
||||||
$tabindex = 1;
|
$tabindex = 1;
|
||||||
parseHtml(null, $container, array(), false, $tabindex, $_GET['type']);
|
parseHtml(null, $container, array(), false, $tabindex, $type->getScope());
|
||||||
|
|
||||||
if ((sizeof($saveErrors) == 0) && isset($_POST['scrollPositionTop']) && isset($_POST['scrollPositionLeft'])) {
|
if ((sizeof($saveErrors) == 0) && isset($_POST['scrollPositionTop']) && isset($_POST['scrollPositionLeft'])) {
|
||||||
// scroll to last position
|
// scroll to last position
|
||||||
|
|
Loading…
Reference in New Issue