HTML Decrations are not working in Liferay - liferay

I am using Liferay 6 with Struts2 .
I have this Struts2 Tags JSP in Liferay .
<HTML>
<HEAD>
<TITLE>Login using Ravi</TITLE>
</HEAD>
<body bgcolor="#E6E6FA">
<s:form action="helloForm" method="POST" theme="simple">
<table>
<tr>
<td>Enter Your Name:<s:textfield name="namer" value="%{name}" required="true"/></tr>td>
</tr>
<tr>
<td>Enter Your Password:<s:textfield name="passer" value="%{passer}" /></tr>td>
</tr>
</table>
<s:submit/>
<s:submit/>
<s:submit/>
</s:form>
</BODY>
</HTML>
This page is being displayed , but the issue is that , the body color is not being chnaged at all .
And also when i tried to set the body height width and all they are not being reflected .
Or is it that using themes only we can achieve this ?

Liferay cut the html-, header- and body-tag out. After the cutting remain all inside body tag:
<s:form action="helloForm" method="POST" theme="simple">
<table>
<tr>
<td>Enter Your Name:<s:textfield name="namer" value="%{name}" required="true"/></tr>td>
</tr>
<tr>
<td>Enter Your Password:<s:textfield name="passer" value="%{passer}" /></tr>td>
</tr>
</table>
<s:submit/>
<s:submit/>
<s:submit/>
</s:form>
but you can modify look-and-feel from portlet with portlet specific css.
Set in liferay-portlet.xml <css-class-wrapper>your-portlet-name-or-some-thing-uniq</css-class-wrapper>
and add in /MyPortlet/docroot/css/main.css
.your-portlet-name-or-some-thing-uniq {
background-color: #E6E6FA;
}

Related

How to use "Flat Json"-Bootstrap 5 Table example with ejs + nodejs + expressjs

I want to use the "Flat Json"-Bootstrap 5 Table example. [Link][1]
I am using expressjs with nodejs and ejs.
My Code so far:
```<link href="https://unpkg.com/bootstrap-table#1.18.1/dist/bootstrap-table.min.css" rel="stylesheet">
<script src="https://unpkg.com/bootstrap-table#1.18.1/dist/bootstrap-table.min.js"></script>
<body>
<h2>JOB DASHBOARD</h2>
<table id="table" data-toggle="table" data-flat="true" data-search="true" >
<thead>
<tr>
<th data-field="" data-sortable="true">Order ID</th>
<th data-field="" data-sortable="true">Liefertermin</th>
<th data-field="" data-sortable="true">Fertigstellungstermin</th>
<th data-field="" data-sortable="true">Keyline Nr</th>
</tr>
</thead>
<tbody>
<% var count = 0; %>
<% orders.forEach((order)=>{ %>
<tr data-index="<%= count %>">
<td><%= order.order_id %></td>
<td><%= order.due_at %> </td>
<td><%= order.deliver_at %> </td>
<td><%= order.keyline_obj.event.data.attributes.reference %> </td>
</tr>
<% count +=1; %>
<% }) %>
</tbody>
</table>
</body>
</html>```
I am loading the content from my mongoDB Database. The Variable "orders" is an array of order documents.
At the moment the data is loading but the searchfield doesnt appear at all and all the styling doesnt work although I have loaded the bootsrap css and js.
[1]: https://examples.bootstrap-table.com/index.html?bootstrap5#welcomes/flat-json.html
i think the problem is that the is successfully sent but the respond is in json as the browser waiting
you can check data is received or not by => clicking right click on the screen =>press inspect => Network => click on the page file => then choose Response
you will find your html page with the updated data in it
you can render it from your js script after fetching api like so
await fetch(----your fetching code-----).then(res=>{
document.open();
res.text().then(function(text) {
document.write(text)
});
})

HTML tag is not accepted in nodejs

