Extension to the page icon status in SDL Trdidion 2009 - tridion

We are using SDL Tridion 2009 SP1.
We have implemented a new functionality, an extension in our CMS which allowed us to lock a page.
If a page it is locked it cannot longer be published ( the information of a page that is locked is kept in a database which was created for this extension).
We want to add a new icon which will notify the user on the new status of the page.
Now there are 4 combination of icons ( no action , checked , published , checked and published )
Since I do not have a long experience with the CMS interface I want some help on finding a solution that have no impact on performance and
that it easy to implement in terms of not doing of lot of modification.
Below is my investigation regarding this:
I noticed that the way the icons are render in the cms is not a simple mechanism that can be easy updated.
Each time we click on an item in the left side of the CMS, in order to render the list from the right side a ajax call (with an xml request) is done to the WebGUIResponder.aspx. page.
The response we will get back is a xml that contain the attribute field Icon
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0"
ID="tcm:yyy-zzzz-4" Managed="68" ItemType="4">
<tcm:Item ID="tcm:yyy-zzzzz-64" Type="64" Title="NotificationTest"
Modified="2011-05-09T09:42:27" FromPub="400 YYYY Website Master (EN-GB)"
IsNew="false" Icon="T64L0P1"/>
</tcm:ListItems>
Based on this field Icon attribute (Icon="T64L0P1) the image name starts to be processed.
T64 = means it is a page
L0 = is not checked
P1 = it is already published
For such a field the image name result will be = T64.16x16.List.Published.gif
I couldn't find a way to update this field through the page xml, is not an information that is kept in the xml but rather is build in the dll when the
xml request . (Somewhere based on other fields like published and something else this Icon field is calculated.)
So if it is not possible to modify this field the option we may have is:
In order to integrate our change in the CMS without modifying their .dll (this for compatibility with the new version of the SDL Trdion is not good to modify in the dlll)
and without changing too much the logic I was thinking to this approach.
We can make a new Ajax call to a a new page WebGUICheckPageLocked.aspx (need to be tested what will be the impact on the performance).
In the code behind of this page we can determine if the page is locked or not ( used our internal function that determine if the page is locked or not this functionality is already done).
In the page we will change the icon field to something T64L0P1E01 (adding some extra information which will allowed us to determine the new status of the page ).
We will also modify the In the GetPNGIconName javascript function we can then make an extra check taking in consideration the new information E01 ...)
Please if someone have some better idea on this, maybe it is something easy that can be done, maybe it is a way we can update the Icon field.
Kind Regards,
Cristina

I'll paste my answer from the forums here, so everyone can see (and maybe bring ideas on how to do it differently?)...
In 2011 I would use a Data Extender to change the icon.
Since this is 2009 you will need to use the less elegant predecessor: the GUI Responder Extension.
Essentially you need to manipulate the XML that is returned for the relevant requests (such as the GetList on a Folder).
I couldn't immediately find any documentation on this - which is not surprising as it is an older version. But it boils down to this:
Create a .NET assembly containing a class with the following method signature and attribute:
[ResponseMessageHandler]
public XmlDocument HandleMessage(XmlDocument messageXml, string userName, HttpContext httpContext, object tcmSession)
In that method, you can change the icon set in the XML based on your own logic.
In the extension configuration file, add a section to hook into the response for the lists you care about
(substitute "YourResponderExtension.dll" with the name of the assembly you added):
<ProcessResponse>
<!-- GetList -->
<ExecuteWhen>/tcmapi:Message/tcmapi:Response/tcmapi:Request/tcmapi:GetList</ExecuteWhen>
<!-- Handler for all of the above -->
<Execute>/bin/YourResponderExtension.dll</Execute>
</ProcessResponse>
Add more elements before the if applicable - and make the XPath query as specific as you can to avoid your extension being called unnecessarily. You might also need to check for more cases in the .NET code that you can't do with the XPath query.
ZIP up your extension and deploy it with TcmExtensionInstaller.exe.
From your text I'm assuming you've already worked out how to create and package an extension in 2009.
I hope that these smalls steps can get you started.
If you have any trouble or follow-up questions, just let me know and I'll see if I can answer them.

Related

Plone: Email contents in content rule action

