How to ignore cHash when working with urls that contain an id? - typo3

The website that I'm working on uses cooluri to format the urls. In the case of news, the "parameters" column of the "link_cache" table stores the parameters like this:
a:3:{s:5:"cHash";s:32:"eea2db734d63b661abaab43d86fd3bb5";s:2:"id";s:5:"15503";s:18:"tx_ttnews[tt_news]";s:6:"142085";}
, or in a more readable way:
{
"cHash":"eea2db734d63b661abaab43d86fd3bb5",
"id":"15503",
"tx_ttnews[tt_news]":"142085"
}
My problem is, that there are lots of pages where these urls are inserted in content elements like in the example below, and ofcourse the cHash parameters don't match.
website.com/news/some-title/431731b3f9d391a54c9ee48467ca4bb4.html
Now because of this I get the following error message on the news single view page:
no news_id given
Is there a clean way to solve this issue? I was told that changing the links in the backend is not an option. Also, the links are very old, and the option "oldlinksvalidfor" is set to 365.

Your configuration goes in the block. Here is a configuration for Ext:CoolUri. This working fine for me (with tt_news) this will remove cHash from the URL. You have an additional configuration for managing caching and all.
<predefinedparts>
<part>
<parameter>no_cache</parameter>
</part>
<part>
<parameter>cHash</parameter>
</part>
<!-- common patterns -->
<!-- parts defined this way will be removed from URL -->
<part>
<parameter>paramC</parameter>
</part>
<!-- this will prefix a value with "prefix-". Cannot be localized.
-->
<part key="prefix-(.*)" regexp="1">
<parameter>paramD</parameter>
</part>
<part key="page-(.*)" regexp="1">
<parameter>array[k5]</parameter>
</part>
<!-- if parameter matches value, key will be added to URL
with mutliple values, use valuemaps
-->
<part key="thisWillAppearInUrl">
<parameter>paramE</parameter>
<value>ifParamEMatcesThisValue</value>
</part>
</predefinedparts>
Hope this will helpful to you.
Greetings!

Related

Accessing DOM element with namespace in Freemarker template

