umbraco 重建cmsContentXml 表

发布于:
Microsoft.Net

我对umbraco 数据表进行的批量更改,但是需要重新生成cmsContentXml表中的内容,该表用于为前端缓存数据创建umbraco.config文件。在Forum搜索了很久才找到现成的方法,本来有文档的,后来地址变了就找不到了,记录下来,防止下次忘记了。

访问你的网站地址 http://YOURDOMAIN/Umbraco/dialogs/republish.aspx?xml=true 点击republish 就完成了,如此简单。。

How To Reset Main Umbraco 7 Admin Password

发布于:
Microsoft.Net
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using System;
using System.IO;
using System.Text;
using System.Configuration;
using umbraco.IO;

namespace Tmp.PasswordReset
{
     public class RegisterEvents : ApplicationEventHandler
     {
          protected override void ApplicationStarted(UmbracoApplicationBase 
                    umbracoApplication, ApplicationContext applicationContext)
          {
               UmbracoApplicationBase.ApplicationInit += ResetAdminPassword;
          }

          public void ResetAdminPassword(object sender, EventArgs e)
          {
               var userService = ApplicationContext.Current.Services.UserService;

               var adminUser = userService.GetUserById(0);
               adminUser.Username = adminUser.Email = "hello@umbraco.org";
               adminUser.FailedPasswordAttempts = 0;
               adminUser.IsLockedOut = false;
               adminUser.IsApproved = true;
               userService.SavePassword(adminUser, "123Qwe!");
          }
     }
}

 

All Your Images Are Belong to Umbraco

发布于:
Microsoft.Net

Today I am going to talk to you about a tool that has been shipped within the Umbraco core since v7.1. It powers the Image Cropper property editor but can do much much more to help you build high quality, performant websites. That tool is called ImageProcessor.

ImageProcessor is actually two libraries: ImageProcessor – A library for desktop and web that provides a fluent API allowing you to easily chain methods to deliver the desired output, and ImageProcessor.Web – A web extension to ImageProcessor that allows the developer to perform image manipulation using a Url API of querystring parameters as instructions.

Umbraco删除无用Version

发布于:
Microsoft.Net

Umbraco会保存每次修改的草稿,这样的网页内容可以方便的回滚到以前的任意一个版本(Version),这是一个相当赞的功能。

我的网站大概不到两千条内容页,但是我最近查看数据库,数据库达到了800MB之在,一查看数据库中保存的Version 有一万8八条之多,cmsPropertyData表更是有记录三十万之巨。

虽然数据库记录很多,但是网站性能还是很不错的,但是我的网站内容基本不用回滚到以前版本,保存这些对我来说没有多少意义,所以决定删除这些Version。

umbraco 修改部分 根据ID生成Url以解决URL中出现中文的问题

发布于:
Microsoft.Net

较早版本的修改

//srcUmbraco.Core.Models.ContentExtensions.cs
// line 425
// 解决发布URL问题
var niceUrl = contentBase.Name.FormatUrl().ToLower();
    niceUrl = string.Format("item-{0}", contentBase.Id).FormatUrl().ToLower();//增加此行
//srcumbraco.cms.businesslogic.datatypeFileHandlerData.cs
// line 50
//解决上传文件命名问题
var name = IOHelper.SafeFileName(postedFileName.Substring(postedFileName.LastIndexOf(IOHelper.DirSepChar) + 1, postedFileName.Length - postedFileName.LastIndexOf(IOHelper.DirSepChar) - 1).ToLower());
    name = String.Concat(Guid.NewGuid(), Path.GetExtension(name));//增加此行

更新到6.1.0以后的修改

Handling External URLs in Umbraco 6 页面重定向到外部URL

发布于:
Microsoft.Net

copy from: http://www.theoutfield.net/blog/2013/10/handling-external-urls-in-umbraco-6

Umbraco 有一些特殊的别名,如:umbracoUrlName,能让你在当前网站中的页面间重定向。然而,他没有一个内置的方法将一个页面重定向到外部URL。我认为我想出了一个相当不错的办法,下面讲解如何做到:

创建一个属性(Property)

我们在文档类型中创建一个名为“umbracoExternalUrl”的文本字符串属性。

创建 IUrlProvider

  我已经设立我们需要的属性,现在我们要让umbraco知道,当这个属性值被设置的时候,就使用他的值来作为节点的URL而不是使用默认生的URL。我们将使用Umbraco一个很酷的新功能实现它,它是一个UrlProvider,该IUrlProvider接口能在生成一个节点的URL的时候定义我们自己的逻辑。继续,我们建立一个接口如下

Umbraco 7 编辑器tinymce配置

发布于:
Microsoft.Net

Umbraco 发布了新的版本,Umbraco 7,全新的后台。看上去非常不错。

但的他有编辑器默认配置还是有点满足不了需要,查了一下文档,有些配置可以在 <InstallPath>ConfigtinyMceConfig.config 中修改

<commands> 中增加一个按钮(文字颜色选择器),如下

<command>
            <umbracoAlias>forecolor</umbracoAlias>
            <icon>images/editor/forecolor.gif</icon>
            <tinyMceCommand value="" userInterface="false" frontendCommand="forecolor">forecolor</tinyMceCommand>
            <priority>1001</priority>
 </command>

 

当然增加了这个不会有任何效果的,好像他依赖 textcolor 插件,所以在 <plugins> 中启用这个插件

<plugin loadOnFrontend="true">textcolor</plugin>

 

依次类推,就这么简单。

但是,我遇到一个难题,想在 Formats 中分组显示各种样式,默认可以在后台配置 启用编辑器CSS样式解析,但是不分组显示,不是很方便啊。不想动他源码,不然升级麻烦。