I use ZK (just started learning), and I'd like to set some of the text from my modal window's title to bold.
Here is the code I use :
<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window apply="hidden-file-name" title="${msg:l('title')}" width="390px" closable="true">
<tablelayout columns="2">
<!-- Some code -->
</tablelayout>
</window>
</zk>
I have already divided title in my .properties file into title and info. I'd like the "info" part to appear in bold.
Just in case, here's an example :
Title : "This is my title"
Info : " and this is the info"
-> I want my modal window to have this title : "This is my title and this is the info".
I found a dirty solution, which is to set the "info" part as a caption, use float: left; to bring it to the left, and alter the css of the "title" part by setting a fixed width to remove the space appearing between the two parts, but as you can see, this is bad.. I'd like something clean.
Add Caption to Window and the position should be by default
[Title here][Caption Here]
so just put the info in the Captions label and set it to bold.
To set different styles to the same label is as far as i know not
possible in zk directly.
Of course you can change it via java script, but this would imho
be overkill in your case.
Edit
See this example. You see that title and caption are both left.
So this is normal.
After I play around a bit, I found a solution. Look here.
You can try override the bind_ function to update the content of title after dom elements rendered by Client Side Programming,
e.g.,
<window border="normal" title="the bold title">
<attribute w:name="bind_"><![CDATA[
function (a, b, c) {
this.$bind_(a, b, c);
var cap = this.$n('cap');
cap.innerHTML = cap.innerHTML.replace('bold', '<span style="font-weight: bold;">bold</span>');
}
]]></attribute>
</window>
Ref:
ZK Client Side Programming
Related
I'm very new at orchard and I'm having troubles finding a solution for what I think is a basic problem.
I want to render my own custom shape 'Content-Button' for my custom content type 'Button'. This works wonderful!
The Button content is made out of:
Display name
Content picker
My custom shape looks like this:
#using Orchard.Utility.Extensions;
#{
if (Model.Title != null) {
Layout.Title = Model.Title;
}
Model.Classes.Add("content-item");
var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify();
Model.Classes.Add(contentTypeClassName);
var tag = Tag(Model, "div");
tag.AddCssClass("row");
}
#tag.StartElement
<div id="" class="col-md-8 col-sm-10 col-xs-8 col-xs-push-2 col-sm-push-1 col-md-push-2 btn btn-secondary center-block">
#Display(Model.Content)
</div>
#tag.EndElement
What I'm however trying to do is instead of calling '#Display(Model.Content)' I would like to call a specific shape to be rendered there. Like #Display(Model.Content.DisplayName).
I would like to do the same for the content picker so i can make a link in the div (through ID)
I've also tried to exlude certain (extra) fields using my theme's placement.info) but it seems I'm doing something wrong there as well.
<Match ContentType="Button">
<Place Parts_Contents_Publish="-"></Place>
<Place Fields_Common_Text="-"/>
</Match>
Note: The 'Fields_Common_Text' was purely a test but it stills renders that shape on my button.
If somebody could point me in the right direction, explain it or send me some very good documentation to read through I would be a very happy man.
You can access fields directly as following:
#Model.ContentItem.ButtonPart.DisplayName.Value
and same thing for content picker field, then you don't need to use placement.info file any more.
I've recently added a simple ZK ThemeProvider that adds some CSS files, which works fine but seems to have a strange side effect... My index page looks like this...
<?page id="iframe" title="${labels.title}"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver" ?>
<zk>
<include src="/zk/content/outerContainer.zul" id="outerContainer" sclass="outerContainerLayout" apply="com.example.RootComposer"/>
</zk>
But somehow, ZK ends up putting this style into the include-div...
style="width:100%;height:100%;"
The width and height of 100% is not correct, but I have no idea where they come from. Interesting enough, it only happens to that include - not includes following. Except, when I try to wrap the thing into another include - both get 100%, but still not the includes below that in the hierarchy.
Anyone an idea where zk adds this strange style?
The solution is in the documentation:
If this component is the only child of its parent, the default width
and height will become 100%.
Somehow this only seems to happen when ThemeProvider is used (or there was some other side effect before that prevented it). Anyway, adding a (hidden) empty div to my index page solved the problem:
<?page id="iframe" title="${labels.title}"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver" ?>
<zk>
<include src="/zk/content/outerContainer.zul" id="outerContainer" sclass="outerContainerLayout" apply="com.example.RootComposer"/>
<div sclass="hidden"/> <-- Cannot have a poor, sad, alone include -->
</zk>
Now the style of the include-div is empty, as it should be.
I am using iReport 5.2.0. I'm trying show a parameter as checkbox: checked or unchechecked. How I can solve this task?
Answer by #Kudo
I'm using two images to display checkbox or uncheckbox. In each image, using Image Expression else if. ex: $P{param}.equals("TRUE") ? $P{imagecheck} : $P{imageuncheck}
I'm using a text field with this expression:
$F{b}!=null?"þ":"¨"
and set font: Wingdings.
The first symbol is a checked box, the second is an unchecked box.
So, if I want a check I just send a character from database in field b. If I want a blank box I leave b field null.
... and check this too:
http://jasperreports.sourceforge.net/sample.reference/fonts/
it provides information like "How to ship the required fonts with your report templates when deploying them in the target application, using font extensions."
You do not need to put images to create a checkbox. Just put a 11x11 rectangle. and add 2 pieces of 9x9 lines like "\" and "/" and laminate them(put on top of each other). Make the line at bottom Opaque and right click and send it backward. Make the line at top "not opaque". If not showing one of them true, just play with these back or front settings. Then center those laminated lines into your rectangle. After all you can set print when expression parts by code. thats all!
By the way you can reverse "\" line to "/", by line properties > direction > "bottom up" or "top down" settings. Have a nice day!
Another way is to use unicode ensure your jasper report has an encoding of:
...
<?xml version="1.0" encoding="UTF-8"?>
...
<field name="COLUMN_1" class ="java.lang.Boolean" />
...
<textFieldExpression class="java.lang.String">
<![CDATA[$F{COLUMN_1} ? "\u2713":"\u2717"]]>
</textFieldExpression>
...
Before:
After:
How can I add attributes to the current Insert Image dialogue box on umbraco Richtext Editor?
What I really want is to let content editor choose images and set their class, and maybe choose if this is lightbox image or not. If user choose lighbox option, then a hyper link is added with some extra attributes, like data-rel. I even want to be able to modify the image url added by the content editor, if possible.
The output should look like this
<a href="/media/2813/DSC_2615.JPG" data-rel="prettyPhoto[gal-3-col]" >
<img src="http://domain.com/imageGen.ashx?
image=%2fmedia%2f2813%2fDSC_2615.JPG&width=420" alt="DSC_2615" title="DSC_2615"
class="alignright">
</a>
I found this very useful link http://forum.umbraco.org/yaf_postst8163_TinyMCE--insert-image-dialog.aspx which solve half of my issue, but I can't figure out how to continue
Default umbraco tinymce add image interface is
<plugin loadOnFrontend="false">umbracoimg</plugin>
I was able to modify it to show additional field in the image selection interface, then render markup I want.
I edited \umbraco\plugins\tinymce3\insertImage.aspx, added my field there and some jquery logic:
<ui:PropertyPanel id="pp_desc" runat="server" Text="Description">
<input type="text" id="title" style="width: 300px"/>
</ui:PropertyPanel>
...
Then if you are adding custom attributes, you might want to add them to \config\umbracoSettings.config
<!-- what attributes that are allowed in the editor on an img tag -->
<allowedAttributes>src,alt,title,border,class,style,align,id,name,onclick,usemap</allowedAttributes>
and \config\tinyMceConfig.config
<validElements>
<![CDATA[+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|
ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],
-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],
img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel],
-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],
-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],
thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],
-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],
-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align],-h2[id|dir|class|align],
-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],
dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],
param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*],code[*]]]>
</validElements>
Then I modified the .js that is in charge of rendering html that will be added to tinymce editor:
\umbraco_client\tinymce3\plugins\umbracoimg\js\image.js
ed.execCommand('mceInsertContent', false, '<div id="__dimps_width" class="img-with-text"><img id="__mce_tmp" /><p id="__dimps_desc">description</p></div>', { skip_undo: 1 });
ed.dom.setAttribs('__mce_tmp', args);
ed.dom.setAttrib('__mce_tmp', 'id', '');
ed.dom.setAttribs('__dimps_width', {style: 'width: ' + nl.width.value + 'px;'});
...
One important thing: everything is cached and bundled, so to make sure your changes was applied remove all files from \app_data\TEMP\ClientDependency\ and use new instance of incognito browser. You probably can disable it somewhere, but I just removed the cache.
There is no magic in Umbraco TinyMCE. Just a bunch of .aspx and .js code. Modify it to your needs.
I'm working on a site in EPiServer, and whenever I create a page property with the type set to "XHTML string" (which uses the WYSIWYG content editor in Edit mode), it wraps all content in <p> tags.
Is there any way to prevent this from happening? I can't remove the paragraph margins universally through my CSS (e.g. p {margin: 0 !important;}) since I do need the margins for actual paragraphs of text. I've even tried going to the HTML source view in the editor and manually deleting the <p> tags that it generates, but it immediately adds them back in when I save!
It doesn't happen when the property type is either a long or short string, but that's not always an option since the content might contain images, dynamic controls, etc.
This is becoming a real nuisance since it's very hard to achieve the layout I need when basically every element on the page has extra margins applied to it.
As Johan is saying, they are there for a reason - see more info here. That being said, it's not impossible to remove them. It can be done in one of two ways (taken from world.episerver.com:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
myEditor.InitOptions["force_p_newlines"] = "false";
}
or
<script type="text/javascript">
tinyMCE.init({
force_p_newlines: false
});
</script>
You can add your own custom TinyMCE-config that removes P-elements or strip them out using regular expressions either when saving the page or when rendering the property/page.
I think it's a bad idea though. P-elements are what the editors generate the most and in most cases their content is also semantically correct. Better to wrap your property in a div with a class and adjust margins using CSS like you mention.
If you're using a version of EPiServer with TinyMCE editors, you can insert <br /> elements instead of <p> elements if you type shift-enter instead of enter. This should eliminate your margin problems.
More info at the link below:
http://www.tinymce.com/wiki.php/TinyMCE_FAQ#TinyMCE_produce_P_elements_on_enter.2Freturn_instead_of_BR_elements.3F
EDIT: My comment below answers his question better.
I discovered that while I can't remove the <p> tags from the source view (because it adds them back in automatically), if I replace them with <div> tags, it'll leave things alone. It does mean that I've got an extra <div> wrapping some elements that I don't really need, but at least a <div> doesn't add margins like a <p> does, so...good enough!