I have the following XML
<wmi xmlns="http://www.exmple.com/XMLSchema/fulfillment/v1/order/orderShipment" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/XMLSchema/fulfillment/v1/order/orderShipment OrderShipmentNotification.xsd">
<wmiHeader>
<fileID>693401.20160229.130342.3541254</fileID>
<version>2.0.0</version>
<messageType>FSN</messageType>
<genDate>2016-02-29T13:03:42Z</genDate>
<from>
</from>
</wmiHeader>
<orderShipNotification>
<shipmentHeader dateTimeCreated="2016-02-29T13:03:42Z" requestNumber="2574445351883" />
<shipmentDetails actualShipmentDateTime="2016-02-29T12:18:54Z" carrierCode="XX" carrierMethodCode="XX-01">
<shipmentPackDetails trackingNumber="9361289672090007124848" trackingURL="https://example.com/go/TrackConfirmAction_input?qtc_tLabels1=323434">
<shipmentPackLineDetails requestLineNumber="1" partnerItemID="FXT-CC-LB" itemQtyShipped="1" />
</shipmentPackDetails>
</shipmentDetails>
</orderShipNotification>
</wmi>
I am getting error in Freemarker template when I am trying to access.
${orderShipNotification.shipmentDetails.#actualShipmentDateTime[0]!""}
If I delete the namespaces from the document it is working fine. I deleted the following content from the XML
xmlns="http://www.exmple.com/XMLSchema/fulfillment/v1/order/orderShipment" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/XMLSchema/fulfillment/v1/order/orderShipment OrderShipmentNotification.xsd"
I did some investigation. The is a ftl directive. But it is still not clear how this will solve the problem. Please let me know how I can access the attributes.
http://freemarker.incubator.apache.org/docs/ref_directive_ftl.html#ref.directive.ftl
Start the template with
<#ftl ns_prefixes={"D":"http://www.exmple.com/XMLSchema/fulfillment/v1/order/orderShipment"}>
This sets the namespace as the default (D stands for default). Note that if you will also use XPath queries, there you will have to write out the D: before the element names (this is an XPath restriction).
This is documented here: http://freemarker.org/docs/xgui_imperative_learn.html

Xforms checkbox - replacing True / False with Y / N

I am writing a form (betterFORMs/Xforms) to be displayed to the user with a selection of checkboxes.
If a checkbox is empty the form should bind an "N" into the element. When ticked, a "Y".
I realise there are answers to this question already but I have tried all answered solutions with no luck.
The first solution I attempted to use is here - stackoverflow link
(the first solution looks good, but I have had more success with solution 2 as I am not using Orbeon)
The answer given is what I am looking for, but I am having trouble implementing this into my form. I am not using Xhtml or Orbeon and so the binding I use seems to be different to that used in the solution.) I have tried tweaking this code to fit into my form but I get a repetitive error from the xml parser every time I load the page - but it doesn't point me to anywhere related to the new code.
The next solution I have tried is found here - stackoverflow link
This answer has had the best results in my code because the checkbox values change to N when not used and when they are deselected. The problem I have with this solution is that the Y set in the form element is contained in braces - [].
output example:
<addressProof>N</addressProof><other>[Y]</other><otherText>_text_</otherText>
Here is a snippet of my form:
model:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/2002/06/xhtml2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<xsl:output method="xml" />
<xsl:template match="/">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<detail>
<other></other>
<otherText></otherText>
</detail>
</actionform>
</xforms:instance>
<xforms:bind id="other" nodeset="/actionform/detail/other" calculate="choose(. = 'Y', ., 'N')"/>
<xforms:bind nodeset="/actionform/detail/otherBox" relevant="/actionform/detail/other ='Y'" />
</xforms:model>
form:
<div id="formBody"><br />
<xforms:select bind="other" appearance="full" align="right">
<xforms:item>
<xforms:label>Other</xforms:label>
<xforms:value>Y</xforms:value>
</xforms:item>
</xforms:select>
<xforms:input ref="/actionform/detail/otherText">
<xforms:label>Please specify:*</xforms:label>
</xforms:input>
</div>
</xsl:template>
</xsl:stylesheet>
Why does the checkbox value now get set to "[Y]" instead of "Y"? (Could it be something to do with an Array?) Thanks.
PS. I know I could do this using a boolean for each checkbox, with the checkbox value corresponding to the boolean, which in turn updates the bind value. I would rather not have to have a big block of boolean elements and binds as I have a large amount of check boxes. this solution has an example here - stackoverflow link
A select control allows you to select more than one item and I wonder if it is why the XForms implementation you are using is adding square brackets (according to specifications selected values have to be separated by a space character, which is not always very convenient by the way).
I am afraid that XForms 1.1 and XForms 2.0 require to use extra intermediate nodes and bindings. It would be useful to be able to add 2 XPath expressions for bindings: one to convert node value to control value and the other one back from control value to node value.
As a workaround, I use another extension in XSLTForms: XSLT stylesheets for converting instances.
-Alain

CruiseControl.net - configuration of users / email at server level

We have around 50 projects configured in CruiseControl.net, and each is individually configured to send an email out on completion / change / whatever.
Is there any way of configuring the user / email address list at a higher (e.g. server) level? I've searched the documentation, and googled for any clues, but I can't find anything.
I need to update who gets sent emails, and updating 50 files isn't a sustainable or ideal solution!
Thanks.
I'm not sure this the exact case of yours, but might work for you too. I have separated all the email settings into separate file, and then use the include in project configuration.
So it looks sth like this:
File: EmailPublisher.xml
<cb:config-template xmlns:cb="urn:ccnet.config.builder">
<email from="notification#example.com" mailhost="mailhost.example.com" mailport="587" includeDetails="true" mailhostUsername="username"
mailhostPassword="mailPwd" useSSL="TRUE" replyto="admin#example.com">
<description>Sending email notifications</description>
<groups>
<group name="developers">
<notifications>
<notificationType>Failed</notificationType>
<notificationType>Fixed</notificationType>
</notifications>
</group>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
</groups>
<converters>
<regexConverter find="$" replace="#example.com" />
</converters>
<modifierNotificationTypes>
<NotificationType>Failed</NotificationType>
<NotificationType>Fixed</NotificationType>
</modifierNotificationTypes>
</email>
</cb:config-template>
And then in the project configuration in publishers section:
<!-- email publisher -->
<cb:include href="EmailPublisher.xml"/>
The downside is that you need to have the same configuration for each project, or alternatively use several include files (which starts to cause the same issue again).
Anyway, it seems to work for our team rather well.
[EDIT]
You can also go one step further, and for example only include the users list from separate file, and have the notifications settings applied separately for project.
You could use variables/substitutions like this: $(admins), $(programmers), $(ProductAScrumMaster), $(ProductBEntireTeam), $(HolyCrapTheMachineFriedEmailEveryone) and the like. You can append or nest them as well if you need combinations.
This post might be more useful as an example - it has lots more detail: Using dynamic parameters in email publisher subjectSettings block with CruiseControl.Net

