Inter communication between widgets in orchard - asp.net

is there way in orchard to intercommunicate between custom widget?
Scenario :-
Suppose :- We have one widget name teacher . which can add student name . on same page we have second widget name student . while teacher add new student name it will show in second widget (student) on same page . on second page we have also dragged student widget it should be also update with new value .i would not to store value in database . Please help me out .
Thanks in advance .

Orchard does not have anything specific to do this, but neither does it get in your way of doing it if you want to.
We have similar intra-communication in some of our widgets. We do it by adding a specific property to the widget (which can be changed by editing the widget) where we input the name of the widget to link to. In our case, the widgets we are using share a JSON object (the linked widget now knows the name of the widget it's linked to, so we can work out how to get the JSON object). We then use an observable style JS framework (I believe that our frontend devs are using marionette, but pick your flavour). If widget A or Widget B updates the JSON object, then the the html is automatically updated, due to how the JS framework works. This gives nice "interactive" widgets.
Alternatively - if you only care about the linking at the loading time, then both widgets should pull data from an interface implementing IDependency (e.g. IMyService) that is "per request", then you can easily share the data that way server side.
I'm guessing from your comments to Bertrand that you are looking for the first option I listed.
I'm sure you could take these concepts significantly further and get to SharePoints "linked parts" framework where as long as you link an output / input of the same data type it allows the linking, but that would be rather harder to complete.

Related

How can I store data to use it any where in my element

I am face to a problem and I can not find a solution!!! may not enougn experience with CakePHP :o)
I created a setting pages (Controller+Model+view)
On admin_edit action, I created a form to enter the parameter of the web site, as the site of name (to be display on the layout), the status (online or not), the id of the home page, ect.
I may be did it wrong but until I can not use variable on all element.
I tried Configure::write or Set('val',$val) but with both of them, I could not use it eighter on the layout or on a controller.
As I spent almost a day, I would like tp know if someone can provide me an exemple to create an array (or something else) to be able to use it's value, either on a layout, a controller, a view, an element or a compnent, or a Helper. But the main need, would be on a Controller, the layout and the view.
may thank for any tuto or exemples
P.
Your question indicates that you need to get a basic understanding of how CakePHP works.
To understand how a request is made, take a look at the picture in the section "CakePHP request cycle" in this link:
http://book.cakephp.org/2.0/en/cakephp-overview/understanding-model-view-controller.html
As you can see, Controller asks Model for data, then sets that data to the View. The View can never send data back to the Controller - that would be a new request.
To understand the use of layouts,elements and how to set variables in views, see the cookbooks description of Views:
http://book.cakephp.org/2.0/en/views.html
And of course follow the blog tutorial is a good thing to get a grip of the basic concepts.

Extending the GUI fields

I would like to extend the individual GUI elements, do some custom processing and later call the default function.
For example: Whenever a particular Input Element is selected in the Component window, I would like show a TooTip to the user associated with that field.
Kindly provide some pointers.
#
Sorry for my earlier attempt in framing the question Reframing it
again.
#
Actually I have a schema with four fields, My requirement is to show a
help text, whenever the focus is on a particular field.
One of the field holds Country Name: So when the focus is on the
Country Name ( Single Text Field ) I need to show "Please enter the
Country Name" on the text field. So that the editor understands the
same, without using the Schema Description field.
So my question was can we capture the events for all types of fields (
like Multimedia, RTF, Single Line ) in the Component Edit view ?
Hope was able to make my question more clear
You would have to extend the Component-edit screen for this. I suggest you read-up on Tridion GUI extensions:
www.sdltridionworld.com,
SDLLivecontent
Tridion Developer blog
Also, searching stackoverlow might help: Extending the publish screen
A valuable source of examples is the PowerTools project. You can find it here
Asking a more specific question allows us to help you more specific.

Extension to the page icon status in SDL Trdidion 2009

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.

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.

help me to proceed with drupal views?

I am newbie to drupal , I just created a view called "master" and i wanna manipulate the output pro grammatically for creating widget (javascript widget can embed in other website).
$view = views_get_view('master');
$view->set_display('page');
$view->execute();
$viewArray = $view->result;
$title = $view->display['default']->display_options['title'];
echo "<h2>$title</h2>";
echo("<pre>"); print_r ($viewArray); echo("</pre>");
It prints the result(in object form), But the output contains only 10 result which was mentioned while at the time of views creation.Please guide me,
1.how to get the next 10 result pro grammatically (pagination) ?
2.how to theme a views pro grammatically (since its js widget) ?
3.any live demo tutorial links to play with advanced views?
4.how to do sorting (whether i need to pass through url)?
5.how deal this with handler object?
my view preview looks like this below image
Thanxs,
Nithish.
Well, for #1 all you need to do is go into the edit control panel for that view and change the number of records to be shown on each page. Setting it to 0 lets it display all records at once.
For the others ... I wonder if views is the right solution for you. I suspect you might be better off with a custom module that returns a lot of drupal_json() calls. At very least, it's cumbersome and wasteful to be doing all this through views, since views spends so many cycles on rendering.
If you want to avoid coding a custom module, I'd suggest installing the View Bonus Pack (http://drupal.org/project/views_bonus) and using the 'Feed' display types. This will make it marginally easier to manipulate the results with js.

Resources