how to replace coding in gsp? - grails

how to replace the coding in the finePrint?
that large textArea i call "finePrint"...
this is my problem...i am confusing..
when i filled with HMTL's coding..with ${name} on gsp..
like this..
look the arrow...thats have a button submit at below finePrint..when i click that...
the g:textField of "Your Name" thats i fill with "Bobby"..it will be replace in the finePrint with ${name}..
this ini my gsp coding where i fill it to finePrint..
<table align="center" >
<tbody>
<tr style="border-spacing:0!important;border-collapse:collapse!important;color:#666666;background-color:#F8F8F8" align="center">
<td style="padding:35px 75px 60px 75px;background-color:#fafafa;">
<table style="border-spacing:0!important;border-collapse:collapse!important;color:#666666;" width="80%">
<tbody>
<tr>
<td>
<p align="center"><img alt="Tempo AI" border="0"/></p>
<h1 style="font-family:Arial,Helvetica,sans-serif;color:#ee710b;font-size:30px;font-weight:normal;width:450px">${name}, you requested to reset your Password</h1>
<p style="padding:0;margin:0 0 15px 0;">To reset your password, just click the link below.</p>
<p style="padding:0;margin:0 0 15px 0;">Reset Password</p>
<p style="padding:0;margin:0;">Best,</p>
<p style="padding:0;margin:0;color:#bcbcbc;font-size:20px;">Tempo Team</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-family:Arial, Helvetica, sans-serif;padding-top:15px;" align="center" >
<td style="font-family:Arial, Helvetica, sans-serif;padding-top:15px;" align="center">
<p style="margin-top:0;margin-bottom:10px;">
<a href="http://www.facebook.com" style="text-decoration:none;">
<img alt="Facebook" border="0"/>
</a>
<a href="http://www.twitter.com" style="text-decoration:none;">
<img alt="Twitter" border="0"/>
</a>
<a href="http://www.plus.google.com" style="text-decoration:none;">
<img alt="Google+" border="0"/>
</a>
<a href="http://www.mail.yahoo.com" style="text-decoration:none;">
<img alt="Email" border="0"/>
</a>
</p>
<p style="margin-top:0;margin-bottom:8px;font-size:12px;font-weight:bold;">
<a style="color:#666666;text-decoration:none;">
ABOUT
</a>
<a style="color:#666666;text-decoration:none;">
PRIVACY
</a>
<a style="color:#666666;text-decoration:none;">
TERM OF USE
</a>
</p>
<p style="padding:0;margin:0;font-size:10px;color:#999999;font-weight:bold;">
If you would like to change your email notification settings
<a style="color:#44b1d9;" href="www.w3school.com">click here</a>
</p>
<p style="padding:0;margin:0;font-size:10px;color:#999999;font-weight:bold;">
© 2012 Tempo
</p>
</td>
</tr>
</tbody>
</table>
and this is my SMTP coding when i click submit..it will send email to abc#yahoo.com
def send = {
sendMail {
multipart true
to params.email
from "s_yoshitsune#yahoo.com"
subject "Test Reset Password"
html params.finePrint
}
render params.finePrint
}
and the result when i received email..
i want the ${name} replaced by my name(Bobby) where i fill before
this is coding for submit email address..
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main"/>
<g:javascript src='jquery-1.6.2.min.js'/>
<g:javascript src='jquery.cleditor.min.js'/>
<g:javascript src='test.js'/> <%-- cara import file JavaScript/ JS --%>
<link rel="stylesheet" href="${resource(dir: 'css', file: 'cleditor/jquery.cleditor.css')}" type="text/css"> <%-- cara import file CSS --%>
<title>Reset Password</title>
</head>
<body>
<g:form action="send">
<table style="width:500px">
<tbody>
<tr>
<td>Your Email Address </td>
<%-- <td><input style="width:250px" name="email" /></td>--%>
<td><g:textField style="width:250px" name = "email"/></td>
</tr>
<tr>
<td>Your Name</td>
<td><g:textField style="width:250px" name = "user"/></td>
</tr>
<tr>
<td colspan="4">
<g:textArea name="finePrint"/>
</td>
</tr>
<tr>
<td><input type="submit"/></td>
</tr>
</tbody>
</table>
</g:form>
<div id="finePrintBlank" style="display:none;" title="${message(code: 'campaign.finePrint.label')}">
<p>${message(code: 'default.blank.message', args: [message(code: 'campaign.finePrint.label')])}</p>
</div>
</body>
</html>

