SharePoint view access control - sharepoint

I have the following requirement to fulfill:
I have a view group by "Project" column. Current logged in user need to expand only a project that he/she belongs to (I have a way to get the user's project). The grouped projects have the following forms:
<td nowrap="" class="ms-gb" colspan="100"><img width="0" height="1" alt="" src="/_layouts/images/blank.gif"><a onclick="javascript:ExpCollGroup('1-2_','img_1-2_');return false;" href="javascript:"><img border="0" alt="Expand/Collapse" src="/_layouts/images/plus.gif" id="img_1-2_"></a> <a onclick="javascript:ExpCollGroup('1-2_','img_1-2_');return false;" href="javascript:">Project</a> : Project1 <span style="font-weight: lighter">‎(2)</span></td>
<td nowrap="" class="ms-gb" colspan="100"><img width="0" height="1" alt="" src="/_layouts/images/blank.gif"><a onclick="javascript:ExpCollGroup('1-3_','img_1-3_');return false;" href="javascript:"><img border="0" alt="Expand/Collapse" src="/_layouts/images/plus.gif" id="img_1-3_"></a> <a onclick="javascript:ExpCollGroup('1-3_','img_1-3_');return false;" href="javascript:">Project</a> : Project2 <span style="font-weight: lighter">‎(1)</span></td>
Tried the following but disables all project links:
$('td:contains("Project1") td.ms-gb a').removeAttr("onclick").click(function() { return false; });
Also when a user clicks on project that he/she don't have access to, I need to throw out a message "you do not have access to this project...".
All helps are greatly appreciated! Thanks!

to disable the specified project group linke, use this (project1 for ex.):
$("td:contains('Project1')>a").removeAttr("onclick");
I haven't found out how to change items links' behavior under a certen group. But, even if we can do that, we still can't prevend unauthorized users to access the project items through url directly. The best solution is to stop those items permission inherit and give access permisson only to those people who supposed to read or write the items.

Related

qListView custom display & Lync presence indicator issue

I've got a basic list of users with some roles & features and am using qlist to display them how I want on the main page. The only problem is that I cannot get the Lync presence indicator to work with a Custom Display.
If I just use the default Sharepoint List View or the Quest 'Display Fields' one without custom display, it's fine but I cannot get the presence indicator to work using custom. I'm really hoping that I'm missing something super simple...
The normal Display Field looks like this (tickbox for 'Enable Presence' checked) and the Lync indicator is there:
<Fields LookupThresholdControlSetting="Default">
<Field Name="Name" Presence="true" GroupExpanded="false" />
<Field Name="Responsible for..." />
</Fields>
The bit of my custom display that's not working so well is here (pulling some other fields too but they're fine). The Lync indicator doesn't appear:
<td valign="top" style="font-size:14px; padding:2px;">
<%Name%><br>
<%Job Title%><br>
<%Telephone Number%><br>
<%Responsible for...%>
</a> </td>
I have a workaround that displays the indicator (non-custom display) but I don't like it so would like to have my custom one.
Can anyone tell me if adding the equivalent of Presence="true" is possible with a Custom Display? The name field is pulling AD details with Lync presence.
update
I have come a little further with this and now have a Lync icon appearing with the correct details etc...but it's showing everyone as offline (unless hovered over in which case it's fine..)
<td valign="top" style="font-size:14px; padding:2px;">
<img src="/_layouts/images/imnhdr.gif" onload="IMNRC('<%EMail%>')" id="<%ID%>" name="imnmark<%ID%>" ShowofflinePawn = "1" border="0" height="12" valign="middle" /><%Name%><br>
<%Job Title%><br>
<%Telephone Number%><br>
<%Responsible for...%>
</a>
</td>
FIXED
FIXED - Dell Forums came through with a solution.
<td valign="top" style="font-size:14px; padding:2px;">
<span><img src="/_layouts/images/imnhdr.gif" onload="IMNRC('<%EMail%>')" id="QAIMID<%ID%>" name="imnmark<%ID%>" ShowofflinePawn = "1" border="0" height="12" valign="middle" /><%Name%></span>
<br>
<%Job Title%><br>
<%Telephone Number%><br>
<%Responsible for...%>
</a>
</td>
</tr>
</table>

How to style Blog Output in Orchard CMS

