Compare commits
60 Commits
0.1-Beta
...
kotlinjssu
Author | SHA1 | Date | |
---|---|---|---|
8a0396ab2d | |||
b3960653ca | |||
af321c8aad | |||
16939c7b6a | |||
fbc53b97f5 | |||
99961e18c5 | |||
26d4284169 | |||
026cf1a51a | |||
7e8a857caf | |||
1238a121f4 | |||
98b3c69c15 | |||
9cf713ab4a | |||
04ecbd1375 | |||
0bf021ab5a | |||
4fe1b0c6ae | |||
1dc2aa1022 | |||
daf440e36b | |||
22a9a5b612 | |||
02dff914ca | |||
5e42eeb2ae | |||
02e6f96a3a | |||
e5d579e9d0 | |||
339ba9861b | |||
10058b24a7 | |||
cdb03ada81 | |||
7207f39892 | |||
a9cf947670 | |||
664ba5e28b | |||
d34b43f61a | |||
c590b612b5 | |||
81e79c1e67 | |||
7f62fc9bec | |||
fa16d1206b | |||
ce44ee5d17 | |||
23f75cae4f | |||
b9ba0dbcef | |||
92ef4cc0c6 | |||
ac02e4bd62 | |||
c3fb92d6eb | |||
05b15a1ea2 | |||
86dc38a8da | |||
7c8a0d3018 | |||
4b96ad576d | |||
f7383474ac | |||
0518c1c809 | |||
c44a0dd9ec | |||
28d5ba0b03 | |||
7ca16400d4 | |||
a1b3998890 | |||
27c2b9ceb4 | |||
3a82f81c1a | |||
1ef61f13ab | |||
e26258c3cf | |||
b1e7de952a | |||
89426cfcee | |||
e4f9d88cda | |||
ab1ce79900 | |||
f32dbd802b | |||
23bffc4c6e | |||
97214d786e |
2
.idea/.gitignore
generated
vendored
2
.idea/.gitignore
generated
vendored
@ -1,2 +0,0 @@
|
||||
# Default ignored files
|
||||
/workspace.xml
|
11
.idea/artifacts/WasteInformationServer_main_jar.xml
generated
11
.idea/artifacts/WasteInformationServer_main_jar.xml
generated
@ -1,11 +0,0 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="WasteInformationServer.main:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/WasteInformationServer_main_jar</output-path>
|
||||
<root id="archive" name="WasteInformationServer.main.jar">
|
||||
<element id="module-output" name="WasteInformationServer.main" />
|
||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.eclipse.paho/org.eclipse.paho.client.mqttv3/1.0.2/e1c9a81aadf25b884c779298a90750d0ab8013a5/org.eclipse.paho.client.mqttv3-1.0.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/mysql/mysql-connector-java/8.0.18/e088efaa4b568bc7d9f7274b9c5ea1a00da1a45c/mysql-connector-java-8.0.18.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protobuf-java/3.6.1/d06d46ecfd92ec6d0f3b423b4cd81cb38d8b924/protobuf-java-3.6.1.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
22
.idea/gradle.xml
generated
22
.idea/gradle.xml
generated
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="true" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="11" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="useAutoImport" value="true" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
10
.idea/inspectionProfiles/Project_Default.xml
generated
10
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,10 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<Languages>
|
||||
<language minSize="47" name="Java" />
|
||||
</Languages>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
20
.idea/jarRepositories.xml
generated
20
.idea/jarRepositories.xml
generated
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
10
.idea/misc.xml
generated
10
.idea/misc.xml
generated
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" default="true" project-jdk-name="13" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
generated
124
.idea/uiDesigner.xml
generated
@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
28
.travis.yml
Normal file
28
.travis.yml
Normal file
@ -0,0 +1,28 @@
|
||||
language: java
|
||||
jdk: oraclejdk8
|
||||
dist: trusty
|
||||
|
||||
# Make the gradle wrapper executable
|
||||
# before_install: chmod +x gradlew
|
||||
before_install:
|
||||
- wget https://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
- unzip -qq gradle-6.1.1-all.zip
|
||||
- export GRADLE_HOME=$PWD/gradle-6.1.1
|
||||
- export PATH=$GRADLE_HOME/bin:$PATH
|
||||
- gradle -v
|
||||
|
||||
script:
|
||||
#- gradle check jacocoTestReport
|
||||
# Also upload test coverage to codecov
|
||||
#- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
|
||||
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
94
WebServer/build.gradle
Normal file
94
WebServer/build.gradle
Normal file
@ -0,0 +1,94 @@
|
||||
//plugins {
|
||||
// id 'org.jetbrains.kotlin.js' version '1.3.70-eap-184'
|
||||
//}
|
||||
|
||||
//group 'org.example'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.web_dir = '../src/resources/wwwroot/js/'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin2js'
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs = ["src/js/"]
|
||||
test.java.srcDirs = ["src/js/test"]
|
||||
}
|
||||
|
||||
compileKotlin2Js {
|
||||
kotlinOptions.outputFile = "${projectDir}/build/web/WasteInformationServer.js"
|
||||
kotlinOptions.moduleKind = "plain"
|
||||
kotlinOptions.sourceMap = true
|
||||
}
|
||||
|
||||
compileTestKotlin2Js {
|
||||
kotlinOptions.moduleKind = "plain"
|
||||
kotlinOptions.sourceMap = true
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "http://dl.bintray.com/kotlin/kotlin-eap-1.1"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
|
||||
testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
|
||||
}
|
||||
|
||||
clean.doFirst() {
|
||||
delete("${web_dir}")
|
||||
}
|
||||
|
||||
build.doLast() {
|
||||
// Copy kotlin.js and kotlin-meta.js from jar into web directory
|
||||
configurations.compile.each { File file ->
|
||||
copy {
|
||||
includeEmptyDirs = false
|
||||
|
||||
from zipTree(file.absolutePath)
|
||||
into "${projectDir}/${web_dir}/lib"
|
||||
include { fileTreeElement ->
|
||||
def path = fileTreeElement.path
|
||||
path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unpack build contents
|
||||
// TODO Remove this step when a CDN link is available.
|
||||
copy {
|
||||
File artifact = new File("build/libs/${project.name}-${project.version}.jar")
|
||||
includeEmptyDirs = false
|
||||
|
||||
from zipTree(artifact)
|
||||
into "${web_dir}"
|
||||
include { fileTreeElement ->
|
||||
def path = fileTreeElement.path
|
||||
!(path.startsWith("META-INF/") || path.startsWith("${project.name}"))
|
||||
}
|
||||
}
|
||||
|
||||
// Copy scripts to web directory
|
||||
copy {
|
||||
includeEmptyDirs = false
|
||||
from new File("build/classes/main")
|
||||
into "${web_dir}/lib"
|
||||
}
|
||||
|
||||
copy {
|
||||
includeEmptyDirs = false
|
||||
from new File("build/classes/test")
|
||||
into "${web_dir}/lib"
|
||||
}
|
||||
}
|
1
WebServer/settings.gradle
Normal file
1
WebServer/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
rootProject.name = 'WebServer'
|
26
WebServer/src/js/Dashboard.kt
Normal file
26
WebServer/src/js/Dashboard.kt
Normal file
@ -0,0 +1,26 @@
|
||||
import org.w3c.fetch.RequestInit
|
||||
import kotlin.browser.document
|
||||
import kotlin.browser.window
|
||||
import kotlin.js.Json
|
||||
|
||||
class Dashboard {
|
||||
init {
|
||||
window.fetch("/senddata/wastedata", RequestInit(method = "POST", body = "action=getStartHeaderData")).then { it -> it.text().then {
|
||||
println("response text is: "+it)
|
||||
val json = JSON.parse<Json>(it)
|
||||
document.getElementById("total-connection-labels")?.innerHTML = json["collectionnumber"] as String
|
||||
document.getElementById("planed-collection-label")?.innerHTML = json["futurecollections"] as String
|
||||
|
||||
document.getElementById("finished-collection-label")?.innerHTML = json["finshedcollections"] as String
|
||||
|
||||
document.getElementById("total-city-number-label")?.innerHTML = json["citynumber"] as String
|
||||
} }
|
||||
|
||||
window.fetch("/senddata/wastedata", RequestInit(method = "POST", body = "action=getversionandbuildtime")).then { it -> it.text().then {
|
||||
val json = JSON.parse<Json>(it)
|
||||
document.getElementById("version-footer-label")?.innerHTML = "<b>Version</b> " + json["version"] + " <b>Build</b> " + json["buildtime"] as String
|
||||
} }
|
||||
|
||||
|
||||
}
|
||||
}
|
39
WebServer/src/js/Index.kt
Normal file
39
WebServer/src/js/Index.kt
Normal file
@ -0,0 +1,39 @@
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
import org.w3c.fetch.RequestInit
|
||||
import kotlin.browser.document
|
||||
import kotlin.browser.window
|
||||
import kotlin.js.Json
|
||||
|
||||
class Index {
|
||||
init {
|
||||
document.getElementById("loginbtn")?.addEventListener("click", {
|
||||
it.preventDefault()
|
||||
println("clicked!!!")
|
||||
|
||||
val username = document.getElementById("userfield") as HTMLInputElement
|
||||
val passfield = document.getElementById("passfield") as HTMLInputElement
|
||||
println(username.value)
|
||||
|
||||
console.log("fetch 'data.json' with 'post'")
|
||||
window.fetch("/senddata/loginget", RequestInit(method = "POST", body = "username=${username.value}&password=${passfield.value}")).then { response ->
|
||||
response.text().then { text ->
|
||||
val json = JSON.parse<Json>(text)
|
||||
if (json["status"] == "nodbconn") {
|
||||
js("""Swal.fire({
|
||||
type: "error",
|
||||
title: 'No connection to Database',
|
||||
html: 'Setup DB here --> <a href="index.html">click<a/>.'
|
||||
})""")
|
||||
}
|
||||
|
||||
if (json["accept"] == true) {
|
||||
println("successfully logged in!")
|
||||
document.cookie = "username=$username"
|
||||
window.location.replace("dashboard.html")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// todo register pwa correctly
|
||||
}
|
18
WebServer/src/js/Main.kt
Normal file
18
WebServer/src/js/Main.kt
Normal file
@ -0,0 +1,18 @@
|
||||
import kotlin.browser.window
|
||||
|
||||
fun main() {
|
||||
val callurl = window.document.URL
|
||||
window.onload = {
|
||||
if (callurl.endsWith("/") || callurl.contains("index.html")) {
|
||||
println("loaded sucessfully")
|
||||
Index()
|
||||
}
|
||||
else if (callurl.contains("dashboard.html")) {
|
||||
Dashboard()
|
||||
}
|
||||
else {
|
||||
println("js called from undefined html file")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
WebServer/src/js/Requester.kt
Normal file
15
WebServer/src/js/Requester.kt
Normal file
@ -0,0 +1,15 @@
|
||||
import org.w3c.xhr.XMLHttpRequest
|
||||
|
||||
class Requester {
|
||||
fun request(){
|
||||
val test = XMLHttpRequest()
|
||||
|
||||
test.open("GET","https://api.ipify.org?format=json")
|
||||
|
||||
test.onload = {
|
||||
println(test.responseText)
|
||||
}
|
||||
|
||||
test.send()
|
||||
}
|
||||
}
|
26
build.gradle
26
build.gradle
@ -1,9 +1,12 @@
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
|
||||
}
|
||||
|
||||
group 'com.wasteinformationserver'
|
||||
version '0.1-Beta'
|
||||
version '0.3.1-Beta'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
@ -13,7 +16,7 @@ repositories {
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Main-Class': 'com.wasteinformationserver.main'
|
||||
attributes 'Main-Class': 'com.wasteinformationserver.Main'
|
||||
}
|
||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
}
|
||||
@ -26,11 +29,12 @@ sourceSets {
|
||||
dependencies {
|
||||
compile group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version: '1.2.2'
|
||||
compile group: 'mysql',name:'mysql-connector-java',version: '8.0.18'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
}
|
||||
|
||||
task run (type: JavaExec){
|
||||
description = "Secure algorythm testing"
|
||||
main = 'com.wasteinformationserver.main'
|
||||
main = 'com.wasteinformationserver.Main'
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
|
||||
@ -39,11 +43,27 @@ task createProperties(dependsOn: processResources) {
|
||||
new File("$projectDir/src/resources/version.properties").withWriter { w ->
|
||||
Properties p = new Properties()
|
||||
p['version'] = project.version.toString()
|
||||
p['buildtime'] = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date())
|
||||
p.store w, null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources.dependsOn("WebServer:build")
|
||||
|
||||
task myJavadocs(type: Javadoc) {
|
||||
title = "JAVADOC WasteInformationServer"
|
||||
source = sourceSets.main.allJava
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
|
||||
classes {
|
||||
dependsOn createProperties
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
@ -1,2 +1,3 @@
|
||||
rootProject.name = 'WasteInformationServer'
|
||||
|
||||
include 'WebServer'
|
@ -1,3 +1,6 @@
|
||||
/**
|
||||
* dead code...
|
||||
*/
|
||||
package com.wasteinformationserver;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
@ -49,13 +52,13 @@ public class Dateget {
|
||||
|
||||
public void printList() {
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
Log.debug(list.get(n));
|
||||
Log.Log.debug(list.get(n));
|
||||
}
|
||||
}
|
||||
|
||||
public void printListnew() {
|
||||
for (int n = 0; n < listnew.size(); n++) {
|
||||
Log.debug(listnew.get(n));
|
||||
Log.Log.debug(listnew.get(n));
|
||||
}
|
||||
}
|
||||
|
||||
|
50
src/java/com/wasteinformationserver/Main.kt
Normal file
50
src/java/com/wasteinformationserver/Main.kt
Normal file
@ -0,0 +1,50 @@
|
||||
@file:JvmName("Main")
|
||||
package com.wasteinformationserver
|
||||
|
||||
import com.wasteinformationserver.basicutils.Info
|
||||
import com.wasteinformationserver.basicutils.Log
|
||||
import com.wasteinformationserver.db.JDBC
|
||||
import com.wasteinformationserver.mqtt.MqttService
|
||||
import com.wasteinformationserver.website.Webserver
|
||||
import java.io.IOException
|
||||
|
||||
fun main() {
|
||||
Log.setLevel(Log.DEBUG)
|
||||
Info.init()
|
||||
|
||||
Log.info("startup of WasteInformationServer")
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(Thread(Runnable {
|
||||
try {
|
||||
Thread.sleep(200)
|
||||
Log.warning("Shutting down ...")
|
||||
//shutdown routine
|
||||
} catch (e: InterruptedException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}))
|
||||
|
||||
Log.info("Server version: " + Info.getVersion())
|
||||
Log.debug("Build date: " + Info.getBuilddate())
|
||||
|
||||
//initial connect to db
|
||||
Log.message("initial login to db")
|
||||
try {
|
||||
JDBC.init("ingproject", "Kb9Dxklumt76ieq6", "ingproject", "db.power4future.at", 3306)
|
||||
//JDBC.init("users", "kOpaIJUjkgb9ur6S", "wasteinformation", "192.168.65.15", 3306);
|
||||
} catch (e: IOException) { //e.printStackTrace();
|
||||
Log.error("no connection to db")
|
||||
}
|
||||
|
||||
|
||||
//startup web server
|
||||
val mythread = Thread(Runnable { Webserver().startserver() })
|
||||
mythread.start()
|
||||
|
||||
|
||||
//startup mqtt service
|
||||
Log.message("starting mqtt service")
|
||||
|
||||
val m = MqttService("mqtt.heili.eu", "1883")
|
||||
m.startupService()
|
||||
}
|
@ -1,35 +1,85 @@
|
||||
package com.wasteinformationserver.basicutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* get basic infos about Software
|
||||
*
|
||||
* @author Lukas Heiligenbrunner
|
||||
*/
|
||||
public class Info {
|
||||
public static String version="0.0";
|
||||
public static String builddate;
|
||||
private static String version = "not init";
|
||||
private static String builddate = "not init";
|
||||
private static String starttime = "not init";
|
||||
|
||||
/**
|
||||
* get Software Version (defined in gradle build file)
|
||||
*
|
||||
* @return Version as string
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
/**
|
||||
* get Software build date
|
||||
*
|
||||
* @return Date as string
|
||||
*/
|
||||
public static String getBuilddate() {
|
||||
return builddate;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Server start time
|
||||
*
|
||||
* @return start time
|
||||
*/
|
||||
public static String getStarttime() {
|
||||
return starttime;
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize the version and builddate variables
|
||||
*/
|
||||
public static void init() {
|
||||
starttime = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new Date());
|
||||
Properties prop = new Properties();
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
|
||||
|
||||
URL url = Info.class.getResource("/version.properties");
|
||||
|
||||
String builddatee = format.format(new Date(new File(url.toURI()).lastModified()));
|
||||
builddate=builddatee;
|
||||
|
||||
prop.load(url.openStream());
|
||||
version=(String)prop.get("version");
|
||||
version = (String) prop.get("version");
|
||||
builddate = (String) prop.get("buildtime");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* print memory utilization
|
||||
* todo parse into website somehow
|
||||
*/
|
||||
public static void getMemoryUsage() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
long maxMemory = runtime.maxMemory();
|
||||
long allocatedMemory = runtime.totalMemory();
|
||||
long freeMemory = runtime.freeMemory();
|
||||
|
||||
sb.append("free memory: " + format.format(freeMemory / 1024) + "\n");
|
||||
sb.append("allocated memory: " + format.format(allocatedMemory / 1024) + "\n");
|
||||
sb.append("max memory: " + format.format(maxMemory / 1024) + "\n");
|
||||
sb.append("total free memory: " + format.format((freeMemory + (maxMemory - allocatedMemory)) / 1024) + "\n");
|
||||
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
}
|
||||
|
@ -1,123 +0,0 @@
|
||||
package com.wasteinformationserver.basicutils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
public class Log {
|
||||
|
||||
private static final String ANSI_RESET = "\u001B[0m";
|
||||
private static final String ANSI_BLACK = "\u001B[30m";
|
||||
private static final String ANSI_RED = "\u001B[31m";
|
||||
private static final String ANSI_GREEN = "\u001B[32m";
|
||||
private static final String ANSI_YELLOW = "\u001B[33m";
|
||||
private static final String ANSI_BLUE = "\u001B[34m";
|
||||
private static final String ANSI_PURPLE = "\u001B[35m";
|
||||
private static final String ANSI_CYAN = "\u001B[36m";
|
||||
private static final String ANSI_WHITE = "\u001B[37m";
|
||||
|
||||
public static final int CRITICAL_ERROR = 6;
|
||||
public static final int ERROR = 5;
|
||||
public static final int WARNING = 4;
|
||||
public static final int INFO = 3;
|
||||
public static final int MESSAGE = 2;
|
||||
public static final int DEBUG = 1;
|
||||
|
||||
private static int Loglevel = 0;
|
||||
|
||||
private static ArrayList<String> colors = new ArrayList<String>(Arrays.asList("", "DEBUG", "MESSAGE", "INFO", "WARNING", "ERROR", "CRITICAL_ERROR"));
|
||||
|
||||
public static void criticalerror(Object msg) {
|
||||
if (Loglevel <= CRITICAL_ERROR)
|
||||
log(msg, CRITICAL_ERROR);
|
||||
}
|
||||
|
||||
public static void error(Object msg) {
|
||||
if (Loglevel <= ERROR)
|
||||
log(msg, ERROR);
|
||||
}
|
||||
|
||||
public static void warning(Object msg) {
|
||||
if (Loglevel <= WARNING)
|
||||
log(msg, WARNING);
|
||||
}
|
||||
|
||||
public static void info(Object msg) {
|
||||
if (Loglevel <= INFO)
|
||||
log(msg, INFO);
|
||||
}
|
||||
|
||||
public static void message(Object msg) {
|
||||
if (Loglevel <= MESSAGE)
|
||||
log(msg, MESSAGE);
|
||||
}
|
||||
|
||||
public static void debug(Object msg) {
|
||||
if (Loglevel <= DEBUG)
|
||||
log(msg, DEBUG);
|
||||
}
|
||||
|
||||
|
||||
public static void log(Object msg, int level) {
|
||||
boolean iswindows = System.getProperty("os.name").contains("Windows");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (!iswindows) {
|
||||
switch (level) {
|
||||
case INFO:
|
||||
builder.append(ANSI_CYAN);
|
||||
break;
|
||||
case WARNING:
|
||||
builder.append(ANSI_YELLOW);
|
||||
break;
|
||||
case ERROR:
|
||||
builder.append(ANSI_RED);
|
||||
break;
|
||||
case CRITICAL_ERROR:
|
||||
builder.append(ANSI_RED);
|
||||
break;
|
||||
case MESSAGE:
|
||||
builder.append(ANSI_WHITE);
|
||||
break;
|
||||
case DEBUG:
|
||||
builder.append(ANSI_BLUE);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
builder.append("[");
|
||||
builder.append(calcDate(System.currentTimeMillis()));
|
||||
builder.append("]");
|
||||
|
||||
builder.append(" [");
|
||||
builder.append(new Exception().getStackTrace()[2].getClassName());
|
||||
builder.append("]");
|
||||
|
||||
builder.append(" [");
|
||||
builder.append(colors.get(level));
|
||||
builder.append("]");
|
||||
|
||||
if (!iswindows) {
|
||||
builder.append(ANSI_WHITE);
|
||||
}
|
||||
|
||||
builder.append(" - ");
|
||||
builder.append(msg.toString());
|
||||
|
||||
if (!iswindows) {
|
||||
builder.append(ANSI_RESET);
|
||||
}
|
||||
System.out.println(builder.toString());
|
||||
}
|
||||
|
||||
private static String calcDate(long millisecs) {
|
||||
SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date resultdate = new Date(millisecs);
|
||||
return date_format.format(resultdate);
|
||||
}
|
||||
|
||||
public static void setLevel(int level) {
|
||||
Loglevel = level;
|
||||
}
|
||||
|
||||
}
|
139
src/java/com/wasteinformationserver/basicutils/Log.kt
Normal file
139
src/java/com/wasteinformationserver/basicutils/Log.kt
Normal file
@ -0,0 +1,139 @@
|
||||
package com.wasteinformationserver.basicutils
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class Log {
|
||||
companion object Log{
|
||||
val CRITICAL_ERROR = 6
|
||||
val ERROR = 5
|
||||
val WARNING = 4
|
||||
val INFO = 3
|
||||
val MESSAGE = 2
|
||||
val DEBUG = 1
|
||||
|
||||
private val ANSI_RESET = "\u001B[0m"
|
||||
private val ANSI_BLACK = "\u001B[30m"
|
||||
private val ANSI_RED = "\u001B[31m"
|
||||
private val ANSI_GREEN = "\u001B[32m"
|
||||
private val ANSI_YELLOW = "\u001B[33m"
|
||||
private val ANSI_BLUE = "\u001B[34m"
|
||||
private val ANSI_PURPLE = "\u001B[35m"
|
||||
private val ANSI_CYAN = "\u001B[36m"
|
||||
private val ANSI_WHITE = "\u001B[37m"
|
||||
|
||||
private var Loglevel = 0
|
||||
|
||||
/**
|
||||
* Log critical Error
|
||||
*
|
||||
* @param msg message
|
||||
*/
|
||||
fun criticalerror(msg: Any) {
|
||||
if (Loglevel <= CRITICAL_ERROR) log(msg, CRITICAL_ERROR)
|
||||
}
|
||||
|
||||
/**
|
||||
* Log basic Error
|
||||
*
|
||||
* @param msg message
|
||||
*/
|
||||
fun error(msg: Any) {
|
||||
if (Loglevel <= ERROR) log(msg, ERROR)
|
||||
}
|
||||
|
||||
/**
|
||||
* Log warning
|
||||
*
|
||||
* @param msg message
|
||||
*/
|
||||
fun warning(msg: Any) {
|
||||
if (Loglevel <= WARNING) log(msg, WARNING)
|
||||
}
|
||||
|
||||
/**
|
||||
* Log info
|
||||
*
|
||||
* @param msg message
|
||||
*/
|
||||
fun info(msg: Any) {
|
||||
if (Loglevel <= INFO) log(msg, INFO)
|
||||
}
|
||||
|
||||
/**
|
||||
* Log basic message
|
||||
*
|
||||
* @param msg message
|
||||
*/
|
||||
fun message(msg: Any) {
|
||||
if (Loglevel <= MESSAGE) log(msg, MESSAGE)
|
||||
}
|
||||
|
||||
/**
|
||||
* Log debug Message
|
||||
*
|
||||
* @param msg message
|
||||
*/
|
||||
fun debug(msg: Any) {
|
||||
if (Loglevel <= DEBUG) log(msg, DEBUG)
|
||||
}
|
||||
|
||||
/**
|
||||
* Log as defined
|
||||
*
|
||||
* @param msg message
|
||||
* @param level Loglevel --> static vals defined
|
||||
*/
|
||||
fun log(msg: Any, level: Int) {
|
||||
val iswindows = System.getProperty("os.name").contains("Windows")
|
||||
val builder = StringBuilder()
|
||||
if (!iswindows) {
|
||||
when (level) {
|
||||
INFO -> builder.append(ANSI_CYAN)
|
||||
WARNING -> builder.append(ANSI_YELLOW)
|
||||
ERROR -> builder.append(ANSI_RED)
|
||||
CRITICAL_ERROR -> builder.append(ANSI_RED)
|
||||
MESSAGE -> builder.append(ANSI_WHITE)
|
||||
DEBUG -> builder.append(ANSI_BLUE)
|
||||
}
|
||||
}
|
||||
builder.append("[")
|
||||
builder.append(calcDate(System.currentTimeMillis()))
|
||||
builder.append("]")
|
||||
builder.append(" [")
|
||||
builder.append(Exception().stackTrace[2].className)
|
||||
builder.append("]")
|
||||
builder.append(" [")
|
||||
builder.append(colors[level])
|
||||
builder.append("]")
|
||||
if (!iswindows) {
|
||||
builder.append(ANSI_WHITE)
|
||||
}
|
||||
builder.append(" - ")
|
||||
builder.append(msg.toString())
|
||||
if (!iswindows) {
|
||||
builder.append(ANSI_RESET)
|
||||
}
|
||||
println(builder.toString())
|
||||
}
|
||||
|
||||
/**
|
||||
* define Loglevel call on startup or at runtime
|
||||
* default: 0[DEBUG] --> Max logging
|
||||
*
|
||||
* @param level Loglevel --> static vals defined
|
||||
*/
|
||||
fun setLevel(level: Int) {
|
||||
Loglevel = level
|
||||
}
|
||||
private val colors = ArrayList(Arrays.asList("", "DEBUG", "MESSAGE", "INFO", "WARNING", "ERROR", "CRITICAL_ERROR"))
|
||||
|
||||
|
||||
|
||||
private fun calcDate(millisecs: Long): String? {
|
||||
val date_format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
val resultdate = Date(millisecs)
|
||||
return date_format.format(resultdate)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,9 @@
|
||||
package com.wasteinformationserver.db;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
|
||||
public abstract class
|
||||
Database {
|
||||
abstract class Database {
|
||||
|
||||
protected String user;
|
||||
protected String password;
|
||||
@ -29,62 +22,4 @@ Database {
|
||||
}
|
||||
|
||||
public abstract Connection getConnection() throws SQLException;
|
||||
|
||||
public static void logToConsole(ResultSet res) {
|
||||
try {
|
||||
|
||||
ResultSetMetaData rsmd = res.getMetaData();
|
||||
|
||||
while (res.next()) {
|
||||
String row = "";
|
||||
|
||||
for (int i = 1; i <= rsmd.getColumnCount(); ++i) {
|
||||
if (row.length() > 0) {
|
||||
row += ", ";
|
||||
}
|
||||
|
||||
if (res.getObject(i) != null) {
|
||||
row +=
|
||||
rsmd.getColumnName(i) +
|
||||
": " +
|
||||
res.getObject(i).toString();
|
||||
}
|
||||
}
|
||||
|
||||
Log.debug(row);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static DefaultTableModel logToTable(ResultSet res) {
|
||||
try {
|
||||
ResultSetMetaData rsmd = res.getMetaData();
|
||||
Vector<String> columnNames = new Vector<>();
|
||||
int columnCount = rsmd.getColumnCount();
|
||||
|
||||
for (int i = 1; i <= columnCount; ++i) {
|
||||
columnNames.add(rsmd.getColumnName(i));
|
||||
}
|
||||
|
||||
Vector<Vector<Object>> data = new Vector<>();
|
||||
|
||||
while (res.next()) {
|
||||
Vector<Object> row = new Vector();
|
||||
|
||||
for (int i = 1; i <= columnCount; ++i) {
|
||||
row.add(res.getObject(i));
|
||||
}
|
||||
|
||||
data.add(row);
|
||||
}
|
||||
|
||||
return new DefaultTableModel(data, columnNames);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
111
src/java/com/wasteinformationserver/db/JDBC.java
Normal file
111
src/java/com/wasteinformationserver/db/JDBC.java
Normal file
@ -0,0 +1,111 @@
|
||||
package com.wasteinformationserver.db;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* basic connection class to a Database
|
||||
*
|
||||
* @author Lukas Heiligenbrunner
|
||||
*/
|
||||
public class JDBC {
|
||||
private static Connection conn;
|
||||
|
||||
private static JDBC JDBC;
|
||||
private static boolean loggedin = false;
|
||||
|
||||
private static String usernamec;
|
||||
private static String passwordc;
|
||||
private static String dbnamec;
|
||||
private static String ipc;
|
||||
private static int portc;
|
||||
|
||||
/**
|
||||
* initialize database values
|
||||
* suggested on startup
|
||||
*
|
||||
* @param username db username
|
||||
* @param password db password
|
||||
* @param dbname Database name
|
||||
* @param ip Server ip or hostname
|
||||
* @param port Server port
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void init(String username, String password, String dbname, String ip, int port) throws IOException {
|
||||
usernamec = username;
|
||||
passwordc = password;
|
||||
dbnamec = dbname;
|
||||
ipc = ip;
|
||||
portc = port;
|
||||
JDBC = new JDBC(username, password, dbname, ip, port);
|
||||
}
|
||||
|
||||
private JDBC(String username, String password, String dbname, String ip, int port) throws IOException {
|
||||
logintodb(username, password, dbname, ip, port);
|
||||
}
|
||||
|
||||
/**
|
||||
* get instance of db object
|
||||
* logindata has to be set before!
|
||||
*
|
||||
* @return JDBC object of this
|
||||
* @throws IOException
|
||||
*/
|
||||
public static JDBC getInstance() throws IOException {
|
||||
if (loggedin) {
|
||||
return JDBC;
|
||||
} else {
|
||||
logintodb(usernamec, passwordc, dbnamec, ipc, portc);
|
||||
return JDBC;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void logintodb(String username, String password, String dbname, String ip, int port) throws IOException {
|
||||
Database db = new MySQLConnector(
|
||||
username,
|
||||
password,
|
||||
ip,
|
||||
port,
|
||||
dbname);
|
||||
|
||||
try {
|
||||
conn = db.getConnection();
|
||||
loggedin = true;
|
||||
} catch (SQLException e) {
|
||||
throw new IOException("No connection to database");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* execute basic query --> requests only
|
||||
*
|
||||
* @param sql query sql statement
|
||||
* @return ResultSet representating the table
|
||||
*/
|
||||
public ResultSet executeQuery(String sql) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
return stmt.executeQuery();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* update db in some way
|
||||
*
|
||||
* @param sql sql insert/update/delete statement
|
||||
* @return status
|
||||
* @throws SQLException
|
||||
*/
|
||||
public int executeUpdate(String sql) throws SQLException {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
|
||||
return stmt.executeUpdate();
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package com.wasteinformationserver.db;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class JDCB {
|
||||
static Connection conn;
|
||||
|
||||
static JDCB jdcb;
|
||||
static boolean loggedin = false;
|
||||
|
||||
static String usernamec;
|
||||
static String passwordc;
|
||||
static String dbnamec;
|
||||
static String ipc;
|
||||
static int portc;
|
||||
|
||||
public static void init(String username, String password, String dbname, String ip, int port) throws IOException {
|
||||
usernamec = username;
|
||||
passwordc = password;
|
||||
dbnamec = dbname;
|
||||
jdcb = new JDCB(username, password, dbname, ip, port);
|
||||
}
|
||||
|
||||
private JDCB(String username, String password, String dbname, String ip, int port) throws IOException {
|
||||
logintodb(username, password, dbname, ip, port);
|
||||
}
|
||||
|
||||
public static JDCB getInstance() throws IOException {
|
||||
if (loggedin) {
|
||||
return jdcb;
|
||||
} else {
|
||||
logintodb(usernamec, passwordc, dbnamec, ipc, portc);
|
||||
return jdcb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void logintodb(String username, String password, String dbname, String ip, int port) throws IOException {
|
||||
Database db = new MySQLConnector(
|
||||
username,
|
||||
password,
|
||||
ip,
|
||||
port,
|
||||
dbname);
|
||||
|
||||
try {
|
||||
conn = db.getConnection();
|
||||
loggedin = true;
|
||||
} catch (SQLException e) {
|
||||
throw new IOException("No connection to database");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ResultSet executeQuery(String sql) {
|
||||
try {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
return stmt.executeQuery();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int executeUpdate(String sql) throws SQLException {
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
|
||||
return stmt.executeUpdate();
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class MySQLConnector extends Database {
|
||||
class MySQLConnector extends Database {
|
||||
|
||||
static {
|
||||
try {
|
||||
@ -19,7 +19,7 @@ public class MySQLConnector extends Database {
|
||||
}
|
||||
|
||||
public Connection getConnection() throws SQLException {
|
||||
DriverManager.setLoginTimeout(1); // TODO: 30.11.19 set higher maybe
|
||||
DriverManager.setLoginTimeout(1);
|
||||
return DriverManager.getConnection(
|
||||
"jdbc:mysql://" + host + ":" + port + "/" + dbName + "?useSSL=false",
|
||||
user,
|
||||
|
@ -1,37 +0,0 @@
|
||||
package com.wasteinformationserver.db;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class PostgreSQLConnector extends Database {
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName("org.postgresql.Driver").newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public PostgreSQLConnector(String user, String password, String host, int port, String dbName) {
|
||||
super(user, password, host, port, dbName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
Connection con = null;
|
||||
|
||||
try {
|
||||
con = DriverManager.getConnection(
|
||||
"jdbc:postgresql://" + host + ":" + port + "/" + dbName,
|
||||
user,
|
||||
password);
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return con;
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
package com.wasteinformationserver;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Info;
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.mqtt.mqtt;
|
||||
import com.wasteinformationserver.website.Webserver;
|
||||
import java.io.IOException;
|
||||
|
||||
public class main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
Log.setLevel(Log.DEBUG);
|
||||
Log.info("startup of WasteInformationServer");
|
||||
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
Log.warning("Shutting down ...");
|
||||
|
||||
//shutdown routine
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}));
|
||||
|
||||
Info.init();
|
||||
Log.info("Server version: "+Info.version);
|
||||
Log.debug("Build date: "+Info.builddate);
|
||||
|
||||
//initial connect to db
|
||||
Log.message("initial login to db");
|
||||
new Thread(() -> {
|
||||
try {
|
||||
JDCB.init("ingproject", "Kb9Dxklumt76ieq6", "ingproject", "db.power4future.at", 3306);
|
||||
//JDCB.init("users", "kOpaIJUjkgb9ur6S", "wasteinformation", "192.168.65.15", 3306);
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
Log.error("no connection to db");
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
//startup web server
|
||||
Thread mythread = new Thread(() -> new Webserver().startserver());
|
||||
mythread.start();
|
||||
|
||||
|
||||
//startup mqtt service
|
||||
Log.message("starting mqtt service");
|
||||
try {
|
||||
mqtt m = new mqtt();
|
||||
m.notifymessage();
|
||||
} catch (Exception e) {
|
||||
Log.debug("An error was happened in the class mqtt");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package com.wasteinformationserver.mqtt;
|
||||
|
||||
public class Database {
|
||||
}
|
178
src/java/com/wasteinformationserver/mqtt/MqttService.kt
Normal file
178
src/java/com/wasteinformationserver/mqtt/MqttService.kt
Normal file
@ -0,0 +1,178 @@
|
||||
package com.wasteinformationserver.mqtt
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log.Log.debug
|
||||
import com.wasteinformationserver.basicutils.Log.Log.error
|
||||
import com.wasteinformationserver.basicutils.Log.Log.info
|
||||
import com.wasteinformationserver.basicutils.Log.Log.message
|
||||
import com.wasteinformationserver.db.JDBC
|
||||
import org.eclipse.paho.client.mqttv3.*
|
||||
import java.io.IOException
|
||||
import java.sql.SQLException
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Mqtt Service to receive and send back messages to the Hardware
|
||||
* check values from db send right feedback to hardware.
|
||||
*
|
||||
* @author Lukas Heiligenbrunner
|
||||
* @author Gregor Dutzler
|
||||
*/
|
||||
class MqttService(serverurl: String, port: String) {
|
||||
private var client: MqttClient? = null
|
||||
private val serveruri: String
|
||||
private var db: JDBC? = null
|
||||
|
||||
/**
|
||||
* init mqtt service
|
||||
* JDBC has to be inited before
|
||||
*
|
||||
* @param serverurl mqtt server ip or hostname
|
||||
* @param port mqtt server port
|
||||
*/
|
||||
init {
|
||||
serveruri = "tcp://$serverurl:$port"
|
||||
connect()
|
||||
}
|
||||
|
||||
/**
|
||||
* startup of the mqtt service
|
||||
*/
|
||||
fun startupService() {
|
||||
try {
|
||||
client = MqttClient(serveruri, "JavaSample42")
|
||||
val connOpts = MqttConnectOptions()
|
||||
connOpts.isCleanSession = true
|
||||
client!!.connect(connOpts)
|
||||
client!!.setCallback(object : MqttCallback {
|
||||
override fun connectionLost(throwable: Throwable) {
|
||||
error("connection lost")
|
||||
connect()
|
||||
}
|
||||
|
||||
override fun messageArrived(s: String, mqttMessage: MqttMessage) {
|
||||
val deviceid = String(mqttMessage.payload)
|
||||
message("received Request from PCB")
|
||||
val res = db!!.executeQuery("SELECT * from devices WHERE DeviceID=$deviceid")
|
||||
try {
|
||||
res.last()
|
||||
if (res.row != 0) { //existing device
|
||||
res.first()
|
||||
val devicecities = db!!.executeQuery("SELECT * from device_city WHERE DeviceID='$deviceid'")
|
||||
devicecities.last()
|
||||
if (devicecities.row == 0) { //not configured
|
||||
tramsmitMessage("$deviceid,-1")
|
||||
} else {
|
||||
devicecities.first()
|
||||
devicecities.previous()
|
||||
|
||||
while (devicecities.next()) {
|
||||
val cityid = devicecities.getInt("CityID")
|
||||
checkDatabase(cityid, deviceid.toInt())
|
||||
}
|
||||
}
|
||||
} else { //new device
|
||||
db!!.executeUpdate("INSERT INTO devices (DeviceID) VALUES ($deviceid)")
|
||||
info("new device registered to server")
|
||||
tramsmitMessage("$deviceid,-1")
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun deliveryComplete(iMqttDeliveryToken: IMqttDeliveryToken) {}
|
||||
})
|
||||
client!!.subscribe("TopicIn")
|
||||
} catch (e: MqttException) {
|
||||
error("Connection to the Broker failed")
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkDatabase(citywastezoneid: Int, deviceid: Int) {
|
||||
var wastetype = -1
|
||||
val set2 = db!!.executeQuery("SELECT * FROM cities WHERE `id`='$citywastezoneid'")
|
||||
try {
|
||||
set2.last()
|
||||
if (set2.row != 1) { //error
|
||||
} else {
|
||||
val typ = set2.getString("wastetype")
|
||||
wastetype = getIntTyp(typ)
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
val result = db!!.executeQuery("SELECT pickupdates.pickupdate FROM pickupdates WHERE pickupdates.citywastezoneid=$citywastezoneid")
|
||||
try {
|
||||
result.last()
|
||||
if (result.row == 0) { //if not found in db --> send zero
|
||||
debug("not found in db")
|
||||
tramsmitMessage("$deviceid,$wastetype,0")
|
||||
} else {
|
||||
debug(result.getString("pickupdate"))
|
||||
result.first()
|
||||
do {
|
||||
val formatter = SimpleDateFormat("yyyy-MM-dd")
|
||||
val timestamp = formatter.parse(result.getString("pickupdate")).time
|
||||
val timestampnow = formatter.parse(formatter.format(Date())).time
|
||||
debug("timestamp is :$timestamp")
|
||||
if (timestamp == timestampnow || timestamp == timestampnow + 86400000) { // 86400000 == one day
|
||||
// valid time
|
||||
tramsmitMessage("$deviceid,$wastetype,1")
|
||||
debug("valid time")
|
||||
return
|
||||
}
|
||||
} while (result.next())
|
||||
tramsmitMessage("$deviceid,$wastetype,0") //transmit zero if not returned before
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
} catch (e: ParseException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun tramsmitMessage(temp: String) {
|
||||
debug("sending message >>>$temp")
|
||||
val message = MqttMessage(temp.toByteArray())
|
||||
message.qos = 2
|
||||
try {
|
||||
client!!.publish("TopicOut", message)
|
||||
} catch (e: MqttException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTyp(number: Int): String? {
|
||||
if (number == 1) {
|
||||
return "Plastic"
|
||||
} else if (number == 2) {
|
||||
return "Metal"
|
||||
} else if (number == 3) {
|
||||
return "Residual waste"
|
||||
} else if (number == 4) {
|
||||
return "Biowaste"
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun getIntTyp(temp: String): Int {
|
||||
var number = 0
|
||||
when (temp) {
|
||||
"Plastic" -> number = 1
|
||||
"Metal" -> number = 2
|
||||
"Residual waste" -> number = 3
|
||||
"Biowaste" -> number = 4
|
||||
}
|
||||
return number
|
||||
}
|
||||
|
||||
private fun connect() {
|
||||
try {
|
||||
db = JDBC.getInstance()
|
||||
} catch (e: IOException) {
|
||||
error("no connetion to db")
|
||||
}
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
package com.wasteinformationserver.mqtt;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
public class mqtt {
|
||||
MqttClient client = null;
|
||||
|
||||
public mqtt() {
|
||||
|
||||
}
|
||||
|
||||
public void notifymessage() {
|
||||
|
||||
try {
|
||||
client = new MqttClient("tcp://192.168.65.15:1883", "JavaSample");
|
||||
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||
connOpts.setCleanSession(true);
|
||||
client.connect(connOpts);
|
||||
|
||||
} catch (MqttException e) {
|
||||
Log.error("Connection to the ESB was failed");
|
||||
}
|
||||
|
||||
mqttreceiver mr = new mqttreceiver(client);
|
||||
mr.addMessageReceivedListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String temp = e.getActionCommand();
|
||||
|
||||
String[] split = temp.split(",");
|
||||
getDatabasedata("SELECT pickupdates.pickupdate FROM pickupdates WHERE pickupdates.citywastezoneid=(SELECT cities.zone FROM cities WHERE cities.name='" + split[1] + "' AND cities.wastetype='" + split[2] + "' AND cities.zone=" + split[3] + ")", split[2], Integer.parseInt(split[0]));
|
||||
}
|
||||
});
|
||||
mr.getmessage();
|
||||
}
|
||||
|
||||
public void getDatabasedata(String message, String wastetyp, int clientidentify) {
|
||||
|
||||
Log.debug(message);
|
||||
JDCB Database = null;
|
||||
try {
|
||||
Database = JDCB.getInstance();
|
||||
} catch (IOException e) {
|
||||
Log.error("No Connection to the databank");
|
||||
}
|
||||
//new JDCB("placeuser", "eaL956R6yFItQVBl", "wasteinformation");
|
||||
ResultSet result = Database.executeQuery(message);
|
||||
try {
|
||||
if (!result.isBeforeFirst()) {
|
||||
int abholtag = 0;
|
||||
transmitmessageAbfallart(clientidentify + "," + wastetyp + "," + abholtag);
|
||||
} else {
|
||||
while (result.next()) {
|
||||
String temptime = String.valueOf(result.getString("pickupdate"));
|
||||
|
||||
GregorianCalendar now = new GregorianCalendar();
|
||||
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG);
|
||||
String date = df.format(now.getTime());
|
||||
String[] parts = temptime.split("-");
|
||||
String tempyear = parts[0];
|
||||
String[] yearsplit = tempyear.split("0");
|
||||
String tempyearnew = yearsplit[1];
|
||||
String newDate = parts[2] + "." + parts[1] + ".20" + tempyearnew;
|
||||
String[] partstwo = date.split(" ");
|
||||
String Datetomorrow = nexDayDate();
|
||||
|
||||
|
||||
int abholtag;
|
||||
if (partstwo[0].contains(newDate) || partstwo[0].contains(Datetomorrow)) {
|
||||
abholtag = 1;
|
||||
transmitmessageAbfallart(clientidentify + "," + wastetyp + "," + abholtag);
|
||||
} else {
|
||||
abholtag = 0;
|
||||
transmitmessageAbfallart(clientidentify + "," + wastetyp + "," + abholtag);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
Log.error("No data from database");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void transmitmessageAbfallart(String temp) {
|
||||
|
||||
mqtttransmitter mt = new mqtttransmitter(client);
|
||||
Log.debug(temp);
|
||||
mt.sendmessage(temp);
|
||||
}
|
||||
|
||||
private String nexDayDate() {
|
||||
|
||||
final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
|
||||
Date currentDate = new Date();
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(currentDate);
|
||||
c.add(Calendar.DATE, 1);
|
||||
Date currentDatePlusOne = c.getTime();
|
||||
|
||||
String temp = dateFormat.format(currentDatePlusOne);
|
||||
String split[] = temp.split("/");
|
||||
String newDate = split[2] + "." + split[1] + "." + split[0];
|
||||
return newDate;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.wasteinformationserver.mqtt;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class mqttreceiver {
|
||||
|
||||
private MqttClient client;
|
||||
public ArrayList<ActionListener> mylisteners = new ArrayList<>();
|
||||
public String message;
|
||||
|
||||
public mqttreceiver(MqttClient mqtt) {
|
||||
this.client = mqtt;
|
||||
}
|
||||
|
||||
public String getmessage() {
|
||||
|
||||
try {
|
||||
client.setCallback(new MqttCallback() {
|
||||
@Override
|
||||
public void connectionLost(Throwable throwable) {
|
||||
Log.error("connection lost");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||
message = new String(mqttMessage.getPayload());
|
||||
notifylisteners(message);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||
|
||||
}
|
||||
});
|
||||
client.subscribe("TopicIn");
|
||||
Log.debug("subscribed topic");
|
||||
} catch (MqttException e) {
|
||||
Log.error("Connection to the ESB was failed");
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
private void notifylisteners(String message) {
|
||||
for (ActionListener ac : mylisteners) {
|
||||
ac.actionPerformed(new ActionEvent(this, 0, message));
|
||||
}
|
||||
}
|
||||
|
||||
public void addMessageReceivedListener(ActionListener l) {
|
||||
mylisteners.add(l);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
package com.wasteinformationserver.mqtt;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
|
||||
|
||||
public class mqtttransmitter {
|
||||
MqttClient client;
|
||||
|
||||
public mqtttransmitter(MqttClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public void sendmessage(String temp) {
|
||||
String topic = "TopicOut";
|
||||
String content = temp;
|
||||
int qos = 2;
|
||||
MemoryPersistence persistence = new MemoryPersistence();
|
||||
|
||||
try {
|
||||
Log.debug("Connected");
|
||||
Log.debug("Publishing message: " + content);
|
||||
MqttMessage message = new MqttMessage(content.getBytes());
|
||||
message.setQos(qos);
|
||||
client.publish(topic, message);
|
||||
Log.debug("Message published");
|
||||
|
||||
|
||||
} catch (MqttException me) {
|
||||
Log.debug("reason " + me.getReasonCode());
|
||||
Log.debug("msg " + me.getMessage());
|
||||
Log.debug("loc " + me.getLocalizedMessage());
|
||||
Log.debug("cause " + me.getCause());
|
||||
Log.debug("excep " + me);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class HttpTools {
|
||||
public static String StringToMD5(String value) {
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
byte[] messageDigest = md.digest(value.getBytes());
|
||||
BigInteger no = new BigInteger(1, messageDigest);
|
||||
return no.toString(16);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
32
src/java/com/wasteinformationserver/website/HttpTools.kt
Normal file
32
src/java/com/wasteinformationserver/website/HttpTools.kt
Normal file
@ -0,0 +1,32 @@
|
||||
package com.wasteinformationserver.website
|
||||
|
||||
import java.math.BigInteger
|
||||
import java.security.MessageDigest
|
||||
import java.security.NoSuchAlgorithmException
|
||||
|
||||
/**
|
||||
* basic http tools
|
||||
*
|
||||
* @author Lukas Heiligenbrunner
|
||||
*/
|
||||
class HttpTools {
|
||||
companion object{
|
||||
/**
|
||||
* create md5 hash of string
|
||||
*
|
||||
* @param value input string
|
||||
* @return md5 hash
|
||||
*/
|
||||
fun StringToMD5(value: String): String {
|
||||
return try {
|
||||
val md = MessageDigest.getInstance("MD5")
|
||||
val messageDigest = md.digest(value.toByteArray())
|
||||
val no = BigInteger(1, messageDigest)
|
||||
no.toString(16)
|
||||
} catch (e: NoSuchAlgorithmException) {
|
||||
e.printStackTrace()
|
||||
""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
// Dear programmer:
|
||||
// When I wrote this code, only god and
|
||||
// I knew how it worked.
|
||||
// Now, only god knows it!
|
||||
//
|
||||
// Therefore, if you are trying to optimize
|
||||
// this routine and it fails (most surely),
|
||||
// please increase this counter as a
|
||||
// warning for the next person:
|
||||
//
|
||||
// total hours wasted here = 254
|
||||
//
|
||||
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.website.datarequests.login.LoginState;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class MainPage implements HttpHandler {
|
||||
@Override
|
||||
public void handle(HttpExchange t) throws IOException {
|
||||
String path = t.getRequestURI().getPath();
|
||||
|
||||
if (path.equals("/")) {
|
||||
path += "index.html";
|
||||
}
|
||||
|
||||
Log.debug("looking for: " + path);
|
||||
|
||||
if (path.contains(".html")) {
|
||||
if (LoginState.getObject().isLoggedIn() || path.equals("/register.html") || path.equals("/index.html")) { //pass only register page
|
||||
sendPage(path, t);
|
||||
} else {
|
||||
Log.warning("user not logged in --> redirecting to login page");
|
||||
sendPage("/index.html", t);
|
||||
}
|
||||
} else { //only detect login state on html pages
|
||||
sendPage(path, t);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPage(String path, HttpExchange t) throws IOException {
|
||||
InputStream fs = getClass().getResourceAsStream("/wwwroot" + path);
|
||||
|
||||
if (fs == null && path.contains(".html")) {
|
||||
Log.warning("wrong page sending 404");
|
||||
sendPage("/404Error.html", t);
|
||||
} else if (fs == null) {
|
||||
Log.warning("requested resource doesnt exist");
|
||||
} else {
|
||||
// Object exists and is a file: accept with response code 200.
|
||||
String mime = "text/html";
|
||||
if (path.substring(path.length() - 3).equals(".js")) mime = "application/javascript";
|
||||
if (path.substring(path.length() - 3).equals("css")) mime = "text/css";
|
||||
|
||||
Headers h = t.getResponseHeaders();
|
||||
h.set("Content-Type", mime);
|
||||
t.sendResponseHeaders(200, 0);
|
||||
|
||||
OutputStream os = t.getResponseBody();
|
||||
|
||||
final byte[] buffer = new byte[0x10000];
|
||||
int count;
|
||||
while ((count = fs.read(buffer)) >= 0) {
|
||||
os.write(buffer, 0, count);
|
||||
}
|
||||
fs.close();
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
}
|
56
src/java/com/wasteinformationserver/website/MainPage.kt
Normal file
56
src/java/com/wasteinformationserver/website/MainPage.kt
Normal file
@ -0,0 +1,56 @@
|
||||
package com.wasteinformationserver.website
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange
|
||||
import com.sun.net.httpserver.HttpHandler
|
||||
import com.wasteinformationserver.basicutils.Log.Log.debug
|
||||
import com.wasteinformationserver.basicutils.Log.Log.warning
|
||||
import com.wasteinformationserver.website.datarequests.login.LoginState
|
||||
import java.io.IOException
|
||||
|
||||
class MainPage : HttpHandler {
|
||||
@Throws(IOException::class)
|
||||
override fun handle(t: HttpExchange) {
|
||||
var path = t.requestURI.path
|
||||
if (path == "/") {
|
||||
path += "index.html"
|
||||
}
|
||||
debug("looking for: $path")
|
||||
if (path.contains(".html")) {
|
||||
if (LoginState.getObject().isLoggedIn || path == "/register.html" || path == "/index.html") { //pass only register page
|
||||
sendPage(path, t)
|
||||
} else {
|
||||
warning("user not logged in --> redirecting to login page")
|
||||
sendPage("/index.html", t)
|
||||
}
|
||||
} else { //only detect login state on html pages
|
||||
sendPage(path, t)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
private fun sendPage(path: String, t: HttpExchange) {
|
||||
val fs = javaClass.getResourceAsStream("/wwwroot$path")
|
||||
if (fs == null && path.contains(".html")) {
|
||||
warning("wrong page sending 404")
|
||||
sendPage("/404Error.html", t)
|
||||
} else if (fs == null) {
|
||||
warning("requested resource doesnt exist --> $path")
|
||||
} else { // Object exists and is a file: accept with response code 200.
|
||||
var mime = "text/html"
|
||||
val s = path.substring(path.length - 3)
|
||||
if (s == ".js") mime = "application/javascript"
|
||||
if (s == "css") mime = "text/css"
|
||||
val h = t.responseHeaders
|
||||
h["Content-Type"] = mime
|
||||
t.sendResponseHeaders(200, 0)
|
||||
val os = t.responseBody
|
||||
val buffer = ByteArray(0x10000)
|
||||
var count: Int
|
||||
while (fs.read(buffer).also { count = it } >= 0) {
|
||||
os.write(buffer, 0, count)
|
||||
}
|
||||
fs.close()
|
||||
os.close()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
package com.wasteinformationserver.website;
|
||||
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.website.datarequests.AdminRequests;
|
||||
import com.wasteinformationserver.website.datarequests.DataRequest;
|
||||
import com.wasteinformationserver.website.datarequests.NewDateRequest;
|
||||
import com.wasteinformationserver.website.datarequests.RegisterRequest;
|
||||
import com.wasteinformationserver.website.datarequests.login.CheckLoginState;
|
||||
import com.wasteinformationserver.website.datarequests.login.LoginRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
|
||||
public class Webserver {
|
||||
public void startserver() {
|
||||
Log.info("starting Webserver");
|
||||
HttpServer server = null;
|
||||
try {
|
||||
server = HttpServer.create(new InetSocketAddress(8000), 0);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
server.createContext("/", new MainPage());
|
||||
|
||||
server.createContext("/senddata/loginget", new LoginRequest());
|
||||
server.createContext("/senddata/registerpost", new RegisterRequest());
|
||||
server.createContext("/senddata/checkloginstate", new CheckLoginState());
|
||||
server.createContext("/senddata/wastedata", new DataRequest());
|
||||
server.createContext("/senddata/admindata", new AdminRequests());
|
||||
server.createContext("/senddata/newdate", new NewDateRequest());
|
||||
|
||||
server.setExecutor(null); // creates a default executor
|
||||
server.start();
|
||||
Log.info("Server available at http://127.0.0.1:8000 now");
|
||||
|
||||
/*
|
||||
|
||||
try {
|
||||
server = HttpsServer.create(new InetSocketAddress(8000), 0);
|
||||
|
||||
// initialise the HTTPS server
|
||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
|
||||
// initialise the keystore
|
||||
char[] password = "password".toCharArray();
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
FileInputStream fis = new FileInputStream("testkey.jks");
|
||||
ks.load(fis, password);
|
||||
|
||||
// setup the key manager factory
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, password);
|
||||
|
||||
// setup the trust manager factory
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
|
||||
tmf.init(ks);
|
||||
|
||||
// setup the HTTPS context and parameters
|
||||
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
|
||||
server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
|
||||
public void configure(HttpsParameters params) {
|
||||
try {
|
||||
// initialise the SSL context
|
||||
SSLContext context = getSSLContext();
|
||||
SSLEngine engine = context.createSSLEngine();
|
||||
params.setNeedClientAuth(false);
|
||||
params.setCipherSuites(engine.getEnabledCipherSuites());
|
||||
params.setProtocols(engine.getEnabledProtocols());
|
||||
|
||||
// Set the SSL parameters
|
||||
SSLParameters sslParameters = context.getSupportedSSLParameters();
|
||||
params.setSSLParameters(sslParameters);
|
||||
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Failed to create HTTPS port");
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (CertificateException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnrecoverableKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyStoreException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
35
src/java/com/wasteinformationserver/website/Webserver.kt
Normal file
35
src/java/com/wasteinformationserver/website/Webserver.kt
Normal file
@ -0,0 +1,35 @@
|
||||
package com.wasteinformationserver.website
|
||||
|
||||
import com.sun.net.httpserver.HttpServer
|
||||
import com.wasteinformationserver.basicutils.Log.Log.criticalerror
|
||||
import com.wasteinformationserver.basicutils.Log.Log.info
|
||||
import com.wasteinformationserver.website.datarequests.*
|
||||
import com.wasteinformationserver.website.datarequests.login.CheckLoginState
|
||||
import com.wasteinformationserver.website.datarequests.login.LoginRequest
|
||||
import java.io.IOException
|
||||
import java.net.BindException
|
||||
import java.net.InetSocketAddress
|
||||
|
||||
class Webserver {
|
||||
fun startserver() {
|
||||
info("starting Webserver")
|
||||
try {
|
||||
val server = HttpServer.create(InetSocketAddress(8000), 0)
|
||||
server.createContext("/", MainPage())
|
||||
server.createContext("/senddata/loginget", LoginRequest())
|
||||
server.createContext("/senddata/registerpost", RegisterRequest())
|
||||
server.createContext("/senddata/checkloginstate", CheckLoginState())
|
||||
server.createContext("/senddata/wastedata", DataRequest())
|
||||
server.createContext("/senddata/admindata", AdminRequests())
|
||||
server.createContext("/senddata/newdate", NewDateRequest())
|
||||
server.createContext("/senddata/Devicedata", DeviceRequest())
|
||||
server.executor = null // creates a default executor
|
||||
server.start()
|
||||
info("Server available at http://127.0.0.1:8000 now")
|
||||
} catch (e: BindException) {
|
||||
criticalerror("The Port 8000 is already in use!")
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package com.wasteinformationserver.website.basicrequest;
|
||||
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class GetRequest implements HttpHandler {
|
||||
@Override
|
||||
public void handle(HttpExchange httpExchange) throws IOException {
|
||||
if (httpExchange.getRequestMethod().equals("GET")) {
|
||||
String query = httpExchange.getRequestURI().getQuery();
|
||||
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
|
||||
String[] res = query.split("&");
|
||||
for (String str : res) {
|
||||
String[] values = str.split("=");
|
||||
params.put(values[0], values[1]);
|
||||
|
||||
}
|
||||
|
||||
String response = myrequest(params);
|
||||
|
||||
|
||||
Headers h = httpExchange.getResponseHeaders();
|
||||
h.set("Content-Type", "application/json");
|
||||
httpExchange.sendResponseHeaders(200, 0);
|
||||
|
||||
OutputStream os = httpExchange.getResponseBody();
|
||||
os.write(response.getBytes());
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params received get params from com.wasteinformationserver.website
|
||||
* @return json reply to com.wasteinformationserver.website
|
||||
*/
|
||||
public abstract String myrequest(HashMap<String, String> params);
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.wasteinformationserver.website.basicrequest
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange
|
||||
import com.sun.net.httpserver.HttpHandler
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* basic GET request handler
|
||||
* reply function has to be implemented!
|
||||
*/
|
||||
abstract class GetRequest : HttpHandler {
|
||||
@Throws(IOException::class)
|
||||
override fun handle(httpExchange: HttpExchange) {
|
||||
if (httpExchange.requestMethod == "GET") {
|
||||
val query = httpExchange.requestURI.query
|
||||
val params = HashMap<String, String>()
|
||||
val res = query.split("&".toRegex()).toTypedArray()
|
||||
for (str in res) {
|
||||
val values = str.split("=".toRegex()).toTypedArray()
|
||||
params[values[0]] = values[1]
|
||||
}
|
||||
val response = myrequest(params)
|
||||
val h = httpExchange.responseHeaders
|
||||
h["Content-Type"] = "application/json"
|
||||
httpExchange.sendResponseHeaders(200, 0)
|
||||
val os = httpExchange.responseBody
|
||||
os.write(response.toByteArray())
|
||||
os.close()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params received get params from com.wasteinformationserver.website
|
||||
* @return json reply to com.wasteinformationserver.website
|
||||
*/
|
||||
abstract fun myrequest(params: HashMap<String, String>): String
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package com.wasteinformationserver.website.basicrequest;
|
||||
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class PostRequest implements HttpHandler {
|
||||
|
||||
@Override
|
||||
public void handle(HttpExchange httpExchange) throws IOException {
|
||||
if (httpExchange.getRequestMethod().equals("POST")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
InputStream ios = httpExchange.getRequestBody();
|
||||
int i;
|
||||
while ((i = ios.read()) != -1) {
|
||||
sb.append((char) i);
|
||||
}
|
||||
String query = sb.toString();
|
||||
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
|
||||
String[] res = query.split("&");
|
||||
for (String str : res) {
|
||||
String[] values = str.split("=");
|
||||
params.put(values[0], values[1]);
|
||||
}
|
||||
|
||||
String response = request(params);
|
||||
|
||||
|
||||
Headers h = httpExchange.getResponseHeaders();
|
||||
h.set("Content-Type", "application/json");
|
||||
httpExchange.sendResponseHeaders(200, 0);
|
||||
|
||||
OutputStream os = httpExchange.getResponseBody();
|
||||
os.write(response.getBytes());
|
||||
os.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params received get params from com.wasteinformationserver.website
|
||||
* @return json reply to com.wasteinformationserver.website
|
||||
*/
|
||||
public abstract String request(HashMap<String, String> params);
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.wasteinformationserver.website.basicrequest
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange
|
||||
import com.sun.net.httpserver.HttpHandler
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* basic POST request handler
|
||||
* reply function has to be implemented!
|
||||
*/
|
||||
abstract class PostRequest : HttpHandler {
|
||||
@Throws(IOException::class)
|
||||
override fun handle(httpExchange: HttpExchange) {
|
||||
if (httpExchange.requestMethod == "POST") {
|
||||
val sb = StringBuilder()
|
||||
val ios = httpExchange.requestBody
|
||||
var i: Int
|
||||
while (ios.read().also { i = it } != -1) {
|
||||
sb.append(i.toChar())
|
||||
}
|
||||
val query = sb.toString()
|
||||
val params = HashMap<String, String>()
|
||||
val res = query.split("&".toRegex()).toTypedArray()
|
||||
for (str in res) {
|
||||
val values = str.split("=".toRegex()).toTypedArray()
|
||||
params[values[0]] = values[1]
|
||||
}
|
||||
val response = request(params)
|
||||
val h = httpExchange.responseHeaders
|
||||
h["Content-Type"] = "application/json"
|
||||
httpExchange.sendResponseHeaders(200, 0)
|
||||
val os = httpExchange.responseBody
|
||||
os.write(response.toByteArray())
|
||||
os.close()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params received get params from com.wasteinformationserver.website
|
||||
* @return json reply to com.wasteinformationserver.website
|
||||
*/
|
||||
abstract fun request(params: HashMap<String, String>): String
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.io.File;
|
||||
@ -27,7 +28,7 @@ public class AdminRequests extends PostRequest {
|
||||
|
||||
/* is it a jar file? */
|
||||
if (!currentJar.getName().endsWith(".jar"))
|
||||
System.out.println("not jar");
|
||||
Log.Log.warning("not jar --> cant restart");
|
||||
|
||||
/* Build command: java -jar application.jar */
|
||||
final ArrayList<String> command = new ArrayList<String>();
|
||||
|
@ -1,188 +0,0 @@
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Info;
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DataRequest extends PostRequest {
|
||||
@Override
|
||||
public String request(HashMap<String, String> params) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
JDCB jdcb;
|
||||
try {
|
||||
jdcb = JDCB.getInstance();
|
||||
} catch (IOException e) {
|
||||
Log.error("no connection to db");
|
||||
return "{\"query\" : \"nodbconn\"}";
|
||||
}
|
||||
switch (params.get("action")) {
|
||||
case "newCity":
|
||||
sb.append("{");
|
||||
Log.debug(params.toString());
|
||||
|
||||
// check if wastezone and wasteregion already exists
|
||||
|
||||
Log.debug(params.get("cityname") + params.get("wastetype") + params.get("wastezone"));
|
||||
ResultSet set = jdcb.executeQuery("select * from `cities` where `name`='" + params.get("cityname") + "' AND `wastetype`='" + params.get("wastetype") + "' AND `zone`='" + params.get("wastezone") + "'");
|
||||
int size = 0;
|
||||
try {
|
||||
if (set != null) {
|
||||
set.last(); // moves cursor to the last row
|
||||
size = set.getRow(); // get row id
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (size == 0) {
|
||||
//doesnt exist
|
||||
System.out.println("doesnt exist");
|
||||
int status = 0;
|
||||
try {
|
||||
status = jdcb.executeUpdate("INSERT INTO `cities`(`userid`, `name`, `wastetype`, `zone`) VALUES ('0','" + params.get("cityname") + "','" + params.get("wastetype") + "','" + params.get("wastezone") + "');");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(status);
|
||||
if (status == 1) {
|
||||
sb.append("\"status\" : \"inserted\"");
|
||||
} else {
|
||||
sb.append("\"status\" : \"inserterror\"");
|
||||
}
|
||||
|
||||
} else if (size > 1) {
|
||||
Log.warning("more than one entry in db!!!");
|
||||
sb.append("\"status\" : \"exists\"");
|
||||
} else {
|
||||
//already exists
|
||||
System.out.println("already exists");
|
||||
sb.append("\"status\" : \"exists\"");
|
||||
}
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "getAllCities":
|
||||
ResultSet sett = jdcb.executeQuery("select * from cities");
|
||||
Log.debug(sett.toString());
|
||||
sb.append("{\"data\":[");
|
||||
try {
|
||||
while (sett.next()) {
|
||||
sb.append("{\"cityname\":\"" + sett.getString("name") + "\"");
|
||||
sb.append(",\"wastetype\":\"" + sett.getString("wastetype") + "\"");
|
||||
sb.append(",\"id\":\"" + sett.getString("id") + "\"");
|
||||
sb.append(",\"zone\":\"" + sett.getString("zone") + "\"}");
|
||||
if (!sett.isLast()) {
|
||||
sb.append(",");
|
||||
}
|
||||
|
||||
// System.out.println(sett.getString("name"));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sb.append("]");
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "deletecity":
|
||||
//DELETE FROM `cities` WHERE `id`=0
|
||||
sb.append("{");
|
||||
Log.debug(params.get("id"));
|
||||
int status = 0;
|
||||
try {
|
||||
status = jdcb.executeUpdate("DELETE FROM `cities` WHERE `id`='" + params.get("id") + "'");
|
||||
if (status == 1) {
|
||||
//success
|
||||
sb.append("\"status\" : \"success\"");
|
||||
} else {
|
||||
sb.append("\"status\" : \"error\"");
|
||||
}
|
||||
} catch (SQLIntegrityConstraintViolationException e) {
|
||||
Log.warning("dependencies of deletion exist");
|
||||
sb.append("\"status\" : \"dependenciesnotdeleted\"");
|
||||
} catch (SQLException e) {
|
||||
Log.error("sql exception: " + e.getMessage());
|
||||
sb.append("\"status\" : \"error\"");
|
||||
}
|
||||
|
||||
Log.debug(status);
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
|
||||
break;
|
||||
case "getcollectionnumber": //todo maybe combine all three to one
|
||||
sb.append("{");
|
||||
|
||||
try {
|
||||
ResultSet settt = jdcb.executeQuery("select * from pickupdates");
|
||||
settt.last();
|
||||
sb.append("\"collectionnumber\":\"" + settt.getRow() + "\"");
|
||||
} catch (SQLException e) {
|
||||
Log.error("sql exception: " + e.getMessage());
|
||||
sb.append("\"status\" : \"error\"");
|
||||
}
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "getcollectioninfuture":
|
||||
sb.append("{");
|
||||
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = new Date();
|
||||
String time = sdf.format(date);
|
||||
ResultSet settt = jdcb.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '"+time+"' AND '2222-12-27'");
|
||||
settt.last();
|
||||
sb.append("\"collectionnumber\":\"" + settt.getRow() + "\"");
|
||||
} catch (SQLException e) {
|
||||
Log.error("sql exception: " + e.getMessage());
|
||||
sb.append("\"status\" : \"error\"");
|
||||
}
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "getfinishedcollections":
|
||||
sb.append("{");
|
||||
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = new Date();
|
||||
String time = sdf.format(date);
|
||||
ResultSet settt = jdcb.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '0000-12-27' AND '"+time+"'");
|
||||
settt.last();
|
||||
sb.append("\"collectionnumber\":\"" + settt.getRow() + "\"");
|
||||
} catch (SQLException e) {
|
||||
Log.error("sql exception: " + e.getMessage());
|
||||
sb.append("\"status\" : \"error\"");
|
||||
}
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "getversionandbuildtime":
|
||||
sb.append("{");
|
||||
|
||||
sb.append("\"version\" : \""+ Info.version+"\"");
|
||||
sb.append(",\"buildtime\" : \""+ Info.builddate+"\"");
|
||||
|
||||
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,190 @@
|
||||
package com.wasteinformationserver.website.datarequests
|
||||
|
||||
import com.wasteinformationserver.basicutils.Info
|
||||
import com.wasteinformationserver.basicutils.Log.Log.debug
|
||||
import com.wasteinformationserver.basicutils.Log.Log.error
|
||||
import com.wasteinformationserver.basicutils.Log.Log.warning
|
||||
import com.wasteinformationserver.db.JDBC
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest
|
||||
import java.io.IOException
|
||||
import java.sql.ResultSet
|
||||
import java.sql.SQLException
|
||||
import java.sql.SQLIntegrityConstraintViolationException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class DataRequest : PostRequest() {
|
||||
override fun request(params: HashMap<String, String>): String {
|
||||
val sb = StringBuilder()
|
||||
var set: ResultSet?
|
||||
var status = -1
|
||||
val jdbc: JDBC = try {
|
||||
JDBC.getInstance()
|
||||
} catch (e: IOException) {
|
||||
error("no connection to db")
|
||||
return "{\"query\" : \"nodbconn\"}"
|
||||
}
|
||||
when (params["action"]) {
|
||||
"newCity" -> {
|
||||
sb.append("{")
|
||||
debug(params.toString())
|
||||
// check if wastezone and wasteregion already exists
|
||||
debug(params["cityname"] + params["wastetype"] + params["wastezone"])
|
||||
set = jdbc.executeQuery("select * from `cities` where `name`='" + params["cityname"] + "' AND `wastetype`='" + params["wastetype"] + "' AND `zone`='" + params["wastezone"] + "'")
|
||||
var size = 0
|
||||
try {
|
||||
if (set != null) {
|
||||
set.last() // moves cursor to the last row
|
||||
size = set.row // get row id
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if (size == 0) { //doesnt exist
|
||||
try {
|
||||
status = jdbc.executeUpdate("INSERT INTO `cities`(`userid`, `name`, `wastetype`, `zone`) VALUES ('0','" + params["cityname"] + "','" + params["wastetype"] + "','" + params["wastezone"] + "');")
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
if (status == 1) {
|
||||
sb.append("\"status\" : \"inserted\"")
|
||||
}
|
||||
else {
|
||||
sb.append("\"status\" : \"inserterror\"")
|
||||
}
|
||||
}
|
||||
else if (size > 1) {
|
||||
warning("more than one entry in db!!!")
|
||||
sb.append("\"status\" : \"exists\"")
|
||||
}
|
||||
else { //already exists
|
||||
sb.append("\"status\" : \"exists\"")
|
||||
}
|
||||
sb.append(",\"query\":\"ok\"")
|
||||
sb.append("}")
|
||||
}
|
||||
"getAllCities" -> {
|
||||
set = jdbc.executeQuery("select * from cities")
|
||||
debug(set.toString())
|
||||
sb.append("{\"data\":[")
|
||||
try {
|
||||
while (set.next()) {
|
||||
sb.append("{\"cityname\":\"" + set.getString("name") + "\"")
|
||||
sb.append(",\"wastetype\":\"" + set.getString("wastetype") + "\"")
|
||||
sb.append(",\"id\":\"" + set.getString("id") + "\"")
|
||||
sb.append(",\"zone\":\"" + set.getString("zone") + "\"}")
|
||||
if (!set.isLast) {
|
||||
sb.append(",")
|
||||
}
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
sb.append("]")
|
||||
sb.append(",\"query\":\"ok\"")
|
||||
sb.append("}")
|
||||
}
|
||||
"deletecity" -> {
|
||||
//DELETE FROM `cities` WHERE `id`=0
|
||||
sb.append("{")
|
||||
try {
|
||||
status = jdbc.executeUpdate("DELETE FROM `cities` WHERE `id`='" + params["id"] + "'")
|
||||
if (status == 1) { //success
|
||||
sb.append("\"status\" : \"success\"")
|
||||
}
|
||||
else {
|
||||
sb.append("\"status\" : \"error\"")
|
||||
}
|
||||
} catch (e: SQLIntegrityConstraintViolationException) {
|
||||
warning("dependencies of deletion exist")
|
||||
sb.append("\"status\" : \"dependenciesnotdeleted\"")
|
||||
} catch (e: SQLException) {
|
||||
error("sql exception: " + e.message)
|
||||
sb.append("\"status\" : \"error\"")
|
||||
}
|
||||
debug(status)
|
||||
sb.append(",\"query\":\"ok\"")
|
||||
sb.append("}")
|
||||
}
|
||||
"getAllDates" -> {
|
||||
set = jdbc.executeQuery("SELECT pickupdates.id,pickupdates.pickupdate,cities.userid,cities.name,cities.wastetype,cities.zone " +
|
||||
"FROM `pickupdates` INNER JOIN `cities` ON pickupdates.citywastezoneid = cities.id")
|
||||
sb.append("{\"data\":[")
|
||||
try {
|
||||
while (set.next()) {
|
||||
sb.append("{\"date\":\"" + set.getString("pickupdate") + "\"")
|
||||
sb.append(",\"cityname\":\"" + set.getString("name") + "\"")
|
||||
sb.append(",\"wastetype\":\"" + set.getString("wastetype") + "\"")
|
||||
sb.append(",\"id\":\"" + set.getString("id") + "\"")
|
||||
sb.append(",\"zone\":\"" + set.getString("zone") + "\"}")
|
||||
if (!set.isLast) {
|
||||
sb.append(",")
|
||||
}
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
sb.append("]")
|
||||
sb.append(",\"query\":\"ok\"")
|
||||
sb.append("}")
|
||||
}
|
||||
"deletedate" -> {
|
||||
sb.append("{")
|
||||
try {
|
||||
status = jdbc.executeUpdate("DELETE FROM `pickupdates` WHERE `id`='" + params["id"] + "'")
|
||||
if (status == 1) { //success
|
||||
sb.append("\"status\" : \"success\"")
|
||||
}
|
||||
else {
|
||||
sb.append("\"status\" : \"error\"")
|
||||
}
|
||||
} catch (e: SQLIntegrityConstraintViolationException) {
|
||||
warning("dependencies of deletion exist")
|
||||
sb.append("\"status\" : \"dependenciesnotdeleted\"")
|
||||
} catch (e: SQLException) {
|
||||
error("sql exception: " + e.message)
|
||||
sb.append("\"status\" : \"error\"")
|
||||
}
|
||||
sb.append(",\"query\":\"ok\"")
|
||||
sb.append("}")
|
||||
}
|
||||
"getversionandbuildtime" -> {
|
||||
sb.append("{")
|
||||
sb.append("\"version\" : \"" + Info.getVersion() + "\"")
|
||||
sb.append(",\"buildtime\" : \"" + Info.getBuilddate() + "\"")
|
||||
sb.append(",\"query\":\"ok\"")
|
||||
sb.append("}")
|
||||
}
|
||||
"getStartHeaderData" -> {
|
||||
sb.append("{")
|
||||
try {
|
||||
var sdf = SimpleDateFormat("yyyy-MM-dd")
|
||||
var date = Date()
|
||||
var time = sdf.format(date)
|
||||
set = jdbc.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '0000-12-27' AND '$time'")
|
||||
set.last()
|
||||
sb.append("\"finshedcollections\":\"" + set.row + "\"")
|
||||
sdf = SimpleDateFormat("yyyy-MM-dd")
|
||||
date = Date()
|
||||
date = Date(date.time + 1 * 24 * 60 * 60 * 1000)
|
||||
time = sdf.format(date)
|
||||
set = jdbc.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '$time' AND '2222-12-27'")
|
||||
set.last()
|
||||
sb.append(",\"futurecollections\":\"" + set.row + "\"")
|
||||
set = jdbc.executeQuery("select * from pickupdates")
|
||||
set.last()
|
||||
sb.append(",\"collectionnumber\":\"" + set.row + "\"")
|
||||
set = jdbc.executeQuery("select * from `cities`")
|
||||
set.last()
|
||||
sb.append(",\"citynumber\":\"" + set.row + "\"")
|
||||
} catch (e: SQLException) {
|
||||
error("sql exception: " + e.message)
|
||||
sb.append("\"status\" : \"error\"")
|
||||
}
|
||||
sb.append(",\"query\":\"ok\"")
|
||||
sb.append("}")
|
||||
}
|
||||
}
|
||||
return sb.toString()
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package com.wasteinformationserver.website.datarequests
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log.Log.debug
|
||||
import com.wasteinformationserver.basicutils.Log.Log.error
|
||||
import com.wasteinformationserver.db.JDBC
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest
|
||||
import java.io.IOException
|
||||
import java.sql.ResultSet
|
||||
import java.sql.SQLException
|
||||
import java.util.*
|
||||
|
||||
class DeviceRequest : PostRequest() {
|
||||
override fun request(params: HashMap<String, String>): String {
|
||||
var jdbc: JDBC? = null
|
||||
try {
|
||||
jdbc = JDBC.getInstance()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
val sb = StringBuilder()
|
||||
var deviceset: ResultSet
|
||||
when (params["action"]) {
|
||||
"getdevices" -> {
|
||||
deviceset = jdbc!!.executeQuery("SELECT * FROM `devices")
|
||||
sb.append("{\"data\":[")
|
||||
try {
|
||||
while (deviceset.next()) {
|
||||
val deviceid = deviceset.getInt("DeviceID")
|
||||
val cityid = deviceset.getInt("CityID")
|
||||
if (cityid == -1) {
|
||||
sb.append("{\"deviceid\":\"").append(deviceid).append("\",\"cityid\":\"").append(cityid).append("\"}")
|
||||
}
|
||||
else {
|
||||
val devicename = deviceset.getString("DeviceName")
|
||||
val devicelocation = deviceset.getString("DeviceLocation")
|
||||
sb.append("{\"deviceid\":\"").append(deviceid).append("\",\"devicename\":\"").append(devicename).append("\",\"devicelocation\":\"").append(devicelocation).append("\",\"devices\":[")
|
||||
val devicecities = jdbc.executeQuery("SELECT * FROM `device_city` INNER JOIN `cities` ON device_city.CityID=cities.id WHERE `DeviceID`='$deviceid'")
|
||||
while (devicecities.next()) {
|
||||
val cityidd = devicecities.getInt("id")
|
||||
val cityname = devicecities.getString("name")
|
||||
val wastetype = devicecities.getString("wastetype")
|
||||
val zone = devicecities.getString("zone")
|
||||
sb.append("{\"cityid\":\"").append(cityidd).append("\",\"cityname\":\"").append(cityname).append("\",\"wastetype\":\"").append(wastetype).append("\",\"zone\":\"").append(zone).append("\"}")
|
||||
if (!devicecities.isLast) {
|
||||
sb.append(",")
|
||||
}
|
||||
}
|
||||
sb.append("]}")
|
||||
}
|
||||
if (!deviceset.isLast) {
|
||||
sb.append(",")
|
||||
}
|
||||
}
|
||||
sb.append("]}")
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
"getCitynames" -> {
|
||||
deviceset = jdbc!!.executeQuery("select * from cities")
|
||||
debug(deviceset.toString())
|
||||
sb.append("{")
|
||||
try {
|
||||
var prev = ""
|
||||
while (deviceset.next()) {
|
||||
if (prev != deviceset.getString("name")) {
|
||||
if (!deviceset.isFirst()) {
|
||||
sb.append(",")
|
||||
}
|
||||
sb.append("\"").append(deviceset.getString("name")).append("\":\"").append(deviceset.getString("name")).append("\"")
|
||||
}
|
||||
prev = deviceset.getString("name")
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
sb.append("}")
|
||||
debug(sb.toString())
|
||||
}
|
||||
"getzones" -> {
|
||||
deviceset = jdbc!!.executeQuery("select * from cities WHERE `name`='" + params["cityname"] + "' ORDER BY zone ASC")
|
||||
debug(deviceset.toString())
|
||||
sb.append("{")
|
||||
try {
|
||||
var prev = 42
|
||||
while (deviceset.next()) {
|
||||
if (prev != deviceset.getInt("zone")) {
|
||||
sb.append("\"").append(deviceset.getInt("zone")).append("\":\"").append(deviceset.getInt("zone")).append("\"")
|
||||
if (!deviceset.isLast()) {
|
||||
sb.append(",")
|
||||
}
|
||||
}
|
||||
prev = deviceset.getInt("zone")
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
sb.append("}")
|
||||
}
|
||||
"gettypes" -> {
|
||||
deviceset = jdbc!!.executeQuery("select * from cities WHERE `name`='" + params["cityname"] + "' AND `zone`='" + params["zonename"] + "' ORDER BY zone ASC")
|
||||
debug(deviceset.toString())
|
||||
sb.append("{")
|
||||
try {
|
||||
var prev = "42"
|
||||
while (deviceset.next()) {
|
||||
if (prev != deviceset.getString("wastetype")) {
|
||||
sb.append("\"" + deviceset.getString("wastetype") + "\":\"" + deviceset.getString("wastetype") + "\"")
|
||||
if (!deviceset.isLast()) {
|
||||
sb.append(",")
|
||||
}
|
||||
}
|
||||
prev = deviceset.getString("wastetype")
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
sb.append("}")
|
||||
}
|
||||
"savetodb" -> try {
|
||||
val cityset = jdbc!!.executeQuery("SELECT id from cities WHERE `name`='" + params["cityname"] + "' AND `zone`='" + params["zonename"] + "' AND `wastetype`='" + params["wastetype"] + "'")
|
||||
cityset.last()
|
||||
if (cityset.row != 1) {
|
||||
error("error saving device to db --> device multiply defined?")
|
||||
sb.append("{\"success\":\"false\"}")
|
||||
}
|
||||
else {
|
||||
val cityid = cityset.getInt("id")
|
||||
jdbc.executeUpdate("INSERT INTO `device_city` (`DeviceID`, `CityID`) VALUES ('" + params["deviceid"] + "', '" + cityid + "');")
|
||||
jdbc.executeUpdate("UPDATE devices SET `CityID`='0',`DeviceName`='" + params["devicename"] + "',`DeviceLocation`='" + params["devicelocation"] + "' WHERE `DeviceID`='" + params["deviceid"] + "'")
|
||||
sb.append("{\"success\":\"true\"}")
|
||||
}
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
"deleteDevice" -> {
|
||||
try {
|
||||
jdbc!!.executeUpdate("DELETE FROM devices WHERE `DeviceID`='" + params["id"] + "'")
|
||||
jdbc.executeUpdate("DELETE FROM device_city WHERE `DeviceID`='" + params["id"] + "'")
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
sb.append("{\"status\":\"success\"}")
|
||||
}
|
||||
"getDeviceNumber" -> try {
|
||||
val numberset = jdbc!!.executeQuery("SELECT * FROM devices")
|
||||
numberset.last()
|
||||
val devicenr = numberset.row
|
||||
sb.append("{\"devicenr\":\"$devicenr\"}")
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
"addtodb" -> {
|
||||
var cityid = -1
|
||||
try {
|
||||
val device = jdbc!!.executeQuery("SELECT * FROM cities WHERE name='" + params["cityname"] + "' AND wastetype='" + params["wastetype"] + "' AND zone='" + params["zonename"] + "'")
|
||||
device.first()
|
||||
cityid = device.getInt("id")
|
||||
jdbc.executeUpdate("INSERT INTO `device_city` (`DeviceID`, `CityID`) VALUES ('" + params["deviceid"] + "', '" + cityid + "');")
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
sb.append("{\"success\":true}")
|
||||
}
|
||||
}
|
||||
return sb.toString()
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.db.JDBC;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -13,30 +13,31 @@ public class NewDateRequest extends PostRequest {
|
||||
@Override
|
||||
public String request(HashMap<String, String> params) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
JDCB jdcb;
|
||||
JDBC jdbc;
|
||||
ResultSet set;
|
||||
try {
|
||||
jdcb = JDCB.getInstance();
|
||||
jdbc = JDBC.getInstance();
|
||||
} catch (IOException e) {
|
||||
Log.error("no connection to db");
|
||||
Log.Log.error("no connection to db");
|
||||
return "{\"query\" : \"nodbconn\"}";
|
||||
}
|
||||
switch (params.get("action")) {
|
||||
case "getCitynames":
|
||||
ResultSet sett = jdcb.executeQuery("select * from cities");
|
||||
Log.debug(sett.toString());
|
||||
set = jdbc.executeQuery("select * from cities");
|
||||
Log.Log.debug(set.toString());
|
||||
sb.append("{\"data\":[");
|
||||
try {
|
||||
String prev = "";
|
||||
while (sett.next()) {
|
||||
if (prev.equals(sett.getString("name"))) {
|
||||
while (set.next()) {
|
||||
if (prev.equals(set.getString("name"))) {
|
||||
|
||||
} else {
|
||||
if (!sett.isFirst()) {
|
||||
if (!set.isFirst()) {
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("{\"cityname\":\"" + sett.getString("name") + "\"}");
|
||||
sb.append("{\"cityname\":\"" + set.getString("name") + "\"}");
|
||||
}
|
||||
prev = sett.getString("name");
|
||||
prev = set.getString("name");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
@ -44,11 +45,11 @@ public class NewDateRequest extends PostRequest {
|
||||
sb.append("]");
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
Log.debug(sb.toString());
|
||||
Log.Log.debug(sb.toString());
|
||||
break;
|
||||
case "getzones":
|
||||
ResultSet set = jdcb.executeQuery("select * from cities WHERE `name`='" + params.get("cityname") + "' ORDER BY zone ASC");
|
||||
Log.debug(set.toString());
|
||||
set = jdbc.executeQuery("select * from cities WHERE `name`='" + params.get("cityname") + "' ORDER BY zone ASC");
|
||||
Log.Log.debug(set.toString());
|
||||
sb.append("{\"data\":[");
|
||||
try {
|
||||
int prev = 42;
|
||||
@ -70,23 +71,47 @@ public class NewDateRequest extends PostRequest {
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "gettypes":
|
||||
set = jdbc.executeQuery("select * from cities WHERE `name`='" + params.get("cityname") + "' AND `zone`='"+params.get("zonename")+"' ORDER BY zone ASC");
|
||||
Log.Log.debug(set.toString());
|
||||
sb.append("{\"data\":[");
|
||||
try {
|
||||
String prev = "42";
|
||||
while (set.next()) {
|
||||
if (prev == set.getString("wastetype")) {
|
||||
|
||||
} else {
|
||||
sb.append("{\"wastetype\":\"" + set.getString("wastetype") + "\"}");
|
||||
if (!set.isLast()) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
prev = set.getString("wastetype");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sb.append("]");
|
||||
sb.append(",\"query\":\"ok\"");
|
||||
sb.append("}");
|
||||
break;
|
||||
case "newdate":
|
||||
sb.append("{");
|
||||
Log.debug(params);
|
||||
ResultSet seti = jdcb.executeQuery("select * from cities WHERE `name`='" + params.get("cityname") + "' AND `zone`='" + params.get("zone") + "' AND `wastetype`='" + params.get("wastetype") + "'");
|
||||
Log.Log.debug(params);
|
||||
set = jdbc.executeQuery("select * from cities WHERE `name`='" + params.get("cityname") + "' AND `zone`='" + params.get("zone") + "' AND `wastetype`='" + params.get("wastetype") + "'");
|
||||
try {
|
||||
seti.last();
|
||||
if (seti.getRow() == 1) {
|
||||
Log.debug(seti.getInt("id"));
|
||||
set.last();
|
||||
if (set.getRow() == 1) {
|
||||
Log.Log.debug(set.getInt("id"));
|
||||
|
||||
int status = jdcb.executeUpdate("INSERT INTO `pickupdates`(`citywastezoneid`, `pickupdate`) VALUES ('" + seti.getInt("id") + "','" + params.get("date") + "')");
|
||||
int status = jdbc.executeUpdate("INSERT INTO `pickupdates`(`citywastezoneid`, `pickupdate`) VALUES ('" + set.getInt("id") + "','" + params.get("date") + "')");
|
||||
if (status == 1) {
|
||||
sb.append("\"status\" : \"success\"");
|
||||
} else {
|
||||
sb.append("\"status\" : \"error\"");
|
||||
}
|
||||
} else {
|
||||
Log.warning("city doesnt exist!");
|
||||
Log.Log.warning("city doesnt exist!");
|
||||
sb.append("\"status\" : \"citydoesntexist\"");
|
||||
}
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
package com.wasteinformationserver.website.datarequests;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.website.HttpTools;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class RegisterRequest extends PostRequest {
|
||||
@Override
|
||||
public String request(HashMap<String, String> params) {
|
||||
Log.debug(params.toString());
|
||||
|
||||
String passhash = HttpTools.StringToMD5(params.get("password"));
|
||||
|
||||
JDCB myjd = null;
|
||||
try {
|
||||
myjd = JDCB.getInstance();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//new JDCB("users", "kOpaIJUjkgb9ur6S", "wasteinformation");
|
||||
try {
|
||||
int s = myjd.executeUpdate("INSERT INTO `user` (`username`, `firstName`, `secondName`, `password`, `email`, `logindate`) VALUES ('" + params.get("username") + "', '" + params.get("firstname") + "', '" + params.get("lastname") + "', '" + passhash + "', '" + params.get("email") + "', current_timestamp());");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// TODO: 27.09.19 detect if register process was successful and reply right json
|
||||
return "{\"accept\": true}";
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.wasteinformationserver.website.datarequests
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log
|
||||
import com.wasteinformationserver.basicutils.Log.Log.debug
|
||||
import com.wasteinformationserver.db.JDBC
|
||||
import com.wasteinformationserver.website.HttpTools.Companion.StringToMD5
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest
|
||||
import java.io.IOException
|
||||
import java.sql.SQLException
|
||||
import java.util.*
|
||||
|
||||
class RegisterRequest : PostRequest() {
|
||||
override fun request(params: HashMap<String, String>): String {
|
||||
debug(params.toString())
|
||||
val passhash = StringToMD5(params["password"]!!)
|
||||
var reply: StringBuilder = StringBuilder("{")
|
||||
try {
|
||||
var myjd: JDBC = JDBC.getInstance()
|
||||
|
||||
val status = myjd.executeUpdate("INSERT INTO `user` (`username`, `firstName`, `secondName`, `password`, `email`, `logindate`) VALUES ('" + params["username"] + "', '" + params["firstname"] + "', '" + params["lastname"] + "', '" + passhash + "', '" + params["email"] + "', current_timestamp());")
|
||||
if (status == 1) {
|
||||
reply.append("\"accept\": true")
|
||||
} else {
|
||||
reply.append("\"accept\": false")
|
||||
}
|
||||
|
||||
} catch (e: IOException) {
|
||||
Log.error("no connection to db")
|
||||
reply.append("\"accept\": false")
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
reply.append("\"accept\": false")
|
||||
}
|
||||
reply.append("}")
|
||||
|
||||
return reply.toString()
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.wasteinformationserver.website.datarequests
|
||||
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest
|
||||
import java.util.*
|
||||
|
||||
class UserInfoRequest : PostRequest() {
|
||||
override fun request(params: HashMap<String, String>): String {
|
||||
//TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
when (params.get("action")) {
|
||||
"getlogins" -> {
|
||||
println("heyho")
|
||||
}
|
||||
""->{
|
||||
//todo o
|
||||
}
|
||||
}
|
||||
return "{}";
|
||||
}
|
||||
}
|
@ -5,10 +5,13 @@ import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* request handler for checking the login state of a user
|
||||
*/
|
||||
public class CheckLoginState extends PostRequest {
|
||||
@Override
|
||||
public String request(HashMap<String, String> params) {
|
||||
Log.message("checking login state");
|
||||
Log.Log.message("checking login state");
|
||||
if ((params.get("action")).equals("getloginstate")) {
|
||||
if (LoginState.getObject().isLoggedIn()) {
|
||||
return "{\"loggedin\":true, \"username\":\"" + LoginState.getObject().getUsername() + "\", \"permission\":\"" + LoginState.getObject().getPermission() + "\"}";
|
||||
@ -16,7 +19,7 @@ public class CheckLoginState extends PostRequest {
|
||||
return "{\"loggedin\":false}";
|
||||
}
|
||||
} else if ((params.get("action")).equals("logout")) {
|
||||
Log.debug("logging out");
|
||||
Log.Log.debug("logging out");
|
||||
LoginState.getObject().logOut();
|
||||
return "{\"loggedin\":false}";
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
package com.wasteinformationserver.website.datarequests.login;
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log;
|
||||
import com.wasteinformationserver.db.JDCB;
|
||||
import com.wasteinformationserver.website.HttpTools;
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class LoginRequest extends PostRequest {
|
||||
@Override
|
||||
public String request(HashMap<String, String> params) {
|
||||
|
||||
Log.message("new login request");
|
||||
|
||||
String password = params.get("password");
|
||||
String username = params.get("username");
|
||||
|
||||
JDCB jdcb;
|
||||
try {
|
||||
jdcb = JDCB.getInstance();
|
||||
} catch (IOException e) {
|
||||
Log.error("no connection to db");
|
||||
return "{\"status\" : \"nodbconn\"}";
|
||||
}
|
||||
|
||||
ResultSet s = jdcb.executeQuery("select * from user where username ='" + username + "'");
|
||||
;
|
||||
//new JDCB("users", "kOpaIJUjkgb9ur6S", "wasteinformation").executeQuery("select * from user where username ='" + username + "'");
|
||||
Log.debug("successfully logged in to db");
|
||||
String response = "{\"accept\": false}";
|
||||
try {
|
||||
s.last();
|
||||
if (s.getRow() == 1) {
|
||||
//success
|
||||
if (HttpTools.StringToMD5(password).equals(s.getString("password"))) {
|
||||
Log.debug("login success");
|
||||
LoginState.getObject().logIn();
|
||||
LoginState.getObject().setAccountData(username, "", "", "", s.getInt("permission")); // TODO: 06.12.19
|
||||
response = "{\"accept\": true}";
|
||||
} else {
|
||||
Log.debug("wrong password");
|
||||
}
|
||||
} else if (s.getRow() == 0) {
|
||||
//user not found
|
||||
Log.debug("user not found");
|
||||
} else {
|
||||
//internal error two users with same name...?
|
||||
}
|
||||
Log.debug("rowcount: " + s.getRow());
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.wasteinformationserver.website.datarequests.login
|
||||
|
||||
import com.wasteinformationserver.basicutils.Log.Log.debug
|
||||
import com.wasteinformationserver.basicutils.Log.Log.error
|
||||
import com.wasteinformationserver.basicutils.Log.Log.message
|
||||
import com.wasteinformationserver.db.JDBC
|
||||
import com.wasteinformationserver.website.HttpTools.Companion.StringToMD5
|
||||
import com.wasteinformationserver.website.basicrequest.PostRequest
|
||||
import java.io.IOException
|
||||
import java.sql.SQLException
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* request handler of new login request of user
|
||||
* - checks the truth of username and password
|
||||
* - replies right error messages or the success login
|
||||
*/
|
||||
class LoginRequest : PostRequest() {
|
||||
override fun request(params: HashMap<String, String>): String {
|
||||
message("new login request")
|
||||
val password = params["password"]
|
||||
val username = params["username"]
|
||||
val jdbc: JDBC = try {
|
||||
JDBC.getInstance()
|
||||
} catch (e: IOException) {
|
||||
error("no connection to db")
|
||||
return "{\"status\" : \"nodbconn\"}"
|
||||
}
|
||||
val s = jdbc.executeQuery("select * from user where username ='$username'")
|
||||
|
||||
debug("successfully logged in to db")
|
||||
var response = "{\"accept\": false}"
|
||||
try {
|
||||
s.last()
|
||||
if (s.row == 1) { //success
|
||||
if (StringToMD5(password!!) == s.getString("password")) {
|
||||
debug("login success")
|
||||
LoginState.getObject().logIn()
|
||||
LoginState.getObject().setAccountData(username, s.getString("firstName"), s.getString("secondName"), s.getString("email"), s.getInt("permission"))
|
||||
response = "{\"accept\": true}"
|
||||
} else {
|
||||
debug("wrong password")
|
||||
}
|
||||
} else if (s.row == 0) { //user not found
|
||||
debug("user not found")
|
||||
} else { //internal error two users with same name...?
|
||||
error("there seem to be two users with same name")
|
||||
}
|
||||
debug("rowcount: " + s.row)
|
||||
} catch (e: SQLException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return response
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
package com.wasteinformationserver.website.datarequests.login;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class LoginState {
|
||||
private LoginState() {
|
||||
}
|
||||
|
||||
private static LoginState mythis = new LoginState();
|
||||
|
||||
@ -16,7 +17,7 @@ public class LoginState {
|
||||
private String email;
|
||||
private int permission;
|
||||
|
||||
boolean loggedin = false;
|
||||
boolean loggedin = true;
|
||||
|
||||
public void logIn() {
|
||||
loggedin = true;
|
||||
|
@ -23,7 +23,7 @@
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4">
|
||||
<!-- Brand Logo -->
|
||||
<a href="dashboard.html" class="brand-link">
|
||||
<img src="lib/AdminLTE/dist/img/AdminLTELogo.png"
|
||||
<img src="/favicon.png"
|
||||
alt="AdminLTE Logo"
|
||||
class="brand-image img-circle elevation-3"
|
||||
style="opacity: .8">
|
||||
|
@ -45,7 +45,7 @@
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4">
|
||||
<!-- Brand Logo -->
|
||||
<a href="dashboard.html" class="brand-link">
|
||||
<img src="lib/AdminLTE/dist/img/AdminLTELogo.png" alt="AdminLTE Logo"
|
||||
<img src="/favicon.png" alt="AdminLTE Logo"
|
||||
class="brand-image img-circle elevation-3"
|
||||
style="opacity: .8">
|
||||
<span class="brand-text font-weight-light">Waste Control</span>
|
||||
@ -271,5 +271,7 @@
|
||||
|
||||
<script src="lib/AdminLTE/plugins/sweetalert2/sweetalert2.all.js"></script>
|
||||
|
||||
<script src="js/userManager.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -37,6 +37,8 @@
|
||||
<link rel="stylesheet" type="text/css" href="css/dashboard.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/general.css">
|
||||
|
||||
<link rel="icon" type="image/png" href="/favicon.png">
|
||||
|
||||
|
||||
</head>
|
||||
<body class="hold-transition sidebar-mini layout-fixed">
|
||||
@ -45,7 +47,7 @@
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4">
|
||||
<!-- Brand Logo -->
|
||||
<a href="dashboard.html" class="brand-link">
|
||||
<img src="lib/AdminLTE/dist/img/AdminLTELogo.png" alt="AdminLTE Logo"
|
||||
<img src="/favicon.png" alt="AdminLTE Logo"
|
||||
class="brand-image img-circle elevation-3"
|
||||
style="opacity: .8">
|
||||
<span class="brand-text font-weight-light">Waste Control</span>
|
||||
@ -96,6 +98,15 @@
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li id="devicepanel" class="nav-item">
|
||||
<a href="device.html" class="nav-link">
|
||||
<i class="nav-icon fas fa-plus-circle"></i>
|
||||
<p>
|
||||
Devices
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- /.sidebar-menu -->
|
||||
@ -145,14 +156,14 @@
|
||||
<!-- ./col -->
|
||||
<div class="col-lg-3 col-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-success">
|
||||
<div class="small-box bg-gray">
|
||||
<div class="inner">
|
||||
<h3>53<sup style="font-size: 20px">%</sup></h3>
|
||||
<h3 id="total-city-number-label">42</h3>
|
||||
|
||||
<p>Verbundene Clients</p>
|
||||
<p>total collect zones</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-stats-bars"></i>
|
||||
<i class="ion ion-android-globe" style="color: lightgrey"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
@ -167,7 +178,7 @@
|
||||
<p>Planned Collections</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-person-add"></i>
|
||||
<i class="ion ion-calendar"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
@ -175,14 +186,14 @@
|
||||
<!-- ./col -->
|
||||
<div class="col-lg-3 col-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-danger">
|
||||
<div class="small-box bg-success">
|
||||
<div class="inner">
|
||||
<h3 id="finished-collection-label">65</h3>
|
||||
|
||||
<p>Finished Collections</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-pie-graph"></i>
|
||||
<i class="ion ion-android-checkmark-circle"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
@ -199,7 +210,7 @@
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
<i class="fas fa-chart-pie mr-1"></i>
|
||||
Alle abholdaten
|
||||
All pickupdats
|
||||
</h3>
|
||||
</div><!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
@ -311,11 +322,7 @@
|
||||
data-toggle="dropdown">
|
||||
Select waste type
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item-wastetype dropdown-item" href="#">Plastic</a>
|
||||
<a class="dropdown-item-wastetype dropdown-item" href="#">Metal</a>
|
||||
<a class="dropdown-item-wastetype dropdown-item" href="#">Residual waste</a>
|
||||
<a class="dropdown-item-wastetype dropdown-item" href="#">Biowaste</a>
|
||||
<div id="dropdown-type-drops" class="dropdown-menu">
|
||||
</div>
|
||||
</div>
|
||||
<input id="input-wastetime" style="width: 50px;" class="form-control" id="date"
|
||||
@ -433,12 +440,16 @@
|
||||
<script type="text/javascript"
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/dashboard.js"></script>
|
||||
<!-- DataTables -->
|
||||
<script src="lib/AdminLTE/plugins/datatables/jquery.dataTables.js"></script>
|
||||
<script src="lib/AdminLTE/plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
|
||||
|
||||
<script src="lib/AdminLTE/plugins/sweetalert2/sweetalert2.all.js"></script>
|
||||
|
||||
<!-- OWN -->
|
||||
|
||||
<script type="text/javascript" src="js/lib/kotlin.js"></script>
|
||||
<script type="text/javascript" src="js/WasteInformationServer.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
294
src/resources/wwwroot/device.html
Normal file
294
src/resources/wwwroot/device.html
Normal file
@ -0,0 +1,294 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>WasteInformation Server</title>
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/fontawesome-free/css/all.min.css">
|
||||
<!-- Ionicons -->
|
||||
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
|
||||
<!-- DataTables -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/datatables-bs4/css/dataTables.bootstrap4.css">
|
||||
<!-- Tempusdominus Bbootstrap 4 -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
|
||||
<!-- iCheck -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
|
||||
<!-- JQVMap -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/jqvmap/jqvmap.min.css">
|
||||
<!-- Theme style -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/dist/css/adminlte.min.css">
|
||||
<!-- overlayScrollbars -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
|
||||
<!-- Daterange picker -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/daterangepicker/daterangepicker.css">
|
||||
<!-- summernote -->
|
||||
<link rel="stylesheet" href="lib/AdminLTE/plugins/summernote/summernote-bs4.css">
|
||||
<!-- Google Font: Source Sans Pro -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
|
||||
|
||||
<!-- Bootstrap Date-Picker Plugin -->
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/>
|
||||
|
||||
<!-- <link rel="stylesheet" type="text/css" href="css/user.css">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/general.css">
|
||||
|
||||
|
||||
</head>
|
||||
<body class="hold-transition sidebar-mini layout-fixed">
|
||||
<div class="wrapper">
|
||||
<!-- Main Sidebar Container -->
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4">
|
||||
<!-- Brand Logo -->
|
||||
<a href="dashboard.html" class="brand-link">
|
||||
<img src="/favicon.png" alt="AdminLTE Logo"
|
||||
class="brand-image img-circle elevation-3"
|
||||
style="opacity: .8">
|
||||
<span class="brand-text font-weight-light">Waste Control</span>
|
||||
</a>
|
||||
|
||||
<!-- Sidebar -->
|
||||
<div class="sidebar">
|
||||
<!-- Sidebar user panel (optional) -->
|
||||
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
|
||||
<div class="image">
|
||||
<!-- <img src="lib/AdminLTE/dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image"> -->
|
||||
<i class="nav-icon fas fa-user img-circle elevation-2" style="color:white"></i>
|
||||
</div>
|
||||
<!-- <i class="nav-icon fas fa-tachometer-alt"></i> -->
|
||||
<div class="info">
|
||||
<a href="user.html" class="d-block" id="userlabel">Username to set!</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sidebar Menu -->
|
||||
<nav class="mt-2">
|
||||
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
|
||||
data-accordion="false">
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="#todo" class="nav-link">
|
||||
<i class="nav-icon fas fa-cog"></i>
|
||||
<p>
|
||||
Settings
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="index.html" class="nav-link" id="logoutbtn">
|
||||
<i class="nav-icon fas fa-sign-out-alt"></i>
|
||||
<p>
|
||||
Logout
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li id="adminpanel" class="nav-item hideit">
|
||||
<a href="adminpanel.html" class="nav-link">
|
||||
<i class="nav-icon fas fa-plus-circle"></i>
|
||||
<p>
|
||||
Admin panel
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li id="devicepanel" class="nav-item">
|
||||
<a href="device.html" class="nav-link">
|
||||
<i class="nav-icon fas fa-plus-circle"></i>
|
||||
<p>
|
||||
Devices
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- /.sidebar-menu -->
|
||||
</div>
|
||||
<!-- /.sidebar -->
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0 text-dark">Dashboard</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="dashboard.html">Home</a></li>
|
||||
<li class="breadcrumb-item active">Users</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<!-- Small boxes (Stat box) -->
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-info">
|
||||
<div class="inner">
|
||||
<h3>TODO</h3>
|
||||
|
||||
<p>Todo</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-bag"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
<div class="col-lg-3 col-6">
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-success">
|
||||
<div class="inner">
|
||||
<h3>TODO</h3>
|
||||
|
||||
<p>Devices</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="ion ion-stats-bars"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ./col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
<!-- Main row -->
|
||||
<div class="row">
|
||||
<!-- Left col -->
|
||||
<section class="col-lg-7 connectedSortable">
|
||||
<!-- Custom tabs (Charts with tabs)-->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">
|
||||
<i class="fas fa-chart-pie mr-1"></i>
|
||||
All Devices
|
||||
</h3>
|
||||
</div><!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<table id="table-devices" class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device ID</th>
|
||||
<th>Devicename</th>
|
||||
<th>Devicelocation</th>
|
||||
<th>WasteType</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="devices-tablebody">
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Device ID</th>
|
||||
<th>Devicename</th>
|
||||
<th>Devicelocation</th>
|
||||
<th>WasteType</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div><!-- /.card-body -->
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<!-- /.Left col -->
|
||||
<!-- right col (We are only adding the ID to make the widgets sortable)-->
|
||||
<section class="col-lg-5 connectedSortable">
|
||||
|
||||
<!-- /.card -->
|
||||
</section>
|
||||
<!-- right col -->
|
||||
</div>
|
||||
<!-- /.row (main row) -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
<footer class="main-footer">
|
||||
<strong>By Gregor Dutzler & Lukas Heiligenbrunner & Emil Meindl</strong>
|
||||
<div class="float-right d-none d-sm-inline-block">
|
||||
<b>Version</b> 3.0.0
|
||||
<b>Build</b> 2019-8-8 9:30
|
||||
</div>
|
||||
|
||||
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Control sidebar content goes here -->
|
||||
</aside>
|
||||
<!-- /.control-sidebar -->
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="lib/AdminLTE/plugins/jquery/jquery.min.js"></script>
|
||||
<!-- jQuery UI 1.11.4 -->
|
||||
<script src="lib/AdminLTE/plugins/jquery-ui/jquery-ui.min.js"></script>
|
||||
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
|
||||
<script>
|
||||
$.widget.bridge('uibutton', $.ui.button)
|
||||
</script>
|
||||
<!-- Bootstrap 4 -->
|
||||
<script src="lib/AdminLTE/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<!-- ChartJS -->
|
||||
<script src="lib/AdminLTE/plugins/chart.js/Chart.min.js"></script>
|
||||
<!-- Sparkline -->
|
||||
<script src="lib/AdminLTE/plugins/sparklines/sparkline.js"></script>
|
||||
<!-- JQVMap -->
|
||||
<script src="lib/AdminLTE/plugins/jqvmap/jquery.vmap.min.js"></script>
|
||||
<script src="lib/AdminLTE/plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
|
||||
<!-- jQuery Knob Chart -->
|
||||
<script src="lib/AdminLTE/plugins/jquery-knob/jquery.knob.min.js"></script>
|
||||
<!-- daterangepicker -->
|
||||
<script src="lib/AdminLTE/plugins/moment/moment.min.js"></script>
|
||||
<script src="lib/AdminLTE/plugins/daterangepicker/daterangepicker.js"></script>
|
||||
<!-- Tempusdominus Bootstrap 4 -->
|
||||
<script src="lib/AdminLTE/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
|
||||
<!-- Summernote -->
|
||||
<script src="lib/AdminLTE/plugins/summernote/summernote-bs4.min.js"></script>
|
||||
<!-- overlayScrollbars -->
|
||||
<script src="lib/AdminLTE/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="lib/AdminLTE/dist/js/adminlte.js"></script>
|
||||
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
|
||||
<script src="lib/AdminLTE/dist/js/pages/dashboard.js"></script>
|
||||
<!-- AdminLTE for demo purposes -->
|
||||
<script src="lib/AdminLTE/dist/js/demo.js"></script>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script>
|
||||
|
||||
<!--<script type="text/javascript" src="js/user.js"></script>-->
|
||||
<!-- DataTables -->
|
||||
<script src="lib/AdminLTE/plugins/datatables/jquery.dataTables.js"></script>
|
||||
<script src="lib/AdminLTE/plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
|
||||
|
||||
<script src="lib/AdminLTE/plugins/sweetalert2/sweetalert2.all.js"></script>
|
||||
|
||||
<script src="js/userManager.js"></script>
|
||||
<script src="js/device.js"></script>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -1,74 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Login Page</title>
|
||||
<!--Made with love by Mutiullah Samim -->
|
||||
<title>Login Page</title>
|
||||
<!--Made with love by Mutiullah Samim -->
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="lib/bootstrap.min.css">
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="lib/bootstrap.min.css">
|
||||
|
||||
<!-- jQuery library -->
|
||||
<script src="lib/jquery.min.js"></script>
|
||||
<!-- jQuery library -->
|
||||
<script src="lib/jquery.min.js"></script>
|
||||
|
||||
<!-- Popper JS -->
|
||||
<script src="lib/popper.min.js"></script>
|
||||
<!-- Popper JS -->
|
||||
<script src="lib/popper.min.js"></script>
|
||||
|
||||
<!-- Latest compiled JavaScript -->
|
||||
<script src="lib/bootstrap.min.js"></script>
|
||||
<!-- Latest compiled JavaScript -->
|
||||
<script src="lib/bootstrap.min.js"></script>
|
||||
|
||||
<!--Fontawesome CDN-->
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
|
||||
<!--Fontawesome CDN-->
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"
|
||||
integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
|
||||
|
||||
<!--Custom styles-->
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css">
|
||||
<!--Custom styles-->
|
||||
<link rel="stylesheet" type="text/css" href="css/index.css">
|
||||
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
<script src="lib/AdminLTE/plugins/sweetalert2/sweetalert2.all.js"></script>
|
||||
|
||||
<script src="lib/AdminLTE/plugins/sweetalert2/sweetalert2.all.js"></script>
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
|
||||
<link rel="icon" type="image/png" href="/favicon.png">
|
||||
|
||||
<script type="text/javascript" src="js/lib/kotlin.js"></script>
|
||||
<script type="text/javascript" src="js/WasteInformationServer.js"></script>
|
||||
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="d-flex justify-content-center h-100">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Sign In</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<div class="input-group form-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" placeholder="username" id="userfield">
|
||||
<div class="d-flex justify-content-center h-100">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Sign In</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form>
|
||||
<div class="input-group form-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" placeholder="username" id="userfield">
|
||||
|
||||
</div>
|
||||
<div class="input-group form-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-key"></i></span>
|
||||
</div>
|
||||
<input type="password" class="form-control" placeholder="password" id="passfield">
|
||||
</div>
|
||||
<div class="row align-items-center remember">
|
||||
<input type="checkbox">Remember Me
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Login" class="btn float-right login_btn" id="loginbtn">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="d-flex justify-content-center links">
|
||||
Don't have an account?<a href="register.html">Sign Up</a>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<a href="#">Forgot your password?</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group form-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fas fa-key"></i></span>
|
||||
</div>
|
||||
<input type="password" class="form-control" placeholder="password" id="passfield">
|
||||
</div>
|
||||
<div class="row align-items-center remember">
|
||||
<input type="checkbox">Remember Me
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Login" class="btn float-right login_btn" id="loginbtn">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="d-flex justify-content-center links">
|
||||
Don't have an account?<a href="register.html">Sign Up</a>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<a href="#">Forgot your password?</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,34 +0,0 @@
|
||||
$(document).ready(function () {
|
||||
console.log("page loaded");
|
||||
$.post('/senddata/checkloginstate', 'action=getloginstate', function (data) {
|
||||
console.log(data);
|
||||
if (data.loggedin == true) {
|
||||
$("#userlabel").html(" " + data.username);
|
||||
if (data.permission > 0) {
|
||||
$("#adminpanel").show();
|
||||
}
|
||||
} else {
|
||||
$("#userlabel").html(" not logged in!!");
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
|
||||
$("#btn-shutdown").click(function (event) {
|
||||
console.log("shutting down server");
|
||||
|
||||
$.post('/senddata/admindata', 'action=shutdownserver', function (data) {
|
||||
console.log(data);
|
||||
|
||||
}, 'json');
|
||||
|
||||
});
|
||||
|
||||
$("#btn-restart").click(function (event) {
|
||||
console.log("restarting server");
|
||||
|
||||
$.post('/senddata/admindata', 'action=restartserver', function (data) {
|
||||
console.log(data);
|
||||
|
||||
}, 'json');
|
||||
});
|
||||
});
|
@ -1,282 +0,0 @@
|
||||
$(document).ready(function () {
|
||||
console.log("page loaded");
|
||||
$.post('/senddata/checkloginstate', 'action=getloginstate', function (data) {
|
||||
console.log(data);
|
||||
if (data.loggedin == true) {
|
||||
$("#userlabel").html(" " + data.username);
|
||||
if (data.permission > 0) {
|
||||
$("#adminpanel").show();
|
||||
}
|
||||
} else {
|
||||
$("#userlabel").html(" not logged in!!");
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
//load total collections
|
||||
$.post('/senddata/wastedata', 'action=getcollectionnumber', function (data) {
|
||||
console.log(data);
|
||||
$("#total-connection-labels").html(data.collectionnumber);
|
||||
}, 'json');
|
||||
|
||||
//load future collections
|
||||
$.post('/senddata/wastedata', 'action=getcollectioninfuture', function (data) {
|
||||
console.log(data);
|
||||
$("#planed-collection-label").html(data.collectionnumber);
|
||||
}, 'json');
|
||||
|
||||
//load future collections
|
||||
$.post('/senddata/wastedata', 'action=getfinishedcollections', function (data) {
|
||||
console.log(data);
|
||||
$("#finished-collection-label").html(data.collectionnumber);
|
||||
}, 'json');
|
||||
|
||||
//load version footer
|
||||
//
|
||||
$.post('/senddata/wastedata', 'action=getversionandbuildtime', function (data) {
|
||||
$("#version-footer-label").html("<b>Version</b> "+data.version+" <b>Build</b> "+data.buildtime);
|
||||
}, 'json');
|
||||
|
||||
|
||||
var citytable;
|
||||
|
||||
function reloadtable() {
|
||||
$.post('/senddata/wastedata', 'action=getAllCities', function (data) {
|
||||
if (citytable != null) {
|
||||
citytable.destroy(); //delete table if already created
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
if (data.query == "ok") {
|
||||
$('#location-table-data').html("");
|
||||
$(".delbtn").off();
|
||||
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
$('#location-table-data').append("<tr>" +
|
||||
"<td>" + data.data[i].cityname + "</td>" +
|
||||
"<td>" + data.data[i].zone + "</td>" +
|
||||
"<td>" + data.data[i].wastetype + "</td>" +
|
||||
"<td>" + "<button dataid='" + data.data[i].id + "' type='button' class='delbtn btn btn-danger'>X</button>" + "</td>" +
|
||||
"</tr>");
|
||||
}
|
||||
|
||||
$(".delbtn").click(function (event) {
|
||||
var id = event.target.getAttribute("dataid");
|
||||
console.log("clicked btn data " + id);
|
||||
$.post('/senddata/wastedata', 'action=deletecity&id=' + id, function (data) {
|
||||
console.log(data);
|
||||
if (data.status == "success") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully deleted city!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
reloadtable();
|
||||
} else if (data.status == "dependenciesnotdeleted") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'This city is a dependency of a date',
|
||||
html: 'Do you want do delete it anyway with all dependencies?',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
//todo set yes no button here
|
||||
}
|
||||
|
||||
}, "json");
|
||||
});
|
||||
|
||||
citytable = $("#example2").DataTable();
|
||||
} else if (data.query == "nodbconn") {
|
||||
Swal.fire({
|
||||
type: "error",
|
||||
title: 'No connection to Database',
|
||||
html: 'Setup DB here --> <a href="index.html">click<a/>.',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
} else {
|
||||
console.log("Error: " + data.query);
|
||||
}
|
||||
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
|
||||
var DataTable;
|
||||
function reloadDateTable() {
|
||||
$.post('/senddata/wastedata', 'action=getAllDates', function (data) {
|
||||
if (DataTable != null) {
|
||||
DataTable.destroy(); //delete table if already created
|
||||
}
|
||||
|
||||
//todo
|
||||
},"json");
|
||||
}
|
||||
|
||||
reloadtable();
|
||||
reloadDateTable();
|
||||
|
||||
|
||||
//btn listeners
|
||||
$('#logoutbtn').click(function () {
|
||||
$.post('/senddata/checkloginstate', 'action=logout', function (data) {
|
||||
console.log(data);
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
$('.wastetype-citynew-item').click(function (event) {
|
||||
event.preventDefault();
|
||||
$('#dropdown-wastetype').html($(this).html());
|
||||
});
|
||||
|
||||
$('#btn-savecity').click(function () {
|
||||
var cityname = $("#new_city_cityname").val();
|
||||
var zonename = $("#new_city_zonename").val();
|
||||
var wastetype = $("#dropdown-wastetype").html();
|
||||
console.log("storing: " + cityname + "--" + wastetype + "in db");
|
||||
|
||||
$.post('/senddata/wastedata', 'action=newCity&wastetype=' + wastetype + "&cityname=" + cityname + "&wastezone=" + zonename, function (data) {
|
||||
console.log(data);
|
||||
if (data.status == "inserted") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully created city!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
reloadtable();
|
||||
} else if (data.status == "exists") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'Name already exists in db',
|
||||
html: 'Close popup.',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
//clear form data
|
||||
$("#new_city_cityname").val("");
|
||||
$("#new_city_zonename").val("");
|
||||
$("#dropdown-wastetype").html("select waste type");
|
||||
});
|
||||
|
||||
|
||||
/* new Date create: */
|
||||
$("#dropdown-city").click(function (event) {
|
||||
event.preventDefault();
|
||||
var dropdata = $("#dropdown-city-data");
|
||||
dropdata.html("");
|
||||
console.log("loading city names")
|
||||
|
||||
$.post('/senddata/newdate', 'action=getCitynames', function (data) {
|
||||
console.log(data);
|
||||
if (data.query == "ok") {
|
||||
var prev = "";
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var name = data.data[i].cityname;
|
||||
dropdata.append("<a class=\"dropdown-data-cityname dropdown-item\" href=\"#\">" + name + "</a>");
|
||||
}
|
||||
|
||||
$(".dropdown-data-cityname").off();
|
||||
$(".dropdown-data-cityname").click(function (evnt) {
|
||||
evnt.preventDefault();
|
||||
console.log($(this).html());
|
||||
$("#dropdown-city").html($(this).html());
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
});
|
||||
|
||||
$("#dropdown-zone").click(function (event) {
|
||||
event.preventDefault();
|
||||
var dropdata = $("#dropdown-zone-data");
|
||||
dropdata.html("");
|
||||
|
||||
$.post('/senddata/newdate', 'action=getzones&cityname=' + $("#dropdown-city").html(), function (data) {
|
||||
console.log(data);
|
||||
if (data.query == "ok") {
|
||||
var prev = "";
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var zone = data.data[i].zone;
|
||||
dropdata.append("<a class=\"dropdown-data-zonename dropdown-item\" href=\"#\">" + zone + "</a>");
|
||||
}
|
||||
|
||||
$(".dropdown-data-zonename").off();
|
||||
$(".dropdown-data-zonename").click(function (evnt) {
|
||||
evnt.preventDefault();
|
||||
console.log($(this).html());
|
||||
$("#dropdown-zone").html($(this).html());
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".dropdown-item-wastetype").click(function (event) {
|
||||
event.preventDefault();
|
||||
$("#dropdown-type-data").html($(this).html());
|
||||
});
|
||||
|
||||
|
||||
$('.btn-savelist').click(function () {
|
||||
console.log("saving date");
|
||||
|
||||
var cityname = $("#dropdown-city");
|
||||
var zone = $("#dropdown-zone");
|
||||
var wastetype = $("#dropdown-type-data");
|
||||
var date = $("#input-wastetime");
|
||||
|
||||
$.post('/senddata/newdate', 'action=newdate&cityname=' + cityname.html() + "&zone=" + zone.html() + "&wastetype=" + wastetype.html() + "&date=" + date.val(), function (data) {
|
||||
if (data.status == "success") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully created Date!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
|
||||
cityname.html("Select City");
|
||||
zone.html("Select Zone");
|
||||
wastetype.html("Select waste type");
|
||||
date.val("");
|
||||
} else if (data.status == "citydoesntexist") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'city name doesnt exist',
|
||||
html: 'Close popup.',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
console.log(data)
|
||||
}, "json");
|
||||
});
|
||||
|
||||
|
||||
//Date picker pop up actions...
|
||||
var date_input = $('input[name="date"]'); //our date input has the name "date"
|
||||
var container = $('.bootstrap-iso form').length > 0 ? $('.bootstrap-iso form').parent() : "body";
|
||||
var options = {
|
||||
format: 'yyyy-mm-dd',
|
||||
container: container,
|
||||
todayHighlight: true,
|
||||
autoclose: true,
|
||||
};
|
||||
date_input.datepicker(options);
|
||||
});
|
45
src/resources/wwwroot/jsold/adminpanel.js
Normal file
45
src/resources/wwwroot/jsold/adminpanel.js
Normal file
@ -0,0 +1,45 @@
|
||||
$(document).ready(function () {
|
||||
new AdminPanel();
|
||||
});
|
||||
|
||||
class AdminPanel {
|
||||
constructor() {
|
||||
this.checkLoginState();
|
||||
this.addClickListeners();
|
||||
}
|
||||
|
||||
checkLoginState(){
|
||||
$.post('/senddata/checkloginstate', 'action=getloginstate', function (data) {
|
||||
console.log(data);
|
||||
if (data.loggedin == true) {
|
||||
$("#userlabel").html(" " + data.username);
|
||||
if (data.permission > 0) {
|
||||
$("#adminpanel").show();
|
||||
}
|
||||
} else {
|
||||
$("#userlabel").html(" not logged in!!");
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
addClickListeners(){
|
||||
$("#btn-shutdown").click(function (event) {
|
||||
console.log("shutting down server");
|
||||
|
||||
$.post('/senddata/admindata', 'action=shutdownserver', function (data) {
|
||||
console.log(data);
|
||||
|
||||
}, 'json');
|
||||
|
||||
});
|
||||
|
||||
$("#btn-restart").click(function (event) {
|
||||
console.log("restarting server");
|
||||
|
||||
$.post('/senddata/admindata', 'action=restartserver', function (data) {
|
||||
console.log(data);
|
||||
|
||||
}, 'json');
|
||||
});
|
||||
}
|
||||
}
|
366
src/resources/wwwroot/jsold/dashboard.js
Normal file
366
src/resources/wwwroot/jsold/dashboard.js
Normal file
@ -0,0 +1,366 @@
|
||||
$(document).ready(function () {
|
||||
new Dashboard();
|
||||
});
|
||||
|
||||
class Dashboard {
|
||||
constructor() {
|
||||
//load header data
|
||||
this.loadHeaderData();
|
||||
|
||||
//load footer
|
||||
this.loadVersionFooter();
|
||||
|
||||
//reload city table
|
||||
this.reloadtable();
|
||||
|
||||
//reload Date table
|
||||
this.reloadDateTable();
|
||||
|
||||
//init time picker
|
||||
this.initDatePicker();
|
||||
|
||||
//add click listeners to all buttons
|
||||
this.addClickListeners();
|
||||
}
|
||||
|
||||
/* Constants */
|
||||
citytable;
|
||||
datetable;
|
||||
|
||||
/* Btn Action Listeners */
|
||||
|
||||
addClickListeners() {
|
||||
//btn listeners
|
||||
$('#logoutbtn').click(function () {
|
||||
$.post('/senddata/checkloginstate', 'action=logout', function (data) {
|
||||
console.log(data);
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
$('.wastetype-citynew-item').click(function (event) {
|
||||
event.preventDefault();
|
||||
$('#dropdown-wastetype').html($(this).html());
|
||||
});
|
||||
|
||||
$('#btn-savecity').click(function () {
|
||||
var cityname = $("#new_city_cityname").val();
|
||||
var zonename = $("#new_city_zonename").val();
|
||||
var wastetype = $("#dropdown-wastetype").html();
|
||||
console.log("storing: " + cityname + "--" + wastetype + "in db");
|
||||
|
||||
$.post('/senddata/wastedata', 'action=newCity&wastetype=' + wastetype + "&cityname=" + cityname + "&wastezone=" + zonename, function (data) {
|
||||
console.log(data);
|
||||
if (data.status == "inserted") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully created city!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
this.reloadtable();
|
||||
} else if (data.status == "exists") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'Name already exists in db',
|
||||
html: 'Close popup.',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
//clear form data
|
||||
$("#new_city_cityname").val("");
|
||||
$("#new_city_zonename").val("");
|
||||
$("#dropdown-wastetype").html("select waste type");
|
||||
});
|
||||
|
||||
|
||||
/* new Date create: */
|
||||
$("#dropdown-city").click(function (event) {
|
||||
event.preventDefault();
|
||||
var dropdata = $("#dropdown-city-data");
|
||||
dropdata.html("");
|
||||
console.log("loading city names")
|
||||
|
||||
$.post('/senddata/newdate', 'action=getCitynames', function (data) {
|
||||
console.log(data);
|
||||
if (data.query == "ok") {
|
||||
var prev = "";
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var name = data.data[i].cityname;
|
||||
dropdata.append("<a class=\"dropdown-data-cityname dropdown-item\" href=\"#\">" + name + "</a>");
|
||||
}
|
||||
|
||||
$(".dropdown-data-cityname").off();
|
||||
$(".dropdown-data-cityname").click(function (evnt) {
|
||||
evnt.preventDefault();
|
||||
console.log($(this).html());
|
||||
$("#dropdown-city").html($(this).html());
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
});
|
||||
|
||||
$("#dropdown-zone").click(function (event) {
|
||||
event.preventDefault();
|
||||
var dropdata = $("#dropdown-zone-data");
|
||||
dropdata.html("");
|
||||
|
||||
$.post('/senddata/newdate', 'action=getzones&cityname=' + $("#dropdown-city").html(), function (data) {
|
||||
console.log(data);
|
||||
if (data.query == "ok") {
|
||||
var prev = "";
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var zone = data.data[i].zone;
|
||||
dropdata.append("<a class=\"dropdown-data-zonename dropdown-item\" href=\"#\">" + zone + "</a>");
|
||||
}
|
||||
|
||||
$(".dropdown-data-zonename").off();
|
||||
$(".dropdown-data-zonename").click(function (evnt) {
|
||||
evnt.preventDefault();
|
||||
console.log($(this).html());
|
||||
$("#dropdown-zone").html($(this).html());
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#dropdown-type-data").click(function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var dropdata = $("#dropdown-type-drops");
|
||||
dropdata.html("");
|
||||
console.log("clickeeeed");
|
||||
|
||||
$.post('/senddata/newdate', 'action=gettypes&cityname=' + $("#dropdown-city").html() + '&zonename=' + $("#dropdown-zone").html(), function (data) {
|
||||
console.log(data);
|
||||
if (data.query == "ok") {
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var type = data.data[i].wastetype;
|
||||
dropdata.append("<a class=\"dropdown-data-typename dropdown-item\" href=\"#\">" + type + "</a>");
|
||||
}
|
||||
|
||||
$(".dropdown-data-typename").off();
|
||||
$(".dropdown-data-typename").click(function (evnt) {
|
||||
evnt.preventDefault();
|
||||
$("#dropdown-type-data").html($(this).html());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('.btn-savelist').click(function () {
|
||||
console.log("saving date");
|
||||
|
||||
var cityname = $("#dropdown-city");
|
||||
var zone = $("#dropdown-zone");
|
||||
var wastetype = $("#dropdown-type-data");
|
||||
var date = $("#input-wastetime");
|
||||
|
||||
$.post('/senddata/newdate', 'action=newdate&cityname=' + cityname.html() + "&zone=" + zone.html() + "&wastetype=" + wastetype.html() + "&date=" + date.val(), function (data) {
|
||||
if (data.status == "success") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully created Date!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
|
||||
cityname.html("Select City");
|
||||
zone.html("Select Zone");
|
||||
wastetype.html("Select waste type");
|
||||
date.val("");
|
||||
reloadDateTable();
|
||||
} else if (data.status == "citydoesntexist") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'city name doesnt exist',
|
||||
html: 'Close popup.',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
console.log(data)
|
||||
}, "json");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Functions */
|
||||
initDatePicker() {
|
||||
//Date picker pop up actions...
|
||||
var date_input = $('input[name="date"]'); //our date input has the name "date"
|
||||
var container = $('.bootstrap-iso form').length > 0 ? $('.bootstrap-iso form').parent() : "body";
|
||||
var options = {
|
||||
format: 'yyyy-mm-dd',
|
||||
container: container,
|
||||
todayHighlight: true,
|
||||
autoclose: true,
|
||||
};
|
||||
date_input.datepicker(options);
|
||||
}
|
||||
|
||||
loadHeaderData() {
|
||||
$.post('/senddata/wastedata', 'action=getStartHeaderData', function (data) {
|
||||
console.log(data);
|
||||
$("#total-connection-labels").html(data.collectionnumber);
|
||||
|
||||
$("#planed-collection-label").html(data.futurecollections);
|
||||
|
||||
$("#finished-collection-label").html(data.finshedcollections);
|
||||
|
||||
$("#total-city-number-label").html(data.citynumber);
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
loadVersionFooter() {
|
||||
$.post('/senddata/wastedata', 'action=getversionandbuildtime', function (data) {
|
||||
$("#version-footer-label").html("<b>Version</b> " + data.version + " <b>Build</b> " + data.buildtime);
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
reloadtable() {
|
||||
$.post('/senddata/wastedata', 'action=getAllCities', function (data) {
|
||||
if (this.citytable != null) {
|
||||
this.citytable.destroy(); //delete table if already created
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
if (data.query == "ok") {
|
||||
var tabledata = $('#location-table-data');
|
||||
|
||||
|
||||
tabledata.html("");
|
||||
//todo in variable
|
||||
$(".delbtn").off();
|
||||
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
tabledata.append("<tr>" +
|
||||
"<td>" + data.data[i].cityname + "</td>" +
|
||||
"<td>" + data.data[i].zone + "</td>" +
|
||||
"<td>" + data.data[i].wastetype + "</td>" +
|
||||
"<td>" + "<button dataid='" + data.data[i].id + "' type='button' class='delbtn btn btn-danger'>X</button>" + "</td>" +
|
||||
"</tr>");
|
||||
}
|
||||
|
||||
$(".delbtn").click(function (event) {
|
||||
var id = event.target.getAttribute("dataid");
|
||||
console.log("clicked btn data " + id);
|
||||
$.post('/senddata/wastedata', 'action=deletecity&id=' + id, function (data) {
|
||||
console.log(data);
|
||||
if (data.status === "success") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully deleted city!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
reloadtable();
|
||||
} else if (data.status === "dependenciesnotdeleted") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'This city is a dependency of a date',
|
||||
html: 'Do you want do delete it anyway with all dependencies?',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
//todo set yes no button here
|
||||
}
|
||||
|
||||
}, "json");
|
||||
});
|
||||
|
||||
this.citytable = $("#example2").DataTable();
|
||||
} else if (data.query == "nodbconn") {
|
||||
Swal.fire({
|
||||
type: "error",
|
||||
title: 'No connection to Database',
|
||||
html: 'Setup DB here --> <a href="index.html">click<a/>.',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
} else {
|
||||
console.log("Error: " + data.query);
|
||||
}
|
||||
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
reloadDateTable() {
|
||||
$.post('/senddata/wastedata', 'action=getAllDates', function (data) {
|
||||
if (this.datetable != null) {
|
||||
this.datetable.destroy(); //delete table if already created
|
||||
}
|
||||
console.log(data);
|
||||
|
||||
if (data.query == "ok") {
|
||||
$('#picupdates-tablebody').html("");
|
||||
$(".delbtndate").off();
|
||||
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
$('#picupdates-tablebody').append("<tr>" +
|
||||
"<td>" + data.data[i].cityname + "</td>" +
|
||||
"<td>" + data.data[i].zone + "</td>" +
|
||||
"<td>" + data.data[i].wastetype + "</td>" +
|
||||
"<td>" + data.data[i].date + "</td>" +
|
||||
"<td>" + "<button dataid='" + data.data[i].id + "' type='button' class='delbtndate btn btn-danger'>X</button>" + "</td>" +
|
||||
"</tr>");
|
||||
}
|
||||
|
||||
$(".delbtndate").click(function (event) {
|
||||
var id = event.target.getAttribute("dataid");
|
||||
console.log("clicked btn data " + id);
|
||||
$.post('/senddata/wastedata', 'action=deletedate&id=' + id, function (data) {
|
||||
console.log(data);
|
||||
if (data.status == "success") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully deleted city!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
reloadDateTable();
|
||||
} else if (data.status == "dependenciesnotdeleted") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'This city is a dependency of a date',
|
||||
html: 'Do you want do delete it anyway with all dependencies?',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
//todo set yes no button here
|
||||
}
|
||||
|
||||
}, "json");
|
||||
});
|
||||
}
|
||||
this.datetable = $("#table-pickupdates").DataTable({
|
||||
"order": [[3, "asc"]]
|
||||
});
|
||||
}, "json");
|
||||
}
|
||||
}
|
||||
|
||||
|
294
src/resources/wwwroot/jsold/device.js
Normal file
294
src/resources/wwwroot/jsold/device.js
Normal file
@ -0,0 +1,294 @@
|
||||
$(document).ready(function () {
|
||||
new Device();
|
||||
});
|
||||
|
||||
|
||||
class Device {
|
||||
constructor() {
|
||||
this.reloadDevices()
|
||||
}
|
||||
|
||||
devicetable = null;
|
||||
|
||||
/**
|
||||
* reload devices list on page
|
||||
*/
|
||||
reloadDevices() {
|
||||
var _this = this;
|
||||
$.post('/senddata/Devicedata', 'action=getdevices', function (data) {
|
||||
if (_this.devicetable != null) {
|
||||
_this.devicetable.destroy();
|
||||
}
|
||||
console.log(data);
|
||||
|
||||
$('#devices-tablebody').html("");
|
||||
$(".delbtn").off();
|
||||
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var id = data.data[i].deviceid;
|
||||
var cityid = data.data[i].cityid;
|
||||
|
||||
|
||||
if (cityid === -1) {
|
||||
$("#devices-tablebody").append("<tr><td>" + id + "</td><td>new Device</td><td><button deviceid=\"" + id + "\"type=\"button\" class=\"btn btn-primary configuredevicebutton\">Configure</button></td><td></td><td><button dataid='" + id + "' type='button' class='delbtn btn btn-danger'>X</button></td></tr>");
|
||||
} else {
|
||||
var devicename = data.data[i].devicename;
|
||||
var devicelocation = data.data[i].devicelocation;
|
||||
|
||||
var row = "<tr><td>" + id + "</td><td>" + devicename + "</td><td>" + devicelocation + "</td><td>";
|
||||
|
||||
for (var n = 0; n < data.data[i].devices.length; n++) {
|
||||
var cityname = data.data[i].devices[n].cityname;
|
||||
var cityzone = data.data[i].devices[n].zone;
|
||||
var wastetype = data.data[i].devices[n].wastetype;
|
||||
row += cityname + "/" + wastetype + "/" + cityzone + " </br>";
|
||||
}
|
||||
|
||||
row += "</td><td><button dataid='" + id + "' type='button' class='delbtn btn btn-danger'>X</button><button dataid='" + id + "' type='button' class='addbtn btn btn-success'>ADD</button></td></tr>";
|
||||
|
||||
$("#devices-tablebody").append(row);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_this.addDeleteButton();
|
||||
_this.addAddButton();
|
||||
_this.addConfigDialog();
|
||||
_this.devicetable = $('#table-devices').DataTable();
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
/**
|
||||
* add click listener to add button to add new city entries to current device
|
||||
*/
|
||||
addAddButton() {
|
||||
$('.addbtn').click(function (event) {
|
||||
var id = event.target.getAttribute("dataid");
|
||||
var cityname;
|
||||
var zone;
|
||||
var wastetype;
|
||||
var devicename;
|
||||
var devicelocation;
|
||||
|
||||
$.post('/senddata/Devicedata', 'action=getCitynames', function (data) {
|
||||
Swal.mixin({
|
||||
input: 'text',
|
||||
confirmButtonText: 'Next →',
|
||||
showCancelButton: true,
|
||||
progressSteps: ['1']
|
||||
}).queue([{
|
||||
title: 'City',
|
||||
text: 'Select your City',
|
||||
input: 'select',
|
||||
inputOptions: data
|
||||
}
|
||||
]).then((result) => {
|
||||
if (result.value) {
|
||||
console.log(result.value);
|
||||
const answers = JSON.stringify(result.value);
|
||||
cityname = result.value[0];
|
||||
|
||||
console.log("cityname=" + cityname);
|
||||
$.post('/senddata/Devicedata', 'action=getzones&cityname=' + cityname, function (data) {
|
||||
Swal.mixin({
|
||||
input: 'text',
|
||||
confirmButtonText: 'Next →',
|
||||
showCancelButton: true,
|
||||
progressSteps: ['1']
|
||||
}).queue([
|
||||
{
|
||||
title: 'City',
|
||||
text: 'Select your City',
|
||||
input: 'select',
|
||||
inputOptions: data
|
||||
}
|
||||
]).then((result) => {
|
||||
if (result.value) {
|
||||
console.log(result.value);
|
||||
zone = result.value[0];
|
||||
$.post('/senddata/Devicedata', 'action=gettypes&cityname=' + cityname + '&zonename=' + zone, function (data) {
|
||||
Swal.mixin({
|
||||
input: 'text',
|
||||
confirmButtonText: 'Next →',
|
||||
showCancelButton: true,
|
||||
progressSteps: ['1']
|
||||
}).queue([
|
||||
{
|
||||
title: 'City',
|
||||
text: 'Select your City',
|
||||
input: 'select',
|
||||
inputOptions: data
|
||||
}
|
||||
]).then((result) => {
|
||||
if (result.value) {
|
||||
console.log(result.value);
|
||||
wastetype = result.value[0];
|
||||
|
||||
|
||||
//todo add to db
|
||||
$.post('/senddata/Devicedata', 'action=addtodb&deviceid=' + id + '&cityname=' + cityname + '&zonename=' + zone + '&wastetype=' + wastetype, function (data) {
|
||||
if (data.success) {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully configured!',
|
||||
html: 'This alert closes added.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ');
|
||||
reloadDevices();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* add click listener to delete button to delete this device entry
|
||||
*/
|
||||
addDeleteButton() {
|
||||
var _this = this;
|
||||
$(".delbtn").click(function (event) {
|
||||
var id = event.target.getAttribute("dataid");
|
||||
console.log("clicked btn data " + id);
|
||||
$.post('/senddata/Devicedata', 'action=deleteDevice&id=' + id, function (data) {
|
||||
console.log(data);
|
||||
if (data.status === "success") {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully deleted city!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
_this.reloadDevices();
|
||||
} else if (data.status === "dependenciesnotdeleted") {
|
||||
Swal.fire({
|
||||
type: "warning",
|
||||
title: 'This city is a dependency of a date',
|
||||
html: 'Do you want do delete it anyway with all dependencies?',
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ')
|
||||
|
||||
});
|
||||
//todo set yes no button here
|
||||
}
|
||||
|
||||
}, "json");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* add click listener to unconfigured device to show configure dialog
|
||||
*/
|
||||
addConfigDialog() {
|
||||
$(".configuredevicebutton").click(function (event) {
|
||||
var id = event.target.getAttribute("deviceid");
|
||||
var cityname;
|
||||
var zone;
|
||||
var wastetype;
|
||||
var devicename;
|
||||
var devicelocation;
|
||||
|
||||
$.post('/senddata/Devicedata', 'action=getCitynames', function (data) {
|
||||
Swal.mixin({
|
||||
input: 'text',
|
||||
confirmButtonText: 'Next →',
|
||||
showCancelButton: true,
|
||||
progressSteps: ['1', '2', '3']
|
||||
}).queue([
|
||||
{
|
||||
title: 'Name of device',
|
||||
text: 'Please define a device name'
|
||||
}, {
|
||||
title: 'Location of device',
|
||||
text: 'Please define a device location'
|
||||
}, {
|
||||
title: 'City',
|
||||
text: 'Select your City',
|
||||
input: 'select',
|
||||
inputOptions: data
|
||||
}
|
||||
]).then((result) => {
|
||||
if (result.value) {
|
||||
console.log(result.value);
|
||||
const answers = JSON.stringify(result.value);
|
||||
cityname = result.value[2];
|
||||
devicename = result.value[0];
|
||||
devicelocation = result.value[1];
|
||||
|
||||
console.log("cityname=" + cityname);
|
||||
$.post('/senddata/Devicedata', 'action=getzones&cityname=' + cityname, function (data) {
|
||||
Swal.mixin({
|
||||
input: 'text',
|
||||
confirmButtonText: 'Next →',
|
||||
showCancelButton: true,
|
||||
progressSteps: ['1']
|
||||
}).queue([
|
||||
{
|
||||
title: 'City',
|
||||
text: 'Select your City',
|
||||
input: 'select',
|
||||
inputOptions: data
|
||||
}
|
||||
]).then((result) => {
|
||||
if (result.value) {
|
||||
console.log(result.value);
|
||||
zone = result.value[0];
|
||||
$.post('/senddata/Devicedata', 'action=gettypes&cityname=' + cityname + '&zonename=' + zone, function (data) {
|
||||
Swal.mixin({
|
||||
input: 'text',
|
||||
confirmButtonText: 'Next →',
|
||||
showCancelButton: true,
|
||||
progressSteps: ['1']
|
||||
}).queue([
|
||||
{
|
||||
title: 'City',
|
||||
text: 'Select your City',
|
||||
input: 'select',
|
||||
inputOptions: data
|
||||
}
|
||||
]).then((result) => {
|
||||
if (result.value) {
|
||||
console.log(result.value);
|
||||
wastetype = result.value[0];
|
||||
|
||||
$.post('/senddata/Devicedata', 'action=savetodb&deviceid=' + id + '&cityname=' + cityname + '&zonename=' + zone + '&wastetype=' + wastetype + '&devicename=' + devicename + '&devicelocation=' + devicelocation, function (data) {
|
||||
if (data.success) {
|
||||
Swal.fire({
|
||||
type: "success",
|
||||
title: 'Successfully configured!',
|
||||
html: 'This alert closes automatically.',
|
||||
timer: 1000,
|
||||
}).then((result) => {
|
||||
console.log('Popup closed. ');
|
||||
reloadDevices();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
console.log("click..." + id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
14
src/resources/wwwroot/jsold/userManager.js
Normal file
14
src/resources/wwwroot/jsold/userManager.js
Normal file
@ -0,0 +1,14 @@
|
||||
$(document).ready(function () {
|
||||
console.log("page loaded");
|
||||
$.post('/senddata/checkloginstate', 'action=getloginstate', function (data) {
|
||||
console.log(data);
|
||||
if (data.loggedin == true) {
|
||||
$("#userlabel").html(" " + data.username);
|
||||
if (data.permission > 0) {
|
||||
$("#adminpanel").show();
|
||||
}
|
||||
} else {
|
||||
$("#userlabel").html(" not logged in!!");
|
||||
}
|
||||
}, 'json');
|
||||
});
|
@ -4834,7 +4834,7 @@
|
||||
this._element.setAttribute('aria-modal', true);
|
||||
|
||||
if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) {
|
||||
this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
|
||||
this._diaLog.Log.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
|
||||
} else {
|
||||
this._element.scrollTop = 0;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2256,7 +2256,7 @@
|
||||
this._element.setAttribute('aria-modal', true);
|
||||
|
||||
if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) {
|
||||
this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
|
||||
this._diaLog.Log.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
|
||||
} else {
|
||||
this._element.scrollTop = 0;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -350,11 +350,11 @@ var Lightbox = (function ($) {
|
||||
value: function _toggleLoading(show) {
|
||||
show = show || false;
|
||||
if (show) {
|
||||
this._$modalDialog.css('display', 'none');
|
||||
this._$modalDiaLog.Log.css('display', 'none');
|
||||
this._$modal.removeClass('in show');
|
||||
$('.modal-backdrop').append(this._config.loadingMessage);
|
||||
} else {
|
||||
this._$modalDialog.css('display', 'block');
|
||||
this._$modalDiaLog.Log.css('display', 'block');
|
||||
this._$modal.addClass('in show');
|
||||
$('.modal-backdrop').find('.ekko-lightbox-loader').remove();
|
||||
}
|
||||
@ -383,7 +383,7 @@ var Lightbox = (function ($) {
|
||||
}, {
|
||||
key: '_totalCssByAttribute',
|
||||
value: function _totalCssByAttribute(attribute) {
|
||||
return parseInt(this._$modalDialog.css(attribute), 10) + parseInt(this._$modalContent.css(attribute), 10) + parseInt(this._$modalBody.css(attribute), 10);
|
||||
return parseInt(this._$modalDiaLog.Log.css(attribute), 10) + parseInt(this._$modalContent.css(attribute), 10) + parseInt(this._$modalBody.css(attribute), 10);
|
||||
}
|
||||
}, {
|
||||
key: '_updateTitleAndFooter',
|
||||
@ -613,7 +613,7 @@ var Lightbox = (function ($) {
|
||||
var borderPadding = this._padding.top + this._padding.bottom + this._border.bottom + this._border.top;
|
||||
|
||||
//calculated each time as resizing the window can cause them to change due to Bootstraps fluid margins
|
||||
var margins = parseFloat(this._$modalDialog.css('margin-top')) + parseFloat(this._$modalDialog.css('margin-bottom'));
|
||||
var margins = parseFloat(this._$modalDiaLog.Log.css('margin-top')) + parseFloat(this._$modalDiaLog.Log.css('margin-bottom'));
|
||||
|
||||
var maxHeight = Math.min(height, $(window).height() - borderPadding - margins - headerHeight - footerHeight, this._config.maxHeight - borderPadding - headerHeight - footerHeight);
|
||||
|
||||
@ -623,7 +623,7 @@ var Lightbox = (function ($) {
|
||||
}
|
||||
|
||||
this._$lightboxContainer.css('height', maxHeight);
|
||||
this._$modalDialog.css('flex', 1).css('maxWidth', width);
|
||||
this._$modalDiaLog.Log.css('flex', 1).css('maxWidth', width);
|
||||
|
||||
var modal = this._$modal.data('bs.modal');
|
||||
if (modal) {
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
/*! jQuery UI - v1.12.1 - 2016-09-14
|
||||
* http://jqueryui.com
|
||||
* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
|
||||
* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, diaLog.Log.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
|
||||
* To view and modify this theme, visit http://jqueryui.com/themeroller/?bgShadowXPos=&bgOverlayXPos=&bgErrorXPos=&bgHighlightXPos=&bgContentXPos=&bgHeaderXPos=&bgActiveXPos=&bgHoverXPos=&bgDefaultXPos=&bgShadowYPos=&bgOverlayYPos=&bgErrorYPos=&bgHighlightYPos=&bgContentYPos=&bgHeaderYPos=&bgActiveYPos=&bgHoverYPos=&bgDefaultYPos=&bgShadowRepeat=&bgOverlayRepeat=&bgErrorRepeat=&bgHighlightRepeat=&bgContentRepeat=&bgHeaderRepeat=&bgActiveRepeat=&bgHoverRepeat=&bgDefaultRepeat=&iconsHover=url(%22images%2Fui-icons_555555_256x240.png%22)&iconsHighlight=url(%22images%2Fui-icons_777620_256x240.png%22)&iconsHeader=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsError=url(%22images%2Fui-icons_cc0000_256x240.png%22)&iconsDefault=url(%22images%2Fui-icons_777777_256x240.png%22)&iconsContent=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsActive=url(%22images%2Fui-icons_ffffff_256x240.png%22)&bgImgUrlShadow=&bgImgUrlOverlay=&bgImgUrlHover=&bgImgUrlHighlight=&bgImgUrlHeader=&bgImgUrlError=&bgImgUrlDefault=&bgImgUrlContent=&bgImgUrlActive=&opacityFilterShadow=Alpha(Opacity%3D30)&opacityFilterOverlay=Alpha(Opacity%3D30)&opacityShadowPerc=30&opacityOverlayPerc=30&iconColorHover=%23555555&iconColorHighlight=%23777620&iconColorHeader=%23444444&iconColorError=%23cc0000&iconColorDefault=%23777777&iconColorContent=%23444444&iconColorActive=%23ffffff&bgImgOpacityShadow=0&bgImgOpacityOverlay=0&bgImgOpacityError=95&bgImgOpacityHighlight=55&bgImgOpacityContent=75&bgImgOpacityHeader=75&bgImgOpacityActive=65&bgImgOpacityHover=75&bgImgOpacityDefault=75&bgTextureShadow=flat&bgTextureOverlay=flat&bgTextureError=flat&bgTextureHighlight=flat&bgTextureContent=flat&bgTextureHeader=flat&bgTextureActive=flat&bgTextureHover=flat&bgTextureDefault=flat&cornerRadius=3px&fwDefault=normal&ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&cornerRadiusShadow=8px&thicknessShadow=5px&offsetLeftShadow=0px&offsetTopShadow=0px&opacityShadow=.3&bgColorShadow=%23666666&opacityOverlay=.3&bgColorOverlay=%23aaaaaa&fcError=%235f3f3f&borderColorError=%23f1a899&bgColorError=%23fddfdf&fcHighlight=%23777620&borderColorHighlight=%23dad55e&bgColorHighlight=%23fffa90&fcContent=%23333333&borderColorContent=%23dddddd&bgColorContent=%23ffffff&fcHeader=%23333333&borderColorHeader=%23dddddd&bgColorHeader=%23e9e9e9&fcActive=%23ffffff&borderColorActive=%23003eff&bgColorActive=%23007fff&fcHover=%232b2b2b&borderColorHover=%23cccccc&bgColorHover=%23ededed&fcDefault=%23454545&borderColorDefault=%23c5c5c5&bgColorDefault=%23f6f6f6
|
||||
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*! jQuery UI - v1.12.1 - 2016-09-14
|
||||
* http://jqueryui.com
|
||||
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
|
||||
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/diaLog.Log.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
|
||||
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
(function( factory ) {
|
||||
@ -11956,7 +11956,7 @@ var widgetsResizable = $.ui.resizable;
|
||||
//>>docs: http://api.jqueryui.com/dialog/
|
||||
//>>demos: http://jqueryui.com/dialog/
|
||||
//>>css.structure: ../../themes/base/core.css
|
||||
//>>css.structure: ../../themes/base/dialog.css
|
||||
//>>css.structure: ../../themes/base/diaLog.Log.css
|
||||
//>>css.theme: ../../themes/base/theme.css
|
||||
|
||||
|
||||
@ -12104,7 +12104,7 @@ $.widget( "ui.dialog", {
|
||||
// Without detaching first, the following becomes really slow
|
||||
.detach();
|
||||
|
||||
this.uiDialog.remove();
|
||||
this.uiDiaLog.Log.remove();
|
||||
|
||||
if ( this.originalTitle ) {
|
||||
this.element.attr( "title", this.originalTitle );
|
||||
@ -12162,13 +12162,13 @@ $.widget( "ui.dialog", {
|
||||
|
||||
_moveToTop: function( event, silent ) {
|
||||
var moved = false,
|
||||
zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
|
||||
zIndices = this.uiDiaLog.Log.siblings( ".ui-front:visible" ).map( function() {
|
||||
return +$( this ).css( "z-index" );
|
||||
} ).get(),
|
||||
zIndexMax = Math.max.apply( null, zIndices );
|
||||
|
||||
if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
|
||||
this.uiDialog.css( "z-index", zIndexMax + 1 );
|
||||
if ( zIndexMax >= +this.uiDiaLog.Log.css( "z-index" ) ) {
|
||||
this.uiDiaLog.Log.css( "z-index", zIndexMax + 1 );
|
||||
moved = true;
|
||||
}
|
||||
|
||||
@ -12199,7 +12199,7 @@ $.widget( "ui.dialog", {
|
||||
// opening. The overlay shouldn't move after the dialog is open so that
|
||||
// modeless dialogs opened after the modal dialog stack properly.
|
||||
if ( this.overlay ) {
|
||||
this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
|
||||
this.overlay.css( "z-index", this.uiDiaLog.Log.css( "z-index" ) - 1 );
|
||||
}
|
||||
|
||||
this._show( this.uiDialog, this.options.show, function() {
|
||||
@ -12286,7 +12286,7 @@ $.widget( "ui.dialog", {
|
||||
if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
|
||||
return;
|
||||
}
|
||||
var tabbables = this.uiDialog.find( ":tabbable" ),
|
||||
var tabbables = this.uiDiaLog.Log.find( ":tabbable" ),
|
||||
first = tabbables.filter( ":first" ),
|
||||
last = tabbables.filter( ":last" );
|
||||
|
||||
@ -12315,7 +12315,7 @@ $.widget( "ui.dialog", {
|
||||
// that the dialog content is marked up properly
|
||||
// otherwise we brute force the content as the description
|
||||
if ( !this.element.find( "[aria-describedby]" ).length ) {
|
||||
this.uiDialog.attr( {
|
||||
this.uiDiaLog.Log.attr( {
|
||||
"aria-describedby": this.element.uniqueId().attr( "id" )
|
||||
} );
|
||||
}
|
||||
@ -12336,7 +12336,7 @@ $.widget( "ui.dialog", {
|
||||
if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
|
||||
|
||||
// Dialog isn't getting focus when dragging (#8063)
|
||||
this.uiDialog.trigger( "focus" );
|
||||
this.uiDiaLog.Log.trigger( "focus" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
@ -12366,7 +12366,7 @@ $.widget( "ui.dialog", {
|
||||
|
||||
this.uiDialogTitlebar.prependTo( this.uiDialog );
|
||||
|
||||
this.uiDialog.attr( {
|
||||
this.uiDiaLog.Log.attr( {
|
||||
"aria-labelledby": uiDialogTitle.attr( "id" )
|
||||
} );
|
||||
},
|
||||
@ -12458,7 +12458,7 @@ $.widget( "ui.dialog", {
|
||||
};
|
||||
}
|
||||
|
||||
this.uiDialog.draggable( {
|
||||
this.uiDiaLog.Log.draggable( {
|
||||
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
|
||||
handle: ".ui-dialog-titlebar",
|
||||
containment: "document",
|
||||
@ -12494,7 +12494,7 @@ $.widget( "ui.dialog", {
|
||||
|
||||
// .ui-resizable has position: relative defined in the stylesheet
|
||||
// but dialogs have to use absolute or fixed positioning
|
||||
position = this.uiDialog.css( "position" ),
|
||||
position = this.uiDiaLog.Log.css( "position" ),
|
||||
resizeHandles = typeof handles === "string" ?
|
||||
handles :
|
||||
"n,e,s,w,se,sw,ne,nw";
|
||||
@ -12508,7 +12508,7 @@ $.widget( "ui.dialog", {
|
||||
};
|
||||
}
|
||||
|
||||
this.uiDialog.resizable( {
|
||||
this.uiDiaLog.Log.resizable( {
|
||||
cancel: ".ui-dialog-content",
|
||||
containment: "document",
|
||||
alsoResize: this.element,
|
||||
@ -12526,12 +12526,12 @@ $.widget( "ui.dialog", {
|
||||
that._trigger( "resize", event, filteredUi( ui ) );
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
var offset = that.uiDialog.offset(),
|
||||
var offset = that.uiDiaLog.Log.offset(),
|
||||
left = offset.left - that.document.scrollLeft(),
|
||||
top = offset.top - that.document.scrollTop();
|
||||
|
||||
options.height = that.uiDialog.height();
|
||||
options.width = that.uiDialog.width();
|
||||
options.height = that.uiDiaLog.Log.height();
|
||||
options.width = that.uiDiaLog.Log.width();
|
||||
options.position = {
|
||||
my: "left top",
|
||||
at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
|
||||
@ -12588,13 +12588,13 @@ $.widget( "ui.dialog", {
|
||||
_position: function() {
|
||||
|
||||
// Need to show the dialog to get the actual offset in the position plugin
|
||||
var isVisible = this.uiDialog.is( ":visible" );
|
||||
var isVisible = this.uiDiaLog.Log.is( ":visible" );
|
||||
if ( !isVisible ) {
|
||||
this.uiDialog.show();
|
||||
this.uiDiaLog.Log.show();
|
||||
}
|
||||
this.uiDialog.position( this.options.position );
|
||||
this.uiDiaLog.Log.position( this.options.position );
|
||||
if ( !isVisible ) {
|
||||
this.uiDialog.hide();
|
||||
this.uiDiaLog.Log.hide();
|
||||
}
|
||||
},
|
||||
|
||||
@ -12618,8 +12618,8 @@ $.widget( "ui.dialog", {
|
||||
this._size();
|
||||
this._position();
|
||||
}
|
||||
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
|
||||
this.uiDialog.resizable( "option", resizableOptions );
|
||||
if ( this.uiDiaLog.Log.is( ":data(ui-resizable)" ) ) {
|
||||
this.uiDiaLog.Log.resizable( "option", resizableOptions );
|
||||
}
|
||||
},
|
||||
|
||||
@ -12634,7 +12634,7 @@ $.widget( "ui.dialog", {
|
||||
this._super( key, value );
|
||||
|
||||
if ( key === "appendTo" ) {
|
||||
this.uiDialog.appendTo( this._appendTo() );
|
||||
this.uiDiaLog.Log.appendTo( this._appendTo() );
|
||||
}
|
||||
|
||||
if ( key === "buttons" ) {
|
||||
@ -12650,9 +12650,9 @@ $.widget( "ui.dialog", {
|
||||
}
|
||||
|
||||
if ( key === "draggable" ) {
|
||||
isDraggable = uiDialog.is( ":data(ui-draggable)" );
|
||||
isDraggable = uiDiaLog.Log.is( ":data(ui-draggable)" );
|
||||
if ( isDraggable && !value ) {
|
||||
uiDialog.draggable( "destroy" );
|
||||
uiDiaLog.Log.draggable( "destroy" );
|
||||
}
|
||||
|
||||
if ( !isDraggable && value ) {
|
||||
@ -12667,14 +12667,14 @@ $.widget( "ui.dialog", {
|
||||
if ( key === "resizable" ) {
|
||||
|
||||
// currently resizable, becoming non-resizable
|
||||
isResizable = uiDialog.is( ":data(ui-resizable)" );
|
||||
isResizable = uiDiaLog.Log.is( ":data(ui-resizable)" );
|
||||
if ( isResizable && !value ) {
|
||||
uiDialog.resizable( "destroy" );
|
||||
uiDiaLog.Log.resizable( "destroy" );
|
||||
}
|
||||
|
||||
// Currently resizable, changing handles
|
||||
if ( isResizable && typeof value === "string" ) {
|
||||
uiDialog.resizable( "option", "handles", value );
|
||||
uiDiaLog.Log.resizable( "option", "handles", value );
|
||||
}
|
||||
|
||||
// Currently non-resizable, becoming resizable
|
||||
@ -12709,7 +12709,7 @@ $.widget( "ui.dialog", {
|
||||
|
||||
// Reset wrapper sizing
|
||||
// determine the height of all the non-content elements
|
||||
nonContentHeight = this.uiDialog.css( {
|
||||
nonContentHeight = this.uiDiaLog.Log.css( {
|
||||
height: "auto",
|
||||
width: options.width
|
||||
} )
|
||||
@ -12729,8 +12729,8 @@ $.widget( "ui.dialog", {
|
||||
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
|
||||
}
|
||||
|
||||
if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
|
||||
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
|
||||
if ( this.uiDiaLog.Log.is( ":data(ui-resizable)" ) ) {
|
||||
this.uiDiaLog.Log.resizable( "option", "minHeight", this._minHeight() );
|
||||
}
|
||||
},
|
||||
|
||||
@ -12840,7 +12840,7 @@ if ( $.uiBackCompat !== false ) {
|
||||
},
|
||||
_createWrapper: function() {
|
||||
this._super();
|
||||
this.uiDialog.addClass( this.options.dialogClass );
|
||||
this.uiDiaLog.Log.addClass( this.options.dialogClass );
|
||||
},
|
||||
_setOption: function( key, value ) {
|
||||
if ( key === "dialogClass" ) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*! jQuery UI - v1.12.1 - 2016-09-14
|
||||
* http://jqueryui.com
|
||||
* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
|
||||
* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, diaLog.Log.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
|
||||
* To view and modify this theme, visit http://jqueryui.com/themeroller/?bgShadowXPos=&bgOverlayXPos=&bgErrorXPos=&bgHighlightXPos=&bgContentXPos=&bgHeaderXPos=&bgActiveXPos=&bgHoverXPos=&bgDefaultXPos=&bgShadowYPos=&bgOverlayYPos=&bgErrorYPos=&bgHighlightYPos=&bgContentYPos=&bgHeaderYPos=&bgActiveYPos=&bgHoverYPos=&bgDefaultYPos=&bgShadowRepeat=&bgOverlayRepeat=&bgErrorRepeat=&bgHighlightRepeat=&bgContentRepeat=&bgHeaderRepeat=&bgActiveRepeat=&bgHoverRepeat=&bgDefaultRepeat=&iconsHover=url(%22images%2Fui-icons_555555_256x240.png%22)&iconsHighlight=url(%22images%2Fui-icons_777620_256x240.png%22)&iconsHeader=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsError=url(%22images%2Fui-icons_cc0000_256x240.png%22)&iconsDefault=url(%22images%2Fui-icons_777777_256x240.png%22)&iconsContent=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsActive=url(%22images%2Fui-icons_ffffff_256x240.png%22)&bgImgUrlShadow=&bgImgUrlOverlay=&bgImgUrlHover=&bgImgUrlHighlight=&bgImgUrlHeader=&bgImgUrlError=&bgImgUrlDefault=&bgImgUrlContent=&bgImgUrlActive=&opacityFilterShadow=Alpha(Opacity%3D30)&opacityFilterOverlay=Alpha(Opacity%3D30)&opacityShadowPerc=30&opacityOverlayPerc=30&iconColorHover=%23555555&iconColorHighlight=%23777620&iconColorHeader=%23444444&iconColorError=%23cc0000&iconColorDefault=%23777777&iconColorContent=%23444444&iconColorActive=%23ffffff&bgImgOpacityShadow=0&bgImgOpacityOverlay=0&bgImgOpacityError=95&bgImgOpacityHighlight=55&bgImgOpacityContent=75&bgImgOpacityHeader=75&bgImgOpacityActive=65&bgImgOpacityHover=75&bgImgOpacityDefault=75&bgTextureShadow=flat&bgTextureOverlay=flat&bgTextureError=flat&bgTextureHighlight=flat&bgTextureContent=flat&bgTextureHeader=flat&bgTextureActive=flat&bgTextureHover=flat&bgTextureDefault=flat&cornerRadius=3px&fwDefault=normal&ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&cornerRadiusShadow=8px&thicknessShadow=5px&offsetLeftShadow=0px&offsetTopShadow=0px&opacityShadow=.3&bgColorShadow=%23666666&opacityOverlay=.3&bgColorOverlay=%23aaaaaa&fcError=%235f3f3f&borderColorError=%23f1a899&bgColorError=%23fddfdf&fcHighlight=%23777620&borderColorHighlight=%23dad55e&bgColorHighlight=%23fffa90&fcContent=%23333333&borderColorContent=%23dddddd&bgColorContent=%23ffffff&fcHeader=%23333333&borderColorHeader=%23dddddd&bgColorHeader=%23e9e9e9&fcActive=%23ffffff&borderColorActive=%23003eff&bgColorActive=%23007fff&fcHover=%232b2b2b&borderColorHover=%23cccccc&bgColorHover=%23ededed&fcDefault=%23454545&borderColorDefault=%23c5c5c5&bgColorDefault=%23f6f6f6
|
||||
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -47347,7 +47347,7 @@ var Path = function () {
|
||||
p3y = _c$args3[5];
|
||||
}
|
||||
|
||||
// http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
|
||||
// http://bLog.Log.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
|
||||
bbox.addPoint(p3x, p3y);
|
||||
|
||||
var p0 = [cx, cy];
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -141,7 +141,7 @@
|
||||
'formatH5': 'Change current block\'s format as H5',
|
||||
'formatH6': 'Change current block\'s format as H6',
|
||||
'insertHorizontalRule': 'Insert horizontal rule',
|
||||
'linkDialog.show': 'Show Link Dialog',
|
||||
'linkDiaLog.Log.show': 'Show Link Dialog',
|
||||
},
|
||||
history: {
|
||||
undo: 'تراجع',
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*! Summernote v0.8.12 | (c) 2013- Alan Hong and other contributors | MIT license */
|
||||
|
||||
!function(e){e.extend(e.summernote.lang,{"ar-AR":{font:{bold:"عريض",italic:"مائل",underline:"تحته خط",clear:"مسح التنسيق",height:"إرتفاع السطر",name:"الخط",strikethrough:"فى وسطه خط",subscript:"مخطوطة",superscript:"حرف فوقي",size:"الحجم"},image:{image:"صورة",insert:"إضافة صورة",resizeFull:"الحجم بالكامل",resizeHalf:"تصغير للنصف",resizeQuarter:"تصغير للربع",floatLeft:"تطيير لليسار",floatRight:"تطيير لليمين",floatNone:"ثابته",shapeRounded:"الشكل: تقريب",shapeCircle:"الشكل: دائرة",shapeThumbnail:"الشكل: صورة مصغرة",shapeNone:"الشكل: لا شيء",dragImageHere:"إدرج الصورة هنا",dropImage:"إسقاط صورة أو نص",selectFromFiles:"حدد ملف",maximumFileSize:"الحد الأقصى لحجم الملف",maximumFileSizeError:"تم تجاوز الحد الأقصى لحجم الملف",url:"رابط الصورة",remove:"حذف الصورة",original:"Original"},video:{video:"فيديو",videoLink:"رابط الفيديو",insert:"إدراج الفيديو",url:"رابط الفيديو",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)"},link:{link:"رابط رابط",insert:"إدراج",unlink:"حذف الرابط",edit:"تعديل",textToDisplay:"النص",url:"مسار الرابط",openInNewWindow:"فتح في نافذة جديدة"},table:{table:"جدول",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"إدراج خط أفقي"},style:{style:"تنسيق",p:"عادي",blockquote:"إقتباس",pre:"شفيرة",h1:"عنوان رئيسي 1",h2:"عنوان رئيسي 2",h3:"عنوان رئيسي 3",h4:"عنوان رئيسي 4",h5:"عنوان رئيسي 5",h6:"عنوان رئيسي 6"},lists:{unordered:"قائمة مُنقطة",ordered:"قائمة مُرقمة"},options:{help:"مساعدة",fullscreen:"حجم الشاشة بالكامل",codeview:"شفيرة المصدر"},paragraph:{paragraph:"فقرة",outdent:"محاذاة للخارج",indent:"محاذاة للداخل",left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين",justify:"ملئ السطر"},color:{recent:"تم إستخدامه",more:"المزيد",background:"لون الخلفية",foreground:"لون النص",transparent:"شفاف",setTransparent:"بدون خلفية",reset:"إعادة الضبط",resetToDefault:"إعادة الضبط",cpSelect:"اختار"},shortcut:{shortcuts:"إختصارات",close:"غلق",textFormatting:"تنسيق النص",action:"Action",paragraphFormatting:"تنسيق الفقرة",documentStyle:"تنسيق المستند",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"تراجع",redo:"إعادة"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
|
||||
!function(e){e.extend(e.summernote.lang,{"ar-AR":{font:{bold:"عريض",italic:"مائل",underline:"تحته خط",clear:"مسح التنسيق",height:"إرتفاع السطر",name:"الخط",strikethrough:"فى وسطه خط",subscript:"مخطوطة",superscript:"حرف فوقي",size:"الحجم"},image:{image:"صورة",insert:"إضافة صورة",resizeFull:"الحجم بالكامل",resizeHalf:"تصغير للنصف",resizeQuarter:"تصغير للربع",floatLeft:"تطيير لليسار",floatRight:"تطيير لليمين",floatNone:"ثابته",shapeRounded:"الشكل: تقريب",shapeCircle:"الشكل: دائرة",shapeThumbnail:"الشكل: صورة مصغرة",shapeNone:"الشكل: لا شيء",dragImageHere:"إدرج الصورة هنا",dropImage:"إسقاط صورة أو نص",selectFromFiles:"حدد ملف",maximumFileSize:"الحد الأقصى لحجم الملف",maximumFileSizeError:"تم تجاوز الحد الأقصى لحجم الملف",url:"رابط الصورة",remove:"حذف الصورة",original:"Original"},video:{video:"فيديو",videoLink:"رابط الفيديو",insert:"إدراج الفيديو",url:"رابط الفيديو",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)"},link:{link:"رابط رابط",insert:"إدراج",unlink:"حذف الرابط",edit:"تعديل",textToDisplay:"النص",url:"مسار الرابط",openInNewWindow:"فتح في نافذة جديدة"},table:{table:"جدول",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"إدراج خط أفقي"},style:{style:"تنسيق",p:"عادي",blockquote:"إقتباس",pre:"شفيرة",h1:"عنوان رئيسي 1",h2:"عنوان رئيسي 2",h3:"عنوان رئيسي 3",h4:"عنوان رئيسي 4",h5:"عنوان رئيسي 5",h6:"عنوان رئيسي 6"},lists:{unordered:"قائمة مُنقطة",ordered:"قائمة مُرقمة"},options:{help:"مساعدة",fullscreen:"حجم الشاشة بالكامل",codeview:"شفيرة المصدر"},paragraph:{paragraph:"فقرة",outdent:"محاذاة للخارج",indent:"محاذاة للداخل",left:"محاذاة لليسار",center:"توسيط",right:"محاذاة لليمين",justify:"ملئ السطر"},color:{recent:"تم إستخدامه",more:"المزيد",background:"لون الخلفية",foreground:"لون النص",transparent:"شفاف",setTransparent:"بدون خلفية",reset:"إعادة الضبط",resetToDefault:"إعادة الضبط",cpSelect:"اختار"},shortcut:{shortcuts:"إختصارات",close:"غلق",textFormatting:"تنسيق النص",action:"Action",paragraphFormatting:"تنسيق الفقرة",documentStyle:"تنسيق المستند",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDiaLog.Log.show":"Show Link Dialog"},history:{undo:"تراجع",redo:"إعادة"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
|
@ -141,7 +141,7 @@
|
||||
'formatH5': 'Change current block\'s format as H5',
|
||||
'formatH6': 'Change current block\'s format as H6',
|
||||
'insertHorizontalRule': 'Insert horizontal rule',
|
||||
'linkDialog.show': 'Show Link Dialog',
|
||||
'linkDiaLog.Log.show': 'Show Link Dialog',
|
||||
},
|
||||
history: {
|
||||
undo: 'Назад',
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*! Summernote v0.8.12 | (c) 2013- Alan Hong and other contributors | MIT license */
|
||||
|
||||
!function(e){e.extend(e.summernote.lang,{"bg-BG":{font:{bold:"Удебелен",italic:"Наклонен",underline:"Подчертан",clear:"Изчисти стиловете",height:"Височина",name:"Шрифт",strikethrough:"Задраскано",subscript:"Долен индекс",superscript:"Горен индекс",size:"Размер на шрифта"},image:{image:"Изображение",insert:"Постави картинка",resizeFull:"Цял размер",resizeHalf:"Размер на 50%",resizeQuarter:"Размер на 25%",floatLeft:"Подравни в ляво",floatRight:"Подравни в дясно",floatNone:"Без подравняване",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Пуснете изображението тук",dropImage:"Drop image or Text",selectFromFiles:"Изберете файл",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL адрес на изображение",remove:"Премахни изображение",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"Връзка",insert:"Добави връзка",unlink:"Премахни връзка",edit:"Промени",textToDisplay:"Текст за показване",url:"URL адрес",openInNewWindow:"Отвори в нов прозорец"},table:{table:"Таблица",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Добави хоризонтална линия"},style:{style:"Стил",p:"Нормален",blockquote:"Цитат",pre:"Код",h1:"Заглавие 1",h2:"Заглавие 2",h3:"Заглавие 3",h4:"Заглавие 4",h5:"Заглавие 5",h6:"Заглавие 6"},lists:{unordered:"Символен списък",ordered:"Цифров списък"},options:{help:"Помощ",fullscreen:"На цял екран",codeview:"Преглед на код"},paragraph:{paragraph:"Параграф",outdent:"Намаляване на отстъпа",indent:"Абзац",left:"Подравняване в ляво",center:"Център",right:"Подравняване в дясно",justify:"Разтягане по ширина"},color:{recent:"Последния избран цвят",more:"Още цветове",background:"Цвят на фона",foreground:"Цвят на шрифта",transparent:"Прозрачен",setTransparent:"Направете прозрачен",reset:"Възстанови",resetToDefault:"Възстанови оригиналните",cpSelect:"Изберете"},shortcut:{shortcuts:"Клавишни комбинации",close:"Затвори",textFormatting:"Форматиране на текста",action:"Действие",paragraphFormatting:"Форматиране на параграф",documentStyle:"Стил на документа",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Назад",redo:"Напред"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
|
||||
!function(e){e.extend(e.summernote.lang,{"bg-BG":{font:{bold:"Удебелен",italic:"Наклонен",underline:"Подчертан",clear:"Изчисти стиловете",height:"Височина",name:"Шрифт",strikethrough:"Задраскано",subscript:"Долен индекс",superscript:"Горен индекс",size:"Размер на шрифта"},image:{image:"Изображение",insert:"Постави картинка",resizeFull:"Цял размер",resizeHalf:"Размер на 50%",resizeQuarter:"Размер на 25%",floatLeft:"Подравни в ляво",floatRight:"Подравни в дясно",floatNone:"Без подравняване",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Пуснете изображението тук",dropImage:"Drop image or Text",selectFromFiles:"Изберете файл",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"URL адрес на изображение",remove:"Премахни изображение",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"Връзка",insert:"Добави връзка",unlink:"Премахни връзка",edit:"Промени",textToDisplay:"Текст за показване",url:"URL адрес",openInNewWindow:"Отвори в нов прозорец"},table:{table:"Таблица",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Добави хоризонтална линия"},style:{style:"Стил",p:"Нормален",blockquote:"Цитат",pre:"Код",h1:"Заглавие 1",h2:"Заглавие 2",h3:"Заглавие 3",h4:"Заглавие 4",h5:"Заглавие 5",h6:"Заглавие 6"},lists:{unordered:"Символен списък",ordered:"Цифров списък"},options:{help:"Помощ",fullscreen:"На цял екран",codeview:"Преглед на код"},paragraph:{paragraph:"Параграф",outdent:"Намаляване на отстъпа",indent:"Абзац",left:"Подравняване в ляво",center:"Център",right:"Подравняване в дясно",justify:"Разтягане по ширина"},color:{recent:"Последния избран цвят",more:"Още цветове",background:"Цвят на фона",foreground:"Цвят на шрифта",transparent:"Прозрачен",setTransparent:"Направете прозрачен",reset:"Възстанови",resetToDefault:"Възстанови оригиналните",cpSelect:"Изберете"},shortcut:{shortcuts:"Клавишни комбинации",close:"Затвори",textFormatting:"Форматиране на текста",action:"Действие",paragraphFormatting:"Форматиране на параграф",documentStyle:"Стил на документа",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDiaLog.Log.show":"Show Link Dialog"},history:{undo:"Назад",redo:"Напред"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
|
@ -140,7 +140,7 @@
|
||||
'formatH5': 'Canviar l\'estil del bloc com a un H5',
|
||||
'formatH6': 'Canviar l\'estil del bloc com a un H6',
|
||||
'insertHorizontalRule': 'Inserir una línia horitzontal',
|
||||
'linkDialog.show': 'Mostrar panel d\'enllaços',
|
||||
'linkDiaLog.Log.show': 'Mostrar panel d\'enllaços',
|
||||
},
|
||||
history: {
|
||||
undo: 'Desfer',
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*! Summernote v0.8.12 | (c) 2013- Alan Hong and other contributors | MIT license */
|
||||
|
||||
!function(e){e.extend(e.summernote.lang,{"ca-ES":{font:{bold:"Negreta",italic:"Cursiva",underline:"Subratllat",clear:"Treure estil de lletra",height:"Alçada de línia",name:"Font",strikethrough:"Ratllat",subscript:"Subíndex",superscript:"Superíndex",size:"Mida de lletra"},image:{image:"Imatge",insert:"Inserir imatge",resizeFull:"Redimensionar a mida completa",resizeHalf:"Redimensionar a la meitat",resizeQuarter:"Redimensionar a un quart",floatLeft:"Alinear a l'esquerra",floatRight:"Alinear a la dreta",floatNone:"No alinear",shapeRounded:"Forma: Arrodonit",shapeCircle:"Forma: Cercle",shapeThumbnail:"Forma: Marc",shapeNone:"Forma: Cap",dragImageHere:"Arrossegueu una imatge o text aquí",dropImage:"Deixa anar aquí una imatge o un text",selectFromFiles:"Seleccioneu des dels arxius",maximumFileSize:"Mida màxima de l'arxiu",maximumFileSizeError:"La mida màxima de l'arxiu s'ha superat.",url:"URL de la imatge",remove:"Eliminar imatge",original:"Original"},video:{video:"Vídeo",videoLink:"Enllaç del vídeo",insert:"Inserir vídeo",url:"URL del vídeo?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)"},link:{link:"Enllaç",insert:"Inserir enllaç",unlink:"Treure enllaç",edit:"Editar",textToDisplay:"Text per mostrar",url:"Cap a quina URL porta l'enllaç?",openInNewWindow:"Obrir en una finestra nova"},table:{table:"Taula",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Inserir línia horitzontal"},style:{style:"Estil",p:"p",blockquote:"Cita",pre:"Codi",h1:"Títol 1",h2:"Títol 2",h3:"Títol 3",h4:"Títol 4",h5:"Títol 5",h6:"Títol 6"},lists:{unordered:"Llista desendreçada",ordered:"Llista endreçada"},options:{help:"Ajut",fullscreen:"Pantalla sencera",codeview:"Veure codi font"},paragraph:{paragraph:"Paràgraf",outdent:"Menys tabulació",indent:"Més tabulació",left:"Alinear a l'esquerra",center:"Alinear al mig",right:"Alinear a la dreta",justify:"Justificar"},color:{recent:"Últim color",more:"Més colors",background:"Color de fons",foreground:"Color de lletra",transparent:"Transparent",setTransparent:"Establir transparent",reset:"Restablir",resetToDefault:"Restablir per defecte"},shortcut:{shortcuts:"Dreceres de teclat",close:"Tancar",textFormatting:"Format de text",action:"Acció",paragraphFormatting:"Format de paràgraf",documentStyle:"Estil del document",extraKeys:"Tecles adicionals"},help:{insertParagraph:"Inserir paràgraf",undo:"Desfer l'última acció",redo:"Refer l'última acció",tab:"Tabular",untab:"Eliminar tabulació",bold:"Establir estil negreta",italic:"Establir estil cursiva",underline:"Establir estil subratllat",strikethrough:"Establir estil ratllat",removeFormat:"Netejar estil",justifyLeft:"Alinear a l'esquerra",justifyCenter:"Alinear al centre",justifyRight:"Alinear a la dreta",justifyFull:"Justificar",insertUnorderedList:"Inserir llista desendreçada",insertOrderedList:"Inserir llista endreçada",outdent:"Reduïr tabulació del paràgraf",indent:"Augmentar tabulació del paràgraf",formatPara:"Canviar l'estil del bloc com a un paràgraf (etiqueta P)",formatH1:"Canviar l'estil del bloc com a un H1",formatH2:"Canviar l'estil del bloc com a un H2",formatH3:"Canviar l'estil del bloc com a un H3",formatH4:"Canviar l'estil del bloc com a un H4",formatH5:"Canviar l'estil del bloc com a un H5",formatH6:"Canviar l'estil del bloc com a un H6",insertHorizontalRule:"Inserir una línia horitzontal","linkDialog.show":"Mostrar panel d'enllaços"},history:{undo:"Desfer",redo:"Refer"},specialChar:{specialChar:"CARÀCTERS ESPECIALS",select:"Selecciona caràcters especials"}}})}(jQuery);
|
||||
!function(e){e.extend(e.summernote.lang,{"ca-ES":{font:{bold:"Negreta",italic:"Cursiva",underline:"Subratllat",clear:"Treure estil de lletra",height:"Alçada de línia",name:"Font",strikethrough:"Ratllat",subscript:"Subíndex",superscript:"Superíndex",size:"Mida de lletra"},image:{image:"Imatge",insert:"Inserir imatge",resizeFull:"Redimensionar a mida completa",resizeHalf:"Redimensionar a la meitat",resizeQuarter:"Redimensionar a un quart",floatLeft:"Alinear a l'esquerra",floatRight:"Alinear a la dreta",floatNone:"No alinear",shapeRounded:"Forma: Arrodonit",shapeCircle:"Forma: Cercle",shapeThumbnail:"Forma: Marc",shapeNone:"Forma: Cap",dragImageHere:"Arrossegueu una imatge o text aquí",dropImage:"Deixa anar aquí una imatge o un text",selectFromFiles:"Seleccioneu des dels arxius",maximumFileSize:"Mida màxima de l'arxiu",maximumFileSizeError:"La mida màxima de l'arxiu s'ha superat.",url:"URL de la imatge",remove:"Eliminar imatge",original:"Original"},video:{video:"Vídeo",videoLink:"Enllaç del vídeo",insert:"Inserir vídeo",url:"URL del vídeo?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)"},link:{link:"Enllaç",insert:"Inserir enllaç",unlink:"Treure enllaç",edit:"Editar",textToDisplay:"Text per mostrar",url:"Cap a quina URL porta l'enllaç?",openInNewWindow:"Obrir en una finestra nova"},table:{table:"Taula",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Inserir línia horitzontal"},style:{style:"Estil",p:"p",blockquote:"Cita",pre:"Codi",h1:"Títol 1",h2:"Títol 2",h3:"Títol 3",h4:"Títol 4",h5:"Títol 5",h6:"Títol 6"},lists:{unordered:"Llista desendreçada",ordered:"Llista endreçada"},options:{help:"Ajut",fullscreen:"Pantalla sencera",codeview:"Veure codi font"},paragraph:{paragraph:"Paràgraf",outdent:"Menys tabulació",indent:"Més tabulació",left:"Alinear a l'esquerra",center:"Alinear al mig",right:"Alinear a la dreta",justify:"Justificar"},color:{recent:"Últim color",more:"Més colors",background:"Color de fons",foreground:"Color de lletra",transparent:"Transparent",setTransparent:"Establir transparent",reset:"Restablir",resetToDefault:"Restablir per defecte"},shortcut:{shortcuts:"Dreceres de teclat",close:"Tancar",textFormatting:"Format de text",action:"Acció",paragraphFormatting:"Format de paràgraf",documentStyle:"Estil del document",extraKeys:"Tecles adicionals"},help:{insertParagraph:"Inserir paràgraf",undo:"Desfer l'última acció",redo:"Refer l'última acció",tab:"Tabular",untab:"Eliminar tabulació",bold:"Establir estil negreta",italic:"Establir estil cursiva",underline:"Establir estil subratllat",strikethrough:"Establir estil ratllat",removeFormat:"Netejar estil",justifyLeft:"Alinear a l'esquerra",justifyCenter:"Alinear al centre",justifyRight:"Alinear a la dreta",justifyFull:"Justificar",insertUnorderedList:"Inserir llista desendreçada",insertOrderedList:"Inserir llista endreçada",outdent:"Reduïr tabulació del paràgraf",indent:"Augmentar tabulació del paràgraf",formatPara:"Canviar l'estil del bloc com a un paràgraf (etiqueta P)",formatH1:"Canviar l'estil del bloc com a un H1",formatH2:"Canviar l'estil del bloc com a un H2",formatH3:"Canviar l'estil del bloc com a un H3",formatH4:"Canviar l'estil del bloc com a un H4",formatH5:"Canviar l'estil del bloc com a un H5",formatH6:"Canviar l'estil del bloc com a un H6",insertHorizontalRule:"Inserir una línia horitzontal","linkDiaLog.Log.show":"Mostrar panel d'enllaços"},history:{undo:"Desfer",redo:"Refer"},specialChar:{specialChar:"CARÀCTERS ESPECIALS",select:"Selecciona caràcters especials"}}})}(jQuery);
|
@ -135,7 +135,7 @@
|
||||
'formatH5': 'Change current block\'s format as H5',
|
||||
'formatH6': 'Change current block\'s format as H6',
|
||||
'insertHorizontalRule': 'Insert horizontal rule',
|
||||
'linkDialog.show': 'Show Link Dialog',
|
||||
'linkDiaLog.Log.show': 'Show Link Dialog',
|
||||
},
|
||||
history: {
|
||||
undo: 'Krok vzad',
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*! Summernote v0.8.12 | (c) 2013- Alan Hong and other contributors | MIT license */
|
||||
|
||||
!function(e){e.extend(e.summernote.lang,{"cs-CZ":{font:{bold:"Tučné",italic:"Kurzíva",underline:"Podtržené",clear:"Odstranit styl písma",height:"Výška řádku",strikethrough:"Přeškrtnuté",size:"Velikost písma"},image:{image:"Obrázek",insert:"Vložit obrázek",resizeFull:"Původní velikost",resizeHalf:"Poloviční velikost",resizeQuarter:"Čtvrteční velikost",floatLeft:"Umístit doleva",floatRight:"Umístit doprava",floatNone:"Neobtékat textem",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Přetáhnout sem obrázek",dropImage:"Drop image or Text",selectFromFiles:"Vybrat soubor",url:"URL obrázku",remove:"Remove Image",original:"Original"},video:{video:"Video",videoLink:"Odkaz videa",insert:"Vložit video",url:"URL videa?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion nebo Youku)"},link:{link:"Odkaz",insert:"Vytvořit odkaz",unlink:"Zrušit odkaz",edit:"Upravit",textToDisplay:"Zobrazovaný text",url:"Na jaké URL má tento odkaz vést?",openInNewWindow:"Otevřít v novém okně"},table:{table:"Tabulka",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Vložit vodorovnou čáru"},style:{style:"Styl",p:"Normální",blockquote:"Citace",pre:"Kód",h1:"Nadpis 1",h2:"Nadpis 2",h3:"Nadpis 3",h4:"Nadpis 4",h5:"Nadpis 5",h6:"Nadpis 6"},lists:{unordered:"Odrážkový seznam",ordered:"Číselný seznam"},options:{help:"Nápověda",fullscreen:"Celá obrazovka",codeview:"HTML kód"},paragraph:{paragraph:"Odstavec",outdent:"Zvětšit odsazení",indent:"Zmenšit odsazení",left:"Zarovnat doleva",center:"Zarovnat na střed",right:"Zarovnat doprava",justify:"Zarovnat oboustranně"},color:{recent:"Aktuální barva",more:"Další barvy",background:"Barva pozadí",foreground:"Barva písma",transparent:"Průhlednost",setTransparent:"Nastavit průhlednost",reset:"Obnovit",resetToDefault:"Obnovit výchozí",cpSelect:"Vybrat"},shortcut:{shortcuts:"Klávesové zkratky",close:"Zavřít",textFormatting:"Formátování textu",action:"Akce",paragraphFormatting:"Formátování odstavce",documentStyle:"Styl dokumentu"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Krok vzad",redo:"Krok vpřed"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
|
||||
!function(e){e.extend(e.summernote.lang,{"cs-CZ":{font:{bold:"Tučné",italic:"Kurzíva",underline:"Podtržené",clear:"Odstranit styl písma",height:"Výška řádku",strikethrough:"Přeškrtnuté",size:"Velikost písma"},image:{image:"Obrázek",insert:"Vložit obrázek",resizeFull:"Původní velikost",resizeHalf:"Poloviční velikost",resizeQuarter:"Čtvrteční velikost",floatLeft:"Umístit doleva",floatRight:"Umístit doprava",floatNone:"Neobtékat textem",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Přetáhnout sem obrázek",dropImage:"Drop image or Text",selectFromFiles:"Vybrat soubor",url:"URL obrázku",remove:"Remove Image",original:"Original"},video:{video:"Video",videoLink:"Odkaz videa",insert:"Vložit video",url:"URL videa?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion nebo Youku)"},link:{link:"Odkaz",insert:"Vytvořit odkaz",unlink:"Zrušit odkaz",edit:"Upravit",textToDisplay:"Zobrazovaný text",url:"Na jaké URL má tento odkaz vést?",openInNewWindow:"Otevřít v novém okně"},table:{table:"Tabulka",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Vložit vodorovnou čáru"},style:{style:"Styl",p:"Normální",blockquote:"Citace",pre:"Kód",h1:"Nadpis 1",h2:"Nadpis 2",h3:"Nadpis 3",h4:"Nadpis 4",h5:"Nadpis 5",h6:"Nadpis 6"},lists:{unordered:"Odrážkový seznam",ordered:"Číselný seznam"},options:{help:"Nápověda",fullscreen:"Celá obrazovka",codeview:"HTML kód"},paragraph:{paragraph:"Odstavec",outdent:"Zvětšit odsazení",indent:"Zmenšit odsazení",left:"Zarovnat doleva",center:"Zarovnat na střed",right:"Zarovnat doprava",justify:"Zarovnat oboustranně"},color:{recent:"Aktuální barva",more:"Další barvy",background:"Barva pozadí",foreground:"Barva písma",transparent:"Průhlednost",setTransparent:"Nastavit průhlednost",reset:"Obnovit",resetToDefault:"Obnovit výchozí",cpSelect:"Vybrat"},shortcut:{shortcuts:"Klávesové zkratky",close:"Zavřít",textFormatting:"Formátování textu",action:"Akce",paragraphFormatting:"Formátování odstavce",documentStyle:"Styl dokumentu"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDiaLog.Log.show":"Show Link Dialog"},history:{undo:"Krok vzad",redo:"Krok vpřed"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}})}(jQuery);
|
@ -140,7 +140,7 @@
|
||||
'formatH5': 'Change current block\'s format as H5',
|
||||
'formatH6': 'Change current block\'s format as H6',
|
||||
'insertHorizontalRule': 'Insert horizontal rule',
|
||||
'linkDialog.show': 'Vis Link Dialog',
|
||||
'linkDiaLog.Log.show': 'Vis Link Dialog',
|
||||
},
|
||||
history: {
|
||||
undo: 'Fortryd',
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*! Summernote v0.8.12 | (c) 2013- Alan Hong and other contributors | MIT license */
|
||||
|
||||
!function(e){e.extend(e.summernote.lang,{"da-DK":{font:{bold:"Fed",italic:"Kursiv",underline:"Understreget",clear:"Fjern formatering",height:"Højde",name:"Skrifttype",strikethrough:"Gennemstreget",subscript:"Sænket skrift",superscript:"Hævet skrift",size:"Skriftstørrelse"},image:{image:"Billede",insert:"Indsæt billede",resizeFull:"Original størrelse",resizeHalf:"Halv størrelse",resizeQuarter:"Kvart størrelse",floatLeft:"Venstrestillet",floatRight:"Højrestillet",floatNone:"Fjern formatering",shapeRounded:"Form: Runde kanter",shapeCircle:"Form: Cirkel",shapeThumbnail:"Form: Miniature",shapeNone:"Form: Ingen",dragImageHere:"Træk billede hertil",dropImage:"Slip billede",selectFromFiles:"Vælg billed-fil",maximumFileSize:"Maks fil størrelse",maximumFileSizeError:"Filen er større end maks tilladte fil størrelse!",url:"Billede URL",remove:"Fjern billede",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Indsæt Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)"},link:{link:"Link",insert:"Indsæt link",unlink:"Fjern link",edit:"Rediger",textToDisplay:"Visningstekst",url:"Hvor skal linket pege hen?",openInNewWindow:"Åbn i nyt vindue"},table:{table:"Tabel",addRowAbove:"Tilføj række over",addRowBelow:"Tilføj række under",addColLeft:"Tilføj venstre kolonne",addColRight:"Tilføj højre kolonne",delRow:"Slet række",delCol:"Slet kolonne",delTable:"Slet tabel"},hr:{insert:"Indsæt horisontal linje"},style:{style:"Stil",p:"p",blockquote:"Citat",pre:"Kode",h1:"Overskrift 1",h2:"Overskrift 2",h3:"Overskrift 3",h4:"Overskrift 4",h5:"Overskrift 5",h6:"Overskrift 6"},lists:{unordered:"Punktopstillet liste",ordered:"Nummereret liste"},options:{help:"Hjælp",fullscreen:"Fuld skærm",codeview:"HTML-Visning"},paragraph:{paragraph:"Afsnit",outdent:"Formindsk indryk",indent:"Forøg indryk",left:"Venstrestillet",center:"Centreret",right:"Højrestillet",justify:"Blokjuster"},color:{recent:"Nyligt valgt farve",more:"Flere farver",background:"Baggrund",foreground:"Forgrund",transparent:"Transparent",setTransparent:"Sæt transparent",reset:"Nulstil",resetToDefault:"Gendan standardindstillinger"},shortcut:{shortcuts:"Genveje",close:"Luk",textFormatting:"Tekstformatering",action:"Handling",paragraphFormatting:"Afsnitsformatering",documentStyle:"Dokumentstil",extraKeys:"Extra keys"},help:{insertParagraph:"Indsæt paragraf",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Vis Link Dialog"},history:{undo:"Fortryd",redo:"Annuller fortryd"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Vælg special karakterer"}}})}(jQuery);
|
||||
!function(e){e.extend(e.summernote.lang,{"da-DK":{font:{bold:"Fed",italic:"Kursiv",underline:"Understreget",clear:"Fjern formatering",height:"Højde",name:"Skrifttype",strikethrough:"Gennemstreget",subscript:"Sænket skrift",superscript:"Hævet skrift",size:"Skriftstørrelse"},image:{image:"Billede",insert:"Indsæt billede",resizeFull:"Original størrelse",resizeHalf:"Halv størrelse",resizeQuarter:"Kvart størrelse",floatLeft:"Venstrestillet",floatRight:"Højrestillet",floatNone:"Fjern formatering",shapeRounded:"Form: Runde kanter",shapeCircle:"Form: Cirkel",shapeThumbnail:"Form: Miniature",shapeNone:"Form: Ingen",dragImageHere:"Træk billede hertil",dropImage:"Slip billede",selectFromFiles:"Vælg billed-fil",maximumFileSize:"Maks fil størrelse",maximumFileSizeError:"Filen er større end maks tilladte fil størrelse!",url:"Billede URL",remove:"Fjern billede",original:"Original"},video:{video:"Video",videoLink:"Video Link",insert:"Indsæt Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)"},link:{link:"Link",insert:"Indsæt link",unlink:"Fjern link",edit:"Rediger",textToDisplay:"Visningstekst",url:"Hvor skal linket pege hen?",openInNewWindow:"Åbn i nyt vindue"},table:{table:"Tabel",addRowAbove:"Tilføj række over",addRowBelow:"Tilføj række under",addColLeft:"Tilføj venstre kolonne",addColRight:"Tilføj højre kolonne",delRow:"Slet række",delCol:"Slet kolonne",delTable:"Slet tabel"},hr:{insert:"Indsæt horisontal linje"},style:{style:"Stil",p:"p",blockquote:"Citat",pre:"Kode",h1:"Overskrift 1",h2:"Overskrift 2",h3:"Overskrift 3",h4:"Overskrift 4",h5:"Overskrift 5",h6:"Overskrift 6"},lists:{unordered:"Punktopstillet liste",ordered:"Nummereret liste"},options:{help:"Hjælp",fullscreen:"Fuld skærm",codeview:"HTML-Visning"},paragraph:{paragraph:"Afsnit",outdent:"Formindsk indryk",indent:"Forøg indryk",left:"Venstrestillet",center:"Centreret",right:"Højrestillet",justify:"Blokjuster"},color:{recent:"Nyligt valgt farve",more:"Flere farver",background:"Baggrund",foreground:"Forgrund",transparent:"Transparent",setTransparent:"Sæt transparent",reset:"Nulstil",resetToDefault:"Gendan standardindstillinger"},shortcut:{shortcuts:"Genveje",close:"Luk",textFormatting:"Tekstformatering",action:"Handling",paragraphFormatting:"Afsnitsformatering",documentStyle:"Dokumentstil",extraKeys:"Extra keys"},help:{insertParagraph:"Indsæt paragraf",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDiaLog.Log.show":"Vis Link Dialog"},history:{undo:"Fortryd",redo:"Annuller fortryd"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Vælg special karakterer"}}})}(jQuery);
|
@ -141,7 +141,7 @@
|
||||
'formatH5': 'Formatiert aktuellen Block als H5',
|
||||
'formatH6': 'Formatiert aktuellen Block als H6',
|
||||
'insertHorizontalRule': 'Fügt eine horizontale Linie ein',
|
||||
'linkDialog.show': 'Zeigt Linkdialog',
|
||||
'linkDiaLog.Log.show': 'Zeigt Linkdialog',
|
||||
},
|
||||
history: {
|
||||
undo: 'Rückgängig',
|
||||
|
@ -1,3 +1,3 @@
|
||||
/*! Summernote v0.8.12 | (c) 2013- Alan Hong and other contributors | MIT license */
|
||||
|
||||
!function(e){e.extend(e.summernote.lang,{"de-DE":{font:{bold:"Fett",italic:"Kursiv",underline:"Unterstreichen",clear:"Zurücksetzen",height:"Zeilenhöhe",name:"Schriftart",strikethrough:"Durchgestrichen",subscript:"Tiefgestellt",superscript:"Hochgestellt",size:"Schriftgröße"},image:{image:"Bild",insert:"Bild einfügen",resizeFull:"Originalgröße",resizeHalf:"1/2 Größe",resizeQuarter:"1/4 Größe",floatLeft:"Linksbündig",floatRight:"Rechtsbündig",floatNone:"Kein Textfluss",shapeRounded:"Abgerundeter Rahmen",shapeCircle:"Kreisförmiger Rahmen",shapeThumbnail:"Rahmenvorschau",shapeNone:"Kein Rahmen",dragImageHere:"Bild hierher ziehen",dropImage:"Bild oder Text nehmen",selectFromFiles:"Datei auswählen",maximumFileSize:"Maximale Dateigröße",maximumFileSizeError:"Maximale Dateigröße überschritten",url:"Bild URL",remove:"Bild entfernen",original:"Original"},video:{video:"Video",videoLink:"Videolink",insert:"Video einfügen",url:"Video URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion oder Youku)"},link:{link:"Link",insert:"Link einfügen",unlink:"Link entfernen",edit:"Bearbeiten",textToDisplay:"Anzeigetext",url:"Link URL",openInNewWindow:"In neuem Fenster öffnen"},table:{table:"Tabelle",addRowAbove:"+ Zeile oberhalb",addRowBelow:"+ Zeile unterhalb",addColLeft:"+ Spalte links",addColRight:"+ Spalte rechts",delRow:"Reihe löschen",delCol:"Spalte löschen",delTable:"Tabelle löschen"},hr:{insert:"Horizontale Linie einfügen"},style:{style:"Stil",normal:"Normal",p:"Normal",blockquote:"Zitat",pre:"Quellcode",h1:"Überschrift 1",h2:"Überschrift 2",h3:"Überschrift 3",h4:"Überschrift 4",h5:"Überschrift 5",h6:"Überschrift 6"},lists:{unordered:"Unnummerierte Liste",ordered:"Nummerierte Liste"},options:{help:"Hilfe",fullscreen:"Vollbild",codeview:"Quellcode anzeigen"},paragraph:{paragraph:"Absatz",outdent:"Einzug verkleinern",indent:"Einzug vergrößern",left:"Links ausrichten",center:"Zentriert ausrichten",right:"Rechts ausrichten",justify:"Blocksatz"},color:{recent:"Letzte Farbe",more:"Weitere Farben",background:"Hintergrundfarbe",foreground:"Schriftfarbe",transparent:"Transparenz",setTransparent:"Transparenz setzen",reset:"Zurücksetzen",resetToDefault:"Auf Standard zurücksetzen"},shortcut:{shortcuts:"Tastenkürzel",close:"Schließen",textFormatting:"Textformatierung",action:"Aktion",paragraphFormatting:"Absatzformatierung",documentStyle:"Dokumentenstil",extraKeys:"Weitere Tasten"},help:{insertParagraph:"Absatz einfügen",undo:"Letzte Anweisung rückgängig",redo:"Letzte Anweisung wiederholen",tab:"Einzug hinzufügen",untab:"Einzug entfernen",bold:"Schrift Fett",italic:"Schrift Kursiv",underline:"Unterstreichen",strikethrough:"Durchstreichen",removeFormat:"Entfernt Format",justifyLeft:"Linksbündig",justifyCenter:"Mittig",justifyRight:"Rechtsbündig",justifyFull:"Blocksatz",insertUnorderedList:"Unnummerierte Liste",insertOrderedList:"Nummerierte Liste",outdent:"Aktuellen Absatz ausrücken",indent:"Aktuellen Absatz einrücken",formatPara:"Formatiert aktuellen Block als Absatz (P-Tag)",formatH1:"Formatiert aktuellen Block als H1",formatH2:"Formatiert aktuellen Block als H2",formatH3:"Formatiert aktuellen Block als H3",formatH4:"Formatiert aktuellen Block als H4",formatH5:"Formatiert aktuellen Block als H5",formatH6:"Formatiert aktuellen Block als H6",insertHorizontalRule:"Fügt eine horizontale Linie ein","linkDialog.show":"Zeigt Linkdialog"},history:{undo:"Rückgängig",redo:"Wiederholen"},specialChar:{specialChar:"Sonderzeichen",select:"Zeichen auswählen"}}})}(jQuery);
|
||||
!function(e){e.extend(e.summernote.lang,{"de-DE":{font:{bold:"Fett",italic:"Kursiv",underline:"Unterstreichen",clear:"Zurücksetzen",height:"Zeilenhöhe",name:"Schriftart",strikethrough:"Durchgestrichen",subscript:"Tiefgestellt",superscript:"Hochgestellt",size:"Schriftgröße"},image:{image:"Bild",insert:"Bild einfügen",resizeFull:"Originalgröße",resizeHalf:"1/2 Größe",resizeQuarter:"1/4 Größe",floatLeft:"Linksbündig",floatRight:"Rechtsbündig",floatNone:"Kein Textfluss",shapeRounded:"Abgerundeter Rahmen",shapeCircle:"Kreisförmiger Rahmen",shapeThumbnail:"Rahmenvorschau",shapeNone:"Kein Rahmen",dragImageHere:"Bild hierher ziehen",dropImage:"Bild oder Text nehmen",selectFromFiles:"Datei auswählen",maximumFileSize:"Maximale Dateigröße",maximumFileSizeError:"Maximale Dateigröße überschritten",url:"Bild URL",remove:"Bild entfernen",original:"Original"},video:{video:"Video",videoLink:"Videolink",insert:"Video einfügen",url:"Video URL",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion oder Youku)"},link:{link:"Link",insert:"Link einfügen",unlink:"Link entfernen",edit:"Bearbeiten",textToDisplay:"Anzeigetext",url:"Link URL",openInNewWindow:"In neuem Fenster öffnen"},table:{table:"Tabelle",addRowAbove:"+ Zeile oberhalb",addRowBelow:"+ Zeile unterhalb",addColLeft:"+ Spalte links",addColRight:"+ Spalte rechts",delRow:"Reihe löschen",delCol:"Spalte löschen",delTable:"Tabelle löschen"},hr:{insert:"Horizontale Linie einfügen"},style:{style:"Stil",normal:"Normal",p:"Normal",blockquote:"Zitat",pre:"Quellcode",h1:"Überschrift 1",h2:"Überschrift 2",h3:"Überschrift 3",h4:"Überschrift 4",h5:"Überschrift 5",h6:"Überschrift 6"},lists:{unordered:"Unnummerierte Liste",ordered:"Nummerierte Liste"},options:{help:"Hilfe",fullscreen:"Vollbild",codeview:"Quellcode anzeigen"},paragraph:{paragraph:"Absatz",outdent:"Einzug verkleinern",indent:"Einzug vergrößern",left:"Links ausrichten",center:"Zentriert ausrichten",right:"Rechts ausrichten",justify:"Blocksatz"},color:{recent:"Letzte Farbe",more:"Weitere Farben",background:"Hintergrundfarbe",foreground:"Schriftfarbe",transparent:"Transparenz",setTransparent:"Transparenz setzen",reset:"Zurücksetzen",resetToDefault:"Auf Standard zurücksetzen"},shortcut:{shortcuts:"Tastenkürzel",close:"Schließen",textFormatting:"Textformatierung",action:"Aktion",paragraphFormatting:"Absatzformatierung",documentStyle:"Dokumentenstil",extraKeys:"Weitere Tasten"},help:{insertParagraph:"Absatz einfügen",undo:"Letzte Anweisung rückgängig",redo:"Letzte Anweisung wiederholen",tab:"Einzug hinzufügen",untab:"Einzug entfernen",bold:"Schrift Fett",italic:"Schrift Kursiv",underline:"Unterstreichen",strikethrough:"Durchstreichen",removeFormat:"Entfernt Format",justifyLeft:"Linksbündig",justifyCenter:"Mittig",justifyRight:"Rechtsbündig",justifyFull:"Blocksatz",insertUnorderedList:"Unnummerierte Liste",insertOrderedList:"Nummerierte Liste",outdent:"Aktuellen Absatz ausrücken",indent:"Aktuellen Absatz einrücken",formatPara:"Formatiert aktuellen Block als Absatz (P-Tag)",formatH1:"Formatiert aktuellen Block als H1",formatH2:"Formatiert aktuellen Block als H2",formatH3:"Formatiert aktuellen Block als H3",formatH4:"Formatiert aktuellen Block als H4",formatH5:"Formatiert aktuellen Block als H5",formatH6:"Formatiert aktuellen Block als H6",insertHorizontalRule:"Fügt eine horizontale Linie ein","linkDiaLog.Log.show":"Zeigt Linkdialog"},history:{undo:"Rückgängig",redo:"Wiederholen"},specialChar:{specialChar:"Sonderzeichen",select:"Zeichen auswählen"}}})}(jQuery);
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user