From 6ab58406acd3b261d275c8f2d0dddde344439c41 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 21 May 2015 10:44:56 -0500 Subject: [PATCH] i18n: Fix layouts for single language systems * FAQ Articles * FAQ Categories * Access templates --- include/staff/category.inc.php | 17 +++++++++------ include/staff/faq.inc.php | 20 +++++++++++------- .../staff/templates/content-manage.tmpl.php | 21 ++++++++++++++----- scp/css/scp.css | 4 +++- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/include/staff/category.inc.php b/include/staff/category.inc.php index b73a611e9..a506b90ab 100644 --- a/include/staff/category.inc.php +++ b/include/staff/category.inc.php @@ -60,16 +60,19 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <div style="margin-top:20px"></div> -<ul class="tabs" style="margin-top:9px;"> +<ul class="tabs clean" style="margin-top:9px;"> <li class="active"><a href="#info"><?php echo __('Category Information'); ?></a></li> <li><a href="#notes"><?php echo __('Internal Notes'); ?></a></li> </ul> <div class="tab_content" id="info"> + +<table width="100%"><tr> <?php $langs = Internationalization::getConfiguredSystemLanguages(); if (count($langs) > 1) { ?> - <ul class="vertical tabs left" style="margin-top:10px;"> + <td valign="top"> + <ul class="vertical tabs left" id="trans" style="margin-top:10px;"> <li class="empty"><i class="icon-globe" title="This content is translatable"></i></li> <?php foreach ($langs as $tag=>$i) { list($lang, $locale) = explode('_', $tag); @@ -81,11 +84,12 @@ if (count($langs) > 1) { ?> </a></li> <?php } ?> </ul> + </td> <?php } ?> - +<td id="trans_container"> <?php foreach ($langs as $tag=>$i) { $code = $i['code']; $cname = 'name'; @@ -100,12 +104,12 @@ if (count($langs) > 1) { ?> $cname = "trans[$code][$cname]"; $dname = "trans[$code][$dname]"; } ?> - <div class="tab_content" style="margin:0 48px;<?php - if ($code != $cfg->getPrimaryLanguage()) echo "display:none;"; + <div class="tab_content left <?php + if ($code != $cfg->getPrimaryLanguage()) echo "hidden"; ?>" id="lang-<?php echo $tag; ?>" <?php if ($i['direction'] == 'rtl') echo 'dir="rtl" class="rtl"'; ?> > - <div style="padding:8px 0;"> + <div style="padding-bottom:8px;"> <b><?php echo __('Category Name');?></b>: <span class="error">*</span> <div class="faded"><?php echo __('Short descriptive name.');?></div> @@ -125,6 +129,7 @@ if (count($langs) > 1) { ?> echo $desc; ?></textarea> </div> <?php } ?> + </td></tr></table> </div> diff --git a/include/staff/faq.inc.php b/include/staff/faq.inc.php index 9fcde9571..89584be75 100644 --- a/include/staff/faq.inc.php +++ b/include/staff/faq.inc.php @@ -116,7 +116,7 @@ if ($topics = Topic::getAllHelpTopics()) { <div style="margin-top:20px"></div> -<ul class="tabs" style="margin-top:9px;"> +<ul class="tabs clean" style="margin-top:9px;"> <li class="active"><a href="#article"><?php echo __('Article Content'); ?></a></li> <li><a href="#attachments"><?php echo __('Attachments') . sprintf(' (%d)', $faq ? count($faq->attachments->getSeparates('')) : 0); ?></a></li> @@ -128,10 +128,12 @@ if ($topics = Topic::getAllHelpTopics()) { <?php echo __('Here you can manage the question and answer for the article. Multiple languages are available if enabled in the admin panel.'); ?> <div class="clear"></div> +<table width="100%"><tr> <?php $langs = Internationalization::getConfiguredSystemLanguages(); -if ($faq) { ?> - <ul class="vertical tabs left" style="margin-top:10px;"> +if ($faq && count($langs) > 1) { ?> +<td valign="top"> + <ul class="vertical tabs left" id="trans" style="margin-top:10px;"> <li class="empty"><i class="icon-globe" title="This content is translatable"></i></li> <?php foreach ($langs as $tag=>$i) { list($lang, $locale) = explode('_', $tag); @@ -143,9 +145,11 @@ if ($faq) { ?> </a></li> <?php } ?> </ul> +</td> <?php } ?> +<td id="trans_container"> <?php foreach ($langs as $tag=>$i) { $code = $i['code']; if ($tag == $cfg->getPrimaryLanguage()) { @@ -163,8 +167,8 @@ if ($faq) { ?> $aname = 'trans['.$code.'][answer]'; } ?> - <div class="tab_content" style="margin:0 45px;<?php - if ($code != $cfg->getPrimaryLanguage()) echo "display:none;"; + <div class="tab_content <?php + if ($code != $cfg->getPrimaryLanguage()) echo "hidden"; ?>" id="lang-<?php echo $tag; ?>" <?php if ($i['direction'] == 'rtl') echo 'dir="rtl" class="rtl"'; ?> > @@ -184,6 +188,7 @@ if ($faq) { ?> </div> <div> <textarea name="<?php echo $aname; ?>" cols="21" rows="12" + data-width="670px" class="richtext draft" <?php list($draft, $attrs) = Draft::getDraftAndDataAttrs('faq', $namespace, $answer); echo $attrs; ?>><?php echo $draft ?: $answer; @@ -192,6 +197,7 @@ echo $attrs; ?>><?php echo $draft ?: $answer; </div> </div> <?php } ?> + </td></tr></table> </div> <div class="tab_content" id="attachments" style="display:none"> @@ -226,7 +232,7 @@ echo $attrs; ?>><?php echo $draft ?: $answer; </ul> <?php foreach ($langs as $lang=>$i) { $code = $i['code']; ?> - <div class="tab_content" style="margin-left:45px" id="attachments-<?php echo $i['code']; ?>" <?php if ($i['code'] != $cfg->getPrimaryLanguage()) echo 'style="display:none;"'; ?>> + <div class="tab_content" id="attachments-<?php echo $i['code']; ?>" <?php if ($i['code'] != $cfg->getPrimaryLanguage()) echo 'style="display:none;"'; ?>> <div style="padding:0 0 9px"> <strong><?php echo sprintf(__( /* %s is the name of a language */ 'Attachments for %s'), @@ -260,5 +266,3 @@ echo $attrs; ?>><?php echo $draft ?: $answer; <input type="button" name="cancel" value="<?php echo __('Cancel'); ?>" onclick='window.location.href="faq.php?<?php echo $qstr; ?>"'> </p> </form> - -<link rel="stylesheet" type="text/css" href="<?php echo ROOT_PATH; ?>css/jquery.multiselect.css" /> diff --git a/include/staff/templates/content-manage.tmpl.php b/include/staff/templates/content-manage.tmpl.php index 9009a4e45..5ca6c82a3 100644 --- a/include/staff/templates/content-manage.tmpl.php +++ b/include/staff/templates/content-manage.tmpl.php @@ -9,10 +9,14 @@ <?php } ?> <form method="post" action="#content/<?php echo $content->getId(); ?>" style="clear:none"> + +<table> + <tr> <?php if (count($langs) > 1) { ?> - <ul class="vertical left tabs"> - <li class="empty"><i class="icon-globe" title="This content is translatable"></i></li> +<td valign="top"> + <ul class="vertical left tabs" id="content-trans"> + <li class="empty"><i class="icon-globe" title="<?php echo __('This content is translatable'); ?>"></i></li> <?php foreach ($langs as $tag=>$nfo) { ?> <li class="<?php if ($tag == $cfg->getPrimaryLanguage()) echo "active"; ?>"><a href="#translation-<?php echo $tag; ?>" title="<?php @@ -21,10 +25,13 @@ if (count($langs) > 1) { ?> </a></li> <?php } ?> </ul> +</td> <?php } ?> + +<td id="content-trans_container"> <div id="translation-<?php echo $cfg->getPrimaryLanguage(); ?>" - class="tab_content left-tabs" style="padding:0" lang="<?php echo $cfg->getPrimaryLanguage(); ?>"> + class="tab_content" style="padding:0" lang="<?php echo $cfg->getPrimaryLanguage(); ?>"> <div class="error"><?php echo $errors['name']; ?></div> <input type="text" style="width: 100%; font-size: 14pt" name="name" value="<?php echo Format::htmlchars($info['title']); ?>" spellcheck="true" @@ -42,7 +49,7 @@ if (count($langs) > 1) { ?> if ($tag == $cfg->getPrimaryLanguage()) continue; $trans = $info['trans'][$tag]; ?> - <div id="translation-<?php echo $tag; ?>" class="tab_content left-tabs" + <div id="translation-<?php echo $tag; ?>" class="tab_content" style="display:none;padding:0" dir="<?php echo $nfo['direction']; ?>" lang="<?php echo $tag; ?>"> <input type="text" style="width: 100%; font-size: 14pt" name="trans[<?php echo $tag; ?>][title]" value="<?php @@ -60,9 +67,13 @@ if (count($langs) > 1) { ?> </div> <?php } ?> - <div class="info-banner left-tabs" style="margin-top:7px"><?php + <div class="info-banner" style="margin-top:7px"><?php echo $content->getNotes(); ?></div> +</td> + </tr> +</table> + <hr class="clear"/> <p class="full-width"> <span class="buttons pull-left"> diff --git a/scp/css/scp.css b/scp/css/scp.css index 1ccde42fb..b0c9efa6a 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1011,7 +1011,7 @@ ul.tabs.vertical { } ul.tabs.vertical.left { float: left; - margin-right: 19px; + margin-right: 9px; } ul.tabs.vertical li { @@ -2003,6 +2003,8 @@ tr.disabled th { .tab_content { position: relative; +} +.tab_content:not(.left) { padding: 12px 0; } .left-tabs { -- GitLab