Showing posts with label navbar. Show all posts
Showing posts with label navbar. Show all posts

Wednesday, 27 October 2010

To Navbar or Not to Navbar

Recently, were asked to help a special school redesign their Uniservity platform to make it more accessible to their students. The main beef with the existing platform was that there was too much extraneous gumpf around the sides of the screen, and navigating to the relevant class page was too complex for many students. The ideal would be to do away with the Navbar entirely and as soon as a student logs in, they are taken directly to their class page. Now that is no mean feat in a platform where you cannot use PHP, and in the end we only partially achieved this.
The system we ended up with was as follows:

  • Student clicks a logo to log in and enters their login details.
  • Student is presented with a picture of their teacher which they click.
  • Student is taken to their class page.

When staff log in, they are presented with the pictures of all the teachers whose class areas they have access to plus any communal areas such as the Staffroom area.

By default, Uniservity will customise the standard Navbar depending on who is logged in and will only show them links to areas and resources they have the permissions to access. If you want to have more control over how the Navbar looks, and aren't happy with simply using Custom Images for the groups and having gaps between them (yuk!), you are stuck with a static Navbar which is not customised to the user's access permissions. This is fine for resources as, if these are linked to manually from class pages, a user will only see them when and if they get to the class page. So what is needed is a way either to customise the Navbar independently of Uniservity's standard functionality, or to do away with the Navbar completely and use graphics on the page which are customised to the user's permissions.

It turns out that both of these are possible using a little JavaScript and a thing called an iframe. The system that was devised works on the principle that if an image is stored in the Resources area of a group that a user does not have the permissions to access, that image will not load if it is on a page that the user is looking at. So, for instance, if Jonny is in class 3 and he looks at the homepage for his platform, which contains an image stored in the class 4 resources area, all he will see is a red cross because he does not have the rights to access the image.

So what we could do is store an image which represents each class (say a pencil with the class's name on it, or in the case above, a photo of the class teacher) in the relevant class's Resources area and set the Access Permissions so that it is only visible to that class, either using All Group Members or Profile Sets, depending on which way round you have it set up. The problem with this is that if we then place these images using their URLs into the homepage or a Custom Navbar, we will see the class images that are accessible to us but we will also see an unsightly red cross for those that aren't. So how do we get rid of the red cross? Enter JavaScript.

Now Uniservity copes well with some JavaScript when entering it into the Source Editor for group pages, but the editor can sometimes do odd things and strip out code that it doesn't recognise. For this reason, I decided to approach it from a slightly different angle. I created the homepage using a text editor and saved it as an HTML file, then uploaded this as a Public resource to the Resources area of the platform's top level group. I then put this code into the homepage Source Editor:

You will notice the iframe tag here, which creates a window (in this case an invisible one) into another webpage. The style properties set the frame which appears around the edge by default to zero pixels so that it is invisible (as well as the frameborder="0" attribute). Also being set is the width of the iframe, which is made to be 100% of the width of the window (in this case the central area of the Uniservity page), and the scrollbars which are turned off so that the iframe is completely invisible and it appears as though the content coming from the source page is simply on the page with no frame. The source page is referred to by the src attribute, and this URL is the URL of the manually created and uploaded webpage I made reference to above.

This method circumvents the filters which decide what one can and cannot put into the Source Editor for a group homepage, so we are free to use whatever JavaScript we like without worry. The JavaScript in question which prevents an image displaying if it is not accessible to the user is shown below:

The magic part of this is the part which starts onerror=. This is what is called an event handler and it is basically saying that if an error is thrown up when trying to load the image concerned (such as it isn't accessible), do something. The something it does is to change the style properties of the image to make it invisible and have zero width and height. That means that if the image does not load, it will not display at all. You can see how this could be used in a Custom Navbar to acheive what the inbuilt Uniservity system does but with much more flexibility in what the Navbar actually looks like.

Please note that I have never tried this code directly in a Custom Navbar, so I don't know whether it will work without being stripped out. In my experience, the Custom Navbar box is a lot more forgiving in terms of what it will allow, so the chances are it would work. If not, you could always use an iframe as in the example above and create the code for the Custom Navbar outside Uniservity then upload it as a resource.

Thursday, 21 October 2010

Lessons Learned - LiveRevise!

Recently, we created a microsite within our Uniservity platform for use on a project we are running with GCSE students called LiveRevise! It is a collaborative revision project involving students from (currently) two high schools and provides a place for them to discuss their revision and construct a wiki based on their revision - like a collaborative revision guide. The site is also attended by mentors from the schools and LA and students can connect to their mentors via videoconference from within the microsite.
The idea was to create something that was attractive and funky but as simple as possible to navigate so that the learning curve for students was reduced. In addition, the desire was to link in with social media so that the students could engage via multiple routes which they use on a daily basis.
Below is a video overview of some of the design elements that were included. In the following blog posts, I will be detailing some of the workarounds which were found to achieve our desired outcomes for the microsite.



The first issue encountered was that we desired an entirely bespoke look and feel for the microsite, different from the look and feel of our platform as a whole. The problem with this is that there is no way of customising the header graphic in Uniservity for specific subgroups, so we were stuck with the common LA header for our site. It was at this point that a useful discovery was made. Using inline CSS code, it is possible to place graphics which are plastered over whatever currently exists in any part of the browser window. So I can put CSS into a Custom Navbar which places graphics over the header to mask the default graphic completely. What is more, these graphics can overlap, have transparency (more on this later) and scale themselves depending on the size of the window they are in (more on this later too).
To explain how the banner, LiveRevise! logo and left hand navigation menu have been created, let's start with a code snippet. All of these graphics flow from within a Custom Navbar code block (accessible through Group Admin -> Navbar) and are placed using inline CSS.



Sorry for the poor formatting in the code snippet, but Blogger does not seem to deal well with treating code snippets as plain text! First of all, the div tag. This creates an area which can be placed anywhere in the browser window using the style="position:absolute" attribute. You will see that there are also top and left properties which govern how many pixels the div is from the top and the left of the browser window. This can also be expressed as a percentage of total window width or height. The z-index property became necessary because the header menu will tend to appear ontop of whatever graphics you try to place over it. The z-index property governs the order in which things are layered and it appears that uniservity have given the header menu a high z-index so that it is always ontop. I have set mine rediculously high to ensure that whatever graphics I place over it with CSS will hide it completely.

The next tag, a, is a link to the LiveRevise! homepage so that students can navigate back to this page by clicking on the logo.

Finally, the img tag places the LiveRevise! logo within the div that has been created. The image has been uploaded as a group resource using Group Admin -> Resources -> Add a file and the URL copied to use in this tag. Make sure that the Access Restrictions for the image are set so that whoever comes to the page will have the rights to view it, or you will end up with red crosses and no images when they visit the page.

The same code snippet is duplicated (with different URLs for the links and images) for the menu buttons and header graphic, and 'up' and 'down' button images are used to change the look of the menu in the different groups.

Many of the images used have transparent sections to allow for them to curve in and out in the right places, and this is done using png images with transparency. The icons which students use to access the forums, wikis and resources in each section are also transparent png's, which is how I have made the shadows partially transparent so that the background pattern shows through. Transparent png's can be made in GIMP or Photoshop, or doubtless many other graphics editing programs. There are many tutorials out there which will guide you through how to do this.

You will probably find that using CSS to place things in Uniservity is somewhat of a black art and involves a lot of trial and error depending on what browser you're in and where the CSS is on the page. With LiveRevise! I simply could not make it cross-browser compatible. Although my CSS was standards compliant, it refuses to display correctly in anything other than Internet Explorer. In the next post, I'll talk about Facebook and Twitter integration.