Default to "Browse" tab when selecting images from Media Library? - sitecore

When browsing for an image from an Image field in Sitecore 7, is it possible to default to the "Browse" tab as opposed to the new "Search" tab?
The new search functionality is great for advanced users, however, my content authors are finding it confusing, especially with multiple languages showing up in the results. Selecting a search result item also yields an error in some cases, so I'd just like to disable it at this point.

on this file \sitecore\shell\Applications\Media\MediaBrowser\MediaBrowser.xml
you need to change order of the tabs :
You will have :
<Tabstrip ID="Tabs" Width="100%" Height="471px">
<Tab ID="MediaLibraryTab" Header="Browse" Height="100%">
<GridPanel Width="100%" Height="100%" Style="table-layout:fixed" Columns="3" GridPanel.Height="100%">
<Scrollbox Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="200" GridPanel.VAlign="top" Style="overflow:auto">
<TreeviewEx ID="Treeview" DataContext="MediaDataContext" Click="SelectTreeNode" DblClick="TreeViewDblClick" ShowRoot="true" ContextMenu='Treeview.GetContextMenu("contextmenu")' Width="100%" />
</Scrollbox>
<VSplitter ID="MediaBrowserLeft" Target="left" GridPanel.Width="4" />
<Scrollbox ID="Listview" Width="100%" Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="100%" GridPanel.VAlign="top" />
</GridPanel>
</Tab>
<Tab ID="MediaTab" Header="Search" Height="100%">
<Frame SourceUri="/sitecore/shell/Applications/Buckets/MediaBrowser.aspx" Width="100%" Height="100%"></Frame>
</Tab>
</Tabstrip>
instead of :
<Tabstrip ID="Tabs" Width="100%" Height="471px">
<Tab ID="MediaTab" Header="Search" Height="100%">
<Frame SourceUri="/sitecore/shell/Applications/Buckets/MediaBrowser.aspx" Width="100%" Height="100%"></Frame>
</Tab>
<Tab ID="MediaLibraryTab" Header="Browse" Height="100%">
<GridPanel Width="100%" Height="100%" Style="table-layout:fixed" Columns="3" GridPanel.Height="100%">
<Scrollbox Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="200" GridPanel.VAlign="top" Style="overflow:auto">
<TreeviewEx ID="Treeview" DataContext="MediaDataContext" Click="SelectTreeNode" DblClick="TreeViewDblClick" ShowRoot="true" ContextMenu='Treeview.GetContextMenu("contextmenu")' Width="100%" />
</Scrollbox>
<VSplitter ID="MediaBrowserLeft" Target="left" GridPanel.Width="4" />
<Scrollbox ID="Listview" Width="100%" Height="100%" Class="scScrollbox scFixSize scFixSize8" Background="white" Padding="0px" GridPanel.Height="100%" GridPanel.Width="100%" GridPanel.VAlign="top" />
</GridPanel>
</Tab>
</Tabstrip>
You just change the order of tag TAB .

If you are using the Media Browser in the new Speak UI (available in Sitecore 7.?) you can accomplish the same thing by doing the following:
In the /App_Config/Include/Sitecore.Speak.config file replace the line:
<override xmlControl="Sitecore.Shell.Applications.Media.MediaBrowser" with="/sitecore/client/applications/Dialogs/SelectMediaDialog" />
with the line:
<override xmlControl="Sitecore.Shell.Applications.Media.MediaBrowser" with="/sitecore/client/applications/Dialogs/SelectMediaViaTreeDialog" />
Thanks Sitecore Support for the instructions.

Related

PrimeFaces orderList not updated with changed order

The order change in orderList has no effect on the list variable. I tried primefaces orderlist not getting updated with the changed order and Primefaces: How to persist reordered data from a p:orderList? and checked multiple other question, however none worked for me. I added process and update the orderList in the submitting command button, I added ajax processing to the command button, immediate to orderList, still nothing.
HTML
<p:dialog id="editDialog" widgetVar="editDialog" header="Editace dokumentu" modal="true" showEffect="fade" width="90%" height="80vh" resizable="true" closable="true" closeOnEscape="true">
<p:outputPanel id="container" widgetVar="container" style="width: 100%; height:100%;">
<h:form id="editTable" widgetVar="editTable">
<p:panelGrid layout="grid" columns="2" columnClasses="label,value" styleClass="ui-panelgrid-blank" rendered="#{documentsInboxView.pdfFileType}">
<p:outputLabel value="Pořadí stránek" for="#next" rendered="#{documentsInboxView.filePagesNumber gt 1}"/>
<h:form rendered="#{documentsInboxView.filePagesNumber gt 1}">
<p:orderList value="#{documentsInboxView.pagesOrder}" var="page" itemValue="#{page}" itemLabel="#{page}" style="width: 100%;" controlsLocation="right" responsive="true" id="pagesOrderOrderList" widgetVar="pagesOrderOrderList" immediate="true">
<p:column>
<h:outputText value="#{page}" />
</p:column>
</p:orderList>
<p:commandButton ajax="true" type="submit" value="Změnit pořadí" onstart="PF('blockUIWidget').show();" oncomplete="PF('blockUIWidget').hide();" actionListener="#{documentsInboxView.changePagesOrder}" immediate="true" update="#widgetVar(container) #widgetVar(pagesOrderOrderList)" process="#this #widgetVar(pagesOrderOrderList)"/>
</h:form>
</p:panelGrid>
</h:form>
</p:outputPanel>
</p:dialog>
Adding ajax to the orderList with processing and updating the orderList solved the issue.
<p:orderList value="#{documentsInboxView.pagesOrder}" var="page" itemValue="#{page}" itemLabel="#{page}" style="width: 100%;" controlsLocation="right" responsive="true" id="pagesOrderOrderList" widgetVar="pagesOrderOrderList" immediate="true">
<p:ajax event="reorder" process="#this" update="#this"/>
<p:column>
<h:outputText value="#{page}" />
</p:column>
</p:orderList>

