When last heard from I was making excuses for not yet having implemented the 'Drafts' system, one of which was that the development server had died.

Then we got a new development server. It is virtualised, which everyone says is a good thing. One day the everything2 servers will all be virtualised, and instead of being in a corner of an office somewhere they will be in a corner of an operating system of a bigger computer somewhere. This should make them less susceptible to overheating, acne, and other physical risks.

The new development server was originally intended to be made available a couple of weeks later, so it had some interesting quirks to start with, one of which killed more or less all of the JavaScript functions. So I put in a temporary fix for that, which can be activated any time on either server by creating a system setting called 'ignoreMissingJsLibraries.' It also has a different address from the old one, which meant a couple of changes were necessary in the Patch Importer and patch exporter. Then back to drafts, and other things I noticed along the way:

Not drafts

  1. Make it possible to pass a title to create node, a page where admins can create nodes of any type.
  2. Rebuild e2createnewnode, which generates the form offering to create a new e2node or scratch pad (as was) after a search has not found anything, with a view to tidying it up and making it work without javascript. Also removing the list of links displayed to admins to create different kinds of nodes with exactly the title just searched for and replacing it with a link to create node with a parameter for the title. The idea being that admins seldom need to create new nodes of exotic types and should have the same opportunity as anyone else to adjust the title before creating an ordinary one.
  3. Remove the 'lastnode_id' parameter from parsecode, since this is never used when displaying a writeup or e2node, which are the only situations where we want a lasnode_id (which is used to create softlinks).
  4. When a writeup is deleted, writeup maintenance delete now removes the corresponding entry from the 'newwriteups' database table. No attempt is made to delete an entry from the 'newnodes' table, which hasn't been used for years. I killed off a couple of hundred thousand old entries while I was at it.
  5. Remove the option to choose how many writeups to show from the New Logs nodelet. It's in New Writeups, and that's enough.
  6. Tweaked minilogin so that if you log in from the Guest User front page you are taken to the logged-in users' front page.
  7. Everything2 ajax is now capable of sending empty form control values to the server. This can be useful when you want to delete something.
  8. addnodeforward, ordernode and softlock, which provide tools for admins on e2nodes, have been tidied up and made prettier.
  9. The opcode repair_e2node_noreorder uses the shared code provided by the htmlcode repair e2node.

Drafts

The New Writeups nodelet sorted new writeups by their creation date. This would be the time the original draft was created, not the time the writeup was published. It also used a fairly heavy database request every time it was generated for a logged-in user. There were quite a few other places/pages where writeups needed their sort order adjusted. So:

  1. The writeups table has a new column: 'publishtime.' For existing writeups it has the same value as node createtime.
  2. publishwriteup sets the publishtime at the same time as it sets the updated time for the e2node a writeup is being inserted into.
  3. New Writeups Feeder supplies potted information for the New Writeups nodelet, updated regularly every five minutes, and sorted by 'publishtime.'
  4. zenwriteups has been adjusted to use the feeder instead of doing its own database lookup. It also checks the writeup title to show all logs when generating the contents of the New Logs nodelet, not just those of type 'log'.
  5. There is a new htmlcode, update New Writeups data, to update the data outside this schedule whenever a writeup is updated or otherwise manipulated.
  6. writeup maintenance update, writeup maintenance delete, hidewriteup, unhidewriteup, massacre, publishwriteup, and removeweblog all call update New Writeups data so that New Writeups will stay up to date. (removeweblog is used to remove writeups from Node Row.)
  7. show content and displaywriteupinfo, both of which are used to display writeups, drafts, and information about them, show publishtime if it exists, instead of createtime.
  8. show writeups makes sure that the function in displaywriteupinfo that displays admin tools for writeups or the status of a draft is always called for drafts, independently of a user's settings.
  9. show content has a function 'oddrow', which outputs 'oddrow' after being called an odd number of times and nothing after an even number of calls. show content will also accept a literal string embedded its instruction string, which is inserted as is between the results of function calls. This makes it possible to use it to produce writeup listings in table form by putting in table cell markup in the appropriate places.
  10. parsetimestamp has new options to suppress the output of the seconds figure at the end of time strings and to add a leading zero to the hours, to produce prettier-looking columns of dates in tables. show content has a new function 'listtitle' that makes use of these options.
  11. Numerous writeup lists now use show content to generate their output, showing and sorted by time of publication not of creation, and with consistent mark-up through the use of shared code. (Everything User Search, Cool Archive, Writeups by Type, My Big Writeup List, 25, ENN ... we could do with some rationalisation here.)
  12. New Cool Stuff and Cream of the Cool are sorted by publication time. Other Users looks at publish time to decide what people have been doing recently.
  13. Node Tracker, Noding Speedometer, My Recent Writeups, Iron Noder Progress, Reputation Graph, Site Trajectory, User Search XML Ticker, userAtomFeed, writeup achievements, and the 'latest writeup' report on users' homenodes all use time of publication, not of creation.
  14. draft maintenance update checks to see if a draft is being given the same title as an existing draft or writeup by the same user. If it is, the title has ' (1)' stuck on the end. Unless the user already has a draft or writeup with that title with a (1) on the end, in which case it gets a (2). Unless ... (3), (4), etc.
  15. repair e2node makes sure that writeups are properly parented while fixing their titles. It reorders on the basis of time of publication, not creation. When not reordering, it still updates the nodegroup, to remove any spare non-writeups that might have slipped in some time.
  16. linkNode() and handleUserRequest() in HTML.pm in ecore have been patched to use the same url structure for drafts and for writeups. linkNodeTitle() has been patched to add a parameter to the url indicating the user_id of the author of the writeup or draft being linked to. This is necessary because the anchor ('#authorname') is not passed to the server, and:
  17. canseewriteup keeps track of whether a writeup or draft by the author indicated in the url parameter has been shown or filtered out on an e2node page. If it hasn't, after all writeups on a page have been processed a search is made for a draft by that author with a matching title, and it is inserted if it exists and the current user is allowed to see it, with a note indicating that it is not usually visible on the page. Here is an example. (Currently broken when linking from writeups, I find. Drat.)

