I want to add a sidebar or a header to some of my reports in OpenERP. The ReportLab user manual (PDF), describes the <frame> and <nextFrame> tags. Are they fully supported in OpenERP? I've gotten some things to work, but one frame just flows into the next, so a report that takes more than one page ends up with overlapping text.
After a bunch of digging in the code, I have frames working in OpenERP 5.0. The key feature I had to find was the last="true" attribute for a frame definition. That means that the frame should assume it's the last frame on the page. Any text that overflows it will flow to the first frame of a new page, not to the next frame on the current page. I ended up setting it true on all my frames. To see an example with frames, here are some snippets from our balance sheet report.
<template
pageSize="(8.5in,11in)"
title="Test"
author="Zaber Technologies Inc."
allowSplitting="20">
<pageTemplate id="first">
<frame
id="first"
x1="1.3cm"
y1="0.2cm"
height="27.5cm"
width="14.0cm"
last="true"/>
<frame
id="upper_right"
x1="14.1cm"
y1="21.53cm"
height="5.2cm"
width="5.0cm"
last="true"/>
</pageTemplate>
</template>
This section specifies your page layout. By default, text will start in the first frame in the list. y1 is the distance from the page bottom. You can specify a page template in two places: within the report itself, or within the headers defined in the company configuration. If you use a header, the report's first page template will be replaced by the header's page template, so the report's template can just be a pageTemplate tag with an empty frame tag in it. The company headers can only use one page template, but each report can define more than one page template.
When you want to put something in one of the other frames, use setNextFrame and nextFrame.
<setNextFrame name="upper_right"/>
<nextFrame/>
You don't have to use the frames in order. You can switch to an earlier frame in the list, and it won't start a new page.
For more details about changing the header, see the documentation or the question on user-defined headers.
Related
I'm using PrimeFaces' p:fileUpload with attribute mode="advanced" so there are 3 buttons (Choose, Upload, Cancel) for uploading files. Below those buttons there is a field in which the chosen files appear after using the choose button. If a file with a correct data type is chosen, the file's name, size, a process bar for the upload and a button to delete the file appear.
First question: Is there a way to add a tooltip to this button?
Also, if a file with an incorrect data type is chosen, an error message appears in the field below the 3 buttons. This error message also has a button to remove the message. Neither the message itself nor its button are focusable by the tab key which makes it inaccessible for non-mouse users.
Second question: Is there a way to make the error message focusable by the tab key?
<p:fileUpload id="fileUpload"
fileUploadListener="#{ShowcaseHandler.handleFileUpload}"
mode="advanced"
multiple="true"
auto="false"
dragDropSupport="false"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" chooseButtonTitle="Test"/>
Tooltip: See https://www.primefaces.org/showcase/ui/file/upload/tooltips.xhtml for examples using PFv10. Also look at the PrimeFaces documentation for p:tooltip.
It appears tooltips were only supported natively in fileUpload from PrimeFaces v10 and I suspect from the question that you're using PF7 or earlier, in which case please see this PrimeFaces issue log for a potential workaround: https://github.com/primefaces/primefaces/issues/5831. Unfortunately the example does not cover the second delete file button that you mentioned, which is an element of a repeating row. You may need to submit an enhancement request to get this added to PrimeFaces natively.
I have come to a road block in my search to the answer to using custom fields in templates.
I have tried adding
%%SNIPPET_ProductCustomFields%%
in the ProductDescription.html but nothing shows.
Is there ANY documentation about this?
Can this snippet be used in certain places only? if so which ones?
What needs to be in place for this to display in the products description?
Any help, tips or pointers would be great.
The CustomFields Snippet, %%SNIPPET_ProductCustomFields%%, can only be used if being referenced through its own Panel.
By default, the Panel that calls this snippet is named %%Panel.ProductOtherDetails%%
You can also create your own custom Panels by uploading them to the Panels folder via WebDav.
For example, if you created a template file called CustomFieldsPanel.html, you would upload it to the /dav/template/Panels folder, and reference it in your theme by %%Panel.CustomFieldsPanel%%
To answer your question though, you can do one of the following to display Custom Fields in the Product Description:
Insert it into ProductDescription.html via its default Panel - %%Panel.ProductOtherDetails%% - modifying it by editing the template file ProductOtherDetails.html
Create your own custom panel, include the Snippet within that same custom panel, and insert it into ProductDescription.html by the custom panel's name. An example of that file might look like so:
<!--
* /dav/template/Panels/MyCustomFieldsPanel.html
* %%Panel.MyCustomFieldsPanel%%
-->
<div id="MyCustomFieldsPanel">
<h1> Custom Fields Below </h1>
%%SNIPPET_ProductCustomFields%%
</div>
Hope this helps :-)
I have a bootstrapped template with datatables.net, I'd like to use the same datatables grid (same functionality/data) within the page, and a modal popup that gets fired from within the same page somewhere.
How would I be able to duplicate the exact same grid without duplicating my code?
I have two scenarios I need help with, and I thought posting them together would prove more
valuable for myself, and other viewers.
Setup:
Worklight 6.1
dojo 1.9
Application:
MainView.html (Contains Body, and a transition Div, and NorthSouthView.js script reference)
View1.html (Contains a single Div that displays and unordered list
View2.html (Contains a single Div that Displays <p> data, and also plays audio)
View3.html (Contains a single Div that Displays instructional information)
application-descriptor <mainFile> MainView.html </mainFile>
All of the views are stored together in the application. There are no external http queries made by the application. All view transitions are local to the application.
Scenario #1:
At application start the MainView.html is invoked by worklight. Anticipated format::
<body>
<div>
<h1 id="SSheader" data-dojo-type="dojox.mobile.Heading" data-dojo-props='fixed:"top"'>Loan Snapshot</h1>
</div>
<div id="TransitionViewDiv">
/* Would like to load content of View1.html, View2.html, or View3.html here */
</div>
<script>SetView.js</script>
</body>
Description + Questions:
When the application starts, SetView.js will be loaded, and the purpose of this script is to look at localStorage and determine which view should be displayed. (View1, View2, or View3). The goal is to keep SSheader fixed at the top of the screen at all times. Only TransitionViewDiv would update.
Questions:
1) What coding approach can be used in SetView.js to load one of the 3 possible views into the TransitionViewDiv?. I did findin dojo 1.9 specs an example using dojox/mobile/ViewController but I was not able to get the sample code to work as documented by dojo.
2) Is the approach of having the TransitionViewDiv necessary, or could View1, 2 or 3 be loaded without TransitionViewDiv? Keep in mind that each view View1, 2, and 3 are defined as individual Div's.
Appreciate any advice to accomplish the above approach, or welcome any suggestion on the best practices to accomplish the transition.
Scenario #2:
As a follow-on to the scenario 1 above. Once View1, 2 or 3 is successfully loaded the views will have buttons defined that will want to cause the transition to another one of the remaining views. So, if inside SetView.js the decision is to slide in View2 to be displayed, View2
will have buttons that will want to load for example View3.html.
Description + Questions:
1) Would the best approach to load View3.html from View2.html be to use the moveTo on the button click, or should the button use the callback to invoke javascript to cause the transition similar to what was used to load the initial view?
Appreciate any advice on the best practices to managing multiple view stored in independent files. In the end the application will have upwards of 15+ ViewXX.html files each containing a Div. Based on this, having all of the views in one html file and forcing the hide, and show is not feasible.
Appreciate your time and help
To load an HTML fragment (View1.html, View2.html or View3.html), you can use the dojox/mobile/ContentPane. This widget allows you to provide a href property that can be used to specify the location of the view.
You can also alter it later on by setting the href property again, for example:
registry.byId("myContentPane").set("href", "View2.html");
You should keep the div#TransitionViewDiv and programmatically add the dojox/mobile/ContentPane to it, or use declarative syntax and add the following attributes:
<div id="TransitionViewDiv" data-dojo-type="dojox/mobile/ContentPane" data-dojo-props="href: 'View1.html'"></div>
Your second scenario is differs from the first one. In the first one, you actually have 1 view with many fragments, while in your second scenario you have many views.
If you only have 1 view, you cannot transition to other views (there are none). So if you want to use transitions you cannot use dojox/mobile/ContentPane.
However, if you have seperate views, then that means you need to move the header to each view (since they're part of it). For these, more complex cases I think you should look at the dojox/app module. This covers a lot of the MVC code for you and the only thing you need to do is configure it.
If you're not interested in the dojox/app module, you can try to inherit views. You might want to look at this answer I once provided. In the comment section of that answer you can also find a more detailed JSFiddle. In this example the header is actually inherited. I also wrote a more detailed article to handle this case .
I have a dynamically generated page made up of some divs and tables and other elements inside those divs, all absolutely positioned. The lower divs can potentially have more contents in them, like comments/description, so they'll be longer then a page.
The problem is dompdf doesn't insert a page break, it just spans till end of first page and the rest of my html gets cut off...
Obviously page-break-before/after allways is not going to work since the content is dynamic, it may or may not span multiple pages depending on every entry.
Does anyone know of a simpler way to make it behave, apart from measuring content height, inserting page breaks with JS before html is generated and sent over to dompdf?
The issue was a large div containing all elements with in the body. Dompdf is not able to comprehend div to break into pieces. Once that was gone it arranged separate elements within the body tag just fine.
The reason is that dompdf doesn't insert an auto page break in elements with position:absolute. Here's the bug report: Auto page break in "position:absolute" elements not working
So without knowing the details of your CSS, I would say that the problem is not about "breaking the div into pieces" but about treating absolute as literally absolute on this very page.