Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

A whole slew of new scratchpad features have been rolled out today, in addition to a hopefully useful XML feature. If I've done my job right you shouldn't have noticed much. But there is always the possibility of bugs lurking so please feel free to let me or pmdev know of any issues you find.

Scratchpad Changes:

The old scratchpads are now totally gone. This is good because it satisfies the initial intention, of lowering the cost of fetching user information on the site. Its also good because now its alot easier to handle the pads in a more flexible way. Its also good becuase it resolves some nits in the overall approach of supplying scratchpads only when a user wants them (an important objective as many of users are non participatory).

So what has really changed? Well scratchpads now have two parts. A private part for yourself only and a public part for others to see. The rendering logic for users viewing their own pads is a little lacking so expect improvements and please offer suggestions. Whats really changed is under the hood. The user table got a new column, called user_scratchpad which is now used to store the id of a users scratchpad if they have one. So XML heads will probably want to take advantage of this.

The other main change involved in this is that now Scratch Pad Viewer is a true proxy for handling nodes. This means that if a user who has no scratchpad wants to create it (a link is provided on their homenodes) go the Scratch Pad Viwer where the magic of creating a new pad is handled. This will work in XML as well, but more on that in a moment. Non owners wont see links to non existing scratchpads any more, and now the scratchpad viewer will tell you if the user has no pad instead of confusingly creating it on their behalf. If a user is allowed to edit a scratchpad then saying something like

/ +scratchpad_doctext=Public

will do the right thing regardless of whether they have a scratchpad or not. This should make writing clients that talk to PM easier.

XML Changes:

The changes to the XML interface are twofold. One relates to scratchpads so we will handle that first. There is a new "passthrough mechanism" in place for XML nodes. If you request a node with "displaytype=xml" and "passthrough=1" and the node is configured appropriately by the gods then page specific non standard XML will result. In the case of the Scratch Pad Viewer youll see the XML for the selected users scratchpad in XML. This means you can do a single step fetch from username to scratchpad contents in XML. Its even more useful because it couples with the new proxy behaviour such that if you do both for a new user you get the new pads id in the returned XML.

The second set of useful changes was originally to help synchronization between PM and the pmdev test enviornment. This is the addition of two flags to the node xml display mode. Each are provided by passing "xmlstyle=FLAG" in the query. One is "clean" which returns the contents of fields without adding trailing newlines to start tags which is nice if your parser doesnt agree that these newlines should be ignored (like the parse used by the synchonization code). The second is "flat" which instead of returning useful fields in "data" element wrapped around multiple "field" elements (with other useful stuff at the root level), it will return one tag per field, with the tag named after the field. An attribute "field_name" will hold the true value of the DB field involved, and is normally the same as the name of the tag. (Flat implies and overrides clean.) Thus for de-merphq's scratchpad we have the "flat" and "normal" looks: (this is pasted from my browser the newlines are not as might be expected)

<?xml version="1.0" encoding="ISO-8859-1" ?> <node id="366276" title="flux8's scratchpad" created="2004-06-13 13: +28:52" updated=""> <type id="182711">scratchpad</type> <author id="357600">flux8</author> <reputation field_name="reputation">0</reputation> <doctext field_name="doctext" /> <privatetext field_name="privatetext" /> </node>
<?xml version="1.0" encoding="ISO-8859-1" ?> <node id="366276" title="flux8's scratchpad" created="2004-06-13 13:2 +8:52" updated=""> <type id="182711">scratchpad</type> <author id="357600">flux8</author> <data> <field name="reputation">0</field> <field name="doctext" /> <field name="privatetext" /> </data> </node>

This makes it much easier to use certain parsers. Especially the version of XML::Simple in use on the site. For now these XML changes are restricted to the displaytype=xml mode, but its likely that ill port them to the other xml tickers if it makes sense to do so. Somewhen anyway :-)

Anway, I hope people enjoy and find this stuff useful.


    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi

In reply to Scratchpads Revisited and some XML Node View Changes by demerphq

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (6)
    As of 2018-03-18 08:32 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (229 votes). Check out past polls.