diff --git a/include/class.forms.php b/include/class.forms.php index be6c35e5b92509c216948a1780b34917db4c1b95..38cb31ef7639550239107deea6c818599ab9501b 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -2576,6 +2576,8 @@ class TextboxWidget extends Widget { $classes = 'class="'.$config['classes'].'"'; if (isset($config['autocomplete'])) $autocomplete = 'autocomplete="'.($config['autocomplete']?'on':'off').'"'; + if (isset($config['autofocus'])) + $autofocus = 'autofocus'; if (isset($config['disabled'])) $disabled = 'disabled="disabled"'; if (isset($config['translatable']) && $config['translatable']) @@ -2594,7 +2596,7 @@ class TextboxWidget extends Widget { id="<?php echo $this->id; ?>" <?php echo implode(' ', array_filter(array( $size, $maxlength, $classes, $autocomplete, $disabled, - $translatable, $placeholder))); ?> + $translatable, $placeholder, $autofocus))); ?> name="<?php echo $this->name; ?>" value="<?php echo Format::htmlchars($this->value); ?>"/> <?php diff --git a/include/class.search.php b/include/class.search.php index b319b0a587bfa08b6f5acf8f4a3a1a7cca38fe76..5caecbd0d2dcb68052f68ae2321a32fda1c06b4a 100644 --- a/include/class.search.php +++ b/include/class.search.php @@ -644,6 +644,7 @@ class SavedSearch extends VerySimpleModel { 'configuration' => array( 'size' => 40, 'length' => 400, + 'autofocus' => true, 'classes' => 'full-width headline', 'placeholder' => __('Keywords — Optional'), ), diff --git a/include/staff/templates/advanced-search.tmpl.php b/include/staff/templates/advanced-search.tmpl.php index 57e9a510e69d60c706c10f81a2f778c9d1b6d8b4..0217be16b7f986a975ab0b3cbc70e801317379f0 100644 --- a/include/staff/templates/advanced-search.tmpl.php +++ b/include/staff/templates/advanced-search.tmpl.php @@ -56,12 +56,12 @@ foreach ($matches as $name => $fields) { ?> </dt> <dd> <span> - <button onclick="javascript:$(this).closest('form').attr({ + <button type="button" onclick="javascript:$(this).closest('form').attr({ 'method': 'get', 'action': '#tickets/search/<?php echo $S->id; ?>'});"><i class="icon-chevron-left"></i> Load</button> <?php if ($thisstaff->isAdmin()) { ?> <button><i class="icon-bullhorn"></i> <?php echo __('Publish'); ?></button> <?php } ?> - <button onclick="javascript: + <button type="button" onclick="javascript: $.ajax({ url: 'ajax.php/tickets/search/<?php echo $S->id; ?>', type: 'POST', @@ -77,7 +77,7 @@ return false; "><i class="icon-save"></i> <?php echo __('Update'); ?></button> </span> <span class="pull-right"> - <button title="<?php echo __('Delete'); ?>" onclick="javascript: + <button type="button" title="<?php echo __('Delete'); ?>" onclick="javascript: if (!confirm(__('You sure?'))) return false; var that = this; $.ajax({ @@ -142,7 +142,8 @@ return false; <div id="search-hint" class="pull-left"> </div> <div class="buttons pull-right"> - <button class="button" id="do_search"><i class="icon-search"></i> <?php echo __('Search'); ?></button> + <button class="button" type="submit" id="do_search"><i class="icon-search"></i> + <?php echo __('Search'); ?></button> </div> </div> diff --git a/include/staff/templates/timezone.tmpl.php b/include/staff/templates/timezone.tmpl.php index 840940b0ce92d9019847096d73334f4aa936a225..edc834050ae8825153abc30524e910a9d00f5764 100644 --- a/include/staff/templates/timezone.tmpl.php +++ b/include/staff/templates/timezone.tmpl.php @@ -16,7 +16,7 @@ $TZ_TIMEZONE = @$TZ_TIMEZONE ?: ''; ?>><?php echo str_replace('/',' / ',$zone); ?></option> <?php } ?> </select> - <button class="action-button" onclick="javascript: + <button type="button" class="action-button" onclick="javascript: $('head').append($('<script>').attr('src', '<?php echo ROOT_PATH; ?>js/jstz.min.js')); var recheck = setInterval(function() { diff --git a/scp/js/scp.js b/scp/js/scp.js index e3c36457e34990ece2d093844ddffc64a2788fc8..fd1017184f8de2ba684aaecc66e4a43ed169e8d8 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -634,6 +634,7 @@ $.dialog = function (url, codes, cb, options) { queue: false, complete: function() { if (options.onshow) options.onshow(); } }); + $("input[autofocus]:visible:enabled:first", $popup).focus(); var submit_button = null; $(document).off('.dialog'); $(document).on('click.dialog',