|
Lines 3-8
Link Here
|
| 3 |
[% INCLUDE 'doc-head-close.inc' %] |
3 |
[% INCLUDE 'doc-head-close.inc' %] |
| 4 |
<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/uploader.css" /> |
4 |
<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/uploader.css" /> |
| 5 |
<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" /> |
5 |
<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" /> |
|
|
6 |
<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/quotes.css" /> |
| 6 |
<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script> |
7 |
<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script> |
| 7 |
[% INCLUDE 'datatables-strings.inc' %] |
8 |
[% INCLUDE 'datatables-strings.inc' %] |
| 8 |
</script> |
9 |
</script> |
|
Lines 134-139
Link Here
|
| 134 |
for(var i=0; i<aaData.length; i++) { |
135 |
for(var i=0; i<aaData.length; i++) { |
| 135 |
aaData[i].unshift(i+1); // Add a column w/quote number |
136 |
aaData[i].unshift(i+1); // Add a column w/quote number |
| 136 |
} |
137 |
} |
|
|
138 |
|
| 139 |
|
| 140 |
/* Transition from the quote file uploader to the quote file editor interface */ |
| 141 |
$('#toolbar').css("visibility","visible"); |
| 142 |
$('#toolbar').css("position",""); |
| 143 |
$('#file_editor_inst').css("visibility", "visible"); |
| 144 |
$('#file_editor_inst').css("position", ""); |
| 145 |
$('#file_uploader_inst').css("visibility", "hidden"); |
| 137 |
$('#save_quotes').css("visibility","visible"); |
146 |
$('#save_quotes').css("visibility","visible"); |
| 138 |
$('#file_uploader').css("visibility","hidden"); |
147 |
$('#file_uploader').css("visibility","hidden"); |
| 139 |
$('#file_uploader').css("position","absolute"); |
148 |
$('#file_uploader').css("position","absolute"); |
|
Lines 141-146
Link Here
|
| 141 |
$('#quotes_editor').css("visibility","visible"); |
150 |
$('#quotes_editor').css("visibility","visible"); |
| 142 |
oSaveButton.on("click", yuiGetData); |
151 |
oSaveButton.on("click", yuiGetData); |
| 143 |
oDeleteButton.on("click", fnClickDeleteRow); |
152 |
oDeleteButton.on("click", fnClickDeleteRow); |
|
|
153 |
|
| 154 |
|
| 155 |
|
| 144 |
oTable = $('#quotes_editor').dataTable( { |
156 |
oTable = $('#quotes_editor').dataTable( { |
| 145 |
"bAutoWidth" : false, |
157 |
"bAutoWidth" : false, |
| 146 |
"bPaginate" : true, |
158 |
"bPaginate" : true, |
|
Lines 169-175
Link Here
|
| 169 |
var quoteNum = $('td', nRow)[0].innerHTML; |
181 |
var quoteNum = $('td', nRow)[0].innerHTML; |
| 170 |
$(nRow).attr("id", quoteNum); /* set row ids to quote number */ |
182 |
$(nRow).attr("id", quoteNum); /* set row ids to quote number */ |
| 171 |
$('td:eq(0)', nRow).click(function() {$(this.parentNode).toggleClass('selected',this.clicked);}); /* add row selectors */ |
183 |
$('td:eq(0)', nRow).click(function() {$(this.parentNode).toggleClass('selected',this.clicked);}); /* add row selectors */ |
| 172 |
$('td:eq(0)', nRow).attr("title", "Click ID to select/deselect quote"); |
184 |
$('td:eq(0)', nRow).attr("title", _("Click ID to select/deselect quote")); |
| 173 |
/* apply no_edit id to noEditFields */ |
185 |
/* apply no_edit id to noEditFields */ |
| 174 |
noEditFields = [0]; /* number */ |
186 |
noEditFields = [0]; /* number */ |
| 175 |
for (i=0; i<noEditFields.length; i++) { |
187 |
for (i=0; i<noEditFields.length; i++) { |
|
Lines 225-236
Link Here
|
| 225 |
var fileSizeInK = Math.round(evt.target.files[0].size/1024); |
237 |
var fileSizeInK = Math.round(evt.target.files[0].size/1024); |
| 226 |
|
238 |
|
| 227 |
if (!fileType.match(/comma-separated-values|csv|excel/i)) { |
239 |
if (!fileType.match(/comma-separated-values|csv|excel/i)) { |
| 228 |
alert('Incorrect filetype: '+fileType+'. Uploads limited to csv.'); |
240 |
alert(_('Uploads limited to csv. Incorrect filetype: ')+fileType); |
| 229 |
parent.location='quotes-upload.pl'; |
241 |
parent.location='quotes-upload.pl'; |
| 230 |
return; |
242 |
return; |
| 231 |
} |
243 |
} |
| 232 |
if (fileSizeInK > 512) { |
244 |
if (fileSizeInK > 512) { |
| 233 |
if (!confirm(evt.target.files[0].name+' is '+fileSizeInK+' K in size. Do you really want to upload this file?')) { |
245 |
if (!confirm(evt.target.files[0].name+' '+fileSizeInK+_(' KB Do you really want to upload this file?'))) { |
| 234 |
parent.location='quotes-upload.pl'; |
246 |
parent.location='quotes-upload.pl'; |
| 235 |
return; |
247 |
return; |
| 236 |
} |
248 |
} |
|
Lines 256-265
Link Here
|
| 256 |
success : function(){ |
268 |
success : function(){ |
| 257 |
var response = JSON.parse(jqXHR.responseText); |
269 |
var response = JSON.parse(jqXHR.responseText); |
| 258 |
if (response.success) { |
270 |
if (response.success) { |
| 259 |
$("#server_response").text(response.records+' quotes saved.'); |
271 |
$("#server_response").text(response.records+_(' quotes saved.')); |
| 260 |
} |
272 |
} |
| 261 |
else { |
273 |
else { |
| 262 |
$("#server_response").text('An error has occurred. '+response.records+' quotes saved. Please ask your administrator to check the server log for more details.'); |
274 |
$("#server_response").text(+response.records+_(' quotes saved, but an error has occurred. Please ask your administrator to check the server log for more details.')); |
| 263 |
} |
275 |
} |
| 264 |
$("#server_response").fadeIn(200); |
276 |
$("#server_response").fadeIn(200); |
| 265 |
}, |
277 |
}, |
|
Lines 271-279
Link Here
|
| 271 |
return this.id; |
283 |
return this.id; |
| 272 |
}).get().join(', '); |
284 |
}).get().join(', '); |
| 273 |
if (!idsToDelete) { |
285 |
if (!idsToDelete) { |
| 274 |
alert('Please select a quote(s) by clicking the quote id(s) you desire to delete.'); |
286 |
alert(_('Please select a quote(s) by clicking the quote id(s) you desire to delete.')); |
| 275 |
} |
287 |
} |
| 276 |
else if (confirm('Are you sure you wish to delete quote(s) '+idsToDelete+'?')) { |
288 |
else if (confirm(_('Are you sure you wish to delete quote(s) ')+idsToDelete+'?')) { |
| 277 |
oTable.$('.selected').each(function(){ |
289 |
oTable.$('.selected').each(function(){ |
| 278 |
oTable.fnDeleteRow(this); |
290 |
oTable.fnDeleteRow(this); |
| 279 |
}); |
291 |
}); |
|
Lines 300-315
Link Here
|
| 300 |
<div class="yui-b"> |
312 |
<div class="yui-b"> |
| 301 |
[% INCLUDE 'quotes-upload-toolbar.inc' %] |
313 |
[% INCLUDE 'quotes-upload-toolbar.inc' %] |
| 302 |
<h2>Quote uploader</h2> |
314 |
<h2>Quote uploader</h2> |
| 303 |
<fieldset id="file_uploader" class="rows" style="visibility:visible;"> |
315 |
<div id="instructions"> |
|
|
316 |
<fieldset id="file_uploader_help" class="rows"> |
| 317 |
<legend>Instructions</legend> |
| 318 |
<div id="file_uploader_inst"> |
| 319 |
<ul> |
| 320 |
<li>The quote uploader accepts standard csv files with two columns: "source","text"</li> |
| 321 |
<li>Click the "Choose File" button and select the csv file to be uploaded.</li> |
| 322 |
<li>The file will be imported into an editable table for review prior to saving.</li> |
| 323 |
</ul> |
| 324 |
</div> |
| 325 |
<div id="file_editor_inst"> |
| 326 |
<ul> |
| 327 |
<li>Click on any field to edit the contents; Press the <Enter> key to save edit.</li> |
| 328 |
<li>Click on one or more quote numbers to select entire quotes for deletion; Click the 'Delete Quote(s)' button to delete selected quotes.</li> |
| 329 |
<li>Click the 'Save Quotes' button in the toolbar to save the entire batch of quotes.</li> |
| 330 |
</ul> |
| 331 |
</div> |
| 332 |
</fieldset> |
| 333 |
</div> |
| 334 |
<fieldset id="file_uploader" class="rows"> |
| 304 |
<legend>Upload quotes</legend> |
335 |
<legend>Upload quotes</legend> |
| 305 |
<div id="file_upload" style="margin-left: 10px;"> |
336 |
<div id="file_upload"> |
| 306 |
<input type="file" name="file" /> |
337 |
<input type="file" name="file" /> |
| 307 |
<button id="cancel_upload" style="visibility:hidden;" onclick="fnAbortRead();">Cancel Upload</button> |
338 |
<button id="cancel_upload" style="visibility:hidden;" onclick="fnAbortRead();">Cancel Upload</button> |
| 308 |
<div id="progress_bar"><div class="percent">0%</div></div> |
339 |
<div id="progress_bar"><div class="percent">0%</div></div> |
| 309 |
</div> |
340 |
</div> |
| 310 |
</fieldset> |
341 |
</fieldset> |
| 311 |
<div id="server_response" onclick='fnResetUpload()'>Server Response</div> |
342 |
<div id="server_response" onclick='fnResetUpload()'>Server Response</div> |
| 312 |
<table id="quotes_editor" style="float: left; width: 100%; visibility:hidden;"> |
343 |
<table id="quotes_editor"> |
| 313 |
<thead> |
344 |
<thead> |
| 314 |
<tr> |
345 |
<tr> |
| 315 |
<th>Source</th> |
346 |
<th>Source</th> |
|
Lines 326-332
Link Here
|
| 326 |
</tr> |
357 |
</tr> |
| 327 |
</tbody> |
358 |
</tbody> |
| 328 |
</table> |
359 |
</table> |
| 329 |
<fieldset id="footer" class="action" style="visibility:hidden; height:25px"> |
360 |
<fieldset id="footer" class="action"> |
| 330 |
</fieldset> |
361 |
</fieldset> |
| 331 |
</div> |
362 |
</div> |
| 332 |
</div> |
363 |
</div> |
| 333 |
- |
|
|