/[drupal]/contributions/modules/attached_node/README.txt
ViewVC logotype

Diff of /contributions/modules/attached_node/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Wed Oct 13 13:01:32 2004 UTC revision 1.2, Sat Oct 23 19:46:52 2004 UTC
# Line 1  Line 1 
1  attached_node.module  $Id: README.txt,v 1.1 2004/10/18 18:00:39 javanaut Exp $
2    
3  Written by Mark Howell 2004  The attached_node module allows users to include a reference to a node within
4    the body of another node.  Textually, this appears in the body text as a type
5  Some of this code was lifted from other modules, including image.module.  of tag.  This tag is translated by a filter into a teaser version of the node
6  Update Aug 18, 04: I'm trying to keep up with changes in CVS as preparations  being referenced.
7  for drupal 4.5 are made.  This code isn't as frozen as I thought it was,  
8  so I apologize if the docs are out of date or the code doesn't work.  -MH  
9    INSTALLATION
10  Purpose of this module:  
11    Unpack the attached_node distribution into the modules directory.
12  Allow users to refer to other nodes from within the body or teaser of a node.  
13  Provide a somewhat standard means of formatting the link to such nodes.  Then, enable the attached_node module in the administer --> modules page
14  Allow user to customize position and attributes of this link/reference.  of the admin section.
15    
16  This is implemented for the most part as an output filter.  Go to the input filters page within the adminster section to configure a filter.
17    
18  Installation:  By default, the filter "Filtered HTML" is enabled to all users of the site.  If
19  To setup this module, just place attached_node.module in your modules directory,  you wanted to allow all users of the site to use the attached_node functionality,
20  then go to administr->input formats and click "configure" to configure whatever  click "configure" under the Operations column of this table.  Alternatively,
21  input format you want to use this feature.  you can pick whichever filter you want to add attached_node functionality to.
22    
23  Enable "Attached Node Filter" and save your configuration.  Under the configuration section, click the checkbox on the "Attached Node Filter"
24    line, then click the "Save configuration" button.
25  Click the "configure filters" tab to configure all filters for this input format.  
26    If you want your users to be able to configure how the nodes are rendered, you
27  There will be a section for "Attached Node codes".  Click the  can click on the "configure filters" tab.  Here, in the "Attached Nodes codes"
28  "Enable Attached Node codes" checkbox to turn this filter on.  section, you can specify node properties that users are allowed to override. A
29    common thing to override is the "title" property.
30  Additionally, if you want your users to be able to specify parameters for  
31  displaying each node, put them here for each node type.  There is one exception to this, and that is for image nodes.  There is a parameter
32    named "res" that users set to specify the resolution of the image to display.
33  Common parameters include "title" for most node types and "res" for image  This has to match one of the pre-rendered resolutions configured on the image
34  nodes.  "res" can be set to any of the resolutions you configured with the  admin page.
35  image module.  A value of "original" will display the original resolution.  
36  Parameters to avoid include nid, uid, teaser and body.  If things go haywire on your site with attached_nodes, you can pull the plug on
37    output filtering by unchecking the "Enable Attached Node codes" checkbox and
38  That's it.  It's ready to use.  Test it out by creating a node (say it's  clicking the "Save configuration" button.  This was originally for development
39  nid is 123, for example).  Then create another node and attach the previously  purposes, but was left in for the occasional odd situation.
40  created node to it using the following syntax:  
41    Click on the "rearrange filters" tab to set the order in which filters are
42  [node:123]  applied.  Since the Attached Node filter outputs HTML with line breaks and other
43    things, you'll probably want this filter to be the last one applied to the output.
44  You can place this tag anywhere in the body and it will get translated on the  If, for instance, the HTML filter is run after the Attached Node filter, then
45  fly.  much of the output could be rearranged or removed.  Just give it a large (heavy)
46    weight.  The default is 10, which should send it to the bottom of the
47    list (where it belongs).
48  The most popular use case for document management in this crowd seems to be  
49  attaching images to stories and blog entries.  Arguments have gone round and  
50  round about what is the best way to do this, and in the process of trying to  USAGE
51  figure out what will make the most people happy, I have come to a compromise.  
52    The tag format is fairly simple.  The most basic tag would be in the following form:
53  I originally designed a relational database model for managing attached nodes  
54  and all of the maintenance code that goes with it.  After much thought, and        [node:<node id>]
55  coming across the filter that the image module uses, it occurred to me that  
56  perhapse the best solution was the simplest one: use meta tags.  Parameters follow the <node id> part and are comma separated name="value" pairs:
57    
58  I took the concept that the image module used for tag format and made it a bit        [node:123,res="640x480"]
59  more generalized.  The format currently is of the form:        [node:123,res="original",title="Original version of the picture"]
60    
61  [node:NID, align="center", height="50", title="look at this stupid article"]  Note that the values must be encased in double quotes.  This is to allow users
62    to include commas in the value.  The side effect is that double quotes cannot
63  ..where NID is the node id of the node being linked to, and all of the optional  be used (currently) without causing problems.
64  parameters are specific to whatever type of node is being linked to.  
65    Questions/comments/etc:
66  Image nodes, for instance, would display a thumbnail in this tag's place (similar  mark@nullcraft.org
67  to how the [image:NID..] tag works with the image.module.  Each node's allowed  
68  parameters are specified on the filter admin page.  You can allow your users to  Mark Howell
69  override whatever node properties you would like.  Some don't make sense (like nid)  (javanaut)
 so caveat emptor, but nothing gets overwritten unless you explicitly set up  
 permissions to do so.  Additionally, these properties are only overwritten for  
 the purposes of displaying the node.  Nothing is saved to the database.  
   
 Security is adhered to by checking <code>node_access("view", $node)</code> for  
 every node that gets translated.  
   
 The tricky part doesn't exist yet.  On each form edit page, there should be a  
 link to "attach node".  This should pop up the "Create Content" (node/add) page.  
 Along with this page will be the understanding that whatever node gets created  
 will eventually be referenced from the original node.  This can be done several  
 ways and I have not decided yet how exactly this will be done.  
   
 1. Form Keys:  
 The original node (parent) will have a form key generated.  Children nodes  
 will need to maintain this key until they are saved.  The form key gets placed  
 in a table awaiting the parent to be saved.  When the parent is saved, meta  
 tags from all children are appended.  This could be done at the preview phase  
 as well.  
   
 2. Javascript:  
 Upon saving a child node, the node body form element of the parent will have  
 a meta tag referring to the child appended to it.  This will allow the user  
 to immediately customize the position and attributes of the attachment.  
   
   
 There are other techniques, but these are the two that I'm most considering.  
   
 -Mark Howell  

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2