Parent: [r13] (diff)

Child: [r22] (diff)

Download this file

home.java    129 lines (105 with data), 3.9 kB

  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
118
119
120
121
122
123
124
125
126
/**
* SPDXVersion: SPDX-1.1
* Creator: Person: Nuno Brito (nuno.brito@triplecheck.de)
* Creator: Organization: TripleCheck (http://triplecheck.de)
* Created: 2014-01-16T00:00:00Z
* LicenseName: NOASSERTION
* FileName: frontPage.java
* FileType: SOURCE
* FileCopyrightText: <text> Copyright (c) 2014 Nuno Brito, TripleCheck </text>
* FileComment: <text> Defines the front page when the program starts </text>
*/
package basic;
import definitions.Messages;
import definitions.is;
import main.controller;
import script.Plugin;
import script.log;
import utils.html;
import www.RequestOrigin;
import www.Table;
import www.WebRequest;
/**
*
* @author Nuno Brito, 21st of December 2013 in Darsmtadt, Germany
*/
public class home extends Plugin{
@Override
public void startup(){
// add our node to the tree right after the "Tools" node is added
log.hooks.addAction(Messages.CallFrontScreen, thisFile, "doScreen");
}
void doScreen(){
WebRequest request = new WebRequest();
// signal that this request is coming from the user interface
request.requestOrigin = RequestOrigin.GUI;
request.BaseFolder = thisFile.getParentFile();
request.scriptFile = thisFile;
request.scriptMethod = is.methodDefault;
// submit the request to be executed
controller.process(request);
}
/**
* A wrapper for the doScreen method when requested from the web
* @param request the request for this method
*/
@Override
public void main(WebRequest request){
String navigationMain = ""
+ html.div()
+ html.link("Create new SPDX", "/spdx/create")
+ html.br
+ html.link("View SPDX files", "/spdx/show")
+ html._div
+ "";
String navigationSub = ""
// + html.h2("Actions")
+ html.br
//+ html.br
+ html.div()
+ "Other actions: "
+ html.link("Log", "/basic/ToolsLog.java?x=showPage")
+ html.divider
+ html.link("Status", "/basic/status")
+ html.divider
+ html.link("Server", "/webserver/server")
+ html.divider
+ html.link("Feedback", "http://triplecheck.de/forum")
+ html._div
// + html.br
// + html.br
// + html.br
+ "";
// get twitter new if available
String timeLine = www.twitter.getTimeLine("@triplechecked");
String newsLine =
"Share your open source news "
+ html.link("@triplechecked", "http://twitter.com/triplechecked")
+ timeLine;
// did we got anything from the web?
if(timeLine == null){
// nothing, just return without further action
newsLine = "Interested in licensing compliance? Follow us "
+ html.link("@triplechecked", "http://twitter.com/triplechecked")
;
//return;
}
String[] params = new String[]{
html.getIcon("logo.png", request)
, navigationMain
};
int[] size = new int[]{40, 200};
String result = ""
+ html.div()
+ html.br
+ Table.alignedTable(params, size)
//+ navigation
+ navigationSub
+ html.br
+ html.br
+ newsLine
+ html._div
;
request.setAnswer(result);
}
}