XSL TreeView Define whether the xsl div is open/closed - xslt

I'v done a tree view in xsl using a javascript function
I want to change the icons depending on the status (+ for to open , - for to close)

This questions is as clear as thick molasses in a pool of mud. (Will try to answer, though.)
I assume you mean XML stylesheets with xsl. If you meant Excel, it should have been xls. But let's assume you mean stylesheets and you're using it to generate a webpage which contains a treeview. In this treeview there are icons indicating if the node is expanded or not. If expanded, display +, else display -. Am I right, here?
Now, it depends on how you've implemented this treeview in your stylesheet. The most practical way would be to just send the tree data fully expanded to the page and let the Javascript handle this client-side. In that case, all you need to know is how to expand and collapse nodes in Javascript with the additional icon change.
Another possible implementation would be when expanding and collapsing is done serverside, thus you'd only send the visible data. In that case you can also just tell the page which icon to use and there would be no need for any javascript. The icon would just be a link back to the server, updating the data through a new requests which builds a new webpage.
A third option would be the WEB 2.0 solution, where you just send the list as a collapsed treeview and every time the user clicks an icon, a AJAX event gets triggered, collecing the additional node data and changing the icon of the treenode.
These are three very different techniques and they're not always the best solution. The first solution is a problem when dealing with lots of data in your tree. It needs to load it all. The second option will generate a lot more traffic with the server but handles better with large amounts of data because you only display the open node. The third option is a bit of a mixture between the first two options. You don't need all data from the beginning and you're not recreating the webpage over and over again. But it's also more complex to code.
Now, I wonder which of these options you use. Once we know this, we can help you. (Edit your question to provide this information and perhaps even add the JavaScript tag to it.)
To be honest, xsl is only used to change the shape of an XML document and it knows nothing about treeviews or whatever. So I don't see any link between xsl and treeviews. It's just that you use xsl to transform your data into something that some Javascript library can process as a treeview. Which Javascript library is this?

Related

Sitecore 8 implement tooltip on RTE authored content

We have a requirement to implement tooltips for words that are authored in Sitecore RTE.
The idea behind is that user should be able to hover over the word and see it's description/meaning.
Is this possible to achieve in sitecore? Did a quick search on marketplace but could not find any modules.
Below are some options to consider for achieving what you described.
Inject Tooltip HTML in a renderField pipeline
In this option, you would extend the renderField pipeline. First, you will need to ensure that you are dealing with a rich-text field, and if so, locate terms and replace them with the necessary markup that is required for the tooltip. This could be as simple as wrapping the word in an <abbr> or perhaps a <span> element with a CSS class. The list of terms and tooltip content could be sourced from items in Sitecore or a custom Sitecore Dictionary. Caching the terms would be essential as this pipeline processor is invoked frequently every time a field is rendereded.
Progressive enhancement with JavaScript
This approach is almost entirely based on the client-side. Terms could be located and replaced fairly easily with the help of JQuery. If the list of terms is of a reasonable size, they could be bootstrapped into a JavaScript variable. Once terms are located and enhanced, a separate, asynchronous call to a REST endpoint could be made when hovering or clicking the term. The API would accept a term and respond with the term's definition.
HTML Snippet in RTE Editor
Sitecore RTE editor can be extended with additional buttons. One of these options allows you to insert predefined snippets of HTML. The RTE editor also has a setting to specify a CSS file to style the content within the field (<setting name="WebStylesheet" value="/css/yourstylesheet.css" />). Styling would be necessary in order to target the description markup and make it visible to be edited, whereas, on the public site, the description markup would normally be hidden by default until the term is clicked on or hovered over.
Dynamic Link Replacement
http://www.layerworks.com/blog/sitecore-token-replacement

How to create a left side bar on APEX 4.0 and open each value in a specific region?

Im a little newbie working with Aplication Express, I want to create an aplication which its structure could be something like this example.
http://apex.oracle.com/pls/apex/f?p=36648:1:110593396161288::NO
Anyone have some ideas to create it?
I just tried creating a List from Shared Components and then set it in a region with Page Region Template Position 3 and another Chart Region with Page Template Body (3), but in my case the side bar is placed on the right when I want it on the left... I have tried all the Template Position combination as possible.
Also when I click a value from the list, the page is opened on another tab. How can I open it on a specific region? As a frame for example
Any help will be greatly appreciated
Having a left sidebar depends on the page template you select. Some page templates will have a left sidebare, other a right one, others maybe both. And since templates are part of a theme, it may be that some templates under some themes may not have a page template that offers what you'd want.
So the first you need to do is look at what page templates you have available in your chosen theme. You can do this by going to the Shared Components and selecting templates from there. Scroll to the Page Templates and see if you can find one there.
While it's a good guess that the sidebart region will be in position 3, and position 3 is in the sidebar, it's best to verify. You can do that by checking the html of the body of the template. See if there is a region assigned to a sidebar. You'll have to divine this from the markup or an example page and which one it is (position 2? position 3? 4?).
Pro-tip: from the Shared Components > Templates, in the report overview, you can preview certain types of templates, such as the page template. Just hit the preview button and you'll get a general idea of the style and the region positioning! When viewing the template in detail, you can also preview from the preview link in the right hand menu list.
As for the list: the example you linked has a list region on the left sidebar, but all those links are links to other pages. Thus, there are as many pages as there are links in the list.
If on your environment the links are causing a new page or tab to be opened up, then that likely means the attribute target="_blank" is present on those anchor tags. Again though, this just means that that markup is being generated by the chosen list template. Try another list template (by editing the list, under Source you can chose the template) or take a look at the theme's templates. You can find the markup for the individual list items there.
It'd be better not to concern yourself too much by trying to fiddle around with iframes just yet, because even though that'd be possible it is not an out of the box feature. Unless you're already really familiar with eg javascript I'd stick to page links until you're more familiar with the environment.

