使用 jQuery 更改 SharePoint 中的 application.master 页面

发布于 2024-08-03 22:47:14 字数 363 浏览 9 评论 0原文

我们使用 MOSS 2007 (SharePoint) 作为我们的 Intranet。最近,我们的任务是为我们农场的多家公司提供品牌支持。我们很快意识到应用程序页面(由修改后的 application.master 生成)无法提供多个品牌模板(主题除外)。

我认为正确的解决方法是在应用程序页面上保留默认的 Microsoft 品牌(我们已经在开发中致力于此 - 不对服务器上托管的文件进行修改)。

然而,作为一种快速解决方案,我想我也许可以使用 jQuery 来替换应用程序页面上的一个徽标、一些导航图像和一些颜色。基本上在页面完全呈现之前从品牌 A 到品牌 B。

我的问题是……这个想法有多糟糕?这样做有哪些陷阱?鉴于这只是一个临时解决方案,我应该尝试一下吗?

We use MOSS 2007 (SharePoint) for our intranet. Recently we were tasked with supporting the branding for multiple companies on our farm. We quickly realized that the application pages (produced by a modified application.master) can't serve up multiple branded templates (other than themes).

I think the right fix is to keep the default Microsoft branding on application pages (we were already working on this in dev - no modifications to files hosted on the server).

As a quick fix however, I was thinking that I might be able to use jQuery to replace one logo, a handful of nav images, and a few colors on the application pages. Basically going from Brand A to Brand B before the page is fully rendered.

My question is... how bad is this idea? What are the pitfalls associated with doing this? Given that it is only an interim solution, should I try it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野の 2024-08-10 22:47:14

要添加到 Kobi 的答案,您可以使用委托控制功能进行部署。

_controltemplates下放置一个用户控件,如:

<%@ Control Language="C#" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<SharePoint:CssRegistration name="/_layouts/custom/app.css" runat="server"/>

编写委托控件功能(这里是elements.xml):

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 <Control ControlSrc="~/_ControlTemplates/CustomBranding.ascx"
                 Id="AdditionalPageHead" Sequence="1" />
</Elements>

包含自定义CSS在_layouts/custom/app.css中。

To add to Kobi's answer, you can use a delegate control feature for deployment.

Place a user control under _controltemplates, such as:

<%@ Control Language="C#" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<SharePoint:CssRegistration name="/_layouts/custom/app.css" runat="server"/>

Write the delegate control feature (here is elements.xml):

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 <Control ControlSrc="~/_ControlTemplates/CustomBranding.ascx"
                 Id="AdditionalPageHead" Sequence="1" />
</Elements>

Include custom CSS in _layouts/custom/app.css.

与酒说心事 2024-08-10 22:47:14

我认为你的大部分问题都可以通过一个好的 CSS 文件来解决。根据我的经验,这比 javascript 更好,因为它加载速度更快。请记住,SharePoint 会生成大量页面(DOM 方面),因此 jQuery 需要很长时间才能到达 $(document).ready,甚至在 IE6 上操作过大的 DOM 需要更长的时间这可能需要几秒钟,给人的印象就像网站或服务器速度慢一样。
我使用 CSS 对 SharePoint 进行了许多自定义:可能需要一些臭味 !important,但结果比 javascript 更好。
另外,请记住,您可以设置每个站点的 CSS 文件(在设置子站点的母版页的同一页面上) - 这可以用来代替实际为每个品牌创建母版页。

I think most of your problems can be solved with a good CSS file. This is better than javascript, in my experience, since it loads a lot faster. Keep in mind that SharePoint produces heavy pages (DOM wise), so jQuery takes a long time to get to $(document).ready, and even longer time to manipulate that over-sized DOM - on IE6 this can take several seconds, giving the same impression as a slow site or server.
I've done many customization to SharePoint using CSS: It may take a few smelly !importants, but the result is better than javascript.
Also, remember that you can set a per-site CSS file (on the same page you set the sub-site's master page) - this can be used instead of actually creating a master page for every brand.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文