SharePoint 2010:创建一个书签按钮,将页面添加到“我的链接”
我正在尝试在我的母版页上创建一个链接/按钮,单击该链接/按钮会将当前页面添加到用户的我的链接列表中。这只是一个快捷方式,让用户不必导航到他们的我的网站并手动添加链接。
[这篇博文]给出这个问题的解决方案,但我在“添加链接”对话框 (QuickLinksDialog2.aspx) 的第二行收到 JavaScript 错误,因为 frameElement 属性为 null:
<script language="Javascript">
var form = document.forms[0];
var args = window.parent.frameElement.dialogArgs;
无论如何,Portal.js 似乎包含“我的链接”页面 (_layouts/MyQuickLinks.aspx) 用于向此列表添加链接的所有函数。
谁能建议我如何从我的母版页调用其中一个/某些函数,以便打开“添加链接”对话框并预先填充标题和 URL 字段?
I am trying to create a link/button on my masterpage which when clicked, adds the current page to the user's My Links list. This is merely a shortcut to save the user from having to navigate to their My Site and add the link manually.
[This blog post] gives a solution to this problem, but I get a JavaScript error on the second line of the "Add Link" dialog (QuickLinksDialog2.aspx) because the frameElement property is null:
<script language="Javascript">
var form = document.forms[0];
var args = window.parent.frameElement.dialogArgs;
Regardless, Portal.js appears to contain all the functions that the My Links page (_layouts/MyQuickLinks.aspx) uses to add links to this list.
Can anyone suggest how I might go about calling one/some of these functions from my masterpage so that the "Add Link" dialog is opened with the title and URL fields pre-poulated?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终使用对象模型来创建“我的链接”(与弹出对话框相反)。
这样做的好处是添加链接现在只需一键式过程,缺点是用户没有机会重命名链接或将其分配给组(就我个人而言,我已将组从无论如何,UI 因为我们不需要它们,所以这对我来说不是问题)。
对于那些感兴趣的人,我创建了一个小用户控件,其中仅包含一个 ajaxified 按钮,您可以将其拖放到母版页/页面布局上。我的代码如下:
HTML
C#
I ended up using the object model to create the My Links (as apposed to the popup dialog).
The upside to this is that adding a link is now only a 1-click process, the downside is that the user does not have the opportunity to rename the link or assign it to a group (personally, I've hidden the groups from the UI anyway as we didnt need them so this was a non-issue for me).
For those interested, I created a little usercontrol which just houses an ajaxified button which you can drop onto your masterpage / page layout. My code for this is as follows:
HTML
C#
将以下功能添加到您的母版页:
然后添加您的锚标记:
Add the following function to your master page:
Then add your anchor tag: