Liferay 7.2 print custom menu - themes

I have Liferay 7.2
I create a custom theme.
I created a custom navigation menu "link-utili" in back-end
I have main navigation but i need a secondary navigation before the footer but i have not any solution.
I tried:
<#assign preferencesMap = {"displayDepth": "1", "portletSetupPortletDecoratorId": "barebone", "siteNavigationMenuType": "2"} />
<#liferay.navigation_menu
default_preferences=freeMarkerPortletPreferences.getPreferences(preferencesMap)
instance_id="link-utili"
/>
how i cand do that?

If you have marked your custom Site-NavigationMenu as "Seconday Navigation" (see the ... context-menu of your menu entry), you could use the following snippet in your theme to print the secondary navigation (as an example, some settings can be adjusted to fit your needs):
<#assign secondaryNavigationPreferencesMap = {
"displayStyle": "ddmTemplate_NAVBAR-BLANK-JUSTIFIED-FTL",
"portletSetupPortletDecoratorId": "barebone",
"rootLayoutType": "relative",
"siteNavigationMenuId": "0",
"siteNavigationMenuType": "2"
}
/>
<#liferay.navigation_menu
default_preferences=freeMarkerPortletPreferences.getPreferences(secondaryNavigationPreferencesMap)
instance_id="secondary_navigation_menu"
/>
I do not know how to reference it via its name (here "link-utili"). I always use "marked navigation menus". Maybe someone could add this hint here.

Related

Kendo Ui AutoComplete - How to change default filter "startWith" to "contains"?

My application built with AngularJs and KendoUI controls. I used AutoComplete Text Box so many places in the application. Now client wants that search should be with "Contains" filter. for the same i need to put filter: 'contains' everywhere AutoComplete control used.
I want to change default filter 'startWith' to 'contains' at beginning of the application. So that i can escape to make change every html file.
can anyone knows how to do the same?
I guess you need to update your auto complete filter property at least once for all controls to support dynamic property binding and bind to some root configuration, like:
<input kendo-auto-complete k-filter="config.autoComplete.defaultFilter" />
So will be able to change default filter in future by updating only config value.
Another approach - is to override default "setOptions" behavior for "AutoComplete" component to use correct filter by default somewhere on app start:
var nativeSetOptions = window.kendo.ui.AutoComplete.prototype.setOptions;
window.kendo.ui.AutoComplete.prototype.setOptions = function(options) {
options.filter = 'contains';
nativeSetOptions.call(this, options);
}
You can use k-options attribute:
<input kendo-auto-complete ng-model="yourModel" k-data-source="yourDataSource" style="width: 100%;" k-options="autocompleteOptions"/>
and then in your controller:
$scope.autocompleteOptions = {
filter:"contains"
}

How does addStylesSet interact with the contents css?