How to use the same WSDL message defenitions in multiple functions?

I had some errors about invalid definitions coming from Visual Studio 2010 when trying to call a WSDL defined function. The problem was that you cannot use the same message definition in two seperate functions. So I have to create multiple message definitions while they do the same.
For instance:
<message name="Hi">
<part name="input" type="xsd:string">
</message>
<message name="Say_hi_back">
<part name="return" type="xsd:string">
</message>
<message name="I_hate_you">
<part name="return" type="xsd:string">
</message>
<portType name="DataPort">
<operation name="sayHello">
<input message="tns:Hi"/>
<output message="tns:Say_hi_back"/>
</operation>
<operation name="sayIHateYou">
<input message="tns:Hi"/>
<output message="tns:I_hate_you"/>
</operation>
</portType>
Now calling either one of the functions will give you an error. Unless I add a Hi2 with exactly the same parts and change one of the input messages in the operation definitions to tns:Hi2.
Why is this? It makes no sense. I'm building up a service where I'm going to have to add the customerID to all the functions I'm going to build. One function for getting the appointments, one for the payments, one for all. This means I'm going to have to copy the message definition like 10 times and name them getCustomerID*N*.
Also a lot of times I'm going to have to have multiple input parameters. Say for instance someone wants to have all appointments between date x and date y. (And this goes for all the information that is stored like payments etc.) While I only need one message with an int, a date and a date. I'm going to have to write a huge document.
So my question is if there is any other way to do this. I've only been working with WSDL for two days and those were two days full of problems and deceiving 'victories'. Where you solve one problem only to find out that opened the gate to the next.
Thanks. :)
You are creating a WSDL reflecting an RPC style as evidenced by the 'type' attributes in the message part definitions. I am not entirely sure why this would cause a problem with VS, but the RPC style has gone out of vogue in favor of the document style (the modern versions of some tools have dropped support for RPC altogether).
You may have better results using the document style (document/literal/wrapped is our standard). You can read a little more about style differences here (http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/).
The changes required are not too complex and this site (http://wso2.org/library/knowledge-base/convert-rpc-encoded-wsdl-document-literal-wrapped-wsdl) gives some help, although I think the author flipped his rpc vs literal output definitions in the #Output message section.

Sharepoint 2007 - Custom List provisioning - are List Forms needed at deployment?

I have a feature which is provisioning 1 document library and 2 custom lists. A folder is included for each list containing the schema.xml for that list. Each folder also contains the associated forms (AllItems, DispForm, EditForm, NewForm, etc.). Everything deploys/works correctly but it seems a little redundant having the same forms copied into each list's folder. There is nothing special about these lists - the are basically a default doc library/generic list with additional fields provided through new content types (derived from Item/Document).
As far as I can tell these forms are pretty generic. Are there pre-installed forms that I can reference from my list so I don't have to deploy all of these extra files? Is there any reason I would not want to do this?
Update - moving xml in comment to original question for readability:
<Forms>
<Form Type="DisplayForm" Url="Forms/DispForm.aspx" WebPartZoneID="Main"/>
<Form Type="EditForm" Url="Forms/EditForm.aspx" WebPartZoneID="Main"/>
<Form Type="NewForm" Url="Forms/Upload.aspx" WebPartZoneID="Main"/>
<Form Type="NewFormDialog" Path="EditDlg.htm">
....
There are virtual defaults that are used if you don't specify a concrete page.
All lists use these template defaults unless you use a tool like SharePoint designer to customize the page. Then the template is used to create the concrete page and you can customize the look for a particular list without affecting others.
For my custom definitions, I use
<List>
...
<MetaData>
...
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>
</MetaData>
</List>
If you have no reason to customize the out of the box version of these forms, you can use the virtual form and not deploy copies.