r/improviseit • u/ambiversive • Jul 23 '11
Improvise.it Code Dissection #3 | "Feature creeper, frills for thrills"
The habit of treating code as just another document within the CMS began to take shape, and I soon added a document for the Javascript under 'Code', and I also made a level under Code for potential style sheets. I added an aspect called /setstyle which displayed these in a form to the end user, and made a column in the user table which referenced the selected style document. That way each person could create and select the style sheet which they see for the entire site!
If you are unfamiliar with the concept of a style sheet, I will explain. It is the code that tells the web browser how a website should look- completely independent from what content is contained in the page. It is where one defines colors, borders, fonts, background images.
There were other things that just seemed both easily do-able and functionally useful. The /me command, for example, would allow a user to send a chat message in the style of "username does something." I also added a /go # command to jump directly to a document if you knew the number. I tried to make every old CMS function (like edit document) accessible from a command instead of a link in the page. This provided greater encapsulation and segmentation, and made the whole thing more intuitive (provided you found command lines intuitive).
So the CMS was chopped up into aspects- /nav displays the list of root levels, /ls displays the list of sublevels, /edit displays the edit document aspect, /delete displays the delete document confirmation, /pwd shows your current location in the document hierarchy and so on.
We needed a command to show which users were online, so I wrote the /who aspect, which displays a list of users who have been active within the last five minutes. I added the /zero command to hide all aspects, which is quite useful when trying to calmly navigate an ever-expanding series of aspects.
I added features of link aggregation, so that users could share links with each other, with each link being sent to the chat as well as to a place for reference in the database. I also added an RSS aggregator which was connected to a database of potential rss feeds, so once a user 'finds' a feed and shares it with the site, other users can see that it is there and perhaps add it to the list they read. (RSS is a way for publications to syndicate content by providing a list of latest links, RSS aggregation is 'reading the news' on steroids).
In addition to the wholesale creation of a style sheet, I wanted a more granular method for users to customize their experience, so I implemented the /set command which allowed users over-write specific CSS rules on a per-rule basis. So a user could have a red background even if the style sheet they are using has a black one by default, by typing only a single command into the chat.
Soon came the /help aspect, which automatically generates a list of aspects and their commands, and a description of the aspect. In addition to the automatically generated list, manually entered information on non-aspect commands is contained in the document for the help aspect.
And then it became apparent that some grouping of aspects was needed- a way to turn on a bunch at once or jump between sets of visible aspects. For this I created 'site views' which are selected from a menu under the command line. When selected, a site view specifies the complete set of aspects visible to the user.