In the root page, I have web parts - Announcements and Events, and hyperlinks to different Document Libraries and lets say Group X and Y has permissions for this. There is also an image which directs to another page (ex. Manager Sales), which has different document libraries.
I am able to set up different permissions for all document libraries, but I would like the Group X to not have access to the image link.
You could use JavaScript api to check user groups, you could find the script here, then you could hide the image link for Group X users by jQuery or CSS.hide element by jQuery
function CheckUserGroups() {
var groups = ["Visitors", "Designers"]
IsCurrentUserMemberOfGroups(groups, function (isCurrentUserInGroup) {
if (isCurrentUserInGroup) {
//your hide logic
}
});
}
ExecuteOrDelayUntilScriptLoaded(CheckUserGroups, 'SP.js');
Related
Here is the scenario:
I have a GI ListFolder, (DB-Appointments), which displays Tech Appoints and the RefNbr of those appointments on the mobile app.
I want to have the user tap on an SO number and then be able to send that SO number to customized mobile app (Service Orders) which will allow the user to edit and change the service order information.
HOWEVER, I am unable to determine how to pass the value of the RefNbr from the first mobile app screen to the other one using the "redirect" command inside of the "EditDetail" container action. (code below)
Does anyone know how to do this?
add container "Result" {
containerActionsToExpand = 2
add field "ServiceOrderTypeFSServiceOrderSrvOrdType"
add field "RefNbr"
add containerAction "Insert" {
icon = "system://Plus"
behavior = Create
redirect = True
}
add containerAction "EditDetail" {
behavior = Open
redirect = True
redirectToScreen = "GI993132"
redirectToContainer = "Filter_$List$ServiceOrderTypeFSServiceOrderRefNbr"
}
}
}
Since it has been a couple of weeks without an answer, I can offer an alternative approach.
I haven't done redirects to other fields in the GI, but I do something similar to what you are describing. If you are open to alternatives, you can use the GI to go to a screen for the record (i.e. the Appointment). Then create a screen in the mobile app for the Service Order. Then put an action on the Appointment graph to View Service Order. Finally, on the Appointment screen use a RecordAction to redirect via the View Service Order action.
add recordAction "ViewServiceOrder" {
redirect = True
}
In this way, the redirect is defined as an action within Acumatica, and you are simply executing that action.
Has anyone found a way to automatically add a jslink URL to lists by default instead of having to add the URL to every list manually when they are created? Ultimately we'd like to have default jslink for each type of app the editors have access to.
yes, this was described perfectly by Chris O'Brien here: http://www.sharepointnutsandbolts.com/2013/01/using-jslink-to-change-ui-of-sharepoint_20.html
short story - you should create list template and define jslink there, so all lists based on this template would have the js link. If you don't want to assosiate lists with templates by any reason, you should look into event receivers. (for List created event.)
Another solution is to write your own code to update all of your pages.
On this page Tobias Zimmergren shows a code updating JSLink with PowerShell:
PowerShell: Configure the JSLink property of a Web Part
I personally use C# CSOM to update JSLink on all requested pages.
Here is the sample code which updates JSLink on one page (for simplicity I have stripped out exception handling and all non-happy-path logic):
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.WebParts;
void UpdateWebPart(ClientContext webpartContext, string RelativeUrl, string JSLink)
{
File page = webpartContext.Web.GetFileByServerRelativeUrl(RelativeUrl);
LimitedWebPartManager wpm = page.GetLimitedWebPartManager(PersonalizationScope.Shared);
webpartContext.Load(page);
webpartContext.Load(wpm.WebParts, wps => wps.Include(w => w.WebPart.Title, w => w.WebPart.Properties));
webpartContext.ExecuteQuery();
if (wpm.WebParts.Count > 0)
{
// You can find your WebPart inside wpm.WebParts e.g. by Title. On each page I have only 1 WebPart, so I just take the first.
WebPartDefinition wpd = wpm.WebParts[0];
WebPart myWP = wpd.WebPart;
if ((string)myWP.Properties["JSLink"] != JSLink)
{
myWP.Properties["JSLink"] = JSLink;
wpd.SaveWebPartChanges();
webpartContext.ExecuteQuery();
}
}
}
webpartContext is SharePoint ClientContext created earlier
RelativeUrl is something like: "/Lists/Sample%20Tasks/AllItems.aspx"
JSLink is new value for JSLink of WebPart, which you want to update
I'm familiar with SharePoint but would like some guidance on developing a custom page.
I have 1 list and have created 3 different views.
On my Page, I have added a webpart to show the list.
I'd like to be able to add some form items - possibly radio buttons/ a picker/ or just text links at the top that would allow the user to switch views on the list below.
I'd like to add some other information and make the experience more intuitive for the user.
In short, is there a way to add a list web part and some options to choose the view of that list in another section of the page?
Sure, just do something like this
var dview = MyList.Views["YourViewTitle"];
dview.DefaultView = true;
dview.Update();
MyList.Update();
Each view has its own URL so you just need to use some HTML and JavaScript. When a box is checked or a button is clicked then you can load the URL of the view.
I would like to use a different layout view for anonymous users. I have tried using url alternates and I am not sure how I can create a layout for anonymous users since there is no particular url for them.
The idea is that, if a new user visits the site I want to show a splash screen with very limited information with an option to register/ login to view the full site. This splash screen will have a completely different layout / look and feel from the rest of the site.
I tried using the Anonymous user layer but all I could do was move widgets (maybe I am missing something).
Any help would be greatly appreciated.
Thanks!
There is no out of the box solution but you can do something like this to get what you want:
Add new layout in a file with the name of your choosing - for example, you could name it Splash.cshtml.
Add the code below to the top of your Layout.cshtml template:
#if (WorkContext.CurrentUser == null) {
#Display.Splash()
return;
}
The code will check if the user is logged in. If it's not, it will render the content of your Splash.cshtml template, and stop the rendering of the rest of the Layout.cshtml template.
If you need to display any of the widgets in your Splash.cshtml template, you could add it by simply adding #Display(Layout.NameOfTheZone) where you should replace NameOfTheZone with the actual name of the zone you're using inside the Layout.cshtml template. Generally, anything that you use inside Layout.cshtml template with the Model object, you can use through Layout object inside any of your views.
I'm trying to make the Liferay (6.0.6) Asset Publisher publish all changes across multiple communities on the portal homepage. By clicking on a link the user is supposed to be redirected to another community and see the new web content. The problem is that the default behaviour of asset publisher (even with the hook to gather info from all communities) tries to get the url by searching the group of the current page (in which the content is not).
I decided to change the jsp showing the page to search all pages across all communities and find the first one containing the portlet with the desired web content. So
How could I get the portlet containing the web content by journal id of the web content?
How could I get the page containing the portlet?
Thanks
The PortletPreferences table in the database contains the configurations of each portlet in the system. The configuration of an articleId for a Web Content Display portlet is stored as a preference in this table. If you look at that table, there are 3 important columns:
plid contains the id of the Layout (=page) on which the portlet was dropped.
portletid contains the instance id of the portlet. For Web Content Display portlet, this ID has the format 56_INSTANCE_XXXX where XXXX is a unique hash.
preferences is an XML formatted string of all preferences and their values for this portlet.
An example of the preferences XML:
<portlet-preferences>
<preference><name>group-id</name><value>10139</value></preference>
<preference><name>article-id</name><value>14295</value></preference>
</portlet-preferences>
So it's just a question of getting your SQL queries right. As far as I know, there is no service you can call directly for this.
SELECT l.friendlyURL
FROM PortletPreferences p, Layout l
WHERE p.plid=l.plid
AND p.portletid LIKE '56_INSTANCE_%'
AND p.preferences LIKE '<preference><name>article-id</name><value>14295</value></preference>';
Something like the following allows you to find the Layout on which an article is Rendered.
List<Long> layoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(groupId, false, articleId);
long layoutId = 0;
if (!layoutIds.isEmpty()) {
layoutId = layoutIds.get(0).longValue();
Layout layout = LayoutLocalServiceUtil.getLayout(groupId, false, layoutId);
String url = PortalUtil.getLayoutURL(layout, themeDisplay);
...
}