It lives!

On Friday, the 24th of March I had to stay in all morning waiting for a table to be delivered for my step-daughter. So that seemed like a good opportunity to implement the final patches to take the drafts system live and hang around to see if anything went horribly wrong because of something I'd forgotten to think about. So just after 8:00 in the morning (7:00 server time) the following happened:

  1. editwriteup provides a form to create a new draft as default, even when told to provide a form for a writeup.
  2. addwriteup only allows users below level 2 to post a draft from an e2node.
  3. Scratch Pads deletes a user's default scratch pad if it is empty, and offers to convert any scratch pads the user has to drafts. It also offers to show another user's drafts or scratch pads.
  4. Drafts automatically converts a user's existing scratch pads to drafts. If it is asked to show another user's drafts and they don't have any, it will show any scratch pads they have.
  5. All mentions of scratch pads are replaced with references to drafts.
  6. Code for posting to scratch pads is removed from Nothing Found and from writeup maintenance create.
  7. voteit notes why it is you can see a private draft by someone else (because they let you). Oolong suggested this after looking at the private draft announcement of the drafts system.
  8. admin toolset provides an option to publish a draft to a document instead of a writeup.
  9. The draft announcement was published to a document and put in the front page news.

... and I waited for the snafu reports and suggestions for complete rebuilds of the entire system to roll in. Which they did, in modest numbers:

  1. One of gnarl's drafts appeared to be a user's homenode. It turned out the title contained [square brackets] and a pipe (|), which was messing up the link to the draft. convertscratchpads, draft maintenance update and parentdraft now send titles through the ecore function cleanNodeName().
  2. While using list nodes of type to try to find gnarl's unlinkable draft, it occurred to me that I shouldn't be able to do that, since it was showing me all drafts, whether private or not. So I can't now, and nor can anyone else.
  3. Spifficus rex wasn't happy about all his drafts being findable in search findings. As he and others pointed out, scratch pads were less visible. So I initially left drafts out of the findings, and later created a new draft status 'findable' in addition to private, shared and public, to let the user decide. Non-private scratch pads convert to public drafts, not findable ones.
  4. The Custodian and the Spifficus also pointed out that clicking on a link to a draft called 'Thunder' by a particular user would take you to a writeup called 'Thunderbirds' by the same user if it existed. This needed a patch to handleUserRequest() in ecore, which I duly made, and which duly arrived on the production server a few hours later. (The number of people with the power to completely trash the production server is limited, and rightly so.)
  5. Messaging users from their homenodes broke because I accidentally imported some unfinished code from the development server. Oolong fixed that even though it wasn't his fault.
  6. kthejoker suggested that it should be made clear that the user and group names in the 'shared with' box under drafts need to be separated with commas (yes). And that the status in the draft footer should automatically be updated when the status is changed by AJAX (absolutely). And that the list of suggested existing titles under which to publish a draft should be shorter (in the pipeline). (Sometimes I feel like I spend most of my coding time here implementing or building on kthejoker's ideas.)
  7. kthejoker also reported a problem with google Chrome which sometimes made it impossible to use the back button after creating a draft. This is a Chrome bug, but it could be fixed by changing the url pointed to by the draft creation form at the bottom of e2nodes to the url of the new draft or writeup, which made sense anyway. So I did that.

The table arrived and was defective and had to be sent back, but the drafts system appeared to work.

And there was evening and there was morning and it was Saturday. Around about or some time after my bedtime, tentative expressed some confusion arising from a lack of a report of a draft's status as it was converted, so I put in such a report on Sunday. Also on on Sunday, everybody's favourite conservative commentator Noung was mildly distressed by his latest writeup not being where it should be in New Writeups. This turned out to be because he is using the E2 jukka theme, which we no longer support. But it was easy to fix by having Test NW Feeder sort by publicationtime, so I did it.

Still not done...

Next: attaching an unpublished draft to an e2node and expressing a desire for comments on a draft by changing its status to 'review.' Just at the moment I can't decide exactly how to do the former, so I'm chopping wood in the sunshine, which is a good idea anyway. If you have any good ideas for the drafts system, Suggestions for E2 is still open. Please do not suggest things listed here under 'So here it is, Merry Christmas,' or suggest that the Drafts page could be better presented. That's on the list.

Log in or register to write something here or to contact authors.