Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entrega mais recente do grupo 2 #341

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Grails Metadata file
#Thu Jun 06 10:16:12 GMT-03:00 2013
#Wed Nov 12 18:55:23 GMT-03:00 2014
app.grails.version=2.1.0
app.name=rgms
app.servlet.version=2.5
Expand Down
Binary file added chromedrivers/chromedriver.exe
Binary file not shown.
1 change: 1 addition & 0 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ grails.project.dependency.resolution = {
compile('lib:itext-pdfa:5.4.0')
compile('lib:itext-xtra:5.4.0')
compile('lib:twitter4j-core:4.0.1')
compile('commons-codec:commons-codec:1.6')

compile(group: 'org.apache.poi', name: 'poi', version: '3.7') {
excludes 'xmlbeans'
Expand Down
4 changes: 2 additions & 2 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ grails {
port = 465
//TODO: Before running, make sure that your email login and password appear below
//TODO: Before committing, make sure that the strings "LOGIN" and "PASSWORD" appear in place of your login and password
username = "LOGIN"
password = "PASSWORD"
username = "rgmsTest"
password = "rgmsTest202"
props = ["mail.smtp.auth": "true",
"mail.smtp.socketFactory.port": "465",
"mail.smtp.socketFactory.class": "javax.net.ssl.SSLSocketFactory",
Expand Down
11 changes: 6 additions & 5 deletions grails-app/controllers/rgms/member/MemberController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class MemberController {

def memberInstance = new Member(params)
def userInstance = new User(params)

def password = ""

if (!userInstance.passwordHash) {
Expand All @@ -63,12 +62,13 @@ class MemberController {
userInstance.passwordHash = new Sha256Hash(password).toHex()
}
userInstance.passwordChangeRequiredOnNextLogon = true

if (!memberInstance.save(flush: true)) {
memberInstance.errors.each {
println it
}
render(view: "create", model: [userMemberInstanceList: [memberInstance: memberInstance, userInstance: userInstance]])
return
}

userInstance.author = memberInstance;
if (!userInstance.save(flush: true)) {
userInstance.errors.each {
Expand All @@ -84,10 +84,11 @@ class MemberController {
def title = message(code: 'mail.title.create.account')
def content = message(code: 'mail.body.create.account', args: [memberInstance.name, params.username, password, createLink(absolute: true, uri: '/')])

//Not Working
EmailService emailService = new EmailService();
emailService.sendEmail(email, mailSender, title, content)
//emailService.sendEmail(email, mailSender, title, content)

flash.message = message(code: 'default.created.message', args: [message(code: 'member.label', default: 'Member'), memberInstance.id])
//flash.message = message(code: 'default.created.message', args: [message(code: 'member.label', default: 'Member'), memberInstance.id])
redirect(action: "show", id: memberInstance.id)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class TeseController extends ThesisOrDissertationController {
}

def save() {
saveThesisOrDissertation("Tese", params)
String file = params['file']
def format = file.substring(file.indexOf('.')+1,file.size())
if(format == 'doc' || format == 'pdf') {
saveThesisOrDissertation("Tese", params)
}
}

def show() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ class ThesisOrDissertationController {

def saveThesisOrDissertation(String thesisOrDissertation, params) {
//noinspection GroovyAssignabilityCheck
def instance = getClassByName(thesisOrDissertation).newInstance(params)
PublicationController pb = new PublicationController()
def instance = null
if(thesisOrDissertation == 'Tese')
instance = new Tese(params)
else
instance = new Dissertacao(params)
def duplicated
if (thesisOrDissertation == "Tese") {
//noinspection GroovyAssignabilityCheck
Expand All @@ -50,7 +53,10 @@ class ThesisOrDissertationController {
render(view: "create", model: [instance: instance])
return
}
if (!pb.upload(instance as Publication) || !instance.save(flush: true)) {
if (!instance.save(flush: true)) {
instance.errors.each {
println it
}
render(view: "create", model: [instance: instance])
return
}
Expand Down
2 changes: 1 addition & 1 deletion grails-app/domain/rgms/authentication/User.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class User {
static hasMany = [roles: Role, permissions: String, ]

static constraints = {
username(unique:true,nullable: false, blank: false,size: 5..20)
username(unique:true,nullable: false, blank: false,size: 3..20)
enabled(blank: false)
author(unique: true, blank:false, nullable: false)
}
Expand Down
2 changes: 1 addition & 1 deletion grails-app/domain/rgms/member/Member.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Member {
status(nullable: false, inList: ["Graduate Student", "MSc Student", "PhD Student", "Professor", "Researcher"])
university(blank:false)
phone(nullable: true)
website(nullable:true, url:true)
website(nullable:true)
city(nullable: true)
country(nullable: true)
active(nullable: true)
Expand Down
79 changes: 79 additions & 0 deletions grails-app/views/pdf/_demo2.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Simple PDF demo2</title>
<style>
.sample_table {
width:60%;
background-color:#b2b2b2;
}
.sample_table th {
text-align:center;
text-decoration:underline;
}
.sample_table td {
padding:7px;
background-color: #fff;
}
.small_text {
font-size:8pt;
}
</style>
</head>
<body>
<h1>Sample PDF Output</h1>
<h2>This is simple HTML</h2>
<h2 style='color:red'>this has inline CSS</h2>

<h3>Here is some data passed from the contorller...</h3>
<p>Information gathered from the controller: ${randomString}</p>

<h3>Here is some information sent in the URL and handled by a controller (get variables):</h3>
<table class="sample_table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>${id}</td>
<td>${name}</td>
<td>${age}</td>
</tr>
<tr>
<td colspan="3" class="small_text">styled with css...</td>
</tr>
</tbody>
</table>
<img src="<g:resource dir='images' file='laptop.jpg' />" alt="laptop" title="laptop" />

<form>
<p>checkbox:
%{-- checkboxes used to cause an error in pdf generation, but now they simply don't show up... --}%
<input type="checkbox" checked="checked" name="sample_box" title="sample_box" />
</p>
%{-- text field sample --}%
<p>Text Input:
<input name="textField" />
</p>
</form>

<h3>Here is some information gathered from a form and handled grails render method (post variables):</h3>
<p>Favorite food: ${pdf?.food}</p>
<p>Favorite food: ${pdf?.food.toString()}</p>
<p>Hometown: ${pdf?.hometown}</p>

<p>${pdf}</p>

<p>Images with relative URL's are automatically resolved by the the modified version of XHTMLrenderer included with the plugin</p>
<img src="<g:resource dir='images' file='laptop.jpg' />" alt="laptop" title="laptop" />

<p>Images with absolute URI's also do just fine:</p>
<img src="http://system76.com/images/nb1_front_med.jpg" alt="laptop2" title="laptop2" />

<p><strong>Hint:</strong> One way to style gsp's that you intend to make into pdf's is to have two seperate style sheets one for media="print" and one for media="screen". The print style sheet will be used to style the PDF, and if PDF generation fails you will get a styled HTML view that isn't all weird because of fonts sized in pt and such.</p>
</body>
</html>
Loading