Insert grid template row (within grid) under condition

In a facebook-esque fasion, I'm working in a post with comments. The comments have a int which indicates the id of the parent post. So Comment 1 and 2 both have assigned as parent Post 1.
What im working on is on displaying them as a grid within a grid. Here is that part in .zul:
<grid id="postGrid" height="550px" model="#load(vm.pcdata.posts)" emptyMessage="No Posts.">
<template name="model">
<row>
<window border="normal">
<!-- .................. -->
<!-- PARENT POST -->
<!-- .................. -->
<caption id="userPost" label="#load(each.user)"/>
<textbox id="infoPost" readonly="true" value="#load(each.info)" multiline="true" rows="4" width="100%" mold="rounded"/>
<separator bar="true"/>
<hlayout>
<div>
<button label="Like" onClick="#command('addPLike', postid=each.postid)"/>
</div>
<div hflex="true">
<textbox id="likeTB" disabled="true" width="40px" style="text-align:center" value="#load(each.plikes)"/>
</div>
</hlayout>
<separator bar="false"/>
<window border="normal">
<!-- .................. -->
<!-- THE SECOND GRID-->
<!-- .................. -->
<grid id="commentGrid" height="150px" model="#load(vm.pcdata.comments)" emptyMessage="No Comments.">
<template name="model">
<row>
<window border="normal">
<caption id="userComment" label="#load(each.user)"/>
<textbox id="infoComment" readonly="true" value="#load(each.info)" multiline="true" rows="4" width="100%" mold="rounded"/>
<separator bar="true"/>
<hlayout>
<div>
<button label="Like" onClick="#command('addCLike', commentid=each.commentid)"/>
</div>
<div hflex="true">
<textbox id="likeTB" disabled="true" width="40px" style="text-align:center" value="#load(each.clikes)"/>
</div>
</hlayout></window></row></template></grid></window></window></row></template></grid>
In the second grid, I imagine there could be some sort of if function in which if both the postid in the father Post and the postsrc in the child Comment are the same, the comment will be displayed. Is there any way to make this work?
You can use shadow element <if>, e.g.
<if test="#load(vm.yourFlag)">
<grid id="commentGrid">
....
</if>
please see http://books.zkoss.org/zk-mvvm-book/8.0/shadow_elements/flow_control.html
Do you mean commentGrid is created but inner window is hidden, so there is space inside commentGrid, right?
Since you specify emptyMessage on commentGrid, it should show no comments. Or there are still comments but all hidden? If so, you can consider hide both commentGrid with inner window.

jsf header navigation menu - template

I have template like here:
http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example/
i add menu navigation:
<h:form id="form">
<div id="page">
<div id="header">
<ui:insert name="header" >
<ui:include src="/pages/template/header.xhtml" />
</ui:insert>
<f:ajax render="ContentLoader">
<h:commandLink actionListener="#{contentPage.setPage('/pages/first.xhtml')}" value="About Us" />
<h:commandLink actionListener="#{contentPage.setPage('/pages/login.xhtml')}" value="Contact Us" />
</f:ajax>
</div>
<h:panelGroup id="ContentLoader" >
<div id="content">
<ui:insert name="content" >
<ui:include src="#{contentPage.page}" />
</ui:insert>
</div>
</h:panelGroup>
</div>
</h:form>
links are working fine, but i have problem with redirect content by useing <h:commandButton action="link"> which is in content
how can i fix this problem?
maybe it's something wrong with my layout?
or how to correctly redirect from content to another content, useing buttons which are in contents?
As to your concrete problem, it's likely caused by the combination <ui:include src="#{...}"> and a view scoped bean. This construct works only if you upgrade to at least Mojarra 2.1.18. Otherwise, the view scoped bean will fail to restore and be newly recreated and therefore the default value of #{contentPage.page} will be considered when any form actions inside the page are to be decoded. Upgrading to at least Mojarra 2.1.18 should fix your problem. You can get it at http://javaserverfaces.java.net. It's currently already at 2.1.25.
As to your concrete functional requirement, using command links/buttons for plain page-to-page navigation is a poor practice. You should be using output links/buttons for this.
<h:button value="navigate" outcome="link" />
or
<h:link value="navigate" outcome="link" />

Facelets: any library that ships templates?

