use central function to include CSS/JS

This commit is contained in:
Roland Gruber 2017-11-04 11:29:38 +01:00
parent 78c4043927
commit 0becd907f6
6 changed files with 25 additions and 205 deletions

View File

@ -1522,21 +1522,6 @@ function printHeaderContents($title, $prefix) {
echo '<title>'; echo '<title>';
echo $title; echo $title;
echo '</title>'; echo '</title>';
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$prefix/style/$cssEntry\">";
}
// include responsive CSS // include responsive CSS
$cssDirName = dirname(__FILE__) . '/../style/responsive'; $cssDirName = dirname(__FILE__) . '/../style/responsive';
$cssDir = dir($cssDirName); $cssDir = dir($cssDirName);
@ -1552,6 +1537,21 @@ function printHeaderContents($title, $prefix) {
foreach ($cssFiles as $cssEntry) { foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$prefix/style/responsive/$cssEntry\">"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$prefix/style/responsive/$cssEntry\">";
} }
// include all other CSS files
$cssDirName = dirname(__FILE__) . '/../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$prefix/style/$cssEntry\">";
}
echo '<link rel="shortcut icon" type="image/x-icon" href="' . $prefix . '/graphics/favicon.ico">'; echo '<link rel="shortcut icon" type="image/x-icon" href="' . $prefix . '/graphics/favicon.ico">';
echo '<link rel="icon" href="' . $prefix . '/graphics/logo136.png">'; echo '<link rel="icon" href="' . $prefix . '/graphics/logo136.png">';
} }

View File

@ -42,37 +42,8 @@ if (strtolower(session_module_name()) == 'files') {
setlanguage(); setlanguage();
echo $_SESSION['header']; echo $_SESSION['header'];
printHeaderContents(_("Configuration overview"), '../..');
?> ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
<?php
echo _("Configuration overview");
?>
</title>
<link rel="stylesheet" type="text/css" href="../../style/responsive/105_normalize.css">
<link rel="stylesheet" type="text/css" href="../../style/responsive/110_foundation.css">
<link rel="stylesheet" type="text/css" href="../../style/responsive/120_lam.css">
<?php
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/" . $cssEntry . "\">\n";
}
?>
<link rel="shortcut icon" type="image/x-icon" href="../../graphics/favicon.ico">
<link rel="icon" href="../../graphics/logo136.png">
</head> </head>
<body class="admin"> <body class="admin">
<table class="lamTop ui-corner-all"> <table class="lamTop ui-corner-all">

View File

@ -67,37 +67,8 @@ if (isset($_POST['passwd'])) {
} }
echo $_SESSION['header']; echo $_SESSION['header'];
printHeaderContents(_("Login"), '../..');
?> ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
<?php
echo _("Login");
?>
</title>
<link rel="stylesheet" type="text/css" href="../../style/responsive/105_normalize.css">
<link rel="stylesheet" type="text/css" href="../../style/responsive/110_foundation.css">
<link rel="stylesheet" type="text/css" href="../../style/responsive/120_lam.css">
<?php
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/" . $cssEntry . "\">\n";
}
?>
<link rel="shortcut icon" type="image/x-icon" href="../../graphics/favicon.ico">
<link rel="icon" href="../../graphics/logo136.png">
</head> </head>
<body class="admin"> <body class="admin">
<?php <?php

View File

@ -242,37 +242,8 @@ if (isset($_POST['submit'])) {
} }
echo $_SESSION['header']; echo $_SESSION['header'];
printHeaderContents(_("Edit general settings"), '../..');
?> ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
<?php
echo _("Edit general settings");
?>
</title>
<link rel="stylesheet" type="text/css" href="../../style/responsive/105_normalize.css">
<link rel="stylesheet" type="text/css" href="../../style/responsive/110_foundation.css">
<link rel="stylesheet" type="text/css" href="../../style/responsive/120_lam.css">
<?php
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/" . $cssEntry . "\">\n";
}
?>
<link rel="shortcut icon" type="image/x-icon" href="../../graphics/favicon.ico">
<link rel="icon" href="../../graphics/logo136.png">
</head> </head>
<body class="admin"> <body class="admin">
<table border=0 width="100%" class="lamHeader ui-corner-all"> <table border=0 width="100%" class="lamHeader ui-corner-all">
@ -288,17 +259,7 @@ echo $_SESSION['header'];
<?php <?php
// include all JavaScript files // include all JavaScript files
$jsDirName = dirname(__FILE__) . '/../lib'; printJsIncludes('../..');
$jsDir = dir($jsDirName);
$jsFiles = array();
while ($jsEntry = $jsDir->read()) {
if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue;
$jsFiles[] = $jsEntry;
}
sort($jsFiles);
foreach ($jsFiles as $jsEntry) {
echo "<script type=\"text/javascript\" src=\"../lib/" . $jsEntry . "\"></script>\n";
}
$tabindex = 1; $tabindex = 1;

