summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/models/Links.java
blob: 07db94a5f0c1eb2dbdf8e9138a1eb05ff087e1c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package models;

import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;

public class Links {

	private static String FAQ = "http://bwlehrpool.hs-offenburg.de/";
	private static String OTRS = "https://bwlehrpool-otrs.rz.hs-offenburg.de//otrs/customer.pl";
	private static String uriWindows = "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0";
	private static String uriLinux = "https://my.vmware.com/de/web/vmware/free#desktop_end_user_computing/vmware_player/6_0";

	public static String getFAQ() {
		return FAQ;
	}

	public static String getOTRS() {
		return OTRS;
	}

	public static void openFAQ() {

		String faq = FAQ;
		Runtime rt = Runtime.getRuntime();
		String os = System.getProperty("os.name");

		try {

			if (os.indexOf("Win") >= 0) {

				// this doesn't support showing urls in the form of
				// "page.html#nameLink"
				rt.exec("rundll32 url.dll,FileProtocolHandler " + faq);

			} else if (os.indexOf("Mac") >= 0) {

				rt.exec("open " + faq);

			} else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {

				// Do a best guess on unix until we get a platform independent
				// way
				// Build a list of browsers to try, in this order.
				String[] browsers = { "epiphany", "firefox", "mozilla",
						"konqueror", "netscape", "opera", "links", "lynx" };

				// Build a command string which looks like
				// "browser1 "url" || browser2 "url" ||..."
				StringBuffer cmd = new StringBuffer();
				for (int i = 0; i < browsers.length; i++)
					cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \""
							+ faq + "\" ");

				rt.exec(new String[] { "sh", "-c", cmd.toString() });
			}

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public static void openOTRS() {

		String otrs = OTRS;
		Runtime rt = Runtime.getRuntime();
		String os = System.getProperty("os.name");

		try {

			if (os.indexOf("Win") >= 0) {

				// this doesn't support showing urls in the form of
				// "page.html#nameLink"
				rt.exec("rundll32 url.dll,FileProtocolHandler " + otrs);

			} else if (os.indexOf("Mac") >= 0) {

				rt.exec("open " + otrs);

			} else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {

				// Do a best guess on unix until we get a platform independent
				// way
				// Build a list of browsers to try, in this order.
				String[] browsers = { "epiphany", "firefox", "mozilla",
						"konqueror", "netscape", "opera", "links", "lynx" };

				// Build a command string which looks like
				// "browser1 "url" || browser2 "url" ||..."
				StringBuffer cmd = new StringBuffer();
				for (int i = 0; i < browsers.length; i++)
					cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \""
							+ otrs + "\" ");

				rt.exec(new String[] { "sh", "-c", cmd.toString() });
			}

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public static String getUriWindows() {
		return uriWindows;
	}

	public static String getUriLinux() {
		return uriLinux;
	}

}