Like in the title, is there any lib like PrimeFaces or RichFaces that is template-oriented?
I'm building my own including some fixed/liquid/elastic base layouts but I wonder if someone out there has already done this boring work.
UPDATE
i'm sorry, i haven't explained myself.
i'm talking about a sort of framework on framework made by a tree of templates (and optionally beans).
i'm currently using this root template, that is bundled in a jar file with some bean and , entity, for all my applications:
<!DOCTYPE html>
<html lang="#{localeBean.locale.language}"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:o="http://omnifaces.org/ui"
xmlns:s="http://shapeitalia.com/jsf2"
xmlns:sc="http://java.sun.com/jsf/composite/shape">
<f:view locale="#{localeBean.locale}">
<h:head>
<title><ui:insert name="module"/> - <ui:insert name="title"/></title>
<link rel="shortcut icon" type="image/x-icon" href="#{resource['shape/favicon/shape.ico']}" />
<h:outputStylesheet library="shape" name="css/core.css" />
<h:outputStylesheet library="shape" name="css/fileicons.css" />
<h:outputScript library="shape" name="js/jquery.jsPlumb-1.3.15-all.js" />
<h:outputScript library="shape" name="js/core.js" />
</h:head>
<h:body>
<ui:debug hotkey="x" />
<p:growl id="messages" globalOnly="false" autoUpdate="true" showDetail="true" showSummary="true" />
<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();" />
<p:dialog modal="true" widgetVar="statusDialog" header="loading..." resizable="false" closable="false">
<h:graphicImage library="shape" name="images/ajaxloadingbar.gif" />
</p:dialog>
<div>
<ui:insert name="header">
<h:form>
<s:panelGrid cellStyle="border: 0;">
<s:column style="text-align: left;">
<p:commandLink action="index" >
<h:graphicImage library="shape" name="images/shape.png" height="30px" style="vertical-align: middle; float: left; border: 0"/>
</p:commandLink>
</s:column>
<s:column style="text-align: right;">
<p:menuButton rendered="#{not empty request.userPrincipal}" value="#{request.userPrincipal.name}" style="float: right">
<p:menuitem actionListener="#{sessionBean.logout}" action="index" ajax="false" icon="ui-icon-power" value="#{bundle.logout}"/>
</p:menuButton>
</s:column>
</s:panelGrid>
</h:form>
</ui:insert>
</div>
<h:panelGroup rendered="#{not empty request.userPrincipal}">
<ui:insert name="content">insert content here</ui:insert>
</h:panelGroup>
<h:panelGroup rendered="#{empty request.userPrincipal}">
<h:form>
<p:panel header="login">
<h:panelGrid columns="3">
<h:outputLabel for="login_email" value="Email:" />
<h:outputLabel for="login_password" value="Password:" />
<h:panelGroup />
<p:inputText id="login_email" value="#{requestScope.email}" label="email" size="32"/>
<p:password id="login_password" value="#{requestScope.password}" label="password" feedback="false" size="32"/>
<p:commandButton value="Login" action="#{sessionBean.login}" icon="ui-icon ui-icon-check" ajax="false"/>
<p:message for="login_email" />
<p:message for="login_password" />
<h:panelGroup />
</h:panelGrid>
</p:panel>
</h:form>
</h:panelGroup>
<ui:insert name="external" />
</h:body>
</f:view>
</html>
and this is only the root one.
i'd like to know if is there someone who has already done a work like this and have bundled it
ok there is no such a thing.
the best out there are components like p:layout.

Creating a Word document in Coldfusion - how to have pagenumbering?

I am creating a Word format .doc using the following code, then cfheader and cfcontent to serve. All is good but I need to be able to place dynamic information in the header (or footer), or automatic pagenumbering would be a second best option.
How should I modify the code?
<cfsavecontent variable="myDocument">
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<!--- Head tag instructs Word to start up a certain way, specifically in
print view. --->
<head>
<xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:DoNotOptimizeForBrowser/>
</w:WordDocument>
</xml>
</head>
<body>
Regular HTML document goes here
<!--- Create a page break microsoft style (took hours to find this)
--->
<br clear="all"
style="page-break-before:always;mso-break-type:page-break" />
Next page goes here
</body>
</html>
</cfsavecontent>
Please have a look at this: Header & Footer
I have successfully created custom header and footer with only one html file using this article. (Word 2003)
Hope this helps!
Doesn't seem easy to add page number using a WordprocessingML
http://openxmldeveloper.org/archive/2006/08/03/443.aspx
If you can serve PDF instead of DOC, here's a solution for page numbering.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7c21.html
See example 2:
<cfdocument format="pdf">
<cfdocumentitem type="header" evalatprint="true">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align="right"><cfoutput>#cfdocument.currentsectionpagenumber# of
#cfdocument.totalsectionpagecount#</cfoutput></td></tr>
</table>
</cfdocumentitem>
<cfdocumentitem type="footer" evalatprint="true">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align="center"><cfoutput>#cfdocument.currentpagenumber# of
#cfdocument.totalpagecount#</cfoutput></td></tr>
</table>
</cfdocumentitem>
...
</cfdocument>