We want to be able to click to create a new card *from* a given place and have some default content based on the link I clicked from.  For example, from Deck A, you click to create Note B, and by default Note B is already associated with Deck A.



Suppose we have a Deck named Zappa Wagn and want a link on that deck to create a Note with +re already filled in with "Zappa Wagn".


We can do that by putting a link on Deck+*tform:

create a Note for work on specifiable relative content for plus cards+solution

Additional fields on the note can be filled out by simply adding parameters:

create a Note for work on specifiable relative content for plus cards+solution

If the plus card having default content handed to it is a pointer you can add multiple items separated by a newline, encoded as %0A



Most of the rest of this is defunct. Some may go into a new ticket.


It is not enough to know the HTTP_REFERER, because the Zappa Wagn card may show up in recent changes, on the Deck card, etc, and in all of those cases the HTP_REFERER would be the main card.  So the request itself must carry the information.  That means we could either (a) automatically append the information to all such links, or (b) require the user to append this information.  I don't know how (a) would work.  Here's how (b) might work:

add Note

Note that (b) has the advantage of finer grain control, and of working from anywhere desired, not just from the referrer card.


In this example we just use the variable name "var", but we will probably want to think a good bit more about the form and scope of variables we'll support.


Instead of var, what if we supported anything beginning with "$" as a variable?  It could be very useful to be able to put multiple variables in a link.  For example, if we wanted a special link for sys admin emergencies, we could make it create tickets that are urgent, in progress, assigned to Lewis, and tagged sysadmin all with one link.  -EFM


