<rich:fileUpload> component controls issues in RichFaces 4.3 - file-upload

Versions:
RichFaces: 4.3
MyFaces: 2.1
Problem:
There are two issues with the <rich:fileUpload> component in v4.3 of RichFaces which work fine in v3.0:
The autoclear="true" attribute does not seem to be working. I have referred below two links (neither of which seem to say anything about "autoclear" attribute):
answer1
answer2
The stop button doesn't show up after file is uploaded using upload button.
Code:
<rich:fileUpload maxFilesQuantity="5" fileUploadListener="#{bean.uploadFile}"
deleteLabel="RemoveNow" addLabel="BrowseFiles" uploadLabel="AttachFile" autoclear="true">
<a4j:ajax event="uploadcomplete" execute="#none" render="filePanel" />
</rich:fileUpload>

Those things are not implemented in RF 4.
If you need to clear the list after upload you can do something like this:
<a4j:ajax event="uploadcomplete"
oncomplete="#{rich:component('fileUpload')}.clearButton.triggerHandler('click')" … />

Related

Using different vendors with the same codebase in Vue

I'm working on a Vue project that is generated with the Vue cli 3. I would like to use different vendors in the same code base.
I need something that can load different images/styling based on a variable. For example something like:
<!-- In HTML templates -->
<img :src="`#/assets/vendor_name_here/banner.jpg`" />
/* In SCSS */
#import "assets/vendor_name_here/style/bootstrap";
Where vendor_name_here is a variable that can be set in the environment. Please, note that the above doesn't work.
Coming from an Angular background, something similar could be achieved by simply adding an app or project to the config. However, there is no such thing documented in the Vue docs (of what I could find).
So is there something similar in Vue?
Update:
I just found out that the following works for HTML images:
<img :src="require(`#/assets/${VUE_APP_VENDOR}/banner-large.jpg`)" />
So the question is still open for the SCSS files.
Update 2:
So apparently the same method also works for SCSS files. I added the folowing in my script block:
require(`./assets/${process.env.VUE_APP_VENDOR}/style/bootstrap.scss`);
And now it works :).
So I found my own answer to this. The fixes are in the answer itself in the updates.

ngb-tabset not styling correctly

I have a angular 5 component that is using ngbootstrap and bootstrap 4 to display a tabset. The tabset does not style correctly.
I am using ngb elsewhere in the project and it seems to work fine elserwhere.
Here is my component template:
I'm importing ngbmodule into my sub module:
and I have it imported forRoot() in my app module:
I also made sure to add bootstrap.min.css to my angular-cli.json when troubleshooting (and made sure the file was there):
Yet, when I view my component, the ngb-tabset isn't rendering correctly at all:
I have restarted ng serve many times and checked my console for errors (clean), I'm not sure what could be the issue, as our ngb modals and ngb date pickers have been working fine (and still are) :'(
This was my problem:
<ng-template ngbTabContend>
<p> here's some content</p>
</ng-template>
notice Contend instead of Content. D'oh!

Confused with pe:documentViewer rendering pdf file in web app

I have a web app that uses primefaces extensions.
If I use
<pe:documentViewer id="verPdf"
height="500"
name="/resources/pdf/#{utentesBean.nomeFile}" />
it does not render PDF in view.
if I use
<pe:documentViewer id="verPdf"
height="500"
name="/resources/pdf/441.pdf" />
it shows the PDF .
Can anyone give an idea ?
Thank you.
I am one of the developers of the document viewer component and I just tested it and it worked fine with both of the following:
<pe:documentViewer url="/sections/documentviewer/#{controller.bookFile}"/>
<pe:documentViewer library="books" name="#{controller.hoodFile}"/>
One thing I noticed above in your example is you were not using URL you were using "name" attribute and name is meant to be used with "library" as in my example above as a relative path to a resource folder called "books".
I think you want to change your code to...
<pe:documentViewer id="verPdf"
height="500"
library="pdf"
name="#{utentesBean.nomeFile}" />

XUL textbox is not editable or visible

When using an XUL <textbox> element in the latest Firefox releases, I am not able to focus the element and write something into it. It worked in older versions, like 33. Using html:textarea instead seems to work. However, I would be happy to keep the original XUL element in my app and want to understand what is going wrong here.
When using the multiline attribute on the <textbox> element, the element is not visible at all!
Any hint or explanation would be great.
Here is my small test.xul file content:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html = "http://www.w3.org/1999/xhtml"
width="800"
height="800">
<textbox flex="1" />
<html:textarea flex="1" />
</window>
Found the problem.
I had an override rule in my chrome.manifest file which looked like this:
override chrome://global/locale/textcontext.dtd
chrome://myapp/locale/xulrunner_global_textcontext.dtd
The file was changed for firefox 38 and an additional ENTITY was added which is not defined in my file. Adding the missing ENTITY solved all problems.
Thanks Makyen for testing and inspiration.
The changes for those who are interested:
https://hg.mozilla.org/releases/l10n/mozilla-beta/de/diff/6f25b6d2dcf5/toolkit/chrome/global/textcontext.dtd

Drag and drop file upload strange behaviour

I'm using Primefaces 3.5 and I have ran into a pretty disturbing problem. The component looks like this in the xhtml:
<p:tab id="installApp" title="Install application">
<h:form enctype="multipart/form-data">
<p:panel header="Upload status" id="upld_status">
<p:dataTable id="errorTable" var="error"
value="#{applicationInstallerBean.uploadMsgs}">
<p:column headerText="Application">
<h:outputText value="#{error.filename}" />
</p:column>
<p:column headerText="Status">
<h:outputText value="#{error.errorMsg}" />
</p:column>
</p:dataTable>
</p:panel>
<p:remoteCommand name="clearPrevious" update="upld_status uploader" action="#{applicationInstallerBean.clearPrevious}" process="#this" />
<p:fileUpload id="uploader" multiple="true" dragDropSupport="true" onstart="clearPrevious()"
fileUploadListener="#{applicationInstallerBean.install}" uploadLabel="Install"
mode="advanced" update="#this upld_status" auto="false"
allowTypes="/(\.|\/)(zip)$/" styleClass="install_app_fileupload" />
</h:form>
<p:panel header="Help" toggleable="true">
<ui:include src="applicationInstallHelp.xhtml" />
</p:panel>
</p:tab>
Now the behaviour I'm experiencing is pretty strange:
For the first few times, uploading files with drag'n'drop method works fine. After a few uploads, the following errors appear totally undetermenistic:
FileUpload component disappears after pressing Upload button, only to reappear when I refresh the page
the onstart method gets called a lot of times during upload
the table containing the status of the upload does not refresh or only one of the files appear there, when multiple are uploaded
I also get a message from the browser that a script is running on this page and I can abort or continue
What I have tried:
Removing the h:form element, since this is an include in the index file, which already has a h:form element in it
Result: basicly the same, with the difference, that dropping a file for the first time onto the component automatically uploads it, but auto is set to false
I have also tried emptying the browser cache, redeploying the application from a scratch, turning off multiple...all with no luck.
The files I'm uploading are 80k to 9mb.
From this it looks to me, that uploading too much files makes the whole thing go crazy, but I cannot really think of a solution. Any help would be appreciated.
Update: During testing I found that the onstart method ALWAYS fires more than once after the first upload. For the first time it only fires once. On the second upload about 7-10 times, on the third time it seems it keeps firing until I end the session. This is pretty strange and I think it may be the root of the problems. Any ideas on this?
Thank you in advance!