View File

@ -193,46 +193,13 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
setlanguage(); // setting correct language setlanguage(); // setting correct language
echo $_SESSION["header"]; echo $_SESSION["header"];
printHeaderContents('LDAP Account Manager', '..');
?> ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LDAP Account Manager</title>
<link rel="stylesheet" type="text/css" href="../style/responsive/105_normalize.css">
<link rel="stylesheet" type="text/css" href="../style/responsive/110_foundation.css">
<link rel="stylesheet" type="text/css" href="../style/responsive/120_lam.css">
<?php
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/" . $cssEntry . "\">\n";
}
?>
<link rel="shortcut icon" type="image/x-icon" href="../graphics/favicon.ico">
<link rel="icon" href="../graphics/logo136.png">
</head> </head>
<body class="admin" onload="focusLogin()"> <body class="admin" onload="focusLogin()">
<?php <?php
// include all JavaScript files // include all JavaScript files
$jsDirName = dirname(__FILE__) . '/lib'; printJsIncludes('..');
$jsDir = dir($jsDirName);
$jsFiles = array();
while ($jsEntry = $jsDir->read()) {
if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue;
$jsFiles[] = $jsEntry;
}
sort($jsFiles);
foreach ($jsFiles as $jsEntry) {
echo "<script type=\"text/javascript\" src=\"lib/" . $jsEntry . "\"></script>\n";
}
// upgrade if pdf/profiles contain single files // upgrade if pdf/profiles contain single files
if (containsFiles('../config/profiles') || containsFiles('../config/pdf')) { if (containsFiles('../config/profiles') || containsFiles('../config/pdf')) {
@ -264,23 +231,11 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
echo "myElement.focus();\n"; echo "myElement.focus();\n";
} }
echo "}\n"; echo "}\n";
?>
jQuery(document).ready(function() {
jQuery('#loginButton').button();
});
<?php
echo "//-->\n"; echo "//-->\n";
echo "</script>\n"; echo "</script>\n";
} }
?> ?>
<script type="text/javascript">
jQuery(document).ready(function() {
var equalWidthElements = new Array('#username', '#passwd', '#language');
equalWidth(equalWidthElements);
});
</script>
<table border=0 width="100%" class="lamHeader ui-corner-all"> <table border=0 width="100%" class="lamHeader ui-corner-all">
<tr> <tr>
<td align="left" height="30"> <td align="left" height="30">
@ -393,8 +348,7 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
$userSelect = new htmlSelect('username', $adminList, $selectedAdmin); $userSelect = new htmlSelect('username', $adminList, $selectedAdmin);
$userSelect->setHasDescriptiveElements(true); $userSelect->setHasDescriptiveElements(true);
$userSelect->setTransformSingleSelect(false); $userSelect->setTransformSingleSelect(false);
$userSelect->alignment = htmlElement::ALIGN_LEFT; $row->addField(new htmlDiv(null, $userSelect));
$row->addField($userSelect);
} }
else { else {
if ($config_object->getHttpAuthentication() == 'true') { if ($config_object->getHttpAuthentication() == 'true') {
@ -421,7 +375,6 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
else { else {
$passwordInput = new htmlInputField('passwd'); $passwordInput = new htmlInputField('passwd');
$passwordInput->setIsPassword(true); $passwordInput->setIsPassword(true);
$passwordInput->setFieldSize('20px');
$row->addField($passwordInput); $row->addField($passwordInput);
} }
// language // language

View File

@ -117,51 +117,15 @@ if (isset($_POST['submit'])) {
} }
} }
?> echo $_SESSION['header'];
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> printHeaderContents(_("Login"), '..');
<html class="no-js">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<title><?php echo _("Login"); ?></title>
<link rel="stylesheet" type="text/css" href="../style/responsive/105_normalize.css">
<link rel="stylesheet" type="text/css" href="../style/responsive/110_foundation.css">
<link rel="stylesheet" type="text/css" href="../style/responsive/120_lam.css">
<?php
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/" . $cssEntry . "\">\n";
}
?> ?>
</head> </head>
<body class="admin"> <body class="admin">
<?php <?php
// include all JavaScript files // include all JavaScript files
$jsDirName = dirname(__FILE__) . '/lib'; printJsIncludes('..');
$jsDir = dir($jsDirName);
$jsFiles = array();
while ($jsEntry = $jsDir->read()) {
if (substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') continue;
$jsFiles[] = $jsEntry;
}
sort($jsFiles);
foreach ($jsFiles as $jsEntry) {
echo "<script type=\"text/javascript\" src=\"lib/" . $jsEntry . "\"></script>\n";
}
?> ?>
<table border=0 width="100%" class="lamHeader ui-corner-all"> <table border=0 width="100%" class="lamHeader ui-corner-all">