I'm using schedule component of Primefaces 2.2.1. If you decompress primefaces-2.2.1.jar included in your project in /lib, you see a .js file and a .css file for each component of primefaces. In my case, I have schedule.js and schedule.css (placed at primefaces-2.2.1\META-INF\resources\primefaces\schedule). The point is that I have to modify schedule.js to add some functionality. So, I decompress primefaces-2.2.1.jar, modify schedule.js, compress everything again to primefaces-2.2.1.jar an place it again in /lib. Then I run the application and this message is showed to me:
javax.servlet.ServletException: Error loading theme, cannot find "themes/sam/theme.css" resource of "primefaces" library
I can see that the file theme.css is present in primefaces-2.2.1\META-INF\resources\primefaces\themes\sam
And I know that it's possible to change schedule.js and make it work becouse some other user did. You can see it here http://forum.primefaces.org/viewtopic.php?f=3&t=15163&p=80971#p80971
Anybody knows how?
All you have to do is :
1) Install 7-zip
2) Browse the primefaces-2.2.1.jar , copy the relevant js file outside the jar
3) Modify it as you wish
4) Delete the relevant js file from the jar
5) Drag and Drop the modified js file back to the jar
Also , take a look at a similar question :
Customizing event appearance primefaces schedule
Related
I want to make a local HTML application read and update a JSON file and use its content to display HTML content. Alas, I'm stuck at the very first step, as I can't seem to setup any sort of test file that simply notices and reads a JSON file. From what I see online, I need to use other libraries. I attempted to use require.js but I can't make it work and the documentation doesn't help me.
I imported the require.js with a tag and attempt to launch something out of what I got from the documentation, but there's nothing to do. It doesn't look like it's willing to take .json files.
requirejs([
'example'
], function(example) {
const config = require('./config.json')
});
My issue is to get the program to read the file. From there I believe I can make the display of it, but this JS thing is all alien to me.
The recommended way would be to run a web server or use something like Electron and build a desktop app (as #chrisG points out in the comments). But if you wanna do this in the browser without an web server you could do something like:
Run Chrome with the --allow-file-access-from-files (or however you allow local file access in your browser of choice)
Put your JSON in a js file and load it (to just do this you don't need the flag, but if you want to use absolute path you'll need it)
I am working to edit the month view of "The Events Calendar" in Wordpress. I cannot seem to figure out which files contain the relevant markup. The file structure seems to make sense, however, when I edit anything with /month no changes reflect.
The File Structure
Core Plugin Files
.../plugins/the-events-calendar/src/views/
Here we have several folders with the different views. One of which is "month" and, according to the documentation, contains the files I wish to edit.
Theme Files
.../mytheme/tribe-events/
This is the folder the documentation told me to create to place edited templates in.
The Fubar
When i follow the documentation for editing a single event located in /list everything works as expected. All I need to do is create a subfolder in mytheme/tribe-events/list and put a new file within to override the original.
When I repeat these same steps in order to edit a file within /month view things are different. For some reason none of my changes work. Outside of the /month folder in /views there is a month.php file which contains the following...
do_action( 'tribe_events_before_template' );
// Title Bar
tribe_get_template_part( 'month/title-bar' );
// Tribe Bar
tribe_get_template_part( 'modules/bar' );
// - My Custom Code -
write_log('This Log Works');
// Main Events Content
tribe_get_template_part( 'month/content' );
do_action( 'tribe_events_after_template' );
Note: write_log() is a function I use in php for debugging. It's essentially a console.log but appends the data to the end of the error.log file which i have being read by a terminal. I do not believe the issue is with this function as I have tested other methods.
The "month" file echoes my log just fine. However, when I add the same log into any of the files it is pulling from the 'month/' directory I get nothing. I went through every file in the subdirectories and added a log and realized that they all work except any file within /month
I thought maybe the issue was with the plugins' "tribe_get_template_part()" function pointing to the wrong place so I decided to eliminate the "am i making this child plugin right" variables and just start editing the plugin files directly. But I get the exact same behavior. I got so desperate that I deleted the entire /months folder from the plugin and the calendar still worked!
So obviously I am really missing something but currently I am at a loss.
This documentation is what I've been following to figure this out.
https://support.theeventscalendar.com/153124-Themers-Guide
The only thing I can think of at this point is that the javascript templating system built into the plugin is working some hidden magic but the fact that I can delete the entire months folder leaves me at a loss.
For anyone struggling with this still, I also had the same issue and solved it by disabling the Month View Cache under Event Settings > Display. Screenshot:
question reworked for clarity and brevity
I am trying to install the [Slider Revolution][1] plugin on my Rails 4 application and I am having trouble with dynamically created relative paths in the jquery.themepunch.revolution.js file. The javascript snippet that I've placed on the page (as per the docs) sets a parent directory via this code:
jsFileLocation:"../../revolution/js/",
This directory tells the code in jquery.themepunch.revolution.js where to find the "extensions" folder.
But, if I use that bit of js on my page I get this error
Slider Revolution 5.0 Error !
Failure at Loading:revolution.extension.navigation.min.js on Path:extensions/
as the js is telling the browser to search HERE for the file:
http://localhost:5000/revolution/js/extensions/revolution.extension.actions.min.js
when in reality the actual location is something like:
http://localhost:5000/assets/javascripts/plugins/revolution/extensions/revolution.extension.actions.min.js
I've tried setting the js snippet to the following options:
jsFileLocation:"../../assets/",
jsFileLocation:"../../assets/javascripts/",
jsFileLocation:"/assets/",
jsFileLocation:"/assets/javascripts/plugins/revolution/",
jsFileLocation:"/assets/plugins/revolution/",
It still doesn't work.
Please try /assets/plugins/revolution/ as the js location. I am assuming you haven't tried it.
According to Mozilla's pdfjs plugin, I can view my pdfs by passing a query param to viewer.html as shown below:
http://localhost/MyProject/viewer.html/?file=file.pdf
This is working fine. But I have some different kind of requirement. The requirement in my project is that I need to have tabs like feature on a single page. Each tab holds a pdf file.
So, I am thinking to make all the code in the viewer.js to a big function. So that I can use it as constructor to render each pdf file. Something like this:
var firstPdf = new paintPdf({file: 'myfile.pdf'});
Anyway, I decided to do the above changes later when I am able to integrate pdfjs's viewer functionality successfully in my project.
Summary of my project:
Single page application
All templates are being maintained in a single file within an Object of name - templates
To do so, first of all, I copied all the html inside of the body tag of viewer.html and appended as new property to the templates object. and then I copied all necessary and dependency files from the example to my project's folder and loaded them dynamically. The files which I included are:
pdf.js
pdf.worker.js
viewer.js
l10n.js
viewer.css - I am not loading this file dynamically.
After loading of files, I am rendering the viewer.html's template using lodash. Still, I can't able to see the rendered pdf in my project. I suspect this might be because everything is happening dynamically. (but I am not sure because everything is being rendered in sequence as it should be)
Btw, I have added the default pdf with name compressed.tracemonkey-pldi-09.pdf adjacent to index.html file. What could I be missing?
Firefox and chrome doesn't throw any error.
Note: I might be doing in wrong way. Suggesting me to solve in right directions would be appreciable.
Some important points while modifying viewer.js.
It is recommended to build your own viewer.js instead of modifying the available viewer.js file which is actually just for demo purpose.
You can create your own viewer.js file by visiting each js files available here.
If you have only small things to modify in the existing demo viewer.js, then
Mention the exact path for pdf.worker.js file inside your viewer.js.
This file will start rendering pdf on DomContentLoaded event. If you are planning to render the pdf file dynamically later, then you should comment this event register and call the following function whenever necessary.
webViewerLoad();
I hope this will help someone.
I am newby in Spring, but have a task, and I am learning on the fly.
I used Roo to generates for me part of the code, but now I have to make some dynamic list binding, which is done with form, popping-up in new window, and when the submit button is pushed I have to insert the new values in the parent window.
For the purpose I wrote a .js file, which hooks the values to the parent DOM tree, but the point is that I can't configure Spring to deliver the required .js file to the browser.
The browser, doesn't recognize my function. Even when I try to access the .js file via the browser, I receive error that the file couldn't not be found.
I've tried to configure the web.xml, but it didn't work...
Any ideas, how I can configure the access to a .js file in a Spring MVC application?
Thanks a lot!
P.S. Respectively, I'll need to grant access for a static .htm(l) file... I suppose the principle for configuration of the access of static html files is the same..., right?
You just need to get the path to the file right. Assuming you have a Maven-like set-up (I assume you do because you're using Roo), then your script belongs under src/main/webapp - probably in something like a scripts folder.
Let's assume that your file is at src/main/webapp/scripts/myscript.js
You can create a URL reference for your script by adding the following Spring tag:
<spring:url value="/scripts/myscript.js" var="script_url"/>
This should give you the right path to your script, regardless of the context in which you later decide to publish your webapp.
After that, it's just a matter of using that reference:
<script type="text/javascript" src="${script_url}"></script>