|
12 | 12 | bool has_data = false; |
13 | 13 | string data_aggreement = "none"; |
14 | 14 | bool aggrreement_checked = true; |
| 15 | + bool withFilter = false; |
| 16 | + bool withUnits = false; |
15 | 17 |
|
16 | 18 | if (ViewData["TabIndex"] != null) |
17 | 19 | { |
|
245 | 247 | </div> |
246 | 248 |
|
247 | 249 | <div class="datasetview_header-toggle flex"> |
248 | | - |
| 250 | + |
249 | 251 | @if (Model.DownloadAccess) |
250 | 252 | { |
251 | 253 | /* data aggreement state: none, data policy, terms and conditions**/ |
|
254 | 256 | { |
255 | 257 | <div class="data-aggreement"> |
256 | 258 | @Html.CheckBox("data_policy", false, new { @id = "data-policy" }) |
257 | | - <b>I accept the public regulations from the |
258 | | - <a href="/footer/policy" target="_blank">privacy policy</a>.</b> |
| 259 | + <b> |
| 260 | + I accept the public regulations from the |
| 261 | + <a href="/footer/policy" target="_blank">privacy policy</a>. |
| 262 | + </b> |
259 | 263 | </div> |
260 | 264 | } |
261 | 265 | else if (data_aggreement.Equals("terms and conditions")) |
|
266 | 270 | I accept the public regulations from the |
267 | 271 | <a href="/footer/termsandconditions" target="_blank">terms and conditions</a>. |
268 | 272 | </b> |
269 | | - </div> |
| 273 | + </div> |
270 | 274 | } |
271 | 275 |
|
272 | 276 |
|
273 | 277 |
|
274 | 278 | if (Model.DataStructureType.ToLower().Equals("structured")) |
275 | 279 | { |
276 | | - <span class="dropdown"> |
277 | | - |
278 | | - <button class="bx-button function small" type="button" id="dropdownMenu1" data-toggle="dropdown" title="Download dataset with a selected dataformat for the primary data" aria-haspopup="true" aria-expanded="true"> |
279 | | - <span class="fa fa-download" style="padding-right: 5px;"></span> |
280 | | - Download |
281 | | - <span class="caret"></span> |
282 | | - </button> |
283 | | - <ul class="dropdown-menu" aria-labelledby="dropdownMenu1" style="z-index:100000; margin-top:10px;"> |
284 | | - |
285 | | - @if (@total < 1048576) // hide Excel download for bigger datasets, which exceed the max number of rows in excel |
286 | | - { |
287 | | - <li>@*<a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "application/xlsm", version = Model.VersionId })">... with Template</a>*@</li> |
288 | | - <li><a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "application/xlsx", version = Model.VersionId })">... with Excel</a></li> |
289 | | - } |
290 | | - <li><a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "text/csv", version = Model.VersionId })">... with CSV</a></li> |
291 | | - <li><a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "text/tsv", version = Model.VersionId })">... with TSV</a></li> |
292 | | - <li><a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "text/plain", version = Model.VersionId })">... with TXT</a></li> |
293 | | - </ul> |
294 | | - </span> |
295 | | - } |
296 | | - else |
297 | | - { |
298 | | - <a class="bx-button small function" href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, version = Model.VersionId, format = "" })"><span class="fa fa-download" style="padding-right: 5px;"></span>Download Dataset</a> |
299 | | - } |
300 | | - } |
301 | | - else |
302 | | - { |
| 280 | + <div class="padding-top-5 position-releative "> |
| 281 | + <span> |
| 282 | + @Html.CheckBox("WithFilter", false, new { text = "download filtered data", @id = "withFilter" }) |
| 283 | + use filter |
| 284 | + </span> |
| 285 | + |
| 286 | + <span> |
| 287 | + @Html.CheckBox("WithUnits", false, new { text = "download data with units", @id = "withUnits" }) |
| 288 | + add units |
| 289 | + </span> |
| 290 | + </div> |
| 291 | + |
| 292 | + <span class="dropdown"> |
| 293 | + |
| 294 | + <button class="bx-button function small" type="button" id="dropdownMenu1" data-toggle="dropdown" title="Download dataset with a selected dataformat for the primary data" aria-haspopup="true" aria-expanded="true"> |
| 295 | + <span class="fa fa-download" style="padding-right: 5px;"></span> |
| 296 | + Download |
| 297 | + <span class="caret"></span> |
| 298 | + </button> |
| 299 | + <ul class="dropdown-menu" aria-labelledby="dropdownMenu1" style="z-index:100000; margin-top:10px;"> |
| 300 | + |
| 301 | + @if (@total < 1048576) // hide Excel download for bigger datasets, which exceed the max number of rows in excel |
| 302 | + { |
| 303 | + <li>@*<a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "application/xlsm", version = Model.VersionId })">... with Template</a>*@</li> |
| 304 | + <li><a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "application/xlsx", version = Model.VersionId, withFilter, withUnits })">... with Excel</a></li> |
| 305 | + } |
| 306 | + <li><a id="csv-download" href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "text/csv", version = Model.VersionId })" >... with CSV</a></li> |
| 307 | + <li><a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "text/tsv", version = Model.VersionId, withFilter,withUnits })">... with TSV</a></li> |
| 308 | + <li><a href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, format = "text/plain", version = Model.VersionId, withFilter,withUnits })">... with TXT</a></li> |
| 309 | + </ul> |
| 310 | + </span> |
| 311 | + } |
| 312 | + else |
| 313 | + { |
| 314 | + <a class="bx-button small function" href="@Url.Action("DownloadZip", "Data", new { id = @Model.Id, version = Model.VersionId, format = "" })"><span class="fa fa-download" style="padding-right: 5px;"></span>Download Dataset</a> |
| 315 | + } |
| 316 | + } |
| 317 | + else |
| 318 | + { |
303 | 319 |
|
304 | 320 |
|
305 | | - if (Model.HasRequestRight) |
306 | | - { |
307 | | - if (Model.RequestAble) |
308 | | - { |
| 321 | + if (Model.HasRequestRight) |
| 322 | + { |
| 323 | + if (Model.RequestAble) |
| 324 | + { |
309 | 325 |
|
310 | 326 | if (Model.RequestExist) |
311 | 327 | { |
312 | | - <button id="sendRequestBt" class="bx-button small function bx-disabled" title="Send request to the owner of the dataset for the rights to see and download the primary data." disabled="disabled">Request Pending</button> |
| 328 | + <button id="sendRequestBt" class="bx-button small function bx-disabled" title="Send request to the owner of the dataset for the rights to see and download the primary data." disabled="disabled">Request Pending</button> |
313 | 329 | } |
314 | 330 | else if (!has_data) |
315 | 331 | { |
316 | | - <!-- if dataset has no data--> |
317 | | - |
| 332 | + <!-- if dataset has no data--> |
318 | 333 | } |
319 | 334 | else |
320 | 335 | { |
321 | | - <div> |
322 | | - @Html.TextArea("intention", new { @class = "bx-input", placeholder = "describe your intention " }); |
323 | | - </div> |
324 | | - <button id="sendRequestBt" datasetId="@Model.Id" class="bx-button small function" title="Send request to the owner of the dataset for the rights to see and download the primary data."> |
325 | | - <span class="fa fa-paper-plane" style="padding-right: 5px;"></span> |
326 | | - Request Access |
327 | | - </button> |
| 336 | + <div> |
| 337 | + @Html.TextArea("intention", new { @class = "bx-input", placeholder = "describe your intention " }); |
| 338 | + </div> |
| 339 | + <button id="sendRequestBt" datasetId="@Model.Id" class="bx-button small function" title="Send request to the owner of the dataset for the rights to see and download the primary data."> |
| 340 | + <span class="fa fa-paper-plane" style="padding-right: 5px;"></span> |
| 341 | + Request Access |
| 342 | + </button> |
328 | 343 | } |
329 | 344 |
|
330 | | - } |
331 | | - else |
332 | | - { |
| 345 | + } |
| 346 | + else |
| 347 | + { |
333 | 348 | if (show_tabs["show_tabs_deactivated"] == "true") |
334 | 349 | { |
335 | | - <button id="sendRequestBt" class="bx-button small function bx-disabled" title="Send request to the owner of the dataset for the rights to see and download the primary data. If the function is not available, please contact the administrator." disabled="disabled">Currently not available</button> |
| 350 | + <button id="sendRequestBt" class="bx-button small function bx-disabled" title="Send request to the owner of the dataset for the rights to see and download the primary data. If the function is not available, please contact the administrator." disabled="disabled">Currently not available</button> |
336 | 351 | } |
337 | | - } |
338 | | - } |
339 | | - else |
340 | | - { |
341 | | - if (show_tabs["show_tabs_deactivated"] == "true") |
342 | | - { |
| 352 | + } |
| 353 | + } |
| 354 | + else |
| 355 | + { |
| 356 | + if (show_tabs["show_tabs_deactivated"] == "true") |
| 357 | + { |
343 | 358 | <button id="sendRequestBt" class="bx-button small function bx-disabled" title="You have no right to make requests." disabled="disabled">Currently not available</button> |
344 | | - } |
345 | | - } |
346 | | - } |
| 359 | + } |
| 360 | + } |
| 361 | + } |
347 | 362 |
|
348 | | - @if (Model.HasEditRight && ViewData["state"].ToString() != "hidden") |
349 | | - { |
| 363 | + @if (Model.HasEditRight && ViewData["state"].ToString() != "hidden") |
| 364 | + { |
350 | 365 |
|
351 | | - <button title="go to edit dataset" class="bx-button small function" type="button" onclick="toogleToEdit()"> |
352 | | - <span class="fa fa-pencil"></span> |
353 | | - <span style="padding:5px;"> |
354 | | - Edit |
355 | | - </span> |
356 | | - </button> |
| 366 | + <button title="go to edit dataset" class="bx-button small function" type="button" onclick="toogleToEdit()"> |
| 367 | + <span class="fa fa-pencil"></span> |
| 368 | + <span style="padding:5px;"> |
| 369 | + Edit |
| 370 | + </span> |
| 371 | + </button> |
357 | 372 |
|
358 | | - } |
359 | | - </div> |
| 373 | + } |
| 374 | +</div> |
360 | 375 | </div> |
361 | 376 |
|
362 | 377 |
|
|
515 | 530 | console.log("aggrreement_checked",'@aggrreement_checked') |
516 | 531 | setDownloadBt('@aggrreement_checked'); |
517 | 532 |
|
| 533 | +
|
| 534 | + $("#csv-download").on("click", function (e) { |
| 535 | + // Prevent the default navigation initially |
| 536 | + e.preventDefault(); |
| 537 | +
|
| 538 | + var withFilter = $("#withFilter"); |
| 539 | + var withFilterIsChecked = withFilter.is(":checked"); // Check if the box is checked |
| 540 | + var withUnits = $("#withUnits"); |
| 541 | + var withUnitsIsChecked = withUnits.is(":checked"); // Check if the box is checked |
| 542 | +
|
| 543 | +
|
| 544 | + var link = $(this); |
| 545 | + var originalHref = link.attr("href"); |
| 546 | + var newHref = originalHref; |
| 547 | +
|
| 548 | + // Construct the query parameter, using the checkbox's name 'IsChecked' |
| 549 | + var param = "withFilter=" + withFilterIsChecked + "&&withUnits=" + withUnitsIsChecked; |
| 550 | +
|
| 551 | + // Check if the URL already contains query parameters |
| 552 | + if (originalHref.indexOf('?') > -1) { |
| 553 | + newHref += "&" + param; |
| 554 | + } else { |
| 555 | + newHref += "?" + param; |
| 556 | + } |
| 557 | +
|
| 558 | + console.log("newHref", newHref); |
| 559 | +
|
| 560 | + // Set the new URL and navigate |
| 561 | + window.location.href = newHref; |
| 562 | + }); |
| 563 | +
|
518 | 564 | }); |
519 | 565 |
|
520 | 566 | function setDownloadBt(aggreed) { |
@@ -760,6 +806,11 @@ else |
760 | 806 | padding-top: 5px; |
761 | 807 | } |
762 | 808 |
|
| 809 | +
|
| 810 | + .position-releative { |
| 811 | + position: relative; |
| 812 | + } |
| 813 | +
|
763 | 814 | #identifier-container { |
764 | 815 | padding-left:2px; |
765 | 816 | } |
|
0 commit comments