in this code html table tag not accepted.i don't why within codes i have tried but result not came i want the table format with border style.html within code also tried
this is my html table :
let mailOptions = {
from: 'aaaaaaaaa',
to: 'bbbbbbbbbb',
subject: 'Test',
html:`<html><head>
<body>
<table>
<tr>
<th>Id </th><th>Templatename</th>
<th>Description</th>
<th>TemplateContent</th>
<th>Active</th>
</tr>
<tr>
<td>streamingTemplate.id.toString()</td>//here the table data should be a database not the defined one.
<td>streamingTemplate.template_name.toString()</td>
<td>streamingTemplate.description.toString()</td>
<td>streamingTemplate.template_content.toString()</td>
<td>streamingTemplate.is_active.toString()</td>
</tr>
</table>
</body>
</head></html>`
};
Your <table> tag is inside a <head> tag.
Change your structure to this :
<html>
<head>
</head>
<body>
<table></table>
</body>
</html>
You have a space character inside your <table> tag. It is <table > instead of <table>

NotFoundHTTPException while pagination. Laravel

I'm trying to paginate my views. I have used following syntax to do that:
Route:
Route::get('Bill/view/month/history','BillController#monthHistory');
Controller:
public function monthHistory(Request $request)
{
$month= $request->month;
$bills=Bill::orderBy('created_at', 'desc')->where('month',$month)->paginate(7);
$bills->setPath('custom/url');
return view('Bill.monthResult',compact('bills'));
}
View:
<div class="row">
<div class="col-sm-12">
#section ('cotable_panel_title','Bills')
#section ('cotable_panel_body')
<table class="table table-bordered">
<thead>
<tr>
<th>Id</th>
<th>Student</th>
<th>Grade</th>
<th>Month</th>
<th>Date Published</th>
<th>Amount</th>
<th>Paid</th>
<th>Balance</th>
<th>User</th>
</tr>
</thead>
<tbody>
#foreach($bills as $bill)
<tr class="info">
<td>{{$bill->id}}</td>
<td>{{$bill->student->first_name}}</td>
<td>{{$bill->grade->grade_name}}</td>
<td>{{$bill->month}}</td>
<td>{{$bill->date_published}}</td>
<td>{{$bill->amount}}</td>
<td>{{$bill->paid}}</td>
<td>{{$bill->fee_status}}</td>
<td>{{$bill->user}}</td>
</tr>
#endforeach
</tbody>
</table>
#endsection
#include('widgets.panel', array('header'=>true, 'as'=>'cotable'))
</div>
</div>
</div>
{!! $bills->render() !!}
While the Pagination works fine for the first page, When i click on next page it throws not foundhttpexception with URL:
http://localhost:8000/Bill/view/month/custom/url?page=2
How can i solve this problem? Can anyone help me?
you also need to have a GET route for
Route::get('Bill/view/month/history/custom/url','BillController#monthHistory');
in your routes file.
or you can do this to
use custom url as optional variables on your route as below.
Route::get('Bill/view/month/history/{custom?}/{url?}','BillController#monthHistory');
and do use set path like this in your controller
$bills->setPath('/Bill/view/month/history/custom/url');

Laravel 5 - Download Excel file of a View

