Per's answer was a big part of the solution. For completeness here is what I ended up having to do.
First, I had to fix the AMD problem that Per mentioned.
Then I had to modify my Xpage to make sure that the proper libraries were loaded in the proper order. Some of this was done with trial and error.
I had to set the resource aggregation setting to true, but only for this design element. I do not understand why.
Then I needed to add 2 js libraries and one css library. The moment library had to be loaded first and by using a the head tag. Next I had to load the fullcalendar.min.js file but NOT using the headTag but a simple script, and then the css for fullcalendar using the style tag.
Doing this everything worked. Below is the code, and below that is my theme.....
Design code:
<xp:this.properties>
<xp:parameter name="xsp.resources.aggregate" value="true" />
</xp:this.properties>
<div class="cal"></div>
<xp:this.resources>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="FullCalendar/moment.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:script src="FullCalendar/fullcalendar.min.js"
clientSide="true">
</xp:script>
<xp:styleSheet href="FullCalendar/fullcalendar.min.css"></xp:styleSheet>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[$(document).ready(function() {
var calCon = $(".cal");
calCon.fullCalendar({});
})]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
Theme code:
<!--
Use this pattern to include resources (such as style sheets
and JavaScript files that are used by this theme.
-->
<theme
extends="Bootstrap3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.stylekits/schema/stylekit.xsd">
<resource>
<content-type>application/x-javascript</content-type>
<href>/.ibmxspres/domino/KendoUI/js/jquery.min.js</href>
</resource>
--><resource>
<content-type>text/css</content-type>
<href>/.ibmxspres/domino/KendoUI/styles/kendo.common.min.css</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>/.ibmxspres/domino/KendoUI/styles/kendo.blueopal.min.css</href>
</resource>
<resource>
<content-type>application/x-javascript</content-type>
<href>/.ibmxspres/domino/KendoUI/js/kendo.all.min.js</href>
</resource>
</theme>
==================================================================
I want to use FullCalendar in my Xpages applications.
This code will work, as long as I don't use my standard theme. So "webstandard" and "platform default" are no problem, but Bootstrap doesn't work, nor my theme which extends bootstrap (see below)
<theme
extends="Bootstrap3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.stylekits/schema/stylekit.xsd">
<resource>
<content-type>application/x-javascript</content-type>
<href>/.ibmxspres/domino/KendoUI/js/jquery.min.js</href>
</resource>
--><resource>
<content-type>text/css</content-type>
<href>/.ibmxspres/domino/KendoUI/styles/kendo.common.min.css</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>/.ibmxspres/domino/KendoUI/styles/kendo.blueopal.min.css</href>
</resource>
<resource>
<content-type>application/x-javascript</content-type>
<href>/.ibmxspres/domino/KendoUI/js/kendo.all.min.js</href>
</resource>
</theme>
When I try to use my theme I get this error:
Uncaught TypeError: calCon.fullCalendar is not a function
I tried putting the js/css that I need to use in my theme, in the order that they need to be used, but this didn't work either.
I use the scoBootstrap throughout many applications, and don't want to not use it in applications that need a calendar. There must be some way for my javascript to live together...
Here is the code for the Xpage:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.properties>
<xp:parameter name="xsp.resources.aggregate" value="true" />
</xp:this.properties>
<div class="cal"></div>
<xp:this.resources>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="KendoUI/js/jquery.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="FullCalendar/moment.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="FullCalendar/fullcalendar.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="FullCalendar/fullcalendar.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:styleSheet href="FullCalendar/fullcalendar.min.css"></xp:styleSheet>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[$(document).ready(function() {
var calCon = $(".cal");
calCon.fullCalendar({});
})]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
FullCalendar uses AMD loading. Dojo and AMD loading conflicts so remove the AMD part from fullcalendar.min.js.
Change the first part of the source from this:
!function(t){"function"==typeof define&&define.amd?define
to this:
!function(t){"function"==typeof define&&false?define
Related
I want to add a upload button the start-workflow page and for that i need to add upload component xml tags as follows in template instance:
<component>
<region-id>html-upload</region-id>
<url>/components/upload/html-upload</url>
</component>
<component>
<region-id>flash-upload</region-id>
<url>/components/upload/flash-upload</url>
</component>
<component>
<region-id>file-upload</region-id>
<url>/components/upload/file-upload</url>
</component>
<component>
<region-id>dnd-upload</region-id>
<url>/components/upload/dnd-upload</url>
</component>
<component>
<region-id>archive-and-download</region-id>
<url>/components/download/archive</url>
</component>
Why you wanted to add a upload button to the start-workflow page alfresco OOTB provides the workflow package you can attach your documents here.
You just need to define it in share config
<config evaluator="string-compare" condition="activiti$submitDocument">
<forms>
<form>
<field-visibility>
<show id="packageItems" />
</field-visibility>
<appearance>
<set id="general" appearance="title" label-id="workflow.set.other" />
<field id="packageItems" set="general" label="Purchase request document">
<control template="/org/alfresco/components/form/controls/workflow/packageitems.ftl">
</control>
</field>
</appearance>
</form>
</forms>
</config>
and you can get all the attached document using javascript
var documents = bpm_package.children;
It was as simple and obvious as it could have been. All you need to do is create a file named start-workflow.xml in the directory src/main/resources/alfresco/web-extension/site-data/template-instances. Then just copy paste the original file and add your components. This isn't enough in itself. You also have to add regions of these components to the template of start-workflow. Again, a simple process. Create a file start-workflow.ftl in the directory src/main/resources/alfresco/web-extension/site-data/templates/org/alfresco. Once again copy paste the original file and add your regions. In my case it was :
<#region id="html-upload" scope="template"/>
<#region id="flash-upload" scope="template"/>
<#region id="file-upload" scope="template"/>
<#region id="dnd-upload" scope="template"/>
<#region id="archive-and-download" scope="template"/>
I need to hide custom workflow list for folders/documents present in " MyFiles " and other sites areas.Doing that from "show-site-workflow-modules.xml " with this configuration(code below), hides workflows from "workflows that I have started" also,which is terribly wrong.
<module>
<id>General_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>.*</sites>
<sitePresets>.*</sitePresets>
<applyForNonSites>true</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all Custom workflows -->
<workflow name="customactiviti$xxxx" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<task type="customwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>
<module>
<id>xxx_Conditional_Workflow</id>
<description>Applies config based on site id</description>
<evaluator type="site.module.evaluator">
<params>
<sites>xxx-xxx-xxx</sites>
<applyForNonSites>false</applyForNonSites>
</params>
</evaluator>
<configurations>
<config evaluator="string-compare" condition="Workflow" replace="true">
<!-- A list of workflow definitions that are NOT displayed in Share -->
<hidden-workflows>
<!-- Hide all WCM related workflows -->
<workflow name="activiti$activitiAdhoc" />
<workflow name="activiti$activitiInvitationModerated" />
<workflow name="activiti$activitiInvitationNominated" />
<workflow name="activiti$activitiInvitationNominatedAddDirect" />
<workflow name="activiti$activitiParallelGroupReview" />
<workflow name="activiti$activitiParallelReview" />
<workflow name="activiti$activitiReview" />
<workflow name="activiti$activitiReviewPooled" />
<workflow name="activiti$publishWebContent" />
</hidden-workflows>
<!-- A list of workflow tasks that are NOT displayed in Share -->
<hidden-tasks>
<!-- Hide all WCM related tasks -->
<task type="wcmwf:*" />
</hidden-tasks>
</config>
</configurations>
</module>
I'd like to use fullCalendar in my xpage. It works with fullCalendar 1.6.7, not with 2.2.5 (nothing is displayed).
The sources are copied in package Explorer. This code works with the 1.6.7 sources:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:styleSheet href="fullcalendar/fullcalendar.css"></xp:styleSheet>
<xp:script src="js/jquery.min.js" clientSide="true"
type="text/javascript"></xp:script>
<xp:script src="fullcalendar/fullcalendar.min.js"
clientSide="true" type="text/javascript"></xp:script>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[var calCon = $("[id$=CalendarContainer]");
calCon.fullCalendar({});]]></xp:this.value>
</xp:scriptBlock>
The following code doesn't work with the 2.2.5 sources:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.resources>
<xp:styleSheet href="fullcalendar/fullcalendar.min.css"></xp:styleSheet>
<xp:script src="js/moment.min.js" clientSide="true"
type="text/javascript"></xp:script>
<xp:script src="js/jquery.min.js" clientSide="true"
type="text/javascript"></xp:script>
<xp:script src="fullcalendar/fullcalendar.min.js"
clientSide="true" type="text/javascript"></xp:script>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[var calCon = $("[id$=CalendarContainer]");
calCon.fullCalendar({});]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
Any ideas?
Mark is right, You need to load the libraries before dojo
Here is the working code
<div class="cal"></div>
<xp:this.resources>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="jquery-2.1.3.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="moment.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:headTag tagName="script">
<xp:this.attributes>
<xp:parameter name="type" value="text/javascript" />
<xp:parameter name="src" value="fullcalendar.min.js" />
</xp:this.attributes>
</xp:headTag>
<xp:styleSheet href="fullcalendar.min.css"></xp:styleSheet>
</xp:this.resources>
<xp:panel id="CalendarContainer"></xp:panel>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[var calCon = $(".cal");
calCon.fullCalendar({});]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
I think that FullCalender started using an AMD loader for their JavaScript in v2. That doesn't play well with Dojo in XPages. See my answer here for more details and a possible solution.
The problem is - like Mark mentioned - that the current version uses AMD to load another library called "moment". This can be examined in the uncrompressed version of the fullcalendar.js file at the beginning. I made it working like this:
Create a theme and load all the resources there like
<theme
extends="yeti"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="platform:/plugin/com.ibm.designer.domino.stylekits/schema/stylekit.xsd">
<resource>
<content-type>application/x-javascript</content-type>
<href>bower_components/moment/moment.js</href>
</resource>
<resource>
<content-type>application/x-javascript</content-type>
<href>bower_components/fullcalendar/dist/fullcalendar.js</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>bower_components/fullcalendar/dist/fullcalendar.min.css</href>
</resource>
OR
load the moment.js also in your page resources separately.
Then open the fullcalendar.js file and edit the top of the code as follows (check the comments I made):
/*!
* FullCalendar v2.2.5
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/
(function(factory) {
/*
if (typeof define === 'function' && define.amd) {
define([ 'jquery', 'moment' ], factory);
}
else {
*/
factory(jQuery, moment);
//}
})(function($, moment) {
;;
I used the uncompressed version here to find the code but the compressed one is not such as obfuscated, so you should be able to add those comments there, too.
EDIT
I just saw Thomas' answer - that's the most elegant way to do it :-)
I want to have log messages from each log level go to a different file. From the name, LevelMatchFilter seems like what I want, except it seems to not filter anything from a different level.
I think the following properties should do that using LevelRangeFilter. However, anything sent to the global logger ends up in INFO.log, regardless of the level.
log4j.rootLogger = OFF
# Global level based logs
log4j.logger.global = ALL, Info
log4j.appender.Info=org.apache.log4j.FileAppender
log4j.appender.Info.File=Logs/INFO.log
log4j.appender.Info.layout=org.apache.log4j.PatternLayout
log4j.appender.Info.layout.ConversionPattern=%d [%p] %m%n
log4j.appender.Info.filter.a=org.apache.log4j.filter.LevelRangeFilter
log4j.appender.Info.filter.a.LevelMin=info
log4j.appender.Info.filter.a.LevelMax=info
log4j.appender.Info.filter.a.AcceptOnMatch=true
I also tried using INFO for the values of LevelMin and LevelMax but that had the same results.
What am I doing wrong?
As a side question, is there a way to turn on debugging of the log4cxx configuration when using a property file? I found an option when using an xml file, but none of the obvious translations to properties (debug=true, log4j.debug=true) and any effect.
As of log4cxx 0.10 (and probably earlier), the properties format does not support filters. So the XML configuration (or programmatic configuration) is required.
<?xml version="1.0" encoding="UTF-8" ?>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<appender name="Info" class="org.apache.log4j.FileAppender">
<param name="file" value="Logs/INFO.log" />
<param name="append" value="false" />
<!-- If this filter accepts the message, it will be printed. That happens if this is an info message -->
<filter class="org.apache.log4j.filter.LevelMatchFilter">
<param name="levelToMatch" value="INFO" />
<param name="acceptOnMatch" value="true" />
</filter>
<!-- If it is not an info message, this filter will reject it -->
<filter class="org.apache.log4j.filter.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%p] %m%n" />
</layout>
</appender>
<root>
<priority value="off" />
</root>
<logger name="global">
<priority value="all" />
<appender-ref ref="Info" />
</logger>
</log4j:configuration>
I have a main application which is referencing to 4-5 external jar files. So while compiling the project netbeans ide(javafx application) takes long time. Therefore I want to design a splash screen and which will be displayed till all jars gets loaded.
My JNLP file is
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="Black.jnlp">
<information>
<title>Black</title>
<vendor>RATTAN</vendor>
<description>Sample JavaFX 2.0 application.</description>
<offline-allowed/>
</information>
<resources>
<jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Black.jar" size="3393158" download="eager" />
<jar href="lib/commons-io-1.3.2.jar" size="95655" download="eager" />
<jar href="lib/commons-lang-2.0.jar" size="179420" download="eager" />
<jar href="lib/newlink.jar" size="6160" download="eager" />
<jar href="lib/scribe-1.3.0.jar" size="74543" download="eager" />
</resources>
<security>
<all-permissions/>
</security>
<applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="Black" >
<param name="requiredFXVersion" value="2.2+"/>
</applet-desc>
<jfx:javafx-desc width="800" height="600" main-class="test.Test" name="Black" />
<update check="always"/>
</jnlp>
Use preloaders module from JavaFx
here is complete tutorial:
http://docs.oracle.com/javafx/2/deployment/preloaders.htm
Good luck,'.