Then we could sub in a variable at the point of creation.  So if you were on a Deck called "Zappa Wagn" and clicked a link like add Note, then +re in the resulting multi-edit will contain "Zappa Wagn" (i.e., if it's a Pointer, it will contain one item - Zappa Wagn). If there is no referring card (i.e., created through Search bar or by any means if the type is set via the cardtype menu), then _referrer returns a null string.


Two solutions for setting the default content according to the referer are being explored; we'll probably do both ultimately:


Through right formatting / inclusion syntax


In re+*rform you can put:

or _var

...and when +re is created, it will be replaced with an inclusion or link to the card from which you created the Note.


If _var is absent, the entire link or inclusion is substituted for an empty string.



Through inclusion syntax


We've also talked about adding a new way to set default content via inclusions:


On Note+*tform you can include something like:

...and when a Note is about to be created, +re is auto-filled with the content "hello world".


If we could do that, then we could potentially do the same thing as above wrt content substitution.  Within the quotes, you can use _var and it will be replaced with a link to the card specified in the variable. Eg:

Note that making this work would require two preliminary changes: (1) supporting default content via inclusions, and (2) respecting this syntax in multi-edit, which currently breaks for type - see apply type in inclusions when multi-editing




I wanted to add a user story for this and realized that I wanted to be able to click "add user story" down below here, and for the user story to know it should be connected to this ticket.


Other examples / things to add when this is done: 

  • click "add note" on a deck and have the note point to the deck
  • click "add receipt" on a month and have it point to the month http://grasscommons.org/wagn/Month+*tform
  • click "add ticket" from a tag and have it pre-tagged
  • click "add organization" on a connectipedia topic and have it point to the topic
  • click "add Documentation Ticket" on a dev ticket and have it link back to the dev ticket

Documentation note: We think inclusions should work straightforwardly when content is going to a text field. Inclusions going into a Pointer item (which is represented as a link) you'd have to HTML-encode the braces - %5B, %5D

  --John Abbe.....Thu Sep 10 18:12:14 -0700 2009

This doesn't work yet, would it be easy to do?

put me on a committee


Hrm, or maybe not. Ideally it would add me to the committee if "steering" already exists. Seems like another use case for implement triggers.

  --John Abbe.....Thu Sep 10 21:08:47 -0700 2009

Almost everything works, yay!

http://test.dwagn.org/wagn/User+*tform has links with different combinations, see http://test.dwagn.org/Lewis_Hoffman to try them out. Problems:

  • Links break, which means there's no way to have links in default content for Basic/PlainText/Phrase plus cards. This includes not only in-Wagn links, but also plain URLs, see the last two links on http://test.dwagn.org/wagn/John_Abbe
  • If a referred card doesn't exist, ugly breakage also occurs. See the last two links on http://test.dwagn.org/wagn/Ethan_McCutchen
  • Definitely an edge-case, but maybe easy to fix: +s in names become spaces (we could URL-encode to avoid this, yes?).

The first two are pretty serious problems for using content of cards as default content, but i don't think either of them affect ainability.


Side question - Is there a diff between raw and naked? Is it that raw is deprecated and will have a new meaning later?

  --John Abbe.....Thu Sep 10 21:38:52 -0700 2009

  • raw v. naked: correct! raw is deprecated. the difference is that "naked" will be unadorned but still processed. No card slot or other surrounding html, but links and inclusions will be rendered. "raw" will be completely unprocessed. you'll get the content straight from the database, brackets, braces, and all.
  • links. to put links into content, you need to html escape the brackets. [ = %5B, and ] = %5D (see example on test.dwagn.org/User+*tform)
  • inclusions. to pass inclusions, you have to escape them with a backslash (see same page for examples)
  • bad references. if a referred card other than an escaped inclusion occurs, what should happen? not sure the ugly breakage is a bad thing, because something is wrong with the link if it included a broken inclusion.
  • +'s in names. Lew and I were discussing this yesterday. It's part of a deep problem that has to do with how much we want to battle other peoples' default setup. We don't think we're going to change this yet, so if you're having trouble getting a plus through, it's probably worth CGI escaping it (%2B).

  --Ethan McCutchen.....Fri Sep 11 09:40:48 -0700 2009


So i can ticket implement raw view, yes?


More on the rest later.

  --John Abbe.....Fri Sep 11 15:26:20 -0700 2009

yeah, let's do ticket that.

  --Ethan McCutchen.....Fri Sep 11 20:08:45 -0700 2009

The rest will help a lot when i do documentation, thx.


Only other thing is breakage on inclusions that don't exist. I can imagine cases where there's simply a form element that hasn't been filled out yet. Ideally i imagine this would be interpreted as blank rather than breaking the way it does now. I realize that we may not want to code a special case for interpreting inclusion syntax inside links right now, but i just want to point it out that when it comes up we'll have to do something about it.


(Interesting that name works but linkname doesn't.)

  --John Abbe.....Sat Sep 12 02:29:29 -0700 2009

Ticket this?

http://test.dwagn.org/new/committee?_radio%20fun=Lewis%20Hoffman works, but http://ainability.wagn.org/new/Crop?_plot%20growing%20crop=corner%20section does not.

  --John Abbe.....Wed Sep 16 15:12:26 -0700 2009

Fixed - awesome. 9/17

I don't think we need to ticket the broken inclusion thing yet. I don't think we have a viable user story for it. Missing inclusions break the links because they put the missing inclusion html inside link html.

  --Ethan McCutchen.....Thu Sep 17 11:54:47 -0700 2009

wait a minute. is the only thing breaking on missing now linkname? That's an easy fix, actually. I've already done it in the code.

  --Ethan McCutchen.....Thu Sep 17 13:06:08 -0700 2009

I'm assuming this code is up by now, and here's what i'm seeing, testing from http://test.dwagn.org/card/edit/User+*tform :


Inclusions that don't exist don't break anymore. On http://test.dwagn.org/wagn/Loo_Hoof clicking on  http://test.dwagn.org/new/committee?_who=Loo%20Hoof&_Purpose%20and%20Responsibilities=


To insert actual inclusion markup as default content, escape: { = %7B, } = %7D, | = %7C, + = %2B and spaces = %20


(more coming)


  --John Abbe.....Sat Sep 26 03:32:33 -0700 2009

the code here needs refactoring-- we're missing tests and it's implemented in a way that crosses too many architectural boundaries. moving back to in progress

  --Lewis Hoffman.....Thu Oct 08 09:56:11 -0700 2009

it's documented here: setting default content with links. John had done most of this under the name "default content", but since the card made no mention of soft forms (our primary trick for setting default content), I changed the name.

  --Ethan McCutchen.....Mon Oct 19 18:46:32 -0700 2009