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>';
// 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
$cssDirName = dirname(__FILE__) . '/../style/responsive';
$cssDir = dir($cssDirName);
@ -1552,6 +1537,21 @@ function printHeaderContents($title, $prefix) {
foreach ($cssFiles as $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="icon" href="' . $prefix . '/graphics/logo136.png">';
}

View File

@ -42,37 +42,8 @@ if (strtolower(session_module_name()) == 'files') {
setlanguage();
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>
<body class="admin">
<table class="lamTop ui-corner-all">

View File

@ -67,37 +67,8 @@ if (isset($_POST['passwd'])) {
}
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>
<body class="admin">
<?php

View File

@ -242,37 +242,8 @@ if (isset($_POST['submit'])) {
}
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>
<body class="admin">
<table border=0 width="100%" class="lamHeader ui-corner-all">
@ -288,17 +259,7 @@ echo $_SESSION['header'];
<?php
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/../lib';
$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";
}
printJsIncludes('../..');
$tabindex = 1;

View File

@ -193,46 +193,13 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
setlanguage(); // setting correct language
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>
<body class="admin" onload="focusLogin()">
<?php
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/lib';
$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";
}
printJsIncludes('..');
// upgrade if pdf/profiles contain single files
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 "}\n";
?>
jQuery(document).ready(function() {
jQuery('#loginButton').button();
});
<?php
echo "//-->\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">
<tr>
<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->setHasDescriptiveElements(true);
$userSelect->setTransformSingleSelect(false);
$userSelect->alignment = htmlElement::ALIGN_LEFT;
$row->addField($userSelect);
$row->addField(new htmlDiv(null, $userSelect));
}
else {
if ($config_object->getHttpAuthentication() == 'true') {
@ -421,7 +375,6 @@ function display_LoginPage(LAMConfig $config_object, LAMCfgMain $cfgMain, $licen
else {
$passwordInput = new htmlInputField('passwd');
$passwordInput->setIsPassword(true);
$passwordInput->setFieldSize('20px');
$row->addField($passwordInput);
}
// language

View File

@ -117,51 +117,15 @@ if (isset($_POST['submit'])) {
}
}
echo $_SESSION['header'];
printHeaderContents(_("Login"), '..');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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>
<body class="admin">
<?php
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/lib';
$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";
}
printJsIncludes('..');
?>
<table border=0 width="100%" class="lamHeader ui-corner-all">