PrimeFaces fileUpload not working with dropZone - file-upload

I'm unable to upload a file that is dragged onto an inputTextarea component registered as a dropZone. Here's my code, based on the PrimeFaces demo example - am I missing something? The file uploads when it is dragged onto the fileUpload component itself.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
<h:form enctype="multipart/form-data">
<p:inputTextarea id="customDropZone" />
<p:fileUpload
dropZone="customDropZone"
widgetVar="docUploader"
listener="#{test.uploadDocument}"
sizeLimit="100000"
allowTypes="/(\.|\/)txt$/"
/>
</h:form>
</h:body>
</html>
The setup is Glassfish 6.2 / Primefaces 10 / Mojarra 3.0.1.

The dropZone attribute was added to PrimeFaces 11 (so, it's not available in 10). Note that currently the showcase shows PrimeFaces 11.0.0-RC1. So, upgrade if you want to use this feature.
See also:
https://github.com/primefaces/primefaces/issues/7279
https://github.com/primefaces/primefaces/blob/master/docs/11_0_0/gettingstarted/whatsnew.md
https://github.com/primefaces/primefaces/pull/7283

Related

onclick in Core 3.1 Blazor app doesn't work

I just installed Visual Studio 2019 (v16.4.3, immediately updated to 16.4.4). I have VS2017 on my system, but no prior versions of VS2019.
I created a new Blazor app project. It automatically created Index, Counter, and other pages. It created it as a .NET Core 3.1 app (as 3.1 is now installed automatically with VS2019 v16.4 and later, apparently).
I am literally following this "Get started" page:
https://learn.microsoft.com/en-us/aspnet/core/blazor/get-started?view=aspnetcore-3.1&tabs=visual-studio
I run the app with no changes from what was generated. Clicking the button on the Counter page does nothing. I don't see any messages in the Debug Output window that have any relations.
I did some searches and found reports of similar issues but the solutions don't seem to apply.
Any idea what is wrong? (it is SO annoying when a freshly generated, unmodified project does not work!)
The code for the Counter page was generated as:
#page "/counter"
<h1>Counter</h1>
<p>Current count: #currentCount</p>
<button class="btn btn-primary" #onclick="IncrementCount">Click me</button>
#code {
private int currentCount = 0;
private void IncrementCount()
{
currentCount++;
}
}
_Host.cshtml is:
#page "/"
#namespace ToDoList.Pages
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
#{
Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ToDoList</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
</head>
<body>
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
Reload
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
Update:
Per comment suggestions:
I rebooted my computer
Went straight into VS2019 and created a New Project. Selected Blazor App. Accepted all defaults. So, ended up with a project named BlazorApp1.
Hit F5 to start it up. Same results. Clicking the 'Click me' button the Counter does not do anything.
Entire contents of BlazorApp1.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
Note that the Get Started link I am following specifically says to use .NET Core 3.1 (vs 2.1). It says to OPTIONALLY update to the 3.2 preview, but that's only needed if I want to do a Blazor WebAssembly (which I don't). I prefer to only have released code on my system, so I don't want to updated to 3.2 Preview for something that is supposed to work with 3.1.
VS2019 defaulted to launching the app in Internet Explorer.
I changed it to launch it in Edge. It works in Edge.
Final update:
I got it to work in IE11. To do so:
I downloaded the Daddoon Blazor Polyfill package from here:
https://github.com/Daddoon/Blazor.Polyfill
From the downloaded zip, I copied Publish\Blazor.Polyfill.Publish\blazor.polyfill.min.js to a subfolder that I created, named "js", under the wwwroot subfolder in my project folder. I.e. in ToDoList\wwwroot, I created a subfolder named 'js' and then copied the blazor.polyfill.min.js file into that subfolder.
Then, I edited the file _Host.cshtml. I added the first line here (in front of the second line, which was already there, generated by VS and the Blazor Server template):
<script src="js/blazor.polyfill.min.js"></script>
<script src="_framework/blazor.server.js"></script>
I found a bunch of things that said "use Polyfills", but I couldn't find anything that said "here is how you actually do that." So, hopefully this helps someone else. Also, if I did something in a way that is suboptimal, hopefully someone will see this and tell me how to do it in a better way.
I had the same problem
To solve it, go to your project's Properties >> Debug >> uncheck Enable SSL. Then run your project by clicking e.g. IIS Express.