How to select only published items in XSLT-Umbraco?

i have a photo slider,there is next and prev buttons ,and when you click on a button,a pop-up window appears and show the big size of photos.Im using Umbraco,the xslt macro shows the nodes within the Gallery folder.xslt selects "Gallery/Photo" nodes.When i upload a photo,if i dont publish it,the sliders's next/prev buttons dont seem and pop-up dont work.How can i select only published items in Xslt ? Thanks in advance
I see this debate has sprung up again. It's not a direct answer to the problem, but should you understand Umbraco a little better ...
Umbraco & XSLT
Although Umbraco runs all it's data predominantly from a MS SQL database, it does however cache this data everytime a page is published/unpublished within a "hidden" XML file. It frees up the developer of any direct XML editing and leaves it to Umbraco. However, this makes it easy for a developer to forget or not even know it's there.
The file can be found in either of the following locations, dependant on which version you are using:
~/App_Data/umbraco.config
~/config/umbraco.config
The Problem
The XSLTs run using the umbraco.config file as it's XML source. However, this file will only contain published nodes. Unpublished nodes will be removed from the XML completely, so the XSLTs shouldn't be able to access unpublished nodes at all.
I suspect the problem may have to do with something other than unpublished nodes.
Without seeing your XSLT its difficult to guess what you're doing. However as #Goran states, XSLT in Umbraco can only access published nodes. This is because the data the XSLT has access to is the cached XML structure found in umbraco.config.
So, what is probably happening is that you actually want to exclude nodes that don't yet have an image assigned (even though the node itself is published).
You can do this using something like:
$currentPage//GalleryNode [image != '']
This will select all the GalleryNode elements under the current page that have an image property assigned.
If this is the case, you may want to consider making the image property mandatory to prevent any nodes from being published without an image.

Saving user's data for my application

I was wondering what would be the correct method for saving all user data for an application I am working on. The application is in QT. The user inputs a lot of data into the application and the data will be different for every user. I want the ability for the user to save all the current data to a file that can be user by the loaded by the application again once the user wants to use it again or use it on another computer running the application.
What would be the correct and best way to do this? Do I need to use xml format? And then use the xmlreader for QT? Or do I just need to create my own file format and just use the stream to just read everything in. The data in the file will need to be labeled, because it will need to put the data in certain spots on the gui. And the user has the option to dynamically create boxes and tabs that hold certain information.
If you need any more information, please let me know.
A short example:
I am not only reading gui locations.
But the contents of those. For
instance. The user is able to create
tabs that contain edit text boxes. And
those tabs are associated with items
that are in a list. When the user
clicks on an item in the list the user
will be presented with a whole set of
new tabs. And each tab has some
editing forms. The file will need to
contain what is in the list, what tabs
the user has created under each item
in that list and the contents of each
tab associated with the tab of each
item in the list.
In essense, yes you'll be creating your own file format, but the actual content can just be XML in whatever scheme you need. Then you can use Qt's built-in XML processing capabilities to pull the heavy lifting of parsing the text (I personally prefer the DOM model, so I use QDomDocument as my base point), and you'll just need to worry about parsing things to and from the individual nodes.
The Qt framework has some great XML samples if I remember correctly that helped me get off the ground almost immediately. Hope they help!
Another great solution is to use internal database implementation (QSQL on top of sqlite). Compared to the xml solution, it might be more versatile (update when needed, can use external keys). Qt has some rgeat examples about using it aas well.
In terms of dependencies, XML solution will require you to use xml and xmlpatterns (if you want to validate stuff), whereas sqlite solution will require QSQL + sqlite plugin. I think that sqlite guarantees atomicity of writing , thus preventing corruption of data (think : the user is killing the app while it's saving).

How can I visually design a component in C++ Builder?

I have been away from C++ for a couple of years now doing AS3/Flex work. I have gotten used to being able to create a component and place it in design mode with very little fuss and I am struggling to get my head around the C++ Builder way of doing the same thing.
I have written many components for C++ Builder in the past, but none of them have been visual. What I would like to do now is create a component for customer search and another for order processing because I want to be able to create a new instance of these on the fly. What I don't want to do is have to place each of the components like the dbgrid and search fields manually in code. I would like to do this (as well as set their properties) in design mode.
How do I go about this? I have browsed the source for other Delphi components and I notice they have dfm files which seems to be what I need. How do I do this in C++ Builder? The only option I see is to add a new form if I want a dfm, but this isn't what I want as my components will be based on TPanel.
Is there a way to do this or do I have to resort to doing it all in code with no visual reference?
Pursuing the DFM idea I did a test this morning where I created a component based on TPanel and added a new form to it which I create and parent in the constructor of the component. In design mode I set the form border to none and placed a grid on it. This all looks OK until I place the component in my application, at that point it looks like a panel with a standard looking form in it and the grid is missing. If I run the app the panel shows as expected, borderless and with a grid. The DFM appears to be ignored in design mode for some reason.
If you know a better way to do this than using components then please give me some pointers.
Any help and advice will be appreciated beyond words
You might want to have a look at frames (look for "Frame objects"). They are "subforms" you can design visually and then place on forms.
Just as an FYI item, you can also drop the panel on a form, put any other controls on it, position them, set captions, etc..
Now, click the panel to select it, and use Component->Create Component Template from the IDE's main menu. This creates a unit you can install as a component which will add the panel and it's sub-controls (as a single component) to the IDE's component palette.
Of course, you can then modify the source for that new component like any other component source.