Skip to content

Commit b0b2171

Browse files
committed
#778 hide downlload metadata and prmiary data when dataset is public
1 parent 16b1aca commit b0b2171

File tree

5 files changed

+73
-59
lines changed

5 files changed

+73
-59
lines changed

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI/Views/Form/MetadataEditor.cshtml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
<div>
135135
<table>
136136
<tr>
137-
@if (locked)
137+
@*@if (locked)
138138
{
139139

140140
<td style="width:500px;">
@@ -177,7 +177,7 @@
177177

178178

179179
</td>
180-
}
180+
}*@
181181

182182
@if (!Model.Created && !locked && Model.Import)
183183
{
@@ -198,6 +198,18 @@
198198
)
199199
</td>
200200
}
201+
<td>
202+
@if (ViewData["IsValid"] == "no")
203+
{
204+
<div id="view-warning-container">
205+
<div id="view-warning" class="alert alert-danger" role="alert" style="width: 100%;">
206+
<span id="view-warning-icon" class=" fa fa-exclamation-triangle"></span>
207+
The metadata for this dataset is not complete.
208+
</div>
209+
</div>
210+
}
211+
212+
</td>
201213

202214
<td id="form_message_container_Column" style="text-align: right">
203215
<span id="form_message"></span>
@@ -214,16 +226,7 @@
214226
</table>
215227
</div>
216228

217-
@if (ViewData["IsValid"] == "no" )
218-
{
219-
<div id="view-warning-container">
220-
<div id="view-warning" class="alert alert-danger" role="alert" style="width: 100%;">
221-
<span id="view-warning-icon" class=" fa fa-exclamation-triangle"></span>
222-
The metadata for this dataset is not complete.
223-
</div>
224-
</div>
225-
}
226-
229+
227230
@if (validationErrors.Any())
228231
{
229232
<div id="view-warning-container">

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Controllers/DataController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ public ActionResult ShowPrimaryData(long datasetID, int versionId)
782782
}
783783

784784
ViewData["gridTotal"] = dm.RowCount(dataset.Id, null);
785+
ViewData["isPublic"] = entityPermissionManager.ExistsAsync(dataset.EntityTemplate.EntityType.Id, dataset.Id).Result;
785786

786787
sds.Variables = sds.Variables.OrderBy(v => v.OrderNo).ToList();
787788

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Views/Data/ShowData.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@
242242
if (Model.DataStructureType.ToLower().Equals("structured"))
243243
{
244244
<span class="dropdown">
245+
245246
<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">
246247
<span class="fa fa-download" style="padding-right: 5px;"></span>
247248
Download

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Views/Data/_structuredDataView.cshtml

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
tableClass = "scroll_in_screen";
3737
}
3838

39+
bool isPublic = false;
40+
41+
if(ViewData["isPublic"]!=null)
42+
{
43+
isPublic = (bool)ViewData["isPublic"];
44+
}
3945
}
4046

4147
@section Scripts{
@@ -58,64 +64,68 @@
5864
}
5965
<div id="downloadOptions" style="text-align:left;">
6066