I'm working on adding an export/downloading feature to a Laravel 5 application. I found the Laravel-Excel library (http://www.maatwebsite.nl/laravel-excel/docs), which seems perfect -- ideally, I will be able to take a Laravel View or html and make a downloadable Excel file.
So far, I've gotten the creation and storage to work. I can create an Excel file, and it's okay (it's the right data and View), and on the server in storage/exports/ I see "Report.xls" - which is right save path. The issue I'm having is I cannot seem to download the file through the browser after creating it.
The Laravel-Excel library has ->download('xls') and ->export('xls') methods, but these only seems to return the raw content, which is visible in the developer's console:
On the right, you can see the file was created and stored as "Report.xls", and presumably the raw content is the right content - but I don't know why it's just spitting raw content into the console. I can open the Report.xls file in Excel, so I know it's not corrupted.
I also tried to use the Laravel 5 Response::download() function and set headers for the download, but it also spit out raw content in the console instead of downloading the file:
The code I'm using is an AJAX call that hits a Controller method, and the controller method just triggers a Service method called "downloadReportFile()":
public function downloadReportFile($requestData, $fileType) {
$configJSON = \Report::loadConfigFile($requestData['reportName']);
$today = Carbon::today()->format('Y-m-d');
$FileViewdata = array(
'config' => $configJSON,
'html' => $requestData['report_html']
);
\Excel::create("Report", function($excel) use ($FileViewdata) {
$excel->setTitle($FileViewdata['config']['title']);
$excel->setDescription($FileViewdata['config']['description']);
$excel->sheet("page 1", function($sheet) {
$sheet->loadView("reports.sample");
});
})->store('xls', storage_path('exports')); // ->export('xls');
$report_excelFilepath = storage_path('exports') . "/Report.xls";
return response()->download($report_excelFilepath, "Report.xls", [
'Content-Type' => 'application/vnd.ms-excel',
'Content-Disposition' => "attachment; filename='Report.xls'"
]);
}
The View being made into the Excel file is a simple table - the same table as in the screenshots. Here's the template/HTML of the View:
<div class="container full-width-container">
<link href="http://192.168.33.10/css/reports.css" rel="stylesheet">
<div id="results" class="row">
<div class="col-xs-12">
<h2 class="report-title">Active Products </h2>
<br>
<div class="row">
<div class="col-xs-12">
<div class="table-responsive report-component" name="table" template="table">
<table id="report-table" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td class="report-table-th">ENGINE</td>
<td class="report-table-th">PRODUCT COUNT</td>
<td class="report-table-th">PRODUCT PRICE</td>
</tr>
</thead>
<tbody>
<tr class="results-cell">
<td class="report-table-cell">
<p>Meows</p>
</td>
<td class="report-table-cell">
<p>1,234</p>
</td>
<td class="report-table-cell">
<p>781230.00</p>
</td>
</tr>
</tbody>
<tbody>
<tr class="results-cell">
<td class="report-table-cell">
<p>Paws</p>
</td>
<td class="report-table-cell">
<p>10,777</p>
</td>
<td class="report-table-cell">
<p>3919823.00</p>
</td>
</tr>
</tbody>
<tbody>
<tr class="results-cell">
<td class="report-table-cell">
<p>Meow Mobile</p>
</td>
<td class="report-table-cell">
<p>177</p>
</td>
<td class="report-table-cell">
<p>334323.00</p>
</td>
</tr>
</tbody>
<tbody>
<tr class="results-cell">
<td class="report-table-cell">
<p>Tails Cloud</p>
</td>
<td class="report-table-cell">
<p>335</p>
</td>
<td class="report-table-cell">
<p>378918923.00</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
Does anyone see what I might be missing to download an XLS file?
Thanks for your time!
EDIT
After doing some more research, it seems that my original workflow for downloading -- using an AJAX call to trigger -- is part of the problem. For example Download a file from Servlet using Ajax talks about AJAX storing results in JavaScript memory, which would explain why I get content in my console and not a file.
Try to add code below before Excel::create():
ob_end_clean();
ob_start();
Example code:
ob_end_clean();
ob_start();
Excel::create($filename, function($excel) use($records, $sheetname, $data) {}
This works for me.

Frameset in web app - one of the frames not displaying, but only in IE

We have an old legacy VBScript app that's been running on IIS 6 for many years, and we are now migrating it from Windows Server 2003 to Windows Server 2012 R2. As far as the markup being valid, I'm sure there are many, many issues, but since it's an intranet app, I cannot really run it through a WC3 validator or anything like that.
Anyway, in moving it to our test and production 2012 boxes, one machine serves up the app just fine, and the other one fine, EXCEPT one of the frames on the "home" page will display for a bit while waiting for the response to complete, then once the page has been loaded, the content in that frame disappears, leaving behind a generic "content cannot be displayed message." The logs are proving to be pretty generic with the error codes, and I've compared every IIS setting between the two servers; all settings match. I've checked the installed features on both servers, all match. All the HTML and .asp files are exactly the same. The global.asa files match except for prod/test specific settings, and with any other browser besides IE, both the test and prod pages are served up successfully.
I've tried Compatibility Mode - same result. I know frames are evil, but I just don't know what would cause the code from one of these servers to fail and the other to load fine in IE, but as I said, both servers load the content fine in any other browser.
Here's the Default.htm file (the "home" page). The "TitleFrame.asp" file is the one that's failing to load once the response finishes:
<HTML>
<HEAD>
<TITLE>Page Title</TITLE>
</HEAD>
<FRAMESET ROWS="82,*,20" BORDER="0" FRAMEBORDER="0">
<FRAME NAME="header" TITLE="Portal Header" SRC="TitleFrame.Asp" FRAMEBORDER="0" MARGINHEIGHT="0" SCROLLING="no">
<FRAME NAME="main" TITLE="Main Content" SRC="Home.Asp" FRAMEBORDER="0" MARGINHEIGHT="0">
<FRAME NAME="footer" TITLE="Foot Notes" SRC="FootFrame.Asp" FRAMEBORDER="0" MARGINHEIGHT="0" SCROLLING="no">
</FRAMESET>
</HTML>
and here's the TitleFrame.asp code. Essentially it displays the current database name, authorized user, a logout link, and if a user has been authorized in the global.asa, extra menu items are displayed:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<META HTTP-EQUIV="refresh" CONTENT="600">
<script language='javascript' src='Included_Files/PT_PIAHDRSCRIPT_ENG_empty_1.js'></script>
<script language='javascript' src='Included_Files/PT_ISCROSSDOMAIN_ENG_empty_1.js'></script>
</head>
<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 bgcolor=#ffffff>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td rowspan=3 width=96>
<img src=Included_Files/MyCompany2.gif width=125 height=30 alt="MyCompany Logo" hspace=20></td>
<td width=142 class=globeBar>
<img src=Included_Files/PT_PORTAL_BEIGE_GRAD_ENG_1.JPG width=142 height=36></td>
<td align=right width=90% class=globeBar>
<img src=Included_Files/PT_PORTAL_GLOBE_ENG_1.JPG width=118 height=36></td>
</tr>
<tr>
<td class=searchBar width=142>
<img src=Included_Files/PT_PORTAL_BLUE_GRAD_ENG_1.JPG width=142 height=16></td>
<td class=searchBar width=90%>
<font class=searchBarSize> </font></td>
</tr>
<tr>
<td valign=top>
<img src=Included_Files/PT_PORTAL_SHADOW_GRAD_ENG_1.gif width=142 height=5></td>
<td valign=bottom>
<table width=100% border=0 cellspacing=0 cellpadding=0 height=20>
<tr>
<td width=3% valign=bottom class=buttonBar nowrap=true>
<img src=Included_Files/PT_PORTAL_BLUE_CORNER_ENG_1.gif width=24 height=14></td>
<td width=20% class=buttonBar nowrap=true><nobr>
<a href=Home.Asp target=main class=headerLink>
<span onMouseOver="this.style.textDecoration='underline'" onMouseOut="this.style.textDecoration='none'">
<img src=Included_Files/PIA_HOME_ENG_1.gif ALT='Go To Home Page' border=0 align=absmiddle>
Home</span></a></nobr></td>
<td width=20% class=buttonBar nowrap=true><nobr>
<% If Session("SHOW_AUDITING_MENU") Then Response.Write "<a href=SelectDB.Asp target=main class=headerLink>" %>
<span class=headerLink
<% If Session("SHOW_AUDITING_MENU") Then Response.Write "onMouseOver=this.style.textDecoration='underline'" %>
onMouseOut="this.style.textDecoration='none'">
<img src=Included_Files/PT_PORTAL_IC_LOGOUT_ENG_1.gif ALT='Switch Database' border=0 align=absmiddle>
Database</span>
<% If Session("SHOW_AUDITING_MENU") Then Response.Write "</a>" %>
<span class=headerLink> (<%
DBNAME = Session("DB")
DBNAME = Replace(DBNAME,"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=MyUserID;Password=MyPassword;Initial Catalog=","")
DBNAME = Left(DBNAME, 6)
Response.Write DBNAME%>)
</span>
</nobr></td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=20% class=buttonBar nowrap=true><nobr>
<a href=http://MyCompanynet/ target=_top class=headerLink>
<span onMouseOver="this.style.textDecoration='underline'" onMouseOut="this.style.textDecoration='none'">
<img src=Included_Files/PT_PORTAL_IC_LOGOUT_ENG_1.gif ALT='Go To MyCompanynet' border=0 align=absmiddle>
Logout</span></a>
<span class=headerLink> (<%=Replace(Trim(UCASE(Request.ServerVariables("AUTH_USER"))),Session("Domain"),"")%>)</span>
</nobr></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Resources