diff --git a/assets/default/css/theme.css b/assets/default/css/theme.css index e50724e19283d088aceb3acfd64cf4feb51acc8a..cac01b19b6937fb30bf9b687cd9e7aef7d553896 100644 --- a/assets/default/css/theme.css +++ b/assets/default/css/theme.css @@ -300,9 +300,20 @@ body { height: 71px; padding: 0 20px; } -#header #logo { - width: 220px; - height: 71px; +#logo { + height: 100%; +} +#header #logo img { + max-height: 65px; + max-width: 380px; + width: auto; + height: auto; + vertical-align: middle; +} +.valign-helper { + height: 100%; + display: inline-block; + vertical-align: middle; } #header p { width: 400px; diff --git a/include/class.config.php b/include/class.config.php index 3683399be0e6f0f0a7d37785c9ed89f4c2447f1a..e61c068140e396ed989afae21757797e90d7e714 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -1017,6 +1017,13 @@ class OsticketConfig extends Config { return $this->getLogoId('client'); } + function getStaffLogoId() { + return $this->getLogoId('staff'); + } + function getStaffLogo() { + return $this->getLogo('staff'); + } + function updatePagesSettings($vars, &$errors) { global $ost; @@ -1060,6 +1067,9 @@ class OsticketConfig extends Config { 'client_logo_id' => ( (is_numeric($vars['selected-logo']) && $vars['selected-logo']) ? $vars['selected-logo'] : false), + 'staff_logo_id' => ( + (is_numeric($vars['selected-logo-scp']) && $vars['selected-logo-scp']) + ? $vars['selected-logo-scp'] : false), )); } diff --git a/include/class.file.php b/include/class.file.php index 340f4a63d44bfe870b52adbdeca7110575230a4f..99da8c53a51325965befbef3757b85d44673d86b 100644 --- a/include/class.file.php +++ b/include/class.file.php @@ -293,7 +293,7 @@ class AttachmentFile { } /* Function assumes the files types have been validated */ - function upload($file, $ft='T') { + function upload($file, $ft='T', $deduplicate=true) { if(!$file['name'] || $file['error'] || !is_uploaded_file($file['tmp_name'])) return false; @@ -309,10 +309,10 @@ class AttachmentFile { 'tmp_name'=>$file['tmp_name'], ); - return AttachmentFile::save($info, $ft); + return AttachmentFile::save($info, $ft, $deduplicate); } - function uploadLogo($file, &$error, $aspect_ratio=3) { + function uploadLogo($file, &$error, $aspect_ratio=2) { /* Borrowed in part from * http://salman-w.blogspot.com/2009/04/crop-to-fit-image-using-aspphp.html */ @@ -337,13 +337,13 @@ class AttachmentFile { $source_aspect_ratio = $source_width / $source_height; if ($source_aspect_ratio >= $aspect_ratio) - return self::upload($file, 'L'); + return self::upload($file, 'L', false); $error = __('Image is too square. Upload a wider image'); return false; } - function save(&$file, $ft='T') { + function save(&$file, $ft='T', $deduplicate=true) { if (isset($file['data'])) { // Allow a callback function to delay or avoid reading or @@ -365,7 +365,7 @@ class AttachmentFile { // If the record exists in the database already, a file with the // same hash and size is already on file -- just return its ID - if (list($id, $key) = db_fetch_row(db_query($sql, false))) { + if ($deduplicate && (list($id, $key) = db_fetch_row(db_query($sql, false)))) { $file['key'] = $key; return $id; } diff --git a/include/client/header.inc.php b/include/client/header.inc.php index 92e9dfe13bdda7cc9ad08fc6cedb9b6f7c0d0b7b..5d369f63e3d1c744f8ad507207dfa9e883587961 100644 --- a/include/client/header.inc.php +++ b/include/client/header.inc.php @@ -51,11 +51,6 @@ if (($lang = Internationalization::getCurrentLanguage()) <body> <div id="container"> <div id="header"> - <a class="pull-left" id="logo" href="<?php echo ROOT_PATH; ?>index.php" - title="<?php echo __('Support Center'); ?>"><img src="<?php - echo ROOT_PATH; ?>logo.php" border=0 alt="<?php - echo $ost->getConfig()->getTitle(); ?>" - style="height: 5em"></a> <div class="pull-right flush-right"> <p> <?php @@ -95,6 +90,12 @@ if (($all_langs = Internationalization::availableLanguages()) } ?> </p> </div> + <a class="pull-left" id="logo" href="<?php echo ROOT_PATH; ?>index.php" + title="<?php echo __('Support Center'); ?>"> + <span class="valign-helper"></span> + <img src="<?php echo ROOT_PATH; ?>logo.php" border=0 alt="<?php + echo $ost->getConfig()->getTitle(); ?>"> + </a> </div> <div class="clear"></div> <?php diff --git a/include/staff/header.inc.php b/include/staff/header.inc.php index 60079586dfc40c86fb3a3490a1aa8a6cdc0ce97e..d1c885cf8369a9ef3cd2fe9756549f6b80bafa3f 100644 --- a/include/staff/header.inc.php +++ b/include/staff/header.inc.php @@ -61,7 +61,6 @@ if (($lang = Internationalization::getCurrentLanguage()) echo sprintf('<div id="notice_bar">%s</div>', $ost->getNotice()); ?> <div id="header"> - <a href="index.php" class="no-pjax pull-left" id="logo">osTicket — <?php echo __('Customer Support System'); ?></a> <p id="info" class="pull-right"><?php echo sprintf(__('Welcome, %s.'), '<strong>'.$thisstaff->getFirstName().'</strong>'); ?> <?php if($thisstaff->isAdmin() && !defined('ADMINPAGE')) { ?> @@ -72,6 +71,10 @@ if (($lang = Internationalization::getCurrentLanguage()) | <a href="profile.php"><?php echo __('My Preferences'); ?></a> | <a href="logout.php?auth=<?php echo $ost->getLinkToken(); ?>" class="no-pjax"><?php echo __('Log Out'); ?></a> </p> + <a href="index.php" class="no-pjax" id="logo"> + <span class="valign-helper"></span> + <img src="logo.php" alt="osTicket — <?php echo __('Customer Support System'); ?>"/> + </a> </div> <div id="pjax-container" class="<?php if ($_POST) echo 'no-pjax'; ?>"> <?php } else { diff --git a/include/staff/login.tpl.php b/include/staff/login.tpl.php index eb2bf80d05ea1a126b0975fd671719d797c097fa..b8a4a86016e84961114ab81db1104f90a606b633 100644 --- a/include/staff/login.tpl.php +++ b/include/staff/login.tpl.php @@ -3,7 +3,10 @@ include_once(INCLUDE_DIR.'staff/login.header.php'); $info = ($_POST && $errors)?Format::htmlchars($_POST):array(); ?> <div id="loginBox"> - <h1 id="logo"><a href="index.php">osTicket :: <?php echo __('Staff Control Panel');?></a></h1> + <h1 id="logo"><a href="index.php"> + <span class="valign-helper"></span> + <img src="logo.php?login" alt="osTicket :: <?php echo __('Staff Control Panel');?>" /> + </a></h1> <h3><?php echo Format::htmlchars($msg); ?></h3> <div class="banner"><small><?php echo ($content) ? Format::display($content->getBody()) : ''; ?></small></div> <form action="login.php" method="post"> diff --git a/include/staff/settings-pages.inc.php b/include/staff/settings-pages.inc.php index 3bf1c78776adc2bc90b9604175591bd3ff969202..4d9910b4e2c9e04cd5d41fc40ddde1961f0e1abf 100644 --- a/include/staff/settings-pages.inc.php +++ b/include/staff/settings-pages.inc.php @@ -107,49 +107,74 @@ $pages = Page::getPages(); <tbody> <tr> <td colspan="2"> - <label style="display:block"> +<table style="width:100%"> + <thead><tr> + <th>Client</th> + <th>Staff</th> + <th>Logo</th> + </tr></thead> + <tbody> + <tr> + <td> <input type="radio" name="selected-logo" value="0" style="margin-left: 1em" <?php if (!$ost->getConfig()->getClientLogoId()) echo 'checked="checked"'; ?>/> - <img src="../assets/default/images/logo.png" + </td><td> + <input type="radio" name="selected-logo-scp" value="0" + style="margin-left: 1em" + <?php if (!$ost->getConfig()->getStaffLogoId()) + echo 'checked="checked"'; ?>/> + </td><td> + <img src="<?php echo ROOT_PATH; ?>assets/default/images/logo.png" alt="Default Logo" valign="middle" style="box-shadow: 0 0 0.5em rgba(0,0,0,0.5); margin: 0.5em; height: 5em; vertical-align: middle"/> - </label> - </td></tr> - <tr> - <th colspan="2"> - <em><?php echo __('Use a custom logo'); ?> <i class="help-tip icon-question-sign" href="#upload_a_new_logo"></i></em> - </th> + <img src="<?php echo ROOT_PATH; ?>scp/images/ost-logo.png" + alt="Default Logo" valign="middle" + style="box-shadow: 0 0 0.5em rgba(0,0,0,0.5); + margin: 0.5em; height: 5em; + vertical-align: middle"/> + </td> </tr> - <tr><td colspan="2"> - <?php - $current = $ost->getConfig()->getClientLogoId(); - foreach (AttachmentFile::allLogos() as $logo) { ?> - <div> - <label> + <tr><th colspan="3"> + <em><?php echo __('Use a custom logo'); ?> <i class="help-tip icon-question-sign" href="#upload_a_new_logo"></i></em> + </th></tr> + <?php + $current = $ost->getConfig()->getClientLogoId(); + $currentScp = $ost->getConfig()->getStaffLogoId(); + foreach (AttachmentFile::allLogos() as $logo) { ?> + <tr> + <td> <input type="radio" name="selected-logo" style="margin-left: 1em" value="<?php echo $logo->getId(); ?>" <?php if ($logo->getId() == $current) echo 'checked="checked"'; ?>/> + </td><td> + <input type="radio" name="selected-logo-scp" + style="margin-left: 1em" value="<?php + echo $logo->getId(); ?>" <?php + if ($logo->getId() == $currentScp) + echo 'checked="checked"'; ?>/> + </td><td> <img src="<?php echo $logo->getDownloadUrl(); ?>" alt="Custom Logo" valign="middle" style="box-shadow: 0 0 0.5em rgba(0,0,0,0.5); margin: 0.5em; height: 5em; vertical-align: middle;"/> - </label> - <?php if ($logo->getId() != $current) { ?> + <?php if ($logo->getId() != $current && $logo->getId() != $currentScp) { ?> <label> <input type="checkbox" name="delete-logo[]" value="<?php echo $logo->getId(); ?>"/> <?php echo __('Delete'); ?> </label> <?php } ?> - </div> - <?php } ?> - <br/> + </td> + </tr> +<?php } ?> + </tbody> +</table> <b><?php echo __('Upload a new logo'); ?>:</b> <input type="file" name="logo[]" size="30" value="" /> <font class="error"><br/><?php echo $errors['logo']; ?></font> diff --git a/scp/css/login.css b/scp/css/login.css index 99f8f1220c1f388f52a37d8759c5ba5049566b9c..8998e38833465aea819c3106cb470bd8d2da9065 100644 --- a/scp/css/login.css +++ b/scp/css/login.css @@ -69,12 +69,21 @@ h1 { #logo a { display:block; - width:180px; - height:72px; text-decoration:none; - text-indent:-9999px; - background:url(../images/login-logo.png); - margin:0 auto 1em auto; + height: 100px; +} + +#logo a img { + max-height:72px; + max-width: 300px; + height: auto; + width: auto; + vertical-align: middle; +} +.valign-helper { + height: 100%; + display: inline-block; + vertical-align: middle; } h3 { diff --git a/scp/css/scp.css b/scp/css/scp.css index 2fe63818d17da1f6514482d6b93a69b27c96791b..27599c2690ed3876b817c3bdf958528ddd5a6c3e 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -100,12 +100,23 @@ div#header a { #logo { display:block; - width:190px; - height:76px; text-decoration:none; outline:none; - text-indent:-9999px; - background:url(../images/ost-logo.png) top left no-repeat; + height: 76px; + max-width: 400px; +} +#logo img { + max-height: 76px; + max-width: 300px; + height: auto; + width: auto; + padding-left: 10px; + vertical-align: middle; +} +.valign-helper { + height: 100%; + display: inline-block; + vertical-align: middle; } #header p { diff --git a/scp/images/header-bg.png b/scp/images/header-bg.png deleted file mode 100644 index dc3e1d5c51f1a9c7b58c5a5b8c423a0152c72767..0000000000000000000000000000000000000000 Binary files a/scp/images/header-bg.png and /dev/null differ diff --git a/scp/images/login-logo.png b/scp/images/login-logo.png deleted file mode 100644 index 6526ebe0a15f393382e0339b38cef8422d7ff471..0000000000000000000000000000000000000000 Binary files a/scp/images/login-logo.png and /dev/null differ diff --git a/scp/logo.php b/scp/logo.php new file mode 100644 index 0000000000000000000000000000000000000000..ab6bacdf50da37cd012308623c903dd3f9d1fe0b --- /dev/null +++ b/scp/logo.php @@ -0,0 +1,35 @@ +<?php +/********************************************************************* + logo.php + + Simple logo to facilitate serving a customized client-side logo from + osTicet. The logo is configurable in Admin Panel -> Settings -> Pages + + Peter Rotich <peter@osticket.com> + Jared Hancock <jared@osticket.com> + Copyright (c) 2006-2013 osTicket + http://www.osticket.com + + Released under the GNU General Public License WITHOUT ANY WARRANTY. + See LICENSE.TXT for details. + + vim: expandtab sw=4 ts=4 sts=4: +**********************************************************************/ + +// Don't update the session for inline image fetches +if (!function_exists('noop')) { function noop() {} } +session_set_save_handler('noop','noop','noop','noop','noop','noop'); +define('DISABLE_SESSION', true); + +require_once('../main.inc.php'); + +if (($logo = $ost->getConfig()->getStaffLogo())) { + $logo->display(); +} else { + if (isset($_GET['login'])) + header('Location: images/login-logo.png'); + else + header('Location: images/ost-logo.png'); +} + +?>