61-
@if (Model.DownloadAccess && Model.Data != null && Model.Data.Rows.Count > 0)
62-
{
6367

64-
@*<button id="downloadExcelTemplateButton" class="bx-button function" title="Xlsx download" onclick="downloadExcelTemplate(@Model.DatasetId)">Download Template</button>
68+
@if (!isPublic || User.Identity.Name != "") /* dont sho download options if the dataset is public */
69+
{
70+
if (Model.DownloadAccess && Model.Data != null && Model.Data.Rows.Count > 0)
71+
{
72+
73+
@*<button id="downloadExcelTemplateButton" class="bx-button function" title="Xlsx download" onclick="downloadExcelTemplate(@Model.DatasetId)">Download Template</button>
6574

66-
<button id="downloadExcelButton" class="bx-button function" title="Xlsx download" onclick="downloadExcel(@Model.DatasetId)">Download Excel</button>*@
75+
<button id="downloadExcelButton" class="bx-button function" title="Xlsx download" onclick="downloadExcel(@Model.DatasetId)">Download Excel</button>*@
6776

6877
if (@total < 1048576) // hide Excel download for bigger datasets, which exceed the max number of rows in excel
6978
{
79+
<span class="dropdown">
80+
<button class="bx-button function" type="button" onclick="downloadExcel(@Model.DatasetId)">
81+
Download Excel
82+
</button>
83+
@*<button class="bx-button function" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
84+
Download Excel
85+
<span class="caret"></span>
86+
</button>
87+
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
88+
<li><a id="downloadExcelTemplateButton" onclick="downloadExcelTemplate(@Model.DatasetId)">Template (.xlsm)</a></li>
89+
<li><a id="downloadExcelButton" onclick="downloadExcel(@Model.DatasetId)">Excel (.xlsx)</a></li>
90+
</ul>*@
91+
</span>
92+
}
93+
7094
<span class="dropdown">
71-
<button class="bx-button function" type="button" onclick="downloadExcel(@Model.DatasetId)">
72-
Download Excel
73-
</button>
74-
@*<button class="bx-button function" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
75-
Download Excel
95+
<button class="bx-button function" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
96+
Download Text
7697
<span class="caret"></span>
7798
</button>
78-
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
79-
<li><a id="downloadExcelTemplateButton" onclick="downloadExcelTemplate(@Model.DatasetId)">Template (.xlsm)</a></li>
80-
<li><a id="downloadExcelButton" onclick="downloadExcel(@Model.DatasetId)">Excel (.xlsx)</a></li>
81-
</ul>*@
99+
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
100+
101+
@foreach (KeyValuePair<string, string> fileType in Model.AsciiFileDownloadSupport)
102+
{
103+
<li><a class="file-type-download-entry" ext="@fileType.Value"> @fileType.Key (@fileType.Value)</a></li>
104+
}
105+
</ul>
106+
</span>
107+
108+
<span>
109+
@Html.CheckBox("WithUnits", false, new { text = "download data with units", @id = "WithUnits" })
110+
Download data with units.
82111
</span>
83112
}
113+
else
114+
{
84115

85-
<span class="dropdown">
86-
<button class="bx-button function" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
116+
<button title="Download Excel"
117+
name="Download Excel"
118+
class="t-button t-state-disabled margin"
119+
disabled="disabled">
120+
Download Excel
121+
</button>
122+
<button title="Download Comma Separated"
123+
name="Download Comma Separated"
124+
class="t-button t-state-disabled margin"
125+
disabled="disabled">
87126
Download Text
88-
<span class="caret"></span>
89127
</button>
90-
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
91-
92-
@foreach (KeyValuePair<string, string> fileType in Model.AsciiFileDownloadSupport)
93-
{
94-
<li><a class="file-type-download-entry" ext="@fileType.Value"> @fileType.Key (@fileType.Value)</a></li>
95-
}
96-
</ul>
97-
</span>
98-
99-
<span>
100-
@Html.CheckBox("WithUnits", false, new { text = "download data with units", @id = "WithUnits" })
101-
Download data with units.
102-
</span>
103128
}
104-
else
105-
{
106-
107-
<button title="Download Excel"
108-
name="Download Excel"
109-
class="t-button t-state-disabled margin"
110-
disabled="disabled">
111-
Download Excel
112-
</button>
113-
<button title="Download Comma Separated"
114-
name="Download Comma Separated"
115-
class="t-button t-state-disabled margin"
116-
disabled="disabled">
117-
Download Text
118-
</button>
119129
}
120130

121131
<span>
@@ -125,7 +135,7 @@
125135

126136
<span id="preloaderContainer" style="float: right"></span>
127137
</div>
128-
<br />
138+
129139
@(Html.Telerik().Grid(Model.Data)
130140
.Name("PrimaryDataResultGrid")
131141
.DataBinding(dataBinding => dataBinding

Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Controllers/API/DataStatisticOutController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ public List<int> Get()
5151
foreach (int id in datasetIds)
5252
{
5353
DatasetVersion datasetVersion = dm.GetDatasetLatestVersion(id);
54-
if (datasetVersion.Dataset.DataStructure != null &&
55-
datasetVersion.Dataset.DataStructure is StructuredDataStructure)
54+
if (datasetVersion.Dataset.DataStructure != null)
5655
{
5756
structuredIds.Add(id);
5857
}

0 commit comments

Comments
 (0)