harshdhane's picture
Upload 10 files
a8a001c verified
Raw
History Blame Contribute Delete
6.69 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Resource - Educational Resource Management System</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">
<div class="header">
<h1><a href="{{ url_for('index') }}">Educational Resource Management System</a></h1>
<a href="{{ url_for('logout') }}" class="logout-btn">Logout</a>
</div>
<div class="user-welcome">
<h2>Welcome, {{ session['username'] }}!</h2>
<p>You are logged in as a {{ session['user_type'] }}</p>
</div>
<nav>
<ul class="nav-list">
{% if session['user_type'] == 'admin' %}
<li><a href="{{ url_for('add_resource') }}">Add Resource</a></li>
{% endif %}
<li><a href="{{ url_for('view_resources') }}">View Resources</a></li>
</ul>
</nav>
<div class="dashboard-content">
<h2>Add New Resource</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<p style="color: {{ 'red' if category == 'error' else 'green' }}">{{ message }}</p>
{% endfor %}
{% endif %}
{% endwith %}
<form action="{{ url_for('add_resource') }}" method="POST" enctype="multipart/form-data" class="add-resource-form">
<div class="form-group">
<label for="name">Resource Name:</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="type">Resource Type:</label>
<select id="type" name="type" required>
<option value="" disabled selected>Select Resource Type</option>
<option value="Textbooks">Textbooks</option>
<option value="Digital Materials">Digital Materials</option>
<option value="Library Books">Library Books</option>
</select>
</div>
<div class="form-group">
<label for="institution">Institution:</label>
<select id="institution" name="institution" onchange="updateDepartments()" required>
<option value="" disabled selected>Select Institution</option>
<option value="MIT Institute of Design">MIT Institute of Design</option>
<option value="MIT College of Management">MIT College of Management</option>
<option value="MIT School of Food Technology">MIT School of Food Technology</option>
<option value="MIT School of Film and Theatre">MIT School of Film and Theatre</option>
<option value="MIT School of Indian Civil Services">MIT School of Indian Civil Services</option>
<option value="MIT School of Computing">MIT School of Computing</option>
</select>
</div>
<div class="form-group">
<label for="department">Department:</label>
<select id="department" name="department" required>
<option value="" disabled selected>Select Department</option>
</select>
</div>
<div class="form-group">
<label for="resource_file">Upload Resource (PDF/Video):</label>
<input type="file" id="resource_file" name="resource_file" required>
</div>
<button type="submit" class="submit-btn">Add Resource</button>
</form>
</div>
</div>
<script>
const departments = {
"MIT Institute of Design": [
"Bachelor of Design",
"Master of Design (Animation Design)",
"Master of Design (Design Management)",
"Master of Design (Fashion Management and Marketing)"
],
"MIT College of Management": [
"Bachelor of Commerce (HONORS)",
"Bachelor of Computer Applications",
"Master of Business Administration (Executive)"
],
"MIT School of Food Technology": [
"B. Tech. (Food Technology)",
"M. Tech. (Food Safety and Quality Management)",
"M. Tech. (Food Technology)"
],
"MIT School of Film and Theatre": [
"B.A. in Direction & Screenplay Writing",
"B.Sc. in Filmmaking",
"Bachelor of Arts (Dramatics)",
"M.A. in Direction & Screenplay Writing"
],
"MIT School of Indian Civil Services": [
"B.A. (Administration)",
"M.A. (Administration)"
],
"MIT School of Computing": [
"Bachelor of Technology (Computer Science & Engineering)",
"Master of Science (Computer Science/Artificial Intelligence & Machine Learning)",
"Master of Technology (Computer Science & Engineering - Intelligent Systems & Analysis)",
"Master of Technology (Information Technology - Cyber Security)"
]
};
function updateDepartments() {
const institutionSelect = document.getElementById("institution");
const departmentSelect = document.getElementById("department");
const selectedInstitution = institutionSelect.value;
departmentSelect.innerHTML = "<option value='' disabled selected>Select Department</option>";
if (departments[selectedInstitution]) {
departments[selectedInstitution].forEach(department => {
const option = document.createElement("option");
option.value = department;
option.text = department;
departmentSelect.appendChild(option);
});
}
}
</script>
</body>
</html>