I am a beginner using Orchard CMS (and web design in general). I'm having trouble styling the output of blog pages on my site. Many of my pages have custom HTML to create a background for text. I would like to re-create this background on all blogs created through the Dashboard.
I've looked all through this site and Google for the past few weeks trying to find information, but I can't find anything substantial that isn't completely over my head.
I removed some information for privacy reasons, but basically the code creates a container where I can place my content. Here is the (revised) code for the background:
<table style="float: right" width="100%" border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width: 21px;"><img src="src.gif" /></td>
<td style="background-image: url('src.gif'); font-family: Arial, Helvetica, sans-serif; color: white; font-size: 15px; font-weight: bold;">
<span style="float: left">[Redacted]</span>
<span style="float: right">
<script language="javascript">
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday",
"Thursday","Friday","Saturday");
var monthNames = new Array(
"January","February","March","April","May","June","July",
"August","September","October","November","December");
var now = new Date();
document.write(dayNames[now.getDay()] + ", " +
monthNames[now.getMonth()] + " " +
now.getDate() + ", " + now.getFullYear());
</script>
</span>
</td>
<td style="width: 21px;"><img src="src.gif" /></td>
</tr>
<tr>
<td style="background-image: url('src.gif');"></td>
<td style="background-color: #fcfefc;">
<!-- Content goes here -->
<!-- End Content -->
</td>
<td style="background-image: url('src.gif');"></td>
</tr>
<tr>
<td><img src="src.gif" /></td>
<td style="src.gif');"></td>
<td><img src="src.gif" /></td>
</tr>
</tbody>
</table>
Here are my questions:
How do I style my blog(s) and every blog page so that all content falls within this container?
How do I change the output of the 'excerpt'? The default length of the blog excerpt cuts off in strange places. I want to be able to control this.
Aside from orchardproject.net, can anyone recommend a good place to find Orchard documentation for beginners? I feel the learning curve is steep for me, but I'm committed to learning Orchard. Can you recommend a good place to start so that I can get a good base for this type of stuff?
I'm quite a beginner, but I'm trying to get better, so please bear with me. I have almost no .Net or C# experience, and my CMS knowledge is basic (Wordpress).
Thanks for reading!
In your theme, override the content.cshtml template so it includes your html instead of what's in the default one. The original template shows how to add zones into which content will get inserted (typically something like #Display(Model.Content).
Override the content summary template. See http://weblogs.asp.net/bleroy/archive/2012/07/01/my-body-summary-template-for-orchard.aspx
http://docs.orchardproject.net/Documentation/Orchard-TV
If I may, I'd like to make some comments on your markup as well:
Table should not be used for layout but only for tabular data.
Inline styles should not be used and should be replaced by styles defined in stylesheets.
That script should not be added inline but rather should be in a separate file, and included using #Script.Include so that if the template is rendered more than once for whatever reason, the script is not added as many times.
The script is polluting the global namespace.
The script is not localizable.
Instead of that client-side script, you should probably use server-side code, which by the way already knows day and month names in all cultures of the world. #DateTime.Now.ToString("dddd, MMMM yyyy") should be able to replace that whole script block.

sharepoint designer 2007- Redirect to another Page after adding List Item

I am using SP Designer 2007 to display the custom list form. Users will use this form to fill in the details and click on submit. Once they submit, they will be stored in the list.
But it redirect to Allitems.aspx of the list rather then confirmation page.
How do I redirect to custom page.
When clicking on the cancel button I need to redirect to the default.aspx page.
This is what my code looks in SP designer 2007.
Where do I specify the redirect attribute in the below code?
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap=""><IMG SRC="/_layouts/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="">
<SharePoint:SaveButton runat="server" ControlMode="New" Text="Submit" id="savebutton2" source=""/>
</td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="" align="right">
<SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton2"/>
</td>
</tr>
</table>
Thank you
On the onclick event of your submit button add something like this:
javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={submitted.aspx};')}

SharePoint 2010 WebPart Personalize Layout

I have a homepage on an Intranet. It has at 15+ webparts (news, weather, etc.) I want to allow the users to customize the page by moving the webparts around or deleting them. At present I don't let them see the ribbon at the top so they don't have access to the "Edit page" button. I have pulled it out from the Ribbon
<a unselectable="on" href="javascript:;" onclick="return false;" class="ms-cui-ctl-large" aria-describedby="Ribbon.WebPartPage.Edit.Edit.Menu.Actions.Edit_ToolTip" mscui:controltype="Button" role="button" style="height: auto;" id="Ribbon.WebPartPage.Edit.Edit-SelectedItem">
<span unselectable="on" class="ms-cui-ctl-largeIconContainer">
<span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float">
<img unselectable="on" alt="" src="/_layouts/1033/images/formatmap32x32.png" style="top: -160px; left: -96px;">
</span>
</span>
<span unselectable="on" class="ms-cui-ctl-largelabel" style="height: auto;">Edit<span unselectable="on">
</span>Page</span>
</a>
Unfortunately it is not working. Any thoughts?
I will be doing the same with the "Stop Editing" button as well.
According to this post: http://artykul8.com/2011/03/useful-sharepoint-shortcuts/
the trick is to use the MSOLayout_ToggleLayoutMode(); javascript function.
According to a comment in that same page, in SP2010, that javascript function is only available when you already have a web part in the page. The behavior I observed differs from this one, given that, to me, this function only worked when the page was in edit mode already (and it worked even when the page had no web part added).
I was able to find the javascript file where that function is defined, which is the ie55up.js. You can load it in your masterpage by doing:
<SharePoint:ScriptLink language="javascript" name="ie55up.js" OnDemand="false" runat="server" />
For information about how to build a web control that uses that javascript function, see here: http://www.codeproject.com/KB/sharepoint/SwitchWPMode.aspx
Hope this helps
I finally found the answer to this question. It was very simple after the JS call was determined. I believe this should be for a webpart only page.
To put the page in edit mode for Personalization via a Javascript call:
ChangeLayoutMode(true); // how simple is that??
To stop the editing of the page via a Javascript call:
MSOLayout_ToggleLayoutMode(); // same as given in the other post
The "Stop" edit mode I believe is the same for all pages no matter if it's a personalized page, all webparts page, etc.

How to retrieve attachment file name in display form of custom list form with SharePoint Designer

I have created custom list and modified display form of list for display attached image of list.
I have place HTML image control on display form but I can’t get attachment URL path which I can assign to Image control. I tried to some level hardcode like:
“http://Server Name/SiteName/Lists/ListName/Attachments/{#ID}/???”
I can get ID value so it can be work but the last thing file name, I am not able to get the attached file name.
Do I need to write code to get path? If yes then which event I have to inherited
This solution requires undocumented magic.
...puts robe and wizard hat
Inside your table with the #Title and such:
<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Attachments</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<SharePoint:FormField runat="server" id="attachmentsField" ControlMode="Display" FieldName="Attachments" />
</td>
</tr>
You can change the attribute ControlMode to "Edit", it shows the Delete option.

Resources