diff --git a/libraries/Console.php b/libraries/Console.php index f066d6fb3e..a419cef0ad 100644 --- a/libraries/Console.php +++ b/libraries/Console.php @@ -96,7 +96,7 @@ class Console return Template::get('console/bookmark_content') ->render( array( - 'welcomeMessage' => $welcomeMessage, + 'welcome_message' => $welcomeMessage, 'bookmarks' => $bookmarks, ) ); @@ -132,10 +132,10 @@ class Console return Template::get('console/display') ->render( array( - 'cfgBookmark' => $cfgBookmark, - 'image' => $image, - '_sql_history' => $_sql_history, - 'bookmarkContent' => $bookmarkContent, + 'cfg_bookmark' => $cfgBookmark, + 'image' => $image, + 'sql_history' => $_sql_history, + 'bookmark_content' => $bookmarkContent, ) ); } diff --git a/templates/console/bookmark_content.phtml b/templates/console/bookmark_content.phtml deleted file mode 100644 index 6ef5d00e96..0000000000 --- a/templates/console/bookmark_content.phtml +++ /dev/null @@ -1,31 +0,0 @@ -
- -
- - - diff --git a/templates/console/bookmark_content.twig b/templates/console/bookmark_content.twig new file mode 100644 index 0000000000..259edbf50a --- /dev/null +++ b/templates/console/bookmark_content.twig @@ -0,0 +1,25 @@ +
+ {{ welcome_message }} +
+{% for bookmark in bookmarks %} + +{% endfor %} diff --git a/templates/console/display.phtml b/templates/console/display.phtml deleted file mode 100644 index 098c9ff2ff..0000000000 --- a/templates/console/display.phtml +++ /dev/null @@ -1,227 +0,0 @@ -
-
- - render( - array( - 'parent_div_classes' => 'collapsed', - 'content_array' => [ - ['switch_button console_switch', __('Console'),'image'=> $image], - ['button clear', __('Clear')], - ['button history', __('History')], - ['button options', __('Options')], - isset($cfgBookmark) - ? ['button bookmarks', __('Bookmarks')] : null, - ['button debug hide', __('Debug SQL')], - ], - ) - ); - ?> - - -
-
-
- - - - - - -
- - - -
-
- -
-
- -
- -
- render( - array( - 'parent_div_classes' => '', - 'content_array' => [ - ['button order order_asc', __('ascending')], - ['button order order_desc', __('descending')], - ['text', __('Order:')], - ['switch_button', __('Debug SQL')], - ['button order_by sort_count', __('Count')], - ['button order_by sort_exec', __('Execution order')], - ['button order_by sort_time', __('Time taken')], - ['text', __('Order by:')], - ['button group_queries', __('Group queries')], - ['button ungroup_queries', __('Ungroup queries')], - ] - ) - ); - ?> -
-
-
-
-
- render( - array( - 'parent_div_classes' => 'debug_query action_content', - 'content_array' => [ - ['action collapse', __('Collapse')], - ['action expand', __('Expand')], - ['action dbg_show_trace', __('Show trace')], - ['action dbg_hide_trace', __('Hide trace')], - ['text count hide', __('Count'), 'extraSpan' => ''], - ['text time', __('Time taken'), 'extraSpan' => ''], - ] - ) - ); - ?> -
-
- -
- render( - array( - 'parent_div_classes' => '', - 'content_array' => [ - ['switch_button', __('Bookmarks')], - ['button refresh', __('Refresh')], - ['button add', __('Add')], - ] - ) - ); - ?> -
- -
-
-
- render( - array( - 'parent_div_classes' => '', - 'content_array' => [ - ['switch_button', __('Add bookmark')] - ] - ) - ); - ?> -
-
- - - - -
-
- -
-
-
-
- - -
- render( - array( - 'parent_div_classes' => '', - 'content_array' => [ - ['switch_button', __('Options')], - ['button default', __('Set default')] - ] - ) - ); - ?> -
- -
- -
- -
- -
- -
-
-
-
- - render( - array( - 'parent_div_classes' => 'query_actions', - 'content_array' => [ - ['action collapse', __('Collapse')], - ['action expand', __('Expand')], - ['action requery', __('Requery')], - ['action edit', __('Edit')], - ['action explain', __('Explain')], - ['action profiling', __('Profiling')], - isset($cfgBookmark) - ? ['action bookmark', __('Bookmark')] : null, - ['text failed', __('Query failed')], - ['text targetdb', __('Database'), 'extraSpan' => ''], - ['text query_time', __('Queried time'), 'extraSpan' => ''], - ], - ) - ); - ?> -
-
-
diff --git a/templates/console/display.twig b/templates/console/display.twig new file mode 100644 index 0000000000..e371898412 --- /dev/null +++ b/templates/console/display.twig @@ -0,0 +1,192 @@ +
+
+ {# Console toolbar #} + {% include 'console/toolbar.twig' with { + 'parent_div_classes': 'collapsed', + 'content_array': [ + {0: 'switch_button console_switch', 1: 'Console'|trans, 'image': image}, + ['button clear', 'Clear'|trans], + ['button history', 'History'|trans], + ['button options', 'Options'|trans], + cfg_bookmark is defined ? ['button bookmarks', 'Bookmarks'|trans] : null, + ['button debug hide', 'Debug SQL'|trans] + ] + } only %} + {# Console messages #} +
+
+
+ + {% trans 'Press Ctrl+Enter to execute query' %} + + + {% trans 'Press Enter to execute query' %} + +
+ {% if sql_history is not empty %} + {% for record in sql_history|reverse %} + + {% endfor %} + {% endif %} +
+
+ +
+
+ {# Drak the console with other cards over it #} +
+ {# Debug SQL card #} +
+ {% include 'console/toolbar.twig' with { + 'parent_div_classes': '', + 'content_array': [ + ['button order order_asc', 'ascending'|trans], + ['button order order_desc', 'descending'|trans], + ['text', 'Order:'|trans], + ['switch_button', 'Debug SQL'|trans], + ['button order_by sort_count', 'Count'|trans], + ['button order_by sort_exec', 'Execution order'|trans], + ['button order_by sort_time', 'Time taken'|trans], + ['text', 'Order by:'|trans], + ['button group_queries', 'Group queries'|trans], + ['button ungroup_queries', 'Ungroup queries'|trans] + ] + } only %} +
+
+
+
+
+ {% include 'console/query_action.twig' with { + 'parent_div_classes': 'debug_query action_content', + 'content_array': [ + ['action collapse', 'Collapse'|trans], + ['action expand', 'Expand'|trans], + ['action dbg_show_trace', 'Show trace'|trans], + ['action dbg_hide_trace', 'Hide trace'|trans], + ['text count hide', 'Count'|trans], + ['text time', 'Time taken'|trans] + ] + } only %} +
+
+ {% if cfg_bookmark %} +
+ {% include 'console/toolbar.twig' with { + 'parent_div_classes': '', + 'content_array': [ + ['switch_button', 'Bookmarks'|trans], + ['button refresh', 'Refresh'|trans], + ['button add', 'Add'|trans] + ] + } only %} +
+ {{ bookmark_content }} +
+
+
+ {% include 'console/toolbar.twig' with { + 'parent_div_classes': '', + 'content_array': [ + ['switch_button', 'Add bookmark'|trans] + ] + } only %} +
+
+ + + + +
+
+ +
+
+
+
+ {% endif %} + {# Options card #} +
+ {% include 'console/toolbar.twig' with { + 'parent_div_classes': '', + 'content_array': [ + ['switch_button', 'Options'|trans], + ['button default', 'Set default'|trans] + ] + } only %} +
+ +
+ +
+ +
+ +
+ +
+
+
+
+ {# Templates for console message actions #} + {% include 'console/query_action.twig' with { + 'parent_div_classes': 'query_actions', + 'content_array': [ + ['action collapse', 'Collapse'|trans], + ['action expand', 'Expand'|trans], + ['action requery', 'Requery'|trans], + ['action edit', 'Edit'|trans], + ['action explain', 'Explain'|trans], + ['action profiling', 'Profiling'|trans], + cfg_bookmark is defined ? ['action bookmark', 'Bookmark'|trans] : null, + ['text failed', 'Query failed'|trans], + ['text targetdb', 'Database'|trans], + ['text query_time', 'Queried time'|trans] + ] + } only %} +
+
+