I have redirected the contents.css file for my CKEditor 3.6 to my site's stylesheet:
CKEDITOR.config.contentsCss = '/css/style.css';
Now I'd like to add some styles from that stylesheet into the dropdown box for users to select when editing content. The previous developer created this:
CKEDITOR.addStylesSet( 'cms_styles',
[
{
name : 'Page Header',
element : 'h2'
},
{
name : 'Page Text',
element : 'p'
},
It appears to work, but makes very little sense to me. Where do these get their style from given that a class name cannot have spaces? Why is an element being specified if we're just adding styles to the dropdown? Google turned up no good results for addStylesSet, and the developer guide I found (http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles) really wasn't very specific.
I do not want to display all available classes; just a few that we define.
The name property on the style objects is only used for display purposes, it does not make it into the content in any way. What the previous developer created works because those styles are just specifying the element, and the css likely has styling defined using those element specifiers.
The element property is being set so that CKEditor knows how to apply that style to the content. If you have a style with the element property having a value of p then that style will become a block style and will apply to the currently active p block in the content. If the element property has a value of span then the style would be applied to the selected text only (it would be surrounded with a span element if one didn't already exist).
To get styles in the dropdown to represent classes in your external css you need to add the style objects to the styles set and have it set the class attribute of the element the style is being applied to. By setting properties on the attributes property of the style object you can have CKEditor add or modify attributes on the element that it is applying the style to. For our purposes we want to set the class property of the attributes property in order to have the class defined in your css applied.
CSS:
p.myBlockStyle {
font-size: 32px;
}
CKEditor stylesSet array:
[
{
name: "My Block Style",
element: "p",
attributes: {
"class": "myBlockStyle"
}
}
]
Note that the class property has it's name quoted because class is a reserved keyword.

Joomla stripping out #usemap

I have a map inside a TinyMCE editor in Joomla 3, and it seems like when it is saved Joomla is messing with the html. I just want no filtering or anything.
So this is the HTML I enter:
<img class="mapper noborder"
height="410"
id="Map_of_North_America"
name="Map_of_North_America"
src="/images/State Maps/Map_of_US_web_2014(1).png"
style="border-width: 0px; border-style: solid;"
usemap="#m_Map_of_North_America" width="476" />
and this is what Joomla saves:
<img class="mapper noborder"
src="images/State Maps/Map_of_US_web_2014(1).png"
width="476"
height="410"
name="Map_of_North_America"
style="border-width: 0px; border-style: solid;" />
It removes the id, as well as the usemap=
I have tried setting text-filtering to none, changing up the TinyMCE in the plugin manager etc... Thoughts?
I had the same problem however with JCE (I am not using TinyMCE) bu I guess, this could help :
in JCE / Edit Profile / Features and Layout: at the bottom : check the option "Adds support for OBJECT, EMBED, AUDIO, VIDEO and IFRAME elements. Required by the Media Manager and when inserting Adobe® Flash®, Quicktime® and other media file types"
in JCE / Edit Profile / Editor parameters/advanced : set all to yes
in JCE / Edit Profile / Plugin parameters/media support : set all to yes
This is what solve the problem for me :
Navigate to Content → Article Manager / Parameters (icon top right)
Scroll down to Filtering Options, highlight all Filter groups except Super Administrator, and select Filter type of Blacklist
You could also set the editor as No Editor in the Global Configurations and edit the article.
Go to: plugins/editors/tinymce
open tinymce.php
Find this
Found this section:
// advimage
$advimage = $this->params->def('advimage', 1);
if ($advimage)
{
$plugins[] = 'advimage';
$elements[] = 'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]';
}
add |usemap after style, just like:
// advimage
$advimage = $this->params->def('advimage', 1);
if ($advimage)
{
$plugins[] = 'advimage';
$elements[] = 'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style|usemap]';
}

Customizing the Orchard navigation menu

Excuse me for asking such a general question. I'm creating a website with Orchard CMS. The website's design and interactivity are critical requirements. I have a navigation menu which has a fixed size(900 px wide), but should be able to adjust as many menu items as possible (I do this manually by modifying the css). I've used a bit of jQuery to create some animations on mouse hovers etc. for the menu. Problem is that the css and jQuery parameters are hard coded. So if a user were to change to add a new menu item, they need to know in advance the number of menu items, and sub items, thus it's not very easy for the average user to customize it which the whole point of a CMS. What is the best way of keeping this menu interactive (with the jQuery animations), and such that the user can be able to add content pages to this menu (as they do with the default navigation menu in orchard) and also user friendly such that the non technical user need to have to mess around with the jQuery and CSS of the menu?
What is the best way of doing this, should I create a module (a navigation menu component?) which will dynamically set the css/jQuery values (width etc.)
UPDATE
Also, right now I have my HTML (my navigation menu, Unorderd List etc.) and its jQuery script reference embedded in my Layout.cshtml, and the style for the navigation menu is in my Site.css in my theme, is this considered bad practice?
I eventually got this done in orchard 1.5 by overriding the Menu.cshtml view, coding some logic to check the number of menu items and then rendering navigation menus with different ID's, based on the number of menu items they contained. I then added different CSS selectors in my Site.css, each with CSS suitable for navigation menus of various sizes. Here is what my Menu.cshtml ended up looking like (this goes in the Views folder of your currently active theme).
#
{
Script.Require("jQuery");
var tag = Tag(Model , "ul");
var items = (IList<dynamic>)Enumerable.Cast<dynamic>(Model.Items);
}
#{//if the menu contains 3 items, render a nav called 'ThreeItemNav'
if(items.Count == 3){
<nav id="ThreeItemNav">
#tag.StartElement
#* see MenuItem shape template *#
#DisplayChildren(Model)
#tag.EndElement
</nav>
}
else if(items.Count == 4){
<nav id="FourItemNav">
#tag.StartElement
#* see MenuItem shape template *#
#DisplayChildren(Model)
#tag.EndElement
</nav>
}
else if(items.Count == 5){
<nav id="FiveItemNav">
#tag.StartElement
#* see MenuItem shape template *#
#DisplayChildren(Model)
#tag.EndElement
</nav>
}
}
//Include the jQuery to add animations to the navigation menu
#using (Script.Foot())
{
<script type ="text/javascript">
//<![CDATA[
$(document).ready(function () {
//Add your script here
$(" #FiveItemNav li").hover(function () {
//Do something when the sub menu list items are hovered....
});
$(" #FourItemNav li").hover(function () {
//Do something when the sub menu list items are hovered....
});
$(" #ThreeItemNav li").hover(function () {
//Do something when the sub menu list items are hovered....
});
});
//]]>
</script>
}
Note that you need to add CSS selectors in your theme for each nav element (ThreeItemNav, FourItemNav and FiveItemNav), for example in your current themes Site.css:
/*Style the Three Item Navigation menu*/
#ThreeItemNav li
{
background-color:#263A79;
}
#ThreeItemNav a:hover
{
border-right:1px solid #333;
border-left:1px solid #333;
}
#ThreeItemNav > ul li.current
{
background:#5882FA;
}
/*Style the Four Item Navigation menu*/
#FourItemNav li
{
background:#Purple;
}
#FourItemNav a:hover
{
background:Orange;
}
.........more styles
This certainly seems like a long winded approach, but it's the best I could think off so that I can maintain the functionality of the Orchard navigation menu and still style it with CSS and add jQuery animations. I figured an initial development cost was worth adding some powerful capabilities to the navigation menu in the long run. I'd love to hear any suggestions on how to do this in a neater way. Also I would definitely recommend using Orchard 1.5, since it has built in support for creating hierarchical navigation menus.
Checking out the inner workings of Menu.cshtml and MenuItem.cshtml views help a lot in trying to understand how the navigation menus are rendered in Orchard as well as inspecting how the default Theme Machine styles the navigation menu and its various levels/sub menus.

How to disable contextmenu except in the grid of telerik FileExplorer?

I tried to disable unnecessary context menu when I set a grid with ContextMenus. By default, if you click the blank part of the grid, it disables the Delete menu.
However, after adding customized menu like Download, it shows in the context menu even there is no selected item (i.e., How can I download it?). So I want to disable the unnecessary menu or make it invisible except in the grid row context menu.
I'm using telerik ASP.NET AJAX contorl 2009 Q2.
Thanks in advance.
This piece of code should help - basically what you need to do is attach a handler to the menu showing event, check the target element (the element where you right-clicked) and if it is the grid area itself - disable the menu item.
<script type="text/javascript">
function OnClientLoad(explorer)
{
explorer.get_gridContextMenu().add_showing(disableItem);
}
function disableItem(sender, args)
{
var target = args.get_targetElement();
if (target && target.className == "rgDataDiv")
{
var dlItem = sender.findItemByValue("download");
dlItem.set_enabled(false);
}
}</script><telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" OnClientLoad="OnClientLoad"></telerik:RadFileExplorer>

Resources