Can a web component get its own fname?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can a web component get its own fname?

Lauren Anderson

Is there a way for a running web component, defined as an Advanced CMS portlet, to introspect its own fname?

 

Lauren

 

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.
Reply | Threaded
Open this post in threaded view
|

Re: Can a web component get its own fname?

Drew Wills

Folks,

This smells like a helper function/module that should be added to uPortal-web-components (sillimar to the oidc function).

In your web component, you could call (something like)...

  const metadata = publicationMetadata({something...});

And then you'd get JSON like this...

{
  "portlet": {
    "nodeId": "-1",
    "title": "Announcements",
    "description": "Announcements for students, staff, and faculty",
    "url": null,
    "iconUrl": null,
    "faIcon": null,
    "fname": "announcements",
    "target": null,
    "widgetURL": null,
    "widgetType": null,
    "widgetTemplate": null,
    "widgetConfig": null,
    "staticContent": null,
    "pithyStaticContent": null,
    "renderOnWeb": false,
    "altMaxUrl": false,
    "parameters": {
      "hideFromMobile": "false",
      "highlight": "false",
      "showChrome": "true",
      "blockImpersonation": "false",
      "mobileIconUrl": "/uPortal/media/skins/icons/mobile/announcements.png",
      "hasAbout": "false",
      "editable": "true",
      "alternate": "false",
      "disableDynamicTitle": "true",
      "printable": "false",
      "hasHelp": "false"
    }
  }
}

drew

On 2/15/19 10:41 AM, Lauren Anderson wrote:

We are working on a uPortal REST API that will read or update portlet preferences. We want to build web components that allow administrators and users to save preferences for web components.

 

For example, users can save many weather locations and temperature (C or F) preferences in the current Weather Portlet. The Calendar Portlet allows the administrator to set default calendars that all users can see, and it allows users to select which calendars they want to see and add their own calendars.

 

We are working to replace the Weather and Calendar portlets with web components but we don't want to create our own database tables to save preferences when uPortal already has tables for portlet preferences.

 

In order to use the existing code for portlet preferences we need the fname of the portlet, and optionally, the user name. We can get the user name easily. We could hard-code the fname of the web component (actually an Advanced CMS portlet) in the code that calls the new API, but we’d rather let the web component discover it. Getting the fname from the <section> element sounds like it would work. If you have better ideas, please let us know.

 

I’m including a prior email to Drew, and his response:

 

I believe you're looking for PortletDefinitionPreferencesImpl & PortletEntityPreferencesImpl.  The former is for "publication-level" preferences (manage the defaults... applies to everyone), the later is for per-user values.

 

There's a chance I'll be submitting a REST API to manipulate these in a PR.

 

drew

 

On 2/11/19 7:39 PM, Lauren Anderson wrote:

 

I looked at the uPortal APIs but I didn’t see any that read or update portlet preferences in the uPortal database. Has anyone built one? If not, any suggestions for how I would do that? Having a place to store user preferences for portlets/web components is really useful, as is done for the Weather portlet right now (location, temperature units).

Lauren

 

From: [hidden email] on behalf of Christian Cousquer [hidden email]
Date: Friday, February 15, 2019 at 9:28 AM
To: Drew Wills [hidden email]
Cc: [hidden email] [hidden email]
Subject: Re: [uportal-dev] Can a web component get its own fname?

 

Heya Lauren,

 

Sorry for the late response. 

If you’ve got still issues, retrieving the cleaned fname from the html class attribute of the direct father of an element <section>.

Tell me. 

many possibilities depending on your contexts. 

 

Christian c (ze fRrench)

 

Le jeu. 14 févr. 2019 à 23:18, Drew Wills <[hidden email]> a écrit :

Well, the fname is added as a CSS class to the <section> element that surrounds a content object.  (Perhaps it could be obtained from there?)

drew

On 2/14/19 1:23 PM, Lauren Anderson wrote:

Is there a way for a running web component, defined as an Advanced CMS portlet, to introspect its own fname?

 

Lauren

 

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.