Skip to content
Snippets Groups Projects
Commit 7bfc50cf authored by Jared Hancock's avatar Jared Hancock
Browse files

i18n: Make secondary languages sortable

Also fix syntax error preventing deletes and drop the [manage all phrases]
feature for now.
parent 4d8a41ab
No related branches found
No related tags found
No related merge requests found
...@@ -848,11 +848,8 @@ class OsticketConfig extends Config { ...@@ -848,11 +848,8 @@ class OsticketConfig extends Config {
} }
function getSecondaryLanguages() { function getSecondaryLanguages() {
static $langs = null; $langs = $this->get('secondary_langs');
if (!isset($langs)) { $langs = (is_string($langs)) ? explode(',', $langs) : array();
$langs = $this->get('secondary_langs');
$langs = (is_string($langs)) ? explode(',', $langs) : array();
}
return array_filter($langs); return array_filter($langs);
} }
......
...@@ -226,29 +226,27 @@ $gmtime = Misc::gmtime(); ...@@ -226,29 +226,27 @@ $gmtime = Misc::gmtime();
</tr> </tr>
<tr> <tr>
<td style="vertical-align:top;padding-top:4px;"><?php echo __('Secondary Languages'); ?>:</td> <td style="vertical-align:top;padding-top:4px;"><?php echo __('Secondary Languages'); ?>:</td>
<td><table><?php <td><div id="secondary_langs" style="width: 300px"><?php
foreach ($cfg->getSecondaryLanguages() as $lang) { ?> foreach ($cfg->getSecondaryLanguages() as $lang) { ?>
<tr><td style="border:none;"> <div class="secondary_lang" style="cursor:move">
<i class="icon-sort"></i>
<?php echo Internationalization::getLanguageDescription($lang); ?> <?php echo Internationalization::getLanguageDescription($lang); ?>
<input type="hidden" name="secondary_langs[]" value="<?php echo $lang; ?>"/> <input type="hidden" name="secondary_langs[]" value="<?php echo $lang; ?>"/>
</td><td style="border:none;"> <div class="pull-right">
&nbsp;
<a href="#<?php echo $lang; ?>" onclick="javascript: <a href="#<?php echo $lang; ?>" onclick="javascript:
if (confirm('<?php echo __('You sure?'); ?>'))) { if (confirm('<?php echo __('You sure?'); ?>')) {
$(this).closest('form').find('input[name=\'secondary_langs[]\'][value=' $(this).closest('.secondary_lang')
+ $(this).attr('href').substr(1) + ']').val(''); .find('input').remove();
$(this).closest('tr').remove(); $(this).closest('.secondary_lang').slideUp();
} }
return false; return false;
"><i class="icon-trash"></i></a> "><i class="icon-trash"></i></a>
&nbsp; </div>
&nbsp; </div>
<a href="#" onclick="javascript:
return false;
"><?php echo __('manage all phrases'); ?></a>
</td></tr>
<?php } ?> <?php } ?>
</table> <script type="text/javascript">
</script>
</div>
<i class="icon-plus-sign"></i>&nbsp; <i class="icon-plus-sign"></i>&nbsp;
<select name="add_secondary_language"> <select name="add_secondary_language">
<option value="">&mdash; <?php echo __('Add a Language'); ?> &mdash;</option> <option value="">&mdash; <?php echo __('Add a Language'); ?> &mdash;</option>
...@@ -262,7 +260,7 @@ $gmtime = Misc::gmtime(); ...@@ -262,7 +260,7 @@ $gmtime = Misc::gmtime();
?>><?php echo Internationalization::getLanguageDescription($l['code']); ?></option> ?>><?php echo Internationalization::getLanguageDescription($l['code']); ?></option>
<?php } ?> <?php } ?>
</select> </select>
<span class="error">&nbsp;<?php echo $errors['add_secondary_langyage']; ?></span> <span class="error">&nbsp;<?php echo $errors['add_secondary_language']; ?></span>
<i class="help-tip icon-question-sign" href="#secondary_language"></i> <i class="help-tip icon-question-sign" href="#secondary_language"></i>
</td></tr> </td></tr>
</tbody> </tbody>
...@@ -276,6 +274,9 @@ $gmtime = Misc::gmtime(); ...@@ -276,6 +274,9 @@ $gmtime = Misc::gmtime();
<link rel="stylesheet" href="<?php echo ROOT_PATH; ?>/css/jquery.multiselect.filter.css"/> <link rel="stylesheet" href="<?php echo ROOT_PATH; ?>/css/jquery.multiselect.filter.css"/>
<script type="text/javascript" src="<?php echo ROOT_PATH; ?>/js/jquery.multiselect.filter.min.js"></script> <script type="text/javascript" src="<?php echo ROOT_PATH; ?>/js/jquery.multiselect.filter.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$('#secondary_langs').sortable({
cursor: 'move'
});
$('#timezone-dropdown').multiselect({ $('#timezone-dropdown').multiselect({
multiple: false, multiple: false,
header: <?php echo JsonDataEncoder::encode(__('Time Zones')); ?>, header: <?php echo JsonDataEncoder::encode(__('Time Zones')); ?>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment