Adobe 65007312 Programming Guide - Page 202

Add the title to the HTML template, Testing the plug-in, Adding a customized tagset

Page 202 highlights

CHAPTER 11: Web Gallery Plug-ins: A Tutorial Example Adding a customized tagset 202 Add the title to the HTML template The title will be shown on all pages, so it should be part of the boilerplate HTML used at the front of all pages, as defined by the header.html template file. 3. Edit the header.html template file, adding the following heading immediately following the tag: $model.metadata.siteTitle.value Notice that the title text is found in the model variable, the same one bound to the text-input control in the control panel. An event handler here allows edit-in-place in the browser window of the Web Gallery page, in addition to the editing capability provided by UI control. 4. To make edit-in-place work, we need a JavaScript script to handle Live Update. Add the next statement immediately following, identifying a script to be executed 5. We need to make this script part of the plug-in. To do this, we need to both provide the script, and tell the plug-in it's there. Z In the manifest.lrweb page, add this command: AddResources{ source="resources", destination="resources", } Z Create a copy of the file live_update.js, which is part of the Lightroom SDK, and place it in the resources subfolder of the plug-in. This is a sample implementation of the update functions and callbacks needed for Live Update. Testing the plug-in 1. Save all of your changes and restart Lightroom. 2. Select some photos. 3. Go to the Web Gallery page and select the new gallery type. 4. Place the cursor over the "MySample" text that appears as the default title; you should be able to edit it. 5. Look in the Site Info section of the control panel, and try editing the title text from there. Adding a customized tagset A tagset for a web gallery is an external file containing macro-like definitions that can be loaded by your web pages; see "Web SDK tagsets" on page 135. We will create a tagset for this gallery that allows us to build up a complex string. Our tags will build up a complex string by combining random members of a list of predefined elements with some set text and with the content of the tag when it is included in a page.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204

C
HAPTER
11: Web Gallery Plug-ins: A Tutorial Example
Adding a customized tagset
202
Add the title to the HTML template
The title will be shown on all pages, so it should be part of the boilerplate HTML used at the front of all
pages, as defined by the
header.html
template file.
3.
Edit the
header.html
template file, adding the following heading immediately following the
<body>
tag:
<h1 onclick="clickTarget( this, 'metadata.siteTitle.value' );"
id="metadata.siteTitle.value">
$model.metadata.siteTitle.value
</h1>
Notice that the title text is found in the model variable, the same one bound to the text-input control
in the control panel. An event handler here allows edit-in-place in the browser window of the Web
Gallery page, in addition to the editing capability provided by UI control.
4.
To make edit-in-place work, we need a JavaScript script to handle Live Update. Add the next statement
immediately following, identifying a script to be executed
<script type="text/javascript" src="$theRoot/resources/live_update.js"></script>
5.
We need to make this script part of the plug-in. To do this, we need to both provide the script, and tell
the plug-in it’s there.
Z
In the manifest.lrweb page, add this command:
AddResources{
source="resources",
destination="resources",
}
Z
Create a copy of the file
live_update.js
, which is part of the Lightroom SDK, and place it in the
resources
subfolder of the plug-in. This is a sample implementation of the update functions and
callbacks needed for Live Update.
Testing the plug-in
1.
Save all of your changes and restart Lightroom.
2.
Select some photos.
3.
Go to the Web Gallery page and select the new gallery type.
4.
Place the cursor over the “MySample” text that appears as the default title; you should be able to edit
it.
5.
Look in the Site Info section of the control panel, and try editing the title text from there.
Adding a customized tagset
A tagset
for a web gallery is an external file containing macro-like definitions that can be loaded by your
web pages; see
Web SDK tagsets
” on page 135
. We will create a tagset for this gallery that allows us to
build up a complex string. Our tags will build up a complex string by combining random members of a list
of predefined elements with some set text and with the content of the tag when it is included in a page.