In the gsp page, you can prepopulate finePrint with your html code like this,
<g:textArea name="finePrint">
<table align="center" >
<tbody>
...etc...
${name}, you requested to reset your password.
...rest of the data...
</tbody>
</table>
<g:textArea>
That will be processed on the server side and you should have your the name resolved before it reached the client.

...etc...
${domainInstance.name}, you requested to reset your password.
...rest of the data...

Related

Not able to show committers list in Jenkins Jelly email template

We have recently migrated our jenkins to 1.6 version and I have findbug project set. While showing findbug results in email using below jelly template, "Find Bugs warnings info" section shows error message as "Find Bugs Publisher did not get invoked due to an error". But I do not see any error in console.
Also, "New Warnings" section is not showing up. It looks that fb variable is null and no results are showing up in email template.
Even the change sets section is not visible.
Is there any setting missing for findbug in Jenkins required to show up these results.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<html>
<head>
<title>${project.name}</title>
<style>
body table, td, th, p, h1, h2 {
margin:0;
font:normal normal
90% Georgia, Serif;
background-color: #ffffff;
}
h1, h2 {
border-bottom:dotted 1px #999999;
padding:5px;
margin-top:10px;
margin-bottom:10px;
color: #000000;
font: normal bold 90%
Georgia,Serif;
background-color:#f0f0f0;
}
</style>
</head>
<body>
<div class="header">
<j:set var="spc" value="&nbsp;&nbsp;" />
<h1>
<j:choose>
<j:when test="${build.result=='SUCCESS'}">
<img src="${rooturl}static/e59dfe28/images/32x32/blue.gif" />
</j:when>
<j:when test="${build.result=='FAILURE'}">
<img src="${rooturl}static/e59dfe28/images/32x32/red.gif" />
</j:when>
<j:otherwise>
<img
src="${rooturl}static/e59dfe28/images/32x32/yellow.gif" />
</j:otherwise>
</j:choose>
BUILD ${build.result}
</h1>
<table>
<tr>
<td>Build URL</td>
<td>
${rooturl}${build.url}
</td>
</tr>
<tr>
<td>Project:</td>
<td>${project.name}</td>
</tr>
<tr>
<td>Date of build:</td>
<td>${it.timestampString}</td>
</tr>
<tr>
<td>Build duration:</td>
<td>${build.durationString}</td>
</tr>
<tr>
<td>Build cause:</td>
<td>
<j:forEach var="cause" items="${build.causes}">${cause.shortDescription}
</j:forEach>
</td>
</tr>
<tr>
<td>Build description:</td>
<td>${build.description}</td>
</tr>
<tr>
<td>Built on:</td>
<td>
<j:choose>
<j:when test="${build.builtOnStr!=''}">${build.builtOnStr}
</j:when>
<j:otherwise>master</j:otherwise>
</j:choose>
</td>
</tr>
</table>
</div>
<!-- Static Analysis -->
<j:set var="actions" value="${it.staticAnalysisActions}" />
<j:if test="${!actions.isEmpty()}">
<div class="content">
<h1>Static Analysis Results</h1>
<table>
<tr>
<th></th>
<th>Name</th>
<th>Result</th>
<th>Total</th>
<th>High</th>
<th>Normal</th>
<th>Low</th>
</tr>
<j:forEach var="action" items="${actions}">
<tr>
<td>
<img src="${rooturl}${action.smallImageName}" />
</td>
<td>
<a href="${rooturl}${build.url}/${action.urlName}">${action.displayName}
</a>
</td>
<td class="center">
<j:choose>
<j:when test="${action.result.pluginResult=='SUCCESS'}">
<img src="${rooturl}static/e59dfe28/images/16x16/blue.gif" />
</j:when>
<j:when test="${action.result.pluginResult=='FAILURE'}">
<img src="${rooturl}static/e59dfe28/images/16x16/red.gif" />
</j:when>
<j:otherwise>
<img src="${rooturl}static/e59dfe28/images/16x16/yellow.gif" />
</j:otherwise>
</j:choose>
</td>
<td class="center">${action.result.numberOfAnnotations}
</td>
<td class="center">${action.result.getNumberOfAnnotations('HIGH')}
</td>
<td class="center">${action.result.getNumberOfAnnotations('NORMAL')}
</td>
<td class="center">${action.result.getNumberOfAnnotations('LOW')}
</td>
</tr>
</j:forEach>
</table>
</div>
</j:if>
<!-- More Find bugs info-->
<j:set var="fb" value="${it.getAction('hudson.plugins.findbugs.FindBugsResultAction')}" />
<div class="content">
<h1>Find Bugs warnings info</h1>
<table width="100%">
<tr>
<th>Total</th>
<th>Fixed</th>
<th>New</th>
<th >Report</th>
</tr>
<tr>
<td class="center">${fb.result.numberOfWarnings}</td>
<td class="center">${fb.result.numberOfFixedWarnings}</td>
<td class="center">${fb.result.numberOfNewWarnings}</td>
<td class="center">View Report</td>
</tr>
</table>
</div>
<j:set var="newWarnings" value="${fb.result.newWarnings}" />
<j:if test="${newWarnings!=null}">
<div class="content">
<h1>New warnings</h1>
<table width="100%" class="newWarningsborder">
<tr>
<th width="20%" class="newWarningsborder">Name</th>
<th width="5%" class="newWarningsborder">Line</th>
<th width="*" class="newWarningsborder">Message</th>
</tr>
<j:forEach var="fileAnnotation" items="${newWarnings}" varStatus="loop">
<tr>
<td width="20%" class="newWarningsborder">${fileAnnotation.shortFileName}</td>
<td width="5%" class="newWarningsborder">${fileAnnotation.primaryLineNumber}</td>
<td width="*" class="newWarningsborder">${fileAnnotation.message}</td>
</tr>
</j:forEach>
</table>
</div>
</j:if>
<!-- CHANGE SET -->
<div class="content">
<j:set var="changeSet" value="${build.changeSet}" />
<j:if test="${changeSet!=null}">
<j:set var="hadChanges" value="false" />
<a href="${rooturl}${build.url}/changes">
<h1>Changes</h1>
</a>
<j:forEach var="cs" items="${changeSet.logs}" varStatus="loop">
<j:set var="hadChanges" value="true" />
<h2>${cs.msgAnnotated}</h2>
<p>
by
<em>${cs.author}</em>
</p>
<table>
<j:forEach var="p" items="${cs.affectedFiles}">
<tr>
<td width="10%">${spc}${p.editType.name}</td>
<td>
<tt>${p.path}</tt>
</td>
</tr>
</j:forEach>
</table>
</j:forEach>
<j:if test="${!hadChanges}">
<p>No Changes</p>
</j:if>
<br />
</j:if>
</div>
<!-- ARTIFACTS -->
<j:set var="artifacts" value="${build.artifacts}" />
<j:if test="${artifacts!=null and artifacts.size()>0}">
<div class="content">
<h1>Build Artifacts</h1>
<ul>
<j:forEach var="f" items="${artifacts}">
<li>
${f}
</li>
</j:forEach>
</ul>
</div>
</j:if>
<!-- MAVEN ARTIFACTS -->
<j:set var="mbuilds" value="${build.moduleBuilds}" />
<j:if test="${mbuilds!=null}">
<div class="content">
<h1>Build Artifacts</h1>
<j:forEach var="m" items="${mbuilds}">
<h2>${m.key.displayName}</h2>
<j:forEach var="mvnbld" items="${m.value}">
<j:set var="artifacts" value="${mvnbld.artifacts}" />
<j:if test="${artifacts!=null and artifacts.size()>0}">
<ul>
<j:forEach var="f" items="${artifacts}">
<li>
${f}
</li>
</j:forEach>
</ul>
</j:if>
</j:forEach>
</j:forEach>
<br />
</div>
</j:if>
</body>
</html>

