Creating custom datatypes using the umbraco usercontrol wrapper
本篇文章介绍的是基于UmbracoCMS技术搭建的网站所使用的相关技术。
1. 需求
Umbraco CMS的dataType中有richTexhEditor控件,但是它不是太完善,比如没有对字体进行大小颜色等设置,所以需要对此控件进行替换,用一个功能更加完善一些的控件,从网上找到了一个第三方控件叫fckEditor,就是文本编辑器。
2. 添加步骤
1. 首先创建一个usercontrol,代码如下:
RichTextEditorControl.ascx
<%@ ControlLanguage="C#" AutoEventWireup="true"CodeFile="RichTextEditorControl.ascx.cs"
Inherits="UserControls_RichTextEditorControl" %>
<%@ RegisterAssembly="CKEditor.NET" Namespace="CKEditor.NET"TagPrefix="CKEditor" %>
<CKEditor:CKEditorControlID="CKEditor1" BasePath="~/ckeditor"runat="server" Height="450"
Width="590"></CKEditor:CKEditorControl>
RichTextEditorControl.ascx.cs
using System;
usingSystem.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
usingSystem.Web.UI.WebControls;
public partial classUserControls_RichTextEditorControl :System.Web.UI.UserControl,umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
{
public string m_UmbracoValue;
protected void Page_Load(object sender,EventArgs e)
{
if (Page.IsPostBack)
{
m_UmbracoValue = CKEditor1.Text;
}
CKEditor1.Text = m_UmbracoValue;
//设置fckEditor的工具栏选项
CKEditor1.config.toolbar = new object[]
{
new object[] {"Source", "-", "NewPage", "Preview","-", "Templates" },
new object[] {"Cut", "Copy", "Paste", "PasteText","PasteFromWord"},
new object[] {"Undo", "Redo", "-", "Find", "Replace","-", "SelectAll", "RemoveFormat" },
"/",
new object[] {"NumberedList", "BulletedList", "-","Outdent", "Indent", "Blockquote"},
new object[] {"JustifyLeft", "JustifyCenter", "JustifyRight","JustifyBlock" },
new object[] {"Link", "Unlink", "Anchor" },
new object[] {"Image", "Table", "HorizontalRule","SpecialChar", "PageBreak", "Iframe" },
"/",
new object[] {"Bold", "Italic", "Underline"},
new object[] {"Styles", "Format", "Font", "FontSize"},
new object[] {"TextColor", "BGColor" }
};
}
public object value
{
get
{
returnm_UmbracoValue;
}
set
{
m_UmbracoValue = value.ToString();
}
}
}
2. Xslt代码:
登录Umbraco后台选择Develeoper页签,创建一个DataType。
然后在renderControl中选择umbraco usercontrol wrapper并保存。
然后可以看到usercontrol的选择框,即选择我们创建的usercontrol即可。
到此为止我们就创建成功一个datatype,在Settings也页签中的Document type中就可以选择该DataType了。
Creating custom datatypes using the umbraco usercontrol wrapper的更多相关文章
- 【IOS笔记】Creating Custom Content View Controllers
Creating Custom Content View Controllers 自定义内容视图控制器 Custom content view controllers are the heart of ...
- ASP.NET MVC- VIEW Creating Custom HTML Helpers Part 2
The goal of this tutorial is to demonstrate how you can create custom HTML Helpers that you can ...
- Extending JMeter – Creating Custom Config Element – Property File Reader
JMeter is one of the best open source tools in the Test Automation Community. It comes with all the ...
- Collection View Programming Guide for iOS---(六)---Creating Custom Layouts
Creating Custom Layouts 创建自定义布局 Before you start building custom layouts, consider whether doing so ...
- View Controller Programming Guide for iOS---(四)---Creating Custom Content View Controllers
Creating Custom Content View Controllers 创建自定义内容视图控制器 Custom content view controllers are the heart ...
- 管理后台-第一部分:Creating custom sections in Umbraco 7 - Part 1(翻译文档)
在Umbraco上每个部分都可以被称为一个应用程序,所以这些部分和应用程序基本上是一样的.我们首先要做的事情是需要创建应用程序.在这个例子中,我不会去摆弄xml文件或是数据库——我将使用类来创建我的内 ...
- [TensorFlow] Creating Custom Estimators in TensorFlow
Welcome to Part 3 of a blog series that introduces TensorFlow Datasets and Estimators. Part 1 focuse ...
- Creating Custom Connector Sending Claims with SharePoint 2013
from:http://blogs.msdn.com/b/security_trimming_in_sharepoint_2013/archive/2012/10/29/creating-custom ...
- Creating Custom Login Screen In Oracle Forms 10g
Below is the example plsql unit to validate login credentials and after successful validation open a ...
随机推荐
- 坑爹的NSIS转义符:$ (在NSIS的MessageBox中写换行文字)
最近的项目中,发现了NSIS一个比较坑的地方:$ 不但是变量常量的开头,还是一个转义字符. 大家有没有发现,NSIS写的脚本中,如果要让弹出消息框中的文字带换行功能,“\r\n” 是不是很不管用呢? ...
- 向OC类中添加默认的协议实现(ProtocolKit)
以forkingdog的PorotocolKit举例 举例 ProtocolKit Protocol extension for Objective-C Usage Your protocol: @p ...
- 文件操作 - NSFileManager
iOS的沙盒机制,应用只能访问自己应用目录下的文件.iOS不像android,没有SD卡概念,不能直接访问图像.视频等内容.iOS应用产生的内容,如图像.文件.缓存内容等都必须存储在自己的沙盒内.默认 ...
- 转:Redis Geo: Redis新增位置查询功能
原文来自于:http://www.infoq.com/cn/news/2015/07/redis-geo 移动互联网增进了人与人之间的联系,其中基于位置信息的服务(Location Based Ser ...
- 240多个jQuery插件
概述 jQuery 是继 prototype 之后又一个优秀的 Javascript 框架.其宗旨是—写更少的代码,做更多的事情.它是轻量级的 js 库(压缩后只有21k) ,这是其它的 js 库所不 ...
- BZOJ 1707: [Usaco2007 Nov]tanning分配防晒霜
Description 奶牛们计划着去海滩上享受日光浴.为了避免皮肤被阳光灼伤,所有C(1 <= C <= 2500)头奶牛必须在出门之前在身上抹防晒霜.第i头奶牛适合的最小和最 大的SP ...
- XMLHttpRequest2的进步之处
本文参考自:XMLHttpRequest2 新技巧 (重点保留demo,方便自己日后查阅) HTML5是现在web开发中的热点,虽然关于web app和local app一直有争论,但是从技术学习的角 ...
- VC下载文件显示进度条
VC下载文件显示进度条 逗比汪星人2009-09-18上传 by Koma http://blog.csd.net/wangningyu http://download.csdn.net/deta ...
- Xamarin IOS – hello word
原文:Xamarin IOS – hello word 环境 硬件:Macbook pro Retina 13 系统:10.11.3 EI Capitan Xcode:7.0 Ps:配置刚刚够用. 安 ...
- 一起啃PRML - 1.2.1 Probability densities 概率密度
一起啃PRML - 1.2.1 Probability densities @copyright 转载请注明出处 http://www.cnblogs.com/chxer/ 我们之前一直在讨论“谁取到 ...