Another month, another root log...
Last month I had adjusted the way that Everything2 user poll votes were handled. I couldn't help noticing while doing this that the poll code was in need of a little tidying up. Individual polls were stored as chunks of perl code that generated the form controls for the options offered in the poll and stored the available poll options in %HTMLVARS for use in generating the display of polls that the current user had voted on. This code was generated by other perl code, and run by still other other perl code when the poll needed displaying. This last code existed in more or less identical form in various different places, which meant that any changes to it would have to be made in several different places to keep things consistent. Polls could be displayed in various places but only in some of them would the results of a poll you had voted on be displayed.
Poll options are now stored as lines of text in the database text field that used to hold the generated code used to generate the poll display. There is a new showpoll htmlcode which generates the poll display wherever it is needed, showing the poll options or the results, depending on whether you have voted. This shared code is used by e2poll display page to display any poll, by showcurrentpoll to show the current poll on the Everything User Poll page and in the Current User Poll, and in the Everything Poll Directory and Everything Poll Archive to show pending/future and past polls.
Everything Poll Creator needed adapting to the new set-up, as did e2poll maintenance create, without which it would not work at all. The old Everything Poll Editor is no longer required and has been retired. If a poll really needs editing, an administrator can do this using the normal procedure of clicking on their super special 'Edit Node' button, whereupon e2poll edit page will give them the tools they need and discourage them from using them if a poll has already been opened for voting.
Speaking of voting: pollvote takes more straightforward parameters than it used to.
All of these changes have made it easier to update the polling system. There may be innovations such as voting for more than one answer relatively soon.
Mastery and Control
A Cleaner Nodelet
The 'Edit Node' button I mentioned above is provided in the Master Control nodelet, which is displayed to Content Editors and site administrators. Over time various bits had been added to it and it was getting rather cluttered. Apart from that, some of the bits didn't actually work. And some of those that did work did so in a rather clunky way involving a lot of code, while the job could have been done more easily by code used around the rest of the site or elsewhere on an E2 page. If someone who wasn't an Editor or an admin tried to look at the nodelet on its own page, they got a misleading error message.
Master Control no longer provides editors with tools for manipulating writeups and e2nodes that are available to editors and administrators elsewhere on writeup and e2node pages. If someone who is not authorised tries to look at it, they get an informative and correct access denial message. Some redundant access checks have been removed.
Various attempts to make nuking a node work using a pretty link to the node's normal url failed. As a side-effect of these efforts, Nothing Found will now recognise nukes with nice urls, although they will not be happening. More usefully, it sanitises query parameters before outputting them to avoid injection of malicious code by evil url-contructors, and uses paragraphs to structure its message of absence.
The episection_ces htmlcode, which provides various useful links to tools for administrators and editors no longer has a link to Node Row, which is no longer useful. The link to The Oracle, which is used to look at a user's settings and is therefore only useful when looking at users, is now only shown for users.
Content Editors couldn't put items in the front page news. Now they can: weblog will consent to do it for them, while setupuservars will make sure they are given the appropriate option in the right form. Although not until they have gone and looked at their own profile/homenode/whatever.
Writeup and Draft controls
The widgets at the bottom of your own drafts and writeups were provided by voteit, which also (surprise) produces voting buttons. It also provides widgets for site staff. It was getting rather long and complicated. There are now separate drafttools and writeuptools htmlcodes, which are called as required by displayWriteupInfo instead of voteit. Just in case voteit is called from anywhere else, it will also call the appropriate code to provide the right tools. So it is now easier to adjust draft and writeup tools.
That being so, it seemed appropriate to adjust nodenote to provide output suitable for use in a writeup or draft tool widget, so that drafttools and writeuptools could show notes on individual writeups staff next to the tools used to manipulate them.
Some nodes are locked: you can't add a writeup to them without editor intervention. Some users are suspended: they can't publish a writeup without editor approval of their draft. Until this month, the process of letting a suspended user publish, or of allowing publication to a locked node, was rather clunky: the user or node had to be temporarily unsuspended or unlocked. Now things are smoother:
In the admin widget on a draft with status 'review' which is attached to an e2node, which cannot be published there because the user is suspended or the node is locked, drafttools now provides editors with a display of the reason why the draft cannot be published and a button to 'Approve' the it for publication. Clicking on this button makes it possible for that user to publish that draft in that e2node. This is done by having the opcode approve_draft record the id of the approving editor in the 'food' field of the link that attaches the draft to the e2node.
Once a draft has been approved, staff are provided with a 'Revoke approval' button. The author of the draft can also remove the approval by detaching the draft or attaching it to a different page.
This required changes to nopublishreason to provide sensible messages for people who are not the author of the draft in question and to respect approval when it has been given. setdraftstatus flags publication approval at the bottom of the draft's page after indicating attachment to a node.
To support this added grace in degradation, the killing floor II now requires a 'true' value for the removenodexxx parameter for writeups that are to be removed. It is not enough for the parameter simply to exist.
None of the Above
Then there were the patches that didn't fit into any bigger project:
draft display page – When you had deleted a draft, there used to be an awful blinding expanse of white space under the 'Undo' button. And if the draft was deleted, how could you have an 'undo' button anyway? The mystery is now explained, and a host of useful and inspiring links are now to be found where your draft now isn't.
e2createnewnode – under some circumstances, 'search again' from 'Findings:' and 'Nothing Found' would fail. Now it won't. (The problem was a spare 'node' parameter being generated on the basis of the rewritten page url.)
Nothing Found – provides feedback if an admin tries to use the 'tin-opener' link to check for the existence of an invisible draft and fails because nothing is there.
draft display page – there is no longer superfluous check for edit permission when it isn't needed.
canseedraft – hide locked users' drafts. All of them.
bookmark – don't misidentify e2nodes as nodeshells if none of the authors of the writeups in them want notification of bookmarking. Notify the creator of nodeshells, not the Content Editors.
collaboration useredit page and collaboration display page – remove inline JS and use general operation confirmation set-up.