Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Friday, April 01, 2022

Whitelisting access to the Igloo Action Button

What is the Igloo action button?

The action button gives you access to administrative tools for each page and various features within the digital workplace. These tools allow you to edit the current page, view subscriptions, change access and much more.

Now for most users they don't need to see the action button, however if a user is given any permissions of edit and above, you get access to the action button which will allow you to customize the look of your page, add widgets, etc.

For my use case we wanted users to be able to add and edit posts but did not want them to be able to add widgets or make changes to the page.  Since Igloo lacks this kind of granular permission, the following Javascript will whitelist the action button according to who is logged in.

This is done using the Igloo.currentUser.name property you can read when using SAML

Read more about the Igloo SAML variables.
 

<script type="text/javascript">

//<![CDATA[

switch (Igloo.currentUser.name){

default:

document.getElementById('contentmenu').style.display = 'none';

break;

case "Dylan Hunt":

document.getElementById('contentmenu').style.display = 'visible';

break;

case "Beka Valentine":

document.getElementById('contentmenu').style.display = 'visible';

break;

case "Shamus Harper":

document.getElementById('contentmenu').style.display = 'visible';

break;

case "Trance Gemini":

document.getElementById('contentmenu').style.display = 'visible';

break;

}

//]]>

</script>

Friday, July 23, 2021

Working with igloo, variables, and coding

 I've been asked to setup an email form to tie into Igloo, and for the most part setting up Igloo for a SAML connection was pretty easy, (I'll do a post on that later) but for this email form setup getting some of the variables out of igloo was more tricky; especially since I am not to familiar with the platform, or how it works.  I hope this post will help other coders who need to do work on an igloo system without having to get the developer account or just found it as frustrating as I did trying to break the system down.  I haven't come across a good document for how to do these particular kind of things on Igloo's site but you do have to be approved by igloo to access customer care and the developer section of the site.  In my option they don't have a good web only quick start guide.  So I hope this will help some users of the platform.  If you don't have a igloo login, the only thing accessible is the guides-ebooks page on their website.

https://www.igloosoftware.com/resources/guides-ebooks/

So you have to have an account (probably with admin access) to get more info and access to the igloo support forums.  When your logged in you will see something like this menu.


If you go to the Igloo support link, you will get to see the following resources.

Developer KB

https://customercare.igloosoftware.com/support/developers/kb

Community Forum

API Reference

https://customercare.igloosoftware.com/support/developers/api_reference

For working just with a webform and trying to get some info from the user to me wasn't very intuitive and working with the platform wasn't intuitive but it is workable once you know how things are done.  Now a requirement for this form is that I can't use an iframe, and needs to be native to igloo.  So in this case the email form was setup as a start it was setting up an email form, where it sends data to a helpdesk system but I don't want the user to have to type in their email again because they are logged into the intranet and I should be able to get this information.


So after doing a lot of googling I came across an obscure reference on the community forum.  https://customercare.igloosoftware.com/community/developer_questions/is_there_a_quick_way_to_get_the_current_user