I have a Plone site configured with PloneFormGen. I'm using a save-data-to-content adapter to create a page for each submission, with a unique number for title/id. I have content rules set up so that various roles will be notified when a submitted form transitions along the workflow.
Is there any way to include the content of the submitted in these emails? I know PloneFormGen can send the content of the form in an initial email at submit time, but I need to send this same information later. I'm pretty good at figuring things out, but I'm no Plone expert so any help would be appreciated.
Additional info:
I'm using the uwosh.pfg.d2c adapter to perform the PFG -> Contenttype conversion, which works well. The content type is set to 'page' in the settings for the uwosh.pfg.d2c plugin. Content rules then will send emails to various groups or roles based on a state transition of the resulting content, which works in the normal way - when a transition occurs, the rule executes.
Effectively, what we have is pages that are being generated by the form when the user clicks submit. This is done through a plugin in PloneFormGen. This may provide some extra info: http://pythonhosted.org/uwosh.pfg.d2c/ - I'm not, admittedly, much of a developer.
Ideally, reviewers would get body-text of the created page when the form is submitted: this is done through a content rule that when a page is added to a folder, it sends the email. The page is added to the folder when the plugin in PloneFormGen creates the page.
When we have these pages, other users can come in and review and change the state of them - just as you can with any other page in Plone. PloneFormGen should have no further use once it's been converted to a page. Hope that helps.
The bad news is that this will require programming; the good news is that it won't take much. There are two reasonable approaches to solving the problem:
Have your content rule action run a script that handles the mailing itself. You can use the site's mailhost to send scripted mail; or,
In a Python package (no way to do this in a through-the-web script), provide a named adapter implementing plone.stringinterp.interfaces.IStringSubstitution for your context's text attribute. That will give you a $ substitution for the body. This would probably require less than 10 lines of total code.
You might want to have a look a collective.contentrules.mailtogroup, the newest version is capable to send the body-text as mail (use the '${text}'-variable), triggered on one of the convenient content-rules-events, in your case 'Object added'.
You can assign your roles to a group and use it for your case.

New UI SiteEdit Implementation

I have implemented New UI SiteEdit in Tridion 2011 SP1. When I have created a page without components in it ,I am able to edit the page. If I am inserting the component I am not able to edit the page. Please help on this issue?
When changing a Page in New UI (Experience Manager or XPM), the page is checked-out. What you might be seeing for other users is expected behavior--other users should not be able to edit the page in the CME or within XPM.
Also, you should be restricted from editing content page for even the same user that has a different session (e.g. viewing the page from another browser).
When editing the page with the same user and session, you should be able to add multiple components. The page is checked out. Editing content on the page should be "editing components," rather than the page itself.
Let us know if you're seeing something else.
This can be a result of having an syntax error in your inline editing commands (i.e. the JSON syntax inside HTML comments). Normally you would use the OOTB building blocks that generate this for you, however, in some extreme scenarios, this syntax is written out by hand. I suspect that you may have the latter scenario. Verify your component and component field command syntax.

Webscraping a tricky asp.net page

The overall goal is to perform a search on the following webpage http://www.cma-cgm.com/eBusiness/Tracking/Default.aspx with a container value of CMAU1173561. I have tried two approaches, the php extension cURL and python's mechanized. The php approached involves a performing a POST submit using the input fields found on the page (NOTE: These are really ugly on the asp.net page). The returned page does not contain any of the search results. The second approaches involves using python's mechanize module. In this approach I load the page, select the form, then change the text field ctl00$ContentPlaceBody$TextSearch to the container value. When I load the response again no search results.
I am at a really dead end. Any help would be appreciate because as it stands my next step is to become a asp.net expertm which i perfer not to.
The source of that page is pretty scary (giant viewstate, tables all over the place, inline CSS, styles that look like they were copied from Word).
Regardless...an ASP.Net form still passes the same raw data to the server as any other form (though it is abstracted to the developer).
It's very possible that you are missing the cookies which go along with the request. If the search page (or any piece of the site) uses session state, the ASP.Net session cookie must be included in the request. You will be able to tell it from its name (contains "asp.net" and "session").
I assume that you have used a tool like Firebug or Chrome to view the complete outgoing request when the page is submitted. From my quick test, it looks like the request may be performed with a GET, not a POST. I submitted a form, looked at the request, and pasted the URL into a new browser window.
Example: http://www.cma-cgm.com/eBusiness/Tracking/Default.aspx?ContNum=CMAU1173561&T=57201202648
This may be all you need to do.

SDL Tridion Schema Field "List of Links" Options

