Skip to content
Snippets Groups Projects
Commit e9feae3c authored by Jonathan Weth's avatar Jonathan Weth :keyboard: Committed by root
Browse files

Merge branch 'dev' into feature/events

parents b63dfe3d a85b099f
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -12,4 +12,7 @@ media/
node_modules/
latex/
staticcollect/
.idea
\ No newline at end of file
.idea
dynselect2/src/*
dynselect2/bundle.js
package-lock.json
......@@ -3,4 +3,4 @@
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
</project>
......@@ -77,11 +77,9 @@ python3 schoolapps/manage.py runserver
- SchoolApps benutzen 😃
### Kanboard-Verbindung einrichten
### Mail-Verbindung einrichten (REBUS+Feedback)
1. Zu den [Einstellungen](localhost:8000/settings) navigieren (/settings)
2. Den Kanboard-API-Key von [Kanboard](https://kanboard.katharineum.de/?controller=ConfigController&action) eintragen
3. Die Project-IDs von `REBUS` (#4) und `Feedback` (#18) eintragen
4. Die richtigen E-Mailadressen eintragen
2. Die richtigen E-Mailadressen eintragen
## LDAP (info.katharineum.de)
......
......@@ -12,58 +12,6 @@ const OPTIONS_ONLINE_COMMON = [
];
const BASIC_OPTIONS = [
{
id: "deviceIssues",
name: "Probleme am Computer/Notebook",
options: [
{
id: "loginIssue",
name: "Anmeldeproblem/Passwort vergessen"
},
{
id: "internetIssue",
name: "Internetproblem"
},
{
id: "noReaction",
name: "Programm-/Computerabsturz (keine Reaktion)"
},
{
id: "powerOffNoBoot",
name: "Computer/Notebook ist ausgegangen/startet nicht"
},
{
id: "speedIssue",
name: "Computer/Notebook zu langsam"
},
{
id: "noUSB",
name: "USB-Stick wird nicht erkannt"
},
{
id: "noOpenTray",
name: "CD/DVD-Laufwerk öffnet sich nicht"
},
{
id: "noCDDVD",
name: "CD/DVD wird nicht erkannt/abgespielt"
},
{
id: "keyboardMouse",
name: "Tastatur/Maus funktioniert nicht"
},
{
id: "missingHardware",
name: "Tastatur/Maus/Lautsprecher/etc. fehlt"
},
{
id: "missingKeys",
name: "Fehlende Tasten auf der Tastatur"
}
]
},
{
id: "infrastructureIssues",
name: "Infrastrukturprobleme",
......@@ -147,6 +95,59 @@ const BASIC_OPTIONS = [
},
]
},
{
id: "deviceIssues",
name: "Probleme am Computer/Notebook",
options: [
{
id: "loginIssue",
name: "Anmeldeproblem/Passwort vergessen"
},
{
id: "internetIssue",
name: "Internetproblem"
},
{
id: "noReaction",
name: "Programm-/Computerabsturz (keine Reaktion)"
},
{
id: "powerOffNoBoot",
name: "Computer/Notebook ist ausgegangen/startet nicht"
},
{
id: "speedIssue",
name: "Computer/Notebook zu langsam"
},
{
id: "noUSB",
name: "USB-Stick wird nicht erkannt"
},
{
id: "noOpenTray",
name: "CD/DVD-Laufwerk öffnet sich nicht"
},
{
id: "noCDDVD",
name: "CD/DVD wird nicht erkannt/abgespielt"
},
{
id: "keyboardMouse",
name: "Tastatur/Maus funktioniert nicht"
},
{
id: "missingHardware",
name: "Tastatur/Maus/Lautsprecher/etc. fehlt"
},
{
id: "missingKeys",
name: "Fehlende Tasten auf der Tastatur"
}
]
},
{
id: "otherIssues",
name: "Andere Probleme",
......@@ -160,13 +161,6 @@ const BASIC_OPTIONS = [
];
const ROOMS_WITH_PRESENTATION_DEVICE = [
"R 0.04",
"R 0.05",
"R 0.07",
"R 0.08"
];
const OTHER_LOCATIONS = [
"Notebookwagen 1. Stock/R 2.06",
"Notebookwagen 2. Stock/R 2.10",
......@@ -205,7 +199,7 @@ function getOption(option) {
class Select extends Component {
render() {
return <select onChange={this.props.onChange} defaultValue={"no"} required={true}>
return <select onChange={this.props.onChange} defaultValue={"no"} required={this.props.show}>
<option value={"no"} disabled={true}>Nichts ausgewählt</option>
{this.props.values.map(function (val, i) {
return <option value={val} key={i}>{val}</option>;
......@@ -219,7 +213,7 @@ Select.propTypes = {
onChange: PropTypes.func.isRequired,
values: PropTypes.array.isRequired,
defaultValue: PropTypes.string,
show: PropTypes.bool.isRequired
};
......@@ -230,8 +224,8 @@ Select.defaultProps = {
class Input extends Component {
render() {
return <div
className = {(this.props.show ? "" : "hide ") + "input-field col s12 m12 l4"
}>
className={(this.props.show ? "" : "hide ") + "input-field col s12 m12 l4"
}>
<i className={"material-icons prefix"}>{this.props.icon}</i>
{this.props.children}
<label>{this.props.label}</label>
......@@ -311,22 +305,24 @@ class App extends Component {
};
render() {
let LOCATIONS = this.props.rooms.concat(OTHER_LOCATIONS);
LOCATIONS.sort();
let LOCATIONS = this.props.rooms.concat(OTHER_LOCATIONS);
let LOCATIONS_WITH_POSSIBLE_PRESENTATION_DEVICE = this.props.rooms;
LOCATIONS.sort();
console.log(this.state);
// console.log(this.state);
const that = this;
const sC = this.state.selectedCategory;
const sO = this.state.selectedOption ? this.state.selectedOption.id : null;
const step = this.state.step;
console.log(BASIC_OPTIONS[2].options);
// console.log(BASIC_OPTIONS[2].options);
return (
<div className="App">
<div className={"row"}>
< div
className = "input-field col s12 m12 l4" >
< div
className="input-field col s12 m12 l4">
<i className={"material-icons prefix"}>list</i>
<select onChange={this._onCategoryChanges} defaultValue={"noCategory"}>
<select onChange={this._onCategoryChanges} defaultValue={"noCategory"} className={"validate"}
required={true}>
<option value={"noCategory"} disabled={true}>Keine Kategorie ausgewählt</option>
{BASIC_OPTIONS.map(function (category) {
return <optgroup label={category.name} key={category.id}>
......@@ -342,38 +338,40 @@ class App extends Component {
{/* Section B – Device Issues*/}
<Input label={"Ort des Computer/Notebook"} icon={"location_on"} show={sC === "deviceIssues"}>
<Select onChange={this._onSetB} values={LOCATIONS} defaultValue={"Anderer Ort"}/>
<Select onChange={this._onSetB} values={LOCATIONS} defaultValue={"Anderer Ort"}
show={sC === "deviceIssues"}/>
</Input>
{/* Section B – Presentation Device Issues */}
<Input label={"Ort des Beamer/Fernseher"} icon={"location_on"}
show={sO === "presentationDeviceIssue"}>
<Select onChange={this._onSetB} values={ROOMS_WITH_PRESENTATION_DEVICE}
defaultValue={"Anderer Raum"}/>
<Select onChange={this._onSetB} values={LOCATIONS_WITH_POSSIBLE_PRESENTATION_DEVICE}
defaultValue={"Anderer Raum"} show={sO === "presentationDeviceIssue"}/>
</Input>
{/* Section B – Substitution Monitor Issue */}
<Input label={"Art des Problems"} icon={"bug_report"} show={sO === "subMonitorIssue"}>
<Select onChange={this._onSetB}
values={["Schwarzer Bildschirm", "Tage wechseln nicht (Eingefroren)"]}
defaultValue={"Anderer Raum"}/>
defaultValue={"Anderer Raum"} show={sO === "subMonitorIssue"}/>
</Input>
{/* Section B – WLAN Issue */}
<Input label={"Art des Problems"} icon={"bug_report"} show={sO === "wlanIssue"}>
<Select onChange={this._onSetB}
values={["Kein Empfang", "Zugangsdaten funktionieren nicht", "Geschwindigkeit zu langsam"]}
defaultValue={"Anderes Problem"}/>
defaultValue={"Anderes Problem"} show={sO === "wlanIssue"}/>
</Input>
{/* Section B – Online Issue*/}
{BASIC_OPTIONS[2].options.map(function (opt) {
{BASIC_OPTIONS[1].options.map(function (opt) {
if (opt.options) {
return <Input label={"Art des Problems"} icon={"bug_report"}
show={sC === "onlineIssues" && sO === opt.id} key={opt.id}>
<Select onChange={that._onSetB}
values={opt.options}
defaultValue={"Anderes Problem"}/>
defaultValue={"Anderes Problem"} show={sC === "onlineIssues" && sO === opt.id}
key={opt.id}/>
</Input>;
} else {
return <p/>;
......@@ -385,7 +383,7 @@ class App extends Component {
<Input label={"Handelt es sich um einen Beamer oder einen Fernseher?"} icon={"tv"}
show={sO === "presentationDeviceIssue" && step === 2}>
<Select onChange={this._onSetC} values={["Beamer", "Fernseher/Bildschirm"]}
defaultValue={"Sonstiges"}/>
defaultValue={"Sonstiges"} show={sO === "presentationDeviceIssue" && step === 2}/>
</Input>
{/* Section C – WLAN Issue */}
......@@ -393,15 +391,16 @@ class App extends Component {
show={sO === "wlanIssue" && step === 2}>
<Select onChange={this._onSetC}
values={["kath-schueler", "kath-lehrer", "kath-edu", "kath-gaeste"]}
defaultValue={"-"}/>
defaultValue={"-"} show={sO === "wlanIssue" && step === 2}/>
</Input>
{/* Section C – Device Issue */}
<div
className = {(sC === "deviceIssues" && step === 2 ? "" : "hide ") + "input-field col s12 m12 l4"
}>
className={(sC === "deviceIssues" && step === 2 ? "" : "hide ") + "input-field col s12 m12 l4"
}>
<i className={"material-icons prefix"}>device_unknown</i>
<input type={"text"} id={"valc"} onChange={this._onSetC} required={true}/>
<input type={"text"} id={"valc"} onChange={this._onSetC}
required={sC === "deviceIssues" && step === 2} className={"validate"}/>
<label htmlFor="valc">Um welches Gerät handelt es sich?</label>
</div>
......
This diff is collapsed.
This diff is collapsed.
......@@ -21,7 +21,7 @@ class FeedbackForm(forms.Form):
performance_rating = forms.ChoiceField(label='Geschwindigkeit',
choices=ratings,
widget=forms.RadioSelect(attrs={"checked": "checked"}),
widget=forms.RadioSelect(attrs={"checked": "checked", "class": "required"}),
required=True)
usability_rating = forms.ChoiceField(label='Benutzerfreundlichkeit',
......
......@@ -2,17 +2,11 @@ import dbsettings
from django.db import models
class KanboardSettings(dbsettings.Group):
# term = dbsettings.IntegerValue(widget=forms.Select, choices=choices)
api_token = dbsettings.StringValue("API token")
kb_project_id_rebus = dbsettings.PositiveIntegerValue("Project ID for REBUS tasks")
kb_project_id_feedback = dbsettings.PositiveIntegerValue("Project ID for feedback tasks")
class MailSettings(dbsettings.Group):
mail_rebus = dbsettings.EmailValue("Email address for REBUS")
mail_feedback = dbsettings.EmailValue("Email address for Feedback")
class Support(models.Model):
class Meta:
permissions = (
......@@ -21,5 +15,4 @@ class Support(models.Model):
)
kanboard_settings = KanboardSettings("Kanboard")
mail_settings = MailSettings("Mail adresses")
......@@ -9,7 +9,7 @@
<h5>Fehler melden – REBUS – REport-A-Bug-System</h5>
<form method="post">
<form method="post" id="rebus-form">
{% csrf_token %}
......@@ -34,11 +34,12 @@
class="materialize-textarea"></textarea>
<label for="{{ form.long_description.id_for_label }}">Bitte beschreibe dein Problem
<strong>genauer</strong> (optional)</label>
<strong>genauer</strong> (optional)
</label>
</div>
</div>
<button type="submit" name="go" class="btn waves-effect waves-light green">
<button type="submit" name="go" id="go" class="btn waves-effect waves-light green">
Problem-/Fehlermeldung einreichen
<i class="material-icons right">send</i>
</button>
......@@ -49,6 +50,15 @@
var props = JSON.parse(document.getElementById('props').textContent);
window.props = props;
window.react_mount = document.getElementById('react-mount');
$('#go').click(function (event) {
var el = $("#rebus-form").get(0);
var valid = el.reportValidity();
console.log(valid);
if (!valid) {
M.toast({html: "<i class='material-icons left'>error</i>Bitte fülle alle benötigten Felder aus!"})
}
});
</script>
<script src="{% static "support/bundle.js" %}"></script>
......
from django.shortcuts import render
from mailer import send_mail_with_template
from support.models import kanboard_settings, mail_settings
from support.models import mail_settings
from untisconnect.api import get_all_rooms
from .forms import REBUSForm
from .forms import FeedbackForm
from kanboard import Kanboard
from dashboard.models import Activity
api_token = kanboard_settings.api_token
p_id_rebus = kanboard_settings.kb_project_id_rebus
p_id_feedback = kanboard_settings.kb_project_id_feedback
kb = Kanboard('https://kanboard.katharineum.de/jsonrpc.php', 'jsonrpc',
api_token)
# Create your views here.
def rebus(request):
if request.method == 'POST':
form = REBUSForm(request.POST)
if form.is_valid():
# Read out form data
contraction = request.user.username
a = form.cleaned_data['a']
b = form.cleaned_data["b"]
c = form.cleaned_data["c"]
short_description = form.cleaned_data['short_description']
long_description = form.cleaned_data['long_description']
# Build description for kanboard
description = "**Kategorie:** {} → {} → {} \n\n **Übermittelt von:** {} \n\n **Nachricht:** {}".format(a, b,
c,
contraction,
long_description)
# Add kanboard task
#kb.create_task(project_id=p_id_rebus, title=short_description, description=description)
# Register activity
desc_act = "{} → {} → {} | {}".format(a, b, c, short_description)
act = Activity(title="Du hast uns ein Problem gemeldet.", description=desc_act, app="REBUS",
......@@ -76,33 +59,6 @@ def feedback(request):
ideas = form.cleaned_data['ideas']
apps = form.cleaned_data["apps"]
# Build description for kanboard
description = """
**Bewertungen:** {}/5 (Design), {}/5 (Geschwindigkeit), {}/5 (Benutzerfreundlichkeit)
**Bewertung (insgesamt):** {}/5
**Pro/Contra:** {}
**Ideen/Wünsche:** {}
**Sonstiges:** {}
""".format(design_rating, performance_rating, usability_rating, overall_rating, apps, ideas, more)
# Get color for kanboard by rating
if int(overall_rating) < 2:
color = "red"
elif 2 < int(overall_rating) <= 3:
color = "yellow"
else:
color = "green"
# Add kanboard task
# kb.create_task(project_id=p_id_feedback,
# title="Feedback von {}".format(request.user.username),
# description=description,
# color_id=color)
# Register activity
act = Activity(title="Du hast uns Feedback gegeben.",
description="Du hast SchoolApps mit {} von 5 Sternen bewertet.".format(
......@@ -125,7 +81,6 @@ def feedback(request):
[mail_settings.mail_feedback],
"support/mail/feedback.txt",
"support/mail/feedback.html", context)
print(context)
return render(request, 'support/feedback_submitted.html')
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment