Skip to content

Commit 65cda88

Browse files
authored
Merge pull request #132 from contactashish13/issue-40
Implement accordation for chart page #40
2 parents 784088c + 744d467 commit 65cda88

File tree

6 files changed

+110
-121
lines changed

6 files changed

+110
-121
lines changed

classes/Visualizer/Module/Chart.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ private function _handleDataPage() {
329329
wp_enqueue_script( 'visualizer-render' );
330330
wp_localize_script( 'visualizer-render', 'visualizer', array(
331331
'l10n' => array(
332-
'remotecsv_prompt' => esc_html__( 'Please, enter the URL of CSV file:', 'visualizer' ),
333332
'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ),
334333
),
335334
'charts' => array(
@@ -393,7 +392,6 @@ private function _handleDataAndSettingsPage() {
393392
wp_enqueue_script( 'visualizer-render' );
394393
wp_localize_script( 'visualizer-render', 'visualizer', array(
395394
'l10n' => array(
396-
'remotecsv_prompt' => esc_html__( 'Please, enter the URL of CSV file:', 'visualizer' ),
397395
'invalid_source' => esc_html__( 'You have entered invalid URL. Please, insert proper URL.', 'visualizer' ),
398396
),
399397
'charts' => array(

classes/Visualizer/Render/Page.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ protected function _renderContent() {}
6464
*/
6565
protected function _renderSidebar() {
6666
echo '<div id="sidebar">';
67-
echo '<ul class="group-wrapper">';
6867
$this->_renderSidebarContent();
69-
echo '</ul>';
7068

7169
echo '<div id="rate-the-plugin">';
7270
echo '<div><b>', esc_html__( 'Like the plugin? Show us your love!', 'visualizer' ), '</b></div>';

classes/Visualizer/Render/Page/Data.php

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -63,63 +63,68 @@ protected function _renderSidebarContent() {
6363
'chart' => $this->chart->ID,
6464
), admin_url( 'admin-ajax.php' ) );
6565

66-
echo '<input type="button" name="back_button" class="return-settings-btn preview-btn hidden-setting" value="&laquo; Back">';
67-
echo '<div class="initial-screen">';
68-
echo '<iframe id="thehole" name="thehole"></iframe>';
69-
echo '<p class="group-description">';
70-
esc_html_e( 'Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' );
71-
echo '</p>';
72-
73-
echo '<p class="group-description">';
74-
esc_html_e( 'If you are unsure about how to format your data CSV then please take a look at this sample:', 'visualizer' );
75-
echo ' <a href="', VISUALIZER_ABSURL, 'samples/', $this->type, '.csv" target="_blank">', $this->type, '.csv</a> ';
76-
printf( esc_html__( 'or read how you can add Google spreadsheet in following %1$sarticle%1$s.', 'visualizer' ), '<a href="https://github.com/madpixelslabs/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank">', '</a>' );
77-
echo '</p>';
78-
79-
echo '<div>';
80-
echo '<form id="csv-form" action="', $upload_link, '" method="post" target="thehole" enctype="multipart/form-data">';
81-
echo '<input type="hidden" id="remote-data" name="remote_data">';
82-
echo '<div class="form-inline">';
83-
echo '<div class="button button-primary file-wrapper computer-btn">';
84-
echo '<input type="file" id="csv-file" class="file" name="local_data">';
85-
esc_attr_e( 'From Computer', 'visualizer' );
86-
echo '</div>';
87-
88-
echo '<a id="remote-file" class="button from-web from-web-btn" href="javascript:;">', esc_html__( 'From Web', 'visualizer' ), '</a>';
89-
// Added by Ash/Upwork
90-
if ( defined( 'Visualizer_Pro' ) ) {
91-
global $Visualizer_Pro;
92-
$Visualizer_Pro->_addFormElements();
93-
} else {
94-
// Added by Ash/Upwork
95-
echo '<div class="just-on-pro"> </div>';
96-
}
97-
echo '</div>';
98-
echo '</form>';
99-
100-
// added by Ash/Upwork
101-
if ( defined( 'Visualizer_Pro' ) ) {
102-
global $Visualizer_Pro;
103-
$Visualizer_Pro->_addEditorElements();
104-
} else {
10566
?>
106-
<a href="<?php echo Visualizer_Plugin::PRO_TEASER_URL;?>" title="<?php echo Visualizer_Plugin::PRO_TEASER_TITLE;?>" class="check-pro-btn" target="_new">
107-
<input type="button" class="button preview preview-btn" id="existing-chart-free" value="<?php esc_attr_e( 'Check PRO Version ', 'visualizer' );?>">
108-
</a>
67+
<iframe id="thehole" name="thehole"></iframe>
68+
<ul class="group-wrapper">
69+
<li class="group">
70+
<h2 class="group-title main-group"><?php _e( 'Chart Source', 'visualizer' );?></h2>
71+
<ul class="group-content">
72+
<ul class="group-wrapper">
73+
<li class="group">
74+
<h2 class="group-title sub-group visualizer-src-tab"><?php _e( 'Create Chart From File', 'visualizer' );?></h2>
75+
<ul class="group-content">
76+
<p class="group-description"><?php esc_html_e( 'Select and upload your data CSV file here. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).', 'visualizer' );?></p>
77+
<p class="group-description"><?php _e( sprintf( __( 'If you are unsure about how to format your data CSV then please take a look at this sample: %1$s or read how you can add Google spreadsheet in following %1$sarticle%1$s', 'visualizer' ), '<a href="' . VISUALIZER_ABSURL . 'samples/' . $this->type . '.csv" target="_blank">' . $this->type . '.csv</a>', '<a href="https://github.com/madpixelslabs/visualizer/wiki/How-can-I-populate-data-from-Google-Spreadsheet%3F" target="_blank">', '</a>' ) );?></p>
78+
<form id="csv-file-form" action="<?php echo $upload_link?>" method="post" target="thehole" enctype="multipart/form-data">
79+
<input type="hidden" id="remote-data" name="remote_data">
80+
<div class="">
81+
<input type="file" id="csv-file" name="local_data">
82+
<?php esc_attr_e( 'From Computer', 'visualizer' );?>
83+
</div>
84+
<input type="button" class="view-csv-file" value="<?php _e( 'View', 'visualizer' );?>">
85+
</form>
86+
</ul>
87+
</li>
88+
<li class="group">
89+
<h2 class="group-title sub-group visualizer-src-tab"><?php _e( 'Create Chart From URL', 'visualizer' );?></h2>
90+
<ul class="group-content">
91+
<form id="remote-file-form" action="<?php echo $upload_link?>" method="post" target="thehole" enctype="multipart/form-data">
92+
<div class="remote-file-section">
93+
<input type="url" id="remote-data" name="remote_data" placeholder="<?php esc_html_e( 'Please enter the URL of CSV file:', 'visualizer' );?>">
94+
<div class="<?php echo defined( 'Visualizer_Pro' ) ? '' : 'just-on-pro'?>"><?php _e( 'Synchronize each hour', 'visualizer' );?><input type="checkbox" id="remote-sync" name="remote-sync" value="1"></div>
95+
</div>
96+
<input type="button" class="view-remote-file" value="<?php _e( 'View', 'visualizer' );?>">
97+
</form>
98+
</ul>
99+
</li>
100+
<li class="group">
101+
<h2 class="group-title sub-group visualizer-editor-tab" data-current="chart"><?php _e( 'Add data from editor', 'visualizer' );?></h2>
102+
<ul class="group-content">
103+
<?php
104+
if ( defined( 'Visualizer_Pro' ) ) {
105+
global $Visualizer_Pro;
106+
$Visualizer_Pro->_addFormElements( $upload_link );
107+
} else {
108+
// Added by Ash/Upwork
109+
echo '<div class="just-on-pro"> </div>';
110+
}
111+
?>
112+
</ul>
113+
</li>
114+
</ul>
115+
</li>
116+
</ul>
117+
<ul class="group-wrapper">
118+
<li class="group">
119+
<h2 class="group-title main-group"><?php _e( 'Chart Settings', 'visualizer' );?></h2>
120+
<ul class="group-content">
121+
<form id="settings-form" action="<?php echo add_query_arg( 'nonce', wp_create_nonce() );?>" method="post">
122+
<?php echo $this->sidebar;?>
123+
</form>
124+
</ul>
125+
</li>
126+
</ul>
109127
<?php
110-
}
111-
112-
echo'<input type="button" name="advanced_button" class="advanced-settings-btn preview-btn" value="' . __( 'Advanced', 'visualizer' ) . ' &raquo;">';
113-
// Added by Ash/Upwork
114-
echo '</div>';
115-
echo '</div>';
116-
117-
// changed by Ash/Upwork
118-
echo '<div class= "second-screen hidden-setting">';
119-
echo '<form id="settings-form" action="', add_query_arg( 'nonce', wp_create_nonce() ), '" method="post">';
120-
echo $this->sidebar;
121-
echo '</form>';
122-
echo '</div>';
123128
// changed by Ash/Upwork
124129
}
125130

css/frame.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
}
8888

8989
.group-title:hover,
90-
.group.open .group-title {
90+
.group.open > .group-title {
9191
color: white;
9292
background: gray;
9393
background-image: -webkit-gradient(linear, left bottom, left top, from(#6d6d6d), to(gray));
@@ -114,19 +114,19 @@
114114
}
115115

116116
.group-title:hover::after,
117-
.group.open .group-title::after {
117+
.group.open > .group-title::after {
118118
border-color: #eee transparent;
119119
}
120120

121121
.group:hover .group-title {
122122
border-top-color: gray;
123123
}
124124

125-
.group.open .group-title {
125+
.group.open > .group-title {
126126
border-top-color: #6d6d6d;
127127
}
128128

129-
.group.open .group-title::after {
129+
.group.open > .group-title::after {
130130
border-width: 0 6px 6px;
131131
}
132132

@@ -142,7 +142,7 @@ div.group-content {
142142
padding: 10px 20px 20px;
143143
}
144144

145-
.group.open .group-content {
145+
.group.open > .group-content {
146146
display: block;
147147
}
148148

js/frame.js

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,33 @@
1515
if (parent.hasClass('open')) {
1616
parent.removeClass('open');
1717
} else {
18-
$('.group.open').removeClass('open');
18+
parent.parent().find('.group.open').removeClass('open');
1919
parent.addClass('open');
2020
}
2121
});
2222

23-
$('#remote-file').click(function() {
24-
var url = $.trim(prompt(visualizer.l10n.remotecsv_prompt));
23+
$('.view-remote-file').click(function() {
24+
var url = $(this).parent().find('#remote-data').val();
2525

2626
if (url !== '') {
2727
if (/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url)) {
2828
if (url.substr(url.length - 8) === '/pubhtml') {
2929
url = url.substring(0, url.length - 8) + '/export?format=csv';
3030
}
3131

32-
$('#remote-data').val(url);
33-
$('#csv-file').val('');
3432
$('#canvas').lock();
35-
$('#csv-form').submit();
33+
$(this).parent().submit();
3634
} else {
3735
alert(visualizer.l10n.invalid_source);
3836
}
3937
}
4038
});
4139

42-
$('#csv-file').change(function() {
43-
if ($.trim($(this).val()) !== '') {
44-
$('#remote-data').val('');
40+
$('.view-csv-file').click(function(e) {
41+
e.preventDefault();
42+
if ($.trim($(this).parent().find("#csv-file").val()) !== '') {
4543
$('#canvas').lock();
46-
$('#csv-form').submit();
44+
$(this).parent().submit();
4745
}
4846
});
4947

@@ -110,20 +108,4 @@
110108

111109
return $(this);
112110
};
113-
})(jQuery);
114-
115-
//Hide / show settings in sidebar
116-
(function($) {
117-
$(document).ready(function() {
118-
119-
$('.advanced-settings-btn').click(function(){
120-
$('.second-screen, .return-settings-btn').removeClass("hidden-setting");
121-
$('.initial-screen').addClass("hidden-setting");
122-
});
123-
124-
$('.return-settings-btn').click(function(){
125-
$('.second-screen, .return-settings-btn').addClass("hidden-setting");
126-
$('.initial-screen').removeClass("hidden-setting");
127-
});
128-
});
129-
})(jQuery);
111+
})(jQuery);

languages/visualizer.pot

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# This file is distributed under the GPL v2.0 or later.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Visualizer: Charts and Graphs Lite 1.7.5\n"
5+
"Project-Id-Version: Visualizer: Charts and Graphs Lite 1.7.6\n"
66
"Report-Msgid-Bugs-To: https://github.com/Codeinwp/visualizer/issues\n"
7-
"POT-Creation-Date: 2017-01-20 12:32:52+00:00\n"
7+
"POT-Creation-Date: 2017-02-23 12:58:23+00:00\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=utf-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"
@@ -102,32 +102,27 @@ msgid "Pro Addon"
102102
msgstr ""
103103

104104
#: classes/Visualizer/Module/Chart.php:332
105-
#: classes/Visualizer/Module/Chart.php:396
106-
msgid "Please, enter the URL of CSV file:"
107-
msgstr ""
108-
109-
#: classes/Visualizer/Module/Chart.php:333
110-
#: classes/Visualizer/Module/Chart.php:397
105+
#: classes/Visualizer/Module/Chart.php:395
111106
msgid "You have entered invalid URL. Please, insert proper URL."
112107
msgstr ""
113108

114-
#: classes/Visualizer/Module/Chart.php:411
109+
#: classes/Visualizer/Module/Chart.php:409
115110
msgid "Save Chart"
116111
msgstr ""
117112

118-
#: classes/Visualizer/Module/Chart.php:412
113+
#: classes/Visualizer/Module/Chart.php:410
119114
msgid "Create Chart"
120115
msgstr ""
121116

122-
#: classes/Visualizer/Module/Chart.php:414
117+
#: classes/Visualizer/Module/Chart.php:412
123118
msgid "Insert Chart"
124119
msgstr ""
125120

126-
#: classes/Visualizer/Module/Chart.php:473
121+
#: classes/Visualizer/Module/Chart.php:471
127122
msgid "CSV file with chart data was not uploaded. Please, try again."
128123
msgstr ""
129124

130-
#: classes/Visualizer/Module/Chart.php:488
125+
#: classes/Visualizer/Module/Chart.php:486
131126
msgid "CSV file is broken or invalid. Please, try again."
132127
msgstr ""
133128

@@ -173,39 +168,50 @@ msgid ""
173168
msgstr ""
174169

175170
#: classes/Visualizer/Render/Page/Data.php:70
171+
msgid "Chart Source"
172+
msgstr ""
173+
174+
#: classes/Visualizer/Render/Page/Data.php:74
175+
msgid "Create Chart From File"
176+
msgstr ""
177+
178+
#: classes/Visualizer/Render/Page/Data.php:76
176179
msgid ""
177180
"Select and upload your data CSV file here. The first row of the CSV file "
178181
"should contain the column headings. The second one should contain series "
179182
"type (string, number, boolean, date, datetime, timeofday)."
180183
msgstr ""
181184

182-
#: classes/Visualizer/Render/Page/Data.php:74
183-
msgid ""
184-
"If you are unsure about how to format your data CSV then please take a look "
185-
"at this sample:"
185+
#: classes/Visualizer/Render/Page/Data.php:82
186+
msgid "From Computer"
186187
msgstr ""
187188

188-
#: classes/Visualizer/Render/Page/Data.php:76
189-
msgid "or read how you can add Google spreadsheet in following %1$sarticle%1$s."
189+
#: classes/Visualizer/Render/Page/Data.php:84
190+
#: classes/Visualizer/Render/Page/Data.php:96
191+
msgid "View"
190192
msgstr ""
191193

192-
#: classes/Visualizer/Render/Page/Data.php:85
193-
msgid "From Computer"
194+
#: classes/Visualizer/Render/Page/Data.php:89
195+
msgid "Create Chart From URL"
196+
msgstr ""
197+
198+
#: classes/Visualizer/Render/Page/Data.php:93
199+
msgid "Please enter the URL of CSV file:"
194200
msgstr ""
195201

196-
#: classes/Visualizer/Render/Page/Data.php:88
197-
msgid "From Web"
202+
#: classes/Visualizer/Render/Page/Data.php:94
203+
msgid "Synchronize each hour"
198204
msgstr ""
199205

200-
#: classes/Visualizer/Render/Page/Data.php:107
201-
msgid "Check PRO Version "
206+
#: classes/Visualizer/Render/Page/Data.php:101
207+
msgid "Add data from editor"
202208
msgstr ""
203209

204-
#: classes/Visualizer/Render/Page/Data.php:112
205-
msgid "Advanced"
210+
#: classes/Visualizer/Render/Page/Data.php:119
211+
msgid "Chart Settings"
206212
msgstr ""
207213

208-
#: classes/Visualizer/Render/Page/Data.php:137
214+
#: classes/Visualizer/Render/Page/Data.php:142
209215
#: classes/Visualizer/Render/Page/Settings.php:55
210216
msgid "Back"
211217
msgstr ""
@@ -218,11 +224,11 @@ msgstr ""
218224
msgid "Next"
219225
msgstr ""
220226

221-
#: classes/Visualizer/Render/Page.php:72
227+
#: classes/Visualizer/Render/Page.php:70
222228
msgid "Like the plugin? Show us your love!"
223229
msgstr ""
224230

225-
#: classes/Visualizer/Render/Page.php:75
231+
#: classes/Visualizer/Render/Page.php:73
226232
msgid "Rate it on WordPress.org"
227233
msgstr ""
228234

0 commit comments

Comments
 (0)