So not being familiar with igloo I looked at the comments, and seen the question about referencing the object (since I wasn't using the API) I thought it was referenced though the WYSIWYG editor like some other CMS/LMS systems.  I was wrong.

So I tried using {Igloo.currentUser.id} in the HTML page where the form was, and that didn't work.  nothing was displayed and I couldn't get/find any kind of documentation for what I was looking for except from this reference.  I gathered that I had to probably use javascript to access it; however the way igloo is setup you have to really plan how you want to work with.  After viewing source and finding this snipe of code.


 I figured that I have to be able to access this the same way I just have to figure out how to use javascript to access the info.  I found it is best to work in two tabs when doing this in Igloo.  One to have the HTML editor open, the other to have the javascript editor open.

HTML Editor

Javascript Editor


  So I did a test with document.write in the javascript editor in igloo. which broke the page I was working on but I did see the variable get written to the screen!  Yay!?

document.write(Igloo.currentUser.id);

So after setting up some HTML elements I came up with this.

document.getElementById('name').setAttribute('value',Igloo.currentUser.name);

document.getElementById('userid').setAttribute('value',Igloo.currentUser.namespace);

//Display just the first name. (does a split based on the space in the name)

const title=Igloo.currentUser.name;

const firstName=title.split(' ')[0];

document.getElementById('staffName').innerHTML = firstName;

This javascript allows me to get the email because the email has the same convention as the namespace, I can put a note with the user's name with instructions or a note for the email form when they land on the page.


So in short, for any web dev's who are just throwing something together quickly, here are the igloo JavaScript variables for getting some user info.

Igloo.currentUser.name

Igloo.currentUser.namespace

Igloo.currentUser.href

Igloo.currentUser.id

Igloo.currentUser.hasphoto

Igloo.currentUser.memberkey


Tuesday, February 09, 2010

Why Flash will die

Adobe Flash (http://www.adobe.com/products/flashplayer/) is quickly becoming the bane of the internet. Mostly used for online video or interactive websites, flash is quickly becoming a hassle that people don't want to deal with. Within the last year Flash has become the main vector for many malware attacks. Flash also has major issues with causing the CPU to max out, browsers crashing, and memory management. Flash is also not as good for SEO and can lower your ranking on search engines.

A brief history on Flash

Flash has been until now the best platform for delivering low bandwidth highly interactive web objects. What does that mean? Well, Flash has been a great platform for delivering interactive content and eventually making up most of the video on the web. This was due mostly to ActionScript; a programmable language for Flash that allows you to do things you couldn't do before on the web with ASP, PHP, ROR (Ruby on Rails), Perl CGI, JavaScript, QuickTime and windows media player. Flash showed much of it's promise in Version 6. That is where ActionScript became really useful, and more mainstream starting to replace the older program Director, which was almost the same program just raster based with a language called Lingo and had much more CPU and Ram requirements. Director was also given the same options as Flash for posting it to the internet via The Shockwave plug in, but did not catch on as much as Flash did, probably due to the size of the player files, and the lack of bandwidth most internet users had at the time. Flash has quickly come to be the leading video player of choice on the web, and there is no better example of this then youtube. This was probably due to flash being able to read the length of time in the "Flash Video" and the communication capabilities between different swf files where you can put in "markers" or "hotspots" to trigger events in flash players.

So why will Flash Die?

To put it simply, there is a shift to move things on the web to open source and open standards preventing any one company from controlling the web. That is only part of the story. Flash has also drifted away from why people used it in the first place. A low bandwidth solution for providing highly interactive content. Flash as it has matured has become more bloated due to request from flash users for more features and capabilities. Eventually I think Flash will disappear from the web all together unless Adobe does 3 things.

  1. Makes Flash Open Source

  2. Fixes Flash from hogging the Processor and Memory

  3. Stops Flash from crashing web browsers


Most of the things done in flash now with the exception of a few items can be done now with javascript and css. With the move to web standardized content management systems which pretty much eliminates flash unless you put in a Flash Banner, Gallery, video player or some other flash element which has to be custom coded, Flash becomes very inconvenient to implement into websites. If Adobe were to open up Flash and get partners like Microsoft, Apple, Google, and Yahoo to sign on and make flash freely available to everyone to make it easy and very cheap to produce flash swf files. This might be enough for Flash to become a true web standard and have HTML 5 have a native tag just for flash instead of using Active X (which is what they did for video). The odds of this happening are slim to none, it's hard enough to get these guys to agree on anything, let alone release control of their own technologies for an open technology that standardizes everything, which would be a benefit to us all. If Adobe wants flash to live on into the the future I think they have to open it up or it will go the way Director did into oblivion.

Removing Show Recent History and Recently Open Documents from Windows Explorer

How to remove the Recent History and Recently Open Documents from Windows Explorer Using the Registry Editor Press the Windows Key + R, type...