Navigation broken in Sitecore Page Editor during Edit related item

After updating Sitecore 6.3 to 6.6, the Main Navigation is broken in the Sitecore Page Editor when "Edit related item" is clicked.
It looks like this:
It even stays like this when closing the "Edit related item" frame.
Here is the text from that screen:
{"commands":[{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"","icon":"/~/icon/SoftwareV2/16x16/cubes_blue.png.aspx","isDivider":false,"tooltip":"Dieses Item im Content Editor bearbeiten.","type":"common"}],"contextItemUri":"sitecore://master/{78EBD797-ACA9-40BC-9ACE-961CD2296CDC}?lang=de-CH&ver=1","custom":{},"displayName":"Title","expandedDisplayName":null}KATA {"commands":[{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"","icon":"/~/icon/SoftwareV2/16x16/cubes_blue.png.aspx","isDivider":false,"tooltip":"Dieses Item im Content Editor bearbeiten.","type":"common"}],"contextItemUri":"sitecore://master/{F195AD36-86EE-4C13-883B-761E300C23AF}?lang=de-CH&ver=1","custom":{},"displayName":"Title","expandedDisplayName":null}REA {"commands":[{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"","icon":"/~/icon/SoftwareV2/16x16/cubes_blue.png.aspx","isDivider":false,"tooltip":"Dieses Item im Content Editor bearbeiten.","type":"common"}],"contextItemUri":"sitecore://master/{63438A98-FC6F-461D-89BB-7497B12FBAEF}?lang=de-CH&ver=1","custom":{},"displayName":"Title","expandedDisplayName":null}Patientensicherheit {"commands":[{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"","icon":"/~/icon/SoftwareV2/16x16/cubes_blue.png.aspx","isDivider":false,"tooltip":"Dieses Item im Content Editor bearbeiten.","type":"common"}],"contextItemUri":"sitecore://master/{FB9B0590-E933-4141-BA2B-F82C83A3343E}?lang=de-CH&ver=1","custom":{},"displayName":"Title","expandedDisplayName":null}Prozesse {"commands":[{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"","icon":"/~/icon/SoftwareV2/16x16/cubes_blue.png.aspx","isDivider":false,"tooltip":"Dieses Item im Content Editor bearbeiten.","type":"common"}],"contextItemUri":"sitecore://master/{0F1334E0-9BB7-4657-9DC4-884F6E1133C9}?lang=de-CH&ver=1","custom":{},"displayName":"Title","expandedDisplayName":null}Dokumente {"commands":[{"click":"chrome:common:edititem({command:\"webedit:open\"})","header":"","icon":"/~/icon/SoftwareV2/16x16/cubes_blue.png.aspx","isDivider":false,"tooltip":"Dieses Item im Content Editor bearbeiten.","type":"common"}],"contextItemUri":"sitecore://master/{8D18489B-B7F3-442B-9958-7D1FDBDC9010}?lang=de-CH&ver=1","custom":{},"displayName":"Title","expandedDisplayName":null}Telefonlisten
Anyone knows what this is and how I can fix it?
Thanks in advance :)
EDIT:
Code of .ascx:
<%# Control Language="C#" AutoEventWireup="true"
CodeBehind="Header.ascx.cs" Inherits="ZGKS.Intranet.WebApp.Frontend.sublayouts.Header" %>
<%# Register Src="NavLayer.ascx" TagName="NavLayer" TagPrefix="uc1" %>
<%# Register Src="~/Frontend/sublayouts/SearchBox.ascx" TagName="SearchBox" TagPrefix="ZGKSControls" %>
<div class="head">
<div class="line">
<div class="unit sizeCol">
<!-- mod NavService -->
<div class="mod modNavService skinNavServiceHome">
<div class="inner">
<div class="bd">
<ul>
<li>Home</li>
<li><span>
<asp:Literal ID="litWelcome" runat="server"></asp:Literal>
<asp:Literal ID="litUsername" runat="server"></asp:Literal></span></li>
<li class="last"><span>
<asp:Literal ID="litDate" runat="server"></asp:Literal></span></li>
</ul>
</div>
</div>
</div>
<!-- /mod NavService -->
<!-- mod NavService -->
<div class="mod modNavService">
<div class="inner">
<!-- tpl NavService-navservice -->
<div class="bd">
<ul>
<asp:Literal ID="litNaviLinks" runat="server"></asp:Literal>
</ul>
</div>
<!-- /tpl NavService-navservice -->
</div>
</div>
<!-- /mod NavService -->
<!-- mod Favourites -->
<div class="mod modFavourites">
<div class="inner">
<!-- tpl Favourites-favourites -->
<div class="hd">
<ul>
<li>Meine Favoriten
<div class="favnavcontainer">
<div class="wrap">
<div class="list">
<table>
<tbody>
<tr>
<td>
<asp:Label ID="lblFavoritesDescription" runat="server" />
</td>
</tr>
</tbody>
</table>
<table class="highlight">
<tbody>
<asp:Repeater ID="rptFavorite" runat="server" OnItemCommand="RptFavoriteItemCommand">
<ItemTemplate>
<tr class="favoritemark">
<td>
<a href="<%# Eval("Url") %>">
<%# Eval("Title") %></a>
</td>
<td class="delete">
<span>
<asp:ImageButton ToolTip="Löschen" AlternateText="Löschen" ID="btnDeleteFav" runat="server"
CommandName="delFav" CommandArgument='<%# Eval("ID") %>' ImageUrl="~/Frontend/Images/icons/clear.png" />
</span>
</td>
<td class="edit" title="Editieren">
<span></span>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</div>
</div>
<a class="close" title="" href="#">Schliessen <span>|</span> X</a>
</div>
</li>
<li>Meine Systeme
<div class="favnavcontainer">
<div class="wrap">
<div class="list">
<table>
<tbody>
<tr>
<td>
<asp:Label ID="lblSystemDescription" runat="server" />
</td>
</tr>
</tbody>
</table>
<table class="highlight">
<tbody>
<asp:Repeater ID="rptSysteme" runat="server">
<ItemTemplate>
<tr class="">
<td>
<a target="_blank" href="<%# Eval("Url") %>">
<%# Eval("Title") %></a>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</div>
</div>
<div class="modContent" style="padding: 0;">
<div style="margin: 10px 0; margin-left: 10px;">
<a target="_self" href='<%# MySystemLink %>' class="icon back" title="Zurück">
<span>Meine Systeme bearbeiten</span>
</a>
</div>
<a class="close" title="" href="#">Schliessen <span>|</span> X</a>
</div>
</div>
</li>
<li>Meine Alerts
<div class="favnavcontainer">
<div class="wrap">
<div class="list">
<table>
<tbody>
<tr>
<td>
<asp:Label ID="lblAlertDescription" runat="server" />
</td>
</tr>
</tbody>
</table>
<table class="highlight">
<tbody>
<asp:Repeater ID="rptAlert" runat="server" OnItemCommand="RptAlertItemCommand">
<ItemTemplate>
<tr class="alertmark">
<td>
<a href="<%# Eval("Url") %>">
<%# Eval("Title") %></a>
</td>
<td class="delete">
<span>
<asp:ImageButton ToolTip="Löschen" AlternateText="Löschen" ID="btnDeleteAlert" runat="server"
CommandName="delAlert" CommandArgument='<%# Eval("ID") %>' ImageUrl="~/Frontend/Images/icons/clear.png" />
</span>
</td>
<td class="edit" title="Editieren">
<span> </span>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</div>
</div>
<a class="close" title="" href="#">Schliessen <span>|</span> X</a>
</div>
</li>
</ul>
</div>
<div class="bd">
</div>
<!-- /tpl Favourites-favourites -->
</div>
</div>
<!-- /mod Favourites -->
</div>
<div class="unit sizeCol lastUnit">
<div class="line">
<!-- mod Logo -->
<div class="mod modLogo">
<div class="inner">
<!-- tpl Logo-logo -->
<div class="bd">
<a href="/" title="">
<img class="screen" src="/Frontend/Images/logo.gif" width="291" height="27" alt="ZGKS"></a>
</div>
<!-- /tpl Logo-logo -->
</div>
</div>
</div>
<div class="line">
<ZGKSControls:SearchBox ID="SearchBox" runat="server" />
</div>
</div>
<div class="line">
<div class="unit size1of1">
<uc1:NavLayer ID="NavLayer1" runat="server" />
</div>
</div>
</div>
</div>
The issue is due to changes in the webedit.css stylesheet in Sitecore 6.6 from previous versions.
Make sure that /website/webedit.css is present in your inetpub folder, that you do not have it checked into your Visual Studio project, i.e it is not overwriting with a previous version of the file from your source control.

Rails4 template error in mailer in production

On in my production env. I keep getting this error:
ActionView::Template::Error: undefined method `protocol' for nil:NilClass
I can't figure out where this error are in my template, can anybody help me figure this out?
CODE UPDATE
Complete code: Pastebin
I cut out, the area I think might cause problem:
<tr>
<td class="eHeader" style="">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="">
<tr>
<td class="eHeader" style="">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="">
<tr>
<td class="eHeaderLogo" style="">
<a href="#" style="">
<img class="imageFix" src="<%= image_url('crewnetlogo-white.png') %>" width="200" height="48" alt="Crewnet" style="">
</a>
</td>
<!-- end .eHeaderLogo-->
<td class="eHeaderOptions" style="">
</td>
<!-- end .eHeaderOptions-->
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<h1>
<span>
Du er blevet tildelt <%= #workplace.name %>
</span>
</h1>
<div class="bannerLink">
<a href="#" style="">
<img src="<%= image_url "app.png" %>" alt="Crewnet" width="512" height="194" style="">
</a>
</div>
</td>
<!-- end .highlight-->
</tr>
<tr>
<td class="eBody bottomLine" style="">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="entryBox" style="">
<tr>
<td class="width132 pdBt16" style="">
<a href="#" style="">
<img src="<%= image_url "file_icon.gif" %>" width="116" height="116" alt="File" style="">
</a>
</td>
<td class="alignLeft" style="">
<p style="">
Hej <%= #user.name %>!<br>
Du har fået tildelt <%= #workplace.name %> som ansvarsområde. <br>
For mere info log på CrewNet | <%= #workplace.name %>.
</p>
<p style="">
Skulle du have nogle spørgsmål, kan du kontakte supporten på support#crewnet.dk.
<br>
<br>
Teamet bag CrewNet.dk
</p>
</td>
</tr>
</table>
</td>
<!-- end .eBody-->
</tr>
Mailer
class SupervisorMailer < ActionMailer::Base
default from: "support#crewnet.dk"
def assigned(user, workplace)
#user = User.find(user)
#workplace = Workplace.find(workplace)
mail to: #user.email, subject: "Du er ansvarlig for #{#workplace.name}."
end
end
production.rb
config.action_mailer.default_url_options = { :host => Rails.application.secrets.domain_name, :protocol => "http" }
config.action_mailer.asset_host = Rails.application.secrets.domain_name
env
secrets.domain_name = crewnet.dk
Probably it's realted to url building. Do you have asset_host setting in your production.rb? Maybe you have to add protocol to asset_host?
Rails.application.configure do
...
config.action_mailer.asset_host = 'http://example.com'
...
end

jQuery UI dialog - cannot insert table in dialog contents

I have a simple web page where for each row of data, I can pop up a jQuery UI dialog with the details of that row. Since there can be multiple rows in the sub-query a table is the best choice. The result is that I get an empty dialog box, and the table contained in that div (the one for the dialog) appears at the bottom of the page, whether the row is clicked to activate the dialog. Everything else works perfectly, the event for the click, the dialog popup, the passing of the right id for the div, all perfect.
But the dang table (the one inside the dialog, with the class of 'inner-table') appears at the bottom of the page, right off the bat.
The HTML is created in Groovy, with the HTMLMarkupBuilder, and the resulting HTML looks like the following:
<html>
<head>
<title>NAS Execution Groovy Servlet</title>
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery-ui-1.8.23.custom.min.js'></script>
<script type='text/javascript' src='js/jquery.dataTables.min.js'></script>
<script type='text/javascript' src='js/executions.js'></script>
<link rel='stylesheet' type='text/css' href='css/jquery.dataTables_themeroller.css'></link>
<link rel='stylesheet' type='text/css' href='css/jquery-ui.css'></link>
<link rel='stylesheet' type='text/css' href='css/nas.css'></link>
</head>
<body>
<div id='results' class='execution-results'>
<p id='rpt-header'>
<span class='rpt-header-txt'>Backup Schedule Report for </span>
<span class='rpt-header-asset'>ret2w089n1t1</span>
</p>
<table id='nas-table'>
<thead>
<tr class='table-header'>
<th class='hidden'>Backup ID</th>
<th>Schedule Name</th>
<th>Backup Product</th>
<th>Size Mb</th>
<th>Start Time</th>
<th>Duration</th>
<th>Expiration Date</th>
<th>Mon 17</th>
</tr>
</thead>
<tbody>
<tr class='row'>
<td class='hidden'>12345678</td>
<td class='row-data'>null</td>
<td class='row-data'>Product One</td>
<td id='size-mb' class='row-data'>601.31</td>
<td class='row-data'>00:09:03</td>
<td class='row-data'>158 secs</td>
<td class='row-data'>2012-10-01</td>
<td class='row-center'>
<img id='success-fail' src='img/success.gif'></img>
</td>
</tr>
<tr class='row'>
<td class='hidden'>23456789</td>
<td class='row-data'>PolicyName</td>
<td class='row-data'>Product Two</td>
<td id='size-mb' class='row-data'>995.92</td>
<td class='row-data'>20:09:00</td>
<td class='row-data'>191 secs</td>
<td class='row-data'>2012-10-01</td>
<td class='row-center'>
<img id='success-fail' src='img/success.gif'></img>
</td>
</tr>
<div id='dialog-23456789' class='details-dialog'>
<table class='inner-table'>
<thead>
<tr>
<th>JOB_TYPE_NAME</th>
<th>VENDOR_STATUS_NAME</th>
<th>KILOBYTES</th>
</tr>
</thead>
<tbody>
<tr>
<td>Incr Backup</td>
<td>Successful</td>
<td>1019821</td>
</tr>
</tbody>
</table>
</div>
</tbody>
</table>
</div>
</body>
</html>
The jQuery for this is pretty simple; it uses the id from the row clicked on, and pops up a dialog window. That works fine, but the table that is contained in that div is actually at the bottom of the screen, even before anything is clicked:
$(document).ready(function() {
$('#nas-table').dataTable( {
"bJQueryUI": true,
"aaSorting": [[4, 'asc']]
} );
$('.row').live("click", function(){
var target = $(this);
var backupId = $(this).children(":first").html();
var thisId = '#dialog-' + backupId;
$(thisId).dialog(
{
title: "Backup Job Detail",
width: 800,
height: 450
}
);
$(thisId).dialog("open");
$(thisId).dialog("widget").position({
my: 'left top',
at: 'left bottom',
of: target
});
});
} );
At first, I thought the Groovy HTMLMarkupBuilder was outputting the DOM before everything happened, but when I do a view source, copy it to a file, and open the file in my browser, I get the same result.
I would appreciate any help with this. I asked this question earlier, in case you want to complain about that, but I had to follow up some other potential issues in the Groovy code, which I resolved. This example is more complete, and represents exactly what my code will do.
Brian
The problem is that you have a div nested within a table outside of a TR and TD, which will cause the rendering and DOM to be a bit wrong. If you adjust the html so that it resembles something like this it will work:
<div id='results' class='execution-results'>
<p id='rpt-header'>
<span class='rpt-header-txt'>Backup Schedule Report for </span>
<span class='rpt-header-asset'>ret2w089n1t1</span>
</p>
<table id='nas-table'>
<thead>
<tr class='table-header'>
<th class='hidden'>Backup ID</th>
<th>Schedule Name</th>
<th>Backup Product</th>
<th>Size Mb</th>
<th>Start Time</th>
<th>Duration</th>
<th>Expiration Date</th>
<th>Mon 17</th>
</tr>
</thead>
<tbody>
<tr class='row'>
<td class='hidden'>12345678</td>
<td class='row-data'>null</td>
<td class='row-data'>Product One</td>
<td id='size-mb' class='row-data'>601.31</td>
<td class='row-data'>00:09:03</td>
<td class='row-data'>158 secs</td>
<td class='row-data'>2012-10-01</td>
<td class='row-center'>
<img id='success-fail' src='img/success.gif'></img>
</td>
</tr>
<tr class='row'>
<td class='hidden'>23456789</td>
<td class='row-data'>PolicyName</td>
<td class='row-data'>Product Two</td>
<td id='size-mb' class='row-data'>995.92</td>
<td class='row-data'>20:09:00</td>
<td class='row-data'>191 secs</td>
<td class='row-data'>2012-10-01</td>
<td class='row-center'>
<img id='success-fail' src='img/success.gif'></img>
</td>
</tr>
</tbody>
</table>
<div id='dialog-23456789' class='details-dialog' style="display:none;">
<table class='inner-table'>
<thead>
<tr>
<th>JOB_TYPE_NAME</th>
<th>VENDOR_STATUS_NAME</th>
<th>KILOBYTES</th>
</tr>
</thead>
<tbody>
<tr>
<td>Incr Backup</td>
<td>Successful</td>
<td>1019821</td>
</tr>
</tbody>
</table>
</div>
</div>
The trick is to move the div outside of the parent table and also you need to set the display:none on the details table or it will be shown when the page is rendered.

Grails file upload Kendoui

can someone please tell me a running example of upload file in kendoui?
As I have tried to upload file and its uploading in view page but when I click on save button I can't find that file in show page.I searched on it on internet then I found some problem of server.So someone please tell me how to use server in my case.I'm working on a grails project
Code That I have Used.:--
<tr class="prop">
<td valign="top" class="name">
<label>File Upload</label>
<input name="photos[]" id="photos" type="file" /><script>$(document).ready(function ()$("#photos").kendoUpload({
autoUpload:true,
upload: onUpload,
error: onError
});
function onError(e) {
// Array with information about the uploaded files
var files = e.files;
if (e.operation == "upload") {
alert("Failed to uploaded " + files.length + " files");
}
// Suppress the default error message
e.preventDefault();
},
function onUpload(e) {
var files = e.files;
if (e.operation == "upload") {
alert("Successfully uploaded " + files.length + " files");
}
});</script>
</td>
</tr>
i'm ading the view file :- create.gsp
<%# page import="ten.SkeletonBill"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="billing" />
<get var="entityName"
value="${message(code: 'skeletonBill.label', default: 'SkeletonBill')}" />
<title><g:message code="default.create.label"
args="[entityName]" /></title>
<script src="source/kendo.all.js"></script>
<link href="styles/kendo.common.css" rel="stylesheet" />
<link href="styles/kendo.default.css" rel="stylesheet" />
</head>
<body>
<content tag="menu-function">
<li><span class="k-link"><a href="#"
onclick="SkeletonBillForm.submit();return false;"><i
class="icon-plus-sign"></i>
<g:message code="default.button.save.label" /></a></span></li>
</content>
<div class="body">
<h1>
<g:message code="default.create.label" args="[entityName]" />
</h1>
<g:if test="${flash.message}">
<div class="message">
${flash.message}
</div>
</g:if>
<g:hasErrors bean="${skeletonBillInstance}">
<div class="alert alert-error">
<a class="close" data-dismiss="alert">×</a>
<g:renderErrors bean="${skeletonBillInstance}" as="list" />
</div>
</g:hasErrors>
<g:uploadForm name="SkeletonBillForm" action="save" method="post">
<div class="dialog">
<table>
<tbody>
<tr class="prop">
<td valign="top" class="name"><label for="bones"><g:message
code="skeletonBill.bones.label" default="Bones" /></label></td>
<td valign="top"
class="value ${hasErrors(bean: skeletonBillInstance, field: 'bones', 'errors')}">
<g:textField name="bones"
value="${fieldValue(bean: skeletonBillInstance, field: 'bones')}" />
</td>
</tr>
<tr class="prop">
<td valign="top" class="name"><label for="dateOfBirth"><g:message
code="skeletonBill.dateOfBirth.label" default="Date Of Birth" /></label>
</td>
<td valign="top"
class="value ${hasErrors(bean: skeletonBillInstance, field: 'dateOfBirth', 'errors')}">
<g:textField name="dateOfBirth"
value="${skeletonBillInstance?.dateOfBirth}" /> <script>$(document).ready(function () {$("#dateOfBirth").kendoDatePicker({format:"yyyy-MM-dd"})});</script>
</td>
</tr>
<tr class="prop">
<td valign="top" class="name">
<label>File Upload</label>
<input name="excelSheet" id="excelSheet" type="file" />
<script>
$(document).ready(function() {
$("#excelSheet").kendoUpload();
},
function onError(e) {
// Array with information about the uploaded files
var files = e.files;
if (e.operation == "upload") {
alert("Failed to uploaded " + files.length + " files");
}
// Suppress the default error message
e.preventDefault();
},
function onUpload(e) {
var files = e.files;
if (e.operation == "upload") {
alert("Successfully uploaded " + files.length + " files");
}
});
</script>
</td>
</tr>
</tbody>
</table>
</div>
</g:uploadForm>
</div>
</body>
</html>
And Also Controller.gsp
def save = {
def skeletonBillInstance = new SkeletonBill(params)
if(!skeletonBillInstance.empty){
println "Name: ${skeletonBill.bones}"
flash.message = "${message(code: 'default.created.message', args: [message(code: 'skeletonBill.label', default: 'SkeletonBill'), skeletonBillInstance.id])}"
redirect(action: "show", id: skeletonBillInstance.id)
}
} else {
render(view: "create", model: [skeletonBillInstance: skeletonBillInstance])
}
}
Couple of things
1) If you want to use KendoUI, I wouldn't use the gsp tags. Please use the normal form tags to define your form, if you do this grails resorts to using the prototype plugin for.
2) I will not mix the script code with the tags.
3) If you are using grails 2.0, you can use the KendoUI plugin, you can find more information at http://grails.org/plugin/kendo-ui
Hope that helps.

Resources