|
Lines 134-147
Link Here
|
| 134 |
for(var i=0; i<aaData.length; i++) { |
134 |
for(var i=0; i<aaData.length; i++) { |
| 135 |
aaData[i].push('Delete'); //this is hackish FIXME |
135 |
aaData[i].push('Delete'); //this is hackish FIXME |
| 136 |
} |
136 |
} |
| 137 |
document.getElementById('quotes_editor').style.visibility="visible"; |
137 |
document.getElementById('save_quotes').style.visibility="visible"; |
| 138 |
document.getElementById('file_uploader').style.visibility="hidden"; |
138 |
document.getElementById('file_uploader').style.visibility="hidden"; |
|
|
139 |
document.getElementById('quotes_editor').style.visibility="visible"; |
| 139 |
oTable = $('#quotes_editor').dataTable( { |
140 |
oTable = $('#quotes_editor').dataTable( { |
| 140 |
"bAutoWidth" : false, |
141 |
"bAutoWidth" : false, |
| 141 |
"bPaginate" : true, |
142 |
"bPaginate" : true, |
| 142 |
"bSort" : false, |
143 |
"bSort" : false, |
| 143 |
"sPaginationType" : "full_numbers", |
144 |
"sPaginationType" : "full_numbers", |
| 144 |
"sDom" : '<"save_quotes">frtip', |
|
|
| 145 |
"aaData" : aaData, |
145 |
"aaData" : aaData, |
| 146 |
"aoColumns" : [ |
146 |
"aoColumns" : [ |
| 147 |
{ |
147 |
{ |
|
Lines 162-168
Link Here
|
| 162 |
}, |
162 |
}, |
| 163 |
"fnRowCallback": function( nRow, aData, iDisplayIndex ) { |
163 |
"fnRowCallback": function( nRow, aData, iDisplayIndex ) { |
| 164 |
noEditFields = [2]; /* action */ |
164 |
noEditFields = [2]; /* action */ |
| 165 |
/* console.log('Quote ID: '+quoteID); */ |
|
|
| 166 |
/* do foo on various cells in the current row */ |
165 |
/* do foo on various cells in the current row */ |
| 167 |
$('td:eq(2)', nRow).html('<input type="button" class="delete" value="Delete" onclick="fnClickDeleteRow(this.parentNode);" />'); |
166 |
$('td:eq(2)', nRow).html('<input type="button" class="delete" value="Delete" onclick="fnClickDeleteRow(this.parentNode);" />'); |
| 168 |
/* apply no_edit id to noEditFields */ |
167 |
/* apply no_edit id to noEditFields */ |
|
Lines 184-192
Link Here
|
| 184 |
}, |
183 |
}, |
| 185 |
"height" : "14px", |
184 |
"height" : "14px", |
| 186 |
}); |
185 |
}); |
| 187 |
$("div.save_quotes").html('<input type="button" class="add_quote_button" value="Save Quotes" style="float: right;" onclick="fnGetData(document.getElementById(\'quotes_editor\'));"/>'); |
|
|
| 188 |
}, |
186 |
}, |
| 189 |
}); |
187 |
}); |
|
|
188 |
document.getElementById('footer').style.visibility="visible"; |
| 190 |
} |
189 |
} |
| 191 |
|
190 |
|
| 192 |
function fnHandleFileSelect(evt) { |
191 |
function fnHandleFileSelect(evt) { |
|
Lines 201-213
Link Here
|
| 201 |
alert('File read cancelled'); |
200 |
alert('File read cancelled'); |
| 202 |
}; |
201 |
}; |
| 203 |
reader.onloadstart = function(e) { |
202 |
reader.onloadstart = function(e) { |
|
|
203 |
document.getElementById('cancel_upload').style.visibility="visible"; |
| 204 |
document.getElementById('progress_bar').className = 'loading'; |
204 |
document.getElementById('progress_bar').className = 'loading'; |
| 205 |
}; |
205 |
}; |
| 206 |
reader.onload = function(e) { |
206 |
reader.onload = function(e) { |
| 207 |
// Ensure that the progress bar displays 100% at the end. |
207 |
// Ensure that the progress bar displays 100% at the end. |
| 208 |
progress.style.width = '100%'; |
208 |
progress.style.width = '100%'; |
| 209 |
progress.textContent = '100%'; |
209 |
progress.textContent = '100%'; |
| 210 |
setTimeout("document.getElementById('progress_bar').className='';", 2000); |
210 |
document.getElementById('cancel_upload').style.visibility="hidden"; |
| 211 |
quotes = fnCSVToArray(e.target.result, ','); |
211 |
quotes = fnCSVToArray(e.target.result, ','); |
| 212 |
fnDataTable(quotes); |
212 |
fnDataTable(quotes); |
| 213 |
} |
213 |
} |
|
Lines 215-221
Link Here
|
| 215 |
reader.readAsText(evt.target.files[0]); |
215 |
reader.readAsText(evt.target.files[0]); |
| 216 |
} |
216 |
} |
| 217 |
|
217 |
|
| 218 |
document.getElementById('files').addEventListener('change', fnHandleFileSelect, false); |
218 |
//document.getElementById('file_upload').addEventListener('change', fnHandleFileSelect, false); |
|
|
219 |
$('#file_upload').one('change', fnHandleFileSelect); |
| 219 |
|
220 |
|
| 220 |
}); |
221 |
}); |
| 221 |
|
222 |
|
|
Lines 264-274
Link Here
|
| 264 |
<div id="bd"> |
265 |
<div id="bd"> |
| 265 |
<div id="yui-main"> |
266 |
<div id="yui-main"> |
| 266 |
<div class="yui-b"> |
267 |
<div class="yui-b"> |
| 267 |
|
268 |
<div id="toolbar" style="height:61px;"> |
| 268 |
<div id="file_uploader" style="float: left; width: 100%; visibility:visible;"> |
269 |
<div id="save_quotes" style="visibility:hidden;"> |
| 269 |
<input type="file" id="files" name="file" /> |
270 |
<input type="button" class="add_quote_button" value="Save Quotes" style="border-radius: 5px;" onclick="fnGetData(document.getElementById(\'quotes_editor\'));"/> |
| 270 |
<button onclick="fnAbortRead();">Cancel Upload</button> |
271 |
<span class="hint">Click on any field to edit contents</span> |
| 271 |
<div id="progress_bar"><div class="percent">0%</div></div> |
272 |
</div> |
|
|
273 |
<div id="file_uploader" class="file_uploader" style="visibility:visible;"> |
| 274 |
<input id="file_upload" type="file" name="file" /> |
| 275 |
<button id="cancel_upload" style="visibility:hidden;" onclick="fnAbortRead();">Cancel Upload</button> |
| 276 |
<div id="progress_bar"><div class="percent">0%</div></div> |
| 277 |
</div> |
| 272 |
</div> |
278 |
</div> |
| 273 |
<div id="server_response" onclick='fnResetUpload()'>Server Response</div> |
279 |
<div id="server_response" onclick='fnResetUpload()'>Server Response</div> |
| 274 |
<table id="quotes_editor" style="float: left; width: 100%; visibility:hidden;"> |
280 |
<table id="quotes_editor" style="float: left; width: 100%; visibility:hidden;"> |
|
Lines 288-296
Link Here
|
| 288 |
</tr> |
294 |
</tr> |
| 289 |
</tbody> |
295 |
</tbody> |
| 290 |
</table> |
296 |
</table> |
| 291 |
|
297 |
<fieldset id="footer" class="action" style="visibility:hidden; height:25px"> |
| 292 |
|
298 |
</fieldset> |
| 293 |
|
|
|
| 294 |
</div> |
299 |
</div> |
| 295 |
</div> |
300 |
</div> |
| 296 |
<div class="yui-b noprint"> |
301 |
<div class="yui-b noprint"> |