Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Views/Job/UploaderPartial/_UploaderPartial.cshtml @ 13862

Last change on this file since 13862 was 13862, checked in by jlodewyc, 8 years ago

#2582 Start angular OKB manager, data loaded

File size: 4.6 KB
Line 
1@model HeuristicLab.Clients.Hive.WebJobManager.ViewModels.UploadedJobViewModel
2
3
4<div class="panel panel-default"
5     style="border-width:2px!important;padding:17px;
6                        box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
7
8
9    <form method="post"
10          asp-action="Uploader"
11          asp-controller="Job" enctype="multipart/form-data">
12        <input onchange="printFiles()"
13               type="file"
14               id="files"
15               name="files"
16               multiple accept=".hl"
17               style="display:none" />
18
19        <div onclick="firefilebutton()"
20             class="btn btn-info btn-lg btn-block"
21             style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
22                                 text-shadow:1px 1px black;">
23            <i class="fa fa-folder-open-o"></i> Choose file(s) to upload to the server
24        </div>
25
26        <div class="row" style="margin:10px">
27
28            <div id="selectedfiles">
29                <h3>Files</h3>
30                <p>No files selected: press the above button to choose files</p>
31            </div>
32
33            <button style="margin-bottom:10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
34                                 text-shadow:2px 2px black;"
35                    type="button"
36                    disabled
37                    id="del"
38                    class='btn btn-danger'
39                    onclick='deletefiles()'>
40                <span class='glyphicon glyphicon-trash' aria-hidden='true'></span>
41                Remove files
42            </button>
43
44            <div style="margin-top:20px;margin-bottom:20px">
45
46                <label for="basic-url">Directory name</label>
47                <div class="input-group">
48                    <span class="input-group-addon"
49                          id="basic-addon3">
50                        .../uploads/@(Model.User.currentUser.UserName != null ?  Model.User.currentUser.UserName : Model.User.currentUser.FullName)/
51                    </span>
52                    <input type="text"
53                           disabled
54                           class="form-control"
55                           id="directory"
56                           name="directory"
57                           aria-describedby="basic-addon3"
58                           
59                           list="dirnames"/>
60                    <datalist id="dirnames">
61                        @if (!Model.DisplayDatePaths.Contains(DateTime.Now.ToString("yyyy.MM.dd")))
62                        {
63                            <option value="@(DateTime.Now.ToString("yyyy.MM.dd"))">Creates new map for today</option>
64                        }   
65                        @foreach(var d in Model.DisplayDatePaths)
66                        {
67                            <option value="@d"></option>
68                        }
69                    </datalist>
70                </div>
71            </div>
72            <button style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
73                                 text-shadow:2px 2px black;"
74                    disabled
75                    id="upl"
76                    class="btn btn-lg btn-block btn-success"
77                    type="submit">
78                <i class="fa fa-plus-square"></i> Add to uploads
79            </button>
80        </div>
81
82    </form>
83</div>
84
85<script type="text/javascript">
86    function printFiles() {
87        var div = document.getElementById("selectedfiles");
88        var files = document.getElementById("files").files;
89        div.innerHTML = "<h3>Files</h3>";
90        if (files.length > 0) {
91            document.getElementById("upl").disabled = false;
92            document.getElementById("del").disabled = false;
93            document.getElementById("directory").disabled = false;
94
95
96            for (var i = 0; i < files.length; i++) {
97                div.innerHTML += "<p>File " + (i + 1) + ":" + files[i].name +
98                    "</p>";
99            }
100
101        }
102        else {
103            div.innerHTML += "<p>No files selected</p>";
104            document.getElementById("upl").disabled = true;
105            document.getElementById("del").disabled = true;
106            document.getElementById("directory").disabled = true;
107        }
108
109    }
110    function firefilebutton() {
111        document.getElementById("files").click();
112
113    }
114    function deletefiles() {
115        var filesarr = document.getElementById("files").files;
116        document.getElementById("files").value = "";
117        printFiles();
118    }
119</script>
Note: See TracBrowser for help on using the repository browser.