How to Play a SCORM content in react-native

I have tried to create a simple LMS to play a SCORM content in web. parsing the manifest file inside the SCORM zip you can get the target file and use that as src in frame and the Content plays and tracks.
example
<html>
<head>
<title>VS SCORM - RTE Frameset</title>
<!-- Rev 1.0 - Sunday, May 31, 2009 -->
</head>
<frameset
frameborder="0" framespacing="0"
border="0" rows="0,*" cols="*" >
<frame src="api.html" name="API" noresize>
<frame src="../course/course/index.html?type=scorm" name="course">
</frameset>
</html>
This works for web app. The api.html contains all standard SCORM functions like LMSInitialize, LMSCommit etc. I am trying to play SCORM in react-native and creating these functions.
I have tried with WebView and HTMLView but didn't worked.

ELM : Compile ELM page to JS

after creating an ELM page and running it successfully using (elm-reactor),
I have compiled it to generate the js file and open it using browser.
using the following command : elm-make pageName.elm --output target.js.
anyway the target.js page is generated successfully but when opening it using the browser it does not show the desired outcome instead it displays the source code as per the below screen shot
Run elm-make pageName.elm without --output target.js and open produced index.html
Alternatively, create your own *.html file and embed target.js via <script> tag, as you would normally do it for any other JavaScript files:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My app</title>
<script src="target.js"></script>
<script>
// Run the application manually.
Elm.Target.fullscreen();
<script>
</head>
<body>
</body>
</html>
Assuming that the name of the entry module is Target and you want it to take over the whole page.

File upload with Behat, Mink & PhantomJS

I am trying to upload a file using Behat. Therefore I wrote this simple HTML page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" /><br />
<input type="submit" />
</form>
</body>
</html>
and a simple Behat feature:
Feature: test
Scenario: Some Test
Given I am on "/upload.php"
And I attach the file "/path/to/tile" to "file"
When the I attach the file ... to ... phrase is executed, the selenium 2 driver generates a curl request and sends it to PhantomJS: http://localhost:4444/wd/hub/session/5b9a8630-ed8e-11e4-956f-956a9ce75127/element/:wdc:1430215640681/value with params: {"value":["\/path\/to\/file"]}
The request does not terminate unless aborting it and PhantomJS does not react on the request in any way.
I already searched through the net and found several threads saying that it does work and several saying that does not work including an issue on github (https://github.com/detro/ghostdriver/issues/282) which was closed and reopend multiple times.
Versions:
PhantomJS: 2.0.0
Behat: 3.0.15
Mink: 1.6.1
Mink-Selenium2-Driver: 1.2.0
Does anyone know a working solution for this problem?
Could this behaviour exist due to inability to upload files that is a known bug with PhantomJS v 2.0.0?
Basically, a change made in Qt 4.8 and incorporated subsequently in Qt 5.0 prevented clicking on file input elements that were not caused by user gestures.
The solution is discussed further in the issue thread.
To quote, you have to comment one if condition in
/src/qt/qtwebkit/Source/WebCore/html/FileInputType.cpp
//if (!ScriptController::processingUserGesture())
// return;
then compile the binary.

Configure library for tomahawk in JSF 2.0

I am trying to upload a file using <t:inputFileUpload/> , in JSF2.0 facelets
for that i need to use namespace xmlns:t="http://myfaces.apche.org/tomahawk/"
but showing error like "No library found for this namespace"
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:t="http://myfaces.apache.org/tomahawk" <!--Error Here : No library found for this namespace--->
In above code last line show's error
How could i manage this error...
No library found for this namespace means you have not added library
Add tomahawk-1.1.9.jar to your Build Path