Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
These [[InterfaceOptions]] for customising [[TiddlyWiki]] are saved in your browser

Your username for signing your edits. Write it as a [[WikiWord]] (eg [[JoeBloggs]])

<<option txtUserName>>
<<option chkSaveBackups>> [[SaveBackups]]
<<option chkAutoSave>> [[AutoSave]]
<<option chkRegExpSearch>> [[RegExpSearch]]
<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
<<option chkAnimate>> [[EnableAnimations]]

Also see [[AdvancedOptions]]
<div class='header' role='banner' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
<div id='mainMenu' role='navigation' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' role='navigation' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' role='complementary' refresh='content' force='true' tiddler='SideBarTabs'></div>
<div id='displayArea' role='main'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected {color:[[ColorPalette::PrimaryDark]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:alpha(opacity=60);}
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0; top:0;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0 3px 0 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0; padding-bottom:0;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox where print preview displays the noscript content */
<div class='toolbar' role='navigation' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>

A controlled trial without randomisation, quasi experiments, or a failed randomisation.

preferably from more than one centre (a cohort allocates by exposure to treatments and looks for differences in outcomes)
preferably from several centres (allocates by outcome and looks for differences of exposure – in terms of treatment)
between times and/or places, with or without interventions
based on clinical experience, descriptive studies, uncontrolled studies and reports of expert committees
Primary interventions – normal pops – NO
Randomised trials with at-risk pops where something has already happened... YES

Primary focus is self-harming.

!Special populations:
*[[Autism]] – pass on papers to Jeanette
Self-injurious behaviour is common in young people, its incidence has been increasing, it appears frequently to be associated with significant psychiatric comorbidities, and not uncommonly presages poor prognostic outcomes for  young people affected by it.  However, in spite of the scale of the problem, as this chapter lays out, there are extremely wide variations in the definitions in play within the literature as well as between the target behaviours themselves.  Perhaps in keeping with an area of clinical practice that has such poorly defined margins, and one with such a powerful valency for stigma, the evidence base for effective interventions remains relatively sparse.

Although mention is made of them, particularly in relation to the assessment of risk, this chapter does not address primary preventive interventions with normal (usually school-based) populations to reduce rates of suicide or self-injury, and the primary focus is, as the title suggests, on //self-injury// rather than //suicide prevention//.  However, trials with at-risk populations, in which an event of self-injury or a suicide attempt has already happened, are covered, and interventions that include the reduction of suicide as an outcome in such populations are included. 
[[Hawton, 98]]
[[Muehlenkamp, 06]]
[[Skegg, 05]]
[[Tarrier, 08]]
[[General YP views - reviews]]
[[Katz, 04]]
[[From Truth Hurts Report - DBT]]
[[Rathus and Miller, 02]]

!!DBT (presumably ADULT studies...)
1. LINEHAN, M.M., H.E. ARMSTRONG, A. SUAREZ, et al. 1991. Cognitive-behavioral
treatment of chronically parasuicidal borderline patients. Arch. Gen.
Psychiatry 48: 1060–1064.
!!!From [[Miller, 00]] reviewing [[Hawton, 98]]'s review of this DBT trial (adults):
//There was ''one study'', however, that ''did report significantly lower rates of suicidal behavior''
among subjects receiving ''__Dialectical Behavior Therapy (DBT)__'', as compared to
subjects receiving treatment as usual (TAU; Linehan, Armstrong, Suraez, Allmari, &
Heard, 1991). Dialectical Behavior Therapy, developed by Linehan (1991, 1993a, 1993b) is a
principle-based cognitive-behavioral therapy (CBT) developed for chronically parasuicidal
women with a diagnosis of borderline personality disorder. Dialectical Behavior
Therapy blends standard CBT interventions with Eastern philosophy and meditation practices,
and shares elements with psychodynamic, client-centered, gestalt, paradoxical, and
strategic approaches (Heard & Linehan, 1994). An adolescent version of DBT, DBT-A,
has been developed by Miller and colleagues (Miller, Rathus, Linehan,Wetzler, & Leigh,
1997; Rathus & Miller, 1999) and is described below.//"

2. LINEHAN, M.M., H.L. HEARD & H.E. ARMSTRONG. 1993. Naturalistic followup
of a behavioral treatment for chronically parasuicidal borderline patients.
Arch. Gen. Psychiatry 50: 971–974.
!!DBT - Adapted for ADOLESCENTS.....
MILLER, A.L., J.H. RATHUS, M.M. LINEHAN, et al. 1997. Dialectical behavior
therapy adapted for suicidal adolescents. J. Pract. Psychiatry Behav. Health 3: 86.
!!![[Rathus and Miller, 02]] as described here in [[Miller, 00]]:
Another promising intervention that has been developed for suicidal adolescents, but
has not yet been tested empirically in a randomized controlled study, is Miller et al.’s
(1997) Dialectical Behavior Therapy for Adolescents (DBT-A). 

As previously mentioned, ''DBT-A is a modified version of Linehan’s (1993a) DBT'', which has been shown in
clinical trials to be significantly better than TAU in reducing parasuicidal behavior, the
number of inpatient psychiatric days, drop-out rate, and anger, as well as improving
social adjustment and treatment compliance among women with BPD (Koons, Robins,
Bishop, Morse, & Lynch, 1998; Linehan et al., 1991).

From Linehan’s behavioral perspective, ''suicidal behaviors are conceptualized as maladaptive
attempts to regulate feelings or escape and avoid overwhelming and intensely
painful negative emotions.'' 

Thus, DBT targets the following problem areas:

#confusion about self
#emotional dysregulation
#interpersonal problems.

This treatment targets these four problem areas by teaching corresponding behavioral skills modules aimed at increasing adaptive behaviors while simultaneously reducing maladaptive behaviors. 

The four skill modules are as follows:

#emotional regulation
#distress tolerance
#interpersonal effectiveness.

*In standard DBT, ''treatment lasts for one year''. 
*The patient attends a ''didactic group'' once a week that focuses on teaching patients skills in the four target areas mentioned above. 
*Patients in DBT also attend individual therapy once per week in which the therapist uses both:
**''change strategies'' (e.g., behavioral analyses, cognitive modification, exposure to emotional cues) and 
**''acceptance strategies'' (e.g., validation strategies). 
*Between sessions, ''the patient is encouraged to page or call the therapist'' to help problem solve during crises and to enhance skills generalization. 
*Finally, there is a ''weekly consultation group for DBT therapists'' that aims to enhance therapists’ capabilities and to increase motivation to work with this difficult population.

Miller et al. (1997) ''modified standard DBT in several ways to address better the specific needs of suicidal adolescents'' in an inner-city outpatient clinic. 

In brief, these modifications included: 

#shortening the first phase of treatment from one year to twelve weeks;
#including parents in the skills-training group, with the goal of improving
adolescents’ often dysfunctional, invalidating environments, and teaching them skills they ultimately may use to coach their teens;
#including parents or other family members in individual therapy sessions when familial issues seem paramount;
#reducing the number of skills taught in order to facilitate learning the content in 12 weeks;
#simplifying the language on the skills handouts to make them developmentally appropriate for adolescents;
#offering an optional 12- to 24-week follow-up consultation group (Phase 2) to those patients who graduate from the first phase of treatment. This group is designed to help patients apply the skills learned in the first phase of treatment to their current life problems, relying heavily on peer teaching and reinforcement.

''Initial outcome data on the 12-week DBT-A program'' have yielded promising results. (see [[Rathus and Miller, 02]])

!Nomenclature and Definition:
The term Self-Injurious Behaviour (SIB) covers a wide range of heterogeneous acts, and there remain significant difficulties both in defining the problem and in clarifying the nomenclature.   In this chapter we refer to 'Self Injurious Behaviour' (SIB) rather than 'Deliberate Self Harm', which is a phrase that has been criticised for carrying pejorative overtones ([[Royal college of Psychiatrists, 2006]]) or for dangerously simplifying a complex psycho-social and interactional phenomenon in ways that fail to highlight the //disordered intentionality// of the "self-harmer" in respect of his or her mental state at the time of the act (see [[Scanlon and Adlam, 2009]] for an eloquent examination of this question). Other terms that are also still in use include Parasuicide, Nonsuicidal Self-Harm, self-mutilation or Suicidal behaviour; the latter raises another common problem in the literature surrounding self-injurious behaviour, which is the extent to which SIB is conflated with suicidality. 

[[Klonsky, 07]], in a helpful review of the evidence on the varied functions of SIB, defines this as ''the intentional, direct injuring of body tissue without suicidal intent'', while [[Hawton et al 2002]] define Deliberate Self Harm in very similar terms, drawing on definitions that were used in two earlier epidemiological studies (Platt et al 1992, Schmidke et al 1996) from the World Health Organisation (which themselves referred to the behaviour under study as Parasuicide):

"An act with a non­fatal outcome in which an individual deliberately did one or more of the following:
*Initiated behaviour (for example, self cutting, jumping from a height), which they intended to cause self harm.
*Ingested a substance in excess of the prescribed or generally recognised therapeutic dose.
*Ingested a recreational or illicit drug that was an act that the person regarded as self harm
*Ingested a non­ingestible substance or object."

Perhaps it is important to state the self-evident fact that there are no operationalised diagnostic criteria for this phenomenon in either the ~ICD-10 or ~DSM-IV, because it does not constitute a diagnosis //per se//; rather, SIB describes a range of behaviours, that appear to represent a 'final common pathway' from a variety of aetiological factors.  

Notwithstanding this, there has been debate as to whether there is sufficient evidence to change the status of this set of behaviours, moving towards re-classifying SIB (particularly in its most chronic repetitive forms) as a diagnosis in its own right.  Proponents of this position ([[Muehlenkamp, 05]], [[Favazza and Rosenthal, 93]], [[Simeon & Favazza, 2001]] argue that the conversion from episodic acts of impulsive self harm into repetitive compulsive acts warrants diagnostic clarity similar to the way in which, say, addictions have been usefully classified (in the case of self-injury, as an Axis I impulse disorder.)   [[Favazza and Rosenthal, 93]] and [[Simeon & Favazza, 2001]] propose a more detailed breakdown of the categories of self-injurious behaviour, which recognises the wide range of contexts and patterns that mark its manifestations. They describe four main categories; stereotyptic, major, compulsive, and impulsive.  

''Stereotypic'' self injury occurs most typically in the pervasive developmental disorders, or specfic disabilities such as Rhett's syndrome or Lesch-Nyan syndrome, where the harming has minimal relationship to social context, or communicative value, but is instead 'automatic', rhythmic and repetitive.

''Major'' self-injury is, as the name suggests, dramatic, or bizarre (auto-amputation, auto-castration) and is usually isolated and carried out in relation to a major mental illness such as psychosis.

''Compulsive'' self-injury is repetitive and often ritualistic, and covers a wide range of behaviours that will include some that are hardly pathological (nail-biting), and a spectrum of others such as hair-pulling (trichotillomania) and scratching, which may be capable of causing significant damage or disfiguration.

''Impulsive'' self-injury covers the majority of the self-injurious behaviours addressed in this chapter.  It tends to start as an //episodic// phenomenon, and may be characterised as a waymark on a trajectory that follows rising tension, and precedes release and relief.  Over time a proportion of episodic impulsive self-injurious behaviours will transform into more //repetitive// forms, bearing some similarities to the trajectory of some drug or alcohol consumption whereby the use becomes dependent/addictive.
!!Scope of the chapter:
Clinicians, young people who are affected by SIB, and their families, will nearly all recognise this group of behaviours as a major concern when they occur, but it is the sheer range of behaviours that potentially fall under its ambit (from culturally-sanctioned tattooing and body-piercing, through to the ingestion of toxic substances or deep cutting, or more bizarre major forms of SIB) that make for difficulties in appraising the literature and potential treatments.  

For instance, the distinction between //self-injurious// behaviours and //suicidal// behaviours is, for obvious reasons, difficult to draw unambiguously; many young people who self injure repeatedly //also// describe suicidal ideation, and //also// attempt suicide, a proportion doing so to completion.  In this chapter we have primarily focussed on interventions for impulsive self-injury in children and adolescents, with brief mention of approaches for special groups (autism and learning disability), as well as a brief overview of interventions primarily focussed on suicide prevention as a sub-set of the various interventions (though of course suicide prevention is an implicit aim in any interetion that seeks to reduce the frequency, severity or progression of self-injurious behaviours.)

The heterogeneity of behaviours contained under the banner of SIB may go some way to explaining the existence of widely divergent //stances// towards the phenomena itself, towards young people who self-injure, and towards available treatments, often based as much upon divergent explanatory models for the phenomenon as on the wide range of different opportunities to implement treatments.  These stances range from the robust 'defence' of self-injury as a valid coping mechanism, or even as a valued sub-cultural marker or rite of passage, to what the supporters of such a stance would classify as the highly pathologising equation of all self-injury with mental disorder, or dismissive accounts of those who self-injure as "attention-seeking".

In this chapter we take it as axiomatic that in respect of those young people for whom self injury //does// constitute at least in part a "cry for help" the key issue is not the pejorative nature of that judgement, but the question of //what it is that properly needs attending to//.  The "cry for help" has been reframed as a "cry of pain" ([[Williams and Pollock, 2000]]), and [[Scanlon and Adlam, 2009]] point out that, while self-injury may also act as an attachment behaviour, evoking proximity to a caregiver, //" would be a giant leap, and in terms of Occam’s Razor an unnecessary one, to attribute ‘intent’ to this cry, any more than we would be right to attribute rational intent to the proximity-seeking cry of the infant."//

[[From Truth Hurts - CBT]]
[[Kahng, 02]]
[[Slee, 08]]
[[Tarrier, 08]]
Self-injurious behaviour is common amongst adolescents, suicidal ideation even commoner (Lewinson et al (1996) found a point prevalence of nearly 20% for suicidal ideation in adolescents) but completed suicide is rare (though bearing in mind earlier commentary about the risks of conflating self-injurious behaviour with suicidality, we recall that many self-injuring adolescents do not do so with suicidal intent. .  , but carrying these ideas forward into action 

From [[Brent, 01]]:
Ideation is very common in adolescence: 
Suicidal ideation is common in adolescence, approaching a point prevalence of 20%, although more specific suicidal ideation with intent or with a plan is substantially less frequent. LEWINSOHN, P.M., P. ROHDE & J.R. SEELEY. 1996. Adolescent suicidal ideation and attempts: prevalence, risk factors, and clinical implications. Clin. Psychol. Sci. Pract. 3: 25–46.

Acting on these ideas is much less common.

See the "Oxford Studies"
Hawton K, Fagg J, Simkin S (1996) Deliberate
self-poisoning and self-injury
in children and adolescents under 16
years ofage in Oxford, 1976–1993.
British Journal ofP sychiatry 159:
5. Hawton K, Fagg J, Simkin S, Bale E,
Bond A (1997) Trends in deliberate self
harm in Oxford, 1985–1995. British
Journal ofP sychiatry 171:556–560
6. Hawton K, Kingsbury S, Steinhardt K,
James A, Fagg J (1999) Repetition ofdeliberate
selfhar m by adolescents: the
role ofps ychological factors. Journal of
Adolescence 22:369–378

see [[Miller, 00]] on assessment of risks and evidence based assessment instruments.
[[Donaldson 2005]]
See [[Haw, 01]] though only 41% of sample 15-24yrs... PD and other Psych comorbidity common.
[[King 2006]]
[[Spirito, 02]]
[[Wood, 01]]
[[Green et al 2011 - Group therapy]]
[[From Truth Hurts Report - Family Th]]
[[Harrington, 00]]
[[Toumbourou, 02]]

[[Huey, 04]]
Note [[Tarrier, 08]] CBT seems effective for ADULTS but NOT for ADOLESCENTS.  CBT and DBT seem similarly effective
[[Hintikka, 06]]
!Notes for conclusions:
!!!Re Engagement and barriers to Rx: 
There are many shared features between these interventions (in that section) and those described by Rotheram-Borus et al (1996), under Family Therapy interventions (above), which together suggest that attention to timely and appropriate assessment, information-giving, planning, and subsequent support of continued engagement with interventions is of value.
!!!Clarification of severity (risk) and comorbidity, 
to allow direction into the most available appropriate treatment on a ‘ladder of intensivity’... 
See Chitsabesan, Harrington et al, 03 – recommendations for response to SIB...
Esposito-Smythers C, and Spirito A (2004)  - recommend in a great review the need for complex integrated interventions with co-occurring SUD and SIB.
!!Need for robust trials of home-based Vs in-patient treatments.
[[Cotgrove et al 1995]]
[[From Truth Hurts report - Crisis cards]]
[[Spirito, Boergers, 02]]

[[Schaffer - Medication, 03]]
opioid antagonist treatment to ameliorate NSSI - see [[Sher and Stanley, 2008]]
!!Include material on <<tag [[Asssessment of suicide risk]]>>

[[Aseltine, 04]]
[[Aseltine, 07]]
[[Brown, 07]]
[[Carter, 03]]
[[Crawford, 07]]
[[Donaldson, 05]]
[[Donaldson, 06]]
[[Esposito-Smythers and Spirito, 04]]
[[Gould, 03]]
[[Hallfors, 06]]
[[King, 06]]
[[Macgowan, 04]]
[[Miller, 00]]
[[Nordentoft, 05]]
[[Pelkonen, 03]]
[[Pena, 06]]
[[Ploeg, 99]]
[[Portzky, 06]]
[[Randell, 01]]
[[Schaffer - Medication, 03]]
[[Schlenger (or Gould), 05]]
[[Schlenger, 05, comment]]
[[Tarrier, 08]]
[[Thompson, 01]]
[[Toumbourou, 02]]
[[Wyman, 08]]
[[King 2006]]
[[Donaldson, 05]]
[[From Truth Hurts Report - prob solving]]
[[Spirito - problem-solving 2002]]
see: LERNER, M.S. & G.A. CLUM. 1990. Treatment of suicide ideators: a problemsolving
approach. Behav. Ther. 21: 403–411. quoted and discussed in [[Brent, 01]]

E.g.Lead author acknowledges receipt of pharmacological company funding...
Four out of five authors acknowledge receipt of pharmacological company funding

E.g.the Stanley Medical Research Institute

!Practice Parameter for the Assessment and Treatment of Children and Adolescents With Suicidal Behavior
Schaffer et al.
Paul Wilkinson on NSSI.

(Cooper et al JAACAP 2005. NSSI and risk of suicide.)

ADAPT study - 
(Paul w and Raph k)

TADS study (US)
Biggest depression study
Fluox, CBT, combined...
Excluded seriously suicidal youth, measured baseline suicidally and self-rated suicidality.

Confounding of suicidal THOUGHTS and severity of depression - TADS didn't look at CONFOUNDING

TORDIA study:

- DID do multivariate analysis, unlike TADS
++ Family conflict. 
++ Past NSSI


 192 adolescents with major depression
F/up 28 weeks 


Suicidality - NOT significant Assoc with NSSI
**********Family function - SIGNIFICANT Assoc ************
**********Pre baseline NSSI even MORE Assoc.***********
Friendship probes NOT Assoc.


Pre baseline NSSI - the OR was 20!
Family dysfunction a risk factor
female a risk factor

DEPRESSION SEVERITY was NOT a predictor...

Predictors - Family problems, previous NSSI

Being depressed increases risk of self harm and suicidality, but being depressed does NOT drive the risk of suicide attempts...

NSSI is a proxy for impulsivity

****Joiners IPP theory****

 - NSSI habituates to pain and reduces fear of death

Suicide attempts lead to greater safety precautions (unlike NSSI)

Published in JAACAP

TORDIA group replicated this finding (JAACAP - editorial by Paul...)

No evidence for any efficacy in any replicated well designed studies.
Good references for AMBIT-related work
Aglan, A, Kerfoot, M, Pickles, A (2008).  Pathways from adolescent deliberate self-poisoning to early adult outcomes: a six-year follow-up. J Child Psychol Psychiatry 49( 5), pp508-15
Prospective studies show that the adult outcomes of adolescents who deliberately harm themselves are marked by high rates of adversity and psychiatric disorders. The goal of this study was to identify pathways linking childhood risk factors to early adult outcomes of suicidal adolescents. 
A clinical sample of 158 adolescents who deliberately poisoned themselves was followed up six years later. Eighty per cent of the cohort (n = 126) were interviewed in early adulthood using a battery of standardised measures of psychopathology and social functioning. 
Multivariate mediation path analysis identified four pathways linking child and adolescent risk factors to adverse outcomes in early adulthood. 
!!!!Family dysfunction, conduct disorder and hopelessness 
contributed to the risk of high adversity in early adulthood indirectly through its effect on other risk domains, including dropping out of school and adopting adult roles at a younger age. 
not only predicted dropping out of school but also independently contributed to the risk of chronic major depressive disorder in early adulthood. 
!!!!Child sexual abuse 
independently predicted high adversity and chronic major depression over and above the influence of hopelessness. 
!!!!Juvenile onset major depression
independently predicted chronic major depression in early adulthood. 
!!!Risk of DSH in early adulthood
A substantial proportion of the effects of child sexual abuse and hopelessness on the risk of deliberate self-harm in early adulthood was mediated by high adversity and the duration of major depression. However, chronic major depression was the only risk factor independently associated with deliberate self-harm in adulthood once correlation with adversity was taken into account. 
Chronic major depressive disorder is central to deliberate self-harm repetition. However, adult outcomes of suicidal adolescents are also dominated by the accumulating effects and consequences of other childhood risk factors, including child sexual abuse and adolescent hopelessness.


Asarnow, JR, Porta, Anthony Spirito, A, Emslie, G, Clarke, G, Wagner, KD, Vitiello, B, Keller, M, Birmaher, B, McCracken, J, Mayes, T, Berk, M, Brent, DA. (2011) ''Suicide Attempts and Nonsuicidal
~Self-Injury in the Treatment of Resistant Depression in Adolescents: Findings from the TORDIA Study.''  J. Am. Acad. Child Adolesc. Psychiatry, 2011;50(8):772–781

To evaluate the clinical and prognostic significance of suicide attempts (SAs) and nonsuicidal self-injury (NSSI) in adolescents with treatment-resistant depression. 
Depressed adolescents who did not improve with an adequate SSRI trial (N = 334) were
randomized to a medication switch (SSRI or venlafaxine), with or without cognitive-behavioral
therapy. NSSI and SAs were assessed at baseline and throughout the 24-week treatment
Of the youths, 47.4% reported a history of self-injurious behavior at baseline: 
23.9% NSSI alone, 
14% NSSI+SAs, and 
9.5% SAs alone. 
The 24-week incidence rates of SAs and NSSI were 7% and 11%, respectively; these rates were highest among youths with NSSI+SAs at baseline. NSSI history predicted both incident SAs (hazard ratio [HR]= 5.28, 95% confidence interval [CI] = 1.80 –15.47, z = 3.04, p = .002) and incident NSSI (HR = 7.31, z = 4.19, 95% CI = 2.88 –18.54, p = .001) through week 24, and was a stronger predictor of future attempts than a history of SAs (HR = 1.92, 95% CI = 0.81– 4.52, z = 2.29, p = .13). In the most parsimonious model predicting time to incident SAs, baseline NSSI history and hopelessness were significant predictors, adjusting for treatment effects. Parallel analyses predicting time to incident NSSI through week 24 identified baseline NSSI history and physical and/or sexual abuse history as significant predictors. 
NSSI is a common problem among youths with treatment-resistant depression and is a significant predictor of future SAs and NSSI, underscoring the critical need for strategies that target the prevention of both NSSI and suicidal behavior. 

Clinical Trial Registration Information—Treatment of SSRI-Resistant Depression
in Adolescents (TORDIA). URL: Unique Identifier:

!Notes and Quotes
reports secondary analyses examining NSSI and SAs cross-sectionally and longitudinally in the Treatment of Selective Serotonin Reuptake Inhibitors (SSRI)–Resistant Depression in
Adolescents (TORDIA) study, a large multi-site study of chronically depressed adolescents.

sample: adolescents with severe and treatmentresistant depression

Extant research indicates that youths with a history of NSSI have elevated rates of:
*depressed/anxious symptoms, 
*conduct problems, 
*substance use,
*symptoms of borderline personality disorder,
*dissociative symptoms, 
*stress, and 
*histories of abuse/violence.
(''Brunner R, Parzer P, Haffner J, et al. Prevalence and psychological
correlates of occasional and repetitive deliberate self-harm in
adolescents. Arch Pediatr Adolesc Med. 2007;161:641-649'', and ''Muehlenkamp JJ, Gutierrez PM. Risk for suicide attempts among adolescents who engage in non-suicidal self-injury. Arch Suicide
Res. 2007;11:69-822'') 

NSSI also appears to be associated with elevated rates of SAs and to predict future suicide and SAs ''in adults''. 

(Hawton K, Harriss L. Deliberate self-harm in young people: characteristics
and subsequent mortality in a 20-year cohort of patients presenting
to hospital. J Clin Psychiatry. 2007;68:1574-1583.
Linehan MM, Comtois KA, Murray AM, et al. Two-year randomized
controlled trial and follow-up of dialectical behavior therapy
vs therapy by experts for suicidal behaviors and borderline
personality disorder. Arch Gen Psychiatry. 2006;63:757-766.
Nock MK, Joiner TE, Jr., Gordon KH, Lloyd-Richardson E,
Prinstein MJ. Non-suicidal self-injury among adolescents: diagnostic correlates and relation to suicide attempts. Psychiatry Res.
Adrian M, Zeman J, Erdley C, Lisa L, Sim L. Emotional dysregulation
and interpersonal difficulties as risk factors for nonsuicidal self-injury in
adolescent girls. J Abnorm Child Psychol. 2011;39:389-400. )

@@The question of whether NSSI predicts future suicide/SAs in adolescents requires evaluation.@@
!Follow up for 24  weeks (6 months)
!Suicide attempts

23 youths (6.9%) who
made SAs within the 24-week treatment period,
four of whom made two SAs, resulting in 27 SAs
and a median time of event of 6 weeks. SA
methods included overdose (14 youths), cutting/
stabbing (7 youths), poisoning (2 youths), hanging
(2 youths), drowning (1 youth), and asphyxiation
(1 youth). None resulted in fatalities

!!Attempts occurred in:
five of 172 youths (3%) with no-SIB history, 
10 of 78 youths (13%) with NSSI only, 
one of 31 youths (3%) with SAs only,
six of 46 youths (13%) with NSSI+SAs, 
and one youth with missing data. 

Of the four youths making repeat attempts, one had no previous SIB history, one had a history of NSSI only, one had NSSI+SAs, and one had no history data.

History of NSSI at baseline was a significant predictor of SAs
through week 24, and a stronger predictor than
baseline SA history, again underscoring the
need to evaluate, monitor, and effectively treat
NSSI in youths with treatment-resistant depression.

@@Our finding that baseline suicide attempt history was not a
significant predictor of SAs through week 24 was
surprising, given the conventional view that SAs
are more pernicious than NSSI.@@

our results are consistent with those of a recent report
from the Adolescent Depression Antidepressant
and Psychotherapy Trial (ADAPT), which similarly
reported that @@NSSI history at baseline (but not SA) was a significant predictor of SAs over 28
weeks ([[Wilkinson et al, 2011 - ADAPT]])@@


possible explanations for these findings. 

1. NSSI and SAs may be on the
same spectrum of self-harm behavior, and may
share similar correlates and risk and protective
factors.32 For instance, the Dialectical Behavior
Therapy (DBT) model posits that youths with
NSSI could have emotion regulation deficits that
are risk factors for both future NSSI and SAs.11 

2. It could also be that expressing self-harm impulses
in an SA may have a short-term effect of reducing
SA risk because of resulting interventions (e.g.,
SA means restriction or increased treatment intensity).

3. Alternatively, NSSI may not yield
changes in treatment plans, and when NSSI also
fails to produce sufficient relief (intrapersonal
and/or interpersonal effects), vulnerable youths
may turn to SAs.32 

4. Another possibility is that engaging in NSSI ''desensitizes youths to selfharming
behaviors'', thus lowering the barriers to SAs and NSSI.34  
@@//Although the temporal relationship
of NSSI and SA in this study are consistent
with that view, the sequence of self-harm events
is equally consistent with the other explanations
described above.//@@

!Relating this to TREATMENT OUTCOMES

!!!CBT + medication switch = more response
Primary outcome analyses revealed that youths
receiving combined CBT plus a medication
switch were more likely to have a positive treatment
response than youths receiving a medication
switch alone (55% versus 40.5%).16

!!!Slow response to Treatment predicts reduction in SA and NSSI
Although approximately 60% of youths
eventually attained remission, remission rates
were less than 40% at 24 weeks, and nearly 20%
of those showing a good response by 12-weeks
experienced a relapse upon follow-up.17,35 Slow
recovery from depression has been associated
with a higher risk for suicidal events both in
TORDIA and in the Treatment of Adolescent
Depression Study (TADS).36 Also, in the ADAPT
study, NSSI occurrence was greater in those
individuals with a slower recovery from depression.
33 Therefore, interventions that will accelerate
treatment response in adolescent depression
may reduce the incidence of suicidal events and
NSSI. Furthermore, depression treatment may
need supplementation with interventions targeting
specific risk factors for SIB, such as problems
with emotion regulation and distress tolerance.

...results may not generalize to less chronically depressed, untreated,
or nonreferred samples where NSSI is often found without chronic, or even acute depression.

Personality disorder was not assessed - ?may be that BPD traits are the underlying predictor?

TORDIA was a treatment trial - more follow up and input than many community cases - UNDERESTIMATION of risks?

Aseltine RH, DeMartino R (2004)
!An Outcome Evaluation of the SOS Suicide Prevention Program
Am J Public Health. 2004;94:446–451
We examined the effectiveness of the Signs of Suicide (SOS) prevention
program in reducing suicidal behavior.
Twenty-one hundred students in 5 high schools in Columbus, Ga, and Hartford,
Conn, were randomly assigned to intervention and control groups. Self-administered
questionnaires were completed by students in both groups approximately 3 months
after program implementation.
Significantly lower rates of suicide attempts and greater knowledge and more
adaptive attitudes about depression and suicide were observed among students in the
intervention group. The modest changes in knowledge and attitudes partially explained
the beneficial effects of the program.
SOS is the first school-based suicide prevention program to demonstrate significant
reductions in self-reported suicide attempts
Aseltine RH, James A,  Schilling EA,  Glanovsky J (2007)
!Evaluating the SOS suicide prevention program: a replication and extension
BMC Public Health 2007, 7:161
Suicide is a leading cause of death for children and youth in the United States.
Although school based programs have been the principal vehicle for youth suicide prevention
efforts for over two decades, few have been systematically evaluated. This study examined the
effectiveness of the Signs of Suicide (SOS) prevention program in reducing suicidal behavior.
4133 students in 9 high schools in Columbus, Georgia, western Massachusetts, and
Hartford, Connecticut were randomly assigned to intervention and control groups during the
2001–02 and 2002–03 school years. Self-administered questionnaires were completed by students
in both groups approximately 3 months after program implementation.
Significantly lower rates of suicide attempts and greater knowledge and more adaptive
attitudes about depression and suicide were observed among students in the intervention group.
Students' race/ethnicity, grade, and gender did not alter the impact of the intervention on any of
the outcomes assessed in this analysis.
This study has confirmed preliminary analysis of Year 1 data with a larger and more
racially and socio-economically diverse sample. SOS continues to be the only universal school-based
suicide prevention program to demonstrate significant effects of self-reported suicide attempts in
a study utilizing a randomized experimental design. Moreover, the beneficial effects of SOS were
observed among high school-aged youth from diverse racial/ethnic backgrounds, highlighting the
program's utility as a universal prevention program.
!The intervention
SOS is a school-based prevention program developed by
Screening for Mental Health, Inc., a non-profit organization
in Wellesley, Massachusetts. Fifteen national organizations
specializing in youth mental health and suicide
prevention serve as sponsors of the SOS program, including
the American School Counselor Association, National
Association of School Psychologists, National Association
of Secondary School Principals, and the National Association
of Social Workers. SOS incorporates two prominent
suicide prevention strategies into a single program, combining
a curriculum that aims to raise awareness of suicide
and its related issues with a brief screening for depression
and other risk factors associated with suicidal behavior.
The program focuses in particular on two of the most
prominent risk factors for suicidal behavior: underlying
mental illness, particularly depression, and problematic
use of alcohol. In the didactic component of the program,
SOS promotes the concept that suicide is directly related
to mental illness, typically depression, and that it is not a
normal reaction to stress or emotional upset [13]. The
basic goal of the program is to teach high school students
to respond to signs of suicide in themselves and others as
an emergency, much as one would react to signs of a heart
attack. Youths are taught to recognize the signs and symptoms
of suicide and depression and to follow the specific
action steps needed to respond to those signs. The objective
is to make the action step – ACT – as instinctual a
response as the Heimlich maneuver and as familiar an
acronym as "CPR." ACT stands for Acknowledge, Care,
and Tell. First, ACKNOWLEDGE the signs of suicide that
others display and take them seriously. Next, let that person
know you CARE about him or her and that you want
to help. Then, TELL a responsible adult

<<image unsyncedIcon width:48>> Sync is currently unavailable in ~TiddlyWiki due to security constraints in modern browsers. Research is being done to build a suitable alternative. In the meantime if you have changed content in an offline ~TiddlyWiki, you can get your content back into ~TiddlySpace by using the ''import'' functionality from the backstage of the online wiki.

<<message messages.memberStatus>> <<homeLink>>
{{unsyncedList{<<message messages.syncListHeading>> <<list filter [is[unsynced]]>>}}}

running TiddlySpace@glossary version <<message extensions.tiddlyweb.status.tiddlyspace_version>>
<<tiddler Backstage##Resources>>

[[blog|@@blog]] [[documentation|@@docs]] [[featured spaces|@@featured]] 

You can download this TiddlySpace as an offline TiddlyWiki:


|upload a <<message messages.privacySetting>> file: <<binaryUpload>>|<<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>>|
|>|<<tiddler Backstage##Tiddlers>>|

	"Recent" "Recently edited tiddlers" TabTimeline
	"All" "All tiddlers" TabAll
	"Public" "All public tiddlers" [[TiddlySpaceTabs##Public]]
	"Private" "All private tiddlers" [[TiddlySpaceTabs##Private]]
	"Tags" "All tags" TabTags
	"Spaces" "Tiddlers grouped by space" [[TiddlySpaceTabs##Spaces]]
	"Missing" "Missing tiddlers" TabMoreMissing
	"Orphans" "Orphaned tiddlers" TabMoreOrphans
	"Shadows" "Shadowed tiddlers" TabMoreShadowed

	"Private" "Move tiddlers from private to public" Backstage##BatchPrivate
	"Public" "Move tiddlers from public to private" Backstage##BatchPublic

<<TiddlySpacePublisher type:private>>

<<TiddlySpacePublisher type:public>>

''Note:'' Many of these plugins are core TiddlySpace plugins and cannot be changed unless first cloned.

<<tiddler PluginManager>>

These options change behavior in TiddlyWiki //only// and may be ineffective in TiddlySpace.

<<tiddler AdvancedOptions>>
Beautrais AL. Risk factors for suicide and attempted suicide among
young people. Aust N Z J Psychiatry 2000; 34: 420–36
|''Description''|renders base64-encoded binary tiddlers as images or links|
(function($) {

"use strict";

var ctfield = "server.content-type";

var plugin = config.extensions.BinaryTiddlersPlugin = {
	isWikiText: function(tiddler) {
		var ctype = tiddler.fields[ctfield];
		if(ctype) {
			if (ctype === 'text/x-tiddlywiki') {
				return true;
			return !this.isBinary(tiddler) && !this.isTextual(ctype);
		} else {
			return true;
	// NB: pseudo-binaries are considered non-binary here
	isBinary: function(tiddler) {
		var ctype = tiddler.fields[ctfield];
		return ctype ? !this.isTextual(ctype) : false;
	isTextual: function(ctype) {
		return ctype.indexOf("text/") === 0
			|| this.endsWith(ctype, "+xml")
			|| ctype === 'application/json'
			|| ctype === 'application/javascript';
	endsWith: function(str, suffix) {
		return str.length >= suffix.length &&
			str.substr(str.length - suffix.length) === suffix;
	isLink: function(tiddler) {
		return this.isBinary(tiddler) && tiddler.text.indexOf("<html>") !== -1;

// Disable edit for linked tiddlers (for now)
// This will be changed to a GET then PUT
config.commands.editTiddler.isEnabled = function(tiddler) {
    var existingTest = config.commands.editTiddler.isEnabled;
    if (existingTest) {
        return existingTest && !plugin.isLink(tiddler);
    } else {
        return !plugin.isLink(tiddler);

// hijack text viewer to add special handling for binary tiddlers
var _view = config.macros.view.views.wikified;
config.macros.view.views.wikified = function(value, place, params, wikifier,
		paramString, tiddler) {
	var ctype = tiddler.fields["server.content-type"];
	if(params[0] === "text" && ctype && ctype !== 'text/x-tiddlywiki' &&
			!tiddler.tags.contains("systemConfig") && !plugin.isLink(tiddler)) {
		var el;
		if(plugin.isBinary(tiddler)) {
			var uri = "data:%0;base64,%1".format([ctype, tiddler.text]); // TODO: fallback for legacy browsers
			if(ctype.indexOf("image/") === 0) {
				el = $("<img />").attr("alt", tiddler.title).attr("src", uri);
			} else {
				el = $("<a />").attr("href", uri).text(tiddler.title);
		} else {
			el = $("<pre />").text(tiddler.text);
	} else {
		_view.apply(this, arguments);

// hijack edit macro to disable editing of binary tiddlers' body
var _editHandler = config.macros.edit.handler;
config.macros.edit.handler = function(place, macroName, params, wikifier,
		paramString, tiddler) {
	if(params[0] === "text" && plugin.isBinary(tiddler)) {
		return false;
	} else {
		_editHandler.apply(this, arguments);

// hijack autoLinkWikiWords to ignore binary tiddlers
var _autoLink = Tiddler.prototype.autoLinkWikiWords;
Tiddler.prototype.autoLinkWikiWords = function() {
	return plugin.isWikiText(this) ? _autoLink.apply(this, arguments) : false;

|''Author''|Ben Gillies and Jon Robson|
|''Description''|Upload a binary file to TiddlyWeb|
|''Requires''|TiddlySpaceConfig TiddlyWebConfig|
<<binaryUpload bag:<name> edit:tags edit:title tags:<default tags> title:<title> >>
* {{{bag:<name>}}}: optional; if left out, the file will be saved to the current workspace
* {{{edit:tags}}}: specifies that you want to tag the file being uploaded
* {{{edit:title}}}: specifies that you want to set the title to something other than the filename
* {{{tags:<default tags>}}}: specifies a default set of tags to apply to the file (requires {{{edit:tags}}} to be set)
* {{{title:<title>}}}: predefines the title of the binary tiddler
(function($) {

var tiddlyspace = config.extensions.tiddlyspace;

var macro = config.macros.binaryUpload = {
	locale: {
		titleDefaultValue: "Please enter a title...",
		tagsDefaultValue: "Please enter some tags...",
		titlePrefix: "title: ",
		tagsPrefix: "tags: ",
		loadSuccess: 'Tiddler %0 successfully uploaded',
		loadError: "An error occurred when uploading the tiddler %0",
		uploadInProgress: "Please wait while the file is uploaded...",
		membersOnly: "Only members can upload."
	renderInputFields: function(container, options) {
		var locale = macro.locale;
		var editableFields = options.edit;
		var includeFields = {
			tags:  editableFields && editableFields.contains("tags") ? true : false,
			title: editableFields && editableFields.contains("title") ? true : false
		var fields = ["title", "tags"];
		for(var i = 0; i < fields.length; i++) {
			var fieldName = fields[i];
			var userDefault = options[fieldName];
			var defaultValue = userDefault ? userDefault[0] : false;
			if(includeFields[fieldName] || defaultValue) {
				var localeDefault = locale["%0DefaultValue".format(fieldName)];
				var className = defaultValue ? "userInput" : "userInput notEdited";
				var inputEl;
				var val = defaultValue || localeDefault || "";
				var iContainer = $("<div />").addClass("binaryUpload%0".format(fieldName)).
				if(defaultValue && !includeFields[fieldName]) {
					var label = locale["%0Prefix".format(fieldName)];
					$("<span />").text(label).appendTo(iContainer);
					$("<span />").addClass("disabledInput").text(val).appendTo(iContainer);
					inputEl = $("<input />").attr("type", "hidden");
				} else {
					inputEl = $("<input />").attr("type", "text");
				inputEl.attr("name", fieldName).
	getTiddlerName: function(fileName) {
		var fStart = fileName.lastIndexOf("\\");
		var fStart2 = fileName.lastIndexOf("/");
		fStart = fStart < fStart2 ? fStart2 : fStart;
		fileName = fileName.substr(fStart+1);
		return fileName;
	errorHandler: function(fileName) {
		displayMessage("upload of file %0 failed".format(fileName));
	uploadFile: function(place, baseURL, workspace, options) {
		var pleaseWait = $(".uploadProgress", place);
		var iframeName =;
		var form = $("form", place);
		var existingVal = $("input[name=title]", form).val();
		var fileName = existingVal || $('input:file', form).val();
		if(!fileName) {
			return false; // the user hasn't selected a file yet
		fileName = macro.getTiddlerName(fileName);
		$("input[name=title]", place).val(fileName);
		// we need to go somewhere afterwards to ensure the onload event triggers
		var redirectTo = "/%0/tiddlers.txt?select=title:%1".
			format(workspace, fileName);
		var token = tiddlyspace ? tiddlyspace.getCSRFToken() : "";
		var action = "%0?csrf_token=%1&redirect=%2"
			.format(baseURL, token, redirectTo);
		form[0].action = action; // dont use jquery to work with ie
		form[0].target = iframeName;
		// do not refactor following line... won't work in IE6 otherwise
		$(place).append($('<iframe name="' + iframeName + '" id="' + iframeName + '"/>').css('display','none'));
		macro.iFrameLoader(iframeName, function() {
			var content = document.getElementById(iframeName).contentWindow.document.documentElement;
			if($(content).text().indexOf(fileName) > -1) {
				options.callback(place, fileName, workspace, baseURL);
			} else {
		return true;
	createUploadForm: function(place, options) {
		var locale = macro.locale;
		if(readOnly) {
			$('<div class="annotation" />').text(locale.membersOnly).
		var bag = options.bag;
		options.callback = options.callback ? options.callback :
			function(place, fileName, workspace, baseurl) {
				macro.displayFile(place, fileName, workspace);
				$("input[type=text]", place).val("");
		var defaults = config.defaultCustomFields;
		place = $("<div />").addClass("container").appendTo(place)[0];
		var workspace = bag ? "bags/%0".format(bag) : config.defaultCustomFields["server.workspace"];
		var baseURL = defaults[""];
		baseURL += (baseURL[baseURL.length - 1] !== "/") ? "/" : "";
		baseURL = "%0%1/tiddlers".format(baseURL, workspace);
		//create the upload form, complete with invisible iframe
		var iframeName = "binaryUploadiframe%0".format(Math.random());
		// do not refactor following line of code to work in IE6.
		var form = $('<form action="%0" method="POST" enctype="multipart/form-data" />'.
		macro.renderInputFields(form, options);
			append('<div class="binaryUploadFile"><input type="file" name="file" /></div>').
			append('<div class="binaryUploadSubmit"><input type="submit" value="Upload" disabled /></div>').
			submit(function(ev) { = iframeName; = iframeName;
				macro.uploadFile(place, baseURL, workspace, options);
			.find('[type="file"]').bind('change', function() {
				$(form).find('[type="submit"]').prop('disabled', false);
		$('<div />').addClass("uploadProgress").text(locale.uploadInProgress).hide().appendTo(place);
		$("input[name=file]", place).change(function(ev) {
			var target = $(;
			var fileName = target.val();
			var title = $("input[type=text][name=title]", place);
			if(!title.val()) {
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		params = paramString.parseParams(null, null, true);
		macro.createUploadForm(place, params[0]);
	iFrameLoader: function(iframeName, callback) {
		var iframe = document.getElementById(iframeName); //jQuery doesn't seem to want to do this!?
		var locale = macro.locale;
		$(".userInput").addClass("notEdited"); // reset editing
		var finishedLoading = function() {
		var iFrameLoadHandler = function() {

		iframe.onload = iFrameLoadHandler;
		completeReadyStateChanges = 0;
		iframe.onreadystatechange = function() {
			if (++(completeReadyStateChanges) == 3) {
	displayFile: function(place, title, workspace) {
		var adaptor = store.getTiddlers()[0].getAdaptor();
		var context = {
			workspace: workspace,
			host: config.defaultCustomFields['']
		adaptor.getTiddler(title, context, null, function(context) {
			if(context.status) {
				story.displayTiddler(place, title);
				var image = config.macros.image;
				if(image && image.refreshImage) {
					image.refreshImage("/%0/tiddlers/%1".format(workspace, title));
					image.refreshImage("%0/%1/tiddlers/%2".format(, workspace, title));
			} else {

if(tiddlyspace) {
	config.macros.binaryUploadPublic = {
		handler: function(place, macroName, params, wikifier, paramString, tiddler) {
			var options = paramString.parseParams(null, null, true)[0];
			var bag = tiddlyspace.getCurrentBag("public");
			options.bag = bag;
			macro.createUploadForm(place, options);
	config.messages.privacySetting = config.options.chkPrivateMode ?
		"private" : "public";
	config.macros.binaryUpload.defaultWorkspace = tiddlyspace.

Assessment and Treatment of the Youthful Suicidal Patient

Suicidal ideation is common in adolescence, approaching a point prevalence
of 20%, although more specific suicidal ideation with intent or with a
plan is substantially less frequent.(ref 1 = ''LEWINSOHN, P.M., P. ROHDE & J.R. SEELEY. 1996. Adolescent suicidal ideation and attempts: prevalence, risk factors, and clinical implications. Clin. Psychol.
Sci. Pract. 3: 25–46.'') The point prevalence of suicide attempts
in the United States ranges from 1.3–3.8% in males and 1.5–10.1% in females,
with a relatively lower prevalence (1–3%) for medically serious attempts.
(refs 1,2) There is a substantial risk for recurrence of suicidal behavior
ranging between 5 and 15% per year, and there is also a substantially increased
risk for completed suicide of 0.5–1.0% per year.(refs 3–7) It is the latter association,
that of a 10–60-fold increased risk for suicide among suicide
attempters, that makes the proper assessment and treatment of suicidal youth
so critical.(refs 8,9)

!Recommended interventions 
...involve treatment of psychopathology; amelioration of cognitive distortion and difficulties with social skills, problem-solving, and affect regulation; and family psychoeducation and intervention. Given the chronic and recurrent nature of the conditions associated with adolescent suicide attempts, a long-term care plan involving both continuation and maintenance treatment is advocated.

!Discussion of Treatment:
Hawton and colleagues (HAWTON, K., ARENSMAN, E., TOWNSEND, E., et al. 1998. Deliberate self harm:
systematic review of efficacy of psychosocial and pharmacological treatments
in preventing repetition. Br. Med. J. 317: 441–447... __''NB this is for ADULTS''__) recently reviewed the literature on the impact of specialized psychosocial and pharmacological treatments on repetition of suicidal behavior in adult suicide attempters, which is summarized in TABLE 4. 

!!Problem-solving therapy
!!intensive aftercare
!!provision of an emergencycard explaining how to access services on a 24-hour basis 
were each contrasted with treatment as usual, and while the odds of repetition were somewhat lower in the experimental treatment, meta-analyses indicated that these differences did not reach statistical significance. 

!!Two types of studies have shown more promise. 
!!!First, Linehan et al. (DBT) 
showed that dialectical behavior therapy (DBT) was more efficacious than treatment as usual in reducing the number and lethality of suicide attempts in chronically suicidal female borderline ''adults'', despite no differential treatment effect between the two groups on suicidal ideation, depression, or hopelessness. This reduced rate of suicide attempts was sustained upon 1-year follow-up.
!!Second, pharmacological Rx's:
in a placebo-controlled trial of chronically and recurrently parasuicidal ''adults'' a depot (flupenthixol)
...was much more effective than placebo in preventing the repetition of the suicide attempt.76 One study published subsequent to Hawton et al.’s meta-analyses examined ''adult'' attempters who were randomized to either paroxetine or placebo for up to 52 weeks.77 Although there was no significant effect on depression, hopelessness, or anger, there was a significant reduction in recurrent suicide attempts in the subgroup of attempters who did not have cluster B characteristics and who had made fewer than five previous attempts. This appears in contrast to Coccaro et al.’s78 promising placebo-controlled study, in which impulsive aggression was reduced in personality-disordered patients by treatment with fluoxetine.
!N.B. Relatively few studies focus exclusively on young suicidal individuals.

!!Treatment papers discussed:

LERNER, M.S. & G.A. CLUM. 1990. Treatment of suicide ideators: a problemsolving
approach. Behav. Ther. 21: 403–411.

Rotheram-Borus et al. (ROTHERAM-BORUS, M.J., J. PIACENTINI, R. VAN ROSSEM, et al. 1996. Enhancing
treatment adherence with a specialized emergency room program for adolescent
suicide attempters. J. Am. Acad. Child Adolesc. Psychiatry 35: 654–663)  randomized 140 Latina adolescent suicide attempters to a brief cognitive behavioral family therapy either alone or in combination with a specialized emergency room intervention designed to
increase compliance. The combination of the emergency room and family intervention
resulted in improved compliance, lower maternal depression, improved
family interaction, and lower adolescent depression and suicidality
than did the family intervention alone.

BRENT, D.A., D. KOLKO, B. BIRMAHER, et al. 1998. Predictors of treatment
efficacy in a clinical trial of three psychosocial treatments for adolescent
depression. J. Am. Acad. Child Adolesc. Psychiatry 37: 906–914.

BRENT, D.A. 1997. Practitioner review: the aftercare of adolescents with deliberate
self-harm. J. Child Psychol. Psychiatry 38: 277–286. - Psychoeducation with Fmailies/parents – helping to reduce perception that their child is “faking it” or being manipulative.  10% dropout rate reported from this trial in Brent’s ‘01 review paper.

HARRINGTON, R., KERFOOT, M., DYER, E., et al. 1998. Randomized trial of a
home-based family intervention for children who have deliberately poisoned
themselves. J. Am. Acad. Child Adolesc. Psychiatry 37: 512–518.

!!DBT (presumably ADULT studies...)

LINEHAN, M.M., H.E. ARMSTRONG, A. SUAREZ, et al. 1991. Cognitive-behavioral
treatment of chronically parasuicidal borderline patients. Arch. Gen.
Psychiatry 48: 1060–1064.

LINEHAN, M.M., H.L. HEARD & H.E. ARMSTRONG. 1993. Naturalistic followup
of a behavioral treatment for chronically parasuicidal borderline patients.
Arch. Gen. Psychiatry 50: 971–974.

!!DBT - Adapted for ADOLESCENTS.....

MILLER, A.L., J.H. RATHUS, M.M. LINEHAN, et al. 1997. Dialectical behavior
therapy adapted for suicidal adolescents. J. Pract. Psychiatry Behav. Health 3: 86.

!!MST for suicidal adolescents

HENGGELER, S.W. & C.M. BORDUIN. 1990. Treatment of delinquent behavior.
In Family Therapy and Beyond: A Multisystemic Approach to Treating the
Behavior Problems of Children and Adolescents. S.W. Henggeler & C.M.
Borduin, eds. :219-245. Brooks/Cole Publishing Co. Pacific Grove, CA.

!!Engagement – using Family-work...

ROTHERAM-BORUS, M.J., J. PIACENTINI, R. VAN ROSSEM, et al. 1996. Enhancing
treatment adherence with a specialized emergency room program for adolescent
suicide attempters. J. Am. Acad. Child Adolesc. Psychiatry 35: 654–663.

!"Rx often seems to be TOO BRIEF"...

The provision of six monthly CBT booster sessions after acute treatment
markedly reduces the relapse rate.
Seen [_]
BRENT, D.A., D. KOLKO, B. BIRMAHER, et al. 1998. Predictors of treatment
efficacy in a clinical trial of three psychosocial treatments for adolescent
depression. J. Am. Acad. Child Adolesc. Psychiatry 37: 906–914.

CBT Vs Family Vs Supportive

Brent et al. randomized 107 depressed adolescents to either cognitive behavior
treatment (CBT), family therapy, or supportive treatment. Across the
three treatments, 35.1–40.0% had significant suicidality (suicidal ideation
with a plan or a recent attempt) at intake. Although a substantial reduction in
ideation occurred across the three treatments, there was no differential reduction
by treatment, despite one treatment (CBT) being significantly more efficacious
for the treatment of depression.

Reviewed in [[Rathus and Miller, 02]]
NB only 31% of the participants were suicidal - limited generalisability in addition to the lack of any discrminatory effect.
BRENT, D.A. 1997. Practitioner review: the aftercare of adolescents with deliberate self-harm. J. Child Psychol. Psychiatry 38: 277–286. - Psychoeducation with Fmailies/parents – helping to reduce perception that their child is “faking it” or being manipulative.  10% dropout rate reported from this trial in Brent’s ‘01 review paper.

NB no //change in SIB// reported in Brent's report of it in [[Brent, 01]]!
JAMA. 2007;297:1683-1696
Clinical Response and Risk for Reported
Suicidal Ideation and Suicide Attempts in Pediatric Antidepressant Treatment: A Meta-analysis of Randomized Controlled Trials
Jeffrey A. Bridge, PhD
Satish Iyengar, PhD
Cheryl B. Salary, MD
Re´my P. Barbe, MD
Boris Birmaher, MD
Harold Alan Pincus, MD
Lulu Ren, PhD
David A. Brent, MD

Context The US Food and Drug Administration (FDA) has issued warnings that use
of antidepressant medications poses a small but significantly increased risk of suicidal
ideation/suicide attempt for children and adolescents.
Objective To assess the efficacy and risk of reported suicidal ideation/suicide attempt
of antidepressants for treatment of pediatric major depressive disorder (MDD),
obsessive-compulsive disorder (OCD), and non-OCD anxiety disorders.
Data Sources and Study Selection PubMed (1988 to July 2006), relevant US
and British regulatory agency reports, published abstracts of important scientific meetings
(1998-2006), clinical trial registries, and information from authors. Studies were
published and unpublished randomized, placebo-controlled, parallel-group trials of second-
generation antidepressants (selective serotonin reuptake inhibitors, nefazodone,
venlafaxine, and mirtazapine) in participants younger than 19 years with MDD, OCD,
or non-OCD anxiety disorders.
Data Extraction Information was extracted on study characteristics, efficacy outcomes,
and spontaneously reported suicidal ideation/suicide attempt.
Data Synthesis Twenty-seven trials of pediatricMDD(n=15), OCD (n=6), and non-
OCD anxiety disorders (n=6) were selected, and risk differences for response and for
suicidal ideation/suicide attempt estimated by random-effects methods. Pooled risk differences
in rates of primary study-defined measures of responder status significantly favored
antidepressants forMDD(11.0%; [95% confidence interval {CI}, 7.1% to 14.9%]),
OCD(19.8% [95% CI, 13.0% to 26.6%), and non-OCD anxiety disorders (37.1% [22.5%
to 51.7%]), corresponding to a number needed to treat (NNT) of 10 (95% CI, 7 to 15),
6 (4 to 8), and 3 (2 to 5), respectively. While there was increased risk difference of suicidal
ideation/suicide attempt across all trials and indications for drug vs placebo (0.7%;
95%CI, 0.1% to 1.3%) (number needed to harm, 143 [95% CI, 77 to 1000]), the pooled
risk differences within each indication were not statistically significant: 0.9% (95% CI,
−0.1% to 1.9%) for MDD, 0.5% (−1.2% to 2.2%) for OCD, and 0.7% (−0.4% to 1.8%)
for non-OCD anxiety disorders. There were no completed suicides. Age-stratified analyses
showed that for children younger than 12 years with MDD, only fluoxetine showed
benefit over placebo. In MDD trials, efficacy was moderated by age, duration of depression,
and number of sites in the treatment trial.
Conclusions Relative to placebo, antidepressants are efficacious for pediatric MDD,
OCD, and non-OCD anxiety disorders, although the effects are strongest in non-
OCD anxiety disorders, intermediate in OCD, and more modest in MDD. Benefits of
antidepressants appear to be much greater than risks from suicidal ideation/suicide
attempt across indications, although comparison of benefit to risk varies as a function
of indication, age, chronicity, and study conditions.
JAMA. 2007;297:1683-1696
!The role of randomized trials in testing interventions for the prevention of youth suicide
International Review of Psychiatry, December 2007; 19(6): 617–631
Epidemiological considerations point to a small handful of prevention strategies that have the potential for dramatically
reducing suicide rates. Nearly all of those prevention approaches involve population-based strategies to either find an
increased number of individuals at high risk for suicide or to reduce the prevalence of risk factors in members of a population
that, as a whole, has a relatively low rate of suicide. Few of these approaches have been evaluated in rigorous trials. We argue
that there are rigorous randomized trial designs that are both feasible and ethical and can be used to test both programmes
and implementation strategies for population-based suicide prevention. We review existing suicide prevention trials and
introduce two new randomized trial designs that are likely to achieve sufficient statistical power. The ‘dynamic wait-listed
design’ randomizes across different time periods and is now being used to test a gatekeeper training programme in
32 schools. It could also be used to examine suicide prevention programmes in rural areas. The multi-trial follow-up study
builds on the large number of successful population-based preventive interventions aimed at reducing known risk factors for
suicide in youths to see whether these also cause a reduction in rates of completed suicide.
!Three promising psychosocial prevention strategies amenable to evaluation through randomized trials
!!1. Tertiary prevention of suicide in clinic, institutionally, or self-identified high-risk youths
There are a number of interventions that have been
tested with randomized trials and quasi-experimental
designs for this clinically defined high-risk group,
and a clear picture of these results is starting to
emerge (Comtoise & Linehan, 2006). These studies
point out that most low intensity or short programmes,
such as cognitive behavioural therapy
(CBT) only in an inpatient setting or without the
family, weekly debriefing, referral to primary care, or
simplifying the process for coming back into the
hospital are generally ineffective. On the other hand,
longer, more intense interventions can be effective in
reducing suicidal behaviour. Trials have shown that
when those who had been hospitalized for a suicide
attempt are provided in-person follow-up for periods
up to four months, or extended CBT (Salkovskis,
Atha, & Storer, 1990; Brown et al., 2005), or
extended dialectical behaviour therapy for suicidal
patients with borderline personality disorder
(Linehan, Armstrong, Suarez, Allmon, & Heard,
1991; Linehan et al., 2004, 2006), such programmes
do indeed reduce their self-harm behaviour compared
to those in standard care. One RCT has in fact
found significant reduction in suicides for two years
after hospitalization (Motto & Bostrom, 2001).

Schools and juvenile justice programmes routinely identify at-risk
youths, and Thompson and colleagues now have a
randomized trial underway to test Competence and 
Support Training (CAST), an indicated group-based
intervention aimed at reducing suicidality and other
outcomes in eighth graders (13 year olds) who are
likely to drop out of school (Thompson, 2006).
Finally, suicidal youths and families who use crisis
hot-lines are providing a means of self identification.
While the rate of suicidality varies widely among call
centres, this call for help provides an important initial
contact for preventing suicide. One carefully
designed study on crisis hotlines is now underway
(Gould & Kalifat, 2006).
!!!2. Secondary prevention for difficult to identify, high-risk youths
[X] ToDo - finish going thru the table and tagging identified studies as [[Trials identified in Meta-analyses - not to miss]]

!Problem solving therapy
Some suicidal adolescents have difficulty generating and evaluating
the usefulness of a range of solutions to problems [23]. Problem solving
therapy, which is a specific form of cognitive therapy, addresses these
deficiencies, and may be especially appropriate for a suicide attempter
who is impulsive [24]. An important component of problem solving is
the progression though a specific sequence of steps. One such sequence
for suicidal adolescents and their families involves problem definition,
followed by brainstorming of alternative solutions.
[[Donaldson, 97]]. reported a clinical control trial of problem solving
therapy directed to adolescents presenting to an emergency department
with deliberate self-harm and/or suicidal ideation [15]. Twenty-three
adolescents received the intervention and their outcome was compared
with 78 adolescents who received standard aftercare. The intervention
comprised three follow-up phone interviews over an 8-week postdischarge
period and a verbal agreement between the adolescent and
parent/guardian to attend at least four psychotherapy sessions. At
3-month follow-up there were no significant differences between
the treatment group and the group who received standard aftercare
in any of the relevant outcome measures. However, there was a
non-significant trend for fewer adolescents from the experimental
group to self-harm or to fail to attend the minimum number of required
psychotherapy sessions.

!Intensive intervention plus outreach
Sometimes known as assertive outreach, intensive intervention
employs various strategies, such as regular telephone contact and home
visiting, to increase engagement and/or reduce self-harm.
One of the earliest prevention studies targeting recent suicide
attempts in adolescents was a quasi-experimental trial combining
intensive outreach with a community educational curriculum programme
for professionals, adult providers and adolescent peer group
leaders [14]. One hundred and seventy-two adolescents presentingwith suicide attempts received the intervention, and their outcomes
were compared with 147 historical controls. This study reported
higher subject compliance, greater help-seeking and reduced overall
occurrence of emergency admissions for suicidal behaviours in
the intervention group. No significant differences were reported on
the frequency of repeat suicide attempts. The educational component
aided the early identification and referral of young people who were
experiencing suicidal thoughts but were not exhibiting self-harming
In Canada the impact of an outpatient psychiatric emergency department
Follow-up Team was examined. The study employed historical
controls comparing the rate of adolescent psychiatric admissions to
a general paediatric hospital the year before and after the team’s
creation. The proportion of patients returning to the emergency department
two or more times was also compared for those same years.
At 3-year follow-up hospitalization rates were 16% lower in the
experimental group without an increase in the proportion of subjects
returning to the emergency department [18].
One Australian study assessed the efficacy of improving clinical
intervention for patients presenting to emergency departments who
have attempted suicide [Silburn
et al
. unpublished data]. The study
used a quasi-experimental design involving three groups: ‘enhanced’
intervention (n = 324), historical controls (n = 107) and contemporary
controls (n = 223). The intervention consisted of comprehensive
assessment, liaison with community carers and services and a
definite follow-up appointment a week after initial contact. Extra
funding was provided for social work staff in emergency and psychiatry
departments. At 12-month follow-up readmission rates for
suicide attempts were significantly lower in the intervention group
(14%) compared with historical controls (28%) and contemporary
controls (19%). The finding in an Australian context is interesting
but the study design hinders interpretation. Controls were drawn
from a hospital that had initially refused to participate while the
measures of further self-harm were based on hospital readmission,
in effect a proxy measure, and it is unclear whether the results might
reflect a greater willingness of the intervention group to seek further
treatment of any kind, including emergency department consultation
for DSH.
et al
. (2004) studied multisystemic therapy (MST) with
mainly African–American youths attempting suicide and referred
for emergency psychiatric hospitalization. They were randomly
assigned to hospitalization or MST, which involved intensive
community outreach to families and schools regarding youth
behavioural, communication and safety-related issues. Attempted
suicide, suicidal and depressive ideation were assessed before treatment,
at 4 months and at 1 year. Youth report indicated that MST
was significantly more effective than hospitalization at decreasing
attempted suicide rates at 1 years, though the results were the same
in both groups (4%). This effect was accounted for by the MST
group having higher pretreatment levels of attempted suicide (31%
19%), and its rate of symptom reduction over time being greater.
This raises questions about the success of the randomization
process. Questions arose about whether between-group differences
represented regression to the mean, and the generalisability of the
results, given the specific nature of the sample. The relative lack of
effect on depression, hopelessness and suicidal ideation may suggest
that these are mediated by other means than those involved with
suicide attempts.

!Emergency (‘green’) card
The emergency (‘green’) card provides the suicide attempter with
guaranteed access to 24-hour clinical follow-up on demand. The rationale
for the green card is that the vulnerable individual will contact
emergency services for help in preference to engaging in further deliberate
self-harm. To measure the effectiveness of ‘green cards’ 47 young
people (aged 12.2–16.7) were provided with a token allowing readmission
on demand [13], while 58 young people in a comparison group received
‘standard treatment’ from their clinic or child psychiatry department.
The card was not used extensively and at 12-month follow-up, no significant
differences in readmission rates or suicidal behaviour between
the two groups were found. Limited information relating to the study’s
design was provided and data were only available from hospital records
making ascertainment bias a problem.

!Family therapy
Clinical experience suggests that family involvement in the aftercare
of young people who have attempted suicide can play a major role in
facilitating recovery. The effectiveness of family therapy in reducing
suicide attempts has been examined in one randomised controlled trial,
while two trials have examined the impact of enhanced family participation,
one, a clinical control trial, the other involving historical
et al
. report a randomised control trial of home-based
social work intervention directed to young people, aged 16 or younger,
who had attempted suicide by taking an overdose [19]. The intervention
consisted of an assessment session and four home visits by the
social workers to conduct family problem-solving sessions. Patients
referred to mental health teams with a diagnosis of deliberate selfpoisoning
were randomly allocated to either routine care (n = 77) or
routine care plus the social work intervention (n = 85). Both groups
were assessed at baseline, two and 6 months later. There were no
statistically significant differences between the intervention and
control groups in repetition of self-harm, adherence to psychotherapy
or in suicidal ideation at either of the follow-up assessments.
In South Africa, [[Pillay and Wassenaar 1995]] [16] studied 40 Indian
adolescent parasuicides, 40 medical and 40 community controls, the
latter two groups having no history of psychiatric illness or suicidal
behaviour. Fifty-five per cent of the 40 parasuicides agreed to receive
a family orientated psychological intervention. Parasuicide subjects
consenting to receive the intervention did not differ from parasuicide
subjects who did not consent on measures of hopelessness or psychiatric
disturbance, but significant prepost differences in both measures
(Wilcoxon two-tailed p = 0.0002) were noted for the intervention
group after 6 months. Parasuicide subjects had significantly higher
initial levels of hopelessness and psychiatric disturbance than both
groups of control subjects (p
0.01), and the latter groups showed no
change in scores on these measures after 6 months. Suicidal behaviour
was not included as an outcome measure and the authors acknowledge
that other variables between the treated and untreated groups may
account for the variance in hopelessness between the two groups at
Rotheram-Borus 1996 [17] studied a consecutive series of female
adolescents (mean age 15) and their families presenting to the emergency
department in a New York hospital. Participants had attemptedsuicide but did not have a psychiatric disorder or medical problem
subsequent to the attempt. A quasi-experimental design with historical
controls was used. In the first phase of the treatment participants were
assigned to standard emergency department care, and in the second
phase to the experimental conditions. The intervention included some
training of generic emergency staff, provision of manuals and videotapes
to set realistic treatment expectations and one family session
immediately after the attempt. Both groups were offered a six-session
cognitive behavioural therapy programme, which involved both
patients and their families. Participation in the programme did not lead
to greater attendance at follow-up appointments, but the experimental
group had significantly lower levels of suicidal ideation than the
control group. Rates of repeat self-harm were not reported.

!Group therapy
We identified one randomised control trial comparing group therapy
with standard aftercare for young suicide attempters [[Wood, 01]]. The therapy
drew on techniques from a variety of therapies including problem
solving, cognitive-behavioural therapy and dialectical behaviour
therapy. Participants were young people aged 12–16 referred to mental
health services following an incident of self-harm, who had a history
of at least one other incident of self-harm in the previous 12 months.
Participants were randomised to standard aftercare or standard aftercare
plus group therapy. Compared with the control group, significantly
fewer adolescents from the experimental group engaged in two or more
episodes of self-harm in the follow-up period. Missed appointments
were not reported, but the adolescents from the experimental group
attended significantly fewer psychotherapy appointments than adolescents
from the control group. There were no statistically significant
group differences in suicidal ideation.
It is generally agreed that serious misbehavior in children should be replaced with socially appropriate
behaviors, but few guidelines exist with respect to choosing replacement behaviors. We
address this issue in two experiments. In Experiment 1, we developed an assessment method for
identifying situations in which behavior problems, induding aggression, tantrums, and self-injury,
were most likely to occur. Results demonstrated that both low level of adult attention and high
level of task difficulty were discriminative for misbehavior. In Experiment 2, the assessment data
were used to select replacements for misbehavior. Specifically, children were taught to solicit attention
or assistance or both verbally from adults. This treatment, which involved the differential
reinforcement of functional communication, produced replicable suppression of behavior problems
across four developmentally disabled children. The results were consistent with an hypothesis stating
that some child behavior problems may be viewed as a nonverbal means of communication.
According to this hypothesis, behavior problems and verbal communicative acts, though differing
in form, may be equivalent in function. Therefore, strengthening the latter should weaken the
DESCRIPTORS: disruptive behavior, assessment, classroom behavior, communication, developmentally
disabled children
Tiny numbers

|Author|Eric Shulman - ELS Design Studios|
|License| <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|]]|
|Description|Add checkboxes to your tiddler content|
This plugin extends the TiddlyWiki syntax to allow definition of checkboxes that can be embedded directly in tiddler content.  Checkbox states are preserved by:
* by setting/removing tags on specified tiddlers,
* or, by setting custom field values on specified tiddlers,
* or, by saving to a locally-stored cookie ID,
* or, automatically modifying the tiddler content (deprecated)
When an ID is assigned to the checkbox, it enables direct programmatic access to the checkbox DOM element, as well as creating an entry in TiddlyWiki's config.options[ID] internal data.  In addition to tracking the checkbox state, you can also specify custom javascript for programmatic initialization and onClick event handling for any checkbox, so you can provide specialized side-effects in response to state changes.
>see [[CheckboxPluginInfo]]
2008.01.08 [*.*.*] plugin size reduction: documentation moved to [[CheckboxPluginInfo]]
2008.01.05 [2.4.0] set global "" to current checkbox element when processing checkbox clicks.  This allows init/beforeClick/afterClick handlers to reference RELATIVE elements, including using "story.findContainingTiddler(place)".  Also, wrap handlers in "function()" so "return" can be used within handler code.
|please see [[CheckboxPluginInfo]] for additional revision details|
2005.12.07 [0.9.0] initial BETA release
version.extensions.CheckboxPlugin = {major: 2, minor: 4, revision:0 , date: new Date(2008,1,5)};
config.checkbox = { refresh: { tagged:true, tagging:true, container:true } };
config.formatters.push( {
	name: "checkbox",
	match: "\\[[xX_ ][\\]\\=\\(\\{]",
	lookahead: "\\[([xX_ ])(=[^\\s\\(\\]{]+)?(\\([^\\)]*\\))?({[^}]*})?({[^}]*})?({[^}]*})?\\]",
	handler: function(w) {
		var lookaheadRegExp = new RegExp(this.lookahead,"mg");
		lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = lookaheadRegExp.exec(w.source)
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			// get params
			var checked=(lookaheadMatch[1].toUpperCase()=="X");
			var id=lookaheadMatch[2];
			var target=lookaheadMatch[3];
			if (target) target=target.substr(1,target.length-2).trim(); // trim off parentheses
			var fn_init=lookaheadMatch[4];
			var fn_clickBefore=lookaheadMatch[5];
			var fn_clickAfter=lookaheadMatch[6];
			var tid=story.findContainingTiddler(w.output);  if (tid) tid=tid.getAttribute("tiddler");
			var srctid=w.tiddler?w.tiddler.title:null;
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
} );
config.macros.checkbox = {
	handler: function(place,macroName,params,wikifier,paramString,tiddler) {
		if(!(tiddler instanceof Tiddler)) { // if no tiddler passed in try to find one
			var here=story.findContainingTiddler(place);
			if (here) tiddler=store.getTiddler(here.getAttribute("tiddler"))
		var srcpos=0; // "inline X" not applicable to macro syntax
		var target=params.shift(); if (!target) target="";
		var defaultState=params[0]=="checked"; if (defaultState) params.shift();
		var id=params.shift(); if (id && !id.length) id=null;
		var fn_init=params.shift(); if (fn_init && !fn_init.length) fn_init=null;
		var fn_clickBefore=params.shift();
		if (fn_clickBefore && !fn_clickBefore.length) fn_clickBefore=null;
		var fn_clickAfter=params.shift();
		if (fn_clickAfter && !fn_clickAfter.length) fn_clickAfter=null;
		var refresh={ tagged:true, tagging:true, container:false };
	create: function(place,tid,srctid,srcpos,defaultState,id,target,refresh,fn_init,fn_clickBefore,fn_clickAfter) {
		// create checkbox element
		var c = document.createElement("input");
		c.srctid=srctid; // remember source tiddler
		c.srcpos=srcpos; // remember location of "X"
		c.container=tid; // containing tiddler (may be null if not in a tiddler)
		c.tiddler=tid; // default target tiddler 
		c.refresh = {};
		c.refresh.container = refresh.container;
		c.refresh.tagged = refresh.tagged;
		c.refresh.tagging = refresh.tagging;
		// set default state
		// track state in config.options.ID
		if (id) {; // trim off leading "="
			if (config.options[]!=undefined)
		// track state in (tiddlername|tagname) or (fieldname@tiddlername)
		if (target) {
			var pos=target.indexOf("@");
			if (pos!=-1) {
				c.field=pos?target.substr(0,pos):"checked"; // get fieldname (or use default "checked")
				c.tiddler=target.substr(pos+1); // get specified tiddler name (if any)
				if (!c.tiddler || !c.tiddler.length) c.tiddler=tid; // if tiddler not specified, default == container
				if (store.getValue(c.tiddler,c.field)!=undefined)
					c.checked=(store.getValue(c.tiddler,c.field)=="true"); // set checkbox from saved state
			} else {
				var pos=target.indexOf("|"); if (pos==-1) var pos=target.indexOf(":");
				if (pos==0) c.tag=target.substr(1); // trim leading "|" or ":"
				if (pos>0) { c.tiddler=target.substr(0,pos); c.tag=target.substr(pos+1); }
				if (!c.tag.length) c.tag="checked";
				var t=store.getTiddler(c.tiddler);
				if (t && t.tags)
					c.checked=t.isTagged(c.tag); // set checkbox from saved state
		// trim off surrounding { and } delimiters from init/click handlers
		if (fn_init) c.fn_init="(function(){"+fn_init.trim().substr(1,fn_init.length-2)+"})()";
		if (fn_clickBefore) c.fn_clickBefore="(function(){"+fn_clickBefore.trim().substr(1,fn_clickBefore.length-2)+"})()";
		if (fn_clickAfter) c.fn_clickAfter="(function(){"+fn_clickAfter.trim().substr(1,fn_clickAfter.length-2)+"})()";
		c.init=true; c.onclick(); c.init=false; // compute initial state and save in tiddler/config/cookie
	onClickCheckbox: function(event) {;
		if (this.init && this.fn_init) // custom function hook to set initial state (run only once)
			{ try { eval(this.fn_init); } catch(e) { displayMessage("Checkbox init error: "+e.toString()); } }
		if (!this.init && this.fn_clickBefore) // custom function hook to override changes in checkbox state
			{ try { eval(this.fn_clickBefore) } catch(e) { displayMessage("Checkbox onClickBefore error: "+e.toString()); } }
		if (
			// save state in config AND cookie (only when ID starts with 'chk')
			{ config.options[]=this.checked; if (,3)=="chk") saveOptionCookie(; }
		if (this.srctid && this.srcpos>0 && (! ||,3)!="chk") && !this.tag && !this.field) {
			// save state in tiddler content only if not using cookie, tag or field tracking
			var t=store.getTiddler(this.srctid); // put X in original source tiddler (if any)
			if (t && this.checked!=(t.text.substr(this.srcpos,1).toUpperCase()=="X")) { // if changed
				if (!story.isDirty(t.title)) story.refreshTiddler(t.title,null,true);
		if (this.field) {
			if (this.checked && !store.tiddlerExists(this.tiddler))
				store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
			// set the field value in the target tiddler
			// DEBUG: displayMessage(this.field+"@"+this.tiddler+" is "+this.checked);
		if (this.tag) {
			if (this.checked && !store.tiddlerExists(this.tiddler))
				store.saveTiddler(this.tiddler,this.tiddler,"",config.options.txtUserName,new Date());
			var t=store.getTiddler(this.tiddler);
			if (t) {
				var tagged=(t.tags && t.tags.indexOf(this.tag)!=-1);
				if (this.checked && !tagged) { t.tags.push(this.tag); store.setDirty(true); }
				if (!this.checked && tagged) { t.tags.splice(t.tags.indexOf(this.tag),1); store.setDirty(true); }
			// if tag state has been changed, update display of corresponding tiddlers (unless they are in edit mode...)
			if (this.checked!=tagged) {
				if (this.refresh.tagged) {
					if (!story.isDirty(this.tiddler)) // the TAGGED tiddler in view mode
					else // the TAGGED tiddler in edit mode (with tags field)
				if (this.refresh.tagging)
					if (!story.isDirty(this.tag)) story.refreshTiddler(this.tag,null,true); // the TAGGING tiddler
		if (!this.init && this.fn_clickAfter) // custom function hook to react to changes in checkbox state
			{ try { eval(this.fn_clickAfter) } catch(e) { displayMessage("Checkbox onClickAfter error: "+e.toString()); } }
		// refresh containing tiddler (but not during initial rendering, or we get an infinite loop!) (and not when editing container)
		if (!this.init && this.refresh.container && this.container!=this.tiddler)
			if (!story.isDirty(this.container)) story.refreshTiddler(this.container,null,true); // the tiddler CONTAINING the checkbox
		return true;
	refreshEditorTagField: function(title,tag,set) {
		var tagfield=story.getTiddlerField(title,"tags");
		if (!tagfield||tagfield.getAttribute("edit")!="tags") return; // if no tags field in editor (i.e., custom template)
		var tags=tagfield.value.readBracketedList();
		if (tags.contains(tag)==set) return; // if no change needed
		if (set) tags.push(tag); // add tag
		else tags.splice(tags.indexOf(tag),1); // remove tag
		for (var t=0;t<tags.length;t++) tags[t]=String.encodeTiddlyLink(tags[t]);
		tagfield.value=tags.join(" "); // reassemble tag string (with brackets as needed)
Mental health needs of young offenders in custody
and in the community
Background Researchhas revealed
highlevels ofmentalhealthneeds inyoung
offendersbutmany studieshave been
small, focusing on specific populations.
Aims To evaluate thementalhealth and
psychosocialneeds of a nationally
representative sample of juvenile
offendersin England andWales, including
female offenders andthosefromBlackand
minorityethnic groups.
Method Across-sectional surveyof
inthe community, was conductedin six
geographicallyrepresentative areas
across England andWales.Eachyoung
personwasinterviewed to obtain
demographic information,mentalhealth
and socialneeds, andpsychometricdata.
Results Young offenderswere found to
have highlevels of needs in a number of
different areasincludingmentalhealth
(31%), education/work (36%) and social
relationships (48%).Youngoffendersinthe
thanthosein secure care andneedswere
oftenunmet.One in five young offenders
was also identified as having a learning
disability (IQ570).
Conclusions Needs for young
offenderswere high butoftenunmet.This
emphasises theimportance of structured
needs assessmentwithin custody and
community settings in conjunction with a
care programme approachthat improves
continuityof care.
European Child & Adolescent Psychiatry 12:23–29 (2003)
!Predicting repeat self-harm in children: How accurate can we expect to be?
Prathiba Chitsabesan
Richard Harrington
Valerie Harrington
Barbara Tomenson

The main objective of the study was to find which variables
predict repetition of deliberate self-harm in children. The
study is based on a group of children who took part in a randomized
control trial investigating the effects of a home-based family intervention
for children who had deliberately poisoned themselves (FOLLOW-ON FROM [[Harrington, 98]]).

These children had a range of baseline and outcome measures collected
on two occasions (two and six months follow-up). Outcome
data were collected from 149 (92%) ofthe initial 162 childr en over the
six months. Twenty-three children made a further deliberate selfharm
attempt within the follow-up period. 

''__A number of variables at baseline were found to be significantly associated with repeat self harm:__''
!!Strongest predictors:
*Parental mental health
*history of previous attempts
!!Other predictors
*Suicidal ideation
*Family functioning 
*Suicidal intent

A model of prediction off further deliberate self-harm combining these significant
individual variables produced a high positive predictive value (86%) but had low sensitivity (28 %). 

Predicting repeat self-harm in children is difficult, even with a comprehensive series of assessments
over multiple time points, and we need to adapt services with this in mind.

We propose a model of service provision which takes these findings into account.

!Service proposals:
!!!Universal interventions
All children who have deliberately harmed themselves
should have a universal intervention with the following
components. Firstly, a comprehensive mental health assessment
ofb oth the child and their parents, including
an assessment ofp arental mental state. Secondly, education
regarding the physical consequences ofself -harm.
Thirdly, advice about other support agencies. Finally, information
to patients about pathways to re-access
CAMHS services quickly.
!!!Follow-up high-risk cases
Cases felt to be high risk, because of the risk factors
identified above, should be followed up for at least two
months. Our results suggest that the highest risk cases
are likely to be those with all six risk factors,particularly
those whose parents are mentally ill and those with a
history ofp revious attempts. Children and families
should be given targeted interventions following their
assessment. This should include problem solving skills
training for the children, as this is an area in which repeaters
were more likely to have difficulties.
Finally, it will ofc ourse be very important that those individuals
who do repeat self-harm have rapid access to
mental health services.
While this study has highlighted the difficulties in predicting
repeat self-harm in children, further research is
clearly needed. Future studies will need to follow up
larger initial cohorts and be designed to investigate
these processes in much more detail ifwe are to have a
better understanding ofthis group ofc hildren.

|Description:|Closes the tiddler if you click new tiddler then cancel. Default behaviour is to leave it open|
|Version:|3.0.1 ($Rev: 3861 $)|
|Date:|$Date: 2008-03-08 10:53:09 +1000 (Sat, 08 Mar 2008) $|
|Author:|Simon Baird <>|

	handler_mptw_orig_closeUnsaved: config.commands.cancelTiddler.handler,

	handler: function(event,src,title) {
		if (!store.tiddlerExists(title) && !store.isShadowTiddler(title))
	 	return false;



Background: #f4e1ef
Foreground: #1d0a18
PrimaryPale: #f8ecf5
PrimaryLight: #db9cca
PrimaryMid: #be4da0
PrimaryDark: #250d1f
SecondaryPale: #ecf7f8
SecondaryLight: #9cd4db
SecondaryMid: #4db1be
SecondaryDark: #0d2225
TertiaryPale: #f3f8ec
TertiaryLight: #c1db9c
TertiaryMid: #8fbe4d
TertiaryDark: #1b250d
Error: #f88
ColorPaletteParameters: HSL([316|51], [0.4705832216083844],[0.1|0.9514792520431206])
!The author/collator
Is Dr Dickon Bevington and (aside from quoted material) he retains copyright of the layout and notes contained herein.
!See also
Similar notes for child and adolescent Substance Use Disorder (@sud-treatments-literature).
!These notes are released under license:
<html><a rel="license" href=""><img alt="Creative Commons License" style="border-width:0" src="" /></a><br />This work is licensed under a <a rel="license" href="">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License</a></html>
!Health Warning: 
These are just working notes/an aide memoir, made in preparation for a chapter on ~Self-Injurious Behaviour in the second edition of //"What Works for Whom; a critical review of treatments for children and adolescents"// by Fonagy, Cottrell, Glaser, Williams and Bevington (due for pub late 2011), ~WileyBlackwell), and do ''not'' consititute a finished product.  No responsibility is claimed for the accuracy of the contents.

Cotgrove AJ, Zirinsky L, Black D, WSeesctoonnd aryD .
prevention of attempted suicide in adolescence.
Journal of Adolescence 1995; 18:569–577.
[X] needs reviewing
!!!Criteria/group:Recent suicide attempt;
I = 47, C = 58– UK;
Age range 12.2–16.7 years
Standard management and an emergency
‘green’ card following hospital admission
Missed appointments and suicidal ideation not reported
Repeat self-harm, 3/47 v 7/58 (RR = 0.53, 95% CI 0.14–1.93); 12 month f/up.

From [[Miller, 00]]
Reviews 20 studies according to criteria... 
//"Of the 20 studies that met these inclusion criteria, only one of them used adolescent subjects. In that study, adolescents in the experimental group received standard outpatient care (i.e., from a local clinic
or child psychiatry department) and were given a green card that acted as a passport to
readmission into an inpatient unit at a local hospital if they actively felt suicidal [[Cotgrove et al 1995]]. The control group received only standard care.
Results indicated no significant differences between groups on measures of repeated
self-injurious behavior.//
[[Copyright Licensing]]
!<<tag [[02.Definitions]]>>
!<<tag [[03.Incidence & prevalence]]>>
!<<tag [[04.Clinical presentation]]>> - includes material on function of SIB and Assessment
!<<tag [[05.Comorbidity]]>>
!<<tag [[06.Natural history]]>>

Deykin EY, Chung-Chen H, J oshAi dolNes.cent suicidal and
self-destructive behaviours: results of an intervention study.
Journal of Adolescent Health Care 1986; 7:88–95.

Recent suicide attempt; Age range 13–17 years
I = 172 Boston City Hospital;
C = 147 Brockton Hospital;
Intensive outreach;
Educational curriculum for adult
providers and adolescent peer leaders;
Repeat self-harm, 14/172 v 7/147
(RR = 2.99, 95% CI 1.01–8.89);
Missed appointments, 105/172 v v
48/147. (RR = 1.87, 95% CI 1.44–2.43);
Suicidal ideation not reported
!!Follow period:
!From [[Burns, 05]]
One of the earliest prevention studies targeting recent suicide
attempts in adolescents was a quasi-experimental trial combining
intensive outreach with a community educational curriculum programme
for professionals, adult providers and adolescent peer group
leaders. One hundred and seventy-two adolescents presenting
with suicide attempts received the intervention, and their outcomes
were compared with 147 historical controls. This study reported
higher subject compliance, greater help-seeking and reduced overall
occurrence of emergency admissions for suicidal behaviours in
the intervention group. ''No significant differences were reported on
the frequency of repeat suicide attempts''. The educational component
aided the early identification and referral of young people who were
experiencing suicidal thoughts but were not exhibiting self-harming
Diamond GS, Wintersteen MB, Brown GK, Diamond GM, Gallop R, Shelef K, Levy S (2010) Attachment-Based Family Therapy for Adolescents with Suicidal Ideation: A Randomized Controlled Trial. J. Am. Acad. Child Adolesc. Psychiatry, 2010;49(2):122–131

To evaluate whether Attachment-Based Family Therapy (ABFT) is more effective
than Enhanced Usual Care (EUC) for reducing suicidal ideation and depressive symptoms in
This was a randomized controlled trial of suicidal adolescents between the ages of 12 and 17, identified in primary care and emergency departments. Of 341 adolescents
screened, 66 (70% African American) entered the study for 3 months of treatment. Assessment
occurred at baseline, 6 weeks, 12 weeks, and 24 weeks. ABFT consisted of individual and family
meetings, and EUC consisted of a facilitated referral to other providers. All participants received
weekly monitoring and access to a 24-hour crisis phone. Trajectory of change and clinical recovery
were measured for suicidal ideation and depressive symptoms. 
Using intent to treat, patients in ABFT demonstrated significantly greater rates of change on self-reported suicidal ideation at post-treatment evaluation, and benefits were maintained at follow-up, with a strong overall effect size (ES = 0.97). 

Between-group differences were similar on clinician ratings. Significantly more patients in ABFT met criteria for clinical recovery on suicidal ideation post-treatment (87%; 95% confidence interval [CI] = 74.6 –99.6) than patients in EUC (51.7%; 95% CI = 32.4 –54.32). Benefits were maintained at follow-up (ABFT, 70%; 95% CI = 52.6–87.4; EUC 34.6%; 95% CI = 15.6 –54.2; odds ratio = 4.41). Patterns of depressive symptoms over time were similar, as were results for a subsample of adolescents with diagnosed depression. Retention in ABFT was higher than in EUC (mean = 9.7 versus 2.9). 
ABFT is more efficacious than EUC in reducing suicidal ideation and depressive symptoms in adolescents. Additional research is warranted to confirm treatment efficacy and to test the proposed mechanism of change (the Family Safety Net Study). .
|''Description''|highlighting of text comparisons|
Highlights changes in a unified [[diff|]].
Based on Martin Budden's [[DiffFormatterPlugin|]].
The formatter is applied to blocks wrapped in <html><code>{{{diff{..}}}</code></html> within tiddlers tagged with "diff".
!Revision History
!!v0.9 (2010-04-07)
* initial release; fork of DiffFormatterPlugin
.diff { white-space: pre; font-family: monospace; }
.diff ins, .diff del { display: block; text-decoration: none; }
.diff ins { background-color: #dfd; }
.diff del { background-color: #fdd; }
.diff .highlight { background-color: [[ColorPalette::SecondaryPale]]; }
(function() {

config.shadowTiddlers.StyleSheetDiffFormatter = store.getTiddlerText(tiddler.title + "##StyleSheet");
store.addNotification("StyleSheetDiffFormatter", refreshStyles);

var formatters = [{
		name: "diffWrapper",
		match: "^\\{\\{diff\\{\n", // XXX: suboptimal
		termRegExp: /(.*\}\}\})$/mg,
		handler: function(w) {
			var el = createTiddlyElement(w.output, "div", null, "diff");
			w.subWikifyTerm(el, this.termRegExp);
	}, {
		name: "diffRange",
		match: "^(?:@@|[+\\-]{3}) ",
		lookaheadRegExp: /^(?:@@|[+\-]{3}) .*\n/mg,
		handler: function(w) {
			createTiddlyElement(w.output, "div", null, "highlight").
				innerHTML = "&#8230;";
			this.lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
				w.nextMatch = this.lookaheadRegExp.lastIndex;
	}, {
		name: "diffAdded",
		match: "^\\+",
		termRegExp: /(\n)/mg,
		handler: function(w) {
			var el = createTiddlyElement(w.output, "ins", null, "added");
			w.subWikifyTerm(el, this.termRegExp);
	}, {
		name: "diffRemoved",
		match: "^-",
		termRegExp: /(\n)/mg,
		handler: function(w) {
			var el = createTiddlyElement(w.output, "del", null, "removed");
			w.subWikifyTerm(el, this.termRegExp);

config.parsers.diffFormatter = new Formatter(formatters);
config.parsers.diffFormatter.format = "diff";
config.parsers.diffFormatter.formatTag = "diff";

Treatment for Adolescents Following a Suicide Attempt:
Results of a Pilot Trial
Objective: To compare the efficacy of a skills-based treatment protocol to a supportive relationship therapy for adolescents
after a suicide attempt. Method: Thirty-nine adolescents (12–17 years old) and parents who presented to a general pediatric
emergency department or inpatient unit of a child psychiatric hospital after a suicide attemptwere randomized to either a skillsbased
or a supportive relationship treatment condition. Follow-up assessments were conducted at intake and 3 and 6months
post-attempt. Results: In contrast to the low rates of treatment received by adolescent suicide attempters in the community,
approximately 60% of this sample completed the entire treatment protocol. Significant decreases in suicidal ideation and
depressedmood at 3- and 6-month follow-upswere obtained, but there were no differences between treatment groups. There
were six reattempts in the follow-up period. Conclusions: When adolescents who attempt suicide are maintained in treatment,
significant improvements in functioning can be realized for the majority of patients. J. Am. Acad. Child Adolesc. Psychiatry,
2005;44(2):113–120. Key Words: adolescent suicide attempts, cognitive-behavioral therapy, supportive therapy.
Deidre L Donaldson (2006)
!The Youth-Nominated Support Team for Suicidal Adolescents (version 1) intervention does not reduce suicidal attempts
Evid. Based Ment. Health 2006;9;97
Randomised controlled trial.
!Follow up period: 
Six months.
One university hospital and one private hospital, USA;
recruitment 1998 to 2000.
289 adolescents (12–17 years old) who were
psychiatrically hospitalised, and had attempted suicide or had
significant suicidal ideation/intent in the previous month. Other
inclusion criteria: Self Harm Scale of the Child and Adolescent
Functional Assessment Scale score = 20 or 30; >1 completed
baseline measure. 
!Exclusion criteria: 
incapacitating psychosis;
profound or severe mental retardation.
!!!Treatment as usual 
pharmacotherapy, alcohol/drug treatment, partial
hospitalisation, and community service) or 
!!!Youth-Nominated Support Team for Suicidal Adolescents, version 1 
(YST-1: weekly contact with participant-nominated support persons who had
undergone at least 1.5 h of manualised yet personalised
psychoeducational training) plus treatment as usual.
Suicidal ideation (Suicidal Ideation Questionnaire-
Junior: SIQ-J, higher score indicates greater suicidal ideation)
and suicide attempts (Spectrum of Suicide Behavior Scale).
Patient follow up: 89% treatment as usual; 75% YST-1 plus
treatment as usual (p = 0.01 for difference in dropout).
The proportion of adolescents making one or more suicide attempts
did not differ between the treatment as usual (TAU) and YST-1 plus
treatment as usual (17.3% with YST-1 + TAU v 11.6% with TAU,
p=0.26). Overall there was no significant difference in suicidal
ideation between TAU and YST-1 plus TAU (figures and p values not
reported). For girls who completed treatment (at least 3 months’
support from at least two support persons), suicidal ideation
decreased more with YST-1 plus treatment as usual than with
treatment as usual alone (mean SIQ-J scores pre to post intervention:
49.6 to 22.6 with YST-1 + TAU v 42.4 to 25.8 with TAU; time6group
interaction, p = 0.013). This difference was not seen for boys (mean
SIQ-J scores pre to post intervention: 32.8 to 27.6 with YST-1 + TAU v
36.5 to 20.0 with TAU; p value not reported).
The YST-1 had no additional benefit in reducing suicide attempts in
comparison with treatment as usual in suicidal adolescents.
Although the YST-1 did not reduce suicidal ideation overall, it may
reduce suicidal ideation in girls who receive sufficient support.
Donaldson D, Spirito A, Arrigan M , Aspel JW.
Disposition planning for adolescent suicide attempters in a general hospital: preliminary findings on short-term outcome.
Archives of Suicide Research
1997; 3:271–282.

Described in [[Burns, 05]]

!!!Group characteristics:
Suicide attempt and ideation; ED presentation; Age range 12–18 years
I = 23, C = 78; 
Problem solving in ED;
Phone interviews;
4 psychotherapy sessions
Repeat self-harm, 0/23 v 7/78 (RR = 0.22,
95% CI 0.01–3.70);
Missed appointments, 2/23 v 14/78
(RR = 0.48, 95% CI 0.12–1.98);
Suicidal ideation not reported
!!!Follow up:
3 month
Archives of Suicide Research 3: 271–282, 1997.
!Structured disposition planning for adolescent suicide attempters in a general hospital: Preliminary findings on short-term outcome


Adolescent suicide attempters are often noncompliant with outpatient psychotherapy
and drop out of treatment much more quickly than non-suicidal adolescents. In this study, 23
adolescents received medical treatment and a standard psychiatric evaluation in an Emergency
Department following a suicide attempt. In addition, all subjects and their parents received
a psychotherapy compliance enhancement intervention which included a verbal agreement
between the adolescent and parent/guardian to attend at least four psychotherapy sessions.
After discharge from the hospital, each subject received three phone interviews over an 8
week period using a problem solving approach around two key areas: suicidal ideation and
psychotherapy compliance. Compared to a three month follow-up of 78 subjects (which did
not include an experimental intervention), conducted at the same hospital, the experimental
intervention resulted in fewer outpatient psychotherapy ‘no shows’ (9% vs. 18%) and a trend
toward greater number of sessions attended (5.5 vs. 3.9). There were no re-attempts in the
experimental group as compared to 9% in the comparison group. Results are promising and a
randomized intervention trial appears indicated.
Key words: adolescents, compliance, psychotherapy, suicide attempts
<div class='toolbar'
	macro='toolbar [[ToolbarCommands::EditToolbar]] icons:yes'>
<div class='heading editorHeading'>
	<div class='editor title' macro='edit title'></div>
	<div class='tagClear'></div>
<div class='annotationsBox' macro='annotations'>
	<div class='editSpaceSiteIcon'
		macro='tiddlerOrigin height:16 width:16 label:no interactive:no'>
	<div class="privacyEdit" macro='setPrivacy label:no interactive:no'></div>
	<div class='tagClear'></div>
<div class='editor' macro='edit text'></div>
<div class='editorFooter'>
	<div class='tagTitle'>tags</div>
	<div class='editor' macro='edit tags'></div>
	<div class='tagAnnotation'>
		<span macro='message views.editor.tagPrompt'></span>
		<span macro='tagChooser excludeLists'></span>
|''Author''|Jon Robson|
|''Description''|Localised tiddler save errors including edit conflict resolution.|
(function($) {

var tiddlyspace = config.extensions.tiddlyspace;
var currentSpace =;
tiddlyspace.getLocalTitle = function(title, workspace, suffix) {
	var endsWith = config.extensions.BinaryTiddlersPlugin.endsWith;
	if(!suffix) {
		var isPublic = endsWith(workspace, "_public");
		suffix = tiddlyspace.resolveSpaceName(workspace);
		if(currentSpace == suffix) {
			suffix = isPublic ? "public" : "private";
		} else {
			suffix = "@%0".format(suffix);
	return "%0 *(%1)*".format(title, suffix);

var sssp = config.extensions.ServerSideSavingPlugin;

var msgs = config.messages.editConflict = {
	loading: "Loading..",
	resolve: "[[Edit Conflict]]@glossary: this tiddler may have been changed by someone else.",
	reviewDiff: "review (recommended)",
	reviewDiffTooltip: "review changes made to this tiddler",
	reviewDiffError: "error retrieving revision.",
	save: "overwrite",
	saveTooltip: "make this revision the top revision of this tiddler",
	discard: "cancel",
	discardTooltip: "undo changes to this tiddler and get most recent version",
	diffTitle: "%0",
	diffFieldTitle: "%0 - fields",
	diffTextTitle: "%0 - text",
	updating: "updating your version...",
	diffHeader: ["Review the changes that have been made whilst you were editing this tiddler. ",
		"Fold relevant changes back into your version.\n",
		"{{removed{Red}}} highlight shows content removed. ",
		"{{added{Green}}} highlight shows content added.\n"].join(""),
	diffTextHeader: "View changes in text",
	diffFieldsHeader: "View changes in fields"

var plugin = config.extensions.errorHandler = {
	diffTags: ["excludeLists", "excludeMissing", "excludeSearch"],
	displayMessage: function(message, tiddler, context) {
		var desc = context && context.httpStatus ? context.statusText :
		var reportArea = plugin.reportError(tiddler.title);
		var msg = $("<div />").appendTo(reportArea);
		if(message == "saveConflict") {
			wikify(msgs.resolve, msg[0]);
			var choiceArea = $("<div />").appendTo(reportArea)[0];
			plugin.editConflictHandler(choiceArea, tiddler);
		} else {
			msg.text(sssp.locale[message].format(tiddler.title, desc));
	editConflictHandler: function(container, tiddler) {
		var title = tiddler.title;
		var myrev = tiddler.fields[""];
		// note user now needs to edit, fix problem and save. 
		// TODO: make sure this gets reset in save callback
		store.getTiddler(title).fields[""] = "false";

		var diffBtn = createTiddlyButton(container, msgs.reviewDiff, msgs.reviewDiffTooltip, function(ev) {
			var title = $("title");
			plugin.displayDiff(, store.getTiddler(title), myrev);
		var saveBtn = createTiddlyButton(container,, msgs.saveTooltip, function(ev) {
				var title = $("title");
				var tid = store.saveTiddler(store.getTiddler(title));
				autoSaveChanges(null, [tid]);
		var ignoreBtn = createTiddlyButton(container, msgs.discard, msgs.discardTooltip, function(ev) {
			var title = $("title");
		$([diffBtn, ignoreBtn, saveBtn]).data("title", title);
	getDiffTiddlerTexts: function(diffText) {
		var chunks = diffText.split("\n  \n");
		if(chunks.length < 2) {
			return [chunks[0], ""];
		} else {
			var diffFieldsText = "{{diff{\n%0\n}}}".format(chunks[0]);
			diffText = '{{diff{\n%0\n}}}'.format(chunks.splice(1, chunks.length).join("\n"));
			return [diffText, diffFieldsText];
	makeDiffTiddler: function(title, diff) {
		var newTiddler = new Tiddler(title);
		var tags = plugin.diffTags;
		newTiddler.text = msgs.loading;
		newTiddler.fields.doNotSave = true;
		newTiddler.tags = diff ? tags.concat(["diff"]) : tags;
		newTiddler = store.saveTiddler(newTiddler);
			config.defaultCustomFields); // allow option to save it
		return newTiddler;
	displayDiff: function(src, tiddler, latestRevision) {
		var adaptor = tiddler.getAdaptor();
		var title = tiddler.title;
		var ts = new Date().formatString("0hh:0mm:0ss");
		var suffix = "edit conflict %0".format(ts);
		var diffTitle = tiddlyspace.getLocalTitle(msgs.diffTitle.format(title), "", suffix);
		var diffTextTitle = tiddlyspace.getLocalTitle(msgs.diffTextTitle.format(title), "", suffix);
		var diffFieldsTitle = tiddlyspace.getLocalTitle(msgs.diffFieldTitle.format(title), "", suffix);
		plugin.makeDiffTiddler(diffTextTitle, true);
		plugin.makeDiffTiddler(diffFieldsTitle, true);
		var newTiddler = plugin.makeDiffTiddler(diffTitle, false);
		newTiddler.text = ['%0\n<<slider chkViewDiffText "%1" "%2">>\n',
			'<<slider chkViewDiffField "%3" "%4">>'].join("").
			format(msgs.diffHeader, diffTextTitle, msgs.diffTextHeader,
				diffFieldsTitle, msgs.diffFieldsHeader);

		var callback = function(r) {
			var text = plugin.getDiffTiddlerTexts(r);
			store.getTiddler(diffTextTitle).text = text[0];
			store.getTiddler(diffFieldsTitle).text = text[1];
			story.refreshTiddler(diffTitle, null, true);
		var workspace = "bags/%0".format(tiddler.fields["server.bag"]);
			type: "get",
			dataType: "text",
			url: "/diff?format=unified&rev1=%0/%1/%2&rev2=%0/%1".format(workspace, title, latestRevision),
			success: callback,
			error: function() {
		story.displayTiddler(src, diffTitle);
	resetToServerVersion: function(tiddler) {
		var adaptor = tiddler.getAdaptor();
		var ctx = { 
			host: tiddler.fields[""],
			workspace: "bags/" + tiddler.fields["server.bag"]
		adaptor.getTiddler(tiddler.title, ctx, null, function(context) {
	reportError: function(title) {
		var el = story.getTiddler(title);
		if(!el) {
			el = story.displayTiddler(null, title);
		return $("<div />").addClass("error annotation").prependTo(el)[0];

sssp.reportFailure = function(message, tiddler, context) {
	config.options.chkViewDiffText = config.options.chkViewDiffText === undefined ?
		true : config.options.chkViewDiffText;
	config.options.chkViewDiffFields = config.options.chkViewDiffFields || false;
	plugin.displayMessage(message, tiddler, context);

Christianne Esposito-Smythers and Anthony Spirito
!Adolescent Substance Use and Suicidal Behavior: A Review With Implications for Treatment Research
Alcohol Clin Exp Res, Vol 28, No 5, 2004: pp 77S–88S
Adolescent substance use (alcohol and other drugs) and suicidal behavior, independently, pose serious
public health problems. 

''Youths who report co-occurring substance use and suicidality'' are a particularly
high-risk group. 

In this review, we explore four areas that are pertinent to research with substance-abusing
and suicidal adolescent populations. 

!!!First, we review epidemiological research
... that is relevant to the association between substance use and suicidal behavior. Results suggest that substance use heightens
statistical risk for suicidal behavior in adolescent clinical and community populations. Alcohol intoxication
may serve as a proximal risk factor for suicidal behavior among distressed youths through its psychopharmacological
effects on the brain. Substance use may also serve as a distal risk factor for suicidal behavior by
increasing stress and exacerbating co-occurring psychopathology. 
!!!Second, we propose different theoretical models 
...that might explain the high rates of co-occurring substance use and suicidal behavior among adolescents. 

*Substance use may stem from an underlying syndrome of problem behavior among impulsive suicide attempters with predominant externalizing symptoms. 
*In contrast, nonimpulsive suicide attempters with predominant internalizing symptoms may use substances to cope with negative affective states. 
!!!Third, we explore the status of treatment research
...with substance abusing and suicidal adolescent populations.

Studies of substance abuse treatment and suicidal behavior ''have neither adequately assessed nor incorporated treatment of the other co-occurring problem''. 
!!!Finally, we conclude with proposed directions for future research
...including the ''development of integrated interventions tailored to adolescents with these co-occurring problems.''
Favazza, A. R. (1999). Self mutilation. In D. G. Jacobs (Ed.), The Harvard Medical School guide to suicide assessment and intervention ( pp. 125–145). San Francisco: Jossey-Bass, 
[[Simeon & Favazza, 2001]], 
[[Favazza, 98]] = "The coming of age of self-mutilation." Journal of Nervous and Mental Disease, 1998, 186(5), 259–268)
!Diagnostic Issues in Self-Mutilation
Armando R. Favazza M.D., M.P.H.1 and Richard J. Rosenthal M.D.2

Hosp Community Psychiatry 44:134-140, February 1993

1 University of Missouri-Columbia School of Medicine; 3 Hospital Drive, Columbia, Missouri 62501
2 University of California, Los Angeles, School of Medicine

Objective: Pathological self-mutilation-the deliberate alteration or destruction of body tissue without conscious suicidal intent-was examined both as a symptom of mental disorders and as a distinct syndrome. Methods: Data from more than 250 articles and books were reviewed, as well as data obtained by the authors from their extensive clinical experience in treating self-mutilating patients. Results and conclusions: The diverse behaviors that constitute pathological self-mutilation can be categorized into three basic types: major-infrequent acts that result in significant tissue damage, usually associated with psychoses and acute intoxications; stereotypic-fixed, rhythmic behavior seemingly devoid of symbolism, commonly associated with mental retardation; and superficial or moderate-behavior such as skin cutting, burning, and scratching associated with a variety of mental disorders. The authors propose that a syndrome of repetitive superficial or moderate self-mutilation should be regarded as an axis I impulse disorder. In most cases, the syndrome coexists with character pathology.
The coming of age of self-mutilation

Favazza AR
Department of Psychiatry and Neurology,
University of Missouri-Columbia,
Missouri 65201, USA.
J Nerv Ment Dis 1998 May;186(5):259-68


    Self-mutilation (SM), the deliberate, nonsuicidal destruction of one's own body tissue, occurs in such culturally sanctioned practices as tattooing; body piercing; and healing, spiritual, and order-preserving rituals. 

As a symptom, it has typically been regarded as a manifestation of borderline behavior and misidentified as a suicide attempt. It has begun to attract mainstream media attention, and many more who suffer from it are expected to seek treatment. 

This ''review'' suggests that ''SM can best be understood as a morbid self-help effort providing rapid but temporary relief from feelings of depersonalization, guilt, rejection, and boredom as well as hallucinations, sexual preoccupations, and chaotic thoughts.''

''__Major SM__'' includes infrequent acts such as eye enucleation and castration, commonly associated with psychosis and intoxication. 
''__Stereotypic SM__'' includes such acts as head banging and self-biting most often accompanying Tourette's syndrome and severe mental retardation. 
''__Superficial/moderate SM__'' includes compulsive acts such as trichotillomania and skin picking and such episodic acts as skin-cutting and burning, which evolve into an axis I syndrome of repetitive impulse dyscontrol with protean symptoms. 
!Fergusson DM, Woodward LJ, Horwood LJ. (2000)
Risk factors and life processes associated with the
onset of suicidal behaviour during adolescence and early adulthood. Psychological Medicine, 2000;
30: 23-39.
This study examined associations between childhood circumstances, adolescent
mental health and life events, and the development of suicidal behaviour in young people aged
between 15 and 21 years.
Data were gathered over the course of a 21-year longitudinal study of a birth cohort of
1,265 children born in New Zealand. The measures collected included: (1) measures of the patterns
of suicidal behaviour (ideation, attempt) (15-21 years); (2) measures of social background, family
functioning, parental and individual adjustment during childhood (0-16 years); and (3) time
dynamic measures of mental health and stressful life events during adolescence and early adulthood
(15-21 years).
By the age of 21 years, 28.8% of the sample reported having thought about killing
themselves and 7.5% reported having made a suicide attempt. The childhood profile of those at
greatest risk of suicidal behaviour during adolescence and early adulthood was that of a young
person reared in a family environment characterised by socio-economic adversity, marital
disruption, poor parent-child attachment and exposure to sexual abuse, and who as a young
adolescent showed high rates of neuroticism and novelty seeking. With the exception of the socioeconomic
and personality measures, the effects of childhood factors were largely mediated by
mental health problems and exposure to stressful life events during adolescence and early
adulthood. Mental health problems including depression, anxiety disorders, substance use disorder,
and to some extent conduct disorder, in addition to exposure to adverse life events, were
significantly associated with the onset of suicidal behaviours.
Findings support a life course model of the aetiology of suicidal behaviour in which
an individual’s risk of developing suicidal behaviour depends on their accumulative exposure to a
series of social, family, personality and mental health factors that appear to make contributions to
risks of these behaviours.
Acta Psychiatrica Scandinavica
Volume 97 Issue 1, Pages 25 - 31, 1998
!!!E. Ferreira de Castro 1 , M. A. Cunha 1 , F. Pimenta 1 , I. Costa
!!Parasuicide and mental disorders

NB NOT adolescent 

This study aims to provide a better follow-up of parasuicidal subjects, focusing on their diagnostic profile with regard to whether the parasuicide intention was death or not. A total of 235 parasuicidal out-patients (PS) and a comparison group of 235 non-parasuicidal out-patients (CG) were surveyed. A structured interview was applied to both groups. Parasuicide intention was appraised by means of the Suicide Intent Scale of Beck. The PS patients were divided into two groups, depending on whether their intention was death (PSD) or not (OPS), and they were matched with their CG counterparts. The diagnostic profile of each group was analysed and differences in diagnosis distribution were found. The rates of major depression, alcohol dependence and schizophrenia were higher among PSD than in OPS patients. The same was true for comorbidity of major depression and alcohol dependence. On Axis II, borderline personality ranks first among PSD patients. The diagnostic profile of PSD approaches that of completed suicide as shown in retrospective and prospective studies. The methodology employed here could therefore be recommended for estimating parasuicide intention. As well as the diagnosis, a detailed profile could also be obtained in the light of that intention. Bearing in mind such a profile among PSD patients could contribute to a drop in the suicide rate among these subjects.
Fleischhaker C, Böhme R, Sixt B, Brück C, Schneider C, Schulz E (2011) ''Dialectical Behavioral Therapy for Adolescents (DBT-A): a clinical Trial for Patients with suicidal and self-injurious Behavior and Borderline Symptoms with a one-year Follow-up''.  Child and Adolescent Psychiatry and Mental Health 2011, 5:3

Background: To date, there are no empirically validated treatments of good quality for adolescents showing
suicidality and non-suicidal self-injurious behavior. Risk factors for suicide are impulsive and non-suicidal selfinjurious
behavior, depression, conduct disorders and child abuse. Behind this background, we tested the main
hypothesis of our study; that Dialectical Behavioral Therapy for Adolescents is an effective treatment for these
Methods: Dialectical Behavioral Therapy (DBT) has been developed by Marsha Linehan - especially for the
outpatient treatment of chronically non-suicidal patients diagnosed with borderline personality disorder. The
modified version of DBT for Adolescents (DBT-A) from Rathus & Miller has been adapted for a 16-24 week
outpatient treatment in the German-speaking area by our group. The efficacy of treatment was measured by a
pre-/post- comparison and a one-year follow-up with the aid of standardized instruments (SCL-90-R, CBCL, YSR, ILC,
Results: In the pilot study, 12 adolescents were treated. At the beginning of therapy, 83% of patients fulfilled five
or more DSM-IV criteria for borderline personality disorder. From the beginning of therapy to one year after its
end, the mean value of these diagnostic criteria decreased significantly from 5.8 to 2.75. 75% of patients were kept
in therapy. For the behavioral domains according to the SCL-90-R and YSR, we have found effect sizes between
0.54 and 2.14.
During treatment, non-suicidal self-injurious behavior reduced significantly. Before the start of therapy, 8 of 12
patients had attempted suicide at least once. There were neither suicidal attempts during treatment with DBT-A
nor at the one-year follow-up.
Conclusions: The promising results suggest that the interventions were well accepted by the patients and their
families, and were associated with improvement in multiple domains including suicidality, non-suicidal self-injurious
behavior, emotion dysregulation and depression from the beginning of therapy to the one-year follow-up.
1998: Garber J; Little S; Hilsman R; Weaver K R
Family predictors of suicidal symptoms in young adolescents.
Journal of adolescence 1998;21(4):445-57.
A 1-year longitudinal study tested the model that the relation between maternal depression and adolescent suicidal symptoms is mediated by family functioning. Participants were 240 children (mean age = 11.86 years) and their mothers; 77% of the mothers had a history of a mood disorder and the remaining 23% were lifetime-free of psychopathology. An adolescent suicide index was created based on suicide items from the child and parent versions of the Children's Depression Inventory, Child Behavior Checklist and Children's Depression Rating Scale, administered at both Time 1 and 2. Family functioning was assessed with the Family Relationship Index completed by mothers and children at Time 1. Results indicated that the relation between maternal depression and adolescent suicide symptoms at Time 2 was mediated by perceived family functioning, controlling for suicide symptoms at Time 1.


If you choose to change this GettingStarted tiddler, you may wish to add the following to your new content if you expect you space to be included:

''This ~GettingStarted tiddler has been customized.''
If you want to see the original system tiddler just click the following link: GettingStarted@system-info at system-info.

Welcome to your brand new [[TiddlySpace|]].

You're almost ready to go, there are just a couple of things left to do.

!Customise your space
Go to [[SpaceSettings]] to finish customising  your space. When you're done, come back here (just scroll up). Don't worry though, this will still be open when you've finished.

!Further Customisation

For advanced options, the [[ServerSettings]] tiddler is used to enable the following features:

#index: The value is the name of a tiddler that will be presented when loading the space.  For example, when set to {{{Hello}}} for the space, navigating to that URL will present the Hello tiddler. If there is no {{{Hello}}} you will get an error.
#editor: The name of an [[editor application|]] to edit tiddlers with.  Applications come from [[included spaces|]]

//If you do not need or understand these features there is no need to create a ServerSettings tiddler.//

To edit these options: 

* click [[here|ServerSettings]] to open the [[ServerSettings]] tiddler
* click on the edit button (the pencil icon)
* add the options you wish to set 
* click on the save button (the tick icon).

An example [[ServerSettings]] tiddler:
index: HelloThere
editor: /edit#{tiddler}

The additional text after /edit allows a tiddler to be opened in edit mode e.g:

!!See Also

* [[ServerSettings shadow tiddler|]]
* [[Choosing a non-TiddlyWiki Default Application for your Space|]]

!Finished customising?
You can [[Start writing]] some [[tiddlers|]].
If you're not done tweaking yet though, you can always [[Customise this space|SpaceSettings]] a bit more.

You can also [[access and read other tiddlers in various ways|]].

If you'd like to change your password or create another space, visit "Your Account" from the [[Universal Backstage|]] (the blue dot in the upper right of the page). If you'd like to add a member or [[include a space|]] visit "This Space" from the [[Universal Backstage|]].

You can have as many spaces as you like and each space can have as many members as you or your group need.

If you're stuck, and would like some help, please visit the [[help|]] space, which can point you in the right direction.
Gould MS, Marrocco FA, Kleinman M, Thomas JG, Mostkoff K, Cote J, Davies M
!Evaluating Iatrogenic Risk of Youth Suicide Screening Programs: A Randomized Controlled Trial
JAMA. 2005;293:1635-1643
Universal screening for mental health problems and suicide risk is at the forefront
of the national agenda for youth suicide prevention, yet no study has directly
addressed the potential harm of suicide screening.
To examine whether asking about suicidal ideation or behavior during a
screening program creates distress or increases suicidal ideation among high school
students generally or among high-risk students reporting depressive symptoms, substance
use problems, or suicide attempts.
!!!Design, Setting, and Participants 
A randomized controlled study conducted within
the context of a 2-day screening strategy. Participants were 2342 students in 6 high
schools in New York State in 2002-2004. Classes were randomized to an experimental
group (n=1172), which received the first survey with suicide questions, or to a control
group (n=1170), which did not receive suicide questions.
!!!Main Outcome Measures 
Distress measured at the end of the first survey and at
the beginning of the second survey 2 days after the first measured on the Profile of
Mood States adolescent version (POMS-A) instrument. Suicidal ideation assessed in
the second survey.
Experimental and control groups did not differ on distress levels immediately
after the first survey (mean [SD] POMS-A score, 5.5 [9.7] in the experimental
group and 5.1 [10.0] in the control group; P=.66) or 2 days later (mean [SD] POMS-A
score, 4.3 [9.0] in the experimental group and 3.9 [9.4] in the control group; P=.41),
nor did rates of depressive feelings differ (13.3% and 11.0%, respectively; P=.19).
Students exposed to suicide questions were no more likely to report suicidal ideation
after the survey than unexposed students (4.7% and 3.9%, respectively; P=.49). Highrisk
students (defined as those with depression symptoms, substance use problems,
or any previous suicide attempt) in the experimental group were neither more suicidal
nor distressed than high-risk youth in the control group; on the contrary, depressed
students and previous suicide attempters in the experimental group appeared less distressed
(P=.01) and suicidal (P=.02), respectively, than high-risk control students.
No evidence of iatrogenic effects of suicide screening emerged. Screening
in high schools is a safe component of youth suicide prevention efforts.
!Youth Suicide Risk and Preventive Interventions: A Review of the Past 10 Years
J. Am. Acad. Child Adolesc. Psychiatry, 2003, 42(4):386–405.
To review critically the past 10 years of research on youth suicide. 
Research literature on youth suicide
was reviewed following a systematic search of PsycINFO and Medline. The search for school-based suicide prevention programs
was expanded using two education databases: ERIC and Education Full Text. Finally, manual reviews of articles’ reference
lists identified additional studies.The review focuses on epidemiology, risk factors, prevention strategies, and treatment
There has been a dramatic decrease in the youth suicide rate during the past decade. Although a number
of factors have been posited for the decline, one of the more plausible ones appears to be the increase in antidepressants
being prescribed for adolescents during this period.Youth psychiatric disorder, a family history of suicide and
psychopathology, stressful life events, and access to firearms are key risk factors for youth suicide. Exciting new findings have
emerged on the biology of suicide in adults, but, while encouraging, these are yet to be replicated in youths. Promising prevention
strategies, including school-based skills training for students, screening for at-risk youths, education of primary care
physicians, media education, and lethal-means restriction, need continuing evaluation studies. Dialectical behavior therapy,
cognitive-behavioral therapy, and treatment with antidepressants have been identified as promising treatments but
have not yet been tested in a randomized clinical trial of youth suicide. 
While tremendous strides have been made in our understanding of who is at risk for suicide, it is incumbent upon future research efforts to focus on the development and evaluation of empirically based suicide prevention and treatment protocols. 
Risk Factors for and Functions of Deliberate Self-Harm: An Empirical and Conceptual Review
Kim L. Gratz
Clin Psychol Sci Prac 10: 192–205, 2003

!Definitional probs:
[[Favazza, 1998]] refers to the behavior as episodic or repetitive superficial-moderate ''self-mutilation''.

!Distinguishing Self harm from Suicidal behaviours - 

!...Or not distinguishing
[[Linehan, 1993]] refers to both as "parasuicide"

>//''"The present article defines deliberate self-harm as the
deliberate, direct destruction or alteration of body tissue,
without conscious suicidal intent but resulting in injury
severe enough for tissue damage (e.g., scarring) to occur."''//

NB this paper does not focus on CHILD & ADOLESCENT SIB...

!!!Childhood sexual abuse
>//"Boudewyn and Liem (1995) examined the relationship between
self-harm behavior and childhood sexual abuse
among a sample of 438 college students from urban universities.
They found that of the 46 students in their sample
reporting a history of deliberate self-harm, 52% (n = 24) of
these students had been sexually abused as children. Also,
of the 34 individuals reporting a history of repeated selfharm,
59% (n = 20) had been sexually abused. Finally,
when several potentially distressing childhood experiences
(including separation, loss, and physical, emotional, and
sexual abuse) were entered into a regression equation predicting
acts of deliberate self-harm, only childhood sexual
abuse emerged as a significant predictor of self-harm, thus
providing some evidence of its unique relationship to selfharm."//
!!!Childhood Physical Abuse
>//"Results of studies examining the relationship between
childhood physical abuse and self-harm are inconclusive,
providing mixed evidence for this relationship among both
clinical and nonclinical populations."//
!!!Childhood Neglect
>//"The role of neglect as a risk factor for self-harm has been
studied less systematically than childhood abuse, and the results
of the few studies that have examined this relationship
are inconsistent."//
!!!Biological risk factors
>//"Linehan suggests that an individual
biological vulnerability contributes to the emotion dysregulation
underlying self-harm. The specific biological
vulnerability to which she refers is emotional vulnerability
in the form of emotional reactivity (i.e., high sensitivity
to emotional stimuli) and emotional intensity (i.e., the
tendency to have extreme reactions)."//
''NB - this biological effect my relate to early life experinces, though'' - DB.

>//"Linehan suggests that the way ''emotional vulnerability''
and ''invalidating environments'' interact to influence
the development of self-harm is through their
''impact on emotion dysregulation''. For instance, invalidating
environments during childhood may contribute to the
development of emotion dysregulation by failing to teach
effective regulatory strategies for managing emotional
arousal and tolerating emotional distress (Linehan, 1993).
Moreover, childhood trauma in the form of physical abuse,
sexual abuse, or both may contribute to chronic hyperarousal
and, consequently, increased risk for emotion dysregulation
(given that high levels of arousal are more
difficult to regulate; see Eisenberg, Cumberland, & Spinrad,
1998; Flett, Blankstein, & Obertynski, 1996)"//

To examine the effectiveness and costeffectiveness
of group therapy for self harm in young
Two arm, single (assessor) blinded parallel
randomised allocation trial of a group therapy
intervention in addition to routine care, compared with
routine care alone. Randomisation was by minimisation
controlling for baseline frequency of self harm, presence
of conduct disorder, depressive disorder, and severity of
psychosocial stress.
Adolescents aged 12-17 years with at least
two past episodes of self harm within the previous
12 months. 
!!Exclusion criteria were: 
not speaking English,
low weight anorexia nervosa, acute psychosis,
substantial learning difficulties (defined by need for
specialist school), current containment in secure care.
Eight child and adolescent mental health services
in the northwest UK.
Manual based developmental group
therapy programme specifically designed for adolescents
who harm themselves, with an acute phase over six
weekly sessions followed by a booster phase of weekly
groups as long as needed. Details of routine care were
gathered from participating centres.
!Main outcome measures 
Primary outcome was frequency
of subsequent repeated episodes of self harm. 

Secondary outcomes were severity of subsequent self harm, mood
disorder, suicidal ideation, and global functioning. Total
costs of health, social care, education, and criminal
justice sector services, plus family related costs and
productivity losses, were recorded.
183 adolescents were allocated to each arm (total
n=366). Loss to follow-up was low (<4%). On all outcomes
the trial cohort as a whole showed significant
improvement from baseline to follow-up. On the primary
outcome of frequency of self harm, proportional odds
ratio of group therapy versus routine care adjusting for
relevant baseline variables was 0.99 (95% confidence
interval 0.68 to 1.44, P=0.95) at 6 months and 0.88 (0.59
to 1.33, P=0.52) at 1 year. For severity of subsequent self
harm the equivalent odds ratios were 0.81 (0.54 to1.20,
P=0.29) at 6 months and 0.94 (0.63 to 1.40, P=0.75) at
1 year. Total 1 year costs were higher in the group therapy
arm (£21 781) than for routine care (£15 372) but the
difference was not significant (95% CI −1416 to 10782,
The addition of this targeted group therapy
programme did not improve self harm outcomes for
adolescents who repeatedly self harmed, nor was there
evidence of cost effectiveness. The outcomes to end point
for the cohort as a whole were better than current clinical
|''Description''|Mimics allTags macro to provide ways of creating lists grouping tiddlers by any field|
|''Author''|Jon Robson|
{{{<<groupBy tags>>}}}
mimics allTags macro

{{{<<groupBy server.bag>>}}}
groups by the server.bag field (this version contains TiddlySpace specific code for turning a bag into a space name)

{{{groupBy modified dateFormat:"YYYY"}}}
group tiddlers by year.

{{{<<groupBy tags exclude:excludeLists exclude:systemConfig>>}}}
group tiddlers by tag but exclude the tags with values excludeLists and systemConfig

Within that group you can also exclude things by filter
{{{groupBy modifier filter:[tag[film]]}}}
will group tiddlers tagged with film by modifier.
(function($) {
var taglocale = config.views.wikified.tag;
var macro = config.macros.groupBy = {
	locale: {
		tooltip: "all tiddlers in group %0",
		noTiddlers: "no tiddlers",
		openAllText: taglocale.openAllText,
		openAllTooltip: taglocale.openAllTooltip,
		openTiddler: "open tiddler with title %0"
	morpher: {
		// TODO: note currently the following 2 morphers are TiddlySpace specific and probably should be in separate plugin
		"server.workspace": function(value, options) {
			return macro.morpher["server.bag"](value.replace("bags/", "").replace("recipes/", ""));
		"server.bag": function(value, options) {
			if(typeof(value) !== "string") {
				return false;
			} else if(value.indexOf("_public") === -1 && value.indexOf("_private") === -1) {
				value = "*%0".format(value); // add star for non-space bags.
			return value.replace("_public", "").replace("_private", "");
		created: function(value, options) {
			return value.formatString(options.dateFormat || "DD MMM YYYY");
		modified: function(value, options) {
			return macro.morpher.created(value, options);

	handler: function(place, macroName, params, wikifier, paramString) {
		var field = params[0] || "server.workspace";
		var dateFormat = params[1] || "DD MMM YYYY";
		var container = $("<div />").attr("macroName", macroName).addClass("groupBy").
			attr("refresh", "macro").attr("fieldName", field).
			attr("paramString", paramString).
			attr("dateFormat", dateFormat).appendTo(place)[0];
	isTypeArray: function(value) {
		var valueType = typeof value;
		if(valueType === "object" && typeof value.length === "number" &&
			!(value.propertyIsEnumerable("length")) &&
			typeof value.splice === "function") { //is Array
			return true;
		} else {
			return false;
	_onClickGroup: function(ev, options) {
		var i, target =, locale = macro.locale;
		var tiddlers = $(target).closest(".templateContainer").data("tiddlers");
		var popup = $(Popup.create(target)).addClass("taggedTiddlerList")[0];
		var value = $(target).attr("value");
		var openAll = createTiddlyButton($("<li />").appendTo(popup)[0],
			locale.openAllText.format(value), locale.openAllTooltip);
		$(openAll).click(function(ev) {
			story.displayTiddlers(, tiddlers);
			return false;
		var listBreak = $("<li />").addClass("listBreak").html("<div />").appendTo(popup);
		for(i = 0; i < tiddlers.length; i++) {
			var item = $("<li />").appendTo(popup)[0];
			var template = store.getTiddlerText(options.template) || macro.template;
			wikify(template, item, null, tiddlers[i]);
		$(createTiddlyLink($("<li />").appendTo(popup)[0], value, false)).
		return false;
	_refresh: function(container, tiddlers, options) {
		var totalGroups = 0, locale = macro.locale, i, j;
		var excludeValues = options.exclude;
		var values = {}, value_ids = [];
		var field = options.field;
		var morpher = macro.morpher[field] || function(value) {
			return value;
		for(i = 0; i < tiddlers.length; i++) {
			var tiddler = tiddlers[i];
			var value = tiddler[field] || tiddler.fields[field];
			value = macro.isTypeArray(value) ? value : [ value ];
			for(j = 0; j < value.length; j++) {
				var v = morpher(value[j], options);
				if(v && $.inArray(v, excludeValues) === -1) {
					totalGroups += 1;
					if(!values[v]) {
						values[v] = [];
		var ul = $("<ul />").appendTo(container)[0];
		if(totalGroups === 0) {
			$("<li />").addClass("listTitle").text(locale.noTiddlers);
		value_ids = value_ids.sort();
		var groupTemplate = store.getTiddlerText(options.groupTemplate);
		var onClick = function(ev) {
			macro._onClickGroup(ev, options);
		for(i = 0; i < value_ids.length; i++) {
			var title = value_ids[i];
			var info = getTiddlyLinkInfo(title);
			tiddlers = values[title];
			var btn = createTiddlyButton($("<li />").appendTo(ul)[0],
				"%0 (%1)".format(title, tiddlers.length), locale.tooltip.format(title), null, info.classes);
			if(groupTemplate) {
				wikify(groupTemplate, btn, null, tiddlers[0]);
			$(btn).click(onClick).attr("value", title).attr("refresh", "link").attr("tiddlyLink", title);
			$(btn).addClass("templateContainer").data("tiddlers", tiddlers);
	refresh: function(container) {
		container = $(container).empty();
		var paramString = container.attr("paramString");
		var args = paramString.parseParams("name", null, true, false, true)[0];
		var options = { field: container.attr("fieldName"), dateFormat: container.attr("dateFormat"), exclude: args.exclude || [],
			template: args.template ? args.template[0] : false, groupTemplate: args.groupTemplate ? args.groupTemplate[0] : "" };
		var tiddlers = args.filter ? store.filterTiddlers(args.filter[0]) : store.getTiddlers("title");
		macro._refresh(container, tiddlers, options);
	template: "<<view title link>>"

Feasibility of Screening Adolescents for Suicide Risk in “Real-World” High School Settings
Denise Hallfors, PhD, Paul H. Brodish, MSPH, Shereen Khatapoush, PhD, Victoria Sanchez, DrPH, Hyunsan Cho, PhD, and Allan Steckler, PhD

Am J Public Health. 2006;96:282–287.

We evaluated the feasibility of a population-based approach to preventing adolescent suicide.
A total of 1323 students in 10 high schools completed the Suicide Risk
Screen. Screening results, student follow-up, staff feedback, and school responses
were assessed.
Overall, ''@@29% of the participants were rated as at risk of suicide. As a
result of this overwhelming percentage, school staffs chose to discontinue the
screening after 2 semesters.@@'' In further analyses, about half of the students identified
were deemed at high risk on the basis of high levels of depression, suicidal
ideation, or suicidal behavior. Priority rankings evidenced good construct validity
on correlates such as drug use, hopelessness, and perceived family support.
A simpler, more specific screening instrument than the Suicide
Risk Screen would identify approximately 11% of urban high school youths for
assessment, offering high school officials an important opportunity to identify
young people at the greatest levels of need and to target scarce health resources.
Our experiences from this study show that lack of feasibility testing greatly contributes
to the gap between science and practice. 
!Deliberate self-poisoning in adolescence: why does a brief family intervention work in some cases and not others?
Journal of Adolescence 2000, 23, 13±20

In a randomized trial of a brief family intervention with adolescents who had
deliberately poisoned themselves, we have previously reported that, within the group
of patients who did not have major depression, the family intervention was
significantly superior to routine care in reducing suicidal thinking. The present paper
examined whether efficacy was related to changes in family functioning or other
possible mediating variables. Potential mediators included family functioning, hopelessness,
depression, adolescent problem-solving and compliance with treatment. The
efficacy of the family intervention in reducing suicidal ideation within the nondepressed
sub-group was probably not mediated by changes in these variables. The
implications of this finding are discussed.
HARRINGTON, R., KERFOOT, M., DYER, E., et al. 1998. 
!Randomized trial of a home-based family intervention for children who have deliberately poisoned themselves. 
J. Am. Acad. Child Adolesc. Psychiatry 37 (5): 512–518.
*See also [[Kerfoot et al, 95]]
*See also [[Chitsabesan, Harrington et al, 03]] for follow up paper on predictors of repeat SIB
*See also [[Harrington, 00]] on mediating variables for reduction in suicidal thinking in the non-depressed youth:
>//"Potential mediators included family functioning, hopelessness,
depression, adolescent problem-solving and compliance with treatment. The
efficacy of the family intervention in reducing suicidal ideation within the nondepressed
sub-group was probably not mediated by changes in these variables. The
implications of this finding are discussed."//
To establish whether an intervention given by child psychiatric social workers to the families of children and adolescents who had attempted suicide by taking an overdose reduced the patients' suicidal feelings and improved family functioning.
One hundred sixty-two patients, aged 16 or younger, who had deliberately poisoned themselves were randomly allocated to routine care (n = 77) or routine care plus the intervention (n = 85). The intervention consisted of an assessment session and four home visits by the social workers to conduct family problem-solving sessions. The control group received no visits. Both groups were assessed at the time of recruitment and 2 and 6 months later. The primary outcome measures were the Suicidal Ideation Questionnaire, the Hopelessness Scale, and the Family Assessment Device.
There were no significant differences in the primary outcomes between the intervention and control groups at either of the outcome assessments. Parents in the intervention group were more satisfied with treatment (mean difference 1.4 [95% confidence interval 0.6 to 2.1]). A subgroup without major depression had much less suicidal ideation at both outcome assessments (analysis of covariance p < .01) compared with controls.
The home-based family intervention resulted in reduced suicidal ideation only for patients without major depression. J. Am. Acad. Child Adolesc. Psychiatry, 1998, 37(5):512-518.

!other reviewers:
From [[Brent, 01]]:
Harrington et al.80 compared a brief, home-based family intervention to
routine care for adolescents who took an overdose. There were no overall differences
between the two treatments with regard to hopelessness, suicidal
ideation, rate of subsequent suicide attempts, or changes in the family environment.
Post-hoc analyses indicated a significant reduction in suicidal ideation
in the nondepressed group only.

From [[Miller, 00]]:
Harrington and
colleagues (1998) investigated the efficacy of a short-term, action-oriented, home-based
family intervention for suicidal adolescents conducted by master’s-level social workers.
In this study, 162 adolescents who had deliberately poisoned themselves
were assigned randomly to routine care or routine care plus the home-based intervention.
A five-session-home-based program was chosen because previous work has shown
that suicidal adolescents have poor compliance with outpatient treatment and often
fail to complete lengthy treatment protocols (Trautman, Stewart, & Morishima, 1993).
The authors used a family-oriented treatment approach based on previous research
showing significant associations between deliberate overdosing in adolescents and family
dysfunction (Kerfoot, 1988; Kerfoot, Dyer, Harrington, Woodham, & Harrington,
Results of this study indicated that among suicide attempters who did not have major
depression, the family treatment was more effective than routine care alone in reducing
suicidal ideation. This treatment effect was maintained even at six-month follow-up.
However, for subjects with a major depressive disorder, there were no between-group
differences in suicidal ideation, reattempts, or family functioning. This finding is consistent
with Brent and colleagues’ (1997) research, which showed that family therapy was
not significantly better than cognitive-behavior therapy or nondirective supportive therapy
in reducing depressive symptomatology in adolescents with major depression.
It is important to note that the subjects with major depression in the Harrington et al.
(1998) study had higher initial and follow-up levels of suicidal ideation than their nondepressed
counterparts. Thus, it can be concluded that the efficacy of the family intervention
was demonstrated only in a subgroup that was at lower risk for suicide. The
authors suggested several possible reasons for this finding, including the possibility that
more family sessions are needed to resolve family problems.

From [[Truth Hurts, 06]]
Harrington et al (1998) carried out a randomly controlled case study on adolescents under 17 who had selfpoisoned
and been admitted to four hospitals in Manchester. Unfortunately, no significant differences were
found in those who were allocated a intensive intervention rather than standard aftercare. The authors conclude
that brief forms of intervention are only likely to be effective in subjects without major depression. More intensive
forms of family intervention may be more effective, but this has yet to be rigorously assessed (Harrington et al,
The British Journal of Psychiatry (2001) 178: 48-54


Previous UK studies have reported much lower rates of psychiatric and personality disorder in those who attempt suicide than in those who die by suicide.
To determine the nature and prevalence of psychiatric and personality disorders in deliberate self-harm (DSH) patients.
A representative sample of 150 DSH patients who presented to a general hospital were assessed using a structured clinical interview and a standardised instrument. Follow-up interviews were completed for 118 patients approximately 12-16 months later.
ICD-10 psychiatric disorders were diagnosed in 138 patients (92.0%), with comorbidity of psychiatric disorders in 46.7%. The most common diagnosis was affective disorder (72.0%). Personality disorder was identified in 45.9% of patients interviewed at follow-up. Comorbidity of psychiatric and personality disorder was present in 44.1%.
Psychiatric and personality disorders, and their comorbidity, are common in DSH patients. This has important implications for assessment and management.
!Factors associated with suicide after parasuicide in young people.
K Hawton, J Fagg, S Platt, and M Hawkins
BMJ. 1993 June 19; 306(6893): 1641–1644.
To determine factors associated with completed suicide in young parasuicide patients. 
Case-control study.
Regional poisoning treatment centre in a teaching general hospital. 
Patients who, between 1968 and 1985 when aged 15-24 years, were admitted to the regional poisoning treatment centre because of deliberate self poisoning or self injury. Cases (n = 62) consisted of those who by the end of 1985 had died locally from either suicide (n = 41) or possible suicide (n = 21). Controls (n = 124) were patients who were known not to have died locally during the study period. Two controls were selected for each case, matched by sex, age (within two years), and length of follow up.
Possible predictors of completed suicide. 
Univariate analysis (conditional logistic regression) showed that risk of death due to suicide and possible suicide was associated with six factors: 
#social class V (odds ratio 2.7, 95% confidence interval 1.1 to 6.7), 
#unemployment (2.8, 1.4 to 5.8), 
#previous inpatient psychiatric treatment (4.9, 2.2 to 10.9), 
#substance misuse (3.3, 1.6 to 6.8), personality disorder (2.1, 1.03 to 4.4), and 
#previous attempted suicide (2.3, 1.2 to 4.4). 

!!Multivariate analysis identified two factors significantly contributing to the model that best discriminated between the cases and controls: 
#substance misuse (alcohol or drugs, or both) (adjusted odds ratio 3.9) and 
#previous inpatient psychiatric treatment (3.7). 

These factors seemed to be associated with suicide after attempted suicide in both the short term (less than 12 months) and the long term (one year or more) and were also identified when the analysis was restricted to subjects who definitely died by suicide and their controls.
Suicide after parasuicide in young people is associated with substance misuse.

This suggests that prevention of suicide in young people who attempt suicide might be improved by close liaison between general hospital services for patients who have attempted suicide and services for young substance misusers and by measures aimed at preventing substance misuse in young people.
Keith Hawton, Karen Rodham, Emma Evans and Rosamund Weatherall
!Deliberate self harm in adolescents: self report survey in schools in England
BMJ 2002;325;1207-1211

Strong study large sample size - written up in "DSH in adolescence" and "By their own young hand" both by Hawton et al.

To determine the prevalence of deliberate
self harm in adolescents and the factors associated
with it.
Cross sectional survey using anonymous self
report questionnaire.
41 schools in England.
Participants 6020 pupils aged 15 and 16 years.
!!Main outcome measure 
Deliberate self harm.
398 (6.9%) participants reported an act of
deliberate self harm in the previous year that met
study criteria. Only 12.6% of episodes had resulted in
presentation to hospital. Deliberate self harm was
more common in females than it was in males (11.2%
v 3.2%; odds ratio 3.9, 95% confidence interval 3.1 to
4.9). In females the factors included in a multivariate
logistic regression for deliberate self harm were recent
self harm by friends, self harm by family members,
drug misuse, depression, anxiety, impulsivity, and low
self esteem. In males the factors were suicidal
behaviour in friends and family members, drug use,
and low self esteem.
Deliberate self harm is common in
adolescents, especially females. School based mental
health initiatives are needed. These could include
approaches aimed at educating school pupils about
mental health problems and screening for those at
Hawton, K., Arensman, E., Townsend, E., Bremner, S., Feldman, E., Goldney, R., Gunnell, D.,
Hazell, P., van Heeringen, K., House, A., Owens, D., Sakinofsky, I., & Traskman-Bendz, L.
(1998). Deliberate self harm: Systematic review of efficacy of psychosocial and pharmacological
treatments in preventing repetition. British Medical Journal, 317, 441– 447.


From [[Miller, 00]]:
Reviews 20 studies according to criteria... 
//"Of the 20 studies that met these inclusion criteria, only one of them used adolescent subjects. In that study, adolescents in the experimental group received standard outpatient care (i.e., from a local clinic
or child psychiatry department) and were given a green card that acted as a passport to
readmission into an inpatient unit at a local hospital if they actively felt suicidal [[Cotgrove et al 1995]]. The control group received only standard care.

''Results indicated no significant differences between groups on measures of repeated
self-injurious behavior.''//

''__The other 19 studies in Hawton and colleague’s (1998) systematic review included adult subjects.__'' 

//''In summary'', these authors found that problem-solving therapy, inpatient
hospitalization, the use of an emergency contact card in addition to standard therapy,
and intensive outreach (e.g., home visits) were not significantly better than control
conditions (i.e., standard care) in decreasing self-harm behavior ''among adult subjects''.//

//There was ''one study'', however, that ''did report significantly lower rates of suicidal behavior''
among subjects receiving ''__Dialectical Behavior Therapy (DBT)__'', as compared to
subjects receiving treatment as usual (TAU; Linehan, Armstrong, Suraez, Allmari, &
Heard, 1991). Dialectical Behavior Therapy, developed by Linehan (1991, 1993a, 1993b) is a
principle-based cognitive-behavioral therapy (CBT) developed for chronically parasuicidal
women with a diagnosis of borderline personality disorder. Dialectical Behavior
Therapy blends standard CBT interventions with Eastern philosophy and meditation practices,
and shares elements with psychodynamic, client-centered, gestalt, paradoxical, and
strategic approaches (Heard & Linehan, 1994). An adolescent version of DBT, DBT-A,
has been developed by Miller and colleagues (Miller, Rathus, Linehan,Wetzler, & Leigh,
1997; Rathus & Miller, 1999) and is described below.//"

!!!Journal of Adolescence 1999, 22, 369-378
!Repetition of deliberate self-harm by adolescents: the role of psychological factors


The aim of this study was to examine the relationship between psychological variables
and repetition of deliberate self-harm by adolescents (n=45) aged 13-18 years who
had been admitted to a general hospital having taken overdoses. Standardized
measures of depression, hopelessness, suicidal intent, impulsivity, trait and state anger,
self-esteem and problem-solving (both self-report and observer-rated) were administered
to the adolescents while still in the general hospital.
Repetition was assessed on the basis of previous overdoses (n=14) and repetition of self-harm (self-poisoning and
self-injury) during the subsequent year (n=9).

Adolescents with a history of a previous overdose and/or who repeated self-harm
during the following year (n=18) ''differed from non-repeaters'' in having:
!!higher scores for:
# depression, 
#hopelessness and 
#trait anger, and 
!!lower scores for:
# self-esteem, 
#self-rated problem-solving and effectiveness of problem-solving rated on the basis of the Means End Problem Solving test, 
all measured at the initial assessment. 
!''These differences largely disappeared when level of depression was controlled for.'' 
Similarly, differences found between repeaters and non-repeaters in the year following the index overdoses
for problem-solving were much reduced when account was taken of differences in
depression scores.
Depression is a key factor associated with risk of repetition of adolescent self-harm (and hence of suicide risk). In the management of adolescents who have harmed themselves, careful assessment of depression and appropriate management of those
who are depressed is essential.
Hazell PL, Martin G, McGill K, Kay T, Wood A, Trainor G, Harrington R. (2009) //Group therapy for repeated deliberate self-harm in adolescents: failure of replication of a randomized trial.// J Am Acad Child Adolesc Psychiatry. 2009 Jun;48(6):662-70.

Comment on:

    * J Am Acad Child Adolesc Psychiatry. 2001 Nov;40(11):1246-53. ([[Wood, 01]]) - CONTRADICTS THIS and the [[NICE guideline 2004]]

To replicate a study, which found group therapy superior to routine care in preventing the recurrence of self-harming behavior in adolescents who had deliberately harmed themselves on at least two occasions. 
Single blind study with parallel randomized groups undertaken in three sites in Australia. The primary outcome measure was repetition of self-harm, assessed on average after 6 and 12 months. Secondary outcome measures included suicidal ideation, psychiatric disorder, and service use. 
Seventy-two adolescents aged 12 to 16 years (91% female subjects) were randomized to group therapy or routine care. Primary outcome data were available for 68 of the 72 randomized participants. More adolescents randomized to group therapy than those randomized to routine care had self-harmed by 6 months (30/34 versus 23/34, chi = 4.19, p =.04), and there was a statistically nonsignificant trend for this pattern to be repeated in the interval of 6 to 12 months (30/34 versus 24/34, chi = 3.24, p =.07). There were few differences between the treatment groups on secondary outcome measures, other than a trend for greater improvement over time on global symptom ratings among the experimental group compared with the control group. 
Our findings contradict those of the original study. Some differences in participant characteristics between the studies, along with less experience at the Australian sites in delivering the intervention, may have accounted for the different outcome. The benefit of group therapy for deliberate self-harm is unproven outside the environment in which it was originally developed.
Heilbron, N, Prinstein, MJ, (2008) Peer influence and adolescent nonsuicidal self-injury: A theoretical review of mechanisms and moderators. Applied and Preventive Psychology 12; 169–177.

Nonsuicidal self-injury (NSSI) is an increasingly prevalent health risk behavioramongadolescents and represents
a significant public health concern. Although researchers have identified numerous antecedents
or risk factors that precede engagement in NSSI behaviors, few studies have examined the role of peer
influence processes. Yet, recent research suggests that adolescents may be more likely to engage in NSSI
when close friends or other peers engage in similar behaviors. The following paper reviews past research
on peer influence effects, including potential mechanisms and moderating variables. Methodological
considerations for future research on peer influence and NSSI are discussed.
HENGGELER, SCOTT W. PH.D.; ROWLAND, MELISA D. M.D.; HALLIDAY-BOYKINS, COLLEEN PH.D.; SHEIDOW, ASHLI J. PH.D.; WARD, DAVID M. PH.D.; RANDALL, JEFF PH.D.; PICKREL, SUSAN G. M.D., MPH.; CUNNINGHAM, PHILLIPPE B. PH.D.; EDWARDS, AND JAMES M.D. (2003) //One-Year Follow-up of Multisystemic Therapy as an Alternative to the Hospitalization of Youths in Psychiatric Crisis.// J. Am. Acad. Child Adolesc. Psychiatry, 2003, 42(5):543-551.
This study presents findings from a 1-year follow-up to a randomized clinical trial comparing multisystemic therapy (MST), modified for use with youths presenting psychiatric emergencies, with inpatient psychiatric hospitalization.  The original paper is [[Henggeler et al, 99]]
!!Modifications to standard MST:
#the integration of additional clinical staff (i.e., child and adolescent psychiatrist, crisis caseworker) to facilitate the development and implementation of safety plans aimed at stabilizing the psychiatric emergency outside the hospital if at all possible; 
#the integration of evidence-based pharmacological interventions (e.g., primarily for attention-deficit/hyperactivity disorder) with the other evidence-based interventions that comprise MST treatment protocols; and 
#the planned and judicious use of out-of-home placements such as hospitalization and foster care to promote safety or facilitate the attainment of treatment goals.
One hundred fifty-six children and adolescents approved for emergency psychiatric hospitalization were randomly assigned to home-based MST or inpatient hospitalization followed by usual services. Assessments examining mental health symptoms, out-of-home placement, school attendance, and family relations were conducted at five times: within 24 hours of recruitment, shortly after the hospitalized youth was released from the hospital (1-2 weeks after recruitment), at the completion of MST (average of 4 months postrecruitment), and 10 and 16 months postrecruitment.
Based on placement and youth-report measures, MST was initially more effective than emergency hospitalization and usual services at decreasing youths' symptoms and out-of-home placements and increasing school attendance and family structure, but these differences generally dissipated by 12 to 16 months postrecruitment. Hospitalization produced a rapid, but short-lived, decrease in externalizing symptoms based on caregiver reports.
Findings suggest that youths with serious emotional disturbance might benefit from continuous access to a continuum of evidence-based practices titrated to clinical need.
!DB notes:
NB no specific measure of self-harming behaviours/thoughts in outcomes measures

Henggeler, S. W., Rowland, M. R., Randall, J., Ward, D., Pickrel, S. G., Cunningham, P. B., Miller, S. L., Edwards, J. E., Zealberg, J., Hand, L., & Santos, A. B. (1999). Home-based multisystemic therapy as an alternative to the hospitalization of youth in psychiatric crisis: Clinical outcomes. Journal of the American Academy of Child & Adolescent Psychiatry, 38, 1331-1339

!DB notes:
Does not formally measure self-injury as an outcome.

Externalising symps improved more with MST than with hospitalization (parent report CBCL (p<0.011), and teacher report CBCL (p<.048)), but //self esteem was improved more in the hospitalization group at Time(3)// (p<0.006)...

NB [[Henggeler et al, 03]] follows up this study one year on... after more youth had been recruiuted to it
>//"''Results'': Based on placement and youth-report measures, MST was initially more effective than emergency hospitalization and usual services at decreasing youths' symptoms and out-of-home placements and increasing school attendance and family structure, but these differences generally dissipated by 12 to 16 months postrecruitment. Hospitalization produced a rapid, but short-lived, decrease in externalizing symptoms based on caregiver reports. ''Conclusion'': Findings suggest that youths with serious emotional disturbance might benefit from continuous access to a continuum of evidence-based practices titrated to clinical need.//

!Reviewed in DATA TRENDS (2000):
Henggeler, S. W., Rowland, M.D., Randall, J. et al. 1999. Home-based multisystemic therapy as an
alternative to the hospitalization of youths in psychiatric crisis: Clinical outcomes. Journal of the American
Academy of Child and Adolescent Psychiatry, 38(11), 1331-1339.

Schoenwald, S. K., Ward, D. M., Henggeler, S. W., & Rowland, M. D. 2000. Multisystemic therapy
versus hospitalization for crisis stabilization of youth: Placement outcomes 4 months postreferral. Mental Health
Services Research, 2(1), 3-12.

Two recent articles by Scott Henggeler and his colleagues present the results of a study in which multisystemic
therapy was compared to hospitalization for youth in psychiatric crisis. These are important articles both
because of the significance of the topic and the encouraging results that have been obtained so far by Henggeler
using multisystemic therapy (MST).

Most of the research done prior to this study by Henggeler focused on children with delinquency and/or
substance abuse problems. This study therefore represents a major change in the population of concern.
Participants were 116 children aged 10 through 17 in Charleston County, South Carolina who were Medicaidfunded
or without health insurance, and who were judged to be in need of psychiatric hospitalization because of
the presence of systems of suicidal ideation, homicidal ideation, psychosis, or threat of harm to self or others due
to mental illness. Families with children who met eligibility criteria for participation and who agreed to
participate (116 families out of 134 agreed to participate) were randomly assigned either to psychiatric
hospitalization or to multisystemic therapy.

It is important to note that MST underwent considerable modification for purposes of serving this population
of concern. For example, at the time of intake a comprehensive plan to safely resolve the crisis was developed.
The basic MST treatment team was enhanced by a child and adolescent psychiatrist, psychiatric residents, and
crisis caseworkers, and supervision was initially increased from weekly to daily. Also, caseloads of therapists were
reduced from five families per clinician to three families, thereby enhancing the intensity of the intervention.
Also, a therapeutic foster care capability was added to MST.

It is also noteworthy that participants in the MST condition were hospitalized when the MST team felt it was
needed. In fact, 44% of the youths in the MST condition were hospitalized at some point. During the
hospitalization, the MST treatment rather than the hospital staff maintained clinical responsibility for the
youth, and extensive efforts were made to insulate the MST youth from other activities on the inpatient unit.
The first of the two articles (Henggeler at al., 1999) presents the clinical outcomes. The results are favorable for
the MST condition although in a relatively modest way. For example, of nine measures of youth functioning,
two were significant in favor of MST, one was significant in favor of hospitalization, and for six there were no
significant differences. The two significant differences in favor of MST were the externalizing scale of the CBCL
as completed by the teacher, and the externalizing scale of the CBCL as completed by the caregiver. The one
difference in favor of hospitalization was on self-esteem. Of five outcome measures on family functioning, there
were two that were statistically significant in favor of MST (adaptability as reported by youth on the FACESIII,
and cohesion as reported by caregivers on FACES-III), and three for which there were no significant
differences. Out of five measures of youth social functioning, the only significant difference between conditions
was on days out of school, which was in favor of MST. Both measures of consumer satisfaction (one from the
youth and one from a caregiver) showed greater satisfaction by recipients of MST.

Overall, therefore, out of 19 measures of youth, family, or youth social functioning, there were five differences
between conditions in favor of MST, one in favor of hospitalization, and 13 for which there was so significant
difference between groups. On both measures of consumer satisfaction, the MST group was rated more
positively than the hospitalization group. No data on effect sizes are given, although only three of the seven
measures that favored MST were at the .01 level or greater.

The second article (Schoenwald, Ward, Henggeler, & Rowland, 2000) presents the findings on placement and
cost. On overall number of days hospitalized, there is a clear and large difference in favor of MST, which
reduced the number of hospital days used by 72% in comparison to the hospitalization group. Most of this
difference was immediately after entry into the study.

The authors indicate that a “preliminary” accounting of the costs of MST with this population of concern
indicated a cost of $5,954 per youth for a four month period. The estimated daily cost of MST was $47, which
the authors report to be 52% higher than those incurred when MST is used with serious juvenile offender
populations. This is important information for the children’s mental health field. The average cost in the
hospitalization condition was $6,174, just about the same as for the MST condition.
Overall, it is first of all very encouraging that Henggeler et al. modified and adjusted their MST model to better
meet the needs of a population of children with severe psychiatric needs. The authors indicate, in fact, that “even
with the extensive track record of MST in successfully treating adolescents with serious clinical difficulties, the
complexity and severity of the problems presented by the youths in psychiatric crisis and their families was
significantly greater than expected” (Henggeler et al., 1999, p. 1337). Second, it is also encouraging that on
measures of clinical outcome the differences were primarily in favor of MST, and both on measures of consumer
satisfaction and use of hospital days the differences were clearly in favor of MST. Third, however, it should be
noted that the differences in clinical outcomes appear to be relatively modest (it would be easier to judge the
importance of the differences in clinical outcomes if effect sizes had been presented by the authors), and that the
costs for the two interventions were virtually the same. Therefore while the results are largely positive, indicating
the potential value of this expanded MST model for youth in psychiatric crisis, there is still a need for further
study and perhaps program development to enhance the effect sizes.

Also, at this point the results that are presented are only for the first four months after entry into the study. The
authors indicate that they are gathering more long-term data, and that these data will be forthcoming soon.
Finally, it is noteworthy that perhaps no other group of program developers/researchers devote as much time
and care to trying to develop and evaluate interventions for children with special challenges and their families as
Henggeler and his colleagues. The children’s mental health field clearly needs to identify mechanisms to
encourage and support many others in doing the type of systematic program development and evaluation work
that has been the trademark of Henggeler et al. Without such encouragement and support, progress at the
clinical level is likely to be very slow.
HENGGELER, S.W. & C.M. BORDUIN. 1990. Treatment of delinquent behavior.
In Family Therapy and Beyond: A Multisystemic Approach to Treating the
Behavior Problems of Children and Adolescents. S.W. Henggeler & C.M.
Borduin, eds. :219-245. Brooks/Cole Publishing Co. Pacific Grove, CA.

Quote from [[Brent, 01]]:
//"Dysfunctional family processes, particularly parent-child discord, are
among the most common precipitants for suicidal behavior 6,12,28,52–54 and
may also be related to increased risk of dropout.65 Often, it is possible to get
a “truce” while one helps the adolescent patient not to be so reactive to every
“potential argument.” In addition, sessions with the family that aim at teaching
conflict resolution and communication skills may attenuate the level of
conflict. Models for family treatment of suicide-attempting adolescents have
been elaborated and show promise.25,102"// 102 = Henggeler paper
In line with the standard procedure for conducting such reviews, a hierarchy of evidence has been developed to distinguish studies according to their susceptibility to bias (Sheldon, Song, & ~Davey-Smith, 1993). Evidently, randomised controlled trials with manualised treatments and homogenous samples are more reliable than trials where randomisation was not possible and the treatment cannot be described. The hierarchy of evidence is in line with generally accepted criteria described in the Cochrane Reviewers' Handbook (Clarke & Oxman, 1999), and other publications (e.g. Rosenthal, 1995; Woolf et al., 1990). The broad categories are as follows: 

''(i)''	- - - [[(i) randomised controlled trials]], 
''(ib)''- - - [[(ib) systematic reviews and meta-analyses]], 
''(ii)''- - - [[(ii) other trials]]: a controlled trial without randomisation, a quasi experiments, or a failed randomisation]] 
''(iib)''- - - [[(iib) experimental single case designs]]
''(iii)''- - - [[(iii) cohort studies]], preferably from more than one centre (a cohort allocates by exposure to treatments and looks for differences in outcomes); 
''(iv)''- - - [[(iv) case-control (retrospective) studies]], preferably from several centres (allocates by outcome and looks for differences of exposure – in terms of treatment); 
''(v)''- - - [[(v) large differences reported in comparisons]] between times and/or places, with or without interventions; 
''(vi)''- - - [[(vi) opinions of respected authorities]] based on clinical experience, descriptive studies, uncontrolled studies and reports of expert committees. 

As this review will highlight, for the treatment of some conditions there is an absence of good quality outcome research, and so clinical opinion is the only information available. We rated each citation in the treatment section of each chapter in terms of the broad categories of evidence (i)-(vi).
!Improvement in cognitive and psychosocial functioning and self-image among adolescent inpatient suicide attempters
Ulla Hintikka, Mauri Marttunen, Mirjami Pelkonen, Eila Laukkanen, Heimo Viinamäki and Johannes Lehtonen
BMC Psychiatry 2006, 6:58
Psychiatric treatment of suicidal youths is often difficult and non-compliance in treatment
is a significant problem. This prospective study compared characteristics and changes in cognitive
functioning, self image and psychosocial functioning among 13 to 18 year-old adolescent psychiatric
inpatients with suicide attempts (n = 16) and with no suicidality (n = 39)
The two-group pre-post test prospective study design included assessments by a psychiatrist,
a psychologist and medical staff members as well as self-rated measures. DSM-III-R diagnoses were
assigned using the SCID and thereafter transformed to DSM-IV diagnoses. Staff members assessed
psychosocial functioning using the Global Assessment Scale (GAS). Cognitive performance was assessed
using the Wechsler Adult Intelligence Scale, while the Offer Self-Image Questionnaire (OSIQ) was used to
assess the subjects' self-image. ANCOVA with repeated measures was used to test changes from entry to
discharge among the suicide attempters and non suicidal patients. Logistic regression modeling was used
to assess variables associated with an improvement of 10 points or more in the GAS score.
Among suicide attempter patients, psychosocial functioning, cognitive performance and both the
psychological self and body-image improved during treatment and their treatment compliance and
outcome were as good as that of the non-suicidal patients. Suicidal ideation and hopelessness declined, and
psychosocial functioning improved. Changes in verbal cognitive performance were more pronounced
among the suicide attempters. Having an improved body-image associated with a higher probability of
improvement in psychosocial functioning while higher GAS score at entry was associated with lower
probability of functional improvement in both patient groups.
These findings illustrate that a multimodal treatment program seems to improve
psychosocial functioning and self-image among severely disordered suicidal adolescent inpatients.@@ There
were no changes in familial relationships, possibly indicating a need for more intensive family interventions
when treating suicidal youths.@@ Multimodal inpatient treatment including an individual therapeutic
relationship seems recommendable for severely impaired psychiatric inpatients tailored to the suicidal
adolescent's needs.
There are a lot of interesting people using ~TiddlySpace that you might like to keep track of and interact with. There are a number of ways of doing this.

If you see a number in the speech bubble in one of your tiddlers, it means that someone is writing about the same thing as you. You can find out what they're saying by clicking on it. Likewise, if you see something interesting in someone else's space, you can respond to it and write up your own thoughts on the subject by clicking "Reply to this tiddler".

Additionally, if you find anyone interesting, or you find an interesting looking space and you'd like to know when it's changed, you can "follow" that space. To do this, simply create a tiddler with the title: {{{@space-name}}} and tag it {{{follow}}}. If you want, you can store some notes about that space in the body of the tiddler.

If you then want to know what happening, simply [[include|How do I include/exclude spaces?]]@docs the @tivity space and then visit your activity stream at [[/activity|/activity]], or just visit the @tapas space directly.

!Not sure who to follow?
Here's a few suggestions:
* @fnd
* @cdent
* @pmario
* @bengillies
* @dickon
Reviewed in [[Burns, 05]]:
Youth hospitalized for suicidal or homicidal
ideation or behaviour, or psychosis.
I & C not specified. Age 12–17 years
(mean 12.9), African-Caribbean (65%),
male (65%)
MST - Intensive community outreach to families
and schools regarding youth behaviour,
communication and safety issues
Repeat self-harm significantly reduced over
1 year (raw numbers not stated), but not
youth depression, hopelessness, or suicidal ideation.
!!!Follow up:
12 months
|''Description''|Allows the rendering of svg images in a TiddlyWiki|
|''Notes''|Currently only works in modern browsers (not IE)|
{{{<<image SVG>>}}} will render the text of the tiddler with title SVG as an SVG image (but not in ie where it will fail silently)
width/height: specify width/height parameters
link: make the image link to a given location
tiddlyLink: link to a tiddler

Binary tiddlers in TiddlyWeb when passed through the wikifier will be shown as images.
eg. {{{<<view text wikified>>}}} on a binary tiddler will show the image.
{{{<<view fieldname image>>}}}
will render the value of the tiddler field 'fieldname' as an image. This field can contain a tid
{{{<<image SiteIcon>>}}}
will create an image tag where the tiddler has content type beginning image and not ending +xml
will attempt to create svg object in other scenarios
{{{<<image /photos/x.jpg>>}}}
will create an image tag with src /photos/x.jpg as long as there is not a tiddler called /photos/x.jpg in 
which case it will render that tiddler as an image. Note for the case of svg files it will attempt to render as an svg if possible via the image
tag. It doesn't embed the svg in the dom for security reasons as svg code can contain javascript.
(function($) {

var macro = config.macros.image = {
	shim: "/bags/common/tiddlers/shim",
	ieVersion: config.browser.isIE ? parseInt(config.browser.ieVersion[1], 10) : false,
	svgns: "",
	xlinkns: "", 
	svgAvailable: document.implementation.hasFeature("", "1.1"),
	_fixPrefix: 1,
	_external_cache: {},
	_image_tag_cache: {},
	_image_dimensions: {},
	locale: {
		badImage: "This image cannot be displayed."
	handler: function(place, macroName, params, wikifier, paramString, tiddler){
		var imageSource = params[0];
		// collect named arguments
		var args = macro.getArguments(paramString, params);
		this.renderImage(place, imageSource, args);
	init: function() {
		var startupImages = store.getTaggedTiddlers("systemImage");
		var place = $("<div />").attr("id", "systemImageArea").appendTo("body").hide()[0];
		for(var i = 0; i < startupImages.length; i++) {
			var image = startupImages[i];
			macro.renderImage(place, image.title, { idPrefix: "" });
		var data = new Image();
		data.onload = function() {
			// note ie 8 only supports data uris up to 32k so cannot be relied on
			macro.supportsDataUris = this.width != 1 || this.height != 1 ? false : true;
			macro.supportsDataUris = macro.ieVersion && macro.ieVersion < 9 ? false : macro.supportsDataUris;
		data.onerror = data.onload;
		data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
	refreshImage: function(src) {
		var elements = macro._image_tag_cache[src] ? macro._image_tag_cache[src] : [];
		if(macro._image_dimensions[src]) {
			macro._image_dimensions[src] = false;
		for(var i = 0; i < elements.length; i++) {
			var el = $(elements[i]);
			var newSrc = "%0?nocache=%1".format(src, Math.random());
			el.attr("src", newSrc); // force reload
	isBinaryImageType: function(contentType) {
		return (contentType && contentType.indexOf("image") === 0 &&
			contentType.indexOf("+xml") != contentType.length - 4) ? true : false;
	isImageTiddler: function(tiddler) {
		return macro.isSVGTiddler(tiddler) || macro.isBinaryImageTiddler(tiddler);
	isSVGTiddler: function(tiddler) {
		var type = tiddler ? tiddler.fields['server.content-type'] : false;
		return type == "image/svg+xml";
	isBinaryImageTiddler: function(tiddler) {
		return macro.isBinaryImageType(tiddler.fields['server.content-type']);
	renderImage: function(place, imageSource, options) {
		var imageTiddler = store.getTiddler(imageSource);
		var container;
		var classes = ["image"];
		if( {
			classes = classes.concat(["imageLink", "externalLink"]);
			container = $("<a />").attr("href",[0];
		} else if(options.tiddlyLink) {
			container = createTiddlyLink(place, options.tiddlyLink, false);
		} else {
			container = $("<span />").appendTo(place)[0];
		$(container).addClass(classes.join(" "));

		options = options ? options : {};
		if(imageTiddler && macro.isBinaryImageTiddler(imageTiddler)) { // handle the case where we have an image url
			return macro._renderBinaryImageTiddler(container, imageTiddler, options);
		} else if(imageTiddler){ // handle the case where we have a tiddler
			return macro._renderSVGTiddler(container, imageTiddler, options);
		} else { // we have a string representing a url
			return macro._renderBinaryImageUrl(container, imageSource, options);
	_renderAlternateText: function(container, options) {
		var img;
		var src = options.src || "";
		if(options.width && options.height) {
			img = $("<img />").attr("src", src).addClass("svgImageText").attr("width", options.width).
				attr("height", options.height).appendTo(container);
		var alt = options.alt;
		if(img && alt) {
			img.attr("alt", alt).attr("title", alt);
		} else if(alt) {
		macro._image_tag_cache[src] = img;
	_renderSVGTiddler: function(place, tiddler, options) {
		if(!options) {
			options = {};
		merge(options, { tiddler: tiddler, fix: true});

		if(macro.svgAvailable) {
			this._importSVG(place, options); // display the svg
		} else if(options.altImage) {
			var image = options.altImage;
			delete options.altImage;
			this._renderBinaryImageUrl(place, image, options);
		} else {
			this._renderAlternateText(place, options); // instead of showing the image show the alternate text.
	_renderBinaryImageTiddler: function(place, tiddler, options) {
		var resourceURI;
		var fields = tiddler.fields;
		if(fields["server.type"] == "tiddlyweb") { // construct an accurate url for the resource
			resourceURI = "%0/%1/tiddlers/%2".format(config.defaultCustomFields[""],
				fields["server.workspace"], encodeURI(fields["server.title"]));
		} else { // guess the url for the resource
			resourceURI = tiddler.title;
		var ctype = fields["server.content-type"] || tiddler.type;
		var text = tiddler.text;
		if(macro.supportsDataUris && ctype && text.indexOf("<html") == -1) {
			var uri = "data:%0;base64,%1".format(ctype, text);
			options.src = resourceURI;
			return macro._renderBinaryImageUrl(place, uri, options);
		} else if(options.src) {
			return macro._renderBinaryImageUrl(place, options.src, options);
		} else {
			return macro._renderBinaryImageUrl(place, resourceURI, options);
	_renderImageTag: function(container, src, width, height, options) {
		var img;
		img = $("<img />").appendTo(container);
		if(height) {
			img.attr("height", height);
		if(width) {
			img.attr("width", width);
		if(macro.ieVersion && macro.ieVersion < 7 && macro.shim && options.ie6png) {
			$(img).css({width: userW, height: userH,
					filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='%0', sizingMethod='scale')".format(src)
				}).attr("src", macro.shim);
		} else {
			img.attr("src", src);
		if(!macro._image_tag_cache[options.srcUrl]) {
			macro._image_tag_cache[options.srcUrl] = [];
		img = $(img).addClass(options.imageClass)[0];
		return img;
	_getDimensions: function(realDimensions, reqDimensions, preserve) {
		var w = realDimensions.width;
		var h = realDimensions.height;
		var reqh = reqDimensions.height;
		var reqw = reqDimensions.width;
		var finalw = w, finalh = h;
		var ratiow = reqw / w, ratioh = reqh / h;
		var scaledw = ratioh * w;
		var scaledh = ratiow * h;
		if(!reqw && reqh) {
			finalw = scaledw;
			finalh = reqh;
		} else if(reqw && !reqh) {
			finalw = reqw;
			finalh = scaledh;
		} else if(reqh && reqw) {
			var preserveWidth = w > h ? true : false;
			if(preserve) {
				if(preserveWidth && scaledh < reqh) {
					finalh = scaledh;
					finalw = reqw;
				} else {
					finalh = reqh;
					finalw = scaledw;
			} else {
				finalw = reqw;
				finalh = reqh;
		return { width: parseInt(finalw, 10), height: parseInt(finalh, 10) };
	_renderBinaryImageUrl: function(container, src, options) {
		var srcUrl = options.src ? options.src : src;
		srcUrl = srcUrl.indexOf("/") === -1 ? "/%0".format(srcUrl) : srcUrl; // for IE. 
		var image_dimensions = macro._image_dimensions[srcUrl];
		var image = new Image(); // due to weird scaling issues where you use just a width or just a height
		var createImageTag = function(dimensions, error) {
			if(error) {
				var altImage = options.altImage;
				if(altImage) {
					delete options.altImage;
					macro._renderBinaryImageUrl(container, altImage, options);
				} else {
					options.src = src;
					macro._renderAlternateText(container, options);
			} else {
				var dim = macro._getDimensions(dimensions, { 
					width: options.width, height: options.height }, options.preserveAspectRatio);
				options.srcUrl = srcUrl;
				macro._renderImageTag(container, src, dim.width, dim.height, options);

		if(!image_dimensions) {
			image.onload = function() {
				var dimensions = { width: image.width, height: image.height};
				macro._image_dimensions[srcUrl] = dimensions;
			image.onerror = function() {
				createImageTag(null, true);
			image.src = src;
		} else {
	_generateIdPrefix: function(){
		return "twsvgfix_" + (this._fixPrefix++).toString() + "_";
	_fixSVG: function(childNodes, idPrefix) {
		var urlPattern = /url\(\#([^\)]*)\)*/ig;
		var fixes = [
		{ attr: "id", pattern: /^(.*)$/ig },
		{ attr: "href", namespace: macro.xlinkns, pattern: /^#(.*)$/ig }
		var url_fixes = ["filter", "fill", "mask", "stroke", "style"];
		for(var i = 0; i < url_fixes.length; i++) {
			fixes.push({ attr: url_fixes[i], pattern: urlPattern });
		for(var t = 0; t < childNodes.length; t++) {
			var node = childNodes[t];
			for(var a = 0; a < fixes.length; a++) {
				var fix = fixes[a];
				var attr = fix.attr;
				var ns = fix.namespace || "";
				if(node.hasAttributeNS && node.hasAttributeNS(ns, attr)) {
					var v = node.getAttributeNS(ns, attr);
					fix.pattern.lastIndex = 0;
					var match = fix.pattern.exec(v);
					if(match) {
						// Make sure replacement string doesn't contain any single dollar signs
						var toReplace = match[1];
						if(toReplace.indexOf(idPrefix) !== 0 && toReplace.indexOf("twglobal_") !== 0) {
							var replacement = (idPrefix + toReplace).replace("$", "$$$$"); 
							v = v.replace(match[1], replacement);
						node.setAttributeNS(ns, attr,v);
			var children = node.childNodes;
			if(children.length > 0) {
				this._fixSVG(children, idPrefix);
	_importSVG: function(place, options){
		options = options ? options : {};
		var svgDoc, tiddlerText = options.tiddler.text;
		if (window.DOMParser) {
			svgDoc = new DOMParser().parseFromString(tiddlerText, "application/xml").documentElement;
			var idPrefix = options.idPrefix || this._generateIdPrefix();
			this._fixSVG([svgDoc], idPrefix);
			var el = document.importNode(svgDoc, true);
			var svgHolder = document.createElementNS(macro.svgns,"svg");
			var width = options.width;
			var height = options.height;
			if(width || height) {
				if(width && height) { // set view box of containing svg element based on the svg viewbox and width and height.
					var viewBox = el.getAttribute("viewBox");
					var topLeft = "0 0";
					if(viewBox) {
						topLeft = viewBox.replace(/([0-9]*) +([0-9]*) +([0-9]*) +([0-9]*) */gi,"$1 $2");
					svgHolder.setAttributeNS(macro.svgns, "viewBox", "0 0 %0 %1".format(width, height));
				} else {
					if(!width) {
						width = el.getAttribute("width");
					if(!height) {
						height = el.getAttribute("height");
				svgHolder.setAttribute("width", width);
				svgHolder.setAttribute("height", height);

				el.setAttribute("width", "100%");
				el.setAttribute("height", "100%");
				svgHolder.setAttribute("class", "svgImage svgIcon %0".format(options.imageClass || ""));
			else {
				var existing = el.className ? el.className.baseVal : "";
				el.setAttribute("class","svgImage %0".format(existing));
			// if a tiddler attribute is set this is read as a link
			$("[tiddler], [tiddlyLink]", place).attr("refresh", "link").click(function(ev) {
				var tiddler = $("tiddlyLink");
				if(tiddler) {
					story.displayTiddler(, tiddler);
	getArguments: function(paramString, params) {
		var args = paramString.parseParams("name", null, true, false, true)[0];
		var options = {};
		for(var id in args) {
			if(true) {
				var p = args[id];
				if(id == "def") {
					options[id] = p;
				} else {
					options[id] = p[0];
		var width = isNaN(params[1]) ? false : parseInt(params[1], 10);
		var height = isNaN(params[2]) ? false : parseInt(params[2], 10);

		options.width = macro.lookupArgument(options, "width", width);
		options.height = macro.lookupArgument(options, "height", height);
		options.preserveAspectRatio = args.preserveAspectRatio && 
			args.preserveAspectRatio[0] == "yes" ? true : false;
		options.tiddlyLink = macro.lookupArgument(options, "tiddlyLink", false); = macro.lookupArgument(options, "link", false);
		return options;
	lookupArgument: function(args, id, ifEmpty) {
		return args[id] ? args[id] : ifEmpty;

// update views
var _oldwikifiedview = config.macros.view.views.wikified;
// update wikifier to check tiddler type before rendering
merge(config.macros.view.views, {
	wikified: function(value, place, params, wikifier, paramString, tiddler) {
		if(macro.isImageTiddler(tiddler) && params[0] == "text") {
			var newplace = $("<div />").addClass("wikifiedImage").appendTo(place)[0];
			macro.renderImage(newplace, tiddler.title, { alt: macro.locale.badImage });
		} else {
			_oldwikifiedview.apply(this, arguments);
	image: function(value, place, params, wikifier, paramString, tiddler) {
		// a field can point to another tiddler whereas text is the current tiddler.
		var title = params[0] == "text" ? tiddler.title : value;
		var args = macro.getArguments(paramString, params);
		macro.renderImage(place, title, args);
config.shadowTiddlers.StyleSheetImageMacro = [".wikifiedImage svg, .wikifiedImage .image { width: 80%; }",
	".svgImageText { background-color:[[ColorPalette::Error]]; color:#ddd; display: inline-block; }",
	"span.svgImageText { display: inline-block; overflow: hidden; }"
store.addNotification("StyleSheetImageMacro", refreshStyles);

Behavioral Treatment of Self-Injury, 1964 to 2000
SungWoo Kahng
The Johns Hopkins University School of Medicine
Brian A. Iwata and Adam B. Lewin
The University of Florida

!!!See @@LearningDisability@@ population

A literature search covering the period from 1964
to 2000 yielded 396 articles (706 participants) on the treatment of SIB. Most research
participants have been male and diagnosed with severe/profound mental retardation. The
use of reinforcement-based interventions has increased during the past decade, whereas the
use of punishment-based interventions has decreased slightly; both of these trends coincide
with the increase in the use of functional assessments. Most treatments have been highly
effective in reducing SIB; nevertheless, the disorder persists in spite of an abundance of
research, suggesting that a greater emphasis should be placed on prevention.
Effect of general hospital management on repeat episodes
of deliberate self poisoning: cohort study
!Effect of general hospital management on repeat episodes
of deliberate self poisoning: cohort study
Navneet Kapur, Allan House, Kath Dodgson, Chris May, Francis Creed
Provision of services in the United Kingdom for
patients who deliberately poison themselves is variable,
and many patients leave hospital without adequate
assessments.1 This may reflect the equivocal research
evidence on the effectiveness of interventions.2 In this
cohort study, we aimed to investigate whether aspects
of routine hospital management—such as admission,
psychosocial assessment, and referral for follow
up—had an impact on the repetition of deliberate self
@@NB patients were 16 yrs and OVER - not broken down in any more detail than this in the paper.@@
KATZ, LY, COX, BJ, GUNASEKARA, S, and MILLER, AL. (2004) Feasibility of Dialectical Behavior Therapy for Suicidal Adolescent Inpatients. J. Am. Acad. Child Adolesc. Psychiatry, 2004;43(3):276–282.

To evaluate the feasibility of dialectical behavior therapy (DBT) implementation in a general child and
adolescent psychiatric inpatient unit and to provide preliminary effectiveness data on DBT versus treatment as usual
Sixty-two adolescents with suicide attempts or suicidal ideation were admitted to one of two psychiatric inpatient units. One unit used a DBT protocol and the other unit relied on TAU. Assessments of depressive symptoms, suicidal ideation, hopelessness, parasuicidal behavior, hospitalizations, emergency room visits, and adherence to follow-up recommendations were conducted before and after treatment and at 1-year follow-up for both groups. In addition, behavioral incidents on the units were evaluated. 
DBT significantly reduced behavioral incidents during admission when compared with TAU. 

Both groups demonstrated highly significant reductions in parasuicidal behavior, depressive symptoms, and suicidal ideation at 1 year. 
DBT can be effectively implemented in acute-care child and adolescent psychiatric inpatient units. 
The promising results from this pilot study suggest that further evaluation of DBT for adolescent inpatients appears warranted.
Michael Kerfoot, Richard Harrington and Elizabeth Dyer (1995)
!Brief home-based intervention with young suicide attempters and their families
Journal of Adolescence, Volume 18, Issue 5, October 1995, Pages 557-568
Suicidal behaviour among children and young adolescents constitutes a serious and increasing public health problem. Current, little is known about how these youngsters and their families respond to professional intervention, or what kinds of intervention may be most appropriate for them. We describe here an intervention package, the structure and content of which is based on insights gained from previous research studies and extensive clinical practice. Essential features of the package are that it is short-term, focused, intensive, and home-based. The Intervention Package is currently the focus of a major controlled evaluated study.
!Emergence of self-destructive phenomena in children and adolescents during fluoxetine treatment.
Journal of the American Academy of Child and Adolescent Psychiatry 1991;30(2):179-86.
1991: King R A; Riddle M A; Chappell P B; Hardin M T; Anderson G M; Lombroso P; Scahill L

Self-injurious ideation or behavior appeared de novo or intensified during fluoxetine treatment of obsessive-compulsive disorder in six patients, age 10 to 17 years old, who were among 42 young patients receiving fluoxetine for obsessive-compulsive disorder at a university clinical research center. These symptoms required the hospitalization of four patients. Before receiving fluoxetine, four patients had major risk factors for self-destructive behavior including depression or prior suicidal ideation or self-injury. Three hypotheses concerning the apparent association between fluoxetine and these self-injurious phenomena are discussed: (1) coincidence; (2) disorganization of vulnerable individuals secondary to drug-induced activation; and (3) a specific serotonergic-mediated effect on the regulation of aggression.
Youth-Nominated Support Team for Suicidal Adolescents (Version 1):
A Randomized Controlled Trial
Cheryl A. King, Anne Kramer, Lesli Preuss, and
David C. R. Kerr, Lois Weisse, Sanjeev Venkataraman
Journal of Consulting and Clinical Psychology, 2006, Vol. 74, No. 1, 199–206
!DB notes:
Focus on SUICIDE, not Self Injury - 

Reviewed by [[Donaldson, 06]]

Good RCT, though, and intersting approach:

>//"YST–1 was designed to supplement routine care for
suicidal adolescents following psychiatric hospitalization, a period
of high risk for suicidal incidents (Goldston et al., 1999). It
provides psychoeducation for support persons whom youths nominate
from within and outside their family, and it facilitates the
supportive weekly contact of these support persons with the suicidal
>//"Support persons participated in psychoeducation sessions (approximately
1.5–2.0 hr) designed to help them understand the youth’s psychiatric
disorder(s) and treatment plan, suicide risk factors, strategies for
communicating with adolescents, and emergency contact information.
They were asked to maintain weekly supportive contact with the adolescents
(discussing daily activities and concerns, encouraging activities in
support of treatment goals). Support persons were contacted regularly by
intervention specialists."//
See also [[King, 99]] described by [[Miller, 00]].
From [[Miller, 00]]:
"King's new innovative youth-suicide-prevention program, ''Connect Five'', also is under investigation. Connect Five involves bringing together:
#health professionals,
#trusted adults
to create a supportive network for suicidal youth. 

The goal of the treatment is to empower at-risk youth, increase their sense of connectedness with others, and decrease risk factors. 

''Each participating youth nominates two to four people from family, school, neighborhood, and community settings'' who become a part of the youth’s ''Connect Five team''. 

This program is being implemented and evaluated at six clinical sites, and a total of 450 subjects are expected to participate during the three-year project.

See also [[King, 06]] - RCT

The functions of deliberate self-injury: A review of the evidence
E. David Klonsky
Clinical Psychology Review 27 (2007) 226–239

!Review of research literature on FUNCTION of SIB

!!Deliberate self-injury is defined as the intentional, direct injuring of body tissue without suicidal intent.

!!Results from 18 studies provide converging evidence for 

!!!(A) an affect-regulation function. 
Research indicates that: 
(a) acute negative affect precedes self-injury, 
(b) decreased negative affect and relief are present after self-injury,
(c) self-injury is most often performed with intent to alleviate negative affect, and 
(d) negative affect and arousal are reduced by the performance of self-injury proxies in laboratory settings. 

Studies also provide strong support for:

!!!(B) self-punishment function, 

and modest evidence for:

!!!!(C)	anti-dissociation,
!!!!(D)	 interpersonal-influence, 
!!!!(E)	anti-suicide, 
!!!!(F)	sensation-seeking, and 
!!!!(G)	interpersonal boundaries functions.

 The conceptual and empirical relationships among the different functions remain unclear.

!!//Affect regulation// seems particularly pertinent for ADOLESCENTS...

Penn, J. V., Esposito, C. L., Schaeffer, L. E., Fritz, G. K., & Spirito, A. (2003). Suicide attempts and self-mutilative behavior in a juvenile correctional facility. Journal of the American Academy of Child and Adolescent Psychiatry, 42, 762−769.  

Laye-Gindhu, A., & Schonert-Reichl, K. A. (2005). Nonsuicidal self-harm among community adolescents: Understanding the “whats” and “whys” of self-harm. Journal of Youth and Adolescence, 34, 447−457.

Nock, M. K., & Prinstein, M. J. (2005). Contextual features and behavioral functions of self-mutilation among adolescents. Journal of Abnormal Psychology
Childhood sexual abuse and non-suicidal self-injury: meta-analysis
E. David Klonsky and Anne Moyer
The British Journal of Psychiatry (2008)192, 166–170.
Many theorists (cf [[Yates, 2004]]) posit that childhood sexual abuse has a
central role in the aetiology of self-injurious behaviour.
Studies that report statistically significant associations
between a history of such abuse and self-injury are cited to
support this view.
A meta-analysis was conducted to determine systematically
the magnitude of the association between childhood sexual
abuse and self-injurious behaviour.
Forty-five analyses of the association were identified. Effect
sizes were converted to a standard metric and aggregated.
The relationship between childhood sexual abuse and selfinjurious
behaviour is relatively small (mean weighted aggregate f=0.23).
This figure may be inflated owing to publication bias. 

>//"In studies that statistically controlled for
psychiatric risk factors, childhood sexual abuse explained
little or no unique variance in self-injurious behaviour."//
Theories that childhood sexual abuse has a central or causal
role in the development of self-injurious behaviour are not
supported by the available empirical evidence. Instead, it
appears that the two are modestly related because they are
correlated with the same psychiatric risk factors.
Declaration of interest
>//''"Taken as a whole, the pattern of findings
suggests that childhood sexual abuse might be best conceptualised
as a proxy risk factor for self-injurious behaviour. In other
words, the two might be associated because they are correlated
with the same psychiatric risk factors, as opposed to there being
a unique or aetiological link between them. At the same time, in
some cases childhood sexual abuse might contribute to the
initiation of self-injurious behaviour through mediating variables
such as depression, anxiety and self-derogation, each of which is
known to relate to both childhood sexual abuse and self-injurious
[[Kahng, 02]]

!Different presentations:
 (from [[Kahng, 02]])
 in order of frequency:


!From [[Truth Hurts, 06]]
Young people with learning disabilities
Approximately one-third of a million young people in the UK have learning disabilities (Emerson, Hatton, Felce
and Murphy, 2001)25. Of those, 40 per cent are likely to develop a diagnosed mental health problem (Emerson,
2003)26. In 2001 the Foundation for People with Learning Disabilities convened an inquiry to explore the mental
health needs of young people with learning disabilities (Mental Health Foundation, 2002; 2005)27;28. The findings
from this inquiry and research confirmed that young people with learning disabilities experience the same range
of mental health problems as other young people, but found that they are more prone to depression and anxiety
disorders and these often go unrecognised and untreated. The report also highlighted the high incidence of selfharm
among this group of young people.
The existing literature estimates rates of self-harm in people with learning disabilities to be approximately
between 8 to15 per cent in institutional settings, and between 2 and12 per cent in community settings (Wisely et
al, 2002)29. However, most of the research concentrates on people with severe and profound learning disabilities
and associated syndromes. This reflects the medical model that associates the behaviour with a syndrome, rather
than with response to distress (Collacott et al, 199830; Emerson, 200326; Emberson and Walker, 199031; Hyma and
Oliver, 200132). There is also virtually no specific focus on young people in the available research.
One of the few studies solely addressing the views of people with mild to moderate learning disabilities who selfharm
was carried out by Duperouzel (2004)33. This study attempted to explore some of the subjective experiences
of nine people who self-harmed. Participants reported similar views and reasons for their self-harm as the young
people that the Inquiry consulted. Most acknowledged that self-harm was not an effective long-term coping
strategy, and were concerned about the physical damage they were sometimes inflicting on themselves. Some
talked about stopping their self-harm, but did not know how to go about it, or who could help them.
From [[Miller, 00]]:
"Lerner and Clum (1990) compared the efficacy of a social-problem-solving group
therapy to a supportive group therapy for 18 college students (ages 18–24) who reported
significant levels of depression and suicidal ideation on self-report measures. Subjects
were assigned randomly to the treatment groups, both of which consisted of ten sessions
over a 5- to 7-week period. In contrast to the problem-solving therapy, the supportive
therapy consisted mainly of empathic listening and the facilitation of group discussion by
the therapist.
Assessments occurred at pretreatment (Week 0), posttreatment (Week 10), and three
months after treatment (Week 22). At posttreatment, subjects in the problem-solving
group were significantly less depressed and had better problem-solving skills than subjects
in the supportive group. Three months later, the problem-solving group continued to
be less depressed, hopeless, and lonely than those in the supportive group. There was a
significant decrease in suicidal ideation in both treatment groups, with no differences
between the two groups on measures of suicidality. Thus, while the problem-solving
therapy was more effective for reducing depression and hopelessness, both treatments
were effective in reducing suicidal ideation. However, these results should be interpreted
with caution since the sample size (n 5 18) was small."
Association between serotonin transporter gene promoter polymorphism and suicide: results of a meta-analysis
Biological Psychiatry, Volume 55, Issue 10, 15 May 2004, Pages 1023-1030 
Pao-Yen Lin and Guochuan Tsai

There is strong evidence supporting a role for serotonin system dysfunction in the pathology of suicidal behavior. Many studies have examined the association between a functional polymorphism of the serotonin transporter gene promoter (5-HTTLPR) and suicide but have yielded inconsistent results. Our goal here, by analyzing the cumulative data from primary literature, was to determine conclusively whether there is an association.
Three meta-analyses were performed. One compared the 5-HTTLPR polymorphism between suicidal subjects and normal control subjects; another compared suicide attempters with nonattempters of the same psychiatric diagnoses; the last one compared either violent or nonviolent suicidal subjects with normal control subjects.
We found no association between 5-HTTLPR polymorphism and suicidal behavior (p = .379). When we compared subjects with the same psychiatric diagnoses, the genotypes carrying the s allele were significantly more frequent in suicide attempters than in nonattempters (p = .004). In addition, the s allele was associated with violent suicide (p = .0001) but not with nonviolent suicide (p = 1.00).
Our results provide significant evidence supporting the association of the s allele of 5-HTTLPR polymorphism with suicidal behavior in the psychiatric population, also with violent suicide. These support a role for decreased serotonin transporter function in the vulnerability to suicide in a select population.
Lubin G, Werbeloff N, Halperin D, Shmushkevitch M, Weiser M, Knobler HY (2010)
!Decrease in Suicide Rates After a Change of Policy Reducing Access to Firearms in Adolescents: A Naturalistic Epidemiological Study 
Suicide and Life-Threatening Behavior, Volume: 40, Issue: 5, October 2010, Page(s): 421-424
!Abstract text
The use of firearms is a common means of suicide. We examined the effect of a policy change in the Israeli Defense Forces reducing adolescents' access to firearms on rates of suicide. Following the policy change, suicide rates decreased significantly by 40%. Most of this decrease was due to decrease in suicide using firearms over the weekend. There were no significant changes in rates of suicide during weekdays. Decreasing access to firearms significantly decreases rates of suicide among adolescents. The results of this study illustrate the ability of a relatively simple change in policy to have a major impact on suicide rates.
Madge N, Hewitt A, Hawton K, de Wilde EJ, Corcoran P, Fekete S, van Heeringen K, De Leo D, Ystgaard M. (2008) //Deliberate self-harm within an international community sample of young people: comparative findings from the Child & Adolescent Self-harm in Europe (CASE) Study.// J Child Psychol Psychiatry. 2008 Jun;49(6):667-77. Epub 2008 Mar 10.

Deliberate self-harm among young people is an important focus of policy and practice internationally. Nonetheless, there is little reliable comparative international information on its extent or characteristics. We have conducted a seven-country comparative community study of deliberate self-harm among young people. 
Over 30,000 mainly 15- and 16-year-olds completed anonymous questionnaires at school in Australia, Belgium, England, Hungary, Ireland, the Netherlands and Norway. Study criteria were developed to identify episodes of self-harm; the prevalence of self-harm acts and thoughts, methods used, repetition, reasons given, premeditation, setting for the act, associations with alcohol and drugs, hospitalisation, and whether other people knew, were examined. 
Self-harm was more than twice as common among females as males and, in four of the seven countries, at least one in ten females had harmed herself in the previous year. Additional young people had thought of harming themselves without doing so. More males and females in all countries except Hungary cut themselves than used any other method, most acts took place at home, and alcohol and illegal drugs were not usually involved. The most common reasons given were 'to get relief from a terrible state of mind' followed by 'to die', although there were differences between those cutting themselves and those taking overdoses. About half the young people decided to harm themselves in the hour before doing so, and many did not attend hospital or tell anyone else. Just over half those who had harmed themselves during the previous year reported more than one episode over their lifetime. 
Deliberate self-harm is a widespread yet often hidden problem in adolescents, especially females, which shows both similarities and differences internationally.
<<tag [[Descriptive]]>> <<tag [[01.Reviews/Meta-analyses]]>> <<tag SpecificTreatments>>  <<tag [[SpecialGroups]]>> <<tag [[RATINGS]]>> <<tag ChapterPlan>> 

!Repetitive skin-cutting: Parental bonding, personality and gender
M. J. Marchetto*
Psychology and Psychotherapy: Theory, Research and Practice (2006), 79, 445–459

Department of Psychiatry and Behavioural Sciences, University College London, UK
Objectives. This study examines (a) the extent to which repetitive skin-cutting is
most prevalent among women and those with a history of trauma; and (b) among those
skin-cutters without a history of trauma, the extent to which borderline personality
disorder (BPD) features as a primary diagnosis and whether disturbed parental bonding
might be associated with this form of self-harm.
Method. Details of gender and reported experiences of trauma were recorded for a
large, consecutive sample of skin-cutters (N ¼ 517) who attended a general hospital.
Psychiatric diagnoses and parental bonding instrument (PBI) scores were obtained for a
subsample of skin-cutters (N ¼ 81) and comparison group participants without
experiences of trauma.
Results. No gender differences were observed among skin-cutters, most of whom
reported experiences of trauma. BPD was recorded for a minority of those skin-cutters
without a history of trauma. PBI scores discriminated between non-BPD skin cutters
and non-BPD comparison participants without a history of trauma.
Although these results provide further confirmation of a ''potential association between prior trauma and repetitive skin-cutting'', they ''rigorously challenge the validity of reported gender differences for this behaviour.'' 

Further, this study has identified that ''repetitive skin-cutting can arise __independently__ of BPD and prior trauma.''
Clinical implications of these results and suggested directions for future research are
<link rel="shortcut icon" href="/recipes/sib-treatments-literature_public/tiddlers/favicon.ico" />
<link href="/bags/sib-treatments-literature_public/tiddlers.atom" rel="alternate"
	type="application/atom+xml" title="sib-treatments-literature's public feed" />
<link rel="canonical" href="" />
From [[Skegg, 05]]:
>//"Two recent studies that used the General Practice Research Database provided no evidence of such risk in adults who were prescribed SSRIs compared with those prescribed tricyclic antidepressants.97,98 There was, however, weak evidence of a higher risk of self-harm for people younger than 19 years who were prescribed SSRIs."//  
*Martinez C, Rietbrock S, Wise L, et al. Antidepressant treatment and the risk of fatal and non-fatal self harm in first episode depression: nested case-control study. BMJ 2005; 330: 389.
Youth Suicidal Behavior: Assessment and Intervention
Alec L. Miller and Juliet Glinski
JOURNAL OF CLINICAL PSYCHOLOGY, Vol. 56(9), 1131–1152 (2000)

Suicide ranks as the third leading cause of death in the 15-to-24-year-old age group.
Although the actual base rate of adolescent suicide is still relatively low, approximately
13.8 per 100,000 (National Center for Health Statistics, 1996), it is concerning that the
rates of adolescent suicide have increased significantly over the past four decades. According
to Peters, Kochenek, and Murphy (1998), completed suicides for youth between the
ages of 15 and 19 rose 245% between 1956 and 1994


!!With adolescents it is not enough just to look at PAST suicidal behaviour:
Researchers have established that ''the best predictor of a suicide attempt is a previous
suicide attempt'' (Leon, Friedman, Sweeney, Brown, & Mann, 1990; Shafii, Carrigan,
Whittinghill, & Derrick, 1985). However, since ''only 10 to 40% of those adolescents who
commit suicide have made a previous attempt'', it is necessary to assess for other risk
factors (Brent et al., 1988; Marttunen, Aro, & Lonnqvist, 1993).

!!Commonly used self-report inventories of suicidal ideation/behavior:
#''Suicidal Ideation Questionnaire'' (SIQ; Reynolds, 1987)
#''Scale for Suicide Ideation'' (SSI; Beck, Steer, & Ranieri, 1988)
#''Harkavy–Asnis Suicide Survey'' (HASS; Harkavy-Friedman & Asnis, 1989). 

One problem with current self-report measures of suicidality is that they yield a high number of false positives, indicating that these measures alone are not valid enough to distinguish those adolescents who are truly at risk for suicidal behavior (e.g., Lewinsohn et al., 1996; Shaffer et al., 1996).

Eggert, Thompson, and Herting (1994) have developed a more-specific and comprehensive assessment tool, the ''Measure
of Adolescent Potential for Suicide (MAPS)'', that includes both a questionnaire and a follow-up computer-assisted, face-to-face interview. The MAPS was structured to assess direct suicide risk factors, related risk factors, and protective factors. However, despite having good validity and reliability, the MAPS has not been used widely in research.

Jobes, Luoma, Jacoby, & Mann (1998) also have developed a comprehensive assessment
tool, the ''Collaborative Assessment and Management of Suicidality (CAMS)''. The
CAMS is a detailed, step-by-step assessment and brief treatment protocol that emphasizes
a collaborative process that helps the therapist and patient develop a shared framework
of understanding the patient’s suicidality. The model links assessment findings
directly to treatment goals, and it includes a general outline for managing suicidal patients.
It is different from many other approaches to suicide in that the CAMS considers suicide
the central condition that has many underlying symptoms (e.g., depression; relationship
problems) rather than the reverse (i.e., perceiving suicide as only a symptom to a larger
problem). Although the CAMS appears promising, research is needed to evaluate its
validity, reliability, and overall effectiveness. Furthermore, the CAMS was developed for
college students, so adaptations may be indicated for applications to a younger population.

!Psychopathology as a risk factor:
Psychological autopsy studies have shown that between 90 and 97% of adolescent-suicide victims had
a psychiatric illness at the time of their death (Brent et al., 1988; Marttunen, Aro, Henrikson,
& Lonnqvist, 1991; Shaffer et al., 1996)

!!Substances as risk factor
The extent to which alcohol/substance use plays in adolescent suicide is striking. 

Studies with adolescents and young adults have found ''evidence of alcohol/substance abuse in 38
to 54% of suicide victims'' (Brent, Perper, &Allman, 1987; Hoberman & Garfinkel, 1988;
Marttunen et al., 1991; Shafii et al., 1985). Abel and Zeidenberg (1985) found that in
their sample of 15- to 24-year-old suicide victims, 35% of the subjects had medical
records indicating significant blood–alcohol levels at the time of death. Hawton, Fagg,
and McKeown (1989) had similar results in their study of 1,973 adolescents and young
adults presenting to a hospital emergency room. They reported that ''38% of suicide attempters
had consumed alcohol within six hours of their attempt''. One recent study evaluated
89 consecutive admissions to a specialty outpatient clinic for depressed and suicidal
inner-city teens. Of the 49 subjects that had histories of self-injurious behavior, ''18.4%
met diagnostic criteria for cannabis abuse or dependence'' (Velting & Miller, 1999).

!!Conduct Disorder
Conduct disorder is another common diagnosis found among suicidal adolescents. In
a psychological autopsy study of suicide victims, Shafii and colleagues (1985) discovered
that 70% of the suicide victims had antisocial behaviors compared to 34% of the
control group. Apter and colleagues (Apter, Bleich, Plutchik, Mendelsohn, & Tyano,
1988; Apter et al., 1995) have asserted that aggression, a major component of conduct
disorder, may be as important as depression in some kinds of suicidal behavior. For
example, they found higher levels of suicidality among conduct-disordered adolescents
than those with major depressive disorders, in spite of the fact that the conductdisordered
subjects reported less depression (Apter et al., 1988).
!!Borderline PD
The relationship between suicidal behavior and borderline personality disorder (BPD)
in adolescents has been recognized for 20 years (Brent et al., 1994; Crumley, 1979;
Marton et al., 1989). In a recent Finnish study of female suicide completers ranging in
age from 13 to 22 years, Marttunen and colleagues (1995) found that 26% of their 1,397
subjects met criteria for BPD. Personality disorders and the tendency to engage in impulsive
violence have become critical risk factors for suicide among adolescents (Brent
et al., 1994).
!Contextual factors:
!!Family Climate:
Family climate has been found to play a role in suicide risk among adolescents. Parental
psychopathology, including abuse and neglect of children, family history of suicidal behavior,
nonintact family composition, familial stress (e.g., deaths, separations), family conflict,
and, more recently, impaired communication and low levels of emotional support
and expressiveness are the familial factors most consistently associated with adolescent
suicidal behavior (Campbell, Milling, Laughlin, & Bush, 1993; Garber, Little, Hilsman,
& Weaver, 1998; Keitner et al., 1990; King, Segal, Naylor, & Evans, 1993; Martin &
Waite, 1994; Pfeffer, 1989; Wagner, 1997). 
!!Familial mental illness
Studies report a higher rate of mental disorders in the family history of suicide attempters than in control groups (e.g., Garfinkel, Froese, & Hood, 1982; Wagner, 1997). However, when suicidal subjects are compared
with nonsuicidal psychiatric samples, levels of parental psychopathology do not differ
(Brent, Kolko, Allan, & Brown, 1990). ''This suggests that psychiatric disorders in family
members may not be a direct risk factor for adolescent suicidality per se, but rather it puts
adolescents at risk for psychopathology.''
!!Life events:
!!!Familial suicide attempt:
Lewinsohn and colleagues (1996) identified several stressful life events that effect
family functioning and predict future suicide attempts among adolescents.Asuicide attempt
by a relative was the best family-related predictor of adolescent suicide attempt. Other
predictors include having a relative with drug/alcohol problems, having a relative who
remarried or started living with someone else, and the death of a relative.
!!Proximal Risk Factors
It is important to consider precipitating events, called proximal risk factors. These risk factors are neither necessary nor sufficient in and of themselves, but, in combination with distal risk factors, place adolescents at greater risk for suicide. 
!!!Common proximal risk factors for adolescent suicidal behavior.
Often, the precipitating event involves a ''real or imagined loss.''

In fact, ''interpersonal conflicts and separations'' are the most common precipitants to adolescent suicide (Marttunen et al., 1993; Spirito, Overholser, & Stark, 1989). The following life events have been associated with higher risk:

#breakup of a romantic relationship; 
#leaving home/moving away; 
#legal trouble; 
#physical abuse; 
#relative or friend attempting or completing suicide; 
#relative or friend died; 
#relative or friend involved in substance abuse; 
#relative or friend remarried or moved in with someone else; 
#poor parent–child communication; 
#disciplinary crisis; 
#parental unemployment 
(Brent, Perper, Mortiz, Baugher, et al., 1993; Gould et al., 1996; Lewinsohn et al., 1996; Shaffer et al., 1988). *Adolescents with physical diseases and injuries are also at higher risk, but only to the degree that their medical
problems result in functional impairment (Lewinsohn et al., 1996).

[[Harrington, 98]]
[[Lerner & Clum, 90]]
[[Rathus and Miller, 02]] - described as a 1999 paper, but seems to be the same study (111 patients, quasi experimental pilot).
[[King, 99]]
!!Re. Psychodynamic Rx's:
//"It is important to note that several psychodynamically oriented theorists have made
important contributions to the understanding of suicidality among adolescents (Freud,
1917; Leonard, 1967; Menninger, 1938; Schneidman, 1996), although no randomized
controlled trials of psychodynamic treatments for this population have been conducted."//
!Mittendorfer-Rutz E, Rasmussen F, Wasserman D.
Lancet. 2004 Sep 25-Oct 1;364(9440):1102-4.  
Restricted fetal growth and adverse maternal psychosocial and socioeconomic conditions as risk factors for suicidal behaviour of offspring: a cohort study.

Until now, sparse and contradictory results about an association between adverse neonatal, obstetric, and maternal conditions and heightened suicide risk in adolescents have been reported. The aims of this study were to investigate the relations between fetal growth, obstetric complications, and the mother's psychosocial and socioeconomic situation and the risk in early adulthood of suicide and attempted suicide in the offspring. 
Obstetric, neonatal, and maternal risk factors for suicide and attempted suicide in 713370 young adults, born in Sweden between 1973 and 1980, who were followed-up until Dec 31, 1999, were examined by data linkage between Swedish registers. Univariate and multivariate hazard ratios, derived from proportional-hazard models, were estimated. 
Significantly raised risk of attempted suicide was reported for individuals of short birth length, adjusted for gestational age (hazard ratio 1.29, 95% CI 1.18-1.41, p<0.0001); born fourth or more in birth order (1.79, 1.62-1.97, p<0.0001); born to mothers with a low educational level (1.36, 1.27-1.46, p<0.0001) (attributable proportion 10.3%); and those who, at time of delivery, had mothers aged 19 years or younger (2.09, 1.89-2.32, p<0.0001). Significant predictors of suicide were low birthweight, adjusted for gestational age (2.23, 1.43-3.46, p<0.0001), and teenage motherhood (2.30, 1.64-3.22, p<0.0001). 
Multiparity and low maternal education predicted suicide attempt, whereas restricted fetal growth and teenage motherhood were associated with both suicide completion and attempt in offspring.
The psychology of female violence: crimes against the body,  (Chapter 5, Deliberate Self harm pp 123 - 156)
By Anna Motz
Edition: illustrated
Published by Psychology Press, 2001

Not adolescents 
Psychoanalytical and Psychiatric views - psychiatric view critiqued, explicit call for a psychodynamic model of understanding the phenomenon.
Associates child sexual abuse with SIB, and offers psychoanalytic explanation (but note the recent metaanalysis [[Klonsky, 08]] which contradicts the assertion that there is a //direct// aetiological link from CSA to SIB...)

Muehlenkamp, Jennifer J.
!Self-Injurious Behavior as a Separate Clinical Syndrome.
American Journal of Orthopsychiatry. Vol 75(2), Apr 2005, 324-333.

The field of clinical psychology may benefit from adopting a deliberate self-injury syndrome as a distinct disorder for representation in the Diagnostic and Statistical Manual of Mental Disorders (4th ed., text rev.; American Psychiatric Association, 2000). The phenomenological and empirical data supporting a deliberate self-injury syndrome are reviewed, and arguments for and against the adoption of a distinct syndrome are explored. (PsycINFO Database Record (c) 2008 APA, all rights reserved)
Empirically Supported Treatments and General Therapy Guidelines for Non-Suicidal Self-Injury
Jennifer J. Muehlenkamp
Mental health counselors are facing increased demand to treat both adolescents and adults who
present with repetitive non-suicidal self-injurious behaviors, yet there are few empirically supported
treatments or general treatment guidelines available. I will review the research on problem-solving
and dialectical behavior therapy, two cognitive-behavioral treatments that have the most empirical
support for reducing self-injurious behavior. I conclude by providing specific treatment recommendations
drawn from the literature that can be of use to mental health counselors working with
individuals who self-injure.
For young people who have self-harmed several times,
consideration may be given to offering developmental
group psychotherapy with other young people who have
repeatedly self-harmed. This should include at least six
sessions. Extension of the group therapy may also be
offered; the precise length of this should be decided
jointly by the clinician and the service user.

NB see [[Hazell et al 2009]] which contradicts the findings of [[Wood, 01]] on which this recommendation was based.
''Affect Regulation and Addictive Aspects of Repetitive Self-Injury in Hospitalized Adolescents''

The incidence of self-injurious behavior (SIB) in adolescent psychiatric inpatients has been reported to be as
high as 61%, yet few data exist on the characteristics and functional role of SIB in this population. 
Because of the repetitive nature of SIB and its potential to increase in severity, features of SIB and its specific reinforcing effects were examined.
>//Repetitive SIB has been recognized as having addictive
qualities, with the essential feature being “the recurrent
failure to resist impulses” to self-injure (Favazza and
Rosenthal, 1993). Faye (1995) reviewed the SIB literature,
citing addictive characteristics of this behavior and
noting in particular the reinforcing aspects of its tensionreleasing
properties. Specifically, some patients feel mounting
tension, creating a drive to self-injure as the only
means of obtaining relief. Over time, increased frequency
and severity of self-injury occurs in order to achieve the
same effect. A case report of a female adolescent psychiatric
inpatient with the diagnosis of BPD used modified
DSM-III-R substance dependency criteria to illustrate
SIB as an addictive behavior (Karwautz et al., 1996). The
addiction model of repetitive SIB, to our knowledge, has
not been empirically tested. The potential addictive properties
of SIB and its identified effects of regulating intense
negative affective states deserve further attention, particularly
in hospitalized adolescents."//
Participants were 42 self-injuring adolescents admitted to a hospital over a 4 month period. Data sources consisted of self-report questionnaires and medical chart review. 
Used various measures including assesst of SIB with MODIFICATIONS to enquire about ADDICTIVE features:
>//"The major modification was the addition of questions pertaining
to the addictive aspects of this behavior, with the DSM-IV criteria
for substance dependence adapted to incorporate SIB. The criteria
used for all addictive syndromes in both the DSM-IV and the ICD-
10 focuses on loss of control over the substance (in this case, the behavior) 
as well as tolerance and withdrawal (Compton and Guze, 1997).
Since there is no known characteristic withdrawal syndrome for repetitive
SIB, we included an item regarding rising tension levels if the SIB
does not reoccur, as described by Karwautz et al. (1996)."//
Mean age was 15.7 ± 1.5 years. 
Reported urges to self-injure were almost daily in 78.6% of the adolescents (n = 33), with acts occurring more than once a week in 83.3% (n = 35). 
The two primary reasons endorsed for engaging in self-injury were:
# “to cope with feelings of depression” (83.3%, n = 35) and 
# “to release unbearable tension” (73.8%, n = 31). 
Of the sample, 97.6% (n = 41) endorsed three or more addictive symptoms. 
SIB in hospitalized adolescents serves primarily to regulate dysphoric affect and displays many addictive features. Those with clinically elevated levels of internalized anger appear at risk for more addictive features of this behavior.

Dennis Ougrin D, Zundel T, Ng A, Banarsee R, Bottle A, Taylor E
Arch Dis Child Internet publication October 2010 doi:10.1136/adc.2010.188755
!Trial of Therapeutic Assessment in London: randomised controlled trial of Therapeutic Assessment versus standard psychosocial assessment in adolescents presenting with self-harm
To determine whether Therapeutic Assessment (TA) versus assessment as usual (AAU) improves engagement with follow-up in adolescents presenting with self-harm.
Randomised controlled trial with 3 months naturalistic follow-up.
Child and adolescent mental health services in two London National Health Service Trusts.
26 clinicians randomised into TA and AAU groups recruited 70 newly referred adolescents with self-harm.
TA, a manualised procedure including a basic psychosocial assessment and a 30 min therapeutic intervention; AAU, standard psychosocial assessment.
Manual: ''Dr Dennis Ougrin (Author), Dr Audrey V Ng (Author), Dr Tobias Zundel (Author)  "Self-harm in Young People: A Therapeutic Assessment Manual" Hodder Arnold Publication, 2010''
>//"Therapeutic Assessment for self-harm is a pragmatic model, developed by the authors of this book and forming an organic part of the psychosocial assessment following a self-harming incident. Its main features are that firstly, a therapeutic intervention at the time of distress, compared with a standard psychosocial history and risk assessment, improves patients' responses and their willingness to engage in further therapy, and secondly, that there is a vast range of evidence-based interventions that can be used to build a 'toolkit' that individual practitioners can employ with their patients."//

!!!Main outcome measures 
Attendance at the first follow-up session; number of the follow-up sessions attended and changes in Strengths and Difficulties Questionnaire and Children's Global Assessment Scale scores. All measures were adjusted for clustering, social class, changes of therapist and previous contact with services.
Using the data on all participants (n=70), those in the TA group were significantly more likely to attend the first follow-up appointment: 29 (83%) versus 17 (49%), OR 5.12, 95% CI (1.49 to 17.55) and more likely to attend four or more treatment sessions: 14 (40%) versus 4 (11%), OR 5.19, 95% CI (2.22 to 12.10). Three months after the initial assessment there were no statistically significant differences between the groups on Strengths and Difficulties Questionnaire scores: 15.6 versus 16.0, mean difference −0.37, 95% CI (−3.28 to 2.53) or Children's Global Assessment Scale scores: 64.6 versus 60.1, mean difference 4.49, 95% CI (−0.98 to 9.96).
TA was associated with statistically significant improvement in engagement. TA could be usefully applied at the point of initial assessment for adolescents with self-harm
OUGRIN D, LATIF S (2011) Engagement with Specific Psychological Treatment versus Treatment As Usual in Adolescents with Self Harm: Systematic Review and Meta-Analysis CRISIS 32(2):74-80

Background: Despite recent advances in the understanding and treatment of self-harm, poor engagement with therapy remains a serious problem. 
To investigate whether offering specific psychological treatment (SPT) leads to better engagement than offering treatment as usual (TAU) in adolescents who have self-harmed. 
Data sources were identified by searching Medline, PsychINFO, EMBASE, and PubMed for randomized controlled trials comparing SPT versus TAU in adolescents presenting with self-harm. 
Seven studies met inclusion criteria, and six were entered into the meta-analysis. There was no statistically significant difference between the number of subjects not completing four or more sessions of an SPT (27.7%, 70/253) than TAU (43.3%, 106/245), RR = 0.71 (95%
CI: 0.49–1.05). 
Engaging adolescents with psychological treatment is necessary although not sufficient to achieve treatment goals. Further research is needed to develop tools for maximizing engagement
<div class='header'>
	<div id='sidebarSearch'>
		<span macro='search'></span>
	<div class='headerForeground'>
		<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
		<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
	<div class='clearFloat'></div>

<div id='menuBar'>
	<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
	<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='displayArea'>
	<div id='messageArea'></div>
	<div id='tiddlerDisplay'></div>
	<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
Related to appropriate methodology, numbers, as well as relevance, clarity, etc - ''NOT a systematic measure in ANY WAY!'' - at least as much to do with how the content might helpfully frame sections of the chapter... 
!NB...defer to [[Hierarchy of Evidence]] if in doubt.
Pediatr Drugs 2003; 5 (4): 243-265 
REVIEW ARTICLE: Child and Adolescent Suicide.  Epidemiology, Risk Factors, and Approaches to Prevention
Mirjami Pelkonen and Mauri Marttunen

Suicide is rare in childhood and early adolescence, and becomes more frequent with increasing age. The latest
mean worldwide annual rates of suicide per 100 000 were 0.5 for females and 0.9 for males among
5–14-year-olds, and 12.0 for females and 14.2 for males among 15–24-year-olds, respectively. In most countries,
males outnumber females in youth suicide statistics. Although the rates vary between countries, suicide is one of
the commonest causes of death among young people. Due to the growing risk for suicide with increasing age,
adolescents are the main target of suicide prevention. Reportedly, less than half of young people who have
committed suicide had received psychiatric care, and thus broad prevention strategies are needed in healthcare
and social services. Primary care clinicians are key professionals in recognizing youth at risk for suicide.
This article reviews recent population-based psychological autopsy studies of youth suicides and selected
follow-up studies of clinical populations and suicide attempters, analyzing risk factors for youth suicides. As
youth suicides are rare, research on risk factors for youth suicidal ideation and attempted suicide is also briefly

The relationship between psychiatric disorders and adolescent suicide is now well established. Mood
disorders, substance abuse and prior suicide attempts are strongly related with youth suicides. Factors related to
family adversity, social alienation and precipitating problems also contribute to the risk of suicide. The main
target of effective prevention of youth suicide is to reduce suicide risk factors. Recognition and effective
treatment of psychiatric disorders, e.g. depression, are essential in preventing child and adolescent suicides.
Research on the treatment of diagnosed depressive disorders and of those with suicidal behavior is reviewed.
In the treatment of youth depression, psychosocial treatments have proved to be useful and efficacious.

Although studies on the effectiveness of selective serotonin reuptake inhibitors are limited in number, evidence
supports their use as first-line antidepressant medication in youth depression. Available evidence suggests that
various treatment modalities are useful in the treatment of suicidal youths, e.g. cognitive behavioral therapy and
specialized emergency room interventions. Much of the decrease in suicide ideation and suicide attempts seems
to be attributable to nonspecific elements in treatment. For high-risk youth, providing continuity of care is a
challenge, since they are often noncompliant and commonly drop out or terminate their treatment prematurely.
Developing efficacious treatments for suicidal children and adolescents would offer better possibilities to
prevent suicides.

Good info on epidemiology of adolescent suicides


!!!Epidemiology of child and Adolescent SUICIDES (Dickon's description of excerpts from the paper):

Rates vary widely across different countries (potentially due to different cultural pressures on youth, as well as on patterns of suicide reporting behaviours within different countries), with some showing rising secular trends (UK in the 1990's), while the majority have fallen over the past decade or so (cf Finland in particular).  however, universally all studies show a steep rise in the rates of completed suicides along with increasing age, with low rates in childhood and much higher rates in adolescence.  The WHO, 2001 (http:\\\whosis) presents data on the epidemiology of child and adolescent suicide: 104 countries reporting their mortality data, produced mean annual rates of suicide per 100 000 in 1995 (or the latest available year) of: 0.5 for females and 0.9 for males in the the age group 5–14 years, whereas the respective rates among 15–24 olds were 12.0 for females and 14.2 for males.

Pelkonen and Marttunen (2003), in a clearly written review of the epidemiology of suicide (note, not self-injurious behaviour) and a review of evidence for interventions directed at prevention, note a lack of empirical evidence to explain this, although there are plenty of explanatory models with reasonable face-validity, and these are briefly reviewed in this paper (for instance the relative deficiency of cognitive maturity in younger children which may make conceptualising worthlessness and suicidality, and planning the suicidal act, more difficult.  There is also a well-documented rise in the frequency of major psychiatric disorders through adoelscence, and the phenomenon of individuation in adolescence may play a part with its consequent loosening of the supportive relational network that generally holds and supervises younger children in protective ways.
Suicide and Life-Threatening Behavior 36(6) December 2006

!Screening as an Approach for Adolescent Suicide Prevention
Juan B. Pen˜ a, PhD, LCSW, and Eric D. Caine, MD
Among the provisions of the recently signed Garrett Lee Smith Memorial
Act, Congress called for the use of screening to detect adolescents who are at risk
for suicide. After a review of the literature, 17 studies involving screening instruments
and programs were identified. 

We addressed the question: 
!!!What do we know about the demonstrated effectiveness and safety of screening a tool or program to prevent suicide among adolescents? 

While youth suicide screening programs offer the promise of improving identification for those who need treatment
the most, further research is essential to understand how, when, where, and
for whom screening programs can be used effectively and efficiently.
''[[1. No statement about pharmacological company funding]]''

''[[2. Statement indicates no funding from pharmacological companies]]''

''[[3. Authors acknowledge receipt of pharma company funding]]''
E.g.//Lead author acknowledges receipt of pharmacological company funding...//
    //Four out of five authors acknowledge receipt of pharmacological company funding//
''[[4. Authors acknowledge receipt of funding from....]]''
E.g.//the Stanley Medical Research Institute//
!!The main problems are: 
!!!!a) Institutes we can't track down with regard to where they get their
funding, and 
!!!!b) People who declare no pharma sponsorship on one paper but then do on
presumably because the wording required by different journals
allows different interpretations

''__David Cottrell's notes:__''--
Here are the statements about pharma support I used in my chapter that
others could now road test. 

Statement 1 is straightforward and is the case for most older papers

Statement 2 is also straightforward and I have used it when there is either
an acknowledgement of support from a non pharma source, for example, NIHR,
and/ or if there is an explicit statement saying they did not get pharma

Statement 3 varies as sometimes the whole project is supported by pharma -
in which case it is the `all authors' version.  Sometimes, the project
itself isn't funded by pharma but some or all authors acknowledge current or
past funding by pharma on other matters

Statement 4 is the tricky one - I used it where the support was form an
organisation that I could not track down ie I am not sure if it is pharma or
not so I have just quoted the Institute name.
!!!Group characteristics:
Recent suicide attempt; Indian patients,
ED in South Africa; I = 40; C = 40 + 40
community controls, no history of
psychiatric disturbance; Age range
15– 20 years
Family therapy;
55% participation rate, reduced Hopelessness... BUT...
Repeat self-harm, missed appointments
and suicidal ideation not reported
!!!Follow up
6 month
Portzky G,  van Heeringen K
!Suicide prevention in adolescents: a controlled study of the effectiveness of a school-based psycho-educational program
Journal of Child Psychology and Psychiatry 47:9 (2006), pp 910–918
Psycho-educational programs are among the most commonly applied suicide prevention
approaches for young people. This study examined the effectiveness of these programs in a controlled
study by assessing the effect on knowledge, attitudes, coping and hopelessness. 
Fourteen- to 18-year-old students were administered structured questionnaires before and after the program to
assess the effect on knowledge, attitudes, coping and hopelessness. 
The program had no effect on coping styles and levels of hopelessness. However, a positive effect on knowledge could be
identified and an interaction effect of the program with gender on attitudes was also found. A negative
impact of the program could not be found. Results indicated effects of gender and pre-test on knowledge,
attitudes and coping. 
The findings from this study suggest that psycho-educational
programs in schools may influence knowledge about suicide and attitudes towards suicidal
persons but may not affect the use of coping styles or levels of hopelessness. 

!Immediate Post Intervention Effects of Two Brief Youth Suicide Prevention Interventions
Suicide and Life-Threatening Behavior 31(1) Spring 2001 41
@@See also [[Thompson, 01]] - these are preliminary findings@@
This study evaluated the immediate postintervention effects of two brief
suicide prevention protocols: 
#A brief interview—Counselors CARE (C-CARE)
#C-CARE plus a 12-session Coping and Support Training (CAST) peer-group intervention. 
...were students “at risk” of high school dropout and suicide potential in Grades 9–12 from seven high schools (N = 341). 
Students were assigned randomly to C-CARE plus CAST, C-CARE only, or “intervention as usual.” 
The predicted patterns of change were assessed using trend analyses on data available from three repeated measures. 
*C-CARE and CAST led to increases in personal control, problem-solving coping, and perceived family support. 
*Both C-CARE plus CAST and C-CARE only led to decreases in depression, and to enhanced self-esteem and family goals met. 
*All three groups showed equivalent decreases in suicide risk behaviors, anger control problems, and family distress.
|''Description''|Adds a random color palette to TiddlyWiki|
|''Author''|Jon Robson|
Sets and saves a random color palette on execution

Creates a button, which when clicked will change the color palette
More information at
RGB.prototype.toRGBString = function() {
	return "rgb(%0,%1,%2)".format(parseInt(this.r * 255, 10),
		parseInt(this.g * 255, 10), parseInt(this.b * 255, 10))
function HSL_TO_RGB(h, s, l) { // h (hue) between 0 and 360, s (saturation) & l (lightness) between 0 and 1
	var c = l <= 0.5 ? 2 * l * s : ( 2 - (2 * l)) * s;
	var h1 = h / 60;
	var x = c * (1 - Math.abs((h1 % 2) - 1)); 
	var r, g, b;
	if(typeof(h) == 'undefined') {
		r = 0;
		g = 0;
		b = 0;
	} else if(0 <= h1 && h1 < 1) {
		r = c;
		g = x;
		b = 0;
	} else if(1 <= h1 && h1 < 2) {
		r = x;
		g = c;
		b = 0;
	} else if(2 <= h1 && h1 < 3) {
		r = 0;
		g = c;
		b = x;
	} else if(3 <= h1 && h1 < 4) {
		r = 0;
		g = x;
		b = c;
	} else if(4 <= h1 && h1 < 5) {
		r = x;
		g = 0;
		b = c;
	} else if(5 <= h1 && h1 < 6) {
		r = c;
		g = 0;
		b = x;
	m = l - (0.5 * c);
	return new RGB(r + m, g + m, b + m);

	var macro = config.macros.RandomColorPalette = {
		messagesOn: false, 
		changedPaletteText: "We have assigned you a random theme by adjusting the [[ColorPalette]] tiddler.\nDon't like it? Click <<RandomColorPalette>> for another one.", 
		handler: function(place, macroName, params, wikifier, paramString, tiddler) {
			paramString = paramString || "";
			var options = macro.getOptions(paramString);
			macro.generatePalette(options, true);
		optionTypes: {
			floats: ["hue", "saturation", "darkest", "lightness", "huevariance", "dark", "pale", "light", "mid",
				"saturation_light", "saturation_pale", "saturation_mid", "saturation_dark"
		getOptions: function(paramString) {
			var args = paramString.parseParams("name", null, true, false, true)[0];
			var options = {};
			var numbers = macro.optionTypes.floats;
			for(var i in args) {
				options[i] = numbers.indexOf(i) > -1 ? parseFloat(args[i][0], 10) : args[i][0];
			return options;
		generateRandomNumber: function(min, max, info) {
			var num = (Math.random() * 1);
			info = !info ? { attempts:0 } : info;
			info.attempts += 1;
			var good = true;
			if(min == max) {
				return max;
			if(min && num < min) {
				good = false;
			} else if(max && num > max) {
				good = false;
			if(!good) {
				if(info.attempts < 5) {
					return macro.generateRandomNumber(min, max, info);
				} else {
					if(max) {
						return max;
					} else if(min) {
						return min;
					} else {
						return 1;
			return num;
		getExistingPalette: function(asJSON) {
			var title = "ColorPalette";
			var tiddlerText;
			if(store.tiddlerExists(title)) {
				tiddlerText = store.getTiddlerText(title);
			} else if(store.isShadowTiddler(title)){
				tiddlerText = config.shadowTiddlers[title];
			if(asJSON) {
				var json = {};
				if(tiddlerText) {
					var lines = tiddlerText.split("\n");
					for(var i = 0; i < lines.length; i++) {
						var definition = lines[i].split(":");
						if(definition.length == 2) {
							var name = definition[0].trim();
							var value = definition[1].trim();
							json[name] = value;
				return json;
			} else {
				return tiddlerText;
		generatePalette: function(options, save) {
			var outputRGB = options.rgb;
			var palette = macro.getExistingPalette(true);
			var hue = options.hue || Math.floor(Math.random() * 359);
			var saturation = options.saturation || macro.generateRandomNumber(0.3, 0.7);
			var dark = options.dark || options.darkest || macro.generateRandomNumber(0, 0.10);
			var pale = options.pale || options.lightness || macro.generateRandomNumber(0.90, 1);
			var delta = ( ( pale - dark ) / 3 );
			var mid = options.mid || dark + delta;
			var light = options.light || dark + (delta * 2);
			var lightness_values = {Dark: dark, Mid: mid, Light: light, Pale: pale};
			var saturation_values = {};
			for(i in lightness_values) {
				if(true) {
					saturation_values[i] = options["saturation_" + i.toLowerCase()] || saturation;

			var opposite_hue = (hue + 180) % 360;
			var seed = options.huevariance || Math.floor((85 * Math.random()) + 5); // we want it to be at least 5 degrees
			var huetwo = (opposite_hue + seed) % 360;
			var huethree = (opposite_hue - seed) % 360;
			if(huetwo < 0) {
				huetwo = 360 + huetwo;
			if(huethree < 0) {
				huethree = 360 + huethree;
			for(var j in lightness_values) {
				if(true) {
					var saturation = saturation_values[j];
					palette["Primary" + j] = HSL_TO_RGB(hue, saturation, lightness_values[j]);
					palette["Secondary" + j] = HSL_TO_RGB(huetwo, saturation, lightness_values[j]);
					palette["Tertiary" + j] = HSL_TO_RGB(huethree, saturation, lightness_values[j]);
			palette.Background = HSL_TO_RGB(hue, saturation, 0.92);
			palette.Foreground = HSL_TO_RGB(hue, saturation, 0.08);
			palette.ColorPaletteParameters = ["HSL([", hue, "|", seed, "], [", saturation_values.Pale, "|",
				saturation_values.Light, "|", saturation_values.Mid, "|", saturation_values.Dark, "],",
				"[", dark, "|", mid, "|", light, "|", pale, "])"].join("");
			// construct new ColorPalette
			var text = ["/*{{{*/\n"];
			var colorcode;
			for(var id in palette) {
				if(true) {
					var color = palette[id];
					colorcode = outputRGB ? color.toRGBString() : color.toString();
					text.push("%0: %1\n".format(id, colorcode));
			text = text.join("");
			if(save) {
			return text;
		saveColorPalette: function(text) {
			var tid = store.getTiddler("ColorPalette");
			if(!tid) {
				tid = new Tiddler("ColorPalette");
				tid.fields = merge({}, config.defaultCustomFields);
			} // TODO: detect that the ColorPalette in the space comes from outside recipe
			tid.fields[""] = "false"; // edit conflicts dont matter

			// save the color palette in tid
			tid = store.saveTiddler(tid.title, tid.title, text, tid.modifier, tid.modified,
				tid.tags, tid.fields, false, tid.created, tid.creator);
			// an interval is used to cope with users clicking on the palette button quickly.
			if(macro._nextSave) {
			macro._nextSave = window.setTimeout(function() {
					autoSaveChanges(null, [tid]);
				}, 2000);
			// temporary workaround for IE.
			$.twStylesheet.remove({ id: "StyleSheetColors" });
			$.twStylesheet.remove({ id: "StyleSheet" });
			return tid;
		reportChange: function() {
			if(macro.messagesOn) { // only display message once..
				var msgPlace = getMessageDiv();
				if(!$(".changedPalette", msgPlace)[0]) {
					var tempPlace = document.createElement("div");
					wikify("{{changedPalette{" + macro.changedPaletteText + "}}}", tempPlace);
	var btnMacro = config.macros.RandomColorPaletteButton = {
			text: "New ColorPalette",
			tooltip: "Generate a random colour scheme for your TiddlyWiki",
			makeButton: function(place, options) {
				var btnHandler = function(ev) {
					var t = $(;
					var options ="options");
					macro.generatePalette(options, true);
					return false;
				var btn = createTiddlyButton(place, this.text, this.tooltip, btnHandler);
				$(btn).data("options", options);
				return btn;
			handler: function(place, macroName, params, wikifier, paramString, tiddler) {
				var options = macro.getOptions(paramString);
				btnMacro.makeButton(place, options);
RATHUS, JH, and MILLER, AL, (2002) //Dialectical Behavior Therapy Adapted for Suicidal Adolescents// Suicide and Life-Threatening Behavior 32(2) Summer 2002
We report a quasi-experimental investigation of an adaptation of Dialectical
Behavior Therapy (DBT) with a group of suicidal adolescents with borderline
personality features. The DBT group (n = 29) received 12 weeks of twice weekly
therapy consisting of individual therapy and a multifamily skills training group.
The treatment as usual (TAU) group (n = 82) received 12 weeks of twice weekly
supportive-psychodynamic individual therapy plus weekly family therapy. Despite
more severe pre-treatment symptomatology in the DBT group, at post-treatment
this group had significantly fewer psychiatric hospitalizations during treatment,
and a significantly higher rate of treatment completion than the TAU group.
There were no significant differences in the number of suicide attempts made
during treatment. Examining pre-post change within the DBT group, there were
significant reductions in suicidal ideation, general psychiatric symptoms, and
symptoms of borderline personality. DBT appears to be a promising treatment
for suicidal adolescents with borderline personality characteristics.

!DB notes:
quasi experimental trial - 29 in the DBT-A arm (12 weeks of DBT), 82 in the TAU arm (12 weeks of twice weekly individual and family sessions.)

Assignment was non-randomised and related to symptom severity - two criteria (a) recent suicide attempt - last 16 weeks, and (b) Borderline PD (minimum of three borderline personality features as measured by the SCID-II).  BOTH criteria met - go to DBT-A, ONE criterion met - go to TAU.

there were significant pre-treatment group differences (as would be expected from the diff criteria applied)


!Described in [[Miller, 00]] - see [[02.DBT]] for material from that review.

Miller, 00 describes the early pilot study (1999) as follows:
In a quasi-experimental pilot investigation of 111 suicidal adolescents (ages 12–19) diagnosed with borderline personality traits, Rathus and Miller (1999)  examined whether DBT-A was more effective than TAU at: 

#reducing psychiatric hospitalizations
#increasing treatment completion rates
#reducing suicide attempts with intent to die. 

Treatment as Usual was comprised of 12 weeks of twice-weekly individual
and family therapy.

Results indicated significant differences between groups: Thirteen percent of TAU
subjects were psychiatrically hospitalized during treatment, while 0% were in DBT-A,
and 40% of TAU subjects completed treatment as compared to 62% of DBT-A. There
were no significant differences between groups in number of suicide attempts (9% for the
TAU group and 3% for the DBT group). However, because the DBT-A group was classified
initially as more impulsive, was diagnosed with a greater number of Axis-I disorders,
and had a greater number of prior hospitalizations than the TAU group, it is possible
that the DBT-A group was actually at higher risk for suicidality. Thus, the fact that they
were no more suicidal than the TAU group during treatment is noteworthy. Examining
pre-post change within the DBT-A group, there were significant reductions in suicidal
ideation and Axis-I and Axis-II symptomatology. Pilot data from the DBT-A appears
promising, but future research calls for the employment of a randomized control design
that also includes observer ratings of change.

!DBT-A as described in [[Miller, 00]]:
Another promising intervention that has been developed for suicidal adolescents, but
has not yet been tested empirically in a randomized controlled study, is Miller et al.’s (1997) Dialectical Behavior Therapy for Adolescents (DBT-A).

As previously mentioned, DBT-A is a modified version of Linehan’s (1993a) DBT, which has been shown in
clinical trials to be significantly better than TAU in reducing parasuicidal behavior, the
number of inpatient psychiatric days, drop-out rate, and anger, as well as improving
social adjustment and treatment compliance among women with BPD (Koons, Robins,
Bishop, Morse, & Lynch, 1998; Linehan et al., 1991).

From Linehan’s behavioral perspective, suicidal behaviors are conceptualized as maladaptive
attempts to regulate feelings or escape and avoid overwhelming and intensely
painful negative emotions.

Thus, DBT targets the following problem areas:

   1. confusion about self
   2. emotional dysregulation
   3. impulsivity
   4. interpersonal problems.

This treatment targets these four problem areas by teaching corresponding behavioral skills modules aimed at increasing adaptive behaviors while simultaneously reducing maladaptive behaviors.

The four skill modules are as follows:

   1. mindfulness
   2. emotional regulation
   3. distress tolerance
   4. interpersonal effectiveness.
* In standard DBT, treatment lasts for one year.
* The patient attends a didactic group once a week that focuses on teaching patients skills in the four target areas mentioned above.
* Patients in DBT also attend individual therapy once per week in which the therapist uses both:
**change strategies (e.g., behavioral analyses, cognitive modification, exposure to emotional cues) and
**acceptance strategies (e.g., validation strategies). 
* Between sessions, the patient is encouraged to page or call the therapist to help problem solve during crises and to enhance skills generalization.
* Finally, there is a weekly consultation group for DBT therapists that aims to enhance therapists’ capabilities and to increase motivation to work with this difficult population.

Miller et al. (1997) modified standard DBT in several ways to address better the specific needs of suicidal adolescents in an inner-city outpatient clinic.

In brief, these modifications included:

   1. shortening the first phase of treatment from one year to twelve weeks;
   2. including parents in the skills-training group, with the goal of improving

adolescents’ often dysfunctional, invalidating environments, and teaching them skills they ultimately may use to coach their teens;

   1. including parents or other family members in individual therapy sessions when familial issues seem paramount;
   2. reducing the number of skills taught in order to facilitate learning the content in 12 weeks;
   3. simplifying the language on the skills handouts to make them developmentally appropriate for adolescents;
   4. offering an optional 12- to 24-week follow-up consultation group (Phase 2) to those patients who graduate from the first phase of treatment. This group is designed to help patients apply the skills learned in the first phase of treatment to their current life problems, relying heavily on peer teaching and reinforcement.

Initial outcome data on the 12-week DBT-A program have yielded promising results. (see [[Rathus and Miller, 02]])

(function($) {

var cmd = config.commands.refreshTiddler = {
	text: "refresh",
	locale: {
		refreshing: "Refreshing tiddler..."
	tooltip: "refresh this tiddler to be the one on the server",
	handler: function(ev, src, title) {
		var tiddler = store.getTiddler(title);
		if(!tiddler) {
			tiddler = new Tiddler(title);
			merge(tiddler.fields, config.defaultCustomFields);
		var dirtyStatus = store.isDirty();
		story.loadMissingTiddler(title, {
			"server.workspace": tiddler.fields["server.recipe"]  ? "recipes/" + tiddler.fields["server.recipe"] :
				tiddler.fields["server.workspace"] || "bags/"+tiddler.fields["server.bag"],
			"": tiddler.fields[""],
			"server.type": tiddler.fields["server.type"]
		}, function() {

<div macro='slideRevision'></div>
<div class='heading'>
	<span class="titleBar">
		<div class='title' macro='view title text'></div>
	<span class='modifierIcon'
		macro='view modifier SiteIcon label:no height:48 width:48 preserveAspectRatio:yes'>
	<div class='toolbar'
		macro='toolbar [[ToolbarCommands::RevisionToolbar]] icons:yes height:48 width:48 more:popup'>
	<div class='tagClear'></div>
<div class='content'>
	<div class='viewer' macro='view text wikified'></div>
<div class='tagInfo'>
	<div class='tidTags' macro='tags'></div>
	<div class='tagging' macro='tagging'></div>
|''Description''|provides access to tiddler revisions|
|''Contributors''|Martin Budden|
Extend [[ToolbarCommands]] with {{{revisions}}}.
!Revision History
!!v0.1 (2009-07-23)
* initial release (renamed from experimental ServerCommandsPlugin)
!!v0.2 (2010-03-04)
* suppressed wikification in diff view
!!v0.3 (2010-04-07)
* restored wikification in diff view
* added link to side-by-side diff view
!To Do
* strip server.* fields from revision tiddlers
* resolve naming conflicts
* i18n, l10n
* code sanitizing
* documentation
(function($) {

jQuery.twStylesheet(".diff { white-space: pre, font-family: monospace }",
	{ id: "diff" });

var cmd = config.commands.revisions = {
	type: "popup",
	hideShadow: true,
	text: "revisions",
	tooltip: "display tiddler revisions",
	revTooltip: "", // TODO: populate dynamically?
	loadLabel: "loading...",
	loadTooltip: "loading revision list",
	selectLabel: "select",
	selectTooltip: "select revision for comparison",
	selectedLabel: "selected",
	compareLabel: "compare",
	linkLabel: "side-by-side view",
	revSuffix: " [rev. #%0]",
	diffSuffix: " [diff: #%0 #%1]",
	dateFormat: "YYYY-0MM-0DD 0hh:0mm",
	listError: "revisions could not be retrieved",

	handlePopup: function(popup, title) {
		title = this.stripSuffix("rev", title);
		title = this.stripSuffix("diff", title);
		var tiddler = store.getTiddler(title);
		var type = _getField("server.type", tiddler);
		var adaptor = new config.adaptors[type]();
		var limit = null; // TODO: customizable
		var context = {
			host: _getField("", tiddler),
			workspace: _getField("server.workspace", tiddler)
		var loading = createTiddlyButton(popup, cmd.loadLabel, cmd.loadTooltip);
		var params = { popup: popup, loading: loading, origin: title };
		adaptor.getTiddlerRevisionList(title, limit, context, params, this.displayRevisions);

	displayRevisions: function(context, userParams) {
		if(context.status) {
			var callback = function(ev) {
				var e = ev || window.event;
				var revision = resolveTarget(e).getAttribute("revision");
				context.adaptor.getTiddlerRevision(tiddler.title, revision, context,
					userParams, cmd.displayTiddlerRevision);
			var table = createTiddlyElement(userParams.popup, "table");
			for(var i = 0; i < context.revisions.length; i++) {
				var tiddler = context.revisions[i];
				var row = createTiddlyElement(table, "tr");
				var timestamp = tiddler.modified.formatString(cmd.dateFormat);
				var revision = tiddler.fields[""];
				var cell = createTiddlyElement(row, "td");
				createTiddlyButton(cell, timestamp, cmd.revTooltip, callback, null,
					null, null, { revision: revision });
				cell = createTiddlyElement(row, "td", null, null, tiddler.modifier);
				cell = createTiddlyElement(row, "td");
				createTiddlyButton(cell, cmd.selectLabel, cmd.selectTooltip,
					cmd.revisionSelected, null, null, null,
					{ index:i, revision: revision, col: 2 });
				cmd.context = context; // XXX: unsafe (singleton)!?
		} else {
			$("<li />").text(cmd.listError).appendTo(userParams.popup);

	revisionSelected: function(ev) {
		var e = ev || window.event;
		e.cancelBubble = true;
		if(e.stopPropagation) {
		var n = resolveTarget(e);
		var index = n.getAttribute("index");
		var col = n.getAttribute("col");
		while(!index || !col) {
			n = n.parentNode;
			index = n.getAttribute("index");
			col = n.getAttribute("col");
		cmd.revision = n.getAttribute("revision");
		var table = n.parentNode.parentNode.parentNode;
		var rows = table.childNodes;
		for(var i = 0; i < rows.length; i++) {
			var c = rows[i].childNodes[col].firstChild;
			if(i == index) {
				if(c.textContent) {
					c.textContent = cmd.selectedLabel;
				} else {
					c.text = cmd.selectedLabel;
			} else {
				if(c.textContent) {
					c.textContent = cmd.compareLabel;
				} else {
					c.text = cmd.compareLabel;
				c.onclick = cmd.compareSelected;

	compareSelected: function(ev) {
		var e = ev || window.event;
		var n = resolveTarget(e);
		var context = cmd.context;
		context.rev1 = n.getAttribute("revision");
		context.rev2 = cmd.revision;
		context.tiddler = context.revisions[n.getAttribute("index")];
		context.format = "unified";
		context.adaptor.getTiddlerDiff(context.tiddler.title, context,
			context.userParams, cmd.displayTiddlerDiffs);

	displayTiddlerDiffs: function(context, userParams) {
		var tiddler = context.tiddler;
		tiddler.title += cmd.diffSuffix.format([context.rev1, context.rev2]);
		tiddler.text = "{{diff{\n" + context.diff + "\n}}}";
		tiddler.tags = ["diff"];
		tiddler.fields.doNotSave = "true"; // XXX: correct?
		if(!store.getTiddler(tiddler.title)) {
		var src = story.getTiddler(userParams.origin);
		var tiddlerEl = story.displayTiddler(src, tiddler);
		var uri = context.uri.replace("format=unified", "format=horizontal");
		var link = $('<a target="_blank" />').attr("href", uri).text(cmd.linkLabel);
		$(".viewer", tiddlerEl).prepend(link);

	displayTiddlerRevision: function(context, userParams) {
		var tiddler = context.tiddler;
		tiddler.title += cmd.revSuffix.format([tiddler.fields[""]]);
		tiddler.fields.doNotSave = "true"; // XXX: correct?
		if(!store.getTiddler(tiddler.title)) {
		var src = story.getTiddler(userParams.origin);
		story.displayTiddler(src, tiddler);

	stripSuffix: function(type, title) {
		var str = cmd[type + "Suffix"];
		var i = str.indexOf("%0");
		i = title.indexOf(str.substr(0, i));
		if(i != -1) {
			title = title.substr(0, i);
		return title;

var _getField = function(name, tiddler) {
	return tiddler.fields[name] || config.defaultCustomFields[name];

Jo Robinson , Sarah E . Hetrick , Cathy Martin (2011) Preventing suicide in young people:
systematic review.  Australian and New Zealand Journal of Psychiatry 2011; 45:3–26

Risk of suicide attempt, suicidal ideation and deliberate self-harm is high among
young people, yet limited evidence exists regarding effective interventions, particularly from
randomized controlled trials. The aim of this study was to conduct a systematic review and
meta-analysis of all randomized controlled trials testing interventions for adolescents and
young adults who have presented to a clinical setting with any of these behaviours.

The Cochrane Central Register of Controlled Trials, Medline, EMBASE and PsycINFO
were searched for articles published from 1980 to June 2010. The following keywords
formed the basis of the search strategy: ‘ self-injurious behaviour ’ , ‘ attempted suicide ’ ,
‘ suicide ’ , ‘ suicidal behaviour ’ , ‘ self-infl icted wounds ’ , ‘ self-mutilation ’ , ‘ self-harm ’ . We also hand searched conference abstracts from two major suicide prevention conferences and the
reference lists of all retrieved articles and previous reviews.
There were 15 trials included in the review, with six ongoing trials also identifi ed.
In general, the reporting of the conduct of trials was poor, making it difficult to assess the
risk of bias. The reporting of outcome data was inconsistent. No differences were found
between treatment and control groups except in one study that found a difference between
individual cognitive behavioural therapy and treatment as usual.
The evidence regarding effective interventions for adolescents and young
adults with suicide attempt, deliberate self-harm or suicidal ideation is extremely limited.
Many more methodologically rigorous trials are required. However, in the meantime CBT
shows some promise, but further investigation is required in order to determine its ability to
reduce suicide risk among young people presenting to clinical services.

!Papers reviewed by Robinson et al

10. Brent G, Greenhill LL, Compton S e t al . The treatment of adolescent
suicide attempters (TASA): Predictors of suicidal events in an
open treatment trial. J Am Acad Child Adolesc Psychiatry 2009;
11. Rudd MD, Rajab MH, Orman DT, Joiner T, Stulman DA, Dixon W.
Effectiveness of an outpatient intervention targeting suicidal
young adults: preliminary results. J Consult Clin Psychol 1996;
64:179–190.@@ >22yrs sample @@
12. Turner RM. Naturalistic evaluation of dialectical behavior therapyoriented
treatment for borderline personality disorder. Cogn Behav
Practice 2000; 7:413–419. – @@18 – 27 yr old sample@@
13. Power PJR, Bell RJ, Mills R e t al . Suicide prevention in fi rst
episode psychosis: the development of a randomized controlled
trial of cognitive therapy for acutely suicidal patients with early
psychosis. Aust N Z J Psychiatry 2003; 37:414–420. @@age sample 15 - 29@@
14. Cotgrove AJ, Zirinsky L, Black D, Weston D. Secondary prevention
of attempted suicide in adolescence. J Adolesc 1995; 18:
15. Harrington R, Kerfoot M, Dyer E e t al . Randomized trial of a
home-based family intervention for children who have deliberately
poisoned themselves. J Am Acad Child Adolesc Psychiatry 1998;
16. Spirito A, Boergers J, Donaldson D, Bishop D, Lewander W. An
intervention trial to improve adherence to community treatment
by adolescents after a suicide attempt. J Am Acad Child Adolesc
Psychiatry 2002; 41:435–442.
17. King CA, Kramer A, Preuss L e t al . Youth-nominated support
team for suicidal adolescents (version 1): a randomized controlled
trial. J Consult Clin Psychol 2006; 74:199–206.
18. King CA, Klaus N, Kramer A, Venkataraman S, Quinlan P,
Gillespie B. The youth-nominated support team – version II for
suicidal adolescents: a randomized controlled intervention trial.
J Consult Clin Psychol 2009; 77:880–893.
19. Donaldson D, Spirito A, Esposito-Smythers C, Donaldson D,
Spirito A, Esposito-Smythers C. Treatment for adolescents following
a suicide attempt: results of a pilot trial. J Am Acad Child
Adolesc Psychiatry 2005; 44:113–120.
20. McLeavey B, Daly RJ, Ludgate JW, Murray CM. Interpersonal
problem-solving skills training in the treatment of self-poisoning
patients. Suicide Life Threat Behav 1994; 24:382–394.
21. Slee N, Garnefski N, Van Der Leeden R, Arensman E, Spinhoven
P. Cognitive-behavioural intervention for self-harm: randomised
controlled trial. Br J Psychiatry 2008; 192:202–211. – @@sample aged 15 - 35@@
22. Hazell PL, Martin G, McGill K, Wood TK, Trainor G, Harrington
R. Group therapy for repeated deliberate self-harm in adolescents:
failure of replication of a randomized trial. J Am Acad Child Adolesc
Psychiatry 2009; 48:662–670.
Wood A, Trainor G, Rothwell J, Moore A, Harrington R.
Randomized trial of group therapy for repeated deliberate selfharm
in adolescents. J Am Acad Child Adolesc Psychiatry 2001;
24. Diamond GS, Wintersteen MB, Brown GK e t al . Attachment-based
family therapy for adolescents with suicidal ideation: a randomized
controlled trial. J Am Acad Child Adolesc Psychiatry 2010;
Rodham, Karen PH.D.; Hawton, Keith D.SC.; Evans, Emma B.SC. (HONS)
!Reasons for Deliberate Self-Harm: Comparison of Self-Poisoners and Self-Cutters in a Community Sample of Adolescents
Journal of the American Academy of Child & Adolescent Psychiatry: January 2004 - Volume 43 - Issue 1 - pp 80-87
!Objective: To compare motives and premeditation between adolescent deliberate self-poisoners and self-cutters.

In a sample of 6,020 pupils aged 15 and 16 years who completed a self-report questionnaire, those who had deliberately cut themselves in the previous year (n = 220) were compared with those who had taken overdoses (n = 86).
More adolescents who took overdoses than those who cut themselves said that they had wanted to die (66.7% versus 40.2%, χ2 = 14.94, p < .0001) and had wanted to find out if someone loved them (41.2% versus 27.8%, χ2 = 4.14, p = .042). Female self-cutters were more likely than male self-cutters to say that they had wanted to punish themselves (51.0% versus 25.0%, χ2 = 9.25, p = .002) and had tried to get relief from a terrible state of mind (77.2% versus 60.9%, χ2 = 4.78, p = .029). More self-cutters than self-poisoners had thought about the act of self-harm for less than an hour beforehand (50.9% versus 36.1%, χ2 = 5.25, p = .021)
There are differences between adolescents' motives for overdoses and for self-cutting, and also gender differences in the reasons for self-cutting. The often impulsive nature of these acts (especially self-cutting) means that prevention should focus on encouraging alternative methods of managing distress, problem-solving, and help-seeking before thoughts of self-harm develop.

Rates of suicide have risen in young males in many countries since the 1970s, and despite a slight downward trend in recent years, suicide is now the second or third most frequent cause of death among 15- to 24-year-olds in several countries (Centers for Disease Control and Prevention, 1995; Commonwealth Department of Health and Family Services, 1997). Worldwide, nonfatal, deliberate self-harm is usually most common in young people, especially young females (Schmidtke et al., 1996). This is particularly true in the United Kingdom, where adolescents and young adults are involved in more hospital presentations to general hospitals for deliberate self-harm than any other age group, with females in the 15- to 19-year age group being particularly vulnerable (Hawton et al., 1997). Most episodes of deliberate self-harm in adolescents who present to the hospital involve overdoses; hence, most information on this problem is about self-poisoners, especially females.

Studies of adolescents who have deliberately harmed themselves and presented to general hospitals have demonstrated that their behavior is often impulsive, in terms of involving little premeditation (Apter et al., 1993; Hawton et al., 1982a) and usually being precipitated by relationship problems with family or friends, difficulties with schoolwork, or disciplinary crises, (Beautrais et al., 1997; Hawton et al., 1982b), but in many cases it also occurs in the context of depressive, anxiety, and behavioral disorders (Burgess et al., 1998; Kerfoot et al., 1996). Repetition of self-harm is common, and there is a significant association with eventual suicide (Goldacre and Hawton, 1985; Sellar et al., 1990), particularly where substance abuse is present (Hawton et al., 1993).

It has become increasingly clear that much deliberate self-harm occurs in the community but does not result in hospital presentation (Choquet and Ledoux, 1994; Hawton et al., 1996). On the basis of a large school-based study, we recently showed that 6.9% of adolescents had had an episode of deliberate self-harm in the previous year, and only 12.6% of these had been referred to the hospital (Hawton et al., 2002).

An important aspect of understanding the factors that lead to deliberate self-harm is examination of the motives (or intentions) and premeditation involved. Several studies have focused on this (Bancroft et al., 1976, 1979; Hjelmeland et al., 2002; Williams, 1986). The principal findings in a study of adolescents who presented to the hospital after overdoses were that approximately a third said they had wanted to die at the time of the acts and that many acts involved relatively short premeditation (Hawton et al., 1982a). The most common motives chosen by the adolescents from a list of possibilities were to get relief from distress, to escape from their situation, and to show other people how desperate they were feeling. Boegers et al. (1998) obtained similar results in a study of American adolescents who had harmed themselves. These studies have, however, all been confined to patients admitted to the hospital as a result of self-poisoning. There are two limitations to this approach. First, those who engage in deliberate self-harm but who do not go to the hospital as a result are not included; such a strategy therefore omits a potentially large group of self-harmers, namely those who do not receive medical attention. Second, since the focus of these studies has solely been on those who take overdoses, our current understanding of the motives and premeditation involved in self-harming can only be applied to those who take overdoses and receive medical treatment.

There is clearly a need for information on the motives of adolescents who engage in deliberate self-harm and who do not receive medical treatment, including those who choose methods other than overdose. Such an investigation will widen our understanding of the motives for this behavior and will provide information that can assist helping agencies and those planning preventive initiatives. The aims of the present study were to examine the motives of a group of adolescent self-harmers from a community sample, to compare the motives of those who engaged in self-poisoning with those who chose self-cutting, to examine the premeditation involved, and to investigate gender differences.
!go to paper
Rotheram-Borus MJ, Piacentini J, Miller S, Graae F, Castro-Blanco D. (1994)
!!Brief cognitive-behavioral treatment for adolescent suicide attempters and their families.
J Am Acad Child Adolesc Psychiatry. 1994 May;33(4):508-17.
This article describes a brief, standardized, cognitive-behavioral treatment program for adolescent suicide attempters and their families.
Successful Negotiation Acting Positively (SNAP) treatment consists of a series of structured activities that create a positive family atmosphere, teach problem-solving skills, shift the family's understanding of their problems to troublesome situations rather than difficult individuals, and build confidence in the treatment professional, thereby reducing conditions associated with future attempts.
SNAP treatment has been systematically administered to more than 100 suicidal adolescents and their families as part of an ongoing treatment study. Although these results are not yet available, our initial experience suggests that SNAP treatment can be delivered in a reliable fashion and is well accepted by both patients and therapists.
Although suicidality in youth constitutes a major public health problem, few therapeutic interventions have been developed specifically for suicidal adolescents. SNAP treatment addresses a number of issues critical to successful interventions with this population, including their historically poor treatment compliance, the need for family involvement in treatment, and an emphasis on coping and problem-solving strategies. Moreover, the brief, structured format of SNAP treatment is consistent with the growing trend toward standardized, empirically tested, and cost-efficient interventions.
!See also:
*Piacentini, J. C., Rotheram-Borus, M. J., & Cantwell, C. (1995). Brief cognitive-behavioral family therapy for suicidal adolescents. In L. VandeCreek, S. Knapp & T. L. Jackson (Eds.), Innovations in clinical practice: A source book, vol. 14. (pp. 151-168). Sarasota, FL, US: 
Professional Resource Press/Professional Resource Exchange.
*Outcome study: [[Rotheram-Borus et al, 1996]]
!Enhancing Treatment Adherence with a Specialized Emergency Room Program for Adolescent Suicide Attempters
Rotheram-Borus, Mary Jane PhD; Piacentini, John PhD; Van Rossem, Ronan PhD; Graae, Flemming MD; Cantwell, Coleen BA; Castro-Blanco, David PhD; Miller, Sutherland PhD; Feldman, Julie BA
J. Am. Acad. Child Adolesc. Psychiatry, 1996, 35(5):654-663
 The evaluation of outpatient treatment adherence among 140 Latina adolescent suicide attempters and their families.
Sequentially, 75 attempters received standard emergency room care and 65 attempters received a specialized emergency room program including (1) training workshops for emergency room staff, (2) a videotape aimed at modifying families' treatment expectations, and (3) an on-call family therapist.
Attempters receiving the specialized program were more likely to attend one treatment session (95.4% versus 82.7%) and were somewhat more likely to attend more sessions (5.7 versus 4.7) than those receiving standard emergency room care; however, their mothers were less likely to complete treatment. In addition, participants receiving the specialized program reported reduced psychiatric symptoms, and mothers reported more positive attitudes toward treatment and perceptions of family interactions.
Adherence was significantly improved by receiving the specialized care program in the emergency room. Adherence was also associated with increased suicidal ideation, more cohesive family relations, and lower self-esteem at baseline.
!18 month follow up - [[Rotheram-Borus et al, 2000]]
Journal of Consulting and Clinical Psychology
2000, Vol. 68, No. 6, 1081-1093
!The 18-Month Impact of an Emergency Room Intervention for Adolescent Female Suicide Attempters
Mary Jane Rotheram-Borus, John Piacentini, Coleen Cantwell, Thomas R. Belin, and Juwon Song
University of California, Los Angeles
Following a suicide attempt by female adolescents, the impact of a specialized emergency room (ER)
care intervention was evaluated over the subsequent 18 months. Using a quasi-experimental design, this
study assigned 140 female adolescent suicide attempters (SA), ages 12-18 years, and their mothers (88%
Hispanic) to receive during their ER visit either: (a) specialized ER care aimed at enhancing adherence
to outpatient therapy by providing a soap opera video regarding suicidality, a family therapy session, and
staff training; or (b) standard ER care. The adjustment of the SA and their mothers was evaluated over 18
months (follow-up, 92%) using linear mixed model regression analyses. SA's adjustment improved over
time on most mental health indices. Rates of suicide reattempts (12.4%) and suicidal reideation (29.8%)
were lower than anticipated and similar across ER conditions. The specialized ER care condition was
associated with significantly lower depression scores by the SA and lower maternal ratings on family
cohesion. Significant interactions of intervention condition with the SA's initial level of psychiatric
symptomatology indicated that the intervention's impact was greatest on maternal emotional distress and
family cohesion among SA who were highly symptomatic. SA's attendance at therapy sessions following
the ER visit was significantly associated with only one outcome—family adaptability. Specialized ER
interventions may have substantial and sustained impact over time, particularly for the parents of youth
with high psychiatric symptomatology.
!!NB - [[Burns, 05]] describes this as "quasi-experimental historical controls"

!!Quoted in [[Brent, 01]]:
Rotheram-Borus et al. (ROTHERAM-BORUS, M.J., J. PIACENTINI, R. VAN ROSSEM, et al. 1996. Enhancing
treatment adherence with a specialized emergency room program for adolescent
suicide attempters. J. Am. Acad. Child Adolesc. Psychiatry 35: 654–663) randomized 140 Latina adolescent suicide attempters to a brief cognitive behavioral family therapy either alone or in combination with a specialized emergency room intervention designed to increase compliance. The combination of the emergency room and family intervention resulted in improved compliance, lower maternal depression, improved family interaction, and lower adolescent depression and suicidality
than did the family intervention alone.

!!Reviewed in [[Miller, 00]]:
Borus and colleagues (1996) studied the effects of a specialized emergency room (ER)
program on subsequent treatment adherence among 75 female adolescent suicide attempters.
The specialized ER program included: (1) training workshops for ER staff designed
to impact the expectations and behavior of service-care providers serving adolescent
suicide attempters and their families, (2) a videotape shown to attempters and their families
in the ER to provide families with a better understanding of adolescent suicidality
and the course of outpatient therapy, and (3) a brief family treatment session conducted
by a crisis therapist in the ER. After subjects were evaluated in the ER (either with or
without the specialized program), they then were referred to a six-session outpatient
treatment program called Successful Negotiation/Acting Positively (SNAP; Rotheram-
Borus, Piacentini, Miller, Graae, & Castro-Blanco, 1994). The authors found that attempters
receiving the specialized program had better treatment adherence in the SNAP program
than attempters who received standard ER care.
The specialized ER program also had several other immediate effects on the family
that lasted for at least a few days after they left the ER. For example, adolescents in the
experimental group had lower depression levels and less suicidal ideation than the controls
after their discharge from the ER. Thus, it appears that training the ER staff to work
with suicidal patients and providing patients and families with psychoeducation are, in
and of themselves, useful interventions in decreasing suicidal ideation, even before outpatient
treatment is initiated. Similarly, after the ER visit, mothers in the treatment groups
reported lower levels of depression, less overall psychopathology, and more positive
attitudes toward treatment than mothers in the control group. In spite of these positive
outcomes for the mothers, mothers in the experimental condition were less likely to
attend treatment sessions than mothers in the control group. While this study suggests
Youth Suicide: Assessment and Intervention 1141
that adolescent compliance with outpatient treatment may increase with specialized ER
care, there were no baseline measures reported in this study, making it difficult to rule out
preintervention factors that might have influenced outcomes.
There are no known published studies examining the effectiveness of the post-ER
SNAP program in the Rotheram-Borus et al. (1996) study. However, the SNAP treatment
is worth noting as one of the few therapies designed specifically for suicidal adolescents.
It involves a six-session structured outpatient treatment program for adolescent suicide
attempters and their families based on cognitive-behavioral principles. For a detailed
description of the program, see Rotheram-Borus et al. (1994)."

!Reviewed in [[Burns, 05]]
Recent suicide attempt;
Latina females, ED in New York; I = 65,
C = 75;
mean age 15 years
Workshops for ED staff;
Video and manuals for families;
On call family therapist;
Both groups offered a 6-week CBT
!!!Results and Limitations
NB ''Repeat self-harm was not reported'';
Rx Vs Control (?Quasi-experimental historical - check?)
Missed appointments 31/65 v 46/75
(RR = 0.78, 95% CI 0.57–1.06);
Suicidal ideation mean score 1.4
(SD = 2.38) v 2.1 (SD = 2.86), p
3, 6, 12 and
18 months
Self-Harm. (accessed 22.05.09)
!!From [[Miller, 00]]:
"Rudd and colleagues (1994) also studied the efficacy of a ''short-term group treatment''
that emphasized ''problem-solving skills'' among suicidal adolescents/young adults in clinical settings (outpatient clinics, inpatient services, and emergency rooms). 

A total of 264 subjects randomly were assigned either to a structured group intervention in a partial
hospital setting or to TAU. Subjects in the experimental treatment spent approximately
nine hours each day at the treatment facility for a two-week period. The treatment involved
three basic components: a traditional experiential–affective group, psychoeducational
classes, and an extended problem-solving group. A disproportionate amount of time was
dedicated to the problem-solving component of treatment, with subjects spending approximately
three and a half hours a day in the problem-solving groups.

The subjects assigned to the TAU control condition received a combination of inpatient
and outpatient care. Outpatient care often involved a combination of individual and
group treatment with varying theoretical orientations.
Subjects were assessed every six months for 24 months. 
!!!Analyses of ''treatment outcomes'' found ''__no significant differences between the two treatment groups__''. 
In fact, ''both treatment groups showed a significant reduction'' of suicidal ideation, suicidal behavior,
psychopathology, and improvements in problem-solving ability. Although there were no
between-group differences in outcome measures, the results suggest that high-risk patients
can be treated as effectively in an intensive, short-term outpatient group as with traditional
approaches, such as hospitalization or long-term psychotherapy.

A ''major limitation'' to this study was that the ''attrition rates were high'', particularly for
the control group. ''By the 12-month assessment, the attrition rate was 79% for the control
subjects, which was significantly higher than the attrition rate of 68% for the treatment
group.'' It was noted that ''a disproportionate number of subjects who dropped out were classified as poor problem solvers at intake.''

Rudd et al.’s (1994) high attrition rate among suicidal young adults highlights the
common finding of poor treatment compliance among adolescents (e.g., Piacentini et al.,
1995; Spirito, Brown, Overholser, & Fritz, 1989). In order to address this issue, [[Rotheram-Borus, 96]] studied the effects of a specialized emergency room (ER)
program on subsequent treatment adherence among 75 female adolescent suicide attempters.

 Scanlon, C. & Adlam, J. (in press July 2009) ‘“Why do you treat me this way?”: reciprocal violence and the mythology of ‘deliberate self harm’’, pp.55-81 in A. Motz (ed.) Managing Self Harm: Psychological Perspectives. London: Routledge.
|''Description''|server-side saving|
This plugin relies on a dedicated adaptor to be present.
The specific nature of this plugin depends on the respective server.
!Revision History
!!v0.1 (2008-11-24)
* initial release
!!v0.2 (2008-12-01)
* added support for local saving
!!v0.3 (2008-12-03)
* added Save to Web macro for manual synchronization
!!v0.4 (2009-01-15)
* removed ServerConfig dependency by detecting server type from the respective tiddlers
!!v0.5 (2009-08-25)
* raised CoreVersion to 2.5.3 to take advantage of core fixes
!!v0.6 (2010-04-21)
* added notification about cross-domain restrictions to ImportTiddlers
!To Do
* conflict detection/resolution
* rename to ServerLinkPlugin?
* document deletion/renaming convention
(function($) {

readOnly = false; //# enable editing over HTTP

var plugin = config.extensions.ServerSideSavingPlugin = {};

plugin.locale = {
	saved: "%0 saved successfully",
	saveError: "Error saving %0: %1",
	saveConflict: "Error saving %0: edit conflict",
	deleted: "Removed %0",
	deleteError: "Error removing %0: %1",
	deleteLocalError: "Error removing %0 locally",
	removedNotice: "This tiddler has been deleted.",
	connectionError: "connection could not be established",
	hostError: "Unable to import from this location due to cross-domain restrictions."

plugin.sync = function(tiddlers) {
	tiddlers = tiddlers && tiddlers[0] ? tiddlers : store.getTiddlers();
	$.each(tiddlers, function(i, tiddler) {
		var changecount = parseInt(tiddler.fields.changecount, 10);
		if(tiddler.fields.deleted === "true" && changecount === 1) {
		} else if(tiddler.isTouched() && !tiddler.doNotSave() &&
				tiddler.getServerType() && tiddler.fields[""]) { // XXX: could be empty string
			delete tiddler.fields.deleted;

plugin.saveTiddler = function(tiddler) {
	try {
		var adaptor = this.getTiddlerServerAdaptor(tiddler);
	} catch(ex) {
		return false;
	var context = {
		tiddler: tiddler,
		changecount: tiddler.fields.changecount,
		workspace: tiddler.fields["server.workspace"]
	var serverTitle = tiddler.fields["server.title"]; // indicates renames
	if(!serverTitle) {
		tiddler.fields["server.title"] = tiddler.title;
	} else if(tiddler.title != serverTitle) {
		return adaptor.moveTiddler({ title: serverTitle },
			{ title: tiddler.title }, context, null, this.saveTiddlerCallback);
	var req = adaptor.putTiddler(tiddler, context, {}, this.saveTiddlerCallback);
	return req ? tiddler : false;

plugin.saveTiddlerCallback = function(context, userParams) {
	var tiddler = context.tiddler;
	if(context.status) {
		if(tiddler.fields.changecount == context.changecount) { //# check for changes since save was triggered
		} else if(tiddler.fields.changecount > 0) {
			tiddler.fields.changecount -= context.changecount;
		plugin.reportSuccess("saved", tiddler);
	} else {
		if(context.httpStatus == 412) {
			plugin.reportFailure("saveConflict", tiddler);
		} else {
			plugin.reportFailure("saveError", tiddler, context);

plugin.removeTiddler = function(tiddler) {
	try {
		var adaptor = this.getTiddlerServerAdaptor(tiddler);
	} catch(ex) {
		return false;
	var context = {
		host: tiddler.fields[""],
		workspace: tiddler.fields["server.workspace"],
		tiddler: tiddler
	var req = adaptor.deleteTiddler(tiddler, context, {}, this.removeTiddlerCallback);
	return req ? tiddler : false;

plugin.removeTiddlerCallback = function(context, userParams) {
	var tiddler = context.tiddler;
	if(context.status) {
		if(tiddler.fields.deleted === "true") {
		} else {
			plugin.reportFailure("deleteLocalError", tiddler);
		plugin.reportSuccess("deleted", tiddler);
	} else {
		plugin.reportFailure("deleteError", tiddler, context);

plugin.getTiddlerServerAdaptor = function(tiddler) { // XXX: rename?
	var type = tiddler.fields["server.type"] || config.defaultCustomFields["server.type"];
	return new config.adaptors[type]();

plugin.reportSuccess = function(msg, tiddler) {

plugin.reportFailure = function(msg, tiddler, context) {
	var desc = (context && context.httpStatus) ? context.statusText :
	displayMessage(plugin.locale[msg].format([tiddler.title, desc]));

config.macros.saveToWeb = { // XXX: hijack existing sync macro?
	locale: { // TODO: merge with plugin.locale?
		btnLabel: "save to web",
		btnTooltip: "synchronize changes",
		btnAccessKey: null

	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		createTiddlyButton(place, this.locale.btnLabel, this.locale.btnTooltip,
			plugin.sync, null, null, this.locale.btnAccessKey);

// hijack saveChanges to trigger remote saving
var _saveChanges = saveChanges;
saveChanges = function(onlyIfDirty, tiddlers) {
	if(window.location.protocol == "file:") {
		_saveChanges.apply(this, arguments);
	} else {

// override removeTiddler to flag tiddler as deleted -- XXX: use hijack to preserve compatibility?
TiddlyWiki.prototype.removeTiddler = function(title) { // XXX: should override deleteTiddler instance method?
	var tiddler = this.fetchTiddler(title);
	if(tiddler) {
		tiddler.tags = ["excludeLists", "excludeSearch", "excludeMissing"];
		tiddler.text = plugin.locale.removedNotice;
		tiddler.fields.deleted = "true"; // XXX: rename to removed/tiddlerRemoved?
		tiddler.fields.changecount = "1";
		this.notify(title, true);

// hijack ImportTiddlers wizard to handle cross-domain restrictions
var _onOpen = config.macros.importTiddlers.onOpen;
config.macros.importTiddlers.onOpen = function(ev) {
	var btn = $(resolveTarget(ev));
	var url = btn.closest(".wizard").find("input[name=txtPath]").val();
	if(window.location.protocol != "file:" && url.indexOf("://") != -1) {
		var host = url.split("/")[2];
		var macro = config.macros.importTiddlers;
		if(host != {
			btn.text(macro.cancelLabel).attr("title", macro.cancelPrompt);
			btn[0].onclick = macro.onCancel;
			$('<span class="status" />').text(plugin.locale.hostError).insertAfter(btn);
			return false;
	return _onOpen.apply(this, arguments);

!Gay and Lesbian
!!Sexual orientation and suicide attempt: a longitudinal study of the general Norwegian adolescent population.
J Abnorm Psychol. 2003 Feb;112(1):144-51.
Wichstrøm L, Hegna K.
Past and future suicide attempt rates among gay, lesbian, and bisexual (GLB) young people were compared with those of heterosexual young people. A sample of Norwegian students (N = 2.924; grades 7-12) was followed in 3 data collection waves. Risk factors included previous suicide attempt,depressed mood, eating problems, conduct problems, early sexual debut, number of sexual partners, pubertal timing, self-concept, alcohol and drug use, atypical gender roles, loneliness, peer relations, social support, parental attachment, parental monitoring, and suicidal behavior among family and friends. When homosexual attraction, homosexual identity, and same-sex sexual behavior were entered to predict suicide attempt, only same-sex sexual behavior was significantly predictive. The increased odds could not be attributed to GLB students' greater exposure to risk factors for suicide attempt.

!Sexual Orientation and Risk of Suicide Attempts Among a Representative Sample of Youth
Robert Garofalo, MD; R. Cameron Wolf, MS; Lawrence S. Wissow, MD, MPH; Elizabeth R. Woods, MD, MPH; Elizabeth Goodman, MD
Arch Pediatr Adolesc Med. 1999;153:487-493.

!!!Objective  To examine whether sexual orientation is an independent risk factor for reported suicide attempts.
!!!Design  Data were from the Massachusetts 1995 Centers for Disease Control and Prevention Youth Risk Behavior Survey, which included a question on sexual orientation. Ten drug use, 5 sexual behavior, and 5 violence/victimization variables chosen a priori were assessed as possible mediating variables. Hierarchical logistic regression models determined independent predictors of suicide attempts.
Public high schools in Massachusetts.
Representative, population-based sample of high school students. Three thousand three hundred sixty-five (81%) of 4167 responded to both the suicide attempt and sexual orientation questions.
!!!Main Outcome Measure  
Self-reported suicide attempt in the past year.
One hundred twenty-nine students (3.8%) self-identified as gay, lesbian, bisexual, or not sure of their sexual orientation (GLBN). Gender, age, race/ethnicity, sexual orientation, and all 20 health-risk behaviors were associated with suicide attempt (P<.001). Gay, lesbian, bisexual, or not sure youth were 3.41 times more likely to report a suicide attempt. Based on hierarchical logistic regression, female gender (odds ratio [OR], 4.43; 95% confidence interval [CI], 3.30-5.93), GLBN orientation (OR, 2.28; 95% CI, 1.39-3.37), Hispanic ethnicity (OR, 2.21; 95% CI, 1.44-3.99), higher levels of violence/victimization (OR, 2.06; 95% CI, 1.80-2.36), and more drug use (OR, 1.31; 95% CI, 1.22-1.41) were independent predictors of suicide attempt (P<.001). Gender-specific analyses for predicting suicide attempts revealed that among males the OR for GLBN orientation increased (OR, 3.74; 95% CI, 1.92-7.28), while among females GLBN orientation was not a significant predictor of suicide.
Gay, lesbian, bisexual, or not sure youth report a significantly increased frequency of suicide attempts. Sexual orientation has an independent association with suicide attempts for males, while for females the association of sexual orientation with suicidality may be mediated by drug use and violence/victimization behaviors.

The Role of Endogenous Opioids in the Pathophysiology of Self-Injurious and Suicidal Behavior
Leo Sher; Barbara H. Stanley
DOI: 10.1080/13811110802324748
!Published in: 
Archives of Suicide Research, Volume 12, Issue 4 October 2008 , pages 299 - 308
Multiple lines of evidence suggest that endogenous opioids are involved in the pathogenesis of non-suicidal self-injury (NSSI). Evidence for such a role is based on the partial success of opioid antagonist treatment to ameliorate NSSI, reports of altered pain sensitivity during episodes of NSSI, and findings of altered endogenous opioid levels in individuals with NSSI. While suicidal behavior (SB) and NSSI are distinct behaviors, NSSI is a significant risk factor for suicide attempts and suicide. The high co-occurrence of SB and NSSI suggests that they may share a common biology. Available data indicate that endogenous opioids may be involved in the pathophysiology of SB. Future studies of the role of opioids in the biological mechanisms of NSSI and SB are merited and may lead to the development of new treatment modalities.
<<tiddler Backstage##Tiddlers>>
Simeon, D., & Favazza, A. R. (2001). Self-injurious behaviors: Phenomenology and assessment. In D. Simeon, & E. Hollander
(Eds.), Self-injurious behaviors: Assessment and treatment ( pp. 1–28). Washington, DC: American Psychiatric Publishing.

Reported by [[Yates, 2004]]
The most recent edition of this (the best accepted) taxonomy proposes four categories of self-injury: 
(1) stereotypic, (2) major, (3) compulsive, and (4)impulsive [[Simeon & Favazza, 2001]]. 
!!!Stereotypic SIB 
is characteristic of persons with pervasive developmental disorders and disabilities (e.g., autism, Rhett’s syndrome, Lesch–Nyhan syndrome, mental retardation, Cornelia de Lange syndrome). It is typically performed independently of the
social context (e.g., in the presence of onlookers), is devoid of affective content (e.g., feeling,
meaning, thought), and has a repetitive, rhythmic, driven quality. 
!!!Major SIB 
includes dramatic and striking examples of mutilation (e.g., autocastration, self-enucleation) that result in permanent and
severe tissue damage. Major self-injury usually occurs as an isolated event during a psychotic
!!!Compulsive SIB 
subsumes repetitive or ritualistic behaviors that occur many times daily (e.g., hair pulling, nail biting, scratching). It is usually categorized as an impulse control disorder in contemporary psychiatric nosology (e.g., trichotillomania). 
!!!Impulsive SIB
may be ''episodic'' or ''repetitive''. Episodic SIB involves intermittent self-injurious events (e.g., cutting, burning, self-hitting) that typically precipitate tension release and mood elevation. Over time, impulsive episodic SIB may
become repetitive, taking on an addiction-like quality for the individual as s/he becomes increasingly preoccupied with SIB.
|''Description''|displays search results as a simple list of matching tiddlers|
|''License''|[[Creative Commons Attribution-ShareAlike 3.0 License|]]|
!Revision History
!!v0.2.0 (2008-08-18)
* initial release
!!v0.3.0 (2008-08-19)
* added Open All button (renders Classic Search option obsolete)
* sorting by relevance (title matches before content matches)
!!v0.4.0 (2008-08-26)
* added tag matching
!To Do
* tag matching optional
* animations for container creation and removal
* when clicking on search results, do not scroll to the respective tiddler (optional)
* use template for search results
if(!version.extensions.SimpleSearchPlugin) { //# ensure that the plugin is only installed once
version.extensions.SimpleSearchPlugin = { installed: true };

if(!config.extensions) { config.extensions = {}; }

config.extensions.SimpleSearchPlugin = {
	heading: "Search Results",
	containerId: "searchResults",
	btnCloseLabel: "close",
	btnCloseTooltip: "dismiss search results",
	btnCloseId: "search_close",
	btnOpenLabel: "Open all",
	btnOpenTooltip: "open all search results",
	btnOpenId: "search_open",

	displayResults: function(matches, query) {
		story.refreshAllTiddlers(true); // update highlighting within story tiddlers
		var el = document.getElementById(this.containerId);
		query = '"""' + query + '"""'; // prevent WikiLinks
		if(el) {
		} else { //# fallback: use displayArea as parent
			var container = document.getElementById("displayArea");
			el = document.createElement("div"); = this.containerId;
			el = container.insertBefore(el, container.firstChild);
		var msg = "!" + this.heading + "\n";
		if(matches.length > 0) {
			msg += "''" +[matches.length.toString(), query]) + ":''\n";
			this.results = [];
			for(var i = 0 ; i < matches.length; i++) {
				msg += "* [[" + matches[i].title + "]]\n";
		} else {
			msg += "''" +[query]) + "''"; // XXX: do not use bold here!?
		createTiddlyButton(el, this.btnCloseLabel, this.btnCloseTooltip, config.extensions.SimpleSearchPlugin.closeResults, "button", this.btnCloseId);
		wikify(msg, el);
		if(matches.length > 0) { // XXX: redundant!?
			createTiddlyButton(el, this.btnOpenLabel, this.btnOpenTooltip, config.extensions.SimpleSearchPlugin.openAll, "button", this.btnOpenId);

	closeResults: function() {
		var el = document.getElementById(config.extensions.SimpleSearchPlugin.containerId);
		config.extensions.SimpleSearchPlugin.results = null;
		highlightHack = null;

	openAll: function(ev) {
		story.displayTiddlers(null, config.extensions.SimpleSearchPlugin.results);
		return false;

config.shadowTiddlers.StyleSheetSimpleSearch = "/*{{{*/\n" +
	"#" + config.extensions.SimpleSearchPlugin.containerId + " {\n" +
	"\toverflow: auto;\n" +
	"\tpadding: 5px 1em 10px;\n" +
	"\tbackground-color: [[ColorPalette::TertiaryPale]];\n" +
	"}\n\n" +
	"#" + config.extensions.SimpleSearchPlugin.containerId + " h1 {\n" +
	"\tmargin-top: 0;\n" +
	"\tborder: none;\n" +
	"}\n\n" +
	"#" + config.extensions.SimpleSearchPlugin.containerId + " ul {\n" +
	"\tmargin: 0.5em;\n" +
	"\tpadding-left: 1.5em;\n" +
	"}\n\n" +
	"#" + config.extensions.SimpleSearchPlugin.containerId + " .button {\n" +
	"\tdisplay: block;\n" +
	"\tborder-color: [[ColorPalette::TertiaryDark]];\n" +
	"\tpadding: 5px;\n" +
	"\tbackground-color: [[ColorPalette::TertiaryLight]];\n" +
	"}\n\n" +
	"#" + config.extensions.SimpleSearchPlugin.containerId + " .button:hover {\n" +
	"\tborder-color: [[ColorPalette::SecondaryMid]];\n" +
	"\tbackground-color: [[ColorPalette::SecondaryLight]];\n" +
	"}\n\n" +
	"#" + config.extensions.SimpleSearchPlugin.btnCloseId + " {\n" +
	"\tfloat: right;\n" +
	"\tmargin: -5px -1em 5px 5px;\n" +
	"}\n\n" +
	"#" + config.extensions.SimpleSearchPlugin.btnOpenId + " {\n" +
	"\tfloat: left;\n" +
	"\tmargin-top: 5px;\n" +
	"}\n" +
store.addNotification("StyleSheetSimpleSearch", refreshStyles);

// override = function(text, useCaseSensitive, useRegExp) {
	highlightHack = new RegExp(useRegExp ? text : text.escapeRegExp(), useCaseSensitive ? "mg" : "img");
	var matches =, null, "excludeSearch");
	var q = useRegExp ? "/" : "'";
	config.extensions.SimpleSearchPlugin.displayResults(matches, q + text + q);

// override to sort by relevance = function(searchRegExp, sortField, excludeTag, match) {
	var candidates = this.reverseLookup("tags", excludeTag, !!match);
	var primary = [];
	var secondary = [];
	var tertiary = [];
	for(var t = 0; t < candidates.length; t++) {
		if(candidates[t] != -1) {
		} else if(candidates[t].tags.join(" ").search(searchRegExp) != -1) {
		} else if(candidates[t] != -1) {
	var results = primary.concat(secondary).concat(tertiary);
	if(sortField) {
		results.sort(function(a, b) {
			return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);
	return results;

} //# end of "install only once"
What Works for Whom - Dickon Bevington
~Self-Injurious Behaviour - Critical review of Rx
!"Self Harm"
Lancet 2005; 366: 1471–83

Excellent summary paper - 5 star


!Edited highlights:
>//"Self-mutilating actions are not uncommon in non-clinical samples of adolescents, and are not necessarily habitual."//
*Zoroglu SS, Tuzun U, Sar V, et al. Suicide attempt and self-mutilation among Turkish high school students in relation with abuse, neglect and dissociation. Psychiatry Clin Neurosci 2003; 57: 119–26.
*Hawton K, Rodham K, Evans E, Weatherall R. Deliberate self harm in adolescents: self report survey in schools in England. BMJ 2002; 325: 1207–11. [[Hawton et al 2002]]
*Gratz K. Measurement of deliberate self-harm: preliminary data on the deliberate self-harm inventory. J Psychopathol Behaviorl Assesst 2001; 23: 253–63.
>//"Most people admitted to hospital after an overdose neither want nor expect to die.31 Self-harm is often impulsive. Even for near fatal attempts, the decision may have been made only minutes beforehand."//
*Morgan HG, Burns-Cox CJ, Pocock H, Pottle S. Deliberate selfharm: clinical and socio-economic characteristics of 368 patients. Br J Psychiatry 1975; 127: 564–74.
*Simon OR, Swann AC, Powell KE, Potter LB, Kresnow MJ, O’Carroll PW. Characteristics of impulsive suicide attempts and attempters. Suicide Life Threat Behav 2001; 32: 49–59.
>//"''For adolescents, help-seeking has not usually been given as a reason.'' (Rodham et al 2004) Williams (35) has proposed that selfharm be viewed as a “cry of pain” rather than a “cry for help”. In a Swiss study,9 patients endorsed intrapersonal reasons more often than they did interpersonal reasons,
such as trying to influence others. Studies in several non-European countries36–39 have emphasised the role of interpersonal conflict, which of course also often precedes self-harm in western countries."//
*Rodham K, Hawton K, Evans E. Reasons for deliberate self-harm: comparison of self-poisoners and self-cutters in a community sample of adolescents. J Am Acad Child Adolesc Psychiatry 2004; 43: 80–87.
>Whereas completed suicide is rare in adolescents, selfharm ais common in young people and studies in the general population have inquired more comprehensively about these behaviours. Between 5–9% of Australian ~~(10)~~ US ~~(52)~~ and English ~~13~~ adolescents reported having selfharmed in the previous year, with few episodes seeming to be true suicide attempts. Of concern, however, is the fact that the proportion of suicide attempts in US highschool students that were medically serious increased during the 1990s.53 Lifetime self-harm in adolescents stood at 13% in the English sample13 and at 30% in an Australian school sample.54 Superficial self-mutilation seems to be rife in young people, with one-fifth of Turkish high-school students12 and as many as one-third of Massachusetts undergraduate psychology students14 and female Canadian undergraduates55 reporting such behaviours.
*10 Patton GC, Harris R, Carlin JB, et al. Adolescent suicidal
behaviours: a population-based study of risk. Psychol Med 1997; 27:
*13 Hawton K, Rodham K, Evans E, Weatherall R. Deliberate self harm in adolescents: self report survey in schools in England. BMJ 2002; 325: 1207–11.[[Hawton et al 2002]]
*52 Grunbaum JA, Kann L, Kinchen S, et al. Youth risk behavior surveillance-United States, 2003. In: Services DoHaH, ed. MMWR Surveillance Summaries. Atlanta: Centers for Disease Control and Prevention, 2004: 1–96.
!!Risk factors
pre-pubertal = rare
USA - peak onset is c, 16 yrs
Whereas being male is an important risk factor for
suicide, presentations of self-harm to health agencies
are generally more common in women.8 There is some
evidence that the higher rate of self-harm in girls than
boys is attributable to other risk factors such as
depressed mood, disordered eating, and romantic
involvement. Girls were more likely to report having a
current or past boyfriend.57 Self-mutilation may be
equally as common in men as it is in women.14,15,17
!!!Socioeconomic disadvantage
Low socioeconomic status, a low level of education, low
incomes, and living in poverty are all risk factors for
self-harm.8,60,61 Self-harm admission rates are higher in
areas of socioeconomic deprivation.62 In a longitudinal
study,63 childhood socioeconomic disadvantage
continued to predict self-harm independent of later
mental-health problems and stressful life events.
!!!Family discord
Risk is greater for children of separated or divorced parents, in
families where there was marital discord,61 or where the
mother was very young or poorly educated.66 Parental
psychopathology is also a risk factor.67 Children who
inherit biological vulnerability to affective disorders and
substance abuse could also be more likely to be growing
up in a home that is dysfunctional.67
Religious background
!!!Social context
In a longitudinal study
of Norwegian youth, gay, lesbian, or bisexual attraction,
identity, and behaviour were associated with self-harm;
however, only same-sex behaviour emerged as a
significant predictor after logistic regression analysis.83The risk in gay, lesbian, or bisexual youth could not be
attributed to their greater exposure to a wide range of
risk factors, including depressed mood, substance
abuse, pubertal timing, or atypical sex roles.83 However,
victimisation in these groups, which may be important,84
was not assessed. {DB - mostly at or just after the time that they reaslised their sexual orientation was different}
!!!Psychiatric Disorder
Adjustment disorder(?under diagnosed on account of over-medicalisation in structured interview schedules?)
!!!Risks attricb to SSRI's
Two recent studies that used
the General Practice Research Database provided no
evidence of such risk in adults who were prescribed
SSRIs compared with those prescribed tricyclic
antidepressants.97,98 There was, however, weak evidence
of a higher risk of self-harm for people younger than
19 years who were prescribed SSRIs.  (Martinez C, Rietbrock S, Wise L, et al. Antidepressant treatment
and the risk of fatal and non-fatal self harm in first episode depression: nested case-control study. BMJ 2005; 330: 389.)
Serotonin a candidate:
>//"Low concentrations of 5-HIAA, a
serotonin metabolite, have been found in the
cerebrospinal fluid of people from several groups who
have harmed themselves; these low concentrations may
predict future self-harm and violence.105 Blunted
fenfluramine-stimulated prolactin release, another index
of altered serotonergic function, has been related to the
seriousness of self-harm.105 Functional neuroimaging
has indicated decreased binding potential of prefrontal
5-HT2A receptors in patients who have self-harmed.106"//
promising candidate gene - ''serotonin transporter gene promoter 5-HTTLPR polymorphisms'' - results as yet uncertain (see article for refs) but some indicators of involvement...
!!!Physical illness
Head injury
!!!Situational factors
Media reportage, etc
Personal loss, etc

>//"About 15% of self-harmers seen at a hospital will present
again within a year,123 and even more will repeat without
presenting.124 After 9 years, more than 5% will have
committed suicide.123"//
!!!RISK FACTORS for suicide after self-harm
#Older age
#Male sex
#Past psychiatric care
#Psychiatric disorder
#Social isolation
#Repeated self-harm
#Avoiding discovery at time of self-harm
#Medically severe self-harm
#Strong suicidal intent
#Substance misuse (especially in young people)
#Poor physical health

!Diagnosis - classification
>//"Self-harm is a behaviour, not an illness. Thus, management is highly dependent on the underlying problems..."//
NB the differnce between this stance and that of Favazza, reported in [[Yates, 2004]].

!Management - @@NB adult trials, mainly@@
>//"Cochrane review,149 pooled trials of problem-solving therapy and
of a “green card” to allow emergency contact did not
show any significant reduction in repetition rates"//
''Hawton K, Townsend E, Arensman E, et al. Psychosocial and
pharmacological treatments for deliberate self harm. Cochrane
Database Syst Rev 2004; 4: CD001764.''
!Upload an icon
<<tiddler spaceIcon>>
!Describe your space
If you haven't already done so, you should provide a brief decscription of yourself and what you're using this space for. To do this, just edit the [[SiteInfo]] tiddler (keeping the title the same of course).

!Change the title
<<tiddler spaceTitle>>
!Change the theme
<<tiddler colorScheme>>
!Change the menu
If you'd like to change the menu items along the top, you can edit the [[MainMenu]] tiddler.

!Change the default tiddlers
<<tiddler setDefaultTiddlers>>
!More Advanced customisations
If you know HTML and CSS, you can edit some or all of the following tiddlers to customise your space further:
* PageTemplate
* EditTemplate
* ViewTemplate
* StyleSheet
<<tag LearningDisability>>
<<tag Autism>>
<<tag [[02.DBT]]>> 
<<tag [[03.CBT/PsychoEd]]>> 
<<tag [[04.PsychoDynamic]]>> 
<<tag [[05.GroupRx]]>> 
<<tag [[06.FamilySystems]]>> 
<<tag [[07.MultiSystems]]>> 
<<tag [[08.InPatient]]>> 
<<tag [[09.EngageOutreach]]>> 
<<tag [[10.Pharmacology]]>> 
<<tag [[11.SuicidePrev]]>> 
<<tag [[12.SocialNetwork]]>> 
<<tag [[13.ProblemSolving]]>>
An Intervention Trial to Improve Adherence
to Community Treatment by Adolescents
After a Suicide Attempt
Objective: To determine whether a problem-solving intervention would increase adherence to outpatient treatment for
adolescents after a suicide attempt. Method: Sixty-three adolescents who had attempted suicide and were evaluated
in an emergency department between 1997 and 2000 were randomly assigned to undergo standard disposition planning
or a compliance enhancement intervention using a problem-solving format. At 3 months after the intervention, all evaluable
adolescents, guardians, and outpatient therapists were contacted to determine adherence to outpatient treatment.
Results: At 3-month follow-up, the compliance enhancement group attended an average of 7.7 sessions compared with
6.4 sessions for the standard disposition group, but this difference was not statistically significant. However, after covarying
barriers to receiving services in the community (such as being placed on a waiting list and insurance coverage difficulties),
the compliance enhancement group attended significantly more treatment sessions than the standard
disposition-planning group (mean = 8.4 versus 5.8 sessions). Conclusion: Interventions designed to improve treatment
attendance must address not only individual and family factors but also service barriers encountered in the community
that can impede access to services. J. Am. Acad. Child Adolesc. Psychiatry, 2002, 41(4):435–442. Key Words: adolescent
suicide attempts, treatment compliance, family barriers, service barriers.
Click the "new tiddler" button towards the top right of the screen to write something in your space. You'll need to give it a title, some content and, optionally, some tags that will help you identify it later.

!Stuck for ideas?
Not sure what to write about? Not sure what to keep in your space? Other people use ~TiddlySpace for almost anything. How about some of the following:

* [[Save interesting sites|]], images or articles from around the web so that you can refer back to them.
* [[Record your family tree|]], store notes on long lost relatives or ancestors and map their relationship to you.
* [[Make up a pocketbook|]] to store some useful information in, then print it out, [[fold it up|]], and take it with you.
* [[Plan your holiday|]], record where you're planning to go, note down places of interest and refer back to it later.
* [[Create a mindmap|]] to visualise your inner thoughts and see how they relate to each other.
* [[Set up a questionnaire|]] and get all your friends to answer it.

If you don't like any of those ideas, you can still use this space directly to keep notes and link them together, make a todo list and keep track of everything you're doing, or any one of a hundred million other things.

Still stuck? Check out the @featured space for more suggestions.

You can also [[socialise with others|How to socialise]].
.tiddler .originButton div {
	display: inline-block;

.tiddler .spaceSiteIcon .siteIcon {
	_display: inline; /* IE doesn't like inline-block */

.tiddler .originButton {
	display: block;

.selected .tagging,
.selected .tagging:hover {
	border: none;
	background: none;

.tagging {
	float: none;
	background: none;
	border: none;

.tagging li.listTitle {
	margin-left: 0px;
.tagging li {
	margin: 0 8px;

.tagging .tiddlyLink {
	-webkit-border-radius: 3px;
	-moz-border-radius: 3px;
	-o-border-radius: 3px;
	border-radius: 3px;
	padding: 1px 2px;
	line-height: 1.2em;

/* for following */
#popup .siteIcon {
	float: left;
	height: 25px;

.content {
	width: 100%; /* IE */
	font-size: 0.9em;

.editorHeading {
	height: 48px;

.heading {
	left: 0;
	margin-bottom: 40px;
	position: relative;
	top: 32px;

.followButton a {
	display: block;
	margin-top: -20px;

.tiddler .followPlaceHolder {
	display: block;
	position: absolute;
	top: 16px;
	right: 64px;
	_right: 138px; // add width of modifierIcon

.tiddler .followButton {
	position: relative;
	height: 24px;
	text-align: left;
	color: #fff;
	background: [[ColorPalette::PrimaryMid]];
	padding: 10px 0px 0px 10px;
	width: 38px;
	margin: -16px -8px 24px 0;

/* creates the larger triangle */
.followButton:before {
	content: "\00a0";
	display: block; /* reduce the damage in FF3.0 */
	position: relative;
	bottom: -20px;
	right: 0;
	width: 0;
	height: 0;
	border-width: 0 0 20px 20px;
	border-style: solid;
	border-color: transparent [[ColorPalette::PrimaryMid]];

.toolbar svg {
	height: 16px;
	width: 16px;

.toolbar svg .glyph {
	fill: #ccc;

.toolbar a:hover .glyph {
	fill: black;

.toolbar a:active .glyph {
	fill: [[ColorPalette::Background]];

.tiddler .subtitle {
	cursor: pointer;

.editSpaceSiteIcon .originButton {
	cursor: auto;

.tiddler .subtitle:hover {
	font-weight: bold;
	background: none;

.originButton img,
.originButton svg {
	margin-left: 0px;

.modifierIcon {
	position: absolute;
	width: 74px;
	top: 0px;
	right: 0px;
	_right: 74px; /* in IE6 positioning works incorrectly so use -width instead */
	text-align: right;

.modifierIcon img,
.modifierIcon svg {
	margin-right: 8px;

.tiddler .viewer {
	padding-bottom: 16px;
	margin: 0 0 0 56px;
	line-height: 1.4em;

.viewer pre {
	margin-left: 0;

.siteIcon .label {
	color: [[ColorPalette::TertiaryDark]];

.tiddler .spaceSiteIcon {
	float: left;
	margin-right: 0;
	margin-top: 0;
	position: relative;
	display: block;

.tiddler .titleBar {
	display: block;
	margin-right: 136px;
	margin-left: 56px;

.followButton a {
	color: [[ColorPalette::Background]];

.tiddler {
	position: relative;
	padding: 0;
	margin-bottom: 3em;
	border-top: 3px solid [[ColorPalette::PrimaryMid]];
	background: #fff;

.tiddler .editor {
	padding: 0px 8px;

.tiddler .heading .title {
	position: relative;
	display: block;
	word-wrap: break-word;
	font-size: 32px;
	line-height: 32px;
.tiddler .heading .editor.title {
	font-size: 1.7em;
	line-height: normal;

.tiddler .headingClear {
	clear: both;

.tiddler .subtitle {
	font-style: italic;
	font-size: 0.9em;
	color: #a6a59e;
	margin-top: 0;

.toolbar {
	position: absolute;
	padding: 0;
	top: 8px;
	right: -8px;

.toolbar .moreCommand.highlight {
	background: none;

.tiddler .toolbar .button {
	border: none;
	display: inline;
	padding: 0px;
	margin-right: 16px;

.tiddler .toolbar a:hover {
	background: none;

.tiddler .tagged .listTitle {
	display: none;

.revButton {
	float: right;

/*! EditTemplate specific*/
.tiddler .privacySettings {
	text-align: center;
.tiddler .privacySettings .originButton {
	display: inline;

.editSpaceSiteIcon, .privacyEdit {
	float: left;

.editSpaceSiteIcon svg,
.editSpaceSiteIcon img,
.editSpaceSiteIcon .roundelLabel {
	float: left;

.tagTitle {
	position: absolute;
	text-align: center;
	width: 48px;
	top: 0px;
	left: -56px;

.editSpaceSiteIcon .originButton img,
.editSpaceSiteIcon .originButton svg {
	height: 16px;
	margin-left: 24px;
	margin-right: 32px;
	width: 16px;

.tagAnnotation {
	margin-top: 8px;
	padding-bottom: 8px;
.annotationsBox {
	margin-top: 8px;

.editorFooter {
	position: relative;
	padding: 0;
	margin-top: 16px;
	margin-left: 64px;

.tiddler .editorFooter .editor {
	padding-left: 0px;

.heading .editor input {
	width: 100%;
	font-size: 1.5em;

.spaceSiteIcon .externalImage .image a:hover,
.modifierIcon .externalImage .image a:hover {
	background: none;

div.toolbar {

.selected div.toolbar {
	visibility: visible;

.followButton a:hover {
	background: [[ColorPalette::PrimaryMid]];
	text-decoration: underline;

a.image:hover {
	background: transparent;

@media all and (max-device-width: 480px) {
	div.toolbar {
@media only screen and (device-width: 768px) {
	div.toolbar {
@media all and (max-width: 960px) {
	.tiddler .titleBar {
		margin-left: 36px;
		margin-right: 80px;

	.tiddler .heading {
		margin-bottom: 48px;

	.tiddler .heading .title {
		font-size: 32px;
		line-height: 32px;

	.tiddler .modifierIcon img,
	.tiddler .modifierIcon svg,
	.tiddler .spaceSiteIcon .originButton img,
	.originButton svg {
		width: 32px;
		height: 32px;
		margin-left: 0px;
		margin-right: 0px;

	.tiddler .followPlaceHolder {
		right: 48px;

	.tiddler .followButton {
		width: 24px;

	.tiddler .viewer {
		margin: 0px 0px 0px 36px;
		padding-top: 0;

	br {
		line-height: 0.5em;
body {
	font-size: 1em;
	font-family: helvetica, arial, sans-serif;
	background-color: #fff;
	color: [[ColorPalette::Foreground]];

body ul { margin: 0; }

#popup {
	background-color: [[ColorPalette::TertiaryPale]];

#popup.confirmationPopup, .followList {
	font-size: 0.8em;
	padding: 1em;
	border: solid 1px [[ColorPalette::SecondaryMid]];
	background-color: [[ColorPalette::SecondaryPale]];

.followList .listTitle {
	text-decoration: underline;

#popup .followTiddlersList a {
	display: inline;
	padding: 0;

#popup li a {
	color: [[ColorPalette::PrimaryMid]];
	font-weight: bold;

#popup li a:hover {
	color: [[ColorPalette::PrimaryPale]];
	background: [[ColorPalette::PrimaryMid]];

#popup li.listTitle {
	border-bottom: 1px solid #000;
	font-weight: bold;
	margin-bottom: 10px;

#popup.followList {
	margin-left: 50px;
	margin-top: -30px;

.followTiddlersList .label {
	display: block;
	left: 10px;
	top: 0px;
	line-height: 16px;
	position: relative;

#popup .followTiddlersList .siteIcon{
	height: auto;

#popup .followTiddlersList li{
	clear: both;
	display: block;
	height: 48px;
	margin-bottom: 8px;
	position: relative;

#popup .followTiddlersList a{
	display: inline;

#displayArea {
	margin: 0;
	top: 0px;
	left: 0px;
	width: 100%;
	position: relative;

.revisionCloak {
	position: absolute;
	position: fixed !important;
	height: 100%;
	width: 100%;
	top: 0;
	left: 0;
	border: 0;
	margin: 0;
	padding: 0;
	opacity: 0.5;
	filter: alpha(opacity=50);
	background-color: #000;

/* *** Header *** */
.header {
	position: relative;
	background-color: [[ColorPalette::PrimaryMid]];
	_width: 100%; /* ie 6 demands */

.headerForeground {
	background-color: [[ColorPalette::PrimaryMid]];
	float: left;
	margin: 24px 16px 0px 72px;
	padding: 0;
	position: relative;
	top: 0;
	_width: 70%; /*ie6: needed for the background to actually be transparent*/
	_background-color: transparent; /*ie6: needed to show the search box*/

.clearFloat {
	clear: both;

#contentWrapper {
	position: relative;
	padding-top: 1px;
	top: -1px;

#tiddlerDisplay {
	_position: relative; /* ie 6*/

.siteTitle {
	clear: both;
	display: block;
	font-size: 32px;
	font-weight: bold;
	line-height: 32px;

.siteSubtitle {
	display: block;
	font-size: 14px;
	height: 16px;
	margin-bottom: 8px;

#sidebarSearch {
	padding: 0;
	position: absolute;
	right: 80px;
	top: 8px;
	width: 176px;

#sidebarSearch .txtOptionInput {
	width: 100%;
	margin-top: 5px;
	_color: #bbb; /* ie6 danger */

#sidebarSearch .txtOptionInput:focus {
	color: #000;

#sidebarSearch .searchButton {
	display: none;

/* *** Menu Bar *** */

#mainMenu {
	position: static;
	text-align: left;
	margin-left: 72px;
	float: left;
	width: auto;
	padding: 0;
	font-size: 1em;
	line-height: normal;

#mainMenu a {
	color: #fff;
	padding: 8px;
	font-size: 0.9em;
	margin-right: 16px;

#mainMenu a:hover {
	background-color: [[ColorPalette::PrimaryMid]];
	color: [[ColorPalette::Background]]

#sidebarOptions {
	margin-right: 72px;
	float: right;
	font-size: 1.1em;
	line-height: 1.6em;
	min-height: 1em;
	padding-top: 0;

#sidebarOptions a {
	margin-right: 8px;

.confirmationPopup .button,
#sidebarOptions .button {
	cursor: pointer;
	line-height: 1.4em;
	text-align: center;
	margin-right: 8px;

.confirmationPopup .button {
	font-size: 0.9em;
	padding: 2px;

#sidebarOptions .button {
	font-size: 0.7em;
	float: left;
	width: 80px;
	padding: 0px;
        color: #fff;

.confirmationPopup a.button,
#sidebarOptions a {
	border: none;
	margin: 0 0.2em;
	padding: 0.6em 0.25em;
	display: inline;
	color: #666;

.confirmationPopup a.button:hover,
#sidebarOptions a:hover {
	color: #000;

.confirmationPopup a.button:active,
#sidebarOptions a:active {
	border: solid 1px [[ColorPalette::PrimaryMid]];
	background-color: #fff;
	background: -webkit-gradient( linear, left bottom, left top, color-stop(0.1,rgb(200,200,200)), color-stop(1, rgb(100,100,100)));
	background: -moz-linear-gradient(center bottom , rgb(200,200,200) 10%,rgb(100,100,100) 100%) repeat scroll 0 0 transparent;
/* *** Sidebar *** */

#sidebar .wizard table {
	margin: 0px;

.tabContents .listTitle:first-child {
	margin-top: 0px;

#menuBar {
	background: [[ColorPalette::PrimaryLight]];
	left: 0;
	right: 0;
	position: relative;
	margin: 0;
	padding: 0.5em 0 0.5em 0;
	min-height: 1em;
	overflow: hidden;
	_width: 100%; /* for ie 6 */

#sidebarOptions a.button:hover {
	color: [[ColorPalette::PrimaryPale]];
    background: [[ColorPalette::PrimaryMid]];

#tiddlerDisplay, #searchResults {
	margin: 16px 448px 0 72px;

#sidebarTabs {
	position: absolute;
	right: 72px;
	width: 352px;
	top: 0;

#sidebarTabs .tabsetWrapper .tabset {
	width: 87px;
	border-top: 1px solid [[ColorPalette::PrimaryPale]];
	border-left: 1px solid [[ColorPalette::PrimaryPale]];
	border-bottom: 1px solid [[ColorPalette::PrimaryPale]];
	height: auto;
	float: left;
	word-wrap: break-word;
	top: 0;
	padding: 0;

#sidebarTabs .tabsetWrapper .tabContents {
	background-color: [[ColorPalette::PrimaryPale]];
	border: 3px solid [[ColorPalette::PrimaryMid]];
	width: 242px;
	_width: 238px;
	left: -3px;
	_left: -5px;
	position: relative;
	min-height: 34em;
	padding: 8px;
	font-size: 0.8em;

/* ---- Side style --- */

#sidebarTabs .tabsetWrapper .tabset .tab {
	font-size: 0.9em;
	padding: 0.7em 8px 0.5em;
	color: #fff;
	background: [[ColorPalette::PrimaryLight]];
	border: none;
	line-height: 16px;
	position: relative;
	display: block;
	margin: 0;

#sidebarTabs .tabsetWrapper .tabset .tabSelected {
	color: [[ColorPalette::PrimaryMid]];
	background: [[ColorPalette::PrimaryPale]];
	border-top: 3px solid [[ColorPalette::PrimaryMid]];
	border-bottom: 3px solid [[ColorPalette::PrimaryMid]];
	border-left: 3px solid [[ColorPalette::PrimaryMid]];
	z-index: 10;
	margin-top: -1px;
	font-weight: bold;

#sidebarTabs .tabContents li {
	border: none;
	margin-left: 0;
	word-wrap: break-word;

.tabContents .timeline {
	background: [[ColorPalette::PrimaryPale]];
	margin-bottom: 8px;

#sidebarTabs .timeline li.listTitle {
	color: #132E43;
	margin-left: 8px 0;
	padding: 0.3em 0.11em;
	font-size: 1em;
	border-bottom: none;

#sidebarTabs .tabContents li a {
	display: block;
	text-align: left;
	margin: 0 0 1px 0;
	padding: 0.3em 1em;
	background: [[ColorPalette::PrimaryPale]];

#sidebarTabs .tabsetWrapper .tabset a:hover,
#sidebarTabs .tabContents li a:hover {
	color: [[ColorPalette::PrimaryPale]];
	background: [[ColorPalette::PrimaryMid]];

/* Activity Stream */
#sidebarTabs .tabContents .activityStream .feedItem a {
	display: inline-block;
	padding: 0;
	background: none;

/* ---- Tagging box --- */
.tagInfo {
	border: 1px solid #cccccc;
	padding: 10px 15px;
	-moz-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
	box-shadow: 0 2px 2px rgba(0,0,0,0.2);
	color: [[ColorPalette::TertiaryMid]];
	background: -moz-linear-gradient(100% 100% 90deg, #f4f4f4, #e5e5e5);
	background: -webkit-gradient(linear, left top, right top, from(#e5e5e5), to(#f4f4f4));
	margin-top: 1em;
	font-size: 13px;
	margin: 0 0 0 56px;

.tagInfo ul {
	list-style: none;
	padding-left: 2.2em;

.tagInfo ul li {
	display: inline;

.tagInfo ul li.listTitle,
.tagInfo .tagging ul li.listTitle {
	color: [[ColorPalette::PrimaryMid]];
	font-size: 13px;

.tagInfo ul li a {
	border: none;

.tagInfo .tagging ul li {
	float: none;
	display: inline-block;

.tagInfo .tagging {
	padding: 0;

.viewRevision .toolbar {
	right: 48px;
	top: 8px;

.viewRevision .modifierIcon img,
.viewRevision .modifierIcon svg {
	margin-right: 8px;

.viewRevision .toolbar svg {
	width: 32px;
	height: 32px;

/* --- IE hacks from lattice --- */

/* ie hacks */
* html #menuBar {
	margin-bottom: 8px;
.toolbar .svgIconText {
	*display: inline;

div.tiddler .toolbar a {
	cursor: pointer;
	float: left\9;
	display: inline\9;

* html .toolbar {
	right: 8px;
* html .followButton a {
	margin-top: 0px;
	margin-right: 8px;
* html #tiddlerDisplay {
	margin-top: 0px;

/* for printing purposes */
@media print {
	#sidebarSearch .txtOptionInput,
	#sidebarOptions {
		display: none !important;
	#displayArea {
		margin: 1em 1em 0em;
	noscript {
		display:none; /* Fixes a feature in Firefox where print preview displays the noscript content */
	#tiddlerDisplay {
		margin: 16px 16px;

@media all and (max-width: 960px){
	#searchResults {
		margin: 16px 366px 0 16px;

	#mainMenu {
		margin-left: 16px;

	.headerForeground {
		margin-left: 16px;

	#sidebarSearch {
		right: 16px;

	#sidebarOptions {
		margin-right: 16px;

	#sidebarTabs {
		right: 16px;
		width: 326px;

	#sidebarTabs .tabsetWrapper .tabset {
		font-size: 0.9em;
		width: 77px;

	#sidebarTabs .tabsetWrapper .tabContents {
		width: 226px;
		_width: 222px;

	#sidebarTabs .tabContents li a {
		font-size: 0.9em;
!Summary bullet points 
#Substantive conclusions about the level of support for treatments covered in the chapter
#Mention treatment, condition, and population
#Standardised language across conclusions
*Absence of evidence:
**‘There is no systematic evidence for or against the use of treatment T for condition C in population P’
* Strong evidence in favour:
**‘There is strong evidence to support the use of treatment T for condition C in population P’
* Strong evidence against:
**‘There is strong evidence that treatment T for condition C in population P is ineffective’
* Conflicting evidence:
**‘There is conflicting evidence for the use of treatment T for condition C in population P’
***Briefly elaborate the conflict
****Evidence in need of qualification:
****'There is limited/some evidence to support the use of treatment T for condition C in population P.’
***Explain the way in which the evidence is limited
***Number, type, size, duration, site-number and location of studies

!Implication bullet points
o	Treatment recommendations based on summaries of evidence
Suominen K, Henriksson M, Suokas J, Isometsä E, Ostamo A, Lönnqvist J.
!!Mental disorders and comorbidity in attempted suicide.
Acta Psychiatr Scand. 1996 Oct;94(4):234-40.

The present study examined the prevalence and comorbidity of mental disorders according to DSM-III-R among male and female suicide attempters. A systematic sample of 114 patients from consecutive cases of attempted suicide referred to a general hospital in Helsinki between 1 January and 31 July 1990 was interviewed. In 98% of the cases at least one Axis I diagnosis was made. Depressive syndromes were more common among females (85%) than males (64%), and alcohol dependence was more common among males (64%) than females (21%). A high proportion of suicide attempters (82%) suffered from comorbid mental disorders. Comorbidity appears to play an important role in parasuicide.
|Description:|tagglyTagging macro is a replacement for the builtin tagging macro in your ViewTemplate|
|Version:|3.1 ($Rev: 5655 $)|
|Date:|$Date: 2008-06-18 23:50:30 +1000 (Wed, 18 Jun 2008) $|
|Author:|Simon Baird <>|
config.taggly = {

	// for translations
	lingo: {
		labels: {
			asc:        "\u2191", // down arrow
			desc:       "\u2193", // up arrow
			title:      "title",
			modified:   "modified",
			created:    "created",
			show:       "+",
			hide:       "-",
			normal:     "normal",
			group:      "group",
			commas:     "commas",
			sitemap:    "sitemap",
			numCols:    "cols\u00b1", // plus minus sign
			label:      "Tagged as '%0':",
			excerpts:   "excerpts",
			descr:      "descr",
			slices:     "slices",
			contents:   "contents",
			sliders:    "sliders",
			noexcerpts: "title only"

		tooltips: {
			title:      "Click to sort by title",
			modified:   "Click to sort by modified date",
			created:    "Click to sort by created date",
			show:       "Click to show tagging list",
			hide:       "Click to hide tagging list",
			normal:     "Click to show a normal ungrouped list",
			group:      "Click to show list grouped by tag",
			sitemap:    "Click to show a sitemap style list",
			commas:     "Click to show a comma separated list",
			numCols:    "Click to change number of columns",
			excerpts:   "Click to show excerpts",
			descr:      "Click to show the description slice",
			slices:     "Click to show all slices",
			contents:   "Click to show entire tiddler contents",
			sliders:    "Click to show tiddler contents in sliders",
			noexcerpts: "Click to show entire title only"

		tooDeepMessage: "* //sitemap too deep...//"

	config: {
		showTaggingCounts: true,
		listOpts: {
			// the first one will be the default
			sortBy:     ["title","modified","created"],
			sortOrder:  ["asc","desc"],
			hideState:  ["show","hide"],
			listMode:   ["normal","group","sitemap","commas"],
			numCols:    ["1","2","3","4","5","6"],
			excerpts:   ["noexcerpts","excerpts","descr","slices","contents","sliders"]
		valuePrefix: "taggly.",
		excludeTags: ["excludeLists","excludeTagging"],
		excerptSize: 50,
		excerptMarker: "/%"+"%/",
		siteMapDepthLimit: 25

	getTagglyOpt: function(title,opt) {
		var val = store.getValue(title,this.config.valuePrefix+opt);
		return val ? val : this.config.listOpts[opt][0];

	setTagglyOpt: function(title,opt,value) {
		if (!store.tiddlerExists(title))
			// create it silently
			store.saveTiddler(title,title,config.views.editor.defaultText.format([title]),config.options.txtUserName,new Date(),"");
		// if value is default then remove it to save space
		return store.setValue(title,
			value == this.config.listOpts[opt][0] ? null : value);

	getNextValue: function(title,opt) {
		var current = this.getTagglyOpt(title,opt);
		var pos = this.config.listOpts[opt].indexOf(current);
		// a little usability enhancement. actually it doesn't work right for grouped or sitemap
		var limit = (opt == "numCols" ? store.getTaggedTiddlers(title).length : this.config.listOpts[opt].length);
		var newPos = (pos + 1) % limit;
		return this.config.listOpts[opt][newPos];

	toggleTagglyOpt: function(title,opt) {
		var newVal = this.getNextValue(title,opt);

	createListControl: function(place,title,type) {
		var lingo = config.taggly.lingo;
		var label;
		var tooltip;
		var onclick;

		if ((type == "title" || type == "modified" || type == "created")) {
			// "special" controls. a little tricky. derived from sortOrder and sortBy
			label = lingo.labels[type];
			tooltip = lingo.tooltips[type];

			if (this.getTagglyOpt(title,"sortBy") == type) {
				label += lingo.labels[this.getTagglyOpt(title,"sortOrder")];
				onclick = function() {
					return false;
			else {
				onclick = function() {
					return false;
		else {
			// "regular" controls, nice and simple
			label = lingo.labels[type == "numCols" ? type : this.getNextValue(title,type)];
			tooltip = lingo.tooltips[type == "numCols" ? type : this.getNextValue(title,type)];
			onclick = function() {
				return false;

		// hide button because commas don't have columns
		if (!(this.getTagglyOpt(title,"listMode") == "commas" && type == "numCols"))
			createTiddlyButton(place,label,tooltip,onclick,type == "hideState" ? "hidebutton" : "button");

	makeColumns: function(orig,numCols) {
		var listSize = orig.length;
		var colSize = listSize/numCols;
		var remainder = listSize % numCols;

		var upperColsize = colSize;
		var lowerColsize = colSize;

		if (colSize != Math.floor(colSize)) {
			// it's not an exact fit so..
			upperColsize = Math.floor(colSize) + 1;
			lowerColsize = Math.floor(colSize);

		var output = [];
		var c = 0;
		for (var j=0;j<numCols;j++) {
			var singleCol = [];
			var thisSize = j < remainder ? upperColsize : lowerColsize;
			for (var i=0;i<thisSize;i++) 

		return output;

	drawTable: function(place,columns,theClass) {
		var newTable = createTiddlyElement(place,"table",null,theClass);
		var newTbody = createTiddlyElement(newTable,"tbody");
		var newTr = createTiddlyElement(newTbody,"tr");
		for (var j=0;j<columns.length;j++) {
			var colOutput = "";
			for (var i=0;i<columns[j].length;i++) 
				colOutput += columns[j][i];
			var newTd = createTiddlyElement(newTr,"td",null,"tagglyTagging"); // todo should not need this class
		return newTable;

	createTagglyList: function(place,title) {
		switch(this.getTagglyOpt(title,"listMode")) {
			case "group":  return this.createTagglyListGrouped(place,title); break;
			case "normal": return this.createTagglyListNormal(place,title,false); break;
			case "commas": return this.createTagglyListNormal(place,title,true); break;
			case "sitemap":return this.createTagglyListSiteMap(place,title); break;

	getTaggingCount: function(title) {
		// thanks to Doug Edmunds
		if (this.config.showTaggingCounts) {
			var tagCount = store.getTaggedTiddlers(title).length;
			if (tagCount > 0)
				return " ("+tagCount+")";
		return "";

	getExcerpt: function(inTiddlerTitle,title,indent) {
		if (!indent)
			indent = 1;

		var displayMode = this.getTagglyOpt(inTiddlerTitle,"excerpts");
		var t = store.getTiddler(title);

		if (t && displayMode == "excerpts") {
			var text = t.text.replace(/\n/," ");
			var marker = text.indexOf(this.config.excerptMarker);
			if (marker != -1) {
				return " {{excerpt{<nowiki>" + text.substr(0,marker) + "</nowiki>}}}";
			else if (text.length < this.config.excerptSize) {
				return " {{excerpt{<nowiki>" + t.text + "</nowiki>}}}";
			else {
				return " {{excerpt{<nowiki>" + t.text.substr(0,this.config.excerptSize) + "..." + "</nowiki>}}}";
		else if (t && displayMode == "contents") {
			return "\n{{contents indent"+indent+"{\n" + t.text + "\n}}}";
		else if (t && displayMode == "sliders") {
			return "<slider slide>\n{{contents{\n" + t.text + "\n}}}\n</slider>";
		else if (t && displayMode == "descr") {
			var descr = store.getTiddlerSlice(title,'Description');
			return descr ? " {{excerpt{" + descr  + "}}}" : "";
		else if (t && displayMode == "slices") {
			var result = "";
			var slices = store.calcAllSlices(title);
			for (var s in slices)
				result += "|%0|<nowiki>%1</nowiki>|\n".format([s,slices[s]]);
			return result ? "\n{{excerpt excerptIndent{\n" + result  + "}}}" : "";
		return "";

	notHidden: function(t,inTiddler) {
		if (typeof t == "string") 
			t = store.getTiddler(t);
		return (!t || !t.tags.containsAny(this.config.excludeTags) ||
				(inTiddler && this.config.excludeTags.contains(inTiddler)));

	// this is for normal and commas mode
	createTagglyListNormal: function(place,title,useCommas) {

		var list = store.getTaggedTiddlers(title,this.getTagglyOpt(title,"sortBy"));

		if (this.getTagglyOpt(title,"sortOrder") == "desc")
			list = list.reverse();

		var output = [];
		var first = true;
		for (var i=0;i<list.length;i++) {
			if (this.notHidden(list[i],title)) {
				var countString = this.getTaggingCount(list[i].title);
				var excerpt = this.getExcerpt(title,list[i].title);
				if (useCommas)
					output.push((first ? "" : ", ") + "[[" + list[i].title + "]]" + countString + excerpt);
					output.push("*[[" + list[i].title + "]]" + countString + excerpt + "\n");

				first = false;

		return this.drawTable(place,
			this.makeColumns(output,useCommas ? 1 : parseInt(this.getTagglyOpt(title,"numCols"))),
			useCommas ? "commas" : "normal");

	// this is for the "grouped" mode
	createTagglyListGrouped: function(place,title) {
		var sortBy = this.getTagglyOpt(title,"sortBy");
		var sortOrder = this.getTagglyOpt(title,"sortOrder");

		var list = store.getTaggedTiddlers(title,sortBy);

		if (sortOrder == "desc")
			list = list.reverse();

		var leftOvers = []
		for (var i=0;i<list.length;i++)

		var allTagsHolder = {};
		for (var i=0;i<list.length;i++) {
			for (var j=0;j<list[i].tags.length;j++) {

				if (list[i].tags[j] != title) { // not this tiddler

					if (this.notHidden(list[i].tags[j],title)) {

						if (!allTagsHolder[list[i].tags[j]])
							allTagsHolder[list[i].tags[j]] = "";

						if (this.notHidden(list[i],title)) {
							allTagsHolder[list[i].tags[j]] += "**[["+list[i].title+"]]"
										+ this.getTaggingCount(list[i].title) + this.getExcerpt(title,list[i].title) + "\n";

							leftOvers.setItem(list[i].title,-1); // remove from leftovers. at the end it will contain the leftovers


		var allTags = [];
		for (var t in allTagsHolder)

		var sortHelper = function(a,b) {
			if (a == b) return 0;
			if (a < b) return -1;
			return 1;

		allTags.sort(function(a,b) {
			var tidA = store.getTiddler(a);
			var tidB = store.getTiddler(b);
			if (sortBy == "title") return sortHelper(a,b);
			else if (!tidA && !tidB) return 0;
			else if (!tidA) return -1;
			else if (!tidB) return +1;
			else return sortHelper(tidA[sortBy],tidB[sortBy]);

		var leftOverOutput = "";
		for (var i=0;i<leftOvers.length;i++)
			if (this.notHidden(leftOvers[i],title))
				leftOverOutput += "*[["+leftOvers[i]+"]]" + this.getTaggingCount(leftOvers[i]) + this.getExcerpt(title,leftOvers[i]) + "\n";

		var output = [];

		if (sortOrder == "desc")
		else if (leftOverOutput != "")
			// leftovers first...

		for (var i=0;i<allTags.length;i++)
			if (allTagsHolder[allTags[i]] != "")
				output.push("*[["+allTags[i]+"]]" + this.getTaggingCount(allTags[i]) + this.getExcerpt(title,allTags[i]) + "\n" + allTagsHolder[allTags[i]]);

		if (sortOrder == "desc" && leftOverOutput != "")
			// leftovers last...

		return this.drawTable(place,


	// used to build site map
	treeTraverse: function(title,depth,sortBy,sortOrder) {

		var list = store.getTaggedTiddlers(title,sortBy);
		if (sortOrder == "desc")

		var indent = "";
		for (var j=0;j<depth;j++)
			indent += "*"

		var childOutput = "";

		if (depth > this.config.siteMapDepthLimit)
			childOutput += indent + this.lingo.tooDeepMessage;
			for (var i=0;i<list.length;i++)
				if (list[i].title != title)
					if (this.notHidden(list[i].title,this.config.inTiddler))
						childOutput += this.treeTraverse(list[i].title,depth+1,sortBy,sortOrder);

		if (depth == 0)
			return childOutput;
			return indent + "[["+title+"]]" + this.getTaggingCount(title) + this.getExcerpt(this.config.inTiddler,title,depth) + "\n" + childOutput;

	// this if for the site map mode
	createTagglyListSiteMap: function(place,title) {
		this.config.inTiddler = title; // nasty. should pass it in to traverse probably
		var output = this.treeTraverse(title,0,this.getTagglyOpt(title,"sortBy"),this.getTagglyOpt(title,"sortOrder"));
		return this.drawTable(place,
				this.makeColumns(output.split(/(?=^\*\[)/m),parseInt(this.getTagglyOpt(title,"numCols"))), // regexp magic

	macros: {
		tagglyTagging: {
			handler: function (place,macroName,params,wikifier,paramString,tiddler) {
				var refreshContainer = createTiddlyElement(place,"div");
				// do some refresh magic to make it keep the list fresh - thanks Saq
				if (params[0])
				else {

			refresh: function(place) {
				var title = place.getAttribute("title");
				if (store.getTaggedTiddlers(title).length > 0) {
					var lingo = config.taggly.lingo;
					if (config.taggly.getTagglyOpt(title,"hideState") == "show") {

	// todo fix these up a bit
	styles: [
"/* created by TagglyTaggingPlugin */",
".tagglyTagging { padding-top:0.5em; }",
".tagglyTagging li.listTitle { display:none; }",
".tagglyTagging ul {",
"	margin-top:0px; padding-top:0.5em; padding-left:2em;",
"	margin-bottom:0px; padding-bottom:0px;",
".tagglyTagging { vertical-align: top; margin:0px; padding:0px; }",
".tagglyTagging table { margin:0px; padding:0px; }",
".tagglyTagging .button { visibility:hidden; margin-left:3px; margin-right:3px; }",
".tagglyTagging .button, .tagglyTagging .hidebutton {",
"	color:[[ColorPalette::TertiaryLight]]; font-size:90%;",
"	border:0px; padding-left:0.3em;padding-right:0.3em;",
".tagglyTagging .button:hover, .hidebutton:hover, ",
".tagglyTagging .button:active, .hidebutton:active  {",
"	border:0px; background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]];",
".selected .tagglyTagging .button { visibility:visible; }",
".tagglyTagging .hidebutton { color:[[ColorPalette::Background]]; }",
".selected .tagglyTagging .hidebutton { color:[[ColorPalette::TertiaryLight]] }",
".tagglyLabel { color:[[ColorPalette::TertiaryMid]]; font-size:90%; }",
".tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }",
".tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}",
".tagglyTagging ul ul li {margin-left:0.5em; }",
".editLabel { font-size:90%; padding-top:0.5em; }",
".tagglyTagging .commas { padding-left:1.8em; }",
"/* not technically tagglytagging but will put them here anyway */",
".tagglyTagged li.listTitle { display:none; }",
".tagglyTagged li { display: inline; font-size:90%; }",
".tagglyTagged ul { margin:0px; padding:0px; }",
".excerpt { color:[[ColorPalette::TertiaryDark]]; }",
".excerptIndent { margin-left:4em; }",
"div.tagglyTagging table,",
"div.tagglyTagging table tr,",
" {border-style:none!important; }",
".tagglyTagging .contents { border-bottom:2px solid [[ColorPalette::TertiaryPale]]; padding:0 1em 1em 0.5em;",
"  margin-bottom:0.5em; }",
".tagglyTagging .indent1  { margin-left:3em;  }",
".tagglyTagging .indent2  { margin-left:4em;  }",
".tagglyTagging .indent3  { margin-left:5em;  }",
".tagglyTagging .indent4  { margin-left:6em;  }",
".tagglyTagging .indent5  { margin-left:7em;  }",
".tagglyTagging .indent6  { margin-left:8em;  }",
".tagglyTagging .indent7  { margin-left:9em;  }",
".tagglyTagging .indent8  { margin-left:10em; }",
".tagglyTagging .indent9  { margin-left:11em; }",
".tagglyTagging .indent10 { margin-left:12em; }",

	init: function() {
		config.shadowTiddlers["TagglyTaggingStyles"] = this.styles;



By Saq Imtiaz

// syntax adjusted to not clash with NestedSlidersPlugin
// added + syntax to start open instead of closed

config.formatters.unshift( {
	name: "inlinesliders",
	// match: "\\+\\+\\+\\+|\\<slider",
	match: "\\<slider",
	// lookaheadRegExp: /(?:\+\+\+\+|<slider) (.*?)(?:>?)\n((?:.|\n)*?)\n(?:====|<\/slider>)/mg,
	lookaheadRegExp: /(?:<slider)(\+?) (.*?)(?:>)\n((?:.|\n)*?)\n(?:<\/slider>)/mg,
	handler: function(w) {
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart ) {
			var btn = createTiddlyButton(w.output,lookaheadMatch[2] + " "+"\u00BB",lookaheadMatch[2],this.onClickSlider,"button sliderButton");
			var panel = createTiddlyElement(w.output,"div",null,"sliderPanel"); = (lookaheadMatch[1] == '+' ? "block" : "none");
			w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
   onClickSlider : function(e) {
		if(!e) var e = window.event;
		var n = this.nextSibling; = ("none") ? "block" : "none";
		return false;


Nicholas Tarrier, Katherine Taylor and Patricia Gooding
Cognitive-Behavioral Interventions to Reduce Suicide Behavior: A Systematic Review and Meta-Analysis
Behav Modif 2008; 32; 77

[X] done - check through the papers in the review - any extar adoelscent ones?

Good paper but wide defeinitions and age group.
"to systematically review studies that evaluated a CBT or a treatment that contains cognitive-behavioral methods as a substantial part of that treatment, in an attempt to reduce suicide behavior"

"define ''suicide behavior'' as //including ''completed suicides, suicide attempts, suicide intent and/or plans, and suicide ideation''"//

"we maintain that it is helpful to consider that suicide
behavior lies on a continuum from ideation, through intent and planning, to
action. Although not everyone will progress along this continuum, many will
do so. Furthermore, suicide ideation in itself is undesirable and distressing
and, therefore, a legitimate target for treatment. There is also the practical
issue that completed suicide, although not uncommon, remains sufficiently
infrequent to limit its usefulness as an outcome measure in treatment trials in
spite of its obvious importance."

Trial quality assessed with CTAM - structured set of questions, as well as expert opinion.

28 0ut of >8000 papers ientified in literature search fulfilled inclusion criteria.

!Adolescents Vs Adults treated with CBT Rx - 
Signif proportion of Adults did improve, 
adolescents - non signif differences.

> //"Adults Versus Adolescents: 0–3 Months After Treatment Completion
Seven data points (from six studies, given the subgroups of Klingman and
Hochdorf, 1993) were conduced with adolescents, and 18 data points were
available for adults (see Table 2). The definitions of adult and adolescent were
defined by the articles rather than any consistent age cutoffs for adolescents
and adults.//

>//The effect size for the 18 studies based on adults was highly significant
(combined Hedge’s g = –0.775, z = –5.497, p < .0001, 95% CI = –1.051 to
–0.498). The effect size for the data points based on an adolescent sample was
not significant, however (combined Hedge’s g = –0.260, z = –1.355, p = .175,
95% CI = –0.635 to 0.116).//

>>//@@"CBT appears effective with adult populations but not with adolescents.
Although there were possible overlaps in age across studies (i.e., those described
as treating adult or adolescent populations), the tentative conclusion is that
when the treated sample is principally adolescent, then suicide behavior is
difficult to treat. However, in the current analysis, there was a paucity of
studies comprising adolescents, as compared to those involving adults."@@//
!Rx Vs No-Rx
CBT signif better

!CBT Rx Vs another therapy
No signif difference

"The no-treatment and TAU subgroups were highly significant, as expected
(combined Hedge’s g = –0.808, z = –3.389, p < .001, 95% CI = –1.276 to
–0.341 for no treatment; combined Hedge’s g = –0.594, z = –3.574, p < .0001,
95% CI = –0.92 to –0.269 for TAU). However, the effect size for studies
comparing CBT to another form of therapy was not significant (combined
Hedge’s g = –0.412, z = –1.619, p = 0.105, 95% CI = –0.910 to 0.087)."
The no-treatment and TAU subgroups were highly significant, as expected
(combined Hedge’s g = –0.808, z = –3.389, p < .001, 95% CI = –1.276 to
–0.341 for no treatment; combined Hedge’s g = –0.594, z = –3.574, p < .0001,
95% CI = –0.92 to –0.269 for TAU). However, the effect size for studies
comparing CBT to another form of therapy was not significant (combined
Hedge’s g = –0.412, z = –1.619, p = 0.105, 95% CI = –0.910 to 0.087).

!CBT (simple) Vs DBT (longer, more intensive, plus groups, etc)
Studies were included in the meta-analysis if they used a form of CBT.
Although there were numerous subtypes of CBT, a broad classification could
be made with respect to
(a)whether the treatment involved DBT close to its conventional format (n = 7) or 
(b)CBT (n = 18). 

This was important because DBT often involves 12 months of treatment, which includes weekly individual
and group sessions, with additional telephone support. Hence, it might have
been supposed that studies based on this form, duration, and intensity of
treatment would favorably bias the result. 

''However, the effect sizes for CBT and DBT were robust and comparable (respectively, combined Hedge’s
g = –0.562, z = –4.244, p < .0001, 95% CI = –0.825 to –0.302; combined Hedge’s g = –0.697, z = –3.057, p < .0001, 95% CI = –1.143 to –0.250).
>//@@"CBT does prove effective when compared with minimal treatment or TAU,
and interestingly, CBT was still effective when studies using control groups
involving active psychological treatments were included in the analysis. This
suggests that CBT may have a specific effect, but it is does not mean that other
treatments cannot be used to counter suicidal thoughts and behaviors. Indeed,
a key question concerns what aspects of therapies are common and effective
in helping those who are suicidal and which are specific."//@@
>>//@@"A further point to consider is that the number of studies that compared CBT with another active
treatment was comparatively low (Donaldson, Spirito, & Esposito-Smythers,
2005; Lerner & Clum, 1990; Liberman & Eckman, 1981;@@ March & the
Treatment for Adolescents With Depression Study Team, 2004; @@McLeavey,
Daly, Ludgate, & Murray, 1994; Patsiokas & Clum, 1985; Rhee et al., 2005;
Tarrier et al., 2006)."//@@

!Publication Bias noted to be likely:
>//@"A methodological caveat concerns publication bias, wherein studies with
a small sample number and large effect size have a disproportionately large
influence on the overall effect size. Though difficult to assess, in the current
analysis, such a bias appeared to be operating."//@@
Thompson EA, Eggert LL, Randell BP, Pike KC (2001),
!Evaluation of Indicated Suicide Risk Prevention Approaches for Potential High School Dropouts
Am J Public Health. 2001;91:742–752

@@see also [[Randell, 01]]@@
This study evaluated the efficacy of 2 indicated preventive interventions,
postintervention and at 9- month follow-up.
Drawn from a pool of potential high school dropouts, 460 youths
were identified as being at risk for suicide and participated in 1 of 3 conditions
randomly assigned by school: 

(1) Counselors CARE (C-CARE) (n = 150), a brief one-to-one assessment and crisis intervention; 
(2) Coping and Support Training (CAST) (n = 155), a smallgroup skills-building and social support intervention delivered with C-CARE;
(3) usual-care control (n=155). 

Survey instruments were administered preintervention, 
following C-CARE (4 weeks), 
following CAST (10 weeks), 
and at a 9-month follow-up.
Growth curve analyses showed significant rates of decline in attitude toward suicide and suicidal ideation associated with the experimental interventions.

C-CARE andCAST, compared with usual care, also were effective in reducing depression and hopelessness.

Among ''females'', reductions in anxiety and anger were greater in response to the experimental programs.
CASTwas most effective in enhancing and sustaining personal control and problem-solving coping for males and females.
School-based, indicated prevention approaches are feasible and effective for reducing suicidal behaviors and related emotional distress and for enhancing protective factors.
|''Author''|Ben Gillies|
|''Description''|Upload a TiddlyWiki file to TiddlyWeb, and import the tiddlers.|
Upload a TiddlyWiki file to TiddlyWeb, and import the tiddlers.
{ //# ensure that the plugin is only installed once
	version.extensions.TiddlyFileImporter = { installed: true };

config.macros.fileImport = {
	reflectorURI: '/reflector?csrf_token=%0',
	incorrectTypeError: 'Incorrect File Type. You must upload a TiddlyWiki',
	uploadLabel: 'Upload',
	uploadLabelPrompt: 'Import tiddlers from this TiddlyWiki',
	step1FileText: 'File:',
	step1PostText: 'In the next screen you will select the tiddlers to import.',
	step1Title: 'Step 1: Pick a TiddlyWiki to import',
	step1TypeChooser: 'Import From:',
	step3Html: ['<input type="hidden" name="markList" />',
		'<input type="hidden" checked="true" name="chkSync" />',
		'<input type="hidden" name="chkSave" />',
		'<input type="hidden" name="txtSaveTiddler" />'].join(),

	handler: function(place, macroName, params, wikifier, paramString) {
		var wizard = new Wizard();
		wizard.createWizard(place, 'Import a TiddlyWiki');

	restart: function(wizard) {
		var me = config.macros.fileImport;
		wizard.addStep(me.step1Title, ['<input type="hidden" ',
			'name="markList" />'].join(""));
		var markList = wizard.getElement('markList');
		var uploadWrapper = document.createElement('div');
		markList.parentNode.insertBefore(uploadWrapper, markList);
		uploadWrapper.setAttribute('refresh', 'macro');
		uploadWrapper.getAttribute('macroName', 'fileImport');
		var iframeName = 'reflectorImporter' + Math.random().toString();
		me.createForm(uploadWrapper, wizard, iframeName);
		$(uploadWrapper).append('<p>' + me.step1PostText + '</p>');
		wizard.setValue('serverType', 'tiddlyweb');
		wizard.setValue('adaptor', new config.adaptors.file());
		wizard.setValue('host', config.defaultCustomFields['']);
		wizard.setValue('context', {});
		var iframe = $(['<iframe name="' + iframeName + '" ',
			'style="display: none" />'].join("")).appendTo(uploadWrapper);
		var onSubmit = function(ev) {
			var uploadType = $('select[name=uploadtype]', wizard.formElem).val();
			if (uploadType == "file") {
				// set an onload ready to hijack the form
				me.setOnLoad(uploadWrapper, wizard, iframe[0]);
				wizard.importType = 'file';
			} else {
				var csrf_token = config.extensions.tiddlyspace.getCSRFToken();
					url: "%0/reflector?csrf_token=%1".format(
						config.defaultCustomFields[""], csrf_token),
					type: "POST",
					dataType: "text",
					data: {
						uri: $("input", ".importFrom", wizard.formElem).val()
					success: function(data, txtStatus, xhr) {
						wizard.POSTResponse = data;
						me.importTiddlers(uploadWrapper, wizard);
					error: function(xhr, txtStatus, error) {
						displayMessage(["There was an error fetching the ",
							'url: ', txtStatus].join(""));
				return false;
			caption: me.uploadLabel,
			tooltip: me.uploadLabelPrompt,
			onClick: onSubmit
		$(wizard.formElem).submit(function(ev) {

	createForm: function(place, wizard, iframeName) {
		var form = wizard.formElem;
		var me = config.macros.fileImport;
		form.action = me.reflectorURI.format(
		form.enctype = 'multipart/form-data';
		form.encoding = 'multipart/form-data';
		form.method = 'POST'; = iframeName;
		onSelectChange = function(e) {
			var changeTo = $(this).val();
			if (changeTo == "file") {
				$(".importFrom").html('%0 <input type="file" name="file" />'.
			} else {
				$(".importFrom").html('URL: <input type="text" name="uri" />'
					+ ' Do you want <a target="_blank" href="">inclusion</a> instead?');
			append($(['<select name="uploadtype"><option value="file" selected="selected">file',
				'<option value="uri">url</select>'].join("")).change(onSelectChange)).
			append('<div class="importFrom">%0<input type="file" name="file" /></div>'.

	setOnLoad: function(place, wizard, iframe) {
		var me = config.macros.fileImport;
		var loadHandler = function() {
			me.importTiddlers.apply(this, [place, wizard, iframe]);
		iframe.onload = loadHandler;
		completeReadyStateChanges = 0;
		iframe.onreadystatechange = function() {
			if (++(completeReadyStateChanges) == 5) {

	importTiddlers: function(place, wizard, iframe) {
		var tmpStore = new TiddlyWiki();
		var POSTedWiki = "";
		if (wizard.importType == "file") {
			try {
				POSTedWiki= iframe.contentWindow
			} catch(e) {
			// now we are done, so remove the iframe
		} else {
			POSTedWiki = wizard.POSTResponse;

		var newTiddlers = tmpStore.getTiddlers();
		var workspace = config.defaultCustomFields['server.workspace'];
		var context = {
			status: true,
			statusText: 'OK',
			httpStatus: 200,
			adaptor: wizard.getValue('adaptor'),
			tiddlers: newTiddlers
		}; = tmpStore;
		wizard.setValue('context', context);
		wizard.setValue('workspace', workspace);
		wizard.setValue('inFileImport', true);
		config.macros.importTiddlers.onGetTiddlerList(context, wizard);

var _onGetTiddler = config.macros.importTiddlers.onGetTiddler;
config.macros.importTiddlers.onGetTiddler = function(context, wizard) {
	if (wizard.getValue('inFileImport')) {
		var me = config.macros.importTiddlers;
			displayMessage("Error in importTiddlers.onGetTiddler: " + context.statusText);
		var tiddler = context.tiddler;
		var fields = tiddler.fields;
		merge(fields, config.defaultCustomFields);
		fields["server.workspace"] = wizard.getValue('workspace');
		delete fields['server.permissions'];
		delete fields['server.bag'];
		fields[''] = 'false';
		delete fields['server.recipe'];
		fields.changecount = 1;
		store.saveTiddler(tiddler.title, tiddler.title, tiddler.text,
			tiddler.modifier, tiddler.modified, tiddler.tags, tiddler.fields,
			false, tiddler.created);
		var remainingImports = wizard.getValue("remainingImports")-1;
		if(remainingImports === 0) {
			if(context.isSynchronous) {
					{caption: me.doneLabel, tooltip: me.donePrompt, onClick: me.onClose}
	} else {
		_onGetTiddler.apply(this, arguments);

var _onCancel = config.macros.importTiddlers.onCancel;
config.macros.importTiddlers.onCancel = function(e)
	var wizard = new Wizard(this);
	if (!wizard.getValue('inFileImport')) {
		return _onCancel.apply(this, arguments);
	var place = wizard.clear();
	return false;

var _step3Html = config.macros.importTiddlers.step3Html;
var _onGetTiddlerList = config.macros.importTiddlers.onGetTiddlerList;
config.macros.importTiddlers.onGetTiddlerList = function(context, wizard) {
	var fileImport = config.macros.fileImport;
	var importTiddlers = config.macros.importTiddlers;
	if (wizard.getValue('inFileImport')) {
		importTiddlers.step3Html = fileImport.step3Html;
	} else {
		importTiddlers.step3Html = _step3Html;
	_onGetTiddlerList.apply(this, arguments);
|''Description''|Provides a TiddlySpace version of the backstage and a homeLink macro|
|''Contributors''|Jon Lister, Jon Robson, Colm Britton|
|''Requires''|TiddlySpaceConfig ImageMacroPlugin TiddlySpaceViewTypes|
.tiddler .error.annotation .button{
	display: inline-block;

#backstageArea {
	z-index: 49;
	color: white;
	background-color: black;
	background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #222),color-stop(0.5, #333),color-stop(1, #555));
	background: -moz-linear-gradient(center bottom,#222 0%, #333 50%, #555 100%);
	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff555555, endColorstr=#ff222222);
	-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff555555, endColorstr=#ff222222)";
	height: 25px;
	padding: 0;

#backstageButton {
	overflow: hidden;

#backstageButton #backstageShow,
#backstageButton #backstageHide {
	margin: 0px;
	padding: 0px;

#backstageButton #backstageShow:hover,
#backstageButton #backstageHide:hover {
	background: none;
	color: none;

#backstageButton img,
#backstageButton svg {
	width: 24px;
	height: 24px;

#messageArea {
	top: 50px;

#backstageToolbar {
	position: relative;

#backstageArea a {
	padding: 0px;
	margin-left: 0px;
	color: white;
	background: none;

#backstageArea a:hover {
	background-color: white;

#backstage ol,
#backstage ul {
	padding: auto;

#backstageButton a {
	margin: 0;

.backstagePanelBody ul {
	padding: 5px;
	margin: 5px;

#backstage #backstagePanel {
	margin-left: 5%;
	padding: 0em;
	margin-right: 5%;

#backstageToolbar a {
	position: relative;

#backstageArea a.backstageSelTab,
#backstageToolbar .backstageTask {
	line-height: 25px;
	color: #767676;

.backstageTask .externalImage,
.backstageTask .image {
	display: inline;

#backstageToolbar a span {
	z-index: 2;

a.backstageTask {
	display: inline;
        margin-left: 1em !important;

.backstagePanelBody .button {
	display: inline-block;
	margin-right: 10px;

.backstagePanelBody {
	margin: 0 0 0 0.6em;
	padding: 0.4em 0.5em 1px 0.5em;

#backstage table {
	margin: auto;

#backstage .wizard table {
	border: 0px;
	margin: 0;

#backstage div  li.listLink {
	border: 0px;
	width: 78%;
	font-size: 0.7em;

#backstage div li.listTitle {
	font-weight: bold;
	text-decoration: underline;
	font-size: 1em;
	background: #ccc;
	width: 100%;

#backstage fieldset {
	border: solid 1px [[ColorPalette::Background]];

#backstage .viewer table,#backstage table.twtable {
	border: 0px;

#backstageToolbar img {
	padding: 0;

#backstage .wizard,
#backstage .wizardFooter {
	background: none;

.viewer td, .viewer tr, .twtable td, .twtable tr {
	border: 1px solid #eee;

#backstage .inlineList ul li {
	background-color: [[ColorPalette::Background]];
	border: solid 1px [[ColorPalette::TertiaryMid]];
	display: block;
	float: left;
	list-style: none;
	margin-right: 1em;
	padding: 0.5em;

.backstageClear, .inlineList form {
	clear: both;
	display: block;
	margin-top: 3em;

.tiddlyspaceMenu {
	text-align: center;

span.chunkyButton {
	display: inline-block;
	padding: 0;
	margin: 0;
	border: solid 2px #000;
	background-color: #04b;

span.chunkyButton a.button, span.chunkyButton a:active.button {
	white-space: nowrap;
	font-weight: bold;
	font-size: 1.8em;
	color: #fff;
	text-align: center;
	padding: 0.5em 0.5em;
	margin: 0;
	border-style: none;
	display: block;

span.chunkyButton:hover {
	background-color: #014;

span.chunkyButton a.button:hover {
	border-style: none;
	background: none;
	color: #fff;

#backstage .unpluggedSpaceTab .wizard,
.unpluggedSpaceTab .wizard {
	background: white;
	border: 2px solid #CCC;
	padding: 5px;

.syncKey .keyItem {
	border: 1px solid black;
	display: inline-block;
	margin: 0.2em;
	padding: 0.1em 0.1em 0.1em 0.1em;

.keyHeading {
	font-size: 2em;
	font-weight: bold;
	margin: 0.4em 0em -0.2em;

.unpluggedSpaceTab .putToServer,
.unpluggedSpaceTab .notChanged {
	display: none;

.tiddlyspaceMenu ul {
	margin: 0;
	padding: 0;

.tiddlyspaceMenu ul li {
	list-style: none;

.unsyncedChanges .unsyncedList {
	display: block;

.unsyncedList {
	display: none;
(function ($) {
    var name = "StyleSheet" + tiddler.title;
    config.shadowTiddlers[name] = "/*{{{*/\n%0\n/*}}}*/".
        format(store.getTiddlerText(tiddler.title + "##StyleSheet")); // this accesses the StyleSheet section of the current tiddler (the plugin that contains it)
    store.addNotification(name, refreshStyles);

    if (!config.extensions.tiddlyweb.status.tiddlyspace_version) { // unplugged
        config.extensions.tiddlyweb.status.tiddlyspace_version = "<unknown>";
        config.extensions.tiddlyweb.status.server_host = {
   }; // TiddlySpaceLinkPlugin expects this
    var disabled_tasks_for_nonmembers = ["tiddlers", "plugins", "batch", "sync"];

    var tweb = config.extensions.tiddlyweb;
    var tiddlyspace = config.extensions.tiddlyspace;
    var currentSpace =;
    var imageMacro = config.macros.image;

    if (config.options.chkBackstage === undefined) {
        config.options.chkBackstage = false;

// Set up Backstage
    config.tasks = {};
    config.tasks.status = {
        tooltip:"TiddlySpace Info",
        content:"<<tiddler Backstage##Menu>>"
    config.tasks.tiddlers = {
        tooltip:"tiddlers control panel",
        content:"<<tiddler Backstage##BackstageTiddlers>>"
    config.tasks.plugins = {
        tooltip:"Manage installed plugins",
        content:"<<tiddler Backstage##Plugins>>"
    config.tasks.batch = {
        tooltip:"Batch manage public/private tiddlers",
        content:"<<tiddler Backstage##BatchOps>>"
    config.tasks.tweaks = {
        tooltip:"Tweak TiddlyWiki behaviors",
        content:"<<tiddler Backstage##Tweaks>>"
    config.tasks.exportTiddlers = {
        tooltip:"Import/export tiddlers from/to a TiddlyWiki",
        content:"<<tiddler Backstage##ImportExport>>"
    config.tasks.sync = {
        tooltip:"Check Sync status",
        content:"<<tiddler Backstage##SpaceUnplugged>>"

    if (window.location.protocol === "file:") {
        config.unplugged = true;

    config.backstageTasks = ["status", "tiddlers", "plugins",
        "batch", "tweaks", "exportTiddlers", "sync"];

    config.messages.backstage.prompt = "";
// initialize state
    var _show =; = function () {
        // selectively hide backstage tasks and tabs based on user status
        var tasks = $("#backstageToolbar .backstageTask").show();
        var bs = backstage.tiddlyspace;
        if (!config.unplugged) {
            tweb.getUserInfo(function (user) {
                if (user.anon) {
                    jQuery.each(disabled_tasks_for_nonmembers, function (i, task) {
                        var taskIndex = config.backstageTasks.indexOf(task);
                        if (taskIndex !== -1) {
                            config.backstageTasks.splice(taskIndex, 1);
                    config.messages.memberStatus = bs.locale.loggedout;
                } else {
                    config.messages.memberStatus = readOnly ?
                        bs.locale.nonmember : bs.locale.member;
        } else {
            config.messages.memberStatus = bs.locale.unplugged;

        // display backstage
        return _show.apply(this, arguments);
    if (readOnly) {
        jQuery.each(disabled_tasks_for_nonmembers, function (i, task) {
            var taskIndex = config.backstageTasks.indexOf(task);
            if (taskIndex !== -1) {
                config.backstageTasks.splice(taskIndex, 1);

    var tasks = config.tasks;
    var commonUrl = "/bags/common/tiddlers/%0";

    backstage.tiddlyspace = {
            member:"You are a member of this space.",
            nonmember:"You are not a member of this space.",
            loggedout:"You are currently logged out of TiddlySpace.",
            unplugged:"You are unplugged."
        showButton:function () {
            var showBtn = $("#backstageShow")[0];
            var altText = $(showBtn).text();
            imageMacro.renderImage(showBtn, "backstage.svg",
                { altImage:commonUrl.format("backstage.png"), alt:altText});
        hideButton:function () {
            var hideBtn = $("#backstageHide")[0];
            var altText = $(hideBtn).text();
            imageMacro.renderImage(hideBtn, "close.svg",
                { altImage:commonUrl.format("close.png"), alt:altText, width:24, height:24 });

    var _init = backstage.init;
    backstage.init = function () {
        _init.apply(this, arguments);
        var init = function (user) {
            var bs = backstage.tiddlyspace;

    var home = config.macros.homeLink = {
            linkText:"your home space"
        handler:function (place) {
            var container = $("<span />").appendTo(place)[0];
            tweb.getUserInfo(function (user) {
                if (!user.anon && !== currentSpace) {
                    createSpaceLink(container,, null, home.locale.linkText);

    config.macros.exportSpace = {
        handler:function (place, macroName, params) {
            var filename = params[0] ||
            $('<a class="button">download</a>').// XXX: i18n
                attr("href", filename).appendTo(place);

(function() {
var getCSRFToken = function(window) {
	// XXX: should not use RegEx - cf.
	var regex = /^(?:.*; )?csrf_token=([^(;|$)]*)(?:;|$)/;
	var match = regex.exec(document.cookie);
	var csrf_token = null;
	if (match && (match.length === 2)) {
		csrf_token = match[1];

	return csrf_token;

if (typeof config !== 'undefined' && config.extensions &&
		config.extensions.tiddlyspace &&
		config.extensions.tiddlyspace.getCSRFToken === null) {
	config.extensions.tiddlyspace.getCSRFToken = getCSRFToken;
} else {
	window.getCSRFToken = getCSRFToken;
|''Description''|provides a toolbar command for cloning external tiddlers|
|''Requires''|TiddlySpaceConfig TiddlySpaceFilters|
(function($) {

var cmd = config.commands;
var tiddlyspace = config.extensions.tiddlyspace;

var fieldsCache = {};

cmd.cloneTiddler = {
	text: cmd.editTiddler.text,
	tooltip: "Create a copy of this tiddler in the current space",
	errorMsg: "Error publishing %0: %1",

	isEnabled: function(tiddler) {
		return ! && !readOnly;
	handler: function(ev, src, title) {
		var tiddler = store.getTiddler(title);
		if(tiddler) {
			fieldsCache[title] = $.extend({}, tiddler.fields);
			tiddler.fields["server.workspace"] = tiddlyspace.getCurrentWorkspace(config.options.chkPrivateMode ?
		"private" : "public");
			tiddler.fields["server.permissions"] = "read, write, create"; // no delete
			delete tiddler.fields[""];
			delete tiddler.fields["server.title"];
			delete tiddler.fields["server.etag"];
			// special handling for pseudo-shadow tiddlers
			if(tiddlyspace.coreBags.contains(tiddler.fields["server.bag"])) {
		} else { // ensure workspace is the current space
			var el = story.findContainingTiddler(src);
			el = $(el);
			var fields = el.attr("tiddlyfields");
			if(fields) { // inherited via TiddlyLink
				fields = fields.decodeHashMap();
				fields["server.workspace"] = config.
			} else {
				fields = config.defaultCustomFields;
			fields = String.encodeHashMap(fields);
			el.attr("tiddlyfields", fields);
		cmd.editTiddler.handler.apply(this, arguments);
		if(tiddler) {
			tiddler.fields["server.permissions"] += ", delete";
		return false;

cmd.editTiddler.isEnabled = function(tiddler) {
	return !cmd.cloneTiddler.isEnabled.apply(this, arguments);

// hijack cancelTiddler to restore original fields
var _cancelHandler = cmd.cancelTiddler.handler;
cmd.cancelTiddler.handler = function(ev, src, title) {
	var tiddler = store.getTiddler(title);
	if(tiddler) {
		tiddler.fields = fieldsCache[title] || tiddler.fields;
		delete fieldsCache[title];
	return _cancelHandler.apply(this, arguments);

// hijack saveTiddler to clear unused fields stash
var _saveHandler = cmd.saveTiddler.handler;
cmd.saveTiddler.handler =  function(ev, src, title) {
	delete fieldsCache[title];
	return _saveHandler.apply(this, arguments);

|''Description''|TiddlySpace configuration|
|''Requires''|TiddlyWebConfig ServerSideSavingPlugin TiddlyFileImporter|
(function($) {

var tweb = config.extensions.tiddlyweb;

var recipe = config.defaultCustomFields["server.workspace"].split("recipes/")[1];
var currentSpace; // assigned later

var disabledTabs = [];

var coreBags = ["system", "tiddlyspace"];
var systemSpaces = ["plugins", "info", "images", "theme"];
systemSpaces = $.map(systemSpaces, function(item, i) {
	return "system-%0_public".format(item);

// hijack search macro to add custom attributes for mobile devices
var _search =; = function(place, macroName, params) {
	_search.apply(this, arguments);
	$(".searchField:input", place).
		attr({ autocapitalize: "off", autocorrect: "off" });

// arg is either a container name or a tiddler object
// if fuzzy is truthy, space may be inferred from workspace (for new tiddlers)
// returns space object or false
var determineSpace = function(arg, fuzzy) {
	if(typeof arg == "string") { // container name
		var space = split(arg, "_", "r");
		return ["public", "private"].contains(space.type) ? space : false;
	} else if(arg) { // tiddler
		var container = determineContainer(arg, fuzzy);
		return container ? determineSpace(, fuzzy) : false;
	} else {
		return false;

// if fuzzy is truthy, container may be inferred from workspace for new tiddlers
// returns container object or false
var determineContainer = function(tiddler, fuzzy) { // TODO: expose?
	var bag = tiddler.fields["server.bag"];
	var recipe = tiddler.fields["server.recipe"]; // XXX: unused/irrelevant/redundant!?
	if(bag) {
		return { type: "bag", name: bag };
	} else if(recipe) {
		return { type: "recipe", name: recipe };
	} else if(fuzzy) { // new tiddler
		var workspace = tiddler.fields["server.workspace"];
		if(workspace) {
			var container = split(workspace, "/", "l");
			return ["bags", "recipes"].contains(container.type) ? container : false;
		} else {
			return false;
	} else {
		return false;

// hijack removeTiddlerCallback to restore tiddler from recipe cascade -- TODO: move into TiddlyWebWiki?
var sssp = config.extensions.ServerSideSavingPlugin;
var _removeTiddlerCallback = sssp.removeTiddlerCallback;
sssp.removeTiddlerCallback = function(context, userParams) {
	var title = context.tiddler.title;
	var recipe = context.tiddler.fields["server.recipe"];
	_removeTiddlerCallback.apply(this, arguments);
	if(recipe) {
		context.workspace = "recipes/" + recipe;
		var callback = function(context, userParams) {
			if(context.status) {
				var dirty = store.isDirty();
			} else {
				store.notify(title, true);
		context.adaptor.getTiddler(title, context, null, callback);

// splits a string once using delimiter
// mode "l" splits at the first, "r" at the last occurrence
// returns an object with members type and name
var split = function(str, sep, mode) {
	mode = mode == "r" ? "pop" : "shift"; // TODO: use +/-1 instead of "l"/"r"?
	var arr = str.split(sep);
	var type = arr.length > 1 ? arr[mode]() : null;
	return { type: type, name: arr.join(sep) };

var plugin = config.extensions.tiddlyspace = {
	currentSpace: determineSpace(recipe),
	coreBags: coreBags.concat(systemSpaces),

	determineSpace: determineSpace,
	isValidSpaceName: function(name) {
		return name.match(/^[a-z][0-9a-z\-]*[0-9a-z]$/) ? true : false;
	getCurrentBag: function(type) {
		return "%0_%1".format(currentSpace, type);
	getCurrentWorkspace: function(type) {
		return "bags/" + this.getCurrentBag(type);
	// returns the URL for a space's avatar (SiteIcon) based on a server_host
	// object and an optional space name
	// optional nocors argument prevents cross-domain URLs from being generated
	getAvatar: function(host, space, nocors) {
		if(space && typeof space != "string") { // backwards compatibility -- XXX: deprecated
			space =;
		var subdomain = nocors ? currentSpace : space;
		host = host ? this.getHost(host, subdomain) : "";
		var bag = space ? "%0_public".format(space) : "tiddlyspace";
		return "%0/bags/%1/tiddlers/SiteIcon".format(host, bag);
	// returns the URL based on a server_host object (scheme, host, port) and an
	// optional subdomain
	getHost: function(host, subdomain) {
		if(host === undefined) { // offline
			tweb.status.server_host = {}; // prevents exceptions further down the stack -- XXX: hacky workaround, breaks encapsulation
			return null;
		subdomain = subdomain ? subdomain + "." : "";
		var url = "%0://%1%2".format(host.scheme, subdomain,;
		var port = host.port;
		if(port && !["80", "443"].contains(port)) {
			url += ":" + port;
		return url;
	disableTab: function(tabTiddler) {
		if(typeof(tabTiddler) == "string") {
		} else {
			for(var i = 0; i < tabTiddler.length; i++) {
    checkSyncStatus: function(tiddler) {
		if(tiddler) {
			var title = typeof(tiddler) === "string" ? tiddler : tiddler.title;
			var el = story.getTiddler(title) || false;
			if(el) {
	isDisabledTab: function(tabTitle) {
		var match = new RegExp("(?:\\[\\[([^\\]]+)\\]\\])", "mg").exec(tabTitle);
		var tabIdentifier = match ? match[1] : tabTitle;
		return disabledTabs.contains(tabIdentifier);
	getCSRFToken: window.getCSRFToken || null // this may not have been processed yet

currentSpace =;

tweb.serverPrefix ="/")[3] || ""; // XXX: assumes root handler
tweb.getStatus(function(status) {
	var url = plugin.getHost(status.server_host);
	tweb.status.server_host.url = url;
	config.messages.tsVersion = status.version;

if(window.location.protocol == "file:") {
	// enable AutoSave by default
	config.options.chkAutoSave = config.options.chkAutoSave === undefined ?
		true : config.options.chkAutoSave;
} else {
	// set global read-only mode based on membership heuristics
	var indicator = store.getTiddler("SiteTitle") || tiddler;
	readOnly = !(recipe.split("_").pop() == "private" ||
		tweb.hasPermission("write", indicator));
	// replace TiddlyWiki's ImportTiddlers due to cross-domain restrictions
	if(config.macros.fileImport) {
		$.extend(config.macros.importTiddlers, config.macros.fileImport);

// hijack saveChanges to ensure SystemSettings is private by default
var _saveChanges = saveChanges;
saveChanges = function(onlyIfDirty, tiddlers) {
	if(tiddlers && tiddlers.length == 1 &&
			tiddlers[0] && tiddlers[0].title == "SystemSettings") {
		var fields = tiddlers[0].fields;
		delete fields["server.recipe"];
		fields["server.bag"] = plugin.getCurrentBag("private");
		fields["server.workspace"] = plugin.getCurrentWorkspace("private");
	return _saveChanges.apply(this, arguments);

// ensure backstage is always initialized
// required to circumvent TiddlyWiki's read-only based handling
config.macros.backstageInit = {
	init: function() {
		showBackstage = true;

// disable evaluated macro parameters for security reasons
config.evaluateMacroParameters = "none";
var _parseParams = String.prototype.parseParams;
String.prototype.parseParams = function(defaultName, defaultValue, allowEval,
		noNames, cascadeDefaults) {
	if(config.evaluateMacroParameters == "none") {
		arguments[2] = false;
	return _parseParams.apply(this, arguments);

var _tabsMacro = config.macros.tabs.handler;
config.macros.tabs.handler = function(place, macroName, params) {
	var newParams = [params[0]]; // keep cookie name
	for(var i = 1; i < params.length; i += 3) {
		var tabTitle = params[i + 2];
			newParams = newParams.concat(params[i], params[i + 1], tabTitle);
	_tabsMacro.apply(this, [place, macroName, newParams]);

// disable ControlView for XHRs by default
	beforeSend: function(xhr) {
		xhr.setRequestHeader("X-ControlView", "false");
// TiddlyWeb adaptor currently still uses httpReq, which needs extra magic -- XXX: obsolete this!
var _httpReq = httpReq;
httpReq = function(type, url, callback, params, headers, data, contentType,
		username, password, allowCache) {
	headers = headers || {};
	headers["X-ControlView"] = "false";
	_httpReq.apply(this, arguments);

// register style sheet for backstage separately (important)
store.addNotification("StyleSheetBackstage", refreshStyles);

// option for default privacy setting
config.optionsDesc.chkPrivateMode = "Set your default privacy mode to private";
config.optionsSource.chkPrivateMode = "setting";
config.options.chkPrivateMode = config.options.chkPrivateMode || false;
saveSystemSetting("chkPrivateMode", true);
config.defaultCustomFields["server.workspace"] = plugin.
	getCurrentWorkspace(config.options.chkPrivateMode ? "private" : "public");

config.paramifiers.follow = {
	onstart: function(v) {
		if(!readOnly) {
			var bag = "%0_public".format(currentSpace);
			story.displayTiddler(null, v, DEFAULT_EDIT_TEMPLATE, null, null,
				"server.bag:%0 server.workspace:bags/%0".format(bag));
			story.setTiddlerTag(v, "follow", 1);
			story.focusTiddler(v, "text");

var fImport = config.macros.fileImport;
if(fImport) {
	fImport.uploadTo = "Upload to: ";
	var _createForm = config.macros.fileImport.createForm;
	config.macros.fileImport.createForm = function(place, wizard, iframeName) {
		var container = $("<div />").text(fImport.uploadTo).appendTo(place);
		var select = $('<select name="mode" />').appendTo(container)[0];
		$('<option value="private" selected>private</a>').appendTo(select);
		$('<option value="public">public</a>').appendTo(select);
		wizard.setValue("importmode", select);
		_createForm.apply(this, [place, wizard, iframeName]);

	var _onGet = config.macros.importTiddlers.onGetTiddler;
	config.macros.importTiddlers.onGetTiddler = function(context, wizard) {
		var type = $(wizard.getValue("importmode")).val();
		var ws =  plugin.getCurrentWorkspace(type);
		wizard.setValue("workspace", ws);
		_onGet.apply(this, [context, wizard]);

config.extensions.ServerSideSavingPlugin.reportSuccess = function(msg, tiddler) {
	msg = config.extensions.ServerSideSavingPlugin.locale[msg];
	var link = "/" + encodeURIComponent(tiddler.title);
	displayMessage(msg.format([tiddler.title]), link);

|''Description''|provide TiddlySpace-specific filter extensions|
|''Author''|Jon Robson|
<<tsList Private>>
<<tsList Public>>
<<tsList Draft>>
(function($) {

var tiddlyspace = config.extensions.tiddlyspace;
var privateBag = tiddlyspace.getCurrentBag("private");
var publicBag = tiddlyspace.getCurrentBag("public");

config.filterHelpers = {
	is: {
		"private": function(tiddler) {
			var bag = tiddler.fields["server.bag"];
			return bag == privateBag;
		"public": function(tiddler) {
			var bag = tiddler.fields["server.bag"];
			return bag == publicBag;
		draft: function(tiddler) {
			var fields = tiddler.fields;
			var bag = fields["server.bag"];
			return (privateBag == bag && fields[""]) ? true : false;
		local: function(tiddler) {
			return["public"](tiddler) ||["private"](tiddler);
		unsynced: function(tiddler) {
			return tiddler ? tiddler.isTouched() : false;
}; = function(results, match) {
	var candidates = store.getTiddlers("title");
	var type = match[3];
	for (var i = 0; i < candidates.length; i++) {
		var tiddler = candidates[i];
		var helper =[type];
		if(helper && helper(tiddler)) {
	return results;

|''Description''|Provides a following macro|
|''Author''|Jon Robson|
|''Requires''|TiddlySpaceConfig TiddlySpaceTiddlerIconsPlugin ErrorHandler|
Tag a tiddler with "follow" to express a list of followers.
Using the {{{<<followTiddlers X>>}}}
will reveal the number of tiddlers with name X in the set of spaces the *current* user viewing your space follows.
{{{<<following jon>>}}} will list all the users following Jon.
{{{<<followers jon>>}}} will list all the followers of jon.
{{{<linkedTiddlers>>}}} will list all tiddlers across TiddlySpace linked to the current tiddler
{{{<linkedTiddlers follow:yes>>}}} will list all tiddlers across TiddlySpace that come from your list of followers
adds spaceLink view type {{{<<view server.bag spaceLink>>}}} creates a link to the space described in server.bag
{{{<<view server.bag spaceLink title>>}}} makes a link to the tiddler with title expressed in the field title in space server.bag
If no name is given eg. {{{<<following>>}}} or {{{<<follow>>}}} it will default the current user.
.followTiddlersList li {

.followButton {
	width: 2em;

.followTiddlersList li .siteIcon {
	width: 48px;

#sidebarTabs .followers li a,
.followers .siteIcon,
.followers .siteIcon div {
	display: inline;

.followTiddlersList li .externalImage, .followTiddlersList li .image {
	display: inline;

.scanResults li {
	list-style: none;
(function($) {

var tweb = config.extensions.tiddlyweb;
var tiddlyspace = config.extensions.tiddlyspace;
var currentSpace =;

var shadows = config.shadowTiddlers;
config.annotations.ScanTemplate = "This tiddler is the default template used in the display of tiddlers founding using the tsScan macro. To access attributes use the view macro e.g. {{{<<view title text>>}}}";
shadows.ScanTemplate = "<<view modifier SiteIcon width:24 height:24 spaceLink:yes label:no>> <<view title link>>";
shadows.FollowersTemplate = "<<view server.bag SiteIcon width:24 height:24 spaceLink:yes label:no>> <<view server.bag spaceLink>>";
shadows.FollowingTemplate = "<<view title SiteIcon width:24 height:24 spaceLink:yes label:no>> <<view title spaceLink>>";
shadows.FollowTiddlersBlackList = "";
shadows.FollowTiddlersHeading = "There are tiddlers in spaces you follow using the follow tag which use the title <<view title text>>";
shadows.FollowTiddlersTemplate = ["* <<view SiteIcon width:24 height:24 spaceLink:yes label:no>> ",
	"<<view spaceLink title external:no>> modified by <<view modifier spaceLink>> ",
	"in the <<view spaceLink>> space (<<view modified date>> @ <<view modified date 0hh:0mm>>).\n"].join("");

var name = "StyleSheetFollowing";
shadows[name] = "/*{{{*/\n%0\n/*}}}*/".
	format(store.getTiddlerText(tiddler.title + "##StyleSheet"));
store.addNotification(name, refreshStyles);

// provide support for sucking in tiddlers from the server
tiddlyspace.displayServerTiddler = function(src, title, workspace, callback) {
	var adaptor = store.getTiddlers()[0].getAdaptor();
	var localTitle = tiddlyspace.getLocalTitle(title, workspace);
	var tiddler = new Tiddler(localTitle);
	tiddler.text = "Please wait while this tiddler is retrieved...";
	tiddler.fields.doNotSave = "true";
	src = story.displayTiddler(src || null, tiddler.title);
	tweb.getStatus(function(status) {
		var context = {
			host:, // TODO: inherit from source tiddler?
			workspace: workspace,
			headers: { "X-ControlView": "false" }
		var getCallback = function(context, userParams) {
			var tiddler = context.tiddler;
			tiddler.title = localTitle;
			story.refreshTiddler(localTitle, null, true); // overriding existing allows updating
			if(callback) {
				callback(src, tiddler);
		adaptor.getTiddler(title, context, null, getCallback);

tiddlyspace.scroller = {
	runHandler: function(title, top, bottom, height) {
		var i;
		var handlers = tiddlyspace.scroller.handlers;
		var tidEl = story.getTiddler(title);
		if(tidEl) {
			var topEl = $(tidEl).offset().top + 20;
			if(top === false || (topEl > top && topEl < bottom)) {
				var h = handlers[title];
				for(i = 0; i < h.length; i++) {
		} else {
	clearHandlers: function(title) {
		tiddlyspace.scroller.handlers[title] = [];
	registerIsVisibleEvent: function(title, handler) {
		tiddlyspace.scroller.handlers[title] = tiddlyspace.scroller.handlers[title] || [];
	init: function() {
		this.handlers = {};
		this.interval = window.setInterval(function() {
			var top = $(window).scrollTop();
			var height = $(window).height();
			var bottom = top + height;
			var title;
			for(title in tiddlyspace.scroller.handlers) {
				if(title) {
					tiddlyspace.scroller.runHandler(title, top, bottom, height);
		}, 2000); // every 2 seconds check scroll position

var followMacro = config.macros.followTiddlers = {
	locale: {
		followListHeader: "Here are tiddlers from spaces you follow using the follow tag which use this title.",
		noTiddlersFromFollowers: "None of the spaces you follow contain a tiddler with this name.",
		errorMessage: "There was a problem retrieving tiddlers from the server. Please try again later."
	init: function() {
		followMacro.lookup = {};
	followTag: "follow",
	getHosts: function(callback) {
		tweb.getStatus(function(status) {
			callback(, tiddlyspace.getHost(status.server_host, "%0"));
	getBlacklist: function() {
		return store.getTiddlerText("FollowTiddlersBlackList").split("\n");
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var args = paramString.parseParams("anon")[0];
		var containingTiddler = story.findContainingTiddler(place).getAttribute('tiddler');
		var title = (args.anon && args.anon[0]) || tiddler.fields["server.title"] || tiddler.title;
		var tid = store.getTiddler(title);
		var user = params[1] || false;
		if(tid) {
			followMacro.makeButton(place, {
				url: "/search?q=title:%22" + encodeURIComponent(title) + "%22",
				containingTiddler: containingTiddler,
				blacklisted: followMacro.getBlacklist(), title: title, user: user,
				consultFollowRelationship: (args.follow &&
					args.follow[0] === 'false') ? false : true });
	makeButton: function(place, options) { // this is essentially the same code in TiddlySpaceFollowingPlugin
		var title = options.title;
		var blacklisted = options.blacklisted;
		var tiddler = store.getTiddler(title);
		var btn = $('<div class="followButton" />').addClass("notLoaded").appendTo(place)[0];
		if(blacklisted.contains(title)) {
		} else {
			var user = options.user;
			window.setTimeout(function() { // prevent multiple calls due to refresh
				tiddlyspace.scroller.registerIsVisibleEvent(options.containingTiddler, function() {
					var mkButton = function(followers, ignore) {
						if(!followers && !ignore) {
						} else {
							$("<a />").appendTo(btn);
							var scanOptions = { url: options.url,
								spaceField: options.spaceField || "bag", template: null, sort: "-modified",
								callback: function(tiddlers) {
									followMacro.constructInterface(btn, tiddlers);
							if(!ignore) {
								scanOptions.showBags = followMacro._getFollowerBags(followers);
							scanOptions.hideBags = [tiddler.fields["server.bag"]];
							scanMacro.scan(null, scanOptions, user);
					if(options.consultFollowRelationship) {
					} else {
						mkButton([], true);
			}, 1000);
	constructInterface: function(container, tiddlers) {
		var txt = tiddlers.length;
		var className = txt > 0 ? "hasReplies" : "noReplies";
		var el = $(story.findContainingTiddler(container));
		var btn = $("<a />").addClass("followedTiddlers").text(txt).
			click(function(ev) {
			}).appendTo('<div class="followedTiddlers" />').appendTo(container)[0];
		$.data(btn, "tiddlers", tiddlers);
	followingOnClick: function(ev) {
		var target =;
		var locale = followMacro.locale;
		var el = $('<div class="followTiddlersList" />')[0];
		var popup = Popup.create(target,"div");
		$(popup).addClass("taggedTiddlerList followList").click(function(ev) { // make it so only clicking on the document outside the popup removes the popup
			if( != document) {
		var tiddlers = $.data(target, "tiddlers") || [];
		scanMacro.template(el, tiddlers.slice(0,1), "FollowTiddlersHeading");
		scanMacro.template(el, tiddlers, "FollowTiddlersTemplate");
		if(tiddlers.length === 0) {
			$("<li />").text(locale.noTiddlersFromFollowers).appendTo(el);
		return popup;
	_getFollowerBags: function(followers) { // XXX: private or not?
		return $.map(followers, function(name, i) {
			return name != currentSpace ? "%0_public".format(name) : null;
	getFollowers: function(callback, username) {
		// returns a list of spaces being followed by the existing space
		var followersCallback = function(user) {
			if(!user.anon) {
				scanMacro.scan(null, { 
					url: "/search?q=bag:%0_public tag:%1 _limit:%2".format(, followMacro.followTag, LIMIT_FOLLOWING),
					spaceField: "title", template: null, cache: true,
					callback: function(tiddlers) {
						var followers = [];
						for(var i = 0; i < tiddlers.length; i++) {
			} else {
		return !username ? tweb.getUserInfo(followersCallback) : followersCallback({ name: username });

var scanMacro = config.macros.tsScan = {
	init: function () {
		this.scanned = {};
	_tiddlerfy: function(jsontiddlers, options) {
		var tiddlers = [];
		var spaceField = options.spaceField || "bag"; // TODO: phase out use view types instead
		$.each(jsontiddlers, function(i, t) {
			var use = false;
			if(!options.showBags || (options.showBags && options.showBags.contains(t.bag))) {
				use = true;
			if(options.hideBags && options.hideBags.contains(t.bag)) {
				use = false;
			if(use) {
				var spaceName = t[spaceField];
				var tiddler = config.adaptors.tiddlyweb.toTiddler(t,;
				tiddler.fields[""] = tiddlyspace.resolveSpaceName(spaceName);
		return tiddlers;
	_scanCallback: function(place, jsontiddlers, options) {
		var locale = followersMacro.locale;
		var tiddlers = scanMacro._tiddlerfy(jsontiddlers, options);
		if(options.sort) {
			tiddlers = store.sortTiddlers(tiddlers, options.sort);
		if(options.filter) {
			var _store = new TiddlyWiki();
			config.lastStore = _store;
			for(var i = 0; i < tiddlers.length; i++) {
				var clone = tiddlers[i];
				clone.title = tiddlyspace.getLocalTitle(clone.title, clone.fields['server.workspace']);
			tiddlers = _store.filterTiddlers(options.filter);
		if(place) {
			var list = $("<ul />").appendTo(place)[0];
			scanMacro.template(list, tiddlers, options.template);
			if(tiddlers.length === 0) {
				$("<li />").text(options.emptyMessage || locale.noone).appendTo(list);
		if(options.callback) {
	constructSearchUrl: function(host, options) {
		if(options.url) {
			return options.url;
		var inputs = options.searchValues;
		var tag = options.tag;
		var searchField = options.searchField || "title";
		var searchQuery = [];
		for(var i = 0; i < inputs.length; i++) {
			searchQuery.push('%0:"%1"'.format(searchField, inputs[i]));
		var query = searchQuery.join(" OR ");
		query = tag ? "(%0) AND tag:%1".format(query, tag) : query;
		query = options.query ? "%0;%1;".format(query, options.query) : query;
		query = options.fat ? "%0&fat=1".format(query) : query;
		return '%0/search?q=%1'.format(host, query);
	scan: function(place, options) { // TODO: make use of list macro with url filter
		var locale = followersMacro.locale;
		options.template = options.template ? options.template : "ScanTemplate";
		followMacro.getHosts(function(host, tsHost) {
			options = options ? options: {};
			var url = scanMacro.constructSearchUrl(host, options);
			if(options.cache && scanMacro.scanned[url]) {
				var tiddlers = scanMacro.scanned[url].tiddlers;
				var run = function(tiddlers) {
					scanMacro._scanCallback(place, tiddlers, options);
				if(tiddlers) {
				} else {
			} else {
				var callback = function(tiddlers) {
					scanMacro._scanCallback(place, tiddlers, options);
				if(scanMacro.scanned[url] && scanMacro.scanned[url].callbacks) {
				} else {
					scanMacro.scanned[url] = {
						callbacks: [callback]
					url: url,
					dataType: "json",
					success: function(tiddlers) {
						scanMacro.scanned[url].tiddlers = tiddlers;
						var callbacks = scanMacro.scanned[url].callbacks;
						while(callbacks.length > 0) {
					error: function(xhr) {
						$("<span />").addClass("annotation error").text(locale.error.format(xhr.status)).appendTo(place);
	template: function(place, tiddlers, template) { // TODO: make use of list macro.
		for(var i = 0; i < tiddlers.length; i++) {
			var tiddler = tiddlers[i];
			var item = $('<li class="spaceName" />').appendTo(place)[0];
			var spaceName = tiddler.fields[""] || "";
			var templateText = store.getTiddlerText(template).replace(/\$1/mg, spaceName);
			wikify(templateText, item, null, tiddler);
	getOptions: function(paramString, tiddler) {
		var args = paramString.parseParams("name", null, true, false, true)[0];
		var options = { query: false, sort: false, tag: false, template: false, showBags: || false,
			hideBags: args.hide || false, filter: false, spaceField: "bag", searchField: "title", fat: false,
			emptyMessage: false };
		for(var name in args) {
			if(name != "name") {
				if(name == "fat") {
					options[name] = true;
				} else {
					options[name] = args[name][0];
		// if user has set searchField to modifier, then use the modifiers value if available otherwise use searchValues.
		var searchField = options.searchField;
		var searchValues = args[searchField] ? args[searchField] : args.searchValues;
		// if neither of those were used use the first parameter
		var defaultValues = tiddler ? [ tiddler.title ] : [];
		options.searchValues = searchValues ? searchValues : ( ? [[0]] : defaultValues);
		return options;
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var container = $("<div />").addClass("scanResults resultsArea").appendTo(place)[0];
		var options = scanMacro.getOptions(paramString, tiddler);
		scanMacro.scan(container, options);

var followersMacro = config.macros.followers = {
	locale: {
		loggedOut: "Please login to see the list of followers",
		noSupport: "We were unable to retrieve followers as your browser does not support following.",
		pleaseWait: "Please wait while we look this up...",
		error: "Error %0 occurred whilst retrieving data from server",
		noone: "None."
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var locale = followersMacro.locale;
		var args = paramString.parseParams("name", null, true, false, true)[0];
		var username = ?[0] : false;
		var container = $('<div class="followers" />').text(locale.pleaseWait).
		var followersCallback = function(user) {
			if(user.anon) {
				$("<span />").text(locale.loggedOut).appendTo(container);
			} else {
				var options = scanMacro.getOptions(paramString);
				$.extend(options, {
					url: "/search?q=title:@%0 OR title:%0 tag:%1 _limit:%2".
						format(, followMacro.followTag, LIMIT_FOLLOWING),
					spaceField: "bag",
					template: options.template ? options.template : "FollowersTemplate"
				scanMacro.scan(container, options);
		return !username ? followersCallback({ name: currentSpace }) : followersCallback({ name: username });

var followingMacro = config.macros.following = {
	locale: {
		pleaseWait: followersMacro.locale.pleaseWait,
		loggedOut: "Please login to see who you are following",
		noSupport: followersMacro.locale.noSupport,
		error: followersMacro.locale.error,
		noone: followersMacro.locale.noone
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var locale = followingMacro.locale;
		var args = paramString.parseParams("name", null, true, false, true)[0];
		var fat = args.fat ? true : false;
		var username = ?[0] : false;
		var container = $('<div class="following" />').text(locale.pleaseWait).
		var followingCallback = function(user) {
			if(user.anon) {
				$("<span />").text(locale.loggedOut).appendTo(container);
			} else {
				var options = scanMacro.getOptions(paramString);
				$.extend(options, {
					url: "/search?q=bag:%0_public tag:%1 _limit:%2".format(, followMacro.followTag, LIMIT_FOLLOWING),
					spaceField: "title",
					template: options.template ? options.template : "FollowingTemplate"
				scanMacro.scan(container, options);
		return !username ? followingCallback({ name: currentSpace }) : followingCallback({ name: username });

var linkedMacro = config.macros.linkedTiddlers = {
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var args = paramString.parseParams("anon")[0];
		var title = params[0] || tiddler.fields["server.title"] || tiddler.title;
		var tid = store.getTiddler(title);
		var containingTiddler = story.findContainingTiddler(place).getAttribute('tiddler');
		if(tid) {
			followMacro.makeButton(place, {
				spaceField: "recipe",
				url: "/bags/%0/tiddlers/%1/backlinks".format(tid.fields['server.bag'],
				blacklisted: followMacro.getBlacklist(),
				title: title,
				containingTiddler: containingTiddler,
				user: params[1] || false,
				consultFollowRelationship: args.follow ? true : false });

if(config.options.chkFollowTiddlersIsLinkedTiddlers) {
	merge(config.macros.followTiddlers, config.macros.linkedTiddlers);
	config.shadowTiddlers.FollowTiddlersHeading = "These are the other tiddlers that link to this tiddler.";

|''Description''|Initializes new TiddlySpaces the first time they are created|
|''Requires''|TiddlySpaceConfig RandomColorPalettePlugin chrjs ImageMacroPlugin|
* robust error notification and recovery
<link href="/bags/%0_public/tiddlers.atom" rel="alternate"
	type="application/atom+xml" title="%0's public feed" />
<link rel="canonical" href="%1/" />
(function($) {

var versionField = "tiddlyspaceinit_version";
var markupPreHead = store.getTiddlerText(tiddler.title + "##MarkupPreHead", "");
var tiddlyspace = config.extensions.tiddlyspace;
var currentSpace = tiddlyspace.currentSpace;
var tweb = config.extensions.tiddlyweb;

var plugin = config.extensions.TiddlySpaceInit = {
	version: "0.6",
	SiteTitle: "%0",
	SiteSubtitle: "a TiddlySpace",
	flagTitle: "%0SetupFlag",
	flagWarning: "Please do not modify this tiddler; it was created " +
		"automatically upon space creation.",

	dispatch: function(ev) {
		var title = plugin.flagTitle.format([]);
		config.annotations[title] = plugin.flagWarning;
		if(currentSpace.type != "private") {
		var tiddlers = [];
		var tid = store.getTiddler(title);
		if(tid) {
			curVersion = parseFloat(tid.fields[versionField]);
			reqVersion = parseFloat(plugin.version);
			if(curVersion < reqVersion) {
				plugin.update(curVersion, tid);
				tid.fields[versionField] = plugin.version;
				tid = store.saveTiddler(tid);
		} else { // first run
			tid = new Tiddler(title);
			tid.tags = ["excludeLists", "excludeSearch", "excludePublisher"];
			tid.fields = $.extend({}, config.defaultCustomFields);
			tid.fields[versionField] = plugin.version;
			tid.text = "@@%0@@".format([plugin.flagWarning]);
			tid = store.saveTiddler(tid);
			tiddlers = tiddlers.concat(plugin.firstRun(), tid);
		autoSaveChanges(null, tiddlers);
	update: function(curVersion, flagTiddler) {
		if(curVersion < 0.2) {
		if(curVersion < 0.3) {
			flagTiddler.tags.pushUnique("excludePublisher"); // XXX: never persisted
		if(curVersion < 0.5) { // v0.4 was faulty
		if(curVersion < 0.6) {
	pubTid: {
		tags: ["excludeLists", "excludeSearch"],
		fields: $.extend({}, config.defaultCustomFields, {
			"server.workspace": tiddlyspace.getCurrentWorkspace("public")
	makeTiddlerIfNot: function(tiddler) {
		if (!store.tiddlerExists(tiddler.title)) {
			$.extend(true, tiddler, plugin.pubTid);
			return [store.saveTiddler(tiddler)];
		} else {
			return [];
	firstRun: function() {
		var tiddlers = [];
		// generate Site*itle
		$.each(["SiteTitle", "SiteSubtitle"], function(i, item) {
			var tid = new Tiddler(item);
			tid.text = plugin[item].format([]);
		// generate public ColorPalette
		var tid = new Tiddler("ColorPalette");
		tid.text = config.macros.RandomColorPalette.generatePalette({
			saturation_pale: 0.67, saturation_light: 0.53,
			saturation_mid: 0.43, saturation_dark: 0.06,
			pale: 0.99, light: 0.85, mid: 0.5, dark: 0.31
		tiddlers.push.apply(tiddlers, plugin.makeTiddlerIfNot(tid));
		return tiddlers;
	// remove _cookie slices (TiddlyWiki 2.6.2 beta 6 remnants)
	purgeSystemSettings: function() {
		var ss = store.getTiddler("SystemSettings");
		if(ss) {
			var lines = ss.text.split("\n");
			var persistentOptions = $.grep(lines, function(line, i) {
				return line.indexOf("_cookie:") == -1;
			ss.text = persistentOptions.join("\n");
			ss = store.saveTiddler(ss);
			autoSaveChanges(null, [ss]);
	createAvatar: function() {
		var avatar = "SiteIcon";
		var host =;
		var notify = function(xhr, error, exc) {
			displayMessage("ERROR: could not create avatar - " + // TODO: i18n
				"%0: %1".format([xhr.statusText, xhr.responseText]));
			// TODO: resolve!?

		var pubBag = tiddlyspace.getCurrentBag("public");
		var tid = new tiddlyweb.Tiddler(avatar);
		tid.bag = new tiddlyweb.Bag(pubBag, host);

		var callback = function(data, status, xhr) {}; // avatar already exists; do nothing
		var errback = function(xhr, error, exc) {
			if(xhr.status != 404) {
			// copy default avatar
			var _notify = function(tid, status, xhr) {
				displayMessage("created avatar"); // TODO: i18n
				var image = config.macros.image;
				if(image && image.refreshImage) {
					var uri = "/%0/tiddlers/SiteIcon".
			var _callback = function(tid, status, xhr) {
				tid.title = avatar; = pubBag;
				delete tid.etag;
				tid.put(_notify, notify); // TODO: add to current session document (via adaptor?)
			tweb.getUserInfo(function(user) {
				var avatarTitle = == ?
					"defaultUserIcon" : "defaultSiteIcon";
				var tid = new tiddlyweb.Tiddler(avatarTitle);
				tid.bag = new tiddlyweb.Bag("common", host);
				tid.get(_callback, notify);
		tid.get(callback, errback);
	savePublicTiddlerText: function(title, text, pubWorkspace) {
		var tid = new Tiddler(title);
		tid.text = text;
		tid.tags = ["excludeLists"];
		tid.fields = $.extend({}, config.defaultCustomFields);
		tid.fields["server.workspace"] = pubWorkspace;
		tid.fields[""] = "false";
		tid = store.saveTiddler(tid);
		autoSaveChanges(null, [tid]);
	setupMarkupPreHead: function() {
		var pubWorkspace = tiddlyspace.getCurrentWorkspace("public");
		var existing = store.getTiddler("MarkupPreHead");
		if(!existing || existing.fields["server.workspace"] != pubWorkspace) {
			var context = this;
			tweb.getStatus(function(status) {
				var text = markupPreHead.format(,
				context.savePublicTiddlerText("MarkupPreHead", text,
		// also set up DefaultTiddlers
		var title = "DefaultTiddlers";
		existing = store.getTiddler(title) || new Tiddler(title);
		if(existing.fields["server.workspace"] != pubWorkspace) {
			var text = existing.text || store.getShadowTiddlerText(title);
			this.savePublicTiddlerText(title, text, pubWorkspace);

$(document).bind("startup", plugin.dispatch);

|''Description:''|Formatter to reference other spaces from wikitext |
|''Author:''|PaulDowney (psd (at) osmosoft (dot) com) |
|''License:''|[[BSD License|]] |
|''Comments:''|Please make comments at |
This plugin provides wikitext formatters for referencing another [[space|Space]] on the same TiddlySpace server, as in the following examples:
  {{{@space}}} -- @space 
  {{{~@space}}} -- ~@space 
  {{{Tiddler@space}}} -- Tiddler@space
  {{{[[Tiddler Title]]@space}}} -- [[Tiddler Title]]@space 
  {{{[[Link text|Tiddler Title]]@space}}} -- [[Link text|Tiddler Title]]@space
Links to tiddlers with a title begining with an "@" remain as tiddlyLinks:
  {{{[[@tiddler]]}}} -- [[@tiddler]]
and these may be changed into a space link using {{{@@}}}:
  {{{[[@@space]]}}} -- [[@@space]]
  {{{[[Link to an another space|@@space]]}}} -- [[Link to another space|@@space]]
  {{{[[@space|@@space]]}}} -- [[@space|@@space]]
TiddlySpace includes the [[TiddlySpaceLinkPlugin]] which provides WikiText markup for linking to other spaces on the same server. For example @glossary is a link to the {{{glossary}}} space and [[Small Trusted Group]]@glossary a link to an individual tiddler in the @glossary space. Prefixing the link with a tilde escapes the link, for example {{{~@space}}}.
Email addresses, for example and should be unaffected.
The plugin provides external links decorated so that other plugins may be included to add features such as the ability to dynamically pull externally linked tiddlers into the current TiddlyWiki.
Wikitext linking to a space on another server, for example from a tiddler in a space on to a tiddler or a space on, isn't currently supported. 
/*jslint onevar: false nomen: false plusplus: false */
/*global jQuery config createTiddlyText createExternalLink createTiddlyLink */

function createSpaceLink(place, spaceName, title, alt, isBag) {
	var link, a, currentSpaceName, label;
	try {
		if (spaceName === {
			title = title || spaceName;
			a = createTiddlyLink(place, title, false);
			jQuery(a).text(alt || title);
			return a;
	} catch (ex1) {
		currentSpaceName = false;

	a = jQuery("<a />").addClass('tiddlySpaceLink externalLink').appendTo(place)[0];
	if(title) {
		jQuery(a).attr('tiddler', title);
	if(isBag) {
		jQuery(a).attr('bag', spaceName);
	} else {
		jQuery(a).attr('tiddlyspace', spaceName);

	config.extensions.tiddlyweb.getStatus(function(status) {
		link = status.server_host.url;
		if (title) {
			label = alt || title;
			link = link + "/" + encodeURIComponent(title);
		} else {
			label = alt || spaceName;
		// assumes a http URI without user:pass@ prefix
		if(!isBag) {
			link = link.replace("http://", "http://" + spaceName.toLowerCase() + ".");
		} else {
			link += "/bags/" + spaceName + "/";
		jQuery(a).attr("href", link).text(label);
	return a;

(function ($) {

	config.textPrimitives.spaceName = "[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]";
	config.textPrimitives.spaceNameStrict = "[a-z][a-z0-9-]*";
	config.textPrimitives.bareTiddlerLetter = config.textPrimitives.anyLetterStrict;

	config.formatters.splice(0, 0, {
		name: "spacenameLink",
		match: config.textPrimitives.unWikiLink + "?" + config.textPrimitives.bareTiddlerLetter + "*@" + config.textPrimitives.spaceName + "\\.?.?",
		lookaheadRegExp: new RegExp(config.textPrimitives.unWikiLink + "?(" + config.textPrimitives.bareTiddlerLetter + "*)@(" + config.textPrimitives.spaceName + ")", "mg"),
		handler: function (w) {
			if (w.matchText.substr(w.matchText.length - 2, 1) === '.' && w.matchText.substr(w.matchText.length - 1, 1).match(/[a-zA-Z]/)) {
				w.outputText(w.output, w.matchStart, w.nextMatch);
			if (w.matchText.substr(0, 1) === config.textPrimitives.unWikiLink) {
				w.outputText(w.output, w.matchStart + 1, w.nextMatch);
			this.lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			if (lookaheadMatch && lookaheadMatch.index === w.matchStart) {
				createSpaceLink(w.output, lookaheadMatch[2], lookaheadMatch[1]);
				w.nextMatch = this.lookaheadRegExp.lastIndex;
		name: "tiddlySpaceLink",
		match: "\\[\\[[^\\|\\]]*\\|*@@" + config.textPrimitives.spaceName + "\\]",
		lookaheadRegExp: new RegExp("\\[\\[(.*?)(?:\\|@@(.*?))?\\]\\]", "mg"),
		handler: function (w) {
			this.lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			if (lookaheadMatch && lookaheadMatch.index === w.matchStart) {
				var alt = lookaheadMatch[2] ? lookaheadMatch[1] : lookaheadMatch[1].replace(/^@@/, "");
				var space = lookaheadMatch[2] || alt;
				createSpaceLink(w.output, space, "", alt);
				w.nextMatch = this.lookaheadRegExp.lastIndex;
		name: "tiddlyLinkSpacenameLink",
		match: "\\[\\[[^\\[]*\\]\\]@",
		lookaheadRegExp: new RegExp("\\[\\[(.*?)(?:\\|(.*?))?\\]\\]@(" + config.textPrimitives.spaceName + ")", "mg"),
		handler: function (w) {
			this.lookaheadRegExp.lastIndex = w.matchStart;
			var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
			if (lookaheadMatch && lookaheadMatch.index === w.matchStart) {
				var title = lookaheadMatch[2] || lookaheadMatch[1];
				var alt = lookaheadMatch[1] || lookaheadMatch[2];
				createSpaceLink(w.output, lookaheadMatch[3], title, alt);
				w.nextMatch = this.lookaheadRegExp.lastIndex;

	// ensure space links don't appear as missing links
	config.textPrimitives.brackettedLink = "\\[\\[([^\\]][^@\\]][^\\]]*)\\]\\](?=[^@])";
	config.textPrimitives.titledBrackettedLink = "\\[\\[([^\\[\\]\\|]+)\\|([^\\[\\]\\|]+)\\]\\](?=[^@])";

	// reevaluate derrived expressions ..
	config.textPrimitives.tiddlerForcedLinkRegExp = new RegExp("(?:" + config.textPrimitives.titledBrackettedLink + ")|(?:" +
		config.textPrimitives.brackettedLink + ")|(?:" +
		config.textPrimitives.urlPattern + ")","mg");
	config.textPrimitives.tiddlerAnyLinkRegExp = new RegExp("("+ config.textPrimitives.wikiLink + ")|(?:" +
		config.textPrimitives.titledBrackettedLink + ")|(?:" +
		config.textPrimitives.brackettedLink + ")|(?:" +
		config.textPrimitives.urlPattern + ")","mg");

	// treat space links in titledBracketedLink as external links
	var missingTiddlySpaceLink = new RegExp("^@@" + config.textPrimitives.spaceName + "$", "");
	var isExternalLink = config.formatterHelpers.isExternalLink;
	config.formatterHelpers.isExternalLink = function(link) {
		return missingTiddlySpaceLink.test(link) || isExternalLink(link);

|''Description''|toolbar commands for drafting and publishing|
|''Author''|Jon Robson|
|''Requires''|TiddlySpaceConfig TiddlySpaceFilters|
Provides changeToPrivate, changeToPublic and saveDraft commands
Provides TiddlySpacePublisher macro.
{{{<<TiddlySpacePublisher type:private>>}}} make lots of private tiddlers public.
{{{<<TiddlySpacePublisher type:public>>}}} make lots of public tiddlers public.
* add public argument?
(function($) {

var tiddlyspace = config.extensions.tiddlyspace;
var originMacro = config.macros.tiddlerOrigin;

tiddlyspace.getTiddlerStatusType = function(tiddler) {
	var isShadow = store.isShadowTiddler(tiddler.title);
	var exists = store.tiddlerExists(tiddler.title);
	if(isShadow && !exists) {
		return "shadow";
	} else if(!exists) {
		return "missing";
	} else {
		var types = ["private", "public"];
		var type = "external";
		for(var i = 0; i < types.length; i++) {
			var t = types[i];
			type =[t](tiddler) ? t : type;
		if( {
			type = type == "private" ? "unsyncedPrivate" : "unsyncedPublic";
		return type;

var cmd = config.commands.publishTiddler = {
	text: "make public",
	tooltip: "Change this private tiddler into a public tiddler",
	errorMsg: "Error publishing %0: %1",

	isEnabled: function(tiddler) {
		return !readOnly &&["private"](tiddler);
	handler: function(ev, src, title) {
		var tiddler = store.getTiddler(title);
		if(tiddler) {
			var newBag = cmd.toggleBag(tiddler.fields["server.bag"]);
			this.moveTiddler(tiddler, {
				title: tiddler.fields[""] || tiddler.title,
				fields: { "server.bag": newBag }
	toggleBag: function(bag, to) {
		var newBag;
		if(typeof bag != typeof "") {
			var tiddler = bag;
			bag = tiddler.fields["server.bag"];
		if(bag.indexOf("_private") > -1) { // should make use of endsWith
			to = to ? to : "public";
			newBag = bag.replace("_private", "_" + to);
		} else {
			to = to ? to : "private";
			newBag = bag.replace("_public", "_" + to);
		return newBag;
	copyTiddler: function(title, newTitle, newBag, callback) {
		var original = store.getTiddler(title);
		newTitle = newTitle ? newTitle : title;
		var adaptor = original.getAdaptor();
		var publish = function(original, callback) {
			var tiddler = $.extend(new Tiddler(newTitle), original);
			tiddler.fields = $.extend({}, original.fields, {
				"server.bag": newBag,
				"server.workspace": "bags/%0".format(newBag),
				"": "false"
			delete tiddler.fields["server.title"];
			tiddler.title = newTitle;
			adaptor.putTiddler(tiddler, null, null, callback);
		publish(original, callback);
	moveTiddler: function(tiddler, newTiddler, callback) {
			var info = {
			copyContext: {},
			deleteContext: {}
		var _dirty = store.isDirty();
		var adaptor = tiddler.getAdaptor();
		var newTitle = newTiddler.title;
		var oldTitle = tiddler.title;
		delete tiddler.fields["server.workspace"];
		var oldBag = tiddler.fields["server.bag"];
		var newBag = newTiddler.fields["server.bag"];
		var newWorkspace = "bags/%0".format(newBag);
		cmd.copyTiddler(oldTitle, newTitle, newBag, function(ctx) {
				info.copyContext = ctx;
				var context = {
					tiddler: tiddler,
					workspace: newWorkspace
				tiddler.title = oldTitle; // for cases where a rename occurs
				if(ctx.status) { // only do if a success
					if(oldBag != newBag) {
						adaptor.deleteTiddler(tiddler, context, {}, function(ctx) {
							info.deleteContext = ctx;
							var el;
							if(tiddler) {
								tiddler.fields["server.workspace"] = newWorkspace;
								tiddler.fields["server.bag"] = newBag;
							el = el ? el : story.refreshTiddler(oldTitle, null, true);
							if(oldTitle != newTitle) {
								store.notify(oldTitle, true);
							if(el) {
								story.displayTiddler(el, newTitle);
							if(oldTitle != newTitle) {
							if(callback) {
					} else {
						if(callback) {

var changeToPrivate = config.commands.changeToPrivate = {
	text: "make private",
	tooltip: "turn this public tiddler into a private tiddler",
	isEnabled: function(tiddler) {
		return !readOnly &&["public"](tiddler);
	handler: function(event, src, title) {
		var tiddler = store.getTiddler(title);
		var newBag = cmd.toggleBag(tiddler, "private");
		var newTiddler = { title: title, fields: { "server.bag": newBag }};
		cmd.moveTiddler(tiddler, newTiddler);
config.commands.changeToPublic = cmd;

/* Save as draft command */
var saveDraftCmd = config.commands.saveDraft = {
	text: "save draft",
	tooltip: "Save as a private draft",
	isEnabled: function(tiddler) {
		return changeToPrivate.isEnabled(tiddler);
	getDraftTitle: function(title) {
		var draftTitle;
		var draftNum = "";
		while(!draftTitle) {
			var suggestedTitle = "%0 [draft%1]".format(title, draftNum);
			if(store.getTiddler(suggestedTitle)) {
				draftNum = !draftNum ? 2 : draftNum + 1;
			} else {
				draftTitle = suggestedTitle;
		return draftTitle;
	createDraftTiddler: function(title, gatheredFields) {
		var tiddler = store.getTiddler(title);
		var draftTitle = saveDraftCmd.getDraftTitle(title);
		var draftTiddler = new Tiddler(draftTitle);
		if(tiddler) {
			$.extend(true, draftTiddler, tiddler);
		} else {
			$.extend(draftTiddler.fields, config.defaultCustomFields);
		for(var fieldName in gatheredFields) {
			if(TiddlyWiki.isStandardField(fieldName)) {
				draftTiddler[fieldName] = gatheredFields[fieldName];
			} else {
				draftTiddler.fields[fieldName] = gatheredFields[fieldName];
		var privateBag = tiddlyspace.getCurrentBag("private");
		var privateWorkspace = tiddlyspace.getCurrentWorkspace("private");
		draftTiddler.title = draftTitle;
		draftTiddler.fields[""] = title;
		draftTiddler.fields["server.workspace"] = privateWorkspace;
		draftTiddler.fields["server.bag"] = privateBag;
		draftTiddler.fields["server.title"] = draftTitle;
		draftTiddler.fields[""] = "false";
		delete draftTiddler.fields["server.etag"];
		return draftTiddler;
	handler: function(ev, src, title) {
		var tiddler = store.getTiddler(title); // original tiddler
		var tidEl = story.getTiddler(title);
		var uiFields = {};
		story.gatherSaveFields(tidEl, uiFields);
		var tid = saveDraftCmd.createDraftTiddler(title, uiFields);
		tid = store.saveTiddler(tid.title, tid.title, tid.text, tid.modifier,
			new Date(), tid.tags, tid.fields);
		autoSaveChanges(null, [tid]);
		story.displayTiddler(src, title);
		story.displayTiddler(src, tid.title);

var macro = config.macros.TiddlySpacePublisher = {
	locale: {
		title: "Batch Publisher",
		changeStatusLabel: "Make %0",
		noTiddlersText: "No tiddlers to publish",
		changeStatusPrompt: "Make all the selected tiddlers %0.",
		description: "Change tiddlers from %0 to %1 in this space"

	listViewTemplate: {
		columns: [
			{ name: "Selected", field: "Selected", rowName: "title", type: "Selector" },
			{ name: "Tiddler", field: "tiddler", title: "Tiddler", type: "Tiddler" },
			{ name: "Status", field: "status", title: "Status", type: "WikiText" }
		rowClasses: []

	changeStatus: function(tiddlers, status, callback) { // this is what is called when you click the publish button
		var publicBag;
		for(var i = 0; i < tiddlers.length; i++) {
			var tiddler = tiddlers[i];
			var newTiddler = {
				title: tiddler.title,
				fields: { "server.bag": cmd.toggleBag(tiddler, status) }
			cmd.moveTiddler(tiddler, newTiddler, callback);
	getMode: function(paramString) {
		var params = paramString.parseParams("anon")[0];
		var status = params.type ?
			(["public", "private"].contains(params.type[0]) ? params.type[0] : "private") :
		var newStatus = status == "public" ? "private" : "public";
		return [status, newStatus];
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var wizard = new Wizard();
		var locale = macro.locale;
		var status = macro.getMode(paramString);
		wizard.createWizard(place, locale.title);
		wizard.addStep(macro.locale.description.format(status[0], status[1]),
			'<input type="hidden" name="markList" />');
		var markList = wizard.getElement("markList");
		var listWrapper = $("<div />").addClass("batchPublisher").
			attr("refresh", "macro").attr("macroName", macroName).
			attr("params", paramString)[0];
		markList.parentNode.insertBefore(listWrapper, markList);
		$.data(listWrapper, "wizard", wizard);
	getCheckedTiddlers: function(listWrapper, titlesOnly) {
		var tiddlers = [];
		$(".chkOptionInput[rowName]:checked", listWrapper).each(function(i, el) {
			var title = $(el).attr("rowName");
			if(titlesOnly) {
			} else {
		return tiddlers;
	refresh: function(listWrapper) {
		var checked = macro.getCheckedTiddlers(listWrapper, true);
		var paramString = $(listWrapper).empty().attr("params");
		var wizard = $.data(listWrapper, "wizard");
		var locale = macro.locale;
		var params = paramString.parseParams("anon")[0];
		var publishCandidates = [];
		var status = macro.getMode(paramString);
		var pubType = status[0];
		var newPubType = status[1];
		var tiddlers = params.filter ? store.filterTiddlers(params.filter[0]) :
		var enabled = [];
		for(var i = 0; i < tiddlers.length; i++) {
			var tiddler = tiddlers[i];
			var title = tiddler.title;
			if(!tiddler.tags.contains("excludePublisher") && title !== "SystemSettings") {
				publishCandidates.push({ title: title, tiddler: tiddler, status: pubType});
			if(checked.contains(title)) {

		if(publishCandidates.length === 0) {
			createTiddlyElement(listWrapper, "em", null, null, locale.noTiddlersText);
		} else {
			var listView = ListView.create(listWrapper, publishCandidates, macro.listViewTemplate);
			wizard.setValue("listView", listView);
			var btnHandler = function(ev) {
				var tiddlers = macro.getCheckedTiddlers(listWrapper);
				var callback = function(status) {
					$(".batchPublisher").each(function(i, el) {
				macro.changeStatus(tiddlers, newPubType, callback);
				caption: locale.changeStatusLabel.format(newPubType),
				tooltip: locale.changeStatusPrompt.format(newPubType),
				onClick: btnHandler
			$(enabled.join(",")).attr("checked", true); // retain what was checked before

|''Description''|Revert to a previous revision|
|''Requires''|TiddlyWebAdaptor TiddlySpaceRevisionView|
Add a control button to revert to a particular revision.

The button must be called from within a revision, as generated by TiddlySpaceRevisionView
(function($) {

config.commands.revert = {
	text: "revert",
	tooltip: "make this revision the current one",
	handler: function(ev, src, title) {
		var revElem = story.getTiddler(title);
		var tidToRevert = store.getTiddler($(revElem).attr("revName"));

		var revision = store.getTiddler(title);
		if ((revision) && (tidToRevert)) {
			tidToRevert.text = revision.text;
			var newFields = merge({}, revision.fields);
			for (var fieldName in newFields) {
				if (fieldName.substr(0, 7) === "server.") {
					delete newFields[fieldName];
			merge(tidToRevert.fields, newFields);
			tidToRevert.tags = merge([], revision.tags);
			tidToRevert.fields.changecount = 1;
			delete tidToRevert.fields.doNotSave;

			store.saveTiddler(tidToRevert.title, tidToRevert.title,
				tidToRevert.text, null, null, tidToRevert.tags,
				tidToRevert.fields, false, tidToRevert.created, tidToRevert.creator);


|''Description''|Show tiddler revisions in a stack of cards view|
The viewRevisions macro can be attached to any element, which should be passed
in as a parameter.

For example:

&lt;&lt;viewRevisions page:10 link:"<<view modified date>>"&gt;&gt;

would show the revisions "stack of cards" view, 10 at a time, when the modified
date is clicked.
(function($) {

var me = config.macros.viewRevisions = {
	revisionTemplate: "RevisionTemplate",
	revSuffix: " [rev. #%0]", // text to append to each tiddler title
	defaultPageSize: 5, // default number of revisions to show
	defaultLinkText: "View Revisions", // when there's nothing else to use
	offsetTop: 30, // in px
	offsetLeft: 10, // in px
	shiftDownDelay: 50, // in ms
	visibleSlideAmount: 20, // amount of revisions to show on left hand edge after sliding
	zIndex: 100, // default z-index
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		params = paramString.parseParams(null, null, true)[0];
		var tiddlerElem = story.findContainingTiddler(place);

		var revButton;
		var pageSize = parseInt([0], 10) || me.defaultPageSize;
		var linkObj = ?[0] || me.defaultLinkText : false;
		if(linkObj) {
			revButton = $('<span class="button openRevisions" />')
			wikify(linkObj, revButton[0], null, tiddler);
		} else {
			revButton = place;

		$(revButton).click(function() {
			if (!$(tiddlerElem).hasClass("revisions")) {
				me.showRevisions(tiddlerElem, tiddler, pageSize);
			} else {

	// initialisation for revision view
	showRevisions: function(tiddlerElem, tiddler, pageSize) {
		var context = {
			host: tiddler.fields[""],
			workspace: tiddler.fields["server.workspace"]
		$(tiddlerElem).addClass("revisions").attr("revName", tiddler.title);
		// ensure toolbar commands deactivate RevisionsView
		$("a", ".toolbar", tiddlerElem).each(function(index, btn) {
			var _onclick = btn.onclick;
			btn.onclick = function(e) {
				_onclick.apply(this, arguments);
		// ensure default action deactivates RevisionsView
		var _ondblclick = tiddlerElem.ondblclick;
		tiddlerElem.ondblclick = function(e) {
			_ondblclick.apply(this, arguments);
		var type = tiddler.fields["server.type"];
		var adaptor = new config.adaptors[type]();
		var userParams = {
			tiddlerElem: tiddlerElem,
			pageSize: pageSize,
			title: tiddler.title
		adaptor.getTiddlerRevisionList(tiddler.title, null, context, userParams,
				function(context, userParams) {
					// strip the current revision
					me.expandStack(context, userParams);

	// fetch the actual revision and put it in the tiddler div
	showRevision: function(place, revision, callback) {
		var context = {
			host: revision.fields[""],
			workspace: revision.fields["server.workspace"]
		var userParams = {
			revElem: place
		var type = revision.fields["server.type"];
		var adaptor = new config.adaptors[type]();
		var revNo = revision.fields[""];
		adaptor.getTiddlerRevision(revision.title, revNo, context, userParams,
			function(context, userParams) {
				var tiddler = context.tiddler;
				tiddler.title += me.revSuffix
				tiddler.fields.doNotSave = true;
				if (store.getTiddler(tiddler.title)) {

				//now, populate the existing div
				var revElem = userParams.revElem;
				$(revElem).attr("id", story.tiddlerId(tiddler.title));
				$(revElem).attr("refresh", "tiddler");
				var getTemplate = function() {
					var themeName = config.options.txtTheme;
					if (themeName) {
						return store.getTiddlerSlice(themeName,
							me.revisionTemplate) || me.revisionTemplate ||
					} else {
						return (store.getTiddler(me.revisionTemplate)) ?
							me.revisionTemplate : "ViewTemplate";
				var template = getTemplate();
				story.refreshTiddler(tiddler.title, template, true);

	createCloak: function(promoteElem) {
		var el = $(promoteElem);
		// cache styles for resetting later{
			top: el.css("top"),
			left: el.css("left"),
			zIndex: el.css("z-index")

		$('<div class="revisionCloak" />').css("z-index", me.zIndex)
			.click(function() {

		el.css("z-index", me.zIndex + 1);

	// clean up, removing all evidence of revision view
	closeRevisions: function(promoteElem) {
		var el = $(promoteElem);
		// revert the original tiddler back to its previous state

		// remove any revisions still in the store
		var revisions = $(".revisions");
		revisions.each(function(index, revision) {
			var revAttributes = revision.attributes;
			if ((revAttributes.revname) &&
					(revAttributes.revision)) {
				var revName = revAttributes.revname.value;
				var revNo = revAttributes.revision.value;
				var title = revName + me.revSuffix.format([revNo]);

				if (store.getTiddler(title)) {

		// delete the previous revisions

		// remove the cloak

	// calback from getting list of revisions
	expandStack: function(context, userParams) {
		var pageSize = userParams.pageSize;

		var from = userParams.from || 0;
		var tiddlerElem = userParams.tiddlerElem;

		userParams.defaultHeight = $(tiddlerElem).height();
		userParams.defaultWidth = $(tiddlerElem).width();
		if (from < context.revisions.length) {
			me.displayNextRevision(tiddlerElem, userParams, context, from,
				from + pageSize - 1);

	// place the next div above and behind the previous one
	displayNextRevision: function(tiddlerElem, userParams, context, from, to) {
		var revision = context.revisions[from];
		var callback = function() {
			var revText = revBtn.getRevisionText(tiddlerElem, revision);
			tiddlerElem = me.createRevisionObject(tiddlerElem, context,
				userParams, revText);
				.attr("revision", (context.revisions.length - from));
			if ((from < to) && ((from + 1) < context.revisions.length)){
				me.displayNextRevision(tiddlerElem, userParams, context,
					from + 1, to);
			} else if ((context.revisions.length - 1) > to) {
				me.showMoreButton(tiddlerElem, context, userParams, to + 1);
		me.shiftVisibleDown(userParams.title, callback);

	createRevisionObject: function(tiddlerElem, context, userParams, text) {
		var newPosition = me.calculatePosition(tiddlerElem, context);
		return $('<div class="revisions tiddler" />')
				position: "absolute",
				left: newPosition.left,
				"z-index": me.zIndex + 1,
				height: userParams.defaultHeight,
				width: userParams.defaultWidth
			.attr("revName", userParams.title)

	// move the already present revisions down by 1 to fit the next one in
	shiftVisibleDown: function(title, callback) {
		var revisions = $("[revName='%0'].revisions".format([title]));
		var revisionCount = revisions.length;

		$(revisions).animate({top: "+=" + me.offsetTop},
				me.shiftDownDelay, function() {
					revisionCount -= 1;
					if ((callback) && (!revisionCount)) {

	// where we put the new revision
	calculatePosition: function(elem, context) {
		var offset = $(elem).offset();
		var currentPosition = $(elem).position();
		var newPosition = {
			top: - me.offsetTop
		if ((context.restrictLeft) ||
				((offset.left - me.offsetLeft) <
				$("#contentWrapper").offset().left)) {
			newPosition.left = $(elem).position().left;
			context.restrictLeft = true;
		} else {
			newPosition.left = currentPosition.left - me.offsetLeft;
		return newPosition;

	// equivalent of displayNextRevision, but for the more button
	showMoreButton: function(tiddlerElem, context, userParams, moreIndex) {
		userParams.from = moreIndex + 1;
		me.shiftVisibleDown(userParams.title, function() {
			var btn = me.createRevisionObject(tiddlerElem, context, userParams,

			var more = createTiddlyButton(btn[0], "more...", "show more revisions",
				function() {
					if ($(".viewRevision").length) {
					userParams.tiddlerElem = btn[0];
							.getRevisionText(btn[0], context.revisions[moreIndex]))
						.attr("revision", context.revisions.length - moreIndex);
					me.expandStack(context, userParams);
			$(more).css("float", "right");

	stripRevFromTitle: function(revisionTitle) {
		return revisionTitle.split(/ ?\[rev\. #[0-9]+\]$/)[0];

	onClickRevision: function(revElem, revision, callback) {
		// don't do anything if we are still loading
		if ($(".revisions").hasClass("loading")) {
			return null;

		var origTitle = me.stripRevFromTitle(revision.title);
		if ($(revElem).hasClass("viewRevision")) {
			me.slideIn(revElem, revision, origTitle, function() {
				revision.title = origTitle;
				if (callback) {
		} else {
			var viewRevision = function() {
				var prevPos = $(revElem).position().left;
				$(revElem).addClass("viewRevision").attr("prevPos", prevPos);
				me.showRevision(revElem, revision, function(rev) {
					me.slideOut(revElem, rev, origTitle, function() {
			// make sure another revision isn't already out
			if ($(".viewRevision").length) {
				var newRevElem = $(".viewRevision")[0];
				var newRevision = store.getTiddler($(newRevElem)
				me.onClickRevision(newRevElem, newRevision, viewRevision);
			} else {

	slideOut: function(revElem, revision, title, callback) {
		var leftMostPos = $("[revName='%0'].revisions".format([title]))
		var width = $(revElem).width();
		var originalLeftPos = $(story.getTiddler(title))

		var slideAmount = leftMostPos + width - me.visibleSlideAmount;
			.animate({left: "-=" + slideAmount}, 1000);
			.attr("baseHeight", $(revElem).css("height"))
			.css("height", "auto")
			.animate({left: originalLeftPos}, 1000, callback);

	slideIn: function(revElem, revision, title, callback) {
		var slideAmount = $(revElem).offset().left -
		var origRevPos = $(revElem).attr("prevPos");

			.animate({left: "+=" + slideAmount}, 1000);
		$(revElem).animate({left: origRevPos}, 1000, function() {
				.css("height", $(revElem).attr("baseHeight"))

var revBtn;
config.macros.slideRevision = revBtn = {
	btnText: "created by %0 at %1 on %2",
	handler: function(place, macroName, params, wikifier, paramString, tiddler) {
		var btn = revBtn.getRevisionText(place, tiddler);

	getRevisionText: function(place, revision) {
		var text = revBtn.btnText.format([revision.modifier,
			revision.modified.formatString("0DD MMM YYYY")]);
		var btn = $('<a href="javascript:;" class="button revButton" />')
			.click(function() {
				var revElem = story.findContainingTiddler(this);
				me.onClickRevision(revElem, revision);
		return btn;

|''Description''|Sanitisation for dynamically pulling tiddlers into your space and displaying them|
Works both inside and outside TiddlyWiki. Uses the HTML Sanitizer provided by the Google Caja project
(see for more on this), which is licensed under
an Apache License (see
(function($) {

var cleanURL = function(url) {
	var regexp = /^(?:http|https|mailto|ftp|irc|news):\/\//;
	return (regexp.test(url)) ? url : null;

$.sanitize = function(html) {
	return html_sanitize(html, cleanURL);

 * HTML Sanitizer, provided by Google Caja

/* Copyright Google Inc.
 * Licensed under the Apache Licence Version 2.0
 * Autogenerated at Tue May 17 17:39:24 BST 2011
 * @provides html4
 */var html4={};html4.atype={NONE:0,URI:1,URI_FRAGMENT:11,SCRIPT:2,STYLE:3,ID:4,IDREF:5,IDREFS:6,GLOBAL_NAME:7,LOCAL_NAME:8,CLASSES:9,FRAME_TARGET:10},html4.ATTRIBS={"*::class":9,"*::dir":0,"*::id":4,"*::lang":0,"*::onclick":2,"*::ondblclick":2,"*::onkeydown":2,"*::onkeypress":2,"*::onkeyup":2,"*::onload":2,"*::onmousedown":2,"*::onmousemove":2,"*::onmouseout":2,"*::onmouseover":2,"*::onmouseup":2,"*::style":3,"*::title":0,"a::accesskey":0,"a::coords":0,"a::href":1,"a::hreflang":0,"a::name":7,"a::onblur":2,"a::onfocus":2,"a::rel":0,"a::rev":0,"a::shape":0,"a::tabindex":0,"a::target":10,"a::type":0,"area::accesskey":0,"area::alt":0,"area::coords":0,"area::href":1,"area::nohref":0,"area::onblur":2,"area::onfocus":2,"area::shape":0,"area::tabindex":0,"area::target":10,"bdo::dir":0,"blockquote::cite":1,"br::clear":0,"button::accesskey":0,"button::disabled":0,"button::name":8,"button::onblur":2,"button::onfocus":2,"button::tabindex":0,"button::type":0,"button::value":0,"canvas::height":0,"canvas::width":0,"caption::align":0,"col::align":0,"col::char":0,"col::charoff":0,"col::span":0,"col::valign":0,"col::width":0,"colgroup::align":0,"colgroup::char":0,"colgroup::charoff":0,"colgroup::span":0,"colgroup::valign":0,"colgroup::width":0,"del::cite":1,"del::datetime":0,"dir::compact":0,"div::align":0,"dl::compact":0,"font::color":0,"font::face":0,"font::size":0,"form::accept":0,"form::action":1,"form::autocomplete":0,"form::enctype":0,"form::method":0,"form::name":7,"form::onreset":2,"form::onsubmit":2,"form::target":10,"h1::align":0,"h2::align":0,"h3::align":0,"h4::align":0,"h5::align":0,"h6::align":0,"hr::align":0,"hr::noshade":0,"hr::size":0,"hr::width":0,"iframe::align":0,"iframe::frameborder":0,"iframe::height":0,"iframe::marginheight":0,"iframe::marginwidth":0,"iframe::width":0,"img::align":0,"img::alt":0,"img::border":0,"img::height":0,"img::hspace":0,"img::ismap":0,"img::name":7,"img::src":1,"img::usemap":11,"img::vspace":0,"img::width":0,"input::accept":0,"input::accesskey":0,"input::align":0,"input::alt":0,"input::autocomplete":0,"input::checked":0,"input::disabled":0,"input::ismap":0,"input::maxlength":0,"input::name":8,"input::onblur":2,"input::onchange":2,"input::onfocus":2,"input::onselect":2,"input::readonly":0,"input::size":0,"input::src":1,"input::tabindex":0,"input::type":0,"input::usemap":11,"input::value":0,"ins::cite":1,"ins::datetime":0,"label::accesskey":0,"label::for":5,"label::onblur":2,"label::onfocus":2,"legend::accesskey":0,"legend::align":0,"li::type":0,"li::value":0,"map::name":7,"menu::compact":0,"ol::compact":0,"ol::start":0,"ol::type":0,"optgroup::disabled":0,"optgroup::label":0,"option::disabled":0,"option::label":0,"option::selected":0,"option::value":0,"p::align":0,"pre::width":0,"q::cite":1,"select::disabled":0,"select::multiple":0,"select::name":8,"select::onblur":2,"select::onchange":2,"select::onfocus":2,"select::size":0,"select::tabindex":0,"table::align":0,"table::bgcolor":0,"table::border":0,"table::cellpadding":0,"table::cellspacing":0,"table::frame":0,"table::rules":0,"table::summary":0,"table::width":0,"tbody::align":0,"tbody::char":0,"tbody::charoff":0,"tbody::valign":0,"td::abbr":0,"td::align":0,"td::axis":0,"td::bgcolor":0,"td::char":0,"td::charoff":0,"td::colspan":0,"td::headers":6,"td::height":0,"td::nowrap":0,"td::rowspan":0,"td::scope":0,"td::valign":0,"td::width":0,"textarea::accesskey":0,"textarea::cols":0,"textarea::disabled":0,"textarea::name":8,"textarea::onblur":2,"textarea::onchange":2,"textarea::onfocus":2,"textarea::onselect":2,"textarea::readonly":0,"textarea::rows":0,"textarea::tabindex":0,"tfoot::align":0,"tfoot::char":0,"tfoot::charoff":0,"tfoot::valign":0,"th::abbr":0,"th::align":0,"th::axis":0,"th::bgcolor":0,"th::char":0,"th::charoff":0,"th::colspan":0,"th::headers":6,"th::height":0,"th::nowrap":0,"th::rowspan":0,"th::scope":0,"th::valign":0,"th::width":0,"thead::align":0,"thead::char":0,"thead::charoff":0,"thead::valign":0,"tr::align":0,"tr::bgcolor":0,"tr::char":0,"tr::charoff":0,"tr::valign":0,"ul::compact":0,"ul::type":0},html4.eflags={OPTIONAL_ENDTAG:1,EMPTY:2,CDATA:4,RCDATA:8,UNSAFE:16,FOLDABLE:32,SCRIPT:64,STYLE:128},html4.ELEMENTS={a:0,abbr:0,acronym:0,address:0,applet:16,area:2,b:0,base:18,basefont:18,bdo:0,big:0,blockquote:0,body:49,br:2,button:0,canvas:0,caption:0,center:0,cite:0,code:0,col:2,colgroup:1,dd:1,del:0,dfn:0,dir:0,div:0,dl:0,dt:1,em:0,fieldset:0,font:0,form:0,frame:18,frameset:16,h1:0,h2:0,h3:0,h4:0,h5:0,h6:0,head:49,hr:2,html:49,i:0,iframe:4,img:2,input:2,ins:0,isindex:18,kbd:0,label:0,legend:0,li:1,link:18,map:0,menu:0,meta:18,nobr:0,noframes:20,noscript:20,object:16,ol:0,optgroup:0,option:1,p:1,param:18,pre:0,q:0,s:0,samp:0,script:84,select:0,small:0,span:0,strike:0,strong:0,style:148,sub:0,sup:0,table:0,tbody:1,td:1,textarea:8,tfoot:1,th:1,thead:1,title:24,tr:1,tt:0,u:0,ul:0,"var":0},html4.ueffects={NOT_LOADED:0,SAME_DOCUMENT:1,NEW_DOCUMENT:2},html4.URIEFFECTS={"a::href":2,"area::href":2,"blockquote::cite":0,"body::background":1,"del::cite":0,"form::action":2,"img::src":1,"input::src":1,"ins::cite":0,"q::cite":0},html4.ltypes={UNSANDBOXED:2,SANDBOXED:1,DATA:0},html4.LOADERTYPES={"a::href":2,"area::href":2,"blockquote::cite":2,"body::background":1,"del::cite":2,"form::action":2,"img::src":1,"input::src":1,"ins::cite":2,"q::cite":2};var html=function(a){function x(b,c,d){var e=[];w(function(b,e){for(var f=0;f<e.length;f+=2){var g=e[f],h=e[f+1],i=null,j;if((j=b+"::"+g,a.ATTRIBS.hasOwnProperty(j))||(j="*::"+g,a.ATTRIBS.hasOwnProperty(j)))i=a.ATTRIBS[j];if(i!==null)switch(i){case a.atype.NONE:break;case a.atype.SCRIPT:case a.atype.STYLE:h=null;break;case a.atype.ID:case a.atype.IDREF:case a.atype.IDREFS:case a.atype.GLOBAL_NAME:case a.atype.LOCAL_NAME:case a.atype.CLASSES:h=d?d(h):h;break;case a.atype.URI:h=c&&c(h);break;case a.atype.URI_FRAGMENT:h&&"#"===h.charAt(0)?(h=d?d(h):h,h&&(h="#"+h)):h=null;break;default:h=null}else h=null;e[f+1]=h}return e})(b,e);return e.join("")}function w(b){var c,d;return v({startDoc:function(a){c=[],d=!1},startTag:function(e,f,g){if(!d){if(!a.ELEMENTS.hasOwnProperty(e))return;var h=a.ELEMENTS[e];if(h&a.eflags.FOLDABLE)return;if(h&a.eflags.UNSAFE){d=!(h&a.eflags.EMPTY);return}f=b(e,f);if(f){h&a.eflags.EMPTY||c.push(e),g.push("<",e);for(var i=0,j=f.length;i<j;i+=2){var k=f[i],l=f[i+1];l!==null&&l!==void 0&&g.push(" ",k,'="',r(l),'"')}g.push(">")}}},endTag:function(b,e){if(d)d=!1;else{if(!a.ELEMENTS.hasOwnProperty(b))return;var f=a.ELEMENTS[b];if(!(f&(a.eflags.UNSAFE|a.eflags.EMPTY|a.eflags.FOLDABLE))){var g;if(f&a.eflags.OPTIONAL_ENDTAG)for(g=c.length;--g>=0;){var h=c[g];if(h===b)break;if(!(a.ELEMENTS[h]&a.eflags.OPTIONAL_ENDTAG))return}else for(g=c.length;--g>=0;)if(c[g]===b)break;if(g<0)return;for(var i=c.length;--i>g;){var h=c[i];a.ELEMENTS[h]&a.eflags.OPTIONAL_ENDTAG||e.push("</",h,">")}c.length=g,e.push("</",b,">")}}},pcdata:function(a,b){d||b.push(a)},rcdata:function(a,b){d||b.push(a)},cdata:function(a,b){d||b.push(a)},endDoc:function(a){for(var b=c.length;--b>=0;)a.push("</",c[b],">");c.length=0}})}function v(c){return function(d,e){d=String(d);var f=null,g=!1,h=[],j=void 0,l=void 0,m=void 0;c.startDoc&&c.startDoc(e);while(d){var n=d.match(g?t:u);d=d.substring(n[0].length);if(g){if(n[1]){var o=b(n[1]),p;if(n[2]){var q=n[3];switch(q.charCodeAt(0)){case 34:case 39:q=q.substring(1,q.length-1)}p=k(i(q))}else p=o;h.push(o,p)}else if(n[4]){l!==void 0&&(m?c.startTag&&c.startTag(j,h,e):c.endTag&&c.endTag(j,e));if(m&&l&(a.eflags.CDATA|a.eflags.RCDATA)){f===null?f=b(d):f=f.substring(f.length-d.length);var r=f.indexOf("</"+j);r<0&&(r=d.length),l&a.eflags.CDATA?c.cdata&&c.cdata(d.substring(0,r),e):c.rcdata&&c.rcdata(s(d.substring(0,r)),e),d=d.substring(r)}j=l=m=void 0,h.length=0,g=!1}}else if(n[1])c.pcdata&&c.pcdata(n[0],e);else if(n[3])m=!n[2],g=!0,j=b(n[3]),l=a.ELEMENTS.hasOwnProperty(j)?a.ELEMENTS[j]:void 0;else if(n[4])c.pcdata&&c.pcdata(n[4],e);else if(n[5]&&c.pcdata)switch(n[5]){case"<":c.pcdata("&lt;",e);break;case">":c.pcdata("&gt;",e);break;default:c.pcdata("&amp;",e)}}c.endDoc&&c.endDoc(e)}}function s(a){return a.replace(m,"&amp;$1").replace(n,"&lt;").replace(o,"&gt;")}function r(a){return a.replace(l,"&amp;").replace(n,"&lt;").replace(o,"&gt;").replace(p,"&#34;").replace(q,"&#61;")}function k(a){return a.replace(j,g)}function i(a){return a.replace(h,"")}function g(a,b){return f(b)}function f(a){a=b(a);if(c.hasOwnProperty(a))return c[a];var f=a.match(d);if(f)return String.fromCharCode(parseInt(f[1],10));if(!!(f=a.match(e)))return String.fromCharCode(parseInt(f[1],16));return""}var b;"script"==="SCRIPT".toLowerCase()?b=function(a){return a.toLowerCase()}:b=function(a){return a.replace(/[A-Z]/g,function(a){return String.fromCharCode(a.charCodeAt(0)|32)})};var c={lt:"<",gt:">",amp:"&",nbsp:"240",quot:'"',apos:"'"},d=/^#(\d+)$/,e=/^#x([0-9A-Fa-f]+)$/,h=/\0/g,j=/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,l=/&/g,m=/&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi,n=/</g,o=/>/g,p=/\"/g,q=/\=/g,t=new RegExp("^\\s*(?:(?:([a-z][a-z-]*)(\\s*=\\s*(\"[^\"]*\"|'[^']*'|(?=[a-z][a-z-]*\\s*=)|[^>\"'\\s]*))?)|(/?>)|[\\s\\S][^a-z\\s>]*)","i"),u=new RegExp("^(?:&(\\#[0-9]+|\\#[x][0-9a-f]+|\\w+);|<!--[\\s\\S]*?-->|<!\\w[^>]*>|<\\?[^>*]*>|<(/)?([a-z][a-z0-9]*)|([^<&>]+)|([<&>]))","i");return{escapeAttrib:r,makeHtmlSanitizer:w,makeSaxParser:v,normalizeRCData:s,sanitize:x,unescapeEntities:k}}(html4),html_sanitize=html.sanitize

// stop here if we're not in TiddlyWiki
// XXX: is this the correct way of checking for TiddlyWiki?
if (!window.TiddlyWiki || ! || !store instanceof TiddlyWiki) {

var tiddlyspace = config.extensions.tiddlyspace;

var _subWikify = Wikifier.prototype.subWikify;

var cleanedTitle = 'This section has been cleaned of any potentially harmful code';

var replaceFunctions = {
	html: function(w) {
		var sanitizedHTML, spanEl;
		this.lookaheadRegExp.lastIndex = w.matchStart;
		var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
		if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
			sanitizedHTML = $.sanitize(lookaheadMatch[1]);
			spanEl = createTiddlyElement(w.output, 'span', null, 'sanitized');
			spanEl.innerHTML = sanitizedHTML;
			spanEl.setAttribute('title', cleanedTitle);
			w.nextMatch = this.lookaheadRegExp.lastIndex;
	customFormat: function(w) {
		switch(w.matchText) {
			case '@@':
				var e = createTiddlyElement(w.output, 'span');
				var styles = config.formatterHelpers.inlineCssHelper(w);
				if (styles.length === 0) {
					e.className = 'marked';
				w.subWikifyTerm(e, /(@@)/mg);
			case '{{':
				var lookaheadRegExp = /\{\{[\s]*([\w]+[\s\w]*)[\s]*\{(\n?)/mg;
				lookaheadRegExp.lastIndex = w.matchStart;
				var lookaheadMatch = lookaheadRegExp.exec(w.source);
				if(lookaheadMatch) {
					w.nextMatch = lookaheadRegExp.lastIndex;
					e = createTiddlyElement(w.output,lookaheadMatch[2] == "\n" ? "div" : "span",null,lookaheadMatch[1]);

Wikifier.prototype.subWikify = function(output, terminator) {
	var tid = this.tiddler,
		spaceName =,
		tidSpace, recipeName, stripped;
	try {
		recipeName = tid.fields['server.recipe'] ||
		tidSpace = tiddlyspace.resolveSpaceName(recipeName);
		if (tidSpace !== spaceName) {
			// external tiddler, so replace dangerous formatters
			stripped = stripHTML(tid, this.formatter);
	} catch(e) {
		// do nothing. There's no tiddler, so assume it's safe (?!?!?)

	_subWikify.apply(this, arguments);

	if (stripped) {
		// change back to the original function
		unstripHTML(stripped, this.formatter);

// replace potentially unsafe formatters with versions that strip bad HTML/CSS
var stripHTML = function(tid, formatter) {
	var popped = {}, _handler;
	for (var i = 0; i < formatter.formatters.length; i++) {
		var f = formatter.formatters[i];
		if (replaceFunctions[]) {
			_handler = f.handler;
			popped[] = _handler;
			f.handler = replaceFunctions[];

	return popped;

// put the original formatters back where they belong
var unstripHTML = function(stripped, formatter) {
	for (var i = 0; i < formatter.formatters.length; i++) {
		var f = formatter.formatters[i];
		if (stripped[]) {
			f.handler = stripped[];

|''Requires''|TiddlySpaceConfig TiddlySpaceFollowingPlugin|
(function($) {
var tiddlyspace = config.extensions.tiddlyspace;
var tsScan = config.macros.tsScan;

config.shadowTiddlers.SearchTemplate = "<<view server.bag SiteIcon label:no width:24 height:24 preserveAspectRatio:yes>> <<view server.bag spaceLink title external:no>> in space <<view server.bag spaceLink>>";
config.shadowTiddlers.StyleSheetSearch = [".resultsArea .siteIcon { display: inline; }",
	".searchForm {text-align: left;}"].join("\n");
store.addNotification("StyleSheetSearch", refreshStyles);

var search = config.macros.tsSearch = {
	locale: {
		advanced: "Advanced Options",
		header: "Search",
		resultsHeader: "Results (%0)",
		find: "find",
		noResults: "No tiddlers matched your search query",
		query: "QUERY: ",
		error: "please provide a search query or a tag, modifier or title!",
		titleAdvanced: "where the title is",
		modifierAdvanced: "where the last modifier is",
		spaceAdvanced: "only in the space: ",
		notspaceAdvanced: "but not in the spaces: ",
		tagsAdvanced: "with the tags: "
	andConstructor: function(container, label, fieldname, negationMode) {
		var tags = $("<div />").appendTo(container);
		$('<span />').text(label).appendTo(tags);
		var id = "area" + Math.random();
		container = $("<span />").attr("id", id).appendTo(tags)[0];
		function add(container) {
			var el = $('<input type="text" />').attr("field", fieldname).appendTo(container);
			if(negationMode) {
				el.attr("negation", "true");
		var el = $("<button />").text("AND").click(function(ev) {
		$(el).data("container", container);
	fieldConstructor: function(container, label, field) {
		container = $("<div />").appendTo(container)[0];
		$("<span />").text(label).appendTo(container);
		$("<input />").attr("text", "input").attr("field", field).appendTo(container);
	advancedOptions: function(form) {
		var locale = search.locale;
		var container = $("<div />").addClass("tsAdvancedOptions").appendTo(form)[0];
		$("<h2/ >").text(search.locale.advanced).appendTo(container);
		$("<div />").addClass("separator").appendTo(container);
		search.fieldConstructor(container, locale.titleAdvanced, "title");
		search.fieldConstructor(container, locale.modifierAdvanced, "modifier");
		search.fieldConstructor(container, locale.spaceAdvanced, "space");
		search.andConstructor(container, locale.notspaceAdvanced, "space", true);
		search.andConstructor(container, locale.tagsAdvanced, "tag");
	constructSearchQuery: function(form) {
		var data = [], select = [];
		var query = $("[name=q]", form).val();
		if(query) {

		// add tags, fields etc..
		$("[field]", form).each(function(i, el) {
			var val = $(el).val();
			var name = $(el).attr("field");
			var negate = $(el).attr("negation") == "true";
			if(val && name) {
				val = encodeURIComponent(val);
				val = negate ? "!" + val : val;
				if(name == "space") {
					val += "_public";
					name = "bag";
				if(negate) {
				} else {
					var prefix = data.length === 0 ? "q=" : "";
					data.push('%0%1:"%2"'.format(prefix, name, val));
		var dataString = data.join(" ");
		if(dataString.length === 0 && !query) {
			return false;
		var selectStatement = select.join("&");
		if(dataString.length > 0 && selectStatement.length > 0) {
			dataString += "&";
		dataString += selectStatement;
		return "/search?%0".format(dataString);
	constructForm: function(place) {
		var locale = search.locale;
		$("<h1 />").text(locale.header).appendTo(place);
		var form = $("<form />").appendTo(place)[0];
		$('<input type="text" name="q" />').appendTo(form);
		$('<input type="submit" />').val(locale.find).appendTo(form);
		var query = $('<h2 class="query"/>').appendTo(place)[0];
		var results = $("<div />").appendTo(place).addClass("resultsArea")[0];
		var lookup = function(url) {
			if(!url) {
			config.extensions.tiddlyweb.getStatus(function(status) {
				var href = status.server_host.url + url;
				$("<a />").attr("href", href).text(href).appendTo(query);
				tsScan.scan(results, { url: url, emptyMessage: search.locale.noResults, cache: true,
					template: "SearchTemplate", sort: "title", callback: function(tiddlers) {
						$("<h2 />").text(locale.resultsHeader.format(tiddlers.length)).prependTo(results);
		$(form).submit(function(ev) {
			var url = search.constructSearchQuery(form);
			config.macros.tsSearch.lastSearch = url;
		if(search.lastSearch) {
		return form;
	handler: function(place) {
		var container = $("<div />").addClass("searchForm").appendTo(place)[0];

<<groupBy server.bag>>

<<list filter [is[private]]>>

<<list filter [is[public]]>>

<<list filter [is[draft]]>>
|''Author''|Jon Robson|
|''Description''|Provides ability to render SiteIcons and icons that correspond to the home location of given tiddlers|
|''Requires''|TiddlySpaceConfig BinaryTiddlersPlugin ImageMacroPlugin TiddlySpacePublishingCommands|
{{{<<tiddlerOrigin>>}}} shows the origin of the tiddler it is being run on.
In TiddlySpace terms this means it will determine whether the tiddler is external, public or private.
Where private it will analyse whether a public version exists and distinguish between the different scenarios.
If a tiddler is external, the SiteIcon of that external space will be shown

width / height : define a width or height of the outputted icon
label: if label parameter is set to yes, a label will accompany the icon.
(function($) {

if(!config.macros.image) {
	throw "Missing dependency: ImageMacroPlugin";

var imageMacro = config.macros.image;
var tiddlyspace = config.extensions.tiddlyspace;
var tweb = config.extensions.tiddlyweb;
var cmds = config.commands;
var cmd = cmds.publishTiddler;
tiddlyspace.resolveSpaceName = function(value) {
	var endsWith = config.extensions.BinaryTiddlersPlugin.endsWith;
	if(value) {
		value = value.indexOf("bags/") === 0 ? value.substr(5) : value;
		value = value.indexOf("recipes/") === 0 ? value.substr(8) : value;
		if(value.indexOf("@") === 0) {
			value = value.substr(1);
		if(endsWith(value, "_public")) {
			value = value.substr(0, value.length - 7);
		} else if(endsWith(value, "_private")) {
			value = value.substr(0, value.length - 8);
		value = value.toLowerCase();
	return value;

tiddlyspace.renderAvatar = function(place, value, options) {
	options = options ? options : {};
	options.labelOptions = options.labelOptions ? options.labelOptions : { include: false, height: 48, width: 48 };
	options.imageOptions = options.imageOptions ? options.imageOptions : {};
	options.imageOptions.altImage = "/bags/common/tiddlers/defaultUserIcon";
	var container = $('<div class="siteIcon" />').appendTo(place);
	value = tiddlyspace.resolveSpaceName(value);

	tweb.getStatus(function(status) {
		var link, noLabel;
		if(!value || value == config.views.wikified.defaultModifier ||
			value == config.views.wikified.shadowModifier) {
			var icon = config.views.wikified.shadowModifier == value ? "shadowIcon" : "missingIcon";
			if(store.tiddlerExists(icon)) {
				imageMacro.renderImage(container, icon, options.imageOptions);
			} else {
				noLabel = true;
		} else {
			var spaceURI;
			if(value != {
				spaceURI = options.notSpace ? tiddlyspace.getHost(status.server_host) :
					tiddlyspace.getHost(status.server_host, value);
			link = spaceURI ? $("<a />").attr("href", spaceURI) : $("<span />");

			var imageOptions = options.imageOptions;
			if(options.spaceLink && ! { = spaceURI;
			var avatar = options.notSpace ? false : value;
			var uri = tiddlyspace.getAvatar(status.server_host, avatar);
			imageMacro.renderImage(container, uri, options.imageOptions);
			if(!value) {
				value = "tiddlyspace";
		if(!noLabel && options.labelOptions.include) {
			var prefix = $("<span />").text(options.labelOptions.prefix || "")[0];
			var suffix = $("<span />").text(options.labelOptions.suffix || "")[0];
			$('<div class="label" />').append(prefix).append(link).
	if(value) {
		var prefix = options.labelOptions.prefix || "";
		var suffix = options.labelOptions.suffix || "";
		var label = "%0%1%2".format(prefix, value, suffix);
		$(container).attr("title", label);

var originMacro = config.macros.tiddlerOrigin = {
	locale: {
		"shadow": "shadow tiddler",
		"missing": "missing tiddler",
		"private": "private",
		"unknown": "unknown state",
		"public": "public",
		"unsyncedPrivate": "unsynced and private",
		"unsyncedPublic": "unsynced and public",
		externalPrefix: "from ",
		externalBagSuffix: " bag",
		externalSuffix: " space",
		publishPrivateDeletePrivate: "Are you sure you want to make this tiddler public?",
		moveToPrivate: "Are you sure you want to make this tiddler private? Only members will be able to see it.",
		pleaseWait: "please wait..",
		keepPublic: "keep public",
		cannotPublishDirtyTiddler: "The current tiddler is unsaved so cannot be published. Please save the tiddler first.",
		keepPrivate: "keep private",
		makePublic: "make public",
		makePrivate: "make private"
	handler: function(place, macroName, params,wikifier, paramString, tiddler){
		var adaptor = tiddler.getAdaptor();
		var btn = $("<div />").addClass("originButton").attr("params", paramString).
			attr("refresh", "macro").attr("macroName", macroName).appendTo(place)[0];
		$(btn).data("tiddler", tiddler);
	refresh: function(btn) {
		var paramString = $(btn).attr("params");
		var tiddler = $(btn).data("tiddler");
		var options = originMacro.getOptions(paramString);
		var type = tiddlyspace.getTiddlerStatusType(tiddler);
		originMacro.renderIcon(tiddler, type, btn, options);
	getOptions: function(paramString) {
		paramString = "%0 label:no width:48 height:48 spaceLink:yes preserveAspectRatio:yes".format(paramString);
		var parsedParams = paramString.parseParams("name");
		var params = parsedParams[0].name;
		var options = {
			labelOptions: originMacro._getLabelOptions(parsedParams),
			imageOptions: imageMacro.getArguments(paramString, []),
			noclick: parsedParams[0].interactive &&
				parsedParams[0].interactive[0] == "no" ? true : false
		if(!options.noclick) {
			var spaceLink = parsedParams[0].spaceLink;
			options.spaceLink = spaceLink && spaceLink[0] == "no" ? false : true;
		} else {
			options.spaceLink = false;
		return options;
	_getLabelOptions: function(parsedParams) {
		parsedParams = parsedParams[0];
		var includeLabel = !parsedParams.label || ( parsedParams.label && parsedParams.label[0] == "yes" );
		var prefix = parsedParams.labelPrefix ? parsedParams.labelPrefix[0] : false;
		var suffix = parsedParams.labelSuffix ? parsedParams.labelSuffix[0] : false;
		return { include: includeLabel, suffix: suffix, prefix: prefix };
	_isSpace: function(value) {
		value = value ? value : "";
		var endsWith = config.extensions.BinaryTiddlersPlugin.endsWith;
		if(endsWith(value, "_private") || endsWith(value, "_public")) {
			return true;
		} else {
			return false;
	renderIcon: function(tiddler, type, button, options) {
		var locale = originMacro.locale;
		originMacro.annotateTiddler(button, type);
		if(type != "external") {
			originMacro.showPrivacyRoundel(tiddler, type, button,
		} else {
			var prefix = options.labelOptions.prefix, suffix = options.labelOptions.suffix;
			var space = tiddler.fields["server.bag"];
			options.notSpace = !originMacro._isSpace(space);
			options.labelOptions.prefix = prefix ? prefix : locale.externalPrefix;
			options.labelOptions.suffix = suffix ? suffix : (options.notSpace ? locale.externalBagSuffix : locale.externalSuffix);

			tiddlyspace.renderAvatar(button, space, options);
	showPrivacyRoundel: function(thisTiddler, privacyType, button, options) {
		// there is a public tiddler as well as the current tiddler!
		// TODO: not this is not enough.. we also need to check if the public tiddler is the same as..
		// .. the private tiddler to determine whether this is a draft
		// use of hashes would be useful here.
		var icon = "%0Icon".format(privacyType);
		if(privacyType.indexOf("unsynced") === 0 && !store.tiddlerExists(icon)) {
			icon = "unsyncedIcon";
		if(privacyType == "shadow") {
			if(!store.tiddlerExists(icon)) {
				icon = "bags/tiddlyspace/tiddlers/SiteIcon";
		if(privacyType == "missing" && !store.tiddlerExists(icon)) {
			return; // the user is not making use of the missingIcon
		} else {
			imageMacro.renderImage(button, icon, options.imageOptions);
			originMacro.showLabel(button, privacyType, options.labelOptions);
			var cmd = originMacro.iconCommands[privacyType];
			if(cmd && thisTiddler && !options.noclick) {
				$(button).click(function(ev) {
					cmd(ev, thisTiddler);
	annotateTiddler: function(place, type) {
		var tidEl = $(story.findContainingTiddler(place));
			removeClass("private public external privateAndPublic privateNotPublic shadow").
	showLabel: function(button, type, options) {
		var locale = originMacro.locale;
		var label = options.label ? options.label : locale[type];
		label = label ? label : locale.unknown;
		if(options && options.include) {
			$('<div class="roundelLabel" />').html(label).appendTo(button);
		$(button).attr("title", label);
	confirm: function(ev, msg, onYes, options) {
		options = options ? options : {};
		onYes = onYes ? onYes : function(ev) {};
		var btn = $(".originButton", $([0];
		var popup = Popup.create(btn);
		$("<div />").addClass("message").text(msg).appendTo(popup);
		$("<button />").addClass("button").text(options.yesLabel || "yes").appendTo(popup).click(onYes);
		$("<button />").addClass("button").text(options.noLabel || "no").click(function(ev) {
		return false;
	alert: function(ev, msg) {
		var popup = Popup.create(;
		$(popup).addClass("confirmationPopup alert");
		$("<div />").addClass("message").text(msg).appendTo(popup);;
	reportDirty: function(el) {
		originMacro.alert(el, originMacro.locale.cannotPublishDirtyTiddler);
	iconCommands: {
		"public": function(ev, tiddler) {
			if(!readOnly) {
				var locale = originMacro.locale;
				var msg = locale.moveToPrivate;
				if(story.isDirty(tiddler.title)) {
				} else {
					originMacro.confirm(ev, msg, function(ev) {
						var target = $(;
						var onComplete = function(info) {};
						var privateBag = cmd.toggleBag(tiddler, "private");
						cmd.moveTiddler(tiddler, {
							title: tiddler.title,
							fields: { "server.bag": privateBag }
						}, onComplete);
					}, { yesLabel: locale.makePrivate, noLabel: locale.keepPublic });
		"private": function(ev, tiddler) {
			if(!readOnly) {
				var locale = originMacro.locale;
				var adaptor = tiddler.getAdaptor();
				var publishTo = tiddler.fields[""] || tiddler.title;
				var workspace = "bags/%0".format(tiddler.fields["server.bag"]);
				tiddler.fields["server.workspace"] = workspace;
				var publicBag = cmd.toggleBag(tiddler, "public");
				var msg;
				msg = locale.publishPrivateDeletePrivate;
				var title = tiddler.title;
				var newTitle = publishTo || tiddler.title;
				tiddler.fields[""] = "false";
				if(story.isDirty(tiddler.title)) {
				} else {
					originMacro.confirm(ev, msg, function(ev) {
						var onComplete = function(info) {};
						cmd.moveTiddler(tiddler, {
							title: newTitle,
							fields: { "server.bag": publicBag }
						}, onComplete);
					}, { yesLabel: locale.makePublic, noLabel: locale.keepPrivate });

|''Description''|augments tiddler toolbar commands with SVG icons|
|''Keywords''|toolbar icons SVG|
replaces tiddler toolbar commands with SVG icons if available
requires [[ImageMacroPlugin|]]

SVG icons are drawn from tiddlers titled {{{<command>.svg}}}
In readonly mode a tiddler called {{{<command>ReadOnly.svg}}} will be used if it exists.
* rename (IconToolbarPlugin?)
* support more than one more popup menu in the toolbar.
(function($) {

if(!config.macros.image) {
	throw "Missing dependency: ImageMacroPlugin";

var macro = config.macros.toolbar;

macro.icons = {
	cloneTiddler: "editTiddler"

var _handler = macro.handler;
macro.handler = function(place, macroName, params, wikifier,
		paramString, tiddler) {
	var toolbar = $(place);
		refresh: "macro",
		macroName: macroName
	}).data("args", arguments);
	var status = _handler.apply(this, arguments);
	if(tiddler.isReadOnly()) {
	} else {
	var parsedParams = paramString.parseParams("name")[0];
	if(parsedParams.icons && parsedParams.icons == "yes") {
	if(parsedParams.more && parsedParams.more == "popup") {
		// note we must override the onclick event like in createTiddlyButton
		// otherwise the click event is the popup AND the slider
		$(".moreCommand", place).each(function(i, el) {
			el.onclick = macro.onClickMorePopUp;
		// buttons that are after a less command should not be in more menu.
		$(".lessCommand ~ .button", place).appendTo(place);
		$(".lessCommand", place).remove();
	return status;

macro.refresh = function(place, params) {
	var args = $(place).empty().data("args");
	this.handler.apply(this, args);

var imageMacro = config.macros.image;
macro.augmentCommandButtons = function(toolbar) {
	$(".button", toolbar).each(function(i, el) {
		var cmd = $(el).attr("commandname");
		cmd = cmd ? cmd : "moreCommand"; // XXX: special-casing of moreCommand due to ticket #1234
		var icon = store.tiddlerExists(cmd) ? cmd : macro.icons[cmd];
		var text = $(el).text();
		if(readOnly) {
			var readOnlyAlternative = "%0ReadOnly".format([icon]);
			if(store.tiddlerExists(readOnlyAlternative)) {
				icon = readOnlyAlternative;
		if(store.tiddlerExists(icon)) {
			$(el).css({display: "inline-block"}).empty();
			imageMacro.renderImage(el, icon, { alt: text });

// provide onClickMore to provide extra commands in a popup
macro.onClickMorePopUp = function(ev) {
	ev = ev || window.event;
	var sibling = this.nextSibling;
	if(sibling) {
		var commands = sibling.childNodes;
		var popup = Popup.create(this);
		for(var i = 0; i < commands.length; i++) {
			var li = createTiddlyElement(popup, "li", null);
			var oldCommand = commands[i];
			var command = oldCommand.cloneNode(true);
			command.onclick = oldCommand.onclick;
	ev.cancelBubble = true;
	if(ev.stopPropagation) {
	return false;

|''Description''|Provides TiddlySpace specific view types|
|''Author''|Jon Robson|
|''Requires''|TiddlySpaceConfig TiddlySpaceTiddlerIconsPlugin|
Provides replyLink, spaceLink and SiteIcon view types.
!!SiteIcon view parameters
* labelPrefix / labelSuffix : prefix or suffix the label with additional text. eg. labelPrefix:'modified by '
* spaceLink: if set to "yes" will make any avatars link to the corresponding space. {{{<<originMacro spaceLink:yes>>}}}

(function($) {

var tiddlyspace = config.extensions.tiddlyspace;
var originMacro = config.macros.tiddlerOrigin;
var tweb = config.extensions.tiddlyweb;

config.macros.view.replyLink = {
	locale: {
		label: "Reply to this tiddler"

var _replyButtons = [];
var _replyInitialised, _replyScriptLoaded;
config.macros.view.views.replyLink = function(value, place, params, wikifier,
		paramString, tiddler) {
	var valueField = params[0];
	var imported;
	if(valueField == "title") { // special casing for imported tiddlers
		var localTitle = tiddler.title;
		var serverTitle = tiddler.fields["server.title"];
		if(serverTitle && localTitle != serverTitle) {
			value = serverTitle ? serverTitle : localTitle;
			imported = true;
	} else {
		title = tiddler[valueField] ? tiddler[valueField] : tiddler.fields[valueField];
	var args = paramString.parseParams("anon")[0];
	var label = (args.label) ? args.label : config.macros.view.replyLink.locale.label;
	var space;
	if(tiddler) {
		var bag = tiddler.fields["server.bag"];
		space = tiddlyspace.resolveSpaceName(bag);
	var container = $('<span class="replyLink" />').appendTo(place)[0];

	tweb.getUserInfo(function(user) {
		if ((!user.anon) && ((space && != space && != || imported)) {
			var link = $("<a />")

			if(typeof(createReplyButton) === "undefined") {
			if(_replyInitialised) {
			} else if(!_replyScriptLoaded) {
				_replyScriptLoaded = true;
					function() {
						_replyInitialised = true;
						for(var i = 0; i < _replyButtons.length; i++) {
						_replyButtons = [];


config.macros.view.views.spaceLink = function(value, place, params, wikifier,
		paramString, tiddler) {
		var spaceName = tiddlyspace.resolveSpaceName(value);
		var isBag = params[0] == "server.bag" && value === spaceName ? true : false;
		var args = paramString.parseParams("anon")[0];
		var titleField = args.anon[2];
		var labelField = args.labelField ? args.labelField[0] : false;
		var label;
		if(labelField) {
			label = tiddler[labelField] ? tiddler[labelField] : tiddler.fields[labelField];
		} else {
			label = args.label ? args.label[0] : false;
		var title = tiddler[titleField] ? tiddler[titleField] : tiddler.fields[titleField];

		var link = createSpaceLink(place, spaceName, title, label, isBag);
		if(args.external && args.external[0] == "no") {
			$(link).click(function(ev) {
				var el = $(;
				var title = el.attr("tiddler");
				var bag = el.attr("bag");
				var space = el.attr("tiddlyspace");
				bag = space ? space + "_public" : bag;
				if(title && bag) {
					tiddlyspace.displayServerTiddler(el[0], title,
						"bags/" + bag);
				return false;

config.macros.view.views.SiteIcon = function(value, place, params, wikifier,
		paramString, tiddler) {
	var options = originMacro.getOptions(paramString);
	if(!tiddler || value == "None") { // some core tiddlers lack modifier
		value = false;
	var field = params[0];
	if(field == "server.bag") {
		options.notSpace = !originMacro._isSpace(value);
	tiddlyspace.renderAvatar(place, value, options);

|''Description''|adaptor for interacting with TiddlyWeb|
|''Contributors''|Chris Dent, Martin Budden|
|''Keywords''|serverSide TiddlyWeb|
This plugin includes [[jQuery JSON|]].
!To Do
* createWorkspace
* document custom/optional context attributes (e.g. filters, query, revision) and tiddler fields (e.g. server.title, origin)
(function($) {

var adaptor = config.adaptors.tiddlyweb = function() {};

adaptor.prototype = new AdaptorBase();
adaptor.serverType = "tiddlyweb";
adaptor.serverLabel = "TiddlyWeb";
adaptor.mimeType = "application/json";

adaptor.parsingErrorMessage = "Error parsing result from server";
adaptor.noBagErrorMessage = "no bag specified for tiddler";
adaptor.locationIDErrorMessage = "no bag or recipe specified for tiddler"; // TODO: rename

// retrieve current status (requires TiddlyWeb status plugin)
adaptor.prototype.getStatus = function(context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	var uriTemplate = "%0/status";
	var uri = uriTemplate.format([]);
	var req = httpReq("GET", uri, adaptor.getStatusCallback, context,
		null, null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getStatusCallback = function(status, context, responseText, uri, xhr) {
	context.status = responseText ? status : false;
	try {
		context.statusText = xhr.statusText;
	} catch(exc) { // offline (Firefox)
		context.status = false;
		context.statusText = null;
	context.httpStatus = xhr.status;
	if(context.status) {
		context.serverStatus = $.evalJSON(responseText); // XXX: error handling!?
	if(context.callback) {
		context.callback(context, context.userParams);

// retrieve a list of workspaces
adaptor.prototype.getWorkspaceList = function(context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.workspaces = [];
	var uriTemplate = "%0/recipes"; // XXX: bags?
	var uri = uriTemplate.format([]);
	var req = httpReq("GET", uri, adaptor.getWorkspaceListCallback,
		context, { accept: adaptor.mimeType }, null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getWorkspaceListCallback = function(status, context, responseText, uri, xhr) {
	context.status = status;
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(status) {
		try {
			var workspaces = $.evalJSON(responseText);
		} catch(ex) {
			context.status = false; // XXX: correct?
			context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
			if(context.callback) {
				context.callback(context, context.userParams);
		context.workspaces = { return { title: itm }; });
	if(context.callback) {
		context.callback(context, context.userParams);

// retrieve a list of tiddlers
adaptor.prototype.getTiddlerList = function(context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	var uriTemplate = "%0/%1/%2/tiddlers%3";
	var params = context.filters ? "?" + context.filters : "";
	if(context.format) {
		params = context.format + params;
	var workspace = adaptor.resolveWorkspace(context.workspace);
	var uri = uriTemplate.format([, workspace.type + "s",
		adaptor.normalizeTitle(, params]);
	var req = httpReq("GET", uri, adaptor.getTiddlerListCallback,
		context, merge({ accept: adaptor.mimeType }, context.headers), null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getTiddlerListCallback = function(status, context, responseText, uri, xhr) {
	context.status = status;
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(status) {
		context.tiddlers = [];
		try {
			var tiddlers = $.evalJSON(responseText); //# NB: not actual tiddler instances
		} catch(ex) {
			context.status = false; // XXX: correct?
			context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
			if(context.callback) {
				context.callback(context, context.userParams);
		for(var i = 0; i < tiddlers.length; i++) {
			var tiddler = adaptor.toTiddler(tiddlers[i],;
	if(context.callback) {
		context.callback(context, context.userParams);

// perform global search
adaptor.prototype.getSearchResults = function(context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	var uriTemplate = "%0/search?q=%1%2";
	var filterString = context.filters ? ";" + context.filters : "";
	var uri = uriTemplate.format([, context.query, filterString]); // XXX: parameters need escaping?
	var req = httpReq("GET", uri, adaptor.getSearchResultsCallback,
		context, { accept: adaptor.mimeType }, null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getSearchResultsCallback = function(status, context, responseText, uri, xhr) {
	adaptor.getTiddlerListCallback(status, context, responseText, uri, xhr); // XXX: use apply?

// retrieve a particular tiddler's revisions
adaptor.prototype.getTiddlerRevisionList = function(title, limit, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions";
	var workspace = adaptor.resolveWorkspace(context.workspace);
	var uri = uriTemplate.format([, workspace.type + "s",
		adaptor.normalizeTitle(, adaptor.normalizeTitle(title)]);
	var req = httpReq("GET", uri, adaptor.getTiddlerRevisionListCallback,
		context, merge({ accept: adaptor.mimeType }, context.headers), null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getTiddlerRevisionListCallback = function(status, context, responseText, uri, xhr) {
	context.status = status;
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(status) {
		context.revisions = [];
		try {
			var tiddlers = $.evalJSON(responseText); //# NB: not actual tiddler instances
		} catch(ex) {
			context.status = false; // XXX: correct?
			context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
			if(context.callback) {
				context.callback(context, context.userParams);
		for(var i = 0; i < tiddlers.length; i++) {
			var tiddler = adaptor.toTiddler(tiddlers[i],;
		var sortField = "";
		context.revisions.sort(function(a, b) {
			return a.fields[sortField] < b.fields[sortField] ? 1 :
				(a.fields[sortField] == b.fields[sortField] ? 0 : -1);
	if(context.callback) {
		context.callback(context, context.userParams);

// retrieve an individual tiddler revision -- XXX: breaks with standard arguments list -- XXX: convenience function; simply use getTiddler?
adaptor.prototype.getTiddlerRevision = function(title, revision, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.revision = revision;
	return this.getTiddler(title, context, userParams, callback);

// retrieve an individual tiddler
//# context is an object with members host and workspace
//# callback is passed the new context and userParams
adaptor.prototype.getTiddler = function(title, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.title = title;
	if(context.revision) {
		var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions/%4";
	} else {
		uriTemplate = "%0/%1/%2/tiddlers/%3";
	if(!context.tiddler) {
		context.tiddler = new Tiddler(title);
	context.tiddler.fields["server.type"] = adaptor.serverType;
	context.tiddler.fields[""] = AdaptorBase.minHostName(;
	context.tiddler.fields["server.workspace"] = context.workspace;
	var workspace = adaptor.resolveWorkspace(context.workspace);
	var uri = uriTemplate.format([, workspace.type + "s",
		adaptor.normalizeTitle(, adaptor.normalizeTitle(title),
	var req = httpReq("GET", uri, adaptor.getTiddlerCallback, context,
		merge({ accept: adaptor.mimeType }, context.headers), null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getTiddlerCallback = function(status, context, responseText, uri, xhr) {
	context.status = status;
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(status) {
		try {
			var tid = $.evalJSON(responseText);
		} catch(ex) {
			context.status = false;
			context.statusText = exceptionText(ex, adaptor.parsingErrorMessage);
			if(context.callback) {
				context.callback(context, context.userParams);
		var tiddler = adaptor.toTiddler(tid,;
		tiddler.title = context.tiddler.title;
		tiddler.fields["server.etag"] = xhr.getResponseHeader("Etag");
		// normally we'd assign context.tiddler = tiddler here - but we can't do
		// that because of IE, which triggers getTiddler in putTiddlerCallback,
		// and since ServerSideSavingPlugin foolishly relies on persistent
		// object references, we need to merge the data into the existing object
		$.extend(context.tiddler, tiddler);
	if(context.callback) {
		context.callback(context, context.userParams);

// retrieve tiddler chronicle (all revisions)
adaptor.prototype.getTiddlerChronicle = function(title, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.title = title;
	var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions?fat=1";
	var workspace = adaptor.resolveWorkspace(context.workspace);
	var uri = uriTemplate.format([, workspace.type + "s",
		adaptor.normalizeTitle(, adaptor.normalizeTitle(title)]);
	var req = httpReq("GET", uri, adaptor.getTiddlerChronicleCallback,
		context, { accept: adaptor.mimeType }, null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getTiddlerChronicleCallback = function(status, context, responseText, uri, xhr) {
	context.status = status;
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(status) {
		context.responseText = responseText;
	if(context.callback) {
		context.callback(context, context.userParams);

// store an individual tiddler
adaptor.prototype.putTiddler = function(tiddler, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.title = tiddler.title;
	context.tiddler = tiddler; = || this.fullHostName(tiddler.fields[""]);
	var uriTemplate = "%0/%1/%2/tiddlers/%3";
	try {
		context.workspace = context.workspace || tiddler.fields["server.workspace"];
		var workspace = adaptor.resolveWorkspace(context.workspace);
	} catch(ex) {
		return adaptor.locationIDErrorMessage;
	var uri = uriTemplate.format([, workspace.type + "s",
	var etag = adaptor.generateETag(workspace, tiddler);
	var headers = etag ? { "If-Match": etag } : null;
	var payload = {
		type: tiddler.fields["server.content-type"] || null,
		text: tiddler.text,
		tags: tiddler.tags,
		fields: $.extend({}, tiddler.fields)
	delete payload.fields.changecount;
	$.each(payload.fields, function(key, value) {
		if(key.indexOf("server.") == 0) {
			delete payload.fields[key];
	payload = $.toJSON(payload);
	var req = httpReq("PUT", uri, adaptor.putTiddlerCallback,
		context, headers, payload, adaptor.mimeType, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.putTiddlerCallback = function(status, context, responseText, uri, xhr) {
	context.status = [204, 1223].contains(xhr.status);
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(context.status) {
		var loc = xhr.getResponseHeader("Location");
		var etag = xhr.getResponseHeader("Etag");
		if(loc && etag) {
			var bag = loc.split("/bags/").pop().split("/")[0];
			context.tiddler.fields["server.bag"] = bag;
			context.tiddler.fields["server.workspace"] = "bags/" + bag;
			var rev = etag.split("/").pop().split(/;|:/)[0];
			context.tiddler.fields[""] = rev;
			context.tiddler.fields["server.etag"] = etag;
			if(context.callback) {
				context.callback(context, context.userParams);
		} else { // IE
			context.adaptor.getTiddler(context.tiddler.title, context,
				context.userParams, context.callback);
	} else if(context.callback) {
		context.callback(context, context.userParams);

// store a tiddler chronicle
adaptor.prototype.putTiddlerChronicle = function(revisions, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.title = revisions[0].title;
	var headers = null;
	var uriTemplate = "%0/%1/%2/tiddlers/%3/revisions";
	var host = || this.fullHostName(tiddler.fields[""]);
	var workspace = adaptor.resolveWorkspace(context.workspace);
	var uri = uriTemplate.format([host, workspace.type + "s",
	if(workspace.type == "bag") { // generate ETag
		var etag = [adaptor.normalizeTitle(,
			adaptor.normalizeTitle(context.title), 0].join("/"); //# zero-revision prevents overwriting existing contents
		headers = { "If-Match": '"' + etag + '"' };
	var payload = $.toJSON(revisions);
	var req = httpReq("POST", uri, adaptor.putTiddlerChronicleCallback,
		context, headers, payload, adaptor.mimeType, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.putTiddlerChronicleCallback = function(status, context, responseText, uri, xhr) {
	context.status = [204, 1223].contains(xhr.status);
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(context.callback) {
		context.callback(context, context.userParams);

// store a collection of tiddlers (import TiddlyWiki HTML store)
adaptor.prototype.putTiddlerStore = function(store, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	var uriTemplate = "%0/%1/%2/tiddlers";
	var host =;
	var workspace = adaptor.resolveWorkspace(context.workspace);
	var uri = uriTemplate.format([host, workspace.type + "s",
	var req = httpReq("POST", uri, adaptor.putTiddlerStoreCallback,
		context, null, store, "text/x-tiddlywiki", null, null, true);
	return typeof req == "string" ? req : true;

adaptor.putTiddlerStoreCallback = function(status, context, responseText, uri, xhr) {
	context.status = [204, 1223].contains(xhr.status);
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(context.callback) {
		context.callback(context, context.userParams);

// rename an individual tiddler or move it to a different workspace -- TODO: make {from|to}.title optional
//# from and to are objects with members title and workspace (bag; optional),
//# representing source and target tiddler, respectively
adaptor.prototype.moveTiddler = function(from, to, context, userParams, callback) { // XXX: rename parameters (old/new)?
	var self = this;
	var newTiddler = store.getTiddler(from.title) || store.getTiddler(to.title); //# local rename might already have occurred
	var oldTiddler = $.extend(true, {}, newTiddler); //# required for eventual deletion
	oldTiddler.title = from.title; //# required for original tiddler's ETag
	var _getTiddlerChronicle = function(title, context, userParams, callback) {
		return self.getTiddlerChronicle(title, context, userParams, callback);
	var _putTiddlerChronicle = function(context, userParams) {
		if(!context.status) {
			return callback(context, userParams);
		var revisions = $.evalJSON(context.responseText); // XXX: error handling?
		// change current title while retaining previous location
		for(var i = 0; i < revisions.length; i++) {
			delete revisions[i].revision;
			if(!revisions[i].fields.origin) { // NB: origin = "<workspace>/<title>"
				revisions[i].fields.origin = ["bags", revisions[i].bag, revisions[i].title].join("/");
			revisions[i].title = to.title;
		// add new revision
		var rev = $.extend({}, revisions[0]);
		$.each(newTiddler, function(i, item) {
			if(!$.isFunction(item)) {
				rev[i] = item;
		rev.title = to.title;
		rev.created = rev.created.convertToYYYYMMDDHHMM();
		rev.modified = new Date().convertToYYYYMMDDHHMM();
		delete rev.fields.changecount;
		if(to.workspace) {
			context.workspace = to.workspace;
		} else if(context.workspace.substring(0, 4) != "bags") { // NB: target workspace must be a bag
			context.workspace = "bags/" + rev.bag;
		var subCallback = function(context, userParams) {
			if(!context.status) {
				return callback(context, userParams);
			context.adaptor.getTiddler(newTiddler.title, context, userParams, _deleteTiddler);
		return self.putTiddlerChronicle(revisions, context, context.userParams, subCallback);
	var _deleteTiddler = function(context, userParams) {
		if(!context.status) {
			return callback(context, userParams);
		$.extend(true, newTiddler, context.tiddler);
		context.callback = null;
		return self.deleteTiddler(oldTiddler, context, context.userParams, callback);
	callback = callback || function() {};
	context = this.setContext(context, userParams); = || oldTiddler.fields[""];
	context.workspace = from.workspace || oldTiddler.fields["server.workspace"];
	return _getTiddlerChronicle(from.title, context, userParams, _putTiddlerChronicle);

// delete an individual tiddler
adaptor.prototype.deleteTiddler = function(tiddler, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.title = tiddler.title; // XXX: not required!?
	var uriTemplate = "%0/bags/%1/tiddlers/%2";
	var host = || this.fullHostName(tiddler.fields[""]);
	var bag = tiddler.fields["server.bag"];
	if(!bag) {
		return adaptor.noBagErrorMessage;
	var uri = uriTemplate.format([host, adaptor.normalizeTitle(bag),
	var etag = adaptor.generateETag({ type: "bag", name: bag }, tiddler);
	var headers = etag ? { "If-Match": etag } : null;
	var req = httpReq("DELETE", uri, adaptor.deleteTiddlerCallback, context, headers,
		null, null, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.deleteTiddlerCallback = function(status, context, responseText, uri, xhr) {
	context.status = [204, 1223].contains(xhr.status);
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	if(context.callback) {
		context.callback(context, context.userParams);

// compare two revisions of a tiddler (requires TiddlyWeb differ plugin)
//# if context.rev1 is not specified, the latest revision will be used for comparison
//# if context.rev2 is not specified, the local revision will be sent for comparison
//# context.format is a string as determined by the TiddlyWeb differ plugin
adaptor.prototype.getTiddlerDiff = function(title, context, userParams, callback) {
	context = this.setContext(context, userParams, callback);
	context.title = title;

	var tiddler = store.getTiddler(title);
	try {
		var workspace = adaptor.resolveWorkspace(tiddler.fields["server.workspace"]);
	} catch(ex) {
		return adaptor.locationIDErrorMessage;
	var tiddlerRef = [workspace.type + "s",, tiddler.title].join("/");

	var rev1 = context.rev1 ? [tiddlerRef, context.rev1].join("/") : tiddlerRef;
	var rev2 = context.rev2 ? [tiddlerRef, context.rev2].join("/") : null;

	var uriTemplate = "%0/diff?rev1=%1";
	if(rev2) {
		uriTemplate += "&rev2=%2";
	if(context.format) {
		uriTemplate += "&format=%3";
	var host = || this.fullHostName(tiddler.fields[""]);
	var uri = uriTemplate.format([host, adaptor.normalizeTitle(rev1),
		adaptor.normalizeTitle(rev2), context.format]);

	if(rev2) {
		var req = httpReq("GET", uri, adaptor.getTiddlerDiffCallback, context, null,
			null, null, null, null, true);
	} else {
		var payload = {
			title: tiddler.title,
			text: tiddler.text,
			modifier: tiddler.modifier,
			tags: tiddler.tags,
			fields: $.extend({}, tiddler.fields)
		}; // XXX: missing attributes!?
		payload = $.toJSON(payload);
		req = httpReq("POST", uri, adaptor.getTiddlerDiffCallback, context,
			null, payload, adaptor.mimeType, null, null, true);
	return typeof req == "string" ? req : true;

adaptor.getTiddlerDiffCallback = function(status, context, responseText, uri, xhr) {
	context.status = status;
	context.statusText = xhr.statusText;
	context.httpStatus = xhr.status;
	context.uri = uri;
	if(status) {
		context.diff = responseText;
	if(context.callback) {
		context.callback(context, context.userParams);

// generate tiddler information
adaptor.prototype.generateTiddlerInfo = function(tiddler) {
	var info = {};
	var uriTemplate = "%0/%1/%2/tiddlers/%3";
	var host = || tiddler.fields[""]; // XXX: obsolete?
	host = this.fullHostName(host);
	var workspace = adaptor.resolveWorkspace(tiddler.fields["server.workspace"]);
	info.uri = uriTemplate.format([host, workspace.type + "s",
	return info;

// create Tiddler instance from TiddlyWeb tiddler JSON
adaptor.toTiddler = function(json, host) {
	var created = Date.convertFromYYYYMMDDHHMM(json.created);
	var modified = Date.convertFromYYYYMMDDHHMM(json.modified);
	var fields = json.fields;
	fields["server.type"] = adaptor.serverType;
	fields[""] = AdaptorBase.minHostName(host);
	fields["server.bag"] = json.bag;
	fields["server.title"] = json.title;
	if(json.recipe) {
		fields["server.recipe"] = json.recipe;
	if(json.type && json.type != "None") {
		fields["server.content-type"] = json.type;
	fields["server.permissions"] = json.permissions.join(", ");
	fields[""] = json.revision;
	fields["server.workspace"] = "bags/" + json.bag;
	var tiddler = new Tiddler(json.title);
	tiddler.assign(tiddler.title, json.text, json.modifier, modified, json.tags,
		created, json.fields, json.creator);
	return tiddler;

adaptor.resolveWorkspace = function(workspace) {
	var components = workspace.split("/");
	return {
		type: components[0] == "bags" ? "bag" : "recipe",
		name: components[1] || components[0]

adaptor.generateETag = function(workspace, tiddler) {
	var revision = tiddler.fields[""];
	var etag = revision == "false" ? null : tiddler.fields["server.etag"];
	if(!etag && workspace.type == "bag") {
		if(typeof revision == "undefined") {
			revision = "0";
		} else if(revision == "false") {
			return null;
		etag = [adaptor.normalizeTitle(,
			adaptor.normalizeTitle(tiddler.title), revision].join("/");
		etag = '"' + etag + '"';
	return etag;

adaptor.normalizeTitle = function(title) {
	return encodeURIComponent(title);


 * jQuery JSON Plugin
 * version: 1.3
 * source:
 * license: MIT (
(function($){function toIntegersAtLease(n)
{return n<10?'0'+n:n;}
{return this.getUTCFullYear()+'-'+
toIntegersAtLease(this.getUTCDate());};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};$.quoteString=function(string)
{var c=meta[a];if(typeof c==='string'){return c;}
{var type=typeof(o);if(type=="undefined")
return"undefined";else if(type=="number"||type=="boolean")
return o+"";else if(o===null)
{return $.quoteString(o);}
if(type=="object"&&typeof o.toJSON=="function")
return o.toJSON(compact);if(type!="function"&&typeof(o.length)=="number")
{var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i],compact));}
return"["+ret.join(", ")+"]";}
if(type=="function"){throw new TypeError("Unable to convert object of type 'function' to json.");}
var ret=[];for(var k in o){var name;type=typeof(k);if(type=="number")
name='"'+k+'"';else if(type=="string")
continue;var val=$.toJSON(o[k],compact);if(typeof(val)!="string"){continue;}
ret.push(name+": "+val);}
return"{"+ret.join(", ")+"}";};$.compactJSON=function(o)
{return $.toJSON(o,true);};$.evalJSON=function(src)
{return eval("("+src+")");};$.secureEvalJSON=function(src)
{var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};})(jQuery);
|''Description''|configuration settings for TiddlyWebWiki|
|''Requires''|TiddlyWebAdaptor ServerSideSavingPlugin|
|''Keywords''|serverSide TiddlyWeb|
(function($) {

if(!config.extensions.ServerSideSavingPlugin) {
	throw "Missing dependency: ServerSideSavingPlugin";
if(!config.adaptors.tiddlyweb) {
	throw "Missing dependency: TiddlyWebAdaptor";

if(window.location.protocol != "file:") {
	config.options.chkAutoSave = true;

var adaptor = tiddler.getAdaptor();
var recipe = tiddler.fields["server.recipe"];
var workspace = recipe ? "recipes/" + recipe : "bags/common";

var plugin = config.extensions.tiddlyweb = {
	host: tiddler.fields[""].replace(/\/$/, ""),
	username: null,
	status: {},

	getStatus: null, // assigned later
	getUserInfo: function(callback) {
		this.getStatus(function(status) {
				name: plugin.username,
				anon: plugin.username ? plugin.username == "GUEST" : true
	hasPermission: function(type, tiddler) {
		var perms = tiddler.fields["server.permissions"];
		if(perms) {
			return perms.split(", ").contains(type);
		} else {
			return true;

config.defaultCustomFields = {
	"server.type": tiddler.getServerType(),
	"server.workspace": workspace

// modify toolbar commands

config.shadowTiddlers.ToolbarCommands = config.shadowTiddlers.ToolbarCommands.
	replace("syncing ", "revisions syncing ");

config.commands.saveTiddler.isEnabled = function(tiddler) {
	return plugin.hasPermission("write", tiddler) && !tiddler.isReadOnly();

config.commands.deleteTiddler.isEnabled = function(tiddler) {
	return !readOnly && plugin.hasPermission("delete", tiddler);

// hijack option macro to disable username editing
var _optionMacro = config.macros.option.handler;
config.macros.option.handler = function(place, macroName, params, wikifier,
		paramString) {
	if(params[0] == "txtUserName") {
		params[0] = "options." + params[0];
		var self = this;
		var args = arguments;
		args[0] = $("<span />").appendTo(place)[0];
		plugin.getUserInfo(function(user) {
			config.macros.message.handler.apply(self, args);
	} else {
		_optionMacro.apply(this, arguments);

// hijack isReadOnly to take into account permissions and content type
var _isReadOnly = Tiddler.prototype.isReadOnly;
Tiddler.prototype.isReadOnly = function() {
	return _isReadOnly.apply(this, arguments) ||
		!plugin.hasPermission("write", this);

var getStatus = function(callback) {
	if(plugin.status.version) {
	} else {
		var self = getStatus;
		if(self.pending) {
			if(callback) {
		} else {
			self.pending = true;
			self.queue = callback ? [callback] : [];
			var _callback = function(context, userParams) {
				var status = context.serverStatus || {};
				for(var key in status) {
					if(key == "username") {
						plugin.username = status[key];
							"value", plugin.username, "input");
					} else {
						plugin.status[key] = status[key];
				for(var i = 0; i < self.queue.length; i++) {
				delete self.queue;
				delete self.pending;
			adaptor.getStatus({ host: }, null, _callback);
(plugin.getStatus = getStatus)(); // XXX: hacky (arcane combo of assignment plus execution)

list here things that need sorting out/finishing (tag half-finished work...)
|''Description''|Allows you to set the privacy of new tiddlers and external tiddlers within an EditTemplate, and allows you to set a default privacy setting|
When used in conjunction with TiddlySpaceTiddlerIconsPlugin changing the privacy setting will also interact with any privacy icons.

Currently use of
{{{<<setPrivacy defaultValue:public>>}}} is in conflict with {{{<<newTiddler fields:"server.workspace:x_private">>}}}

There is an option, found in the tweak tab of the backstage, called txtPrivacyMode. Set this to either ''public'' or ''private'' depending on your security preference. If you choose not to set it then it will default to ''public''.
Allows you to set the default privacy value (Default is private)

(function($) {

	var tiddlyspace = config.extensions.tiddlyspace,
	macro = config.macros.setPrivacy = {
		handler: function(place, macroName, params, wikifier, paramString, tiddler) {
			if(readOnly) {
			var el = $(story.findContainingTiddler(place)),
				args = paramString.parseParams("name",
					null, true, false, true)[0],
				container = $("<div />").
				currentSpace =,
				currentBag = tiddler ? tiddler.fields["server.bag"] : false,
				// XXX: is the following reliable?
				isNewTiddler = el.hasClass("missing") || !currentBag,
				tiddlerStatus = tiddlyspace.getTiddlerStatusType(tiddler),
				customFields = el.attr("tiddlyfields"),
				defaultValue = "public",
				options = config.macros.tiddlerOrigin ?
						config.macros.tiddlerOrigin.getOptions(paramString) :
			customFields = customFields ? customFields.decodeHashMap() : {};
			if(isNewTiddler || !["public", "private", "unsyncedPrivate",
					"unsyncedPublic"].contains(tiddlerStatus)) {
				if(args.defaultValue) {
					defaultValue = args.defaultValue[0].toLowerCase();
				} else {
					defaultValue = config.options.chkPrivateMode ?
							"private" : "public";
				defaultValue = defaultValue ?
						"%0_%1".format(currentSpace, defaultValue) :
				this.createRoundel(container, tiddler, currentSpace,
						defaultValue, options);
		updateEditFields: function(tiddlerEl, bag) {
			var saveBagField = $('[edit="server.bag"]', tiddlerEl),
				saveWorkspaceField = $('[edit="server.workspace"]', tiddlerEl),
				input = $("<input />").attr("type", "hidden"),
				workspace = "bags/" + bag;
			if(saveBagField.length === 0) {
				input.clone().attr("edit", "server.bag").val(bag).
			} else {
			// reset to prevent side effects
			$(tiddlerEl).attr("tiddlyFields", "");
			if(saveWorkspaceField.length === 0) {
				input.clone().attr("edit", "server.workspace").
			} else {
		setBag: function(tiddlerEl, newBag, options) {
			var bagStatus,
				title = $(tiddlerEl).attr("tiddler"),
				tiddler = store.getTiddler(title),
				originButton = $(".originButton", tiddlerEl)[0],
				newWorkspace = "bags/" + newBag,
				rPrivate = $("input[type=radio].isPrivate", tiddlerEl),
				rPublic = $("input[type=radio].isPublic", tiddlerEl);
			refreshIcon = function(type) {
				var originMacro = config.macros.tiddlerOrigin;
				if(originButton && originMacro) {
					options.noclick = true;
					originMacro.showPrivacyRoundel(tiddler, type,
							originButton, options);
			macro.updateEditFields(tiddlerEl, newBag);
			if(tiddler) {
				tiddler.fields["server.bag"] = newBag;
				// for external tiddlers
				tiddler.fields["server.workspace"] = newWorkspace;
			if(newBag.indexOf("_public") > -1) {
				rPrivate.attr("checked", false);
				rPublic.attr("checked", true);
				bagStatus = "public";
			} else {
				rPublic.attr("checked", false); // explicitly do this for ie
				rPrivate.attr("checked", true);
				bagStatus = "private";
		createRoundel: function(container, tiddler, currentSpace,
							   defaultValue, options) {
			var privateBag = "%0_private".format(currentSpace),
				publicBag = "%0_public".format(currentSpace),
				rbtn = $("<input />").attr("type", "radio").
					attr("name", tiddler.title),
				el = story.findContainingTiddler(container);
			$("<label />").text("private").appendTo(container); // TODO: i18n
			$("<label />").text("public").appendTo(container); // TODO: i18n
			$("[type=radio]", container).click(function(ev) {
				var btn = $(;
				tiddler.fields[""] = "false";
				if(btn.hasClass("isPrivate")) { // private button clicked.
					macro.setBag(el, privateBag, options);
				} else {
					macro.setBag(el, publicBag, options);
			window.setTimeout(function() {
				macro.setBag(el, defaultValue, options);
			}, 100);
			// annoyingly this is needed as customFields are added to end of EditTemplate so are not present yet
			// and don't seem to respect any existing customFields.

|~ViewToolbar|+editTiddler +cloneTiddler > fields refreshTiddler changeToPublic changeToPrivate revisions syncing permalink references jump closeOthers < closeTiddler|
|~EditToolbar|+saveTiddler saveDraft -cancelTiddler deleteTiddler|
|~RevisionToolbar|> fields revert|
!Impact of an Empowerment-based Parent Education Program on the Reduction of Youth Suicide Risk Factors
To evaluate the impact of parent education
groups on youth suicide risk factors. The potential for
informal transmission of intervention impacts within
school communities was assessed.
Parent education groups were offered to
volunteers from 14 high schools that were closely
matched to 14 comparison schools. The professionally
led groups aimed to empower parents to assist one
another to improve communication skills and relationships
with adolescents. Australian 8th-grade students
(aged 14 years) responded to classroom surveys repeated
at baseline and after 3 months. Logistic regression was
used to test for intervention impacts on adolescent substance
use, deliquency, self-harm behavior, and depression.
There were no differences between the intervention
(n = 305) and comparison (n = 272) samples at baseline
on the measures of depression, health behavior, or family
Students in the intervention schools demonstrated
increased maternal care (adjusted odds ratio
[AOR] 1.9), reductions in conflict with parents (AOR .5),
reduced substance use (AOR .5 to .6), and less delinquency
(AOR .2). Parent education group participants
were more likely to be sole parents and their children
reported higher rates of substance use at baseline. Intervention
impacts revealed a dose-response with the largest
impacts associated with directly participating parents,
but significant impacts were also evident for others in
the intervention schools. Where best friend dyads were
identified, the best friend’s positive family relationships
reduced subsequent substance use among respondents.
This and other social contagion processes were posited to
explain the transfer of positive impacts beyond the
minority of directly participating families.
A whole-school parent education intervention
demonstrated promising impacts on a range of
risk behaviors and protective factors relevant to youth
self-harm and suicide.
!Are Adolescent Suicide Attempters Noncompliant with Outpatient Care?
PAUL D. TRAUTMAN, M.D.Corresponding Author Information, NANCY STEWART, C.S.W., ALYSSA MORISHIMA, M.S.
JAACAP 32, Issue 1, Pages 89-94 (January 1993)
The outpatient clinic attendance patterns of 115 consecutively referred 10− to 18-year-old suicide attempters and of 110 nonattempters were compared. The two groups did not differ in number of appointments scheduled or missed, but attempters kept significantly fewer appointments than did nonattempters. Seventy-seven percent of each group dropped out of treatment, but attempters dropped out significantly faster. Attendance and dropout were unrelated to age, reason for referral, or previous attempts. Girls missed more appointments than did boys, and Hispanic patients kept a smaller percentage of scheduled appointments than did other ethnic groups. We conclude that adolescent attempters are not more likely to drop out of treatment but keep fewer appointments and remain in care more briefly than do other outpatients. Recommendations for triage and brief case management are made.
!From [[Miller, 00]]:
[[Harrington, 98]]; 
[[Lerner & Clum, 90]]; 
[[Rudd et al, 94]].
Trupin EW, Stewart DG, Beach B & Boesky L (2002)
!Effectiveness of a Dialectical Behaviour Therapy Program for Incarcerated Female Juvenile Offenders
Child and Adolescent Mental Health Volume 7, No. 3, 2002, pp. 121–127
Female offenders incarcerated in Washington State have demonstrated higher rates of mental health needs than boys. Linehan’s (1993a, b) Dialectical Behavioural Therapy (DBT) is an effective treatment for adult women with Borderline Personality Disorder. DBT utilises a combination of skills training, problem solving, and validation to enable patients to reduce self-destructive, impulsive and aggressive behaviours. The prevalence of similar emotional problems among female juvenile offenders suggests that DBT may be an effective strategy for this population. 

The State of Washington Governor’s Juvenile Justice Advisory Committee sponsored a collaborative project conducted by a research team from the University of Washington
and the staff at the Juvenile Rehabilitation Administration’s Echo Glen Children’s Center to evaluate the effectiveness of a DBT intervention. 
Pre-post intervention records were compared for female offenders from a mental health and a general population unit where DBT was implemented. Youth on a third unit served as a comparison group. Youth behaviour problems, staff punitive responses were compared before and after the intervention period. 
Youth behaviour problems and use of punitive responses by staff
decreased compared to the year prior on one cottage (unit) while no behaviour or staff changes were noted
on another. 
The evaluation demonstrated the efficacy of providing DBT to female offenders in
a residential setting and yielded mixed results on behaviour change during the study period that may relate to
quality of training and prior youth behaviour problems.
ISBN 1-903645-81-6
© Mental Health Foundation 2006

!Why focus on young people and self-harm?
Whilst there is only a relatively small body of research on self-harm that which does exists shows that rates of selfharm
are much higher among young people (National Institute for Clinical Excellence, 2002)2, with the average
age of onset around 12 years old (Fox and Hawton, 2004)3. It was for this reason that the Inquiry focused on young
people aged between 11 and 25 years old. The earliest reported incidents are in children between five (Inquiry’s
consultation sessions with young people, 2005) and seven years old (NCH and the Centre for Social Justice,
Coventry University, 2002)4. It is estimated that approximately 25,000 young people are admitted to hospital in
the UK each year after deliberately harming themselves (Hawton et al, 2000)5. Most have taken overdoses or cut
themselves (Samaritans and The Centre for Suicide Research, University of Oxford, 2002)6.
There is no such thing as a typical young person who self harms. Whilst the best available evidence indicates that
four times as many girls than boys have direct experience of self-harm (Fox and Hawton, 2004)3 caution is needed
in seeing self-harm as a greater problem for young women, not least because young males may well engage in
different forms of self-harm, such as hitting and punching themselves or breaking bones, which may be easier to
hide or to be explained away as the result of an attack, an accident or a fight.
In the vast majority of cases self-harm remains a hidden and secretive behaviour that can go on for a long time
without being discovered. Personal testimony submitted to the Inquiry shows that most young people make
great efforts to hide their scars, bruises or other signs of self-harm and are extremely reluctant to talk about their
self-harm or what may be troubling them. Most family and friends are likely to be unaware that someone close to
them has self-harmed. This may help explain why research – for example that by Meltzer et al (2001)7 and Green
et al (2005)8 - found that parents were often completely unaware of incidents of self-harm which their children
reported to the same study.
The scale of the problem
The statistics on self-harm are unreliable for a number of reasons. Many young people who self-harm will treat
themselves or will be treated at home and will not reach the attention of services or professionals. Their self-harm
will not therefore be recorded and counted. Young people who self-harm and present at hospital accident and
emergency services are predominantly cases of self-poisoning. Substantial anecdotal evidence that the Inquiry
heard strongly suggests that this is only a small sub-population of young people who self-harm. Finally, figures on
self-harm are confusing as definitions of self-harm used varies across the different research.
However, one survey estimates that 1 in 10 young people self-harms at some point in their teenage years
(Samaritans and The Centre for Suicide Research, University of Oxford, 2002)6. Another recent survey published
by the Priory, which is a private sector provider which treats mental health problems and addictions, found that
as many as one in five girls between the ages of 15 and17 had self-harmed and just under one in five adolescents
- both boys and girls - has considered self-harm. This survey of 1,000 young people between the ages of 12
to19 also found ‘unacceptably high’ levels of mental distress, associated for example with bullying and violence
in the home (The Priory, 2005)9. If extrapolated to the whole UK population this would suggest that more than
one million adolescents have considered self-harm and more than 800,000 have actually inflicted injuries on
Three recent large-scale community-based surveys of self-harm in adolescents in England (Green et al, 20058;
Hawton et al, 200210; Meltzer et al, 20017) reinforce the point that the prevalence of self-harm is much higher than
is indicated by hospital presentations.
In a study from the Centre for Suicide Research in Oxford, covering more than 6,000 15 and 16 year olds in a
representative sample of young people from 41 schools in Oxfordshire, Northamptonshire and Birmingham, 6.9
per cent (11.2 per cent of girls and 3.2 per cent of boys) reported an act of self-harm in the previous year that met
with the study criteria (Hawton et al, 2002)10. Only 12.6 per cent of these cases had resulted in presentation to
Further insight into the prevalence of self-harm among young people comes from a national survey of the mental
health of children and adolescents in the UK (Meltzer at al, 20017; Green et al, 20058). This survey has now been
conducted twice and provides information on prevalence rates for a wide range of emotional, behavioural and
hyperkinetic disorders. The first looked at 10,438 individuals aged between five and 15 years old. In total, 4,249
11 to15 year olds were interviewed, of whom 248 (5.8 per cent) reported having attempted to hurt, harm or kill
themselves at some point (Meltzer et al, 2001)7.
In 2005 the second survey – using slightly different research parameters to the first survey - looked at 7,977
children aged between five and 16 years old and their parents. The prevalence of self-harm reported by young
people in this survey was 28 per cent for children with an emotional disorder, with 21 per cent for children with
a conduct disorder and 18 per cent for children with a hyperkinetic disorder (Green et al, 2005)8. It is important
to note that these results are quite specific to the population of children and young people with a diagnosed
disorder and they should not be taken to imply that there is a similar level of self-harm in the general population.
The prevalence of self-cutting
Because self-cutting is believed to be a common form of self-harm that is under researched the Inquiry
commissioned the Scottish Development Centre for Mental Health (SDC) and the Research Unit in Health,
Behaviour and Change (RUHBC), University of Edinburgh, to undertake a review of literature on self-cutting11. The
remit was to identify and review UK published and ‘grey’ literature but initial analysis revealed a comparatively
small pool of work focusing on self-cutting generally, and little on self-cutting and young people. The main
research study that looks at self-cutting (which only covered England) was undertaken by Hawton et al (2002)10.
Looking beyond the UK the research is similarly sparse with only two studies of note. One by de Leo and Heller
(2004)12, covered Australia and the other, by the National Suicide Research Foundation (2004)13, covered Ireland.
Both provided data in a form which can be used to estimate the incidence and prevalence of self-cutting among
young people. However both these studies paid very little attention to the characteristics of the young people
involved such as gender, ethnicity, sexual orientation and/or disability. According to the Irish study the overall
lifetime prevalence rate of cutting was 5.7 per cent in both genders; the rate among females (9.1 per cent) was
over three times higher than the rate than among males (2.4 per cent).
The researchers commissioned by the Inquiry combined the findings of these three studies. This limited evidence
suggests that around four per cent of young people in the community cut themselves over a 12 month period.
Data on the annual incidence of self-cutting which has been treated in hospital are available for Scotland. Figures
for a 3 year period (2001/2 – 2003/4) indicate that the annual incidence of hospital treated self-cutting is about 31
per 100,000 population aged 15 to 19 years, with a somewhat higher rate among females than males. However,
in the 20 to 24 age group, the rate among males is higher than the rate among females with an overall rate of
about 38 per 100,000 population (Information Services of National Services Scotland 2004)14.
The Inquiry concluded that there is a clear and important need for much better data on the prevalence of
self-harm among young people in the UK. Caution needs to be exercised in drawing firm conclusions from the
research quoted above, not least because of variations in research methodology. However, the Inquiry is satisfied
that taking all the available research data together indicates a prevalence rate of between 1 in 12 and 1 in 15
across the UK.
!Reasons for SIB
The Inquiry was interested to know why young people self-harm and whether there are specific individual
characteristics that indicate likelihood of self-harm or whether particular groups of young people who self-harm
more or less than others.
>‘Pain works. Pain heals. If I had never cut myself, I probably wouldn’t still be around today. My parents didn’t help me, religion didn’t help me, school didn’t help me but self-harm did. And I’m doing pretty well for myself these days. Don’t get me wrong, not in a heartbeat do I think that self-harm is a good or positive thing, or anything besides a heart-breaking desperate act that saddens me every time I hear about it. But there is a reason why people do it.’

>‘My emotions can vary rapidly and be very intense. If in an emotionally charged situation, I will either during or shortly after harm myself. I’m not good at dealing with emotions or communicating mine to others.’

>‘I don’t deal with daily stress well, so when extra events occur however big or small, my tension levels rise, resulting in my needing a “release”. Self-harm has proven to be most successful in dealing with this.’

Evidence from the Child and Adolescent Self-harm in Europe (CASE) Study, comprising self-reported information
on an overall sample of 30,437 young people from seven countries, clarifies some of the factors associated with
self-harm among young people (Madge et al, 2004, NCB)15. CASE’s work over the past two years has established
an international network of experts to design, plan and carry out a European multi-centre study to provide better
information on the scale and characteristics of the problem.
The CASE study had two main sources of information. First, participating countries monitored all hospital
admissions (inpatient and outpatient) within their study catchment area (with a population of around 250,000 in
total in each area) by young people under 20 years of age following an episode of deliberate self-harm. Details
on young people’s gender, age and method of self-harm are recorded in all instances, along with other available
information. Second, around 5,000 pupils aged between 15 and 16 years old in each participating country were
given an anonymous self-report questionnaire covering background, life events, deliberate self-harm (occurrence,
frequency, context and experiences), and personal characteristics relating to mood, impulsivity, coping, selfesteem
and health behaviour.
The likelihood of self-harm was positively associated with a wide range of life experiences and personal
characteristics; analyses were conducted to ascertain those independently associated with episodes. Among
males, the factors independently associated with self-harm were a family member who had attempted suicide
or deliberately harmed themselves at some point during the young person’s lifetime (significant in all seven
countries); any drug use in past year (significant in five countries); and a low self-image and low self-esteem
(significant in four countries). The factors independently associated with self-harm among females were a family
member who had attempted suicide or deliberately harmed themselves at some point during the young person’s
lifetime (significant in all seven countries); a close friend who had attempted suicide or deliberately harmed
themselves at some point during the young person’s lifetime (significant in all seven countries); a low self-image
and low self-esteem (significant in six countries); cigarette smoking in the past week (significant in five countries);
drug use in the past year (significant in five countries); worries about sexual orientation (significant in four
countries); high impulsivity (significant in four countries); and a high anxiety level (significant in four countries).

!!Reported by young people:
Reasons cited for self-harm by young people consulted for the Inquiry:
Young people consulted for the Inquiry reported a wide range of factors that could trigger self-harm. It is
interesting to note that whilst there is some similarity to the research findings previously described there are also
some differences. The most frequent reasons mentioned by young people were:
*being bullied at school
*not getting on with parents
*stress and worry around academic performance and examinations
*parental divorce
*unwanted pregnancy
*experience of abuse in earlier childhood (whether sexual, physical, and/or emotional)
*difficulties associated with sexuality
*problems to do with race, culture or religion
*low self-esteem
*feelings of being rejected in their lives.

Other factors often linked with self-harm, including bullying, physical or sexual abuse, poor family relationships,
and problems with boyfriends or girlfriends, showed significant independent associations with self-harm in fewer
countries. The findings overall suggest that the factors most consistently associated with self-harm, across both
countries and gender, were attempted suicide or self-harm in a family member, drug use and a low self-image
and low self-esteem.
The Inquiry also looked specifically at the English component of the CASE Study outlined above (Hawton et al,
Centre for Suicide Research, University of Oxford, 2004)13 to see if there are any significant differences between
this and the European findings. The findings for England were broadly similar to the pan-European findings. For
example, school pupils said their most common motive for self-harm was to cope with distress: ‘to get relief from
a terrible mind state’, as one put it. The study also reinforced the point that adolescents who self-harm are more
likely than average to have a range of problems, to have maladaptive coping strategies, and to use very little
support apart from their friends.
As Fox and Hawton (2004)3 point out, young people usually start to self-harm as the result of a complex
combination of experiences, not one single event or experience. The factors that Fox and Hawton found to be
specifically linked to self-harm include mental health problems (such as hopelessness and depression); family
circumstances (such as parental criminality and/or family poverty); disrupted upbringing (periods of local
authority care, parental marital problems such as separation or divorce); and continuing family relationship
Research additionally indicates a clear link between self-harm and sexual abuse in childhood. For example,
Romans et al (1995)16 interviewed a community sample of 252 women who reported having been sexually
abused as children; compared this to a similarly sized group who did not report abuse; and then compared the
sub-group of women sexually abused as children who reported subsequent incidents of deliberate self-harm with
abused women who did not report self-harm. The authors found a clear statistical association between sexual
abuse in childhood and self-harm, and that this was particularly marked in women who had been subjected to
more severe and more frequent abuse. Self-harm was also associated with major interpersonal problems in the
subject’s family and with becoming involved in further abusive relationships as an adult. Two additional studies
have attempted to determine whether particular characteristics of childhood sexual abuse place individuals at
greater risk for engaging in self-harm as adults, and confirmed that a more severe, more frequent, or a longer
duration of sexual abuse was associated with an increased risk of engaging in self-harm in adult years (Boudewyn
and Liem, 199517; Turell and Armsworth, 200018).

!AT Risk Groups
Groups and populations at particular risk of self-harm
The Inquiry received a range of evidence on ‘populations at risk’, such as:
* young people in closed and custodial settings; 
*lesbian, gay, bisexual and transgender young people; 
*black and minority ethnic young people; and
*young people with learning disabilities. 
Very little formal research comprehensively addresses the issues around self-harm and these populations. This is confirmed by the literature review (‘Written on the body: a review of literature on self-cutting’) commissioned by the Inquiry and carried out by the Scottish Mental Health Development Centre and the Research Unit in Behaviour, Health and Change, University of Edinburgh (2005)11.
!!Closed settings
Self-harm for young people in institutional or residential settings (including the armed forces, prison custody,
sheltered housing or foyers and boarding schools) are continually reported, anecdotally, to be higher compared
to community settings. Currently only the Prison Service collects data on actual prevalence and incidents of selfharm
and this is discussed below.
The latest figures from the Prison Service Safer Custody Group’s Research and Training Unit show that a high
proportion of people, and in particular young people under the age of 21, self-harm in custodial settings.
Reducing self-harm has been identified by Government ministers as one of the priorities for young offenders’
institutions and for the Prison Service as a whole.
In December 2002, the Prison Service introduced a revised system for self-harm data collection that requires
all staff to complete a form for every incident of self-harm known to occur within the establishment. This form
records details of the method used, together with information on location, treatment, risk status and prisoner
details. The new procedures have improved the validity and accuracy of the self-harm data collected although
the Safer Custody Group believes that underreporting still continues.
According to the information recorded in this manner, 5,425 individuals harmed themselves during 2003, and 16,
214 incidents of self-harm were recorded. This is the equivalent to a rate of 74 individuals and 222 incidents per
1,000 prisoners. The most common method of self-harm was cutting or scratching (57 per cent of all incidents).
Various forms of self-strangulation and suffocation are reported as well: 17 per cent of all incidents were by selfstrangulation,
eight per cent involved hanging and six per cent were poisoning. Other methods included head
banging/wall punching, wound aggravation, ligatures and burning.
Young people (under 21 years) were over-represented in this number, accounting for 25 per cent of prisoners who
self-harmed. This was particularly true of young women; 65 per cent of females under 21 harmed themselves
and 10 per cent of young males. Although females only account for six per cent of the prison population, they
accounted for a quarter of all individuals who self-harmed and nearly half (46 per cent) of all reported self-harm
incidents. The female rate of self-harm incidents (1,674 incidents per 1,000) was 13 times higher than the male
rate of self-harm (128 incidents per 1,000). Women were also notably more likely to self-harm repetitively. Half of
the female prisoners who self-harmed did so more than once, compared with one third of males.
!!Lesbian, gay, bisexual and transgender young people
Recent research indicates that lesbian, gay, bisexual and transgender young people report higher rates of selfharm
than heterosexual young people (they are two to three times more likely to self-harm). Rivers (2000)21
found that 72 per cent of lesbian, gay, bisexual and transgender adults reported a regular history of absenteeism
at school due to homophobic harassment; 50 per cent who had been bullied at school reported they had
contemplated self-harm, and 40 per cent had self-harmed at least once. Results from a national survey that looked
at mental health problems in gay men, lesbians and bisexuals found that 42 per cent of gay men, 43 per cent of
lesbians and 49 per cent of bisexual men and women have planned or committed acts of self-harm. Between
September 2000 and July 2002 researchers interviewed 2,430 lesbian women, gay men and bisexual men and
women over the age of 16 years in England and Wales and concluded that ‘there is a likely link between levels of
discrimination and an increased risk of mental health problems’ (Warner et al, 2004)22.
The reasons why young lesbian, gay, bisexual and transgender individuals self-harm are broadly similar to the
reasons cited by young people as a whole. For example, ‘First Out’, a youth service working with lesbian, gay,
bisexual and transgender young people in Leicester carried out a small piece of qualitative research into the
experiences of young people using the service. These young people cited pressure, isolation, not fitting in,
anger and frustration with themselves, panic attacks, the need to take control of something, the need to escape,
bereavement and stress caused by examinations and school as reasons why they had self-harmed. This evidence
is supported anecdotally by national organisations such as Stonewall and LGBT Youth Scotland and England.
!!Black and minority ethnic young people
Research has shown that Asian women aged 15 to 35 are two to three times more vulnerable to self-harm than
their non-Asian counterparts (Soni-Raleigh, 1996)23 and the available research suggests the rates of self-harm and
eating disorders are believed to be higher among adolescent South Asian girls. However there is little known
about the actual experience and needs of young men and women who self-harm from black and minority ethnic
groups and communities.
!!Abuse and Ethnicity
Newham Asian Women’s Project (1998)24 research revealed a complex range of disturbing and familiar issues
with accounts of isolation and despair and many forms of abuse within families. There were reported conflicts
between generations in families but also additional religious and social pressures with many reporting pressures
which include rigidly defined matrimonial roles and the duty of women to maintain the family honour. Many
expressed their concern at the unrealistic expectations demanded of them from their families.
All participants in the Newham research felt that the response from services was inadequate and often
inappropriate and the women were not aware of the support that was available to them or were distrustful of it.
There were also notable examples of professionals who clearly understood very little of mental health issues and
even less the about the different culture and self-harm. There were also many breaches of confidentiality - with
families often being informed of a disclosure of self-harm.
In 2001 YoungMinds decided to focus a national research study on exploring the awareness and experiences
of young people from black and minority ethnic groups who use child and adolescent mental health services
(CAMHS ), with a particular emphasis on the barriers preventing these young people from accessing help.
Young people with learning disabilities
Approximately one-third of a million young people in the UK have learning disabilities (Emerson, Hatton, Felce
and Murphy, 2001)25. Of those, 40 per cent are likely to develop a diagnosed mental health problem (Emerson,
2003)26. In 2001 the Foundation for People with Learning Disabilities convened an inquiry to explore the mental
health needs of young people with learning disabilities (Mental Health Foundation, 2002; 2005)27;28. The findings
from this inquiry and research confirmed that young people with learning disabilities experience the same range
of mental health problems as other young people, but found that they are more prone to depression and anxiety
disorders and these often go unrecognised and untreated. The report also highlighted the high incidence of selfharm
among this group of young people.
The existing literature estimates rates of self-harm in people with learning disabilities to be approximately
between 8 to15 per cent in institutional settings, and between 2 and12 per cent in community settings (Wisely et
al, 2002)29. However, most of the research concentrates on people with severe and profound learning disabilities
and associated syndromes. This reflects the medical model that associates the behaviour with a syndrome, rather
than with response to distress (Collacott et al, 199830; Emerson, 200326; Emberson and Walker, 199031; Hyma and
Oliver, 200132). There is also virtually no specific focus on young people in the available research.
One of the few studies solely addressing the views of people with mild to moderate learning disabilities who selfharm
was carried out by Duperouzel (2004)33. This study attempted to explore some of the subjective experiences
of nine people who self-harmed. Participants reported similar views and reasons for their self-harm as the young
people that the Inquiry consulted. Most acknowledged that self-harm was not an effective long-term coping
strategy, and were concerned about the physical damage they were sometimes inflicting on themselves. Some
talked about stopping their self-harm, but did not know how to go about it, or who could help them.

!!!Anti-bullying strategies
Since September 1999, head teachers of state maintained schools have been under a duty to draw up measures
to prevent all forms of bullying among pupils, and must have anti-bullying policies and procedures in place (DfES
2002). Local education authorities have a responsibility to ensure that schools have anti-bullying policies and that
these are being implemented in practice.
The National Healthy School Standard provides schools with a framework and support for developing and
implementing anti-bullying strategies, based on approaches known to be effective (which usually means
involving the whole school, parents and the community).
There is good research evidence to show that a whole-school approach is more effective than specific
interventions. For example in their review, Clarke and Kiselica (1997)35 focused on a systematic, school-wide
intervention approach which includes: an attitudinal shift in how bullying is understood and responded to;
education for students, teachers, administrators and parents; consistent school policies; close adult supervision;
early intervention; school-wide assessment; and supportive training and counselling. Intervention programmes
integrating these components have shown significant effects: one study found that that this approach reduced
bullying incidents by 20 per cent, and another found a reduction by 50 per cent (Arora, 199436; Olweus, 199137;
199338; 199439).
!!!Peer support
Many young people prefer to turn to other young people when they have a problem. Peer support approaches
are intended to equip school students with the skills to support each other effectively. It is not an alternative to
professional counselling and other interventions or treatments, but it is an important intervention in its own right
– evidenced by work done by the Place2Be which shows a reduction in bullying where young people are helped
to find the support and space to talk about issues that are troubling them.
Structured peer support in schools is still relatively new in the UK – most schools only started peer support
schemes in the 1990s. Schools tend to view such schemes as ways to tackle bullying, but there is evidence to
suggest that they may also help to create an atmosphere that makes other negative behaviours as well as bullying
less acceptable to the student body as a whole (ChildLine, 2005)40.
There are different models of peer support. Most adhere to Cowie and Wallace’s (2000)41 definition, combining
‘peer listening’ – a confidential, usually one-to-one listening service; ‘peer mentoring’ – peer supporters act
as ‘buddies’ or ‘befrienders’ to individuals or groups; ‘peer mediation’ – peer supporters are trained in conflict
resolution so that they can act as mediators in the playground or in response to bullying; ‘peer education’
– peer supporters are given information and training skills in a particular subject area such as smoking or sexual
behaviour, and train their peers in turn; and ‘peer tutoring’ – a peer supporter supports an individual with reading
or other areas of school work.
As noted earlier, evidence shows that interventions such as peer support are a lot more effective when they
are part of a whole school approach rather than run in isolation (Weare and Gray, 2003)42. A peer support
scheme which is part of a whole school approach may well help schools to meet the demands of the citizenship curriculum, help them work towards the National Healthy School Standard, and enable the school to demonstrate
commitment to students’ social and emotional development (Mental Health Foundation, 2002)43.

!!!Access to advice and information
The research from the Centre for Suicide Research in Oxford University (see chapter 1) included a section
commissioned by the Inquiry in which young people were questioned about seeking help and barriers to doing
this (Fortune et al, 2005)44.
Young people were asked: 
>//‘What do you think could be done to help prevent young people from feeling that they want to hurt themselves?’// 
The most common answer (from over a quarter of participants) was someone who would
listen to them, and give advice and support. Students from Asian backgrounds were particularly likely to say
this would be useful, and girls were more likely than boys to emphasise the importance of talking, listening and
advice. Significantly, participants were three times more likely to suggest talking to friends or family members
than to mention mental health professionals or drop-in centres; this suggests that potential intervention or
prevention strategies might well be directed at involving peers and family members.
Seven per cent, mainly girls, suggested that it would be useful to have someone in school to give advice and
support. It is worth noting, in this context, that many pupils described the damaging effects of bullying in
their schools, and their wish that schools would deal with this more effectively; and also that girls particularly
mentioned the effects of exams, school pressures, and teachers who did not intervene effectively in bullying.
Pupils who had experienced self-harm or knew someone who had self-harmed talked about wanting a support
person / counsellor - but ideally not a teacher - who would engage with them on a more regular, hands-on basis
and not just when the pupils were facing difficulties.
Fortune, Hawton and colleagues commented on the high number of young people who talked about difficulties
in their family situations, with eight per cent expressing a desire to have more active parenting, including more
love, attention, time and care from their parents. Similarly, a number of young people commented on serious
problems at home such as parents who abused substances, and/or the effects of parental conflict, separation and
divorce. However, family members were also considered an important source of support and advice.

*''Only three per cent specifically mentioned mental illness or psychiatric disorders; only two per cent mentioned
the potential role of mental health professionals, or GPs in preventing self-harm among young people.'' 
*Seven per cent mentioned telephone help lines, which was the most common form of help referred to – and, perhaps
*Only 11 respondents (0.3 per cent) mentioned the internet.

!!!NB - (DB comments) - General emphasis on SCHOOL BASED WORK

!Response by Emergency services to SIB in youth
Representatives from several hospital A & E departments told the Inquiry that young people who self-harm often
return several times which leads to a sense of therapeutic nihilism: professional staff were asking, ‘What can we
do?’ The Inquiry was told that A & E staff did not feel that they had effective models of working to respond well.
Nor did they feel they were getting the support they needed themselves – many need debriefing after dealing
with self-harm (because the injuries can sometimes be upsetting and it can be difficult to understand why a
young person self-harmed).
Guidelines from NICE on the care of people who self-harm, published in 200454, were intended to address how
young people who have self-harmed are dealt with in A & E (and primary care) . The Inquiry was told that
the guidelines are in part based on the experiences of two focus groups comprising people who had direct
experience of self harm. However, the Inquiry was also aware that some of the focus group members were very
unhappy with the process and withdrew their involvement.
The NICE guidelines make recommendations for physical, psychological and social assessment and treatment
by primary and secondary care services in the first 48 hours after the self-harm has taken place. However, NICE’s
remit does not include evaluation of the take up or compliance with its guidelines (which apply only to England
and Wales) so it is unclear how far service provision in A & E departments has been or will be influenced by the

!Contact and help-seeking after SIB
Table 1: Contact and help-seeking (n=Contact %)
|Profession/ individual/ organisation|Contact N| (%) |No Contact N| (%)|
|Friend| 117 |(82.4) |15 |(10.6)|
|GP |87 |(61.3) |49| (34.5)|
|Psychiatric service| 86 |(60.6)| 50 |(35.2)|
|Relative |73 |(51.4)| 61| (43)|
|Teacher| 56| (39.4) |80| (56.3)|
|Voluntary/local organisation| 44 |(31) |95 |(66.9)|
|Other nurse| 43| (30.3)| 93 |(65.5)|
|School nurse| 30| (21.1) |110 |(77.5)|
|Other organisation |36 |(25.4) |101| (71.1)|
|Social worker| 23 |(16.2) |115| (81)|
|Police| 9 |(6.3) |131 |(92.3)|
|Health visitor |8 |(5.6)| 132 |(93)|
|Prison| 2 |(1.4) |139| (97.9)|

!Coping strategies
Young people told the Inquiry about the crucial importance of being able to distract themselves from self-harm
even for a short period of time. For some distraction can be a first step towards tackling their self-harm and it
should be treated as a positive step.
Part of successful self-management is the ability to ‘surf the urge’ , as described by LifeSigns (2005)57. In practice
this means to wait it out, observing the emotions and how they build up and then diminish and fade away. This
can be very difficult for many young people to manage but it is possible.
>‘I use a wide range of things from music and television to relaxation techniques and reading but the one that helps if I’m feeling really bad is to be around someone I trust. I may look bad and not be very talkative – but just to be around someone who doesn’t question my odd behaviour and lets me be around them without talking or explanations helps.’

>‘I tried so many – from holding an ice-cube, elastic band flicking on the wrist, writing down my thoughts, hitting a pillow, listening to music, writing down pros and cons –but the most helpful to my recovery was the five minutes rule, where if you feel like you want to self-harm you wait for five minutes before you do, then see if you can go another five minutes, and so on till eventually the urge is over. Another great help was talking to my friends about my problems. With some of the methods I couldn’t last two, three days; I found it hard to
adapt to something so different, when I was used to coping with my own way. Eventually though I found a way of coping which I got on with and it helped me to stop.’

Successful distraction techniques
A majority of the young people consulted by the Inquiry told us that they had found distraction techniques that
worked for them. This was confirmed by expert testimony to the Inquiry. However, it is extremely important to
recognise the need for individual techniques; a ‘one size fits all’ approach will not work. Some of the most popular
‘tried and tested’ distraction techniques used by a range of young people are:
using a red water-soluble felt tip pen to mark instead of cut
hitting a punch bag to vent anger and frustration
rubbing ice instead of cutting
physical exercise
making lots of noise, either with a musical instrument or just banging on pots and pans
writing negative feelings on a piece of paper and then ripping it up
scribbling on a large piece of paper with a red crayon or pen
putting elastic bands on wrists and flicking them instead of cutting
writing a diary or journal
talking to a friend (not necessarily about self-harm)
collage or artwork
going online and looking at self-help websites.

!!!Support Groups
Self-help support groups
The Inquiry heard evidence from several organisations that run self-help support groups specifically for young
people who self-harm. Self-help groups offer mutual support which enables people to explore their feelings
around self-harm, the reasons behind it, and how they cope with it. They also provide an important opportunity
for people to gain trust, find friendships, feel less isolated and alone, and begin to share and explore common
experiences and knowledge.
Young people’s evidence to the Inquiry confirms the value of self-help groups, and this is supported by research
into the effectiveness of self-help groups generally (Young and Williams, 1987 58, Self-help Network, 2002 59; Hyde,
2001 60; Adamsen and Rasmussen, 2001 61, Kurtz, 1997 62). In 2003, the Mental Health Foundation commissioned
research into the positive and negative effects of attending a self-harm self-help group (Smith and Clarke, 2003) 63.
The findings from this research suggest that self-help groups offer a safe place to talk openly and honestly
without fearing the response from professionals.
However, although many individual testimonies stressed the helpfulness of contact with others who self-harmed
and how this is often a turning point in the road to recovery (Clarke, 2003) 64, some professionals are still concerned
that talking about self-harm to other people who self-harm may encourage people to continue, and/or self-harm
in new ways.
!!!Websites and internet forums
Websites and internet forums have become increasingly popular, especially with young people, as a way to access
information and support for a range of different issues including self-harm. However, some are concerned that
some of these forums or websites contain unhelpful and misleading information. It is clear that many young
people – especially young men, who tend not to engage in traditional face-to-face services – do find this vehicle
for information accessible, especially when trying to deal with a taboo and stigmatised issue such as self-harm.
The Inquiry has heard from a number of website and chat forums appropriately run and overseen by voluntary
organisations, which provide very useful support and information for young people. It is important that these
reputable sites are publicised more widely to young people to ensure that they can access the most appropriate
advice (See Appendix 3 for further information).
!!!Telephone help lines
Telephone help lines are another popular and easily accessible source of confidential support and advice for
young people, family and friends. They can also direct callers to other organisations that work with young people
and issues of self-harm. Many operate only as a ‘friendly listening ear’ – something many young people told
the Inquiry that they value, particularly when they feel they have no-one else that they can turn to. Again it is
important that information about reputable phone lines is widely available to young people so that they know
where to turn in times of difficulty (See Appendix 3 for further information).
!!!Counselling services
In recent years there has been an increase in the availability of counselling services across the NHS and voluntary
sector. ''The Inquiry could find no evidence (whereas it did for DBT and CBT) to demonstrate the effectiveness of
counselling for young people who have self-harmed'' but found a common – perhaps incorrect – belief that any
kind of counselling/therapy, even from an untrained worker, is better than none (Allen, 1995) 65. It was clear to
the Inquiry that ’talking therapies’ for young people who self-harm should be carried out by staff who are trained
specifically in working with this group, and be focused on the problems or issues that the young people want to
!!!Inpatient treatment
The Inquiry heard evidence from the Crisis Recovery Unit at the Bethlem Hospital in London66, a national specialist
residential unit for people of 17 years and above who persistently self-harm (and do so in ways that often
result in severe injury). The 12-bed service offers both inpatient and outpatient treatment; it is provided by a
multidisciplinary team.
The philosophy of the Unit is that individual young people should retain responsibility for their behaviour,
and that – in the short term – self-harm can sometimes be tolerated although not promoted: this is termed
‘therapeutic risk’. This approach is based on the view – supported by practice experience – that if staff remove all
potentially damaging items and take responsibility for the young person’s immediate safety, the young person
does not make the choice themselves. In the long term, when they have left the unit, they need to have learned
their own strategies for coping with the urge to self-harm.
Acknowledging their self-harm also makes it possible to discuss it, because young people are not forced into
a position where they are continually denying their self-harm behaviour. Instead, the work focuses on helping
young people reach a point where they realise for themselves that self-harm is not an effective long-term strategy
for dealing with their problems. The aim is to help young people start to explore alternative coping strategies (as
well as strategies for dealing with the urge to self-harm).
!!!Systematic reviews of intervention models – a medical approach
A number of systematic reviews evaluating the effectiveness of interventions after incidents of self-harm have
been published relatively recently (Van der Sande, Buskens, Allart et al, 1997 67; Hawton, Arensman, Townsend et al,
1998 68; NHS Centre for Reviews and Dissemination, 1998 69; Fox and Hawton, 2004 3).
The main interventions that have been evaluated are:
*brief psychological therapy (problem-solving therapy)
*more intensive but conventional psychiatric care (special clinics, outreach, continuity of therapist, routine general hospital admission, longer-term contact)
*crisis cards intensive psychological therapy (dialectic behaviour therapy, inpatient therapy) 
*drug therapy (antidepressants, flupenthixol).
This literature is however limited. It is largely based on studies on people attending hospital accident and
emergency services which, as previously noted, is only a proportion of young people who self-harm. ''Most of
the literature focuses on self-poisoning rather than other forms of self-harm such as cutting, burning or bruising.''
Although there is some overlap between these behaviours they are not identical. 

The Inquiry commissioned the Scottish Development Centre for Mental Health and the Research Unit in Health, Behaviour and Change to review the literature on self-cutting. This review found that there is remarkably little on effective therapeutic interventions; ''Derouin and Bravender (2004) 70, in their review of the phenomenon of self-mutilation among adolescents, comment that evidence-based treatment approaches for people who repeatedly cut themselves have not been documented'', while Fox and Hawton (2004) 3 also found no UK-based controlled intervention studies of people who engaged solely in self-cutting.

It is also extremely difficult to reach any conclusions about effective interventions from these studies. For one
thing, they examine different types of intervention, with widely varying study populations (typically small
numbers from selected sub-populations rather than community based normative populations). For another,
different studies focus on different issues (for instance: reducing depressive symptoms, enhancing problemsolving
skills, controlling self-harm or encouraging of individuals to use services during a crisis). In addition, the
majority concentrated on reductions in incidents of self-harm (and in fact no intervention produced a statistically
significant reduction in repetition) rather than mood, or quality of life, or what the people involved themselves
wanted to achieve. Despite the limited evidence base, the three forms of intervention described below seem

!!!Crisis cards
In a Bristol-based study (Morgan, Jones and Owen, 1993) 71 - which focused on people who had taken a first
drug overdose - people were given cards which enabled the holder to speak to a psychiatrist at short notice and
to request psychiatric admission in a crisis. Although the majority did not take up the services on offer on the
card, there was some evidence to suggest that the cards reduced the repetition of the behaviour. It is possible
that a similar approach might be effective for people who have self-harmed for the first time. It should be noted
however that the average age for this group was 30, and one attempt to copy this scheme has not had such
good results (Evans, Evans, Morgan, Hayward and Gunnell, 2005)72. However, it is clearly a good idea to give people
who attend hospital after an episode of self-harm advice about local services that they can use either in a crisis or
when they are contemplating self-harm

!!!Problem-solving therapy
This is a brief treatment aimed at helping the individual to acquire basic problem-solving skills, by taking him
or her through a series of steps: identifying personal problems; constructing a problem list which clarifies
and prioritises them; reviewing possible solutions for a target problem; implementing the chosen solution;
reappraising the problem; reiterating the process; and learning problem-solving skills for the future (D’Zurilla,
1986)73. This usually involves about six one-hour sessions, with some reading and other work between sessions. It
can be delivered by any experienced mental health professional, with suitable training and supervision.
Problem-solving therapy has been shown to be an effective treatment for improving depression, hopelessness
and poor problem-solving in other settings (D’Zurilla, 198673; Salkovskis, Atha and Storer, 199074; Townsend et al,
200175) and in self-harm studies it has led to improvement in other relevant outcomes such as mood and social
adjustment (House, Owens & Storer, 1992)76. It may therefore be suitable for some individuals, although the
existing evidence does not make it completely clear how widely it could be applied, and further work is needed
to build up an evidence base around this type of therapy generally.
!!!Dialectic behaviour therapy
This particular therapy was introduced as a method of helping those who engage in chronic repetitive self-harm,
particularly when they have associated borderline personality characteristics (Linehan, 1993)77. It is intensive: the
full form involves a year of individual therapy, group sessions, social skills training and access to crisis contact.
It has provoked a lot of interest, as there is some evidence to suggest that it reduces self-harm in a group of
people for whom services generally have little or nothing else to offer; but this evidence does not at the moment
demonstrate that it is both widely applicable and cost effective.
!Other (less well-evidenced) treatments
A number of other treatments and interventions have been used in work with young people who self-harm.
However, although there is a substantial amount of literature on these various forms of treatment in relation to
other conditions they have not been sufficiently evaluated in relation to self-harm.
!!!Cognitive Behaviour Therapy
Cognitive Behaviour Therapy is based on the assumption that the way an individual interprets events and
experiences affects the way they feel and behave. Individuals develop automatic patterns of thinking which
can be distortions of reality, which in turn can lead to maladaptive coping mechanisms, such as self-harm. The
therapist aims to change the individual’s cognitive processes using techniques that are similar to those used in
problem-solving therapy but may also include behavioural techniques.
!!!Family therapy
Family therapy is a branch of psychotherapy that treats family problems. Family therapists consider the family
as a system of interacting members; the problems in the family are the result of the interactions in the system
rather than the ‘faults’ or psychological problems of individual members, and the focus is on resolving conflict
and improving communication within the whole family. Anecdotal evidence to the Inquiry suggests that family
therapy may be a useful intervention for some young people who self-harm. Again, however, there is not an
evidence base at this time to support this.
Harrington et al (1998)78 carried out a randomly controlled case study on adolescents under 17 who had selfpoisoned
and been admitted to four hospitals in Manchester. Unfortunately, no significant differences were
found in those who were allocated a intensive intervention rather than standard aftercare. The authors conclude
that brief forms of intervention are only likely to be effective in subjects without major depression. More intensive
forms of family intervention may be more effective, but this has yet to be rigorously assessed (Harrington et al,

The evidence and testimony submitted to the Inquiry demonstrate a number of good practice and learning
points which the Inquiry thinks all services working in this area should consider adopting. These include:
*Full involvement and consultation with clients/residents to ensure that service delivery is wellgrounded in the views of young people who self-harm
*A clear underpinning approach or philosophy: that is, a working definition of what self-harm meansand of the reasons why young people self-harm, and services based on this thinking
*Clear and consistent service provision goals/objectives – including short term plans and long term goals, and a clear knowledge of what the service can offer
*Comprehensive training for all members of staff specifically on self-harm, with appropriate debriefing/supervision procedures built into day-to-day work and clinical supervision where appropriate
*Outputs and outcomes that are collected and monitored – in other words, an ethos of action research and self-reflection. These data makes it possible to see what works and why, and modify or enhance the service.
*Integration with a very broad range of other services that are relevant to young people and families .

!Harm minimisation
Professionals who have presented to the Inquiry and the young people involved in the Inquiry’s consultation sites
have frequently discussed the issue of tolerating self-harm while young people are engaged in services. For many
young people wanting to stop, or significantly reduce their self-harm, it is a long and slow process, even when
they are using services. Their self-harm has often become an entrenched maladaptive coping mechanism that
requires to be replaced with more positive mechanisms –young people need time to learn and become used to
using these alternative strategies for dealing with difficult life circumstances and emotions.
Professionals who gave evidence to the Inquiry had mixed, but usually strong, feelings around self-harm.
Testimony from nurse specialists working in psychiatric services, evidence from the Prison Service, and from
organisations offering sheltered accommodation highlighted the point that some young people will continue
to use self-harm as a coping mechanism and/or a way of expressing their emotions. These professionals do not
condone self-harm but appreciate that the young people need time and appropriate support to be able to move
towards more positive coping strategies.
Clearly this raises legal issues for services and individual practitioners (see section on legal issues in Chapter 3
and the full legal advice commissioned by the Inquiry on it’s website and issues around
professional codes of practice. Essentially the legal advice commissioned by the Inquiry is that services and
individual practitioners should be able to demonstrate defensible practice. This means that they have acted
on any advice from other professionals who might be involved and that they themselves have undertaken an
appropriate assessment of the risk to the young person so that they can ascertain the least invasive interventions
that will address the identified risks.
‘The most important thing is not to tell people to stop, but to listen to them, find out what they need to stop
and help them find ways of achieving that. This way people heal in their own time. Telling people to stop
makes them more secretive, more dangerous, and more dishonest about it. People need to not feel threatened
by people that are ultimately trying to help them.’
A wide range of testimonies to the Inquiry – especially those from residential or institutional settings - made it
clear that removing the usual means of self-harm (whether physically removing the ‘tools’ or through a contract
between the young person and the professional to abstain from self-harm while they are engaged with the
service) only makes the self-harm worse. People who are determined to self-harm invariably find alternatives,
which will quite possibly be more dangerous and possibly lethal (which is particularly evident from the
experience in prison settings). The issue of ‘duty of care’ is important for the Inquiry. There is likely to be a direct
conflict between the professionals’ legal duty to protect and minimise harm towards the young people they look
after versus the individuals’ perception that they have the right to hurt themselves, as either a form of control or
expression in their lives, and that by removing the normal ‘tools’ they use may intensify their behaviour.
The Prison Service has recently won a case against an individual adult male who wanted the service to provide
him with sterile razor blades. He asserted that he had the right to engage in self-harm as he used self-harm for
a number of years as a means of coping with stress, and argued that if the service prevented him from doing
so it was in effect creating a set of circumstances in which he was more likely to commit suicide. Although this
prisoner’s argument is consistent with a harm minimisation approach, the judgment in this case was that ‘his best
protection from his illness, consistent with the policy of protection which must be given to him, is that he should
not be provided with razor blades and that there should be a measure of supervision to prevent him self-harming
in any other way that he might, by ingenuity, devise….it flies in the face of civilised standards of behaviour’.

1 Hawton, K. & Fagg, J. (1992). Deliberate self-poisoning and self-injury in adolescents: A Study of characteristics and trends in
Oxford, 1976-1989. British Journal of Psychiatry, 161, 816-23.
2 National Institute for Clinical Excellence. (2002). Self-harm scope document. London: NICE.
3 Fox, C. & Hawton, K. (2004). Deliberate Self-harm in Adolescence. London: Jessica Kingsley Publishers.
4 NCH & the Centre for Social Justice, Coventry University. (2002). Look beyond the scars: Understanding and responding to selfharm.
London: NCH.
5 Hawton, K., Fagg J., Simkin, S., Bale, E. & Bond A. (2000). Deliberate self-harm in adolescents in Oxford, 1985-1995. Journal of
Adolescence, 23(1), 47-55.
6 Samaritans & the Centre for Suicide Research, University of Oxford. (2002). Youth and self-harm: Perspectives. London:
7 Meltzer, H., Harrington, R., Goodman, R., & Jenkins, R. (2001). Children and adolescents who try to harm, hurt or kill themselves.
London: Office for National Statistics.
8 Green, H., McGinnity, A., Meltzer, H., Ford, T. & Goodman, R. (2005). Mental Health of Children and Young People in Great Britain
2004. London: Office for National Statistics.
9 The Priory. (2005). Adolescent Angst. London: The Priory Group.
10 Hawton, K., Rodham, K., Evans, E. & Weatherall, R. (2002). Deliberate self-harm in adolescents: Self report survey in schools in
England. British Medical Journal, 325, 1207-1211.
11	Scottish Development Centre for Mental Health & Research Unit in Health, Behaviour and Change, University of Edinburgh.
Written on the Body: A Review of literature on Self-cutting.
12 De Leo, D. & Heller, T. S. (2004). Who are the Kids who Self-Harm? An Australian self-report school survey, Medical Journal of
Australia, 181 (3),140.
13 National Suicide Research Foundation (2004) Young People’s Mental Health. A report of the findings from the Lifestyle and
Coping Survey. Cork, Ireland: National suicide Research Foundation.
14 Information Services of National Services, Scotland (2004)
15 Madge, N. & the CASE Study collaborators. (2004.) Evidence to the National Inquiry into Self harm among young people.
London: National Children’s Bureau.
16 Romans, S.E., Martin, J.L., Anderson, J.C., Herbison, G.P. & Mullen, P.E. (1995). Sexual abuse in childhood and deliberate selfharm.
American Journal of Psychiatry, 152, 1336-1342.
17 Boudewyn, A.C. & Liem, J.H.(1995). Childhood sexual abuse as a precursor to depression and self-destructive behaviour in
adulthood. Journal of Trauma Stress, 8(3), 445-459.
18 Turrell, S.C. & Armsworth, M.W. (2000). Differentiating incest survivors who self-mutilate. Child Abuse & Neglect, 24(2),
19 Smith, G., Cox, D. & Saradjian, J. (1998). Women and self-harm. London: Women’s Press.
20 New, A. Talbot, P. Siever, L. Frankle, W. Lombardo, I. Goodman, M. Huang, Y. Hwang, D, Slifstein, M. Curry, S. Abi-Dargham,
A. Laruelle,M. (2005). Brain Serotonin Transporter Distribution in Subjects with Impulsive Aggressivity. American Journal of
Psychiatry,162 (5), 915-923.
21 Rivers, I. (2000). Social exclusion, absenteeism and sexual minority youth. Support for Learning, 15 (1), 13-18.
22 Warner, J., McKeown, E., Griffin, M., Johnson, K., Ramsay, A., Cort, C. & King, M. (2004). Rates and predictors of mental illness in gay
men, lesbians and bisexual men and women. Results from a survey based in England and Wales. The British Journal of Psychiatry,
185, 479-485.
23 Soni-Raleigh, V. (1996). Suicide patterns and trends in people of Indian subcontinent and Caribbean origin in England and
Wales. Ethnicity and Health, 1, 55-63.
24 Newham Asian Women’s Project and Newham. (1998).Growing Up Young Asian and Female in Britain: A Report on Self-harm
and Suicide. London: Newham Asian Women’s Project & Newham Innercity Multifund.
25 Emerson, E., Hatton, C., Felce, D. & Murphy, G. (2001). Learning disabilities: the fundamental facts. London: Mental Health
26 Emerson, E. (2003). Prevalence of psychiatric disorders in children and adolescents with and without intellectual disability.
Journal of Intellectual Disability, 47 (1), 51-58.
27 The Foundation for People with Learning Disabilities (2002). Count Us In. London: Mental Health Foundation.
28 The Foundation for People with Learning Disabilities (2005). Making Us Count. London: Mental Health Foundation.
29 Wisely, J., Hare, D.J. & Fernandez-Ford, L. (2002). A study of the topography and nature of self-injurious behaviour in people
with learning disabilities. Journal of Learning Disabilities, 6(1), 61-71.
30 Collacott, R.A., Cooper, S.A., Branford, D. & McGrother, C. (1998). Epidemiology of self-injurious behaviour in adults with
learning disabilities. British Journal of Psychiatry, 173, 428-432.
31 Emberson, J. & Walker, E. (1990). Self-injurious behaviour in people with a mental handicap. Nursing Times, 86(23), 43-46.
32 Hyma, P. & Oliver, C. (2001). Causal explanations, concern and optimism regarding self-perspective. J. of Intellectual
Disability Research, 4S(4), 326-331
33 Duperouzel, H. (2004). People with learning disabilities who self-injure: A phenomenological study of their personal perspectives
and perceived support needs whilst living in an NHS forensic service. Calderstones NHS Trust.
34 Mental Health Foundation. (2005). A National Framework for Improving Mental Health and Well-being in England. London:
Mental Health Foundation.
35 Clarke, E. A. & Kiselica, M. S. (1997). A systemic counselling approach to the problem of Bullying. Elementary School Guidance
and Counseling, 31, 310-15.
36 Arora, C.M.J. (1994). Is there any point in trying to reduce bullying in secondary schools? A two year follow-up of a wholeschool
anti-bullying policy in one school. Educational Psychology in Practice, 10, 155-162.
37 Olweus, D. (1991). Bully/victim problems among school children: Basic facts and effects of a school based intervention
program. In: Pepler, D. J. & Rubin, K. H. (Eds) The development and treatment of childhood aggression. Hillsdale, NJ: Erlbaum,
pp. 411- 48.
38 Olweus, D. (1993). Bullying at school: What we know and what we can do. Oxford: Blackwell.
39 Olweus, D. (1994). Bullying at school: Long-term outcomes for the victims and an effective school based intervention
program’. In: Huesmann, L. R. (Ed.) Aggressive behavior: Current perspectives. New York: Wiley, pp. 97-130.
40 ChildLine. (2005). Every School Should Have One. London: ChildLine.
41 Cowie, H. & Wallace, P. (2000). Peer Support in Action: From Bystanding to Standing By. London: Sage Publications.
42 Weare, K. & Gray, G. (2003). What Works in Developing Children’s Emotional and Social Competence and Well-being?
University of Southampton for DfES.
43 Mental Health Foundation. (2002). Peer Support: Someone to Turn To. London: Mental Health Foundation.
44 Fortune, S., Sinclair, J. & Hawton, K. (2005). Adolescents Views on Prevention of Self-harm, Barriers to Help-Seeking for Self-harm
& How Quality of Life Might be Improved: A Qualitative & Quantitative Study. Oxford: Centre for Suicide Research, University of
45 Ofsted. (2005). Healthy Minds: Promoting Emotional Health and Well-being in Schools. London: The Stationary Office.
46 Mental Health Foundation. (2006). Feeding Minds - the impact of food on mental health. London: Mental Health Foundation.
47 Richardson, A.J., Cyhlarova, E. & Ross, M.A.(2003). Omega-3 and omega-6 fatty acid concentrations in red blood cell
membranes relate to schizotypal traits in healthy adults. Prostaglandins Leukot Essent Fatty Acids, 69(6), 461 – 6.
48 Hibbeln, J.R. (1998). Fish consumption and major depression. Lancet, 351(9110,) 1213.
49 Servan-Schreiber, D. (2004). Healing Without Freud and Prozac. London: Rodale.
50 Mental Health Foundation. (2005). Up and Running! London: Mental Health Foundation.
51 National Institute for Clinical Excellence. (2005). Depression in children and young people: Identification and management in
primary, community and secondary care. London: National Institute for Clinical Excellence.
52 Fortune, S., Sinclair, J. & Hawton, K. (2005). Adolescents Views on Prevention of Self-harm, Barriers to Help-Seeking for Self-harm
& How Quality of Life Might be Improved: A Qualitative & Quantitative Study. Oxford: Centre for Suicide Research, University of
53 Best, R. (2005). Self-harm: a challenge for pastoral care. Pastoral Care in Education, 23(3), 3-11.
54 National Institute for Clinical Excellence. (2004). Self-harm: The short-term physical and psychological management and
secondary prevention of self-harm in primary and secondary care. London: National Institute for Clinical Excellence.
55 Department of Health. (2005). You’re welcome, london. The Stationary Office.
56 Penumbra. (2001). No Harm in Listening. Edinburgh: Penumbra.
57 LifeSigns. (2005). Self Injury Awareness Booklet. LifeSigns.
58 Young, J. & Williams, C.L. (1987). An evaluation of GROW, a mutual-help community mental health organisation. Community
Health Studies, 11, 38-42.
59 Self-Help Network. (2002). Are self-help groups effective.
60 Hyde, P. (2001). Support groups for people who have experienced psychosis. British Journal of Occupational Therapy, 64(4),
61 Adamsen, L. & Rasmussen, J.M. (2001). Sociological perspectives on self-help groups: reflections on conceptualisation and
social processes. Journal of Advanced Nursing, 35(6), 909-917.
62 Kurtz, L.F. (1997). Support Groups: A Handbook for Practitioners. Sage Publications: London.
63 Smith, A. & Clarke, J. (2003). Self-harm Self Help / Support Groups. Mental Health Foundation: London.
64 Clarke, J. (2003). Women’s Experiences of Attending a Self-harm Self-help Group. Unpublished work.
65 Allen, C. (1995). Helping with deliberate self-harm: Some practical guidelines. Journal of Mental Health, 4(3), 243-250.
66 Crisis Recovery Unit (2003). Working with the Wolli. Our approach to Working with kids, who self-harm, based on our
experience. London. Crisis Recovery Unit
67 van der Sande, R., Buskens, E., Allart, E., van der Graaf, Y. & van England, H. (1997). Psychosocial interventions following
suicide attempt: A systematic review of treatment interventions. Acta Psychiatrica Scandinavica, 96, 43-50.
68 Hawton, K., Arensman, E., Townsend, E., Bremner, S., Feldman, E., Goldney, R., Gunnell, D., Hazell, P. & van Heeringen, K.
(1998). Deliberate self-harm: Systematic review of efficacy of psychosocial and pharmacological treatments in preventing
repetition. British Medical Journal, 317, 441-7.
69 NHS Centre for Reviews and Dissemination. (1998). Deliberate self-harm. Effective Health Care, 4, December.
70 Derouin, A. & Bravender, T. (2004). Living on the edge: The current phenomenon of self-mutilation in adolescents. The
American Journal of Maternal & Child Nursing, 29(1), 12-18.
71 Morgan, H., Jones, E. & Owen, J. (1993). Secondary prevention of non-fatal deliberate self-harm. The green card study. British
Journal of Psychiatry, 163, 11-112.
72 Evans, J., Evans, M., Morgan, H.G., Hayward, A. & Gunnell, D. (2005). Crisis card following self-harm: 12-month follow-up of a
randomised controlled trial. British Journal of Psychiatry, 187, 186-187.
73 D’Zurilla, T. J. (1986). Problem-solving therapy: A social competence approach to clinical intervention. New York: Springer.
74 Salkovskis, P.M., Atha, C. & Storer, D. (1990). Cognitive-behavioural problem solving in the treatment of patients who
repeatedly attempt suicide: a controlled trial. British Journal of Psychiatry, 157, 871-876.
75 Townsend, E., Hawton, K., Altman, D.G., Arensman, E., Gunnell, D., Hazell, P., House, A. & van Heeringen, K. (2001). The
efficacy of problem-solving treatments after deliberate self-harm: meta-analysis of randomized controlled trials with
respect to depression, hopelessness and improvement in problems. Psychological Medicine, 31, 979-988.
76 House, A., Owens, D. & Storer, D. (1992). Psycho-social intervention following attempted suicide: is there a case for better
services? International Review of Psychiatry, 4, 15-22.
77 Linehan, M. M. (1993). Cognitive-behavioral treatment of borderline personality disorder. New York: Guilford.
78 Harrington, R., Kerfoot, M., Dyer, E., McNiven, F., Gill, J., Harrington, V., Woodham, A., & Byford, S. (1998). Randomised trial of a
home-based family intervention for children who have deliberately poisoned themselves. Journal of the American Academy
of Child & Adolescent Psychiatry, 37, 512-18.
79 Harrington, R., Kerfoot, M., Dyer, E., McNiven, F., Gill, J., Harrington, V. & Woodham, A. (2000). Deliberate self-poisoning in
adolescence: Why does a brief family intervention work in some cases and not others? Journal of Adolescence, 23, 13-20.
80 Sinclair, J. & Green, J. (2005). Understanding resolution of deliberate self harm: qualitative interview study of patients’
experiences. British Medical Journal, (330), 112-115.
!Self-Mutilation and Homeless Youth: The Role of Family Abuse, Street Experiences, and Mental Disorders
Kimberly A. Tyler, Les B. Whitbeck, Dan R. Hoyt, and Kurt D. Johnson
>//"Self-mutilation, which is the act of deliberately harming oneself, has been
overlooked in studies of homeless and runaway youth. Given their high
rates of abuse and mental health disorders, which are associated with selfmutilation,
homeless and runaway youth provide an ideal sample in which
to investigate factors associated with self-mutilation among a nonclinical
population. Based on ''interviews with 428 homeless and runaway youth
aged 16 to 19 years in 4 Midwestern states'', the current study revealed
''widespread prevalence'' of self-mutilation among these young people.
''Multivariate analyses indicated that __sexual abuse__, ever __having stayed on
the street__, deviant __subsistence strategies__, and __meeting diagnostic criteria for
depression__ were positively associated with self-mutilation.'' The findings are
interpreted using stress theory and affect-regulation models."//
<div class='toolbar'
	macro='toolbar [[ToolbarCommands::ViewToolbar]] icons:yes height:16 width:16 more:popup'>
<div class='heading'>
	<span class='spaceSiteIcon'
		macro='tiddlerOrigin label:no spaceLink:yes height:48 width:48 preserveAspectRatio:yes'>
	<span class="titleBar">
		<div class='title' macro='view title text'></div>
		<span class="subtitle" macro='viewRevisions page:5'>
			last modified on
			<span macro="view modified date"></span>
		<div macro="view title replyLink"></div>
	<span class='followPlaceHolder' macro='followTiddlers'></span>
	<span class='modifierIcon'
		macro='view modifier SiteIcon label:no spaceLink:yes height:48 width:48 preserveAspectRatio:yes'>
	<div class='tagClear'></div>
<div class='content'>
	<div class='viewer' macro='view text wikified'></div>
<div class='tagInfo'>
	<div class='tidTags' macro='tags'></div>
	<div class='tagging' macro='tagging'></div>
Health Evidence Network. For which strategies of suicide prevention is there evidence of
effectiveness? Copenhagen, WHO Regional Office for Europe, 2004 (http://www.euro.who.
int/eprise/main/WHO/Progs/HEN/Syntheses/suicideprev/20040712_2, accessed 25 May

See "HEN_WHO on Suicide and SIB prevention, 04.pdf"
Wilkinson, P. and I. Goodyer, Non-suicidal self-injury. Eur Child Adolesc Psychiatry, 2011. 20(2): p. 103-8. 

Self-injury is a relatively common phenomenon
in adolescence. Often there is no suicidal intent; rather, the
action is used for one or more reasons that relate to
reducing distressing affect, inflicting self-punishment and/
or signalling personal distress to important others. Nonsuicidal
self-injury (NSSI) is both deliberate and contains
no desire to die and therefore aetiology is likely to be at
least partly different to suicidal behaviour per se. Interestingly,
NSSI is associated with subsequent suicide
attempts suggesting that these behaviours and their related
psychology may lie on the same risk trajectory. NSSI
neither appears in DSM-IV or ICD 10 as a disorder nor
does it constitute a component of any current anxious or
depressive syndrome. This lack of nosological recognition
coupled with clear psychopathological importance is to be
recognised in the 5th edition of the Diagnostic and Statistical
Manual of Mental Disorders (DSM-5), with NSSI
being classified as a syndrome in its own right. We agree
that this is appropriate and is likely to have several positive
consequences including: (1) improving communication
between professionals and patients; (2) informing treatment
and management decisions; (3) increasing research
into the nature, course and outcome of NSSI. We agree
with the proposed DSM-5 diagnostic criteria, although
believe the impairment criterion would be better phrased if
it stated that self-injury is associated with, rather than
causal for, intense distress.
Wilkinson, P, Kelvin, R, Roberts, C, Dubicka, B, Goodyer, I.  (2011) ''Clinical and Psychosocial Predictors of Suicide Attempts and Nonsuicidal Self-Injury in the Adolescent Depression Antidepressants and Psychotherapy Trial (ADAPT).''  Am J Psychiatry 2011; 168:495–501

The authors assessed whether clinical and psychosocial factors in depressed
adolescents at baseline predict suicide attempts and nonsuicidal selfinjury over 28 weeks of follow-up. 
Participants were 164 adolescents with major depressive disorder taking
part in the Adolescent Depression Antidepressants and Psychotherapy Trial (ADAPT).
Clinical symptoms, family function, quality of current personal friendships, and suicidal
and nonsuicidal self-harm were assessed at baseline. Suicidal and nonsuicidal
self-harm thoughts and behaviors were assessed during 28 weeks of follow-up.
High suicidality, nonsuicidal selfinjury, and poor family function at entry
were significant independent predictors of suicide attempts over the 28 weeks of
follow-up. Nonsuicidal self-injury over the follow-up period was independently predicted
by nonsuicidal self-injury, hopelessness, anxiety disorder, and being younger
and female at entry.
Both suicidal and nonsuicidal self-harm persisted in depressed adolescents
receiving treatment in the ADAPT study. A history of nonsuicidal self-injury
prior to treatment is a clinical marker for subsequent suicide attempts and should
be as carefully assessed in depressed youths as current suicidal intent and behavior.
Williams, J. and Pollock, L. (2000) ‘The psychology of suicidal behaviour’, in K. Hawton and K. van Heeringen (eds) The International Handbook of Suicide and Attempted Suicide, Chichester: John Wiley and Sons.
Wood A, Trainor G, Rothwell J, Moore A, Harrington R.
Randomized trial of group therapy for repeated deliberate self-harm in adolescents.
Journal of the American Academy of Child Adolescent Psychiatry
2001; 40:1246–1253.

!Findings NOT replicated in:
 [[Hazell et al 2009]]
!Reviewed in ]
[[Burns, 05]]:
Overdose patients referred to mental
health teams, UK with a history of at
least one previous incident self-harm
I = 32, C = 31 Age 12–16 years
''Group therapy'' using combination of
''problem solving'', ''cognitive-behaviour
therapy'' and ''dialectical behaviour therapy''
self harm, 2/32 v 10/31 (RR = 0.20,
95% CI 0.05–0.84);
Missed appointments not reported;
Suicidal ideation change from baseline
mean score 47.3 (SD = 50.5) v 39.7
(SD = 46.7), p = NS
!!!Follow up:
7 months
Randomized Trial of Group Therapy for Repeated
Deliberate Self-Harm in Adolescents
Objective: To compare group therapy with routine care in adolescents who had deliberately harmed themselves on at
least two occasions within a year. Method: Single-blind pilot study with two randomized parallel groups that took place in
Manchester, England. Sixty-three adolescents aged 12 through 16 years were randomly assigned to group therapy and
routine care or routine care alone. Outcome data on suicide attempts were obtained without knowledge of treatment allocation
on all randomized cases (62/63 by direct interview) on average 29 weeks later.The primary outcomes were depression
and suicidal behavior. Results: In intention-to-treat analyses, adolescents who had group therapy were less likely to
be “repeaters” at the end of the study (i.e., to have repeated deliberate self-harm on two or more further occasions) than
adolescents who had routine care (2/32 versus 10/31; odds ratio 6.3), but the confidence intervals for this ratio were wide
(95% confidence interval 1.4 to 28.7). They were also less likely to use routine care, had better school attendance, and
had a lower rate of behavioral disorder than adolescents given routine care alone. The interventions did not differ, however,
in their effects on depression or global outcome. Conclusions: Group therapy shows promise as a treatment for
adolescents who repeatedly harm themselves, but larger studies are required to assess more accurately the efficacy of
this intervention. J. Am. Acad. Child Adolesc. Psychiatry, 2001, 40(11):1246–1253. Key Words: therapy, attempted suicide,
repetition, sexual abuse, major depression.
Wyman PA,  Brown CH, Inman J,  Cross W,  Schmeelk-Cone K,  Guo J,  Pena JB (2008)
!Randomized Trial of a Gatekeeper Program for Suicide Prevention: 1-Year Impact on Secondary School Staff
Journal of Consulting and Clinical Psychology, 2008, Vol. 76, No. 1, 104–115
Gatekeeper-training programs, designed to increase identification and referral of suicidal individuals, are
widespread but largely untested. A group-based randomized trial with 32 schools examined impact of
Question, Persuade, Refer (QPR) training on a stratified random sample of 249 staff with 1-year average
follow-up. To test QPR impact, the authors introduced and contrasted 2 models of gatekeeper-training
effects in a population: gatekeeper surveillance and gatekeeper communication. Intent-to-treat analyses
showed that training increased self-reported knowledge (effect size [ES] = 0.41), appraisals of efficacy
(ES = 1.22), and service access (ES = 1.07). Training effects varied dramatically. Appraisals increased
most for staff with lowest baseline appraisals, and suicide identification behaviors increased most for
staff already communicating with students about suicide and distress. @@Consistent with the communication
model, increased knowledge and appraisals were not sufficient to increase suicide identification behaviors.
Also consistent with the communication model were results from 2,059 8th and 10th graders
surveyed showing that fewer students with prior suicide attempts endorsed talking to adults about
distress.@@ Skill training for staff serving as “natural gatekeepers” plus interventions that modify students’
help-seeking behaviors are recommended to supplement universal gatekeeper training.
!QPR Training
The 1(1/2)-hr training covers the following: rates of youth
suicide; warning signs and risk factors for suicide; and procedures
for asking a student about suicide, persuading a student to get help,
and referring a student for help. Consistent with QPR recommendations,
the training reviewed local rates of student suicidal behavior
and the district protocol for responding to suicidal students
!A prospective study of child maltreatment and self-injurious behavior in a community sample
Development and Psychopathology 20 (2008), 651–672
In conjunction with prospective ratings of child maltreatment (i.e., sexual abuse, physical abuse, and physical neglect)
and measures of dissociation and somatization, this study examined prospective pathways between child maltreatment
and nonsuicidal, direct self-injurious behavior (SIB; e.g., cutting, burning, self-hitting). 
Ongoing participants in the ''Minnesota Longitudinal Study of Parents and Children'' (N = 164; 83 males, 81 females) completed a semistructured interview about SIB when they were 26 years old. SIB emerged as a heterogeneous and prominent phenomenon in this low-income, mixed-gender, community sample. 
''Child sexual abuse predicted recurrent injuring'' (i.e., three or more events; n = 13), whereas, ''child physical abuse appeared more salient for intermittent injuring'' (i.e., one to two events; n = 13). @@See [[Yates, 2004]] and [[Simeon & Favazza, 2001]] for detail on the subtyping of SIB.  BUT ALSO SEE [[Klonsky, 08]] for a counter-view to the Sexual abuse-causes-SIB argument@@ ...Moreover, these relations appeared largely independent of risk factors that have been associated with child maltreatment and/or SIB, including child cognitive ability, socioeconomic status, maternal life stress, familial disruption, and childhood exposure to partner violence. Dissociation and somatization were related to SIB and, to a lesser degree, child maltreatment. However, only dissociation emerged as a significant mediator of the observed relation between child sexual abuse and recurrent SIB. The findings are discussed within a developmental psychopathology framework in which SIB is viewed as a compensatory regulatory strategy in posttraumatic adaptation.

>//''"Yates (2004) has estimated that 10–15% of the general population has a lifetime history of SIB, with 5–10% of individuals engaging in repeated episodes"''//
>//''"This study provides compelling evidence for the etiological contribution of child maltreatment to SIB."''//
''The developmental psychopathology of self-injurious behavior: Compensatory regulation in posttraumatic adaptation.''
Tuppett M. Yates
Clinical Psychology Review 24 (2004) 35–74

>//"pressing need for a unifying theoretical framework to organize the extant data on SIB and to guide future research"//

Developmental Psychopathology and organization theory of development (Sroufe, 1990b; Sroufe & Rutter, 1984)) can help to oexplain the link btwn childhod trauma and SIB.

>//"Although self-injury manifests itself across an array of populations and a broad continuum of behaviors, the relation between childhood trauma and self-injury is particularly robust (Low, Jones, MacLeod, Power, & Duggan, 2000; van der Kolk, Perry, & Herman, 1991; Wiederman, Sansone, & Sansone, 1999)."//

!Difference btwn SIB and piercing/tattooing/etc
>//"The major difference between
ritualized or group body modifications and pathological self-injury is the sociocultural and intraspsychic
context: ‘‘one is a shared act of pride [or defiance]; the other a secretive act steeped in
shame’’ (Gasperoni, 1998, p. 78)."//
The most recent edition of this (the best accepted) taxonomy proposes four categories of self-injury: 
(1) stereotypic, (2) major, (3) compulsive, and (4)impulsive [[Simeon & Favazza, 2001]]. 
!!!Stereotypic SIB 
is characteristic of persons with pervasive developmental disorders and disabilities (e.g., autism, Rhett’s syndrome, Lesch–Nyhan syndrome, mental retardation, Cornelia de Lange syndrome). It is typically performed independently of the
social context (e.g., in the presence of onlookers), is devoid of affective content (e.g., feeling,
meaning, thought), and has a repetitive, rhythmic, driven quality. 
!!!Major SIB 
includes dramatic and striking examples of mutilation (e.g., autocastration, self-enucleation) that result in permanent and
severe tissue damage. Major self-injury usually occurs as an isolated event during a psychotic
!!!Compulsive SIB 
subsumes repetitive or ritualistic behaviors that occur many times daily (e.g., hair pulling, nail biting, scratching). It is usually categorized as an impulse control disorder in contemporary psychiatric nosology (e.g., trichotillomania). 
!!!Impulsive SIB
may be ''episodic'' or ''repetitive''. Episodic SIB involves intermittent self-injurious events (e.g., cutting, burning, self-hitting) that typically precipitate tension release and mood elevation. Over time, impulsive episodic SIB may
become repetitive, taking on an addiction-like quality for the individual as s/he becomes increasingly preoccupied with SIB.

!Incidence and prevalence
Quotes her own paper (this one) in [[Yates, 08]]: "Yates (2004) has estimated that 10–15% of the general population has a lifetime history of SIB, with 5–10% of individuals engaging in repeated episodes"

>//"This article focuses on the developmental psychopathology of impulsive SIB, in both episodic and repetitive forms, because it typifies SIB that occurs independently of pervasive developmental disorders or disabilities. However, it is likely that these developmental processes are involved in other kinds of SIB, and self-destructive behaviors in general (e.g., eating disorders, sexual risk taking, substance abuse), to varying degrees."//
!Blurring of definition btwn SIB and SUICIDE:
>//"Many conceptualizations of pathological SIB have blurred the distinction between self-injury,
suicide, and attempted suicide:
#''Menninger (1938), for example, described self-injury as a ‘‘focal suicide’’ in which suicidal impulses are displaced onto a part of the body that represents the whole person.'' 
#''In 1977, Kreitman'' introduced the term ''parasuicide'', which forged a strong and enduring association between these two classes of behavior. Interpretations of SIB as a derivation of suicide remain prominent, but they are being gradually supplanted by 
#a recognition that ''SIB may reflect a psychic compromise that prevents or delays suicide, hence the term "antisuicide"'' (Ross & McKay, 1979; Simpson, 1975, 1980). 
Although many researchers still confound self-injury with suicidal behavior (e.g., Barnes, 1985; Campbell & Hale, 1991; Green, 1978; Haw, Hawton, Houston, & Townsend, 2001), ''contemporary research has distinguished SIB from suicidal behavior along several dimensions'', including:
#mode of injury and its 
#chronicity, and 
#age of onset (Brown, Comtois, & Linehan, 2002; Gardner & Cowdry, 1985; Motz, 2001; Pattison & Kahan, 1983; Sabo, Gunderson, Najavits, Chauncey, & Kisiel, 1995; Stone, 1987).

!Links btwn SIB an suicide:
>//Persons who self-injure are significantly more likely to suicide (Walsh & Rosen, 1988), and suicidal ideation has been found in 28–41% of self-injury cases (Gardner & Cowdry, 1985; Jones, Congin, Stevenson, Straus, & Frei, 1979; Pattison & Kahan, 1983). //
HOWEVER:... upward of 85% of self-injurious events are undertaken with the primary goal of releasing tension, rather than of ending life (Gardner & Gardner, 1975; Jones et al., 1979)."//

!Yates definition:
In sum, contemporary definitions of pathological SIB include the specification that the destruction
or alteration of body tissue occurs in the absence of conscious suicidal intent (Favazza, 1998; Motz,
2001; Walsh & Rosen, 1988). 

!comorbidity and SIB
Wide comorbidity - do we need a separate classificatio of SIB (as per Favazza ([[Simeon & Favazza, 2001]]) - or is it a non-specfic marker of distress?  common associations:
!!!Adolescents - 
N.B. though: 
>//"recent findings indicate that observed relations between SIB and BPD are probably exaggerated because SIB is a key criterion for the diagnosis of BPD (see Favazza, 1998, for a discussion)"//
Tends to be major SIB
Favazza, A. R., DeRosear, L., & Conterio, K. (1989). Self-mutilation and eating disorders. Suicide and Life Threatening
Behavior, 19(4), 352–362.
!!!PTSD - Dissociation
People who dissociate are more likley to SIB - Briere, J., & Gil, E. (1998). Self-mutilation in clinical and general population samples: Prevalence, correlates, and functions.
American Journal of Orthopsychiatry, 68(4), 609–620, Low, G., Jones, D., MacLeod, A., Power, M., & Duggan, C. (2000). Childhood trauma, dissociation and self-harming behaviour: A pilot study. British Journal of Medical Psychology, 73, 269–278.
!Arguments for a new DIAGNOSTIC ENTITY
Main proponenet is Favazza:
As detailed previously,
Favazza (Favazza, A. R. (1999). Self mutilation. In D. G. Jacobs (Ed.), The Harvard Medical School guide to suicide assessment and intervention ( pp. 125–145). San Francisco: Jossey-Bass.) argues that:
>//"at some point in the progression of this putative disorder, episodic impulsive SIB transforms into a repetitive syndrome, which is characterized by the individual’s inability to control the frequency, and often the severity, of nonsuicidal, self-injurious actions. Although research has provided some support for Favazza’s assertion (see Tantam & Whittaker, 1993), the alternative interpretation of SIB as a nonspecific symptom of psychological distress remains
to be evaluated empirically. Currently, SIB is rarely considered a distinct diagnostic entity. When SIB
is specified diagnostically, it is usually subsumed under the global category of ‘‘disorders of impulse
control, not otherwise specified’’ (APA, 2000)."//
Favazza, A. R. (1998). The coming of age of self-mutilation. Journal of Nervous and Mental Disease, 186(5), 259–268.
!Multiple models:
!!Behavioural models
Dominate the research on neurodvelopental delays
>//"The most popular behavioral
hypothesis combines these two perspectives. In this view, SIB emerges out of modeling and
vicarious learning experiences, but is maintained by reinforcement contingencies"//
!!Psychoanalytic models
Fonagy et al - what is in the mind of the parents who abuse?
!!Biological models
Mostly studied in retitive SIB in neurodevelopmental disorders, rather than episodic SIB in PD.  
Evidence complex - Simeon, D., Stanley, B., Frances, A., Mann, J. J., Winchel, R., & Stanley, M. (1992). Self-mutilation in personality disorders: Psychological and biological correlates. American Journal of Psychiatry, 149(2), 221–226. and Tiefenbacher, S., Novak, M. A., Jorgensen, M. J., & Meyer, J. S. (2000). Physiological correlates of self-injurious behavior in captive, socially-reared rhesus monkeys. Psychoneuroendocrinology, 25, 799–817.
!!!EOS - endogenous opioid system
>//"The addiction hypothesis posits that the EOS is
repetitively stimulated through recurrent, impulsive SIB producing a positively reinforcing elevation
in mood. Over time, the individual becomes increasingly tolerant to the mood-elevating influence
of SIB-induced opioid release, and it becomes necessary to engage in more frequent and/or more
severe SIB to achieve the desired mood-altering outcome. The pain hypothesis posits that
individuals who engage in SIB have an altered EOS, either congenitally or because of
experience-based neurochemical alterations in early development, that mediates reduced pain
sensitivity (see van der Kolk, 1989, for further discussion)."//
!Developmental Organizational model for SIB
BAsed on Sroufe, L. A., Egeland, B., & Carlson, E. (1999). One social world: The integrated development of parent–child and peer relationships. In W. A. Collins, & B. Laursen (Eds.), Relationships as developmental context: The 30th Minnesota symposium on child psychology ( pp. 241–262). Hillsdale, NJ: Erlbaum. Proposes FIVVE LEVELS OF COMPETENCY REQUIRED TO NEGOTIATE DEVELOPMENTAL STAGES:
>//"First, at the ''motivational level'', the competent child holds positive expectations about relationships
with others that motivate her/him to seek out interpersonal connections in the future. The child feels that
s/he can rely on others, and derives pleasure from companionship and connectedness with social
partners. Second, ''attitudinal competence'' forms the foundation of self-esteem and self-worth. The
competent child views her/himself as worthy of, and effective in eliciting, the care and responsiveness of
important others. Third, at the ''instrumental level'', positive adaptation is predicated on specific skills that
enable the successful negotiation of salient developmental issues. The instrumentally competent child
can elicit and engage the support necessary for successful adaptation. Fourth, the competent child
possesses a strong ''emotional base'' that enables flexible and effective arousal modulation, impulse
control, and adaptation to the demands of the environment. Finally, at the ''relational level'' of competence,
the child possesses capacities to apprehend the rules of social reciprocity, and establish and maintain
genuine empathic connections with others. In addition to other resources, self–other boundaries strongly
influence the child’s relational competence because the formation of reciprocal and empathic relationships
requires a clear understanding of where the self ends and another begins."//
!YATES develops this multi-model perspective WITHIN A TRAUMA PARADIGM
What does Trauma do to these various levels of competency?  SIB as a compensatory strategy in post-traumatic adaptation.

<!DOCTYPE html>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<link href="/bags/common/tiddlers/profile.css" type='text/css' rel='stylesheet' >
	<link href="/bags/common/tiddlers/admin.css" type='text/css' rel='stylesheet' >
	<link href="/bags/common/tiddlers/jquery-ui.custom.css" type='text/css' rel='stylesheet' >

<div id="container">
	<div class="main section">
		<a class="app" href="/">home</a>
		<div class="left">
		<div id="siteiconArea">
		<h2>User Icon</h2>
			<img id="siteicon" class="siteicon">
			<form id="upload" method="POST" enctype="multipart/form-data">
				<input type="hidden" name="title" value="SiteIcon" />
				<input type="hidden" name="tags" value="excludeLists">
				<input type="hidden" name="csrf_token" class="csrf" />
				<input type="file" name="file" accept="image/*" />
				<input type="submit" value="upload" />
			<div id="dropzone">Drop file here
				<img class="notloading" src="/bags/common/tiddlers/ajax-loader.gif" alt="submitting SiteIcon" />
		<h2>Find Space</h2>
		<form class="spaceSearch">
			<input class="inputBox" type="text" placeholder="find space" />
			<a href="" class="help"
				title="What is a space?">What is a space?</a>
			<button>view all</button>
		<div class='list-container'>
			You are a member of the following spaces:
			<ul class='ts-space-search'>
		<h2>Create New Space</h2>
		<form class="ts-spaces">
			<input class="inputBox" type="text" name="spacename" placeholder="space name"><span class="hostSuffix"></span>
			<input type="submit" value="Create Space" />
		<div class="right">
		<h2>Change Password</h2>
		<form class="ts-password">
			<input class="inputBox" placeholder="existing password" type="password" name="password">
			<input class="inputBox" placeholder="new password" type="password" name="new_password">
			<input class="inputBox" placeholder="new password"	type="password" name="new_password_confirm">
			<input type="submit" value="Change password">
		<h3>Why OpenID?</h3>
		<a href=""><img src="/bags/common/tiddlers/openid.png" alt="openid" ></a><br />
		Use just one username and password across hundreds of OpenID-enabled sites.<br />
		It's an open standard.<br />
		<a href="">learn more</a>
		<ul class="ts-identities"></ul>
		<form class="ts-openid" target="_top">
				Add an openid:
			<input class="inputBox" type="text" name="openid" placeholder="your openid" />
			<input type="submit" value="Register" />
			<a href="" class="help"
			title="What is an open id?">What is an open id?</a>
		<div class="clear"></div>
<script src="/bags/common/tiddlers/backstage.js"></script>
<script src='/bags/common/tiddlers/jquery.js'></script>
<script src='/bags/tiddlyspace/tiddlers/chrjs'></script>
<script src='/bags/common/tiddlers/'></script>
<script src='/bags/common/tiddlers/chrjs.users'></script>
<script src='/bags/common/tiddlers/chrjs.identities'></script>
<script src="/bags/common/tiddlers/jquery-ui.custom.js"></script>
<script src='/bags/common/tiddlers/jquery-form.js'></script>
<script src="/bags/common/tiddlers/siteiconupload.js"></script>
<script src='/bags/common/tiddlers/ts.js'></script>
<script src="/status.js"></script>
<script type="text/javascript">
 * jQuery UI Autocomplete HTML Extension
 * Copyright 2010, Scott González (
 * Dual licensed under the MIT or GPL Version 2 licenses.
(function( $ ) {

var proto = $.ui.autocomplete.prototype,
	initSource = proto._initSource;

function filter( array, term ) {
	var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
	return $.grep( array, function(value) {
		return matcher.test( $( "<div>" ).html( value.label || value.value || value ).text() );

$.extend( proto, {
	_initSource: function() {
		if ( this.options.html && $.isArray(this.options.source) ) {
			this.source = function( request, response ) {
				response( filter( this.options.source, request.term ) );
		} else { this );

	_renderItem: function( ul, item) {
		return $( "<li></li>" )
			.data( "item.autocomplete", item )
			.append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label ) )
			.appendTo( ul );

})( jQuery );

_accounts application specific javascript
var link;
ts.init(function(ts) {
	if(ts.user.anon) { // redirect to homepage when user not logged in
		window.location = ts.getHost();
	} else if( === ts.currentSpace){
	} else {
		link = $("<a />").attr("href", ts.getHost( + "/_account").text("Change User Icon");
		$("#siteiconArea div").empty().append(link);
	$(".hostSuffix").text("." + ts.getHost("").split("//")[1]);
	ts.getSpaces(function(spaces) {
		$("<div class='info' />").text("You have " + spaces.length + " spaces.").insertBefore($(".spaceSearch")[0]);
		$("form.spaceSearch input").autocomplete({
			html: true,
			source: function(req, response) {
				ts.getSpaces(function(spaces) {
					var selected = [];
					for(var i = 0; i < spaces.length; i++) {
						var space = spaces[i];
						if( > -1) {
							var host = ts.getHost( ;
							var img = host + "/SiteIcon";
								label: '<a href="' + host + '" target="_parent" class="autocompleteLink"><img src="' + img + '" style="height:24px;width:auto;max-height:24px;max-width:24px;"/>' + + '</a>'
			select: function(event, ui) { = ts.getHost(ui.item.value);

		var $ul = $('.ts-space-search');
		$.each(spaces, function(i, space) {
			$ul.append($('<li/>').html($('<a/>').attr('href', space.uri)

		$('form.spaceSearch button').click(function(ev) {
			return false;

if(window != {
	$("a").live("click",function(ev) {
		$("target", "_parent");
<!--[if lt IE 8]>
<script type="text/javascript" src="/bags/common/tiddlers/json2.js"></script>
<!DOCTYPE html>
<html lang="en">
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<link rel="stylesheet" href="//">
		body {
			overflow: hidden;
			background-color: transparent;

		#container {
			/* prevent a fouc if no images present */
			display: none;

		.modal-header {
			border-bottom: none;
			padding: 5px 0 0;
			position: absolute;
			width: 100%;
			background-color: #e0e0e0;
			-webkit-border-radius: 6px 6px 0 0;
			-moz-border-radius: 6px 6px 0 0;
			border-radius: 6px 6px 0 0;
			cursor: move;

		.form-actions {
			position: absolute;
			bottom: 0;
			box-sizing: border-box;
			-moz-box-sizing: border-box;
			width: 100%;
			margin: 0;
			border-radius: 0 0 6px 6px;
			background-color: #e0e0e0;
			border-top: 1px solid gray;

		.form-actions input.btn {
			width: auto;
			float: right;
			margin: 0 0.2em;

		.closeBtn {
			background-color: #DCE7F1 !important;

		.primary {
			background-color: #09F !important;

		h1 {
			margin-bottom: 9px;
			margin-top: 9px;

		body {
			width: 100%;
			height: 100%;
			position: absolute;

		.modal {
			margin: 10px;
			top: 0;
			left: 0;
			bottom: 0;
			width: 510px;
			position: absolute;
			box-shadow: #444 0px 0px 10px 2px;
			border-radius: 6px;
			background-color: white;
			border: 1px solid gray;
			background-color: #F0F4F8;

		label em {
			cursor: pointer;

		.modal-body {
			overflow: auto;
			position: absolute;
			top: 0;
			bottom: 0;
			left: 0;
			right: 0;
			margin: 65px 20px 67px;
			background-color: transparent;

		.nav-tabs {
			padding-left: 1%;
			margin: 0;
			width: 99%;
			border-color: gray;

		.nav-tabs > li {
			cursor: pointer;

		.nav-tabs > li > a {
			line-height: 2.4em;
			font-weight: bold;
			font-size: 100%;

		.nav-tabs > > a{
			background-color: #F0F4F8;
			border-color: gray;
			border-bottom-color: #F0F4F8;

		.active {
			display: block;

		.uneditable-input {
			color: #606060;

		.imagePicker {
			-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
			-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
			box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
			border: 1px solid #CCC;
			height: 110px;
			overflow: auto;
			-webkit-border-radius: 3px;
			-moz-border-radius: 3px;
			border-radius: 3px;
			margin-left: 0;

		.imagePicker img {
			margin: 5px;
			border: 2px solid transparent;

		.imagePicker .current {
			border: 2px dotted #555;

		label {
			font-weight: bold;

		.form-actions label {
			float: left;
			margin-top: 0.75em;

		fieldset input,
		fieldset textarea {
			width: 90%;
			border-color: gray;

		@media all and (max-width: 550px) {
			.modal {
				width: 95%;

		#help {
			position: absolute;
			border: 0;
			right: 4px;
			top: 5px;
			text-indent: -9999px;
			color: transparent;
			height: 16px;
			width: 16px;
			background: none;
			background-image: url(/bags/common/tiddlers/help.png);
			background-repeat: no-repeat;
			background-color: white;
			z-index: 2;
			border-radius: 10px;

		#help-info {
			padding: 0;
			border: 1px solid gray;
			width: 60%;
			height: 50px;
			color: #404040;
			background-color: white;
			position: absolute;
			top: 5px;
			right: 5px;
			z-index: 1;
			cursor: auto;
			border-radius: 5px;


		#help-info p {
			padding: 10px 25px;
			margin-bottom: 0;
	<div id="container">
		<form action="#" class="modal">
			<div class="modal-header">
				<button id="help">help</button>
				<div id="help-info" style="display:none;"><p>
				Found something interesting? Write about it in your own space. <a href="// to this Tiddler" target="_blank">Find out more</a>
				<ul class="nav nav-tabs" data-tabs="tabs">
					<li class="active" data-tab-name="post"><a href="#postForm">Reply</a></li>

			<fieldset id="postForm" class="modal-body">
					<input type="text" name="title">
				<input type="hidden" name="url">
					<textarea name="text" rows="8"></textarea>
					<input type="text" name="tags" value="">

			<div class="form-actions">
				<label class="checkbox">
					<input type="checkbox" name="private" val="private">
					keep private
				<input type="submit" class="btn primary btn-large" value="Done">
				<input type="button" class="btn btn-large closeBtn" value="Cancel">

	<script type="text/javascript"
	<script type="text/javascript" src="/bags/tiddlyspace/tiddlers/chrjs"></script>
	<script type="text/javascript" src="/bags/common/tiddlers/_reply.js"></script>
<!DOCTYPE html>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<title>This Space</title>
	<link href="/bags/common/tiddlers/profile.css" type='text/css' rel='stylesheet' >
	<link href="/bags/common/tiddlers/admin.css" type='text/css' rel='stylesheet' >
	<!--[if lte IE 8]>
	<script type="text/javascript" src="/bags/common/tiddlers/json2.js"></script>
	<script type="text/javascript" src="/bags/common/tiddlers/es5-shim.min.js"></script>
<div id="container">
	<div id="text-html" class="main section">
		<a class="app" href="/">home</a>
		<div class="left">
		<h2>About this space <button class='toggleNext'></button></h2>
		<div id="siteinfo"></div>
		<h2>Site Icon</h2>
			<img id="siteicon" class="siteicon">
			<form id="upload" method="POST" enctype="multipart/form-data">
				<input type="hidden" name="title" value="SiteIcon" />
				<input type="hidden" name="tags" value="excludeLists">
				<input type="hidden" name="csrf_token" class="csrf" />
				<input type="file" name="file" accept="image/*" />
				<input class="btn" type="submit" value="upload" />
			<div id="dropzone">Drop file here
				<img class="notloading" src="/bags/common/tiddlers/ajax-loader.gif" alt="submitting SiteIcon" />
		<h2>Vital Statistics</h2>
		<div id="info">please wait while information is loaded about this space...</div>
		<button class="spacereset">Reset Space</button>
		<div class="reset-confirm-wrap messageArea">
			<button class="close-btn" title="cancel reset">×</button>
			<p>Are you sure you want to reset the space? You can't go back! This will remove all the content from the space!</p>
			<form class="cf">
				<label for="reset-confirm">Enter the space name to confirm.</label>
				<input type="text" name="reset-confirm" class="reset-confirm-input inputBox" />
				<button type="submit">Reset Now</button>
			<div class="reset-message-area">
				<p class="performing">Resetting...</p>
				<p class="finished">Reset Done!</p>
				<p class="recipe-error-msg">Error removing includes. Please remove manually.</p>
		<div class="right">
		<div class="ts-membership">
				Add Member
				<a href="" title="What is a Member?" class="help">What is a Member?</a>
				<p>Add a new member to your space by entering their name below. Enter a space name instead and prefix with @ to add everyone who is already a member of that space.</p>
				<form class="ts-members">
					<input class="inputBox" type="text" name="username">
					<input type="submit" value="Add Member" class="btn" />
				Existing Members <button class='toggleNext'></button>
				Your space currently has the following members: 
				<ul class="ts-members"></ul>
				Include Space
				<a class="help" href="" title="What is inclusion?">What is Inclusion?</a>
			<form class="ts-includes">
				<input class="inputBox" type="text" name="spacename">
				<input type="submit" value="Include Space" class="btn" />
			<h2>Included Spaces <button class='toggleNext'></button></h2>
			This space includes the following spaces:
			<ul class="ts-includes"></ul>
		<div class="clear"></div>
<script src='/bags/common/tiddlers/backstage.js'></script>
<script src='/bags/common/tiddlers/jquery.js'></script>
<script src='/bags/tiddlyspace/tiddlers/chrjs'></script>
<script src='/bags/common/tiddlers/'></script>
<script src='/bags/common/tiddlers/chrjs.users'></script>
<script src='/bags/common/tiddlers/chrjs.identities'></script>
<script src='/bags/tiddlyspace/tiddlers/TiddlySpaceCSRF'></script>
<script src='/bags/common/tiddlers/jquery-form.js'></script>
<script src="/bags/common/tiddlers/siteiconupload.js"></script>
<script src="/bags/common/tiddlers/ts.js"></script>
<script src="/status.js"></script>
<script src="/bags/common/tiddlers/space.js"></script>
<!DOCTYPE html>
<html lang="en">
	<meta charset="utf-8"/>
	<title>TiddlySpace Apps</title>
	<link rel="stylesheet" href="/bags/common/tiddlers/reset.css" />
	<link rel="stylesheet" href="/bags/common/tiddlers/appspage.css" />
	<!--[if lt IE 7 ]>
	<link rel="stylesheet" href="/bags/common/tiddlers/appspageie6.css" />
	<div id="wrapper">
		<div id="TSbar"></div>
		<div id="main-content">
			<div id="space-details">
				<a href="/_space"><img class="siteicon"></a>
				<div id="title-subtitle">
					<h1 class="spaceaddress">
						<span class="spaceName"></span><span class="hostName"></span>
					<p class="tagline"><span class="subTitle"></span><a class="managespaces" href="/_space">manage space</a></p>
			<div id="holder">
				<div id="appswitcher-wrapper">
					<div id="appswitcher">
						<h2>Your Apps</h2>
						<ul id="app-list">
							<li class="htmlserialisation">
								<a href="/tiddlers.html?select=tag:!excludeLists;sort=-modified">
									<img src="/bags/common/tiddlers/browse_read_blue.png" alt="Icon for the HTML Serialisation" class="app-img" />
							<li class="tiddlywiki">
								<a href="/">
									<img src="/bags/common/tiddlers/tiddlywiki2_blue.png" alt="Icon for TiddlyWiki" class="app-img" />
						<div id="addapp">
							<button class="inactive">Add More!</button>
					<div id="app-desc">
							<li class="htmlserialisationdesc"><p>an easy to understand HTML representation of your content.</p></li>
							<li class="tiddlywikidesc"><p>use TiddlyWiki to create, edit and organise your content.</p></li>
					<div style="clear: both;"></div>
		<div id="footer"><!-- ie doesn't support footer tag -->
			<div id="footer-content">
				<div class="links">
					<a href="">blog</a>
					<a href="">featured</a>
					<a href="">documentation</a>
					<a href="">source</a>
				<p>TiddlySpace 2011, created by <a href="">Osmosoft</a></p>
	<script type="text/javascript" src="/bags/common/tiddlers/backstage.js"></script>
	<script type="text/javascript" src="/bags/common/tiddlers/jquery.js"></script>
	<script type="text/javascript" src="/bags/tiddlyspace/tiddlers/chrjs"></script>
	<script type="text/javascript" src="/bags/common/tiddlers/chrjs-store.js"></script>
	<script type="text/javascript" src="/bags/common/tiddlers/jquery-json.js"></script>
	<script type="text/javascript" src="/bags/common/tiddlers/appspage.js"></script>
<svg xmlns:rdf="" xmlns="" height="100%" width="100%" version="1.1" xmlns:cc="" xmlns:dc="" viewBox="0 0 40 40"><metadata><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource=""/><dc:title/></cc:Work></rdf:RDF></metadata><defs><linearGradient id="lG3826" x1="7.0996" gradientUnits="userSpaceOnUse" y1="18.829" gradientTransform="matrix(1.5858347,0,0,1.8078238,1098.1851,351.13716)" x2="1.5461" y2="-0.95166"><stop stop-color="#000" offset="0"/><stop stop-color="#9c9b99" offset="1"/></linearGradient><linearGradient id="lG3828" y2="372.44" gradientUnits="userSpaceOnUse" y1="375.7" x2="1111.7" x1="1097.7"><stop style="stop-color:#ac9393;" offset="0"/><stop style="stop-color:#c8b7b7;" offset="1"/></linearGradient></defs><g transform="translate(-1080.9375,-357.3329)"><path style="stroke-width:0;stroke-miterlimit:4;fill:url(#lG3826);" d="m1080.9,357.32,39.996-0.0426-0.01,40.008c-15.507-25.519-15.36-25.95-39.988-39.965z"/><path style="stroke-dashoffset:0;stroke:#7aa3be;stroke-linecap:round;stroke-miterlimit:4;stroke-width:1.49999988;fill:#c1e6fd;" d="m1091.9,363.55c6.5716-6.4925,16.576-7.3925,23.147-0.90003,6.5717,6.4925,6.5717,17.019,0,23.511-4.4424-8.6113-12.288-15.713-23.147-22.611z"/><path style="stroke-dashoffset:0;stroke:#ce81b0;stroke-linecap:round;stroke-miterlimit:4;stroke-width:1.5;fill:#f4c4e2;" d="m1110.2,367.62c3.217,3.2168,3.217,8.4323,0,11.649-3.8194-4.2357-8.3307-8.1824-11.649-11.649,3.217-3.2168,8.4325-3.2168,11.649-0.00002z"/><path style="stroke-linejoin:bevel;stroke:#000000;stroke-linecap:round;stroke-dasharray:none;stroke-miterlimit:4;stroke-width:0.80000001;fill:url(#lG3828);" d="m1081,357.34c18.79,6.4752,32.53,16.56,39.894,39.892-11.19-17.028-14.878-19.19-27.352-14.96,6.2984-12.098,3.9371-13.19-12.542-24.932z"/></g></svg>
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="72 648 70 70" 
width="30" height="30">
<g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1">
		<path d="M 77.59005 669.34003 C 71.532745 681.90424 73.714462 697.4441 84.135193 707.86475 
		C 97.315445 721.0451 118.684715 721.0451 131.8649 707.86475 
		C 145.04515 694.68457 145.04515 673.31537 131.8649 660.13513 
		C 121.4441 649.7141 105.90419 647.53253 93.339905 653.5899 L 102.047455 662.2976 
		C 109.58637 660.2373 117.987976 662.16803 123.90997 668.08997 
		C 132.69673 676.8767 132.69673 691.12317 123.90997 699.90985 
		C 115.12313 708.6966 100.87699 708.6966 92.09012 699.90985 
		C 86.168266 693.98804 84.23744 685.58643 86.297653 678.04755 Z M 72 648 L 72 668.25 L 78.75 661.49957 
		L 99.00019 681.7502 L 105.750175 675.00006 L 85.50013 654.75012 L 92.249985 648 Z" fill="black"
// TiddlyWeb adaptor
// v0.14.3

/*jslint vars: true, unparam: true, nomen: true, white: true */
/*global jQuery */

var tiddlyweb = (function($) {

"use strict";

var tw = {
	routes: {
		// host is the TiddlyWeb instance's URI (including server_prefix)
		// placeholders "_type" & "name" refer to the respective bag/recipe
		root     : "{host}/",
		bags     : "{host}/bags",
		bag      : "{host}/bags/{name}",
		recipes  : "{host}/recipes",
		recipe   : "{host}/recipes/{name}",
		tiddlers : "{host}/{_type}s/{name}/tiddlers",
		tiddler  : "{host}/{_type}s/{name}/tiddlers/{title}",
		revisions: "{host}/{_type}s/{name}/tiddlers/{title}/revisions",
		revision : "{host}/{_type}s/{name}/tiddlers/{title}/revisions/{revision}",
		search   : "{host}/search?q={query}"

var convertTimestamp, supplant;

// host (optional) is the URI of the originating TiddlyWeb instance
tw.Resource = function(type, host) {
	if(arguments.length) { // initialization
		this._type = type;
		if(host !== false) { = host !== undefined ? host.replace(/\/$/, "") : null;
$.extend(tw.Resource.prototype, {
	// retrieves resource from server
	// callback is passed resource, status, XHR (cf. jQuery.ajax success)
	// errback is passed XHR, error, exception, resource (cf. jQuery.ajax error)
	// filters is an optional filter string (e.g. "select=tag:foo;limit=5")
	get: function(callback, errback, filters) {
		var uri = this.route();
		if(filters) {
			var separator = uri.indexOf("?") === -1 ? "?" : ";";
			uri += separator + filters;
		var self = this;
		return $.ajax({
			url: uri,
			type: "GET",
			dataType: "json",
			success: function(data, status, xhr) {
				var resource = self.parse(data);
				resource.etag = xhr.getResponseHeader("Etag");
				callback(resource, status, xhr);
			error: function(xhr, error, exc) {
				errback(xhr, error, exc, self);
	// sends resource to server
	// callback is passed data, status, XHR (cf. jQuery.ajax success)
	// errback is passed XHR, error, exception, resource (cf. jQuery.ajax error)
	put: function(callback, errback) {
		var self = this;
		var options = {
			url: this.route(),
			type: "PUT",
			contentType: "application/json",
			data: JSON.stringify(this.baseData()),
			success: function(data, status, xhr) {
				callback(self, status, xhr);
			error: function(xhr, error, exc) {
				errback(xhr, error, exc, self);
		if(this.ajaxSetup) {
		return $.ajax(options);
	// deletes resource on server
	// callback is passed data, status, XHR (cf. jQuery.ajax success)
	// errback is passed XHR, error, exception, resource (cf. jQuery.ajax error)
	"delete": function(callback, errback) {
		var self = this;
		var options = {
			url: this.route(),
			type: "DELETE",
			success: function(data, status, xhr) {
				callback(self, status, xhr);
			error: function(xhr, error, exc) {
				errback(xhr, error, exc, self);
		if(this.ajaxSetup) {
		return $.ajax(options);
	// returns an object carrying only the essential information of the resource
	baseData: function() {
		var data = {},
			self = this;
		$.each(, function(i, item) {
			var value = self[item];
			if(value !== undefined) {
				data[item] = value;
		return data;
	// returns corresponding instance from a raw object (if applicable)
	parse: function(data) {
		return data;
	// list of accepted keys in serialization
	data: [],
	// returns resource's URI
	route: function() {
		return supplant(tw.routes[this._type], this);

var Container = function(type, name, host) {
	if(arguments.length) { // initialization
		tw.Resource.apply(this, [type, host]); = name;
		this.desc = "";
		this.policy = new tw.Policy({});
Container.prototype = new tw.Resource();
$.extend(Container.prototype, {
	tiddlers: function() {
		return new tw.TiddlerCollection(this);
	parse: function(data) {
		var type = tw._capitalize(this._type),
			container = new tw[type](,;
		data.policy = new tw.Policy(data.policy);
		return $.extend(container, data);
	data: ["desc", "policy"]

// attribs is an object whose members are merged into the instance (e.g. query)
tw.Collection = function(type, host, attribs) {
	if(arguments.length) { // initialization
		tw.Resource.apply(this, [type, host]);
		$.extend(this, attribs);
tw.Collection.prototype = new tw.Resource();

tw.TiddlerCollection = function(container, tiddler) {
	if(arguments.length) { // initialization
		tw.Collection.apply(this, [tiddler ? "revisions" : "tiddlers"]);
		this.container = container || null;
		this.tiddler = tiddler || null;
tw.TiddlerCollection.prototype = new tw.Collection();
$.extend(tw.TiddlerCollection.prototype, {
	parse: function(data) {
		var container = this.container;
		return $.map(data, function(item, i) {
			var tiddler = new tw.Tiddler(item.title, container),
				bag = item.bag;
			tiddler = tw.Tiddler.prototype.parse.apply(tiddler, [item]);
			if(!tiddler.bag && bag) { // XXX: bag always present!?
				tiddler.bag = new tw.Bag(bag,;
			if(!tiddler.recipe && item.recipe) {
				tiddler.recipe = new tw.Recipe(item.recipe,;
			delete item.recipe;
			return $.extend(tiddler, item);
	route: function() {
		var params = this.container;
		if(this.tiddler) {
			var container = this.tiddler.bag || this.tiddler.recipe;
			params = {
				_type: container._type,
				title: this.tiddler.title
		return supplant(tw.routes[this._type], params);

tw.Search = function(query, host) {
	tw.Collection.apply(this, ["search", host]);
	this.query = query;
tw.Search.prototype = new tw.Collection();
$.extend(tw.Search.prototype, {
	parse: function(data) {
		this.container = { // XXX: hacky
			_type: "bag",
		var tiddlers = tw.TiddlerCollection.prototype.parse.apply(this, arguments);
		delete this.container;
		return tiddlers;

// title is the name of the tiddler
// container (optional) is an instance of either Bag or Recipe
// optionally accepts a single object representing tiddler attributes
tw.Tiddler = function(title, container) {
	tw.Resource.apply(this, ["tiddler", false]);
	this.title = title;
	this.bag = container && container._type === "bag" ? container : null;
	this.recipe = container && container._type === "recipe" ? container : null;
	var self = this;
	$.each(, function(i, item) {
		self[item] = undefined; // exposes list of standard attributes for inspectability
	if(title && title.title) { // title is an object of tiddler attributes
		$.extend(this, title);
tw.Tiddler.prototype = new tw.Resource();
$.extend(tw.Tiddler.prototype, {
	revisions: function() {
		return new tw.TiddlerCollection(this.bag || this.recipe, this);
	route: function() {
		var container = this.bag || this.recipe;
		var params = $.extend({}, this, {
			host: container ? : null,
			_type: this.bag ? "bag" : (this.recipe ? "recipe" : null),
			name: container ? : null
		return supplant(tw.routes[this._type], params);
	parse: function(data) {
		var tiddler = new tw.Tiddler(this.title),
			container = this.bag || this.recipe;
		if(data.bag) {
			tiddler.bag = new tw.Bag(data.bag,;
			delete data.bag;
		delete data.recipe;
		tiddler.created = data.created ? convertTimestamp(data.created) : new Date();
		delete data.created;
		tiddler.modified = data.modified ? convertTimestamp(data.modified) : new Date();
		delete data.modified;
		if(this.recipe) {
			tiddler.recipe = this.recipe;
		return $.extend(tiddler, data);
	data: ["created", "creator", "modifier", "modified", "tags", "type", "text",
	ajaxSetup: function(options) {
		var self = this;
		if(this.etag && (options.type === "PUT" || options.type === "DELETE")) {
			options.beforeSend = function(xhr) {
				xhr.setRequestHeader("If-Match", self.etag);
		if(options.type === "PUT") {
			var callback = options.success;
			options.success = function(data, status, xhr) {
				var loc = xhr.getResponseHeader("Location"),
					etag = xhr.getResponseHeader("Etag");
				if(loc && etag) {
					self.etag = etag;
					if(!self.bag) {
						var bag = loc.split("/bags/").pop().split("/")[0];
						self.bag = new tw.Bag(bag,;
					callback(self, status, xhr);
				} else { // IE
					self.get(callback, options.error);

tw.Revision = function(id, tiddler) {
	var container = tiddler.bag || tiddler.recipe;
	tw.Tiddler.apply(this, [tiddler.title, container]);
	this._type = "revision";
	this.revision = id;
tw.Revision.prototype = new tw.Tiddler();
$.extend(tw.Revision.prototype, {
	revisions: false,
	data: false,
	put: false,
	"delete": false

tw.Bag = function(name, host) {
	Container.apply(this, ["bag", name, host]);
tw.Bag.prototype = new Container();

tw.Recipe = function(name, host) {
	Container.apply(this, ["recipe", name, host]);
	this.recipe = [];
tw.Recipe.prototype = new Container();
$.extend(tw.Recipe.prototype, {
	data: ["recipe"].concat(

tw.Policy = function(constraints) { // TODO: validation?
	var self = this;
	$.each(this.constraints, function(i, item) {
		self[item] = constraints[item];
tw.Policy.prototype.constraints = ["read", "write", "create", "delete",
	"manage", "accept", "owner"];

 * utilities

tw._capitalize = function(str) {
	return str.charAt(0).toUpperCase() + str.slice(1);

// convert YYYYMMDDhhmmss timestamp to Date instance
convertTimestamp = function(t) {
	if (t.match(/^\d{12,17}$/)) {
		return new Date(Date.UTC(
			parseInt(t.substr(0, 4), 10),
			parseInt(t.substr(4, 2), 10) - 1,
			parseInt(t.substr(6, 2), 10),
			parseInt(t.substr(8, 2), 10),
			parseInt(t.substr(10, 2), 10),
			parseInt(t.substr(12, 2) || "0", 10),
			parseInt(t.substr(14, 3) || "0", 10)
	} else {
		return new Date(Date.parse(t));

// adapted from Crockford (
supplant = function(str, obj) {
	return str.replace(/{([^{}]*)}/g, function (a, b) {
		var r = obj[b];
		r = typeof r === "string" || typeof r === "number" ? r : a;
		return $.inArray(b, ["host", "query"]) !== -1 ? r : encodeURIComponent(r); // XXX: special-casing

return tw;

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape ( -->

   viewBox="918 510 14 14"
           rdf:resource="" />
         offset="0" />
         offset="1" />
       gradientTransform="matrix(11.473944,0,0,11.473944,922.3752,513.7837)" />
         d="m 929.6952,512.9018 c -2.5384,-2.53843 -6.654,-2.53843 -9.1924,0 -2.5384,2.5384 -2.5384,6.654 0,9.19238 2.5384,2.53839 6.654,2.53839 9.1924,0 2.5384,-2.53838 2.5384,-6.65398 0,-9.19238 m -4.5962,2.8407 2.07733,-2.07734 1.75547,1.75549 -2.0773,2.07735 2.0773,2.07732 -1.75547,1.75548 -2.07733,-2.07732 -2.07733,2.07732 -1.75547,-1.75548 2.0773,-2.07732 -2.0773,-2.07735 1.75547,-1.75549 z"
         style="fill:url(#Obj_Gradient)" />
         d="m 927.61447,515.38354 a 4.51205,4.2590378 0 1 1 -9.0241,0 4.51205,4.2590378 0 1 1 9.0241,0 z"
         style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="78 222 60 60" 
width="30" height="30">
<g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1">
		<path d="M 107.92718 244.14815 L 86.651474 222.89253 L 78.85206 230.69925 L 100.120415 251.9476 L 78.774 273.27396 
		L 86.57342 281.08075 L 107.927216 259.74707 L 129.39981 281.19946 L 137.19922 273.39267 L 115.73397 251.94763 
		L 137.121155 230.58054 L 129.32175 222.77374 Z" fill="black" class="glyph"/>
Unless you're delighted with the default theme you can make some quick changes by generating a new random color palette, hit this button to cycle through some alternatives.

<<RandomColorPaletteButton saturation_pale:0.67 saturation_light:0.53
saturation_mid:0.43 saturation_dark:0.06 pale:0.99 light:0.85 mid:0.5 dark:0.31>>

You can also change the look and feel completely by installing a new theme. To do this, find one you like in the @themes space, note down the name, and include it in this space by going to the space menu. You can reach the space menu by clicking on the blue and pink circle at the top-right of the page and chooshing "THIS SPACE". Here are a few to check out:
* @pip
* @caspian-ii
* @basalt
* @simplicity
* @cheesecake
* @jelly-doughnut

(//Note that if you are using a custom TiddlySpace install, these themes may not be present.//)
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="450 366 38 57"
width="30" height="30">
	<g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1">
			<path d="M 452.1094 421.2422 L 450 421.2422 L 450 423 L 487.9688 423 L 487.9688 421.2422 L 485.8595 421.2422 
			L 485.8595 377.29688 L 487.9688 377.29688 L 487.9688 375.53906 L 485.8595 375.53906 
			C 485.8595 375.53906 481.12463 371.59341 473.02023 370.52802 C 472.6824 368.9689 471.72098 366.75 468.9844 366.75 
			C 466.24783 366.75 465.28638 368.9689 464.94864 370.52802 
			C 456.84418 371.59341 452.1094 375.53906 452.1094 375.53906 L 450 375.53906 L 450 377.29688 L 452.1094 377.29688 
			Z M 467.12247 370.32086 L 467.12247 370.32086 C 467.3805 369.42395 467.90762 368.50781 468.9844 368.50781 
			C 470.0612 368.50781 470.5883 369.42395 470.84634 370.32086 
			C 470.24136 370.2848 469.62054 370.26562 468.9844 370.26562 
			C 468.34827 370.26562 467.72748 370.2848 467.12247 370.32086 Z M 454.21875 420.92804 L 454.21875 420.92804 
			C 455.46762 420.42087 456.32816 419.35281 456.32816 418.11716 L 456.32816 377.29688 L 458.4375 377.29688 
			L 458.4375 421.2422 L 454.21875 421.2422 Z M 460.5469 420.92804 L 460.5469 420.92804 
			C 461.79578 420.42087 462.65625 419.35281 462.65625 418.11716 L 462.65625 377.29688 L 464.76566 377.29688 
			L 464.76566 421.2422 L 460.5469 421.2422 Z M 466.87503 420.92804 L 466.87503 420.92804 
			C 468.1239 420.42087 468.9844 419.35281 468.9844 418.11716 L 468.9844 377.29688 L 471.09378 377.29688 
			L 471.09378 421.2422 L 466.87503 421.2422 Z M 473.2032 420.92804 L 473.2032 420.92804 
			C 474.45203 420.42087 475.31256 419.35281 475.31256 418.11716 L 475.31256 377.29688 L 477.4219 377.29688 
			L 477.4219 421.2422 L 473.2032 421.2422 Z M 479.5313 420.92804 L 479.5313 420.92804 
			C 480.78018 420.42087 481.64066 419.35281 481.64066 418.11716 L 481.64066 377.29688 L 483.75006 377.29688 
			L 483.75006 421.2422 L 479.5313 421.2422 Z" fill="black" class="glyph"/>
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="301 225 48 52"
width="30" height="30">
<g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1">
		<path d="M 333.00003 234 L 306 258.75003 L 301.5 270 L 312.75 265.50003 L 339.75 240.74998 Z M 337.5 229.50002 
		L 335.24988 231.75008 L 341.99997 238.50003 L 344.24997 236.24995 Z M 342 225.00003 L 339.74988 227.25009 
		L 346.5 234.00005 L 348.75 231.75003 Z M 301.5 273.9719 C 301.5 273.9719 309.59888 277.99927 317.70013 273.97183 
		C 325.80066 269.94437 341.99997 276.65686 341.99997 276.65686 L 341.99997 273.97195 
		C 341.99997 273.97195 325.80014 267.2594 317.70013 271.28687 C 309.6 275.31451 301.5 271.28683 301.5 271.28683 Z" 
		fill="#101010" class="glyph"/>
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="506 234 68 36" width="30" height="30"><metadata xmlns:dc=""><dc:date>2010-09-16 14:51Z</dc:date><!-- Produced by OmniGraffle Professional 5.2.3 --></metadata><defs></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><rect width="1118" height="783"/><g><path d="M 538.68195 244.31807 C 540.43927 246.07547 540.43927 248.9247 538.68195 250.68204 C 536.92456 252.4394 534.07532 252.4394 532.318 250.68204 C 530.5606 248.9247 530.5606 246.07547 532.318 244.31807 C 534.07532 242.56075 536.92456 242.56075 538.68195 244.31807 M 511.12607 257.99356 C 511.26108 258.13019 511.39728 258.26608 511.53473 258.40121 C 527.2556 273.86606 552.74414 273.86606 568.46515 258.40121 C 568.60248 258.26617 568.73853 258.13037 568.87354 257.9938 C 568.8736 257.99374 568.8736 257.99371 568.8736 257.99362 C 568.87366 257.99371 568.87366 257.9938 568.87372 257.9939 C 570.72504 256.12051 572.35046 254.11153 573.74994 252 C 573.74994 251.99997 573.74994 251.99994 573.74994 251.99992 C 572.35046 249.8884 570.72504 247.87938 568.87372 246.00606 C 568.87366 246.00613 568.87366 246.00621 568.8736 246.00627 C 568.73865 245.86966 568.60254 245.73383 568.46515 245.5987 C 552.74414 230.13387 527.2556 230.13387 511.53473 245.5987 C 511.39728 245.73383 511.26108 245.86974 511.12613 246.00635 C 511.126 246.00624 511.126 246.00616 511.12595 246.00606 C 509.2748 247.87938 507.64954 249.88837 506.24994 251.9998 L 506.24994 251.99983 C 506.24994 251.9999 506.25 251.99992 506.25 251.99997 C 506.25 252 506.24994 252.00005 506.24994 252.00009 L 506.24994 252.00012 C 507.64954 254.11157 509.2748 256.12051 511.12595 257.9939 C 511.126 257.99377 511.126 257.99365 511.12607 257.99359 Z M 515.44916 252 C 515.8548 251.55469 516.27502 251.11778 516.71014 250.68985 C 522.16632 245.32257 529.06055 242.23206 536.17273 241.41824 C 534.6662 241.96199 533.2525 242.83762 532.04498 244.04512 C 527.65155 248.43852 527.65155 255.56163 532.04498 259.95502 C 533.2522 261.16226 534.6656 262.03778 536.17175 262.58154 C 529.05988 261.76761 522.16608 258.6771 516.71014 253.31009 C 516.2751 252.88219 515.85486 252.44528 515.44922 252 Z M 564.55054 251.99995 C 564.14502 252.44525 563.7248 252.88217 563.28973 253.31009 C 557.83368 258.67712 550.93988 261.76764 543.828 262.58157 C 545.33423 262.03781 546.74756 261.1623 547.9549 259.95502 C 552.34833 255.56163 552.34833 248.43852 547.9549 244.04512 C 546.74744 242.83765 545.33374 241.96202 543.82715 241.41824 C 550.9394 242.23206 557.83356 245.3226 563.28973 250.68985 C 563.7248 251.11775 564.14502 251.55467 564.55054 251.99995 Z M 568.8736 257.99362 C 570.7249 256.12033 572.35028 254.11139 573.74988 252.00002" fill="black" class="glyph"/></g></g></svg>
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="434 218 68 68"
width="30" height="30">
<g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1">
		<path d="M 478.39694 232.53705 L 478.39694 232.53705 
		C 477.1145 231.85132 475.77875 231.30147 474.41058 230.88734 L 474.41058 218.24994 L 461.58942 218.24994 
		L 461.58942 230.88734 C 460.22125 231.30147 458.8855 231.85132 457.60306 232.53705 L 448.66824 223.60214 
		L 439.6022 232.66814 L 448.53717 241.60304 C 447.8515 242.8854 447.30157 244.22116 446.88745 245.58936 
		L 434.25 245.58936 L 434.25 258.41052 L 446.88745 258.41052 
		C 447.30157 259.77869 447.8515 261.11447 448.53717 262.39688 L 439.6022 271.33173 L 448.66824 280.3978 
		L 457.60306 271.46283 C 458.8855 272.14862 460.22125 272.69846 461.58942 273.11252 L 461.58942 285.74988 
		L 474.41058 285.74988 L 474.41058 273.11252 C 475.77875 272.69846 477.1145 272.14862 478.39694 271.46283 
		L 487.33176 280.3978 L 496.39767 271.33173 L 487.46286 262.39688 
		C 488.14853 261.11447 488.69836 259.77869 489.11255 258.41052 L 501.74988 258.41052 L 501.74988 245.58936 
		L 489.11255 245.58936 C 488.69836 244.22116 488.14853 242.8854 487.46286 241.60304 L 496.39767 232.66814 
		L 487.33176 223.60214 Z M 475.3328 244.66714 C 479.3825 248.71698 479.3825 255.2829 475.3328 259.33273 
		C 471.28296 263.3826 464.71704 263.3826 460.66724 259.33273 
		C 456.61737 255.2829 456.61737 248.71698 460.66724 244.66714 
		C 464.71704 240.61734 471.28296 240.61734 475.3328 244.66714" fill="#111"
User-agent: *
Disallow: /bags
Disallow: /recipes
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="364 157 64 51" width="30" height="30"><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><g><path class="glyph" d="M 364.50006 184.50061 L 386.99985 207.00037 L 396 198.00002 L 373.50003 175.50066 Z M 403.02295 181.97704 C 400.38693 179.34099 396.11307 179.34099 393.47702 181.97704 C 390.841 184.61307 390.841 188.88695 393.47702 191.52298 C 396.11307 194.15903 400.38693 194.15903 403.02295 191.52298 C 405.65906 188.88695 405.65906 184.61307 403.02295 181.97704 M 414.27298 170.72704 C 411.63693 168.091 407.36307 168.091 404.72702 170.72704 C 402.091 173.36308 402.091 177.63693 404.72702 180.27296 C 407.36307 182.90901 411.63693 182.90901 414.27298 180.27296 C 416.90903 177.63693 416.90903 173.36308 414.27298 170.72704 M 425.523 159.47705 C 422.88696 156.841 418.6131 156.841 415.97705 159.47705 C 413.341 162.11308 413.341 166.38695 415.97705 169.02295 C 418.6131 171.65903 422.88696 171.65903 425.523 169.02295 C 428.15906 166.38695 428.15906 162.11308 425.523 159.47705" fill="#020202"/></g></g></svg>
<svg xmlns="" xmlns:xl="" version="1.1" viewBox="2 724 68 55" 
width="30" height="30">
<g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1">
		<path d="M 2.25 756 L 11.25 747 L 24.75 760.4994 L 60.750004 724.4994 L 69.75 733.49902 
		L 24.749977 778.49976 Z" fill="#101010" class="glyph"/>
Once you have some content then you may choose to determine a tiddler, or set of tiddlers to display each time you load ~TiddlySpace. This is determined by the [[DefaultTiddlers]].
@@Please do not modify this tiddler; it was created automatically upon space creation.@@
A [[SiteIcon|SiteIcon tiddler]]@glossary helps provide some identity to your space.  Ideally it'd be a square and a minimum of 48*48 pixels size.  You can upload your site icon using the uploader below.

<<binaryUploadPublic title:SiteIcon>>
The title and subtitle of your space are visible to visitors and are also displayed in your browser's tabs. Click on the SiteTitle and SiteSubtitle tiddler links below to make changes.
* [[SiteTitle]]
* [[SiteSubtitle]]