I'm looking to create an SDL Tridion schema with a list of repeatable links while avoiding multiple fields per link.
Hyperlink
In a rich text field I have the following options for creating a hyperlink:*
Component
Anchor
http://
mailto:
Other
When content authors create one of these hyperlinks, they have the option to select linked (visible) text as well as title and target attributes that function like typical HTML hyperlinks.
"Richtext" means a Text field with Height of the Text Area = at least 2 rows with Allow Rich Text Formatting selected.
Single Schema Field Link
When creating a single schema field, I see these options:
External Link (author options will include http://, mailto, Other)
Multimedia Link
Component Link (which can allow Multimedia Values)
Current Ideas
The best out-of-the-box (OOTB) setups I've found for this "list of links" is either offering:
a single 2-line RTF with instructions to create a hyperlink (of any type) in that field
separate fields for each type as well as additional fields for display name, target, and title (where the fields are assembled through template code), authors fill in only one of the fields (component link or external)
Question
Is there a way in the schema form designer, by updating the schema source, or through code to offer the same (RTF) hyperlink drop-down options, but in a single field? I could be missing something, but recognize this scenario isn't supported OOTB.
One question we are missing here is to consider if those links are going to be used somewhere else individually. If that's the case, multiple components would be my first choice, so we can reuse each component several times.
If you are planning to allow the editor to create a list of links that they are only going to use in a given component (not reusable), well, you have all the options mentioned in the previous answers.
To give you an idea on what's the best approach (in my humble opinion) here are things to consider:
Individual Components per link: use this approach if links are reusable.
Using embedded schemas (with the link structure) so this approach can be used in different component types (schemas)
Custom URL / Single Line Text Field: it requires an additional development effort and it is very unlikely you will keep the hard-link-references when creating internal links. As you know SDL Tridion keeps a reference to the tcm id in order to resolve links, trigger publishing, etc..
Custom URL / 2 Lines RTF: It will do the job, but you need to make sure you disable all the other RTF options from the Ribbon Tool Bar within the Schema RTF options, so you meke sure that the editors can only create links. Also, you might need to consider to add an XSLT filter to check if the edtiors entered something more than just links. These links are not reusable.
In general if you implement something custom (GUI extension + Custom URL) keep in mind all the TRIDION CMS concepts, like blueprinting (what happens when the link is inherited down), where used, etc...
My recommendation has always been to use Separated Components, but be careful with the link propagation when publishing...
I have seen this case at customers. If they consider less development effort, the idea of having a multiple embedded field is good.
You can have it as:
[text] Link Text
[Component Link] Link to anything
You would need an extra Content schema for External Links, like:
[External Link] Url
[text] target
[any extra option you need]
This means the editor would need to create a new External Link Component every time they create an external link. It is extra work, but it can also mean easier maintenance on the use of external urls within their site.
Lastly, the editor would just add multiple Component Links, those being of schema External Link of any other. It will be the template code which checks on the schema of the linked Component and add the code accordingly.
XML Name Description Field Type
[text] Text Text
[title] Title Text
[static_url] External URL Text
[component] Internal URL Component Link
In the field description for "External URL" and "Internal URL" you could add a comment to make sure that the editor doesn't get confused, only one of these two fields should be filled in. From the component, its ID can be used to create the dynamic link in the DWT. This solution has no development effort and for the editor is pretty much as intuitive as it can get. Of course this would be a multivalue embedded schema field inside the Links schema.
This use-case might work using a Custom URL field and maybe a GUI extension. The idea is to have a Custom URL that opens a popup (which might be a GUI extension). In that popup, you would select/construct your link (maybe using the same options as a normal RTF link - Component, Anchor, mailto, etc).
The popup would return a specially crafted string. The format could be anything, even an actual anchor tag (but JSon is also fine). Example: {href:'tcm:1-2',type='component'}.
Your Templates would interpret this string in order to generate something meaningful, like a dynamic link or static HTML anchor.
Also the Custom URL popup should be smart enough to 'decode' such a link (if a value was specified in that field previously) and maybe pre-populate some attributes in the RTF link constructor form.

VB.Net application - display a message to the user whilst the application is starting up

I have recently created an application where a lot of data is loaded into objects when the application starts up, and other data as it is required. For example if the user requests the catalogue page then it will load all the top level category data into objects of type Category. This will then stay there to be used by other users (who will therefore not have to load this data into objects) and can be altered by admin if they happen to login during the same application instance. I know this is not the most efficient solution, as pointed out below, but it works and the page load, at the moment, is not too long. It is very quick if most of the required data is already loaded into objects. It is also tailored to the business' needs - unlike other techniques such as Linq-to-SQL.
The problem I am facing is when a page is requested which requires lots of data to be displayed about different types of object. For example when a catalogue page is requested which displays information on a product which can be bought, it then loads all the products and categories (as the products make reference to the category object, not just the category name).
I would like to display a loading symbol with a message whilst all this data is being loaded into objects, so the user knows its not just in a loop or anything. Is there any way to do this? I am open to using JS / jQuery if I need to.
Thanks in advance.
Regards,
Richard
PS I am working on ways to make it more efficient - such as using HashTables or HashMaps. However this is taking time as there are so many different types of item (News, Events, Catalogue Item - Range, Collection, Design, RangeCollection, CollectionDesign, RangeCollectionDesign and RangeDesign - Users, PageViews and the list goes on).
Please correct me if I'm wrong, but I do believe that Javascript is required in order to display a "loading" image... Using server-side scriping alone would typically require an entire page load after all the content loads unless you want to start messing with IFrames.
This is a job for AJAX. A common solution to your problem is to have a small page that displays a loading icon. The page has some JavaScript that makes additional HTTP requests to the server to download the rest of the page. JQuery has a "$.ajax" method that is designed to simplify this process.
I would suggest looking at the documentation to the .ajax method in the jQuery documentation. Unfortunately, it seems to be a rather delicate process to get all the scripting code right and it takes a while to learn it all.

Resources