如何在SharePoint中实现用户主题切换?

发布于 2024-07-29 03:07:05 字数 113 浏览 4 评论 0原文

我的客户想要为 SharePoint 应用程序提供 2 个主题。 MOSS 2007 中有实现这一目标的策略吗?

我们希望应用基于用户配置文件的主题选择,甚至可能是一个下拉菜单来切换模式。

My customer wants to provide 2 themes for a SharePoint application. Is there a strategy to accomplish this in MOSS 2007?

We want to apply user profile-based theme selection, and maybe even a drop-down to switch modes.

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

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

发布评论

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

评论(4

琉璃梦幻 2024-08-05 03:07:05

我不知道您希望重新主题的范围有多大。 但是,如果它可能仅包含 CSS,您可以使用以下方法:

  1. 将不同主题的 CSS 文件存储在样式库中。

  2. 创建一个列表来存储用户及其选择的主题。

  3. 编写一个功能和自定义应用程序页面以允许用户更改主题。

  4. 编写一个控件,根据当前用户在列表中进行查找,并获取对样式库中相应 CSS 文件的引用。 然后,该控件将输出 CssRegistration 和指向此文件页面的 CssLink 控件.

  5. 将此控件添加到母版页,以便它在每个页面上执行(应添加缓存)。

我不明白为什么微软不支持这个,因为你只是改变CSS。

如果您需要做更多的事情,那么另一个选择是编写一个更改 HTML 输出的 HTTP 模块。 当然还有 JavaScript。 使用这两个选项,您可能会遇到支持性问题(这取决于您的更改的范围)。

I don't know how extensive you want your re-theming to be. However if it could be CSS-only you could use this approach:

  1. Store the CSS files for the different themes in the Style Library.

  2. Create a list that stores the user and their chosen theme.

  3. Write a feature and custom application page to allow the user to change their theme.

  4. Write a control that does a lookup on the list against the current user and obtains the a reference to the corresponding CSS file in the Style Library. The control would then output the CssRegistration and CssLink controls to the page for this file.

  5. Add this control to the master page so it executes on every page (caching should be added).

I can't see why this wouldn't be supportable by Microsoft as you're only changing CSS.

If you need to do more than that then another option is to write an HTTP module that changes the HTML output. Or of course JavaScript. With these two options you may have supportability issues (it depends on how extensive your changes are).

欲拥i 2024-08-05 03:07:05

现在,Bjørn Furuknap 在 Codeplex 上还提供 SPThemes。 用户可以选择自己的主题,并且可以应用于不同的范围。

There is also SPThemes now available on Codeplex from Bjørn Furuknap. Users can choose their own themes and they can be applied at different scopes.

东风软 2024-08-05 03:07:05

以下是我根据研究和反馈提出的选项。 这两者似乎都不可行。

  • 在 JavaScript 中实现主要的 UI 布局更改。 这会导致客户端速度变慢,难以编码,并且由于需要引用可能随后续 SharePoint 补丁而更改的 SharePoint 对象,因此 Microsoft 完全不支持。

  • 提供两个基于相同数据的并行主题站点,并提供在它们之间切换的方式。 这需要我们将每个站点部署到多个位置,并且需要重新调整代码中的任何站点创建机制(因为它们需要定位两个站点而不是一个)。

Here are the options that I’ve come up with from research and feedback. Both of which seem mostly infeasible.

  • Implement major UI layout changes in JavaScript. This would lead to client slowdowns, would be difficult to code, and would be completely unsupported by Microsoft due to the need to reference SharePoint objects that may change with subsequent SharePoint patches.

  • Provide two parallel themed sites based on the same data, and provide a way to switch between them. This would require that we deploy each site to multiple locations, and would require retooling of any site creation mechanisms in code (since they'd need to target two sites instead of one).

葮薆情 2024-08-05 03:07:05

您可以尝试的另一件事是使用 codeplexTheme Changer 和 ThemeChangerStaple > ,这是作为功能实现的,您可以使用相同的代码逻辑通过一些修改来归档您想要的内容,将其作为使用 CustomAction 的用户的选项。

One another thing you can try is to use the Theme Changer and ThemeChangerStaple from codeplex , That is implemented as feature you can use the same code logic to archive what you want with bit of modification, give it as an option for the user using CustomAction.

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