sitemesh excludes having no effect - sitemesh

I am replacing a GUI based on RForms with one based on GWT and I want to keep the RForms one available for fiddling with test data until the GWT UI is ready to take over. (This is probably not important to my question, I just wanted to give an idea of WHY I'm doing what might appear to be a bit of a silly thing).
I'm using Sitemesh to wrap my GWT GUI in a header and footer which is common to the rest of the system. Unfortunately if Sitemesh gets its paws on the RForms GUI, the styling breaks the functionallity of the page and the RForms GUI becomes unusable.
I have tried to solve this by setting up SiteMesh to exclude the URLs on which the RForms GUI is served, but it doesn't seem to be working, no matter what I do I either get all pages decorated or none. My Sitemesh setup is as follows:
Sitemesh.xml
<sitemesh>
<property name="decorators-file" value="/WEB-INF/decorators.xml"/>
<excludes file="${decorators-file}"/>
<property name="excludes-file" value="/WEB-INF/sitemesh-excludes.xml"/>
<excludes file="${excludes-file}"/>
<page-parsers>
<parser content-type="text/html"
class="com.opensymphony.module.sitemesh.parser.HTMLPageParser"/>
<parser content-type="text/html;charset=ISO-8859-1"
class="com.opensymphony.module.sitemesh.parser.HTMLPageParser"/>
</page-parsers>
<decorator-mappers>
<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
<param name="config" value="${decorators-file}"/>
</mapper>
</decorator-mappers>
</sitemesh>
decorators.xml
<decorators defaultdir="/decorators">
<decorator name="main" page="main.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
sitemesh-excludes.xml
<decorators>
<excludes>
<pattern>/*/hostedmode.*</pattern>
<pattern>/*/download.*</pattern>
<pattern>/list/*</pattern>
<pattern>/entity/*</pattern>
<pattern>/rest/*</pattern>
<pattern>/dwr/*</pattern>
</excludes>
</decorators>
This setup results in all pages being decorated regardless of the excludes file. I have also tried putting the excludes in the same file as the decorators, with the same result. I'm sure I'm doing something stupid, but I can't see it, can anyone explain to me how to prevent sitemesh from decorating specific url patterns?

Related

QuickLink in UML Profile not displaying in Sparx enterprise Architect

I am trying to add a new item to the 'quick link' menu in Sparx Enterprise Architect.
I have followed the instructions on the EA website:
http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/add_quick_linker_definition_to.html
and in despiration I have also tried a vanilla copy of the example from http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/quick_linker_example.html
I have a new profile with a new stereotype of 'quick' which extends the metaclass 'Class'. I have added a 'QuickLink' artefact and copied the below entries into it (from the example above):
Class,quick,,,,Component,,Dependency,,to,,Dependency to,TRUE,TRUE,TRUE,TRUE,Component,0,,,,,
Class,quick,,,,Component,,Dependency,,from,,Dependency from,TRUE,TRUE,TRUE,TRUE,Component,0,,,TRUE,,
Class,quick,Component,,,,,Dependency,,to,Dependency to,,TRUE,,TRUE,TRUE,,0,,,,,
Class,quick,Component,,,,,Dependency,,from,Dependency from,,TRUE,,TRUE,TRUE,,0,,,TRUE,,
Class,quick,Port,,,,,Dependency,,to,Dependency to,,TRUE,,TRUE,TRUE,,0,,,,,
Class,quick,Port,,,,,Dependency,,from,Dependency from,,TRUE,,TRUE,TRUE,,0,,,TRUE,,
Class,quick,Component,,,Port,,Dependency,,to,,Dependency to,TRUE,TRUE,TRUE,TRUE,Port,0,,TRUE,,,
Class,quick,Component,,,Port,,Dependency,,from,,Dependency from,TRUE,TRUE,TRUE,TRUE,Port,0,,TRUE,TRUE,,
I have then saved the UML Profile and generated an MDG from it. I have looked in the profile.xml and MDG xml files and in both cases the CSV information appears as I would expect in the QuickLink element:
e.g.
When I import the MDG, I can create a new diagram, the correct toolbox appears with my 'quick' stereotype on it. When I drag it onto the diagram however and try to create new links, the quicklinks menu is not showing any of my customisations.
Is there anythink I am missing here to make this work?
The problem doesn't appear to be the quicklinker definition. I have created a working technology using that definition (below).
It is likely that the problem is with the way the technology has been put together, rather than the quicklinks themselves. Hopefully you can see what is different by comparing this to your technology. If not then post your technology and I will take a look.
<?xml version="1.0" encoding="windows-1252"?>
<UMLProfile profiletype="uml2">
<Documentation id="C5186393-D" name="MyProfile" version="1.0" notes="MyProfile"/>
<Content>
<Stereotypes>
<Stereotype name="quick" notes="">
<AppliesTo>
<Apply type="Class">
<Property name="isActive" value=""/>
</Apply>
</AppliesTo>
</Stereotype>
</Stereotypes>
<TaggedValueTypes/>
<QuickLink data="Class,quick,,,,Component,,Dependency,,to,,Dependency to,TRUE,TRUE,TRUE,TRUE,Component,0,,,,,
Class,quick,,,,Component,,Dependency,,from,,Dependency from,TRUE,TRUE,TRUE,TRUE,Component,0,,,TRUE,,
Class,quick,Component,,,,,Dependency,,to,Dependency to,,TRUE,,TRUE,TRUE,,0,,,,,
Class,quick,Component,,,,,Dependency,,from,Dependency from,,TRUE,,TRUE,TRUE,,0,,,TRUE,,
Class,quick,Port,,,,,Dependency,,to,Dependency to,,TRUE,,TRUE,TRUE,,0,,,,,
Class,quick,Port,,,,,Dependency,,from,Dependency from,,TRUE,,TRUE,TRUE,,0,,,TRUE,,
Class,quick,Component,,,Port,,Dependency,,to,,Dependency to,TRUE,TRUE,TRUE,TRUE,Port,0,,TRUE,,,
Class,quick,Component,,,Port,,Dependency,,from,,Dependency from,TRUE,TRUE,TRUE,TRUE,Port,0,,TRUE,TRUE,,
"/>
</Content>
</UMLProfile>

Extending language definitions (for code highlighting) in notepad++

I've been doing development in TWIG lately. It is an html templating language that is very simple and robust.
I've set notepad++ to automatically treat .twig files as html. This is ok, but I don't get any syntax highlighting on my twig functions.
The twig syntax is incredibly simple (by design) and would be easy to add to notepad++. The problem is, everything I find on this subject is either about creating a new language definition (and I do not want to reinvent the html definition), or modifying the color for existing syntax bits in a language.
Is there any way to copy a language definition and then modify it in notepad++? If not, is there any way in notepad++ to add extra syntax bits to an existing language definition?
edit
TWIG is an html template language/engine. they syntax for it is the same as html, with the addition of a few open/close tags (specifically {% %}, {{ }}, and {# #}) for control statements. you can read more about it at the twig website
edit #2
Based on the answer from Brian Deragon, I have been investigating 3 files. Heres what I've figured out/done so far:
\plugins\APIs\html.xml - Seems to define keywords, for autocomplete. I made a copy of the file named twig.xml
langs.model.xml - Again, a list of keywords, with all the languages in 1 XML file. I copied the HTML object and replaced the name and ext parameters with twig.
stylers.model.xml - Has a list of different items, and style information (color, bg color, font, etc) for each. I copied the HTML section and changed the name and desc parameters to twig.
Those changes done, I opened up a twig file in notepad++, hoping to see it listed in the language options. Sadly, it has not appeared, leading me to believe that some of this is hard coded (and thus what I want might not be possible).
The stylers.model.xml is interesting, though. Each entry has a bunch of items, defined like this:
<LexerType name="twig" desc="TWIG" ext="">
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
<WordsStyle name="COMMENT" styleID="9" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="TAG" styleID="1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="TAGEND" styleID="11" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
...
</LexerType>
Those seem to be where the styles are defined for the different elements. I can't find anywhere where those elements are defined though. langs.model.xml has a definition for comment start/end, but not for any other delimiters. what I really need is a place to tell notepad++ to treat { } as a delimiter, much like it does for < > now.
edit #3
I am also looking at this list of user defined languages for notepad++ http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=User_Defined_Language_Files
User defined languages use a different engine, but i might be able to find one in there that is similar to html enough that I can adapt it.
You should be able to just copy and edit the XML definition file (html.xml); as long as you don't need stuff beyond the basics, like code-folding, advanced coloring based off of case-handling blocks or multiple conditionals, separate formatting for lead characters, label coloring, xml-based commenting, language mixing (coloring of embedded scripts), support for coloring of duck-types, etc. If you need anything "advanced" you need to write your own lexer, in which case most of the below applies.
Even still, the templates I listed below should give you a head-start on your own language definition file.
As far as I'm aware, Notepad++ uses Scintilla Lexers for determining its code rules.
You'll have to create your own lexer, but...the HTML Scintilla Lexer is already included in the Scintilla source code.
Then you would insert your custom lexer using a plug-in, like Gary's Lua Highlighter Plugin.
Resources for building a custom lexer:
How to write a scintilla lexer
That being said, Geany is very similar to Notepad++ (based off the same engine, Scintilla), so you might want to see whether it's already been done for Geany, or whether there's an open-source project for it in the works. This would at least give you a head start.
If that doesn't help, there are IDEs and editors with Twig support built-in, like:
Eclipse
Netbeans
GEdit (which has a Windows binary, if needed)
JetBrains PhpStorm
GEdit has published their XML definition of the language here, which might help as a reference when creating your own definition file or lexer; there's also another template published by the guys from Twig here that might be of some help.
Here are the best Notepad++-specific tutorials for creating custom lexer's/User Defined Languages I can find:
User Defined Languages
How to create a user-defined language in Notepad++ based on an existing language?
If you want to get brave and build your own Scintilla dll, reference these threads, to see a guy who got it working, and to show up in the language list (use the previous/next thread message to see responses, or the thread index; it's a mailing list, so its UI isn't the best)
http://osdir.com/ml/editors.notepad++/2007-02/msg00021.html
Hope that helps or gets you at least more of a head start!
I made a Highlighter for it here:
https://github.com/Banane9/notepadplusplus-twig
Possible duplicate of this post: https://superuser.com/questions/40876/assigning-custom-extensions-to-a-languages-syntax-highlighting-in-notepad
All you need to do is add your custom extension in Settings->Style Configurator
Click on HTML and add your extension in the User Ext box.
EDIT: If you want to add more rules to your language, you might have to add another XML in notepad++->plugins->APIs
If you think it's like HTML, just copy over html.xml and save as twig.xml
Add more rules to this XML file

when customer login my related and upsells not display

I have a problem with my related and upsells.
When a customer login, my related and upsells not display in product_view.
The three most likely ways in which this can happen involve the following:
Layout XML
PHP/PHTML
CSS
Layout XML: grep your layout xml for <customer_logged_in> and see if there are any <remove /> nodes referring to these blocks. Also check for <action> tags with unsetChild method calls that refer to these blocks.
PHP/PHTML: It's possible that the templates and class definitions for these blocks have had logic added to them to check for customer logged in state. This would be an inefficient way to accomplish this, but it's possible. You'll need to check the templates (google for Magento template path hints) and the block classes in which they are rendered; see if they have been customized.
CSS: This is the most unlikely candidate, but I've seen developers set display:none based on <body> classes added via layout XML. This could be seen as an addBodyClass call in the <customer_logged_in> layout update handle, which I described how to find above.

collective.xdv and multiple theme files

I am having different theme HTML files for different site sections. There are some major layout differences depending if the page is the front page, or a certain subsection.
As far as I see the default behavior is just to have one HTML file:
http://pypi.python.org/pypi/collective.xdv#usage
What would be the best strategy to use multiple theme files, slight rule variations and collective.xdv?
Plone 4.1b.
We usually just utilize plain xdv and use the rules.xml (or whatever you want to call it) file to setup the theme templates leaving the corresponding properties in the collective.xdv controlpanel empty. Nesting rules gives you quite some fexibility when asigning different templates:
<?xml version="1.0" encoding="UTF-8"?>
<rules xmlns="http://namespaces.plone.org/xdv"
xmlns:css="http://namespaces.plone.org/xdv+css"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<theme css:if-content="body.section-front-page" href="frontpage.html" />
<theme css:if-path="/section/subsection/somefolder" href="somefolder.html" />
...
<rules css:if-content="#visual-portal-wrapper">
<!-- The default theme -->
<theme href="theme.html" />
<rules css:if-content="body.section-somefolder">
<!-- Secific rules for somefolder go here -->
...
</rules>
</rules>
You should use the Alternate Themes settings to define alternative layouts when the url matches a specific regular expression.
For example, we have a Plone site named "Plone" and accessible at url localhost:8080/Plone. To provide a different layout for the Home page, we can define the following in the registry (or TTW in the Plone Control Panel > XDV Settings section):
<record field="alternate_themes" interface="collective.xdv.interfaces.ITransformSettings" name="collective.xdv.interfaces.ITransformSettings.alternate_themes">
<field type="plone.registry.field.List">
<description>Define alternate themes and rules files depending on a given path. Should be of a form 'path theme rules' (or 'path rules' with xdv 0.4), where path may use a regular expression syntax, theme is a file path or URL to the theme template and rule is a file path to the rules file.</description>
<required>False</required>
<title>Alternate themes</title>
<value_type type="plone.registry.field.TextLine">
<title>Theme</title>
</value_type>
</field>
<value>
<element>^.*/Plone(/)?$ python://my.xdvtheme/templates/alternative/index.html python://my.xdvtheme/rules/alternative/index-rules.xml</element>
</value>
</record>
This way, the home page will use the alternative layout, while all the other pages will use the main layout specified in Theme template and Rules template
You can provide multiple definitions according to the different sections of your site.
My personal Plone site uses different theme and rules files for different parts.
Are you using the XDV control panel at /##xdv-settings?
In the Theme template and Rules File fields I put my default (i.e most used) files.
In the Alternate Themes textbox you can then provide alternate theme and rules files depending on a given path.
The format is path theme rules.
Here are some examples from my website's config:
.*/login_form|.*logged_out
/home/zope/production/theme/theme.html
/home/zope/production/theme/login.xml
/media/blog$
/home/zope/production/theme/blog.html
/home/zope/production/theme/blog.xml
/media/software
/home/zope/production/theme/software.html
/home/zope/production/theme/media.xml
As you can see, you can use regular expression syntax to match the paths.
The first line is for styling the login and logout pages.
The second for styling only my blog's landing page (henche the $)
the third styles my software page.
Works like a charm.

Struts2 sx:div with Timer ignoring preload="true"

I have the following refreshing timer:
<s:url id="getDeployQueue" action="deploymentQueue" >
<s:param name="readonly" value="readonly" />
</s:url>
<sx:div id="deploymentQueue" href="%{#getDeployQueue}" errorText="Oh wait, I couldn't get the queue right now!"
formId="queueForm" executeScripts="false" preload="true" listenTopics="refreshqueue"
autoStart="true" updateFreq="8000" startTimerListenTopics="/startDeployQueue" stopTimerListenTopics="/stopDeployQueue" />
The problem I have is that it waits 8000 millis before loading the content even though I have preload="true". After this it functions as I would expect, reloading the content every 8000 millis. Removing updateFreq="8000" causes the div to preload correctly but then my timer does not start.
Is this expected behaviour? If so is there a workaround?
I used to get around this by embedding html inside the sx:div tag, but Firefox 3.5 now throws security errors with this approach due to the the html containing a form, and the ajax trying to write over the top of it.
Seem like nobody has an answer, I worked around this with the following
<sx:div id="combinedQueue" href="%{#getCombinedQueue}" errorText="Awww Snap I can't get the queue" formId="queueForm" executeScripts="false"
autoStart="false" updateFreq="15000" preload="false" showLoadingText="false" listenTopics="refreshqueue" startTimerListenTopics="/startDeployQueue" stopTimerListenTopics="/stopDeployQueue">
<noscript>
<tiles:insertAttribute name="queue" />
</noscript>
<!-- Preload the deployment queue, this is done to avoid security precautions new to firefox 3.5 -->
<sx:div id="combinedQueuePreload" href="%{#getCombinedQueue}" errorText="Awww Snap I can't get the queue"
executeScripts="false" preload="true" showLoadingText="false" afterNotifyTopics="/startDeployQueue" />
</sx:div>
It seemed to be failing with a security exception in the latest firefox. I worked around it by duplicating my code :(. I preload with the nested sx:div and when that is finished it notifies the div with a timer to start. Very strange.
Without using trick, you can use the Struts2 jQuery Plugin, you just need to import the library and to change your tag from sx: to sj:
An example here

Resources