Customized error message on loading error of PDF in PDFTron - pdftron

I am working with PDFTron - WebViewer,
Want to know how to handle PDF loading errors and showing customized message, in case of web-viewer
Regards
Bhupesh

The easiest way to do this right now is to modify the ErrorModal component in the UI and replace the error messages there. You'll need to string match the old message and replace it with your own.
The component is located at ui/src/components/ErrorModal/ErrorModal.js and you'll want to change the onError function.
This link describes more about how to edit and build the UI https://www.pdftron.com/documentation/web/guides/ui/advanced-customization

WebViewer has methods that let you display a modal Warning message box, which can be dismissed with its Confirm button or a click outside the dialog, or you can display a modal Error box which has no dismiss buttons and requires you to hit [F5] to refresh the page.
https://www.pdftron.com/api/web/UI.html#.showWarningMessage
https://www.pdftron.com/api/web/UI.html#.displayErrorMessage
Using these is more straightforward than editing the UI code from the pdftron github repo.

Related

Problems calling SharePoint Document Library upload form with custom button

I'm trying to create a link (not actually a button, but styled as a button) that calls up the Upload.aspx for a document library but I'm running into issues once Upload.aspx loads. The main issue is that the Cancel button is non-functional. I can upload select a file and upload it (and this works), but if I were to have accidentally clicked on the initial link and want to navigate away without uploading, the Cancel button doesn't make the page go away.
Now I haven't been able to have Upload.aspx display as a dialogue box over the list page--it gets called as a full page (even though I have "Open forms in dialog" enabled). I'm wondering if that's what the Cancel button expecting. Any ideas? The link that is being called is:
/mySite/_layouts/15/Upload.aspx?List=%7B4982C5B5%2DCF88%2D497F%2DA48D%2D815D7A355F0A%7D&Source=https%3A%2F%2FmyServer%2Ecom%2FmySite%2FmyDocLibrary%2FForms%2FAllItems%2Easpx&isdlg=1"
Turns out it was the &isdlg=1 at the end of the URL that was causing the Cancel button to not work. I removed this from the URL and it works properly now.

Primefaces Dialog Framework and Growl messages

I'm using Primefaces 6.1 Dialog Framework. I'm wondering if there's a way to use a general growl for nested dialogs.
I could use a growl in one of the child dialogs but it displays the messages inside the boundaries of the iframe and not on the top-right corner of the window.
Here's an example:
main.xhtml > dialog1.xhtml > dialog2.xhtml
So, I'm in main, then I open dialog1 to view some data and then dialog2, which is kind of a tiny CRUD page.
When there's an error in this last page, I want to display the error message on the top-right corner of the WINDOW (not the iframe), just like it would do in the main page.
I don't know if it's a bug/issue or I'm just dumb, but I'm running out of ideas. Is there a way to accomplish this?
Thanks in advance!
(I can't provide the code now, but if it's really neccesary i'd edit this a put a simple example).

Is it possible to save a file using client side javascript in xpages

I customize my confirmation prompt using sweetAlert, I did it, now my problem is using a customize confirmation prompt, I cannot use SSJS code but I need to save a document with a file upload.
I need Help with this thanks!
My workaround for this is an XPoages button that contains the required SSJS code for saving the document. The button resides in a hidden normal DIV (style="display:none"). When executing you CSJS just refer to the clientId of that button and fire the event click() like in
function csjsAction(){
dojo.byId("#{id:yourButton}").click();
}

how to use the native control plugin in PhoneGap to load a different page into the UIWebView

I'm using the NativeControls plugin to create a tabbar - http://d.pr/vBJZ
Apparently, on first load, the tabbar has the onSelect event attached to them and i can refresh the webview just fine by doing window.location="http://someremotedomain.com".
But once the webview refreshed with the new external page - it seems the tabbar loses its onSelect event.
I suppose my real question is - why does the tabbar buttons loses its onSelect Event when the webbview starts to show a different (remote/external)page?
Does that mean that i have to re initialize the NativeControls on every new page? that isn't possible because the page im showing is coming from an external source, which doesn't include the phonegaps js related files.
My 2nd question - probably would help me dilemma, is there any way to grab the UIWebView control?
okay nevermind i figured out:
the javascript callback function doesn't exist anymore on the next page
yes you can - but i don't know in the js file but in the plugin/obj-c you can access the webview

jQuery Mobile - Dialogs without changing hash

I have a search dialog that I am popping up and filling with jquery templates. After they make a selection I set a value on the current page. As such I don't need hashTags or anything like that, I just need a pop-up dialog that I can open and close programatically. I am currently opening the dialog with
$.mobile.changePage(dialog, { transition: "slide", changeHash: false });
and closing it with
dialog.dialog('close');
However, in certain cases (when the page is navigated to), closing the dialog refreshes the current page.
Is there a better way to interact with this?
Update:
I think I figured out what is going on. So for some reason, jquery mobile usually keeps 2 pages loaded on the DOM - one of which is invisible, you can verify this by running $('[data-role=page]') in the console. One page is the page you're on, the other is the page that you initially navigated to. Not quite sure why they choose to do that, but there you have it.
So they treat dialogs as a page navigation with a different transition even if the dialog is already in the DOM. Therefore, if you go directly to the page and then trigger a dialog, modifying the current page and closing it works fine - because the original page is always loaded in the DOM. However if you go to another page, than navigate to the page that triggers the dialog, and THEN trigger the dialog it destroys the current page so that the pages in the DOM are the initial one and the dialog. In that case it reloads that dialog-launching page entirely and you never get a chance to make any modifications.
Jeez. How do I interact with the jqm dialog widget directly?
You can try two other things. Both should work:
1 set DomChache
How about overriding JQM to keep the page your are firing the dialog from in the DOM? The docs say you can set data-dom-chache and override cleaning the page from the DOM.
If it only happens when you load this page in via AJAX (vs. loading it directly) you could make DOM-keeping dependend on your trigger page having data-page-external, assign DOM-chache="true" only when the dialog is openend and remove it again once the dialog is closed.
2 override JQM
I had the same problem you described and got it to work like this (requires hacking into JQM though...):
// inside transitionPages function
if ( !$(toPage).jqmData('internal-page')
{fromPage.data( "page" )._trigger( "hide", null, { nextPage: toPage } );}
}
My problem was that pagechanging to certain pages (same as dialog) caused the preceding page (where the dialog fired from) to be removed from the DOM, so I had a blank screen (when trying to go back). I added data-internal-page="true" to the pages, which should keep the preceding page intact and added the if-clause in JQM.
So now pageHide (and DOMcleanup) only fires, if I'm not going to a page labelled with data-internal-page="true"
Cheers!
I think I was having a similar problem. What I wanted to do was based on certain parameters, pop a dialog window on load (with that content on the same page), which they can close and view the page that loaded.
I could get it to pop on load using load, or the pageshow events, but when I clicked close that sent you back to the previous page in history, instead of just closing the dialog.
//target your 1st page content, here its id=success
//the modal content is in a page id=dialog and data-role="dialog"
$('#success').live('pageshow',function(){
window.setTimeout(function(){
$.mobile.changePage('#dialog','pop',false,false);
},1);
}
Its a hack, and just allows the page load to beat the dialog so it gets stuck in history. Then the default dialog close behavior for the dialog works as expected. Talk about a PITA, if they took a little more for the JQuery UI dialog it would have made things a ton easier.
And regarding your question: Have you looked at Jquery Mobile Actionsheet plugin
If you don't really require a page to be loaded, that should be ok.
Also helpful could be Cagintranet iPad popover, although you have to tweak the design to be fullscreen on mobile devices. If you require CSS/Jquery to do that let me know (I'm using this in a JQM plugin I'm writing)
Hope that helps.

Resources