author | Michael Krelin <hacker@klever.net> | 2006-12-18 13:22:11 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-12-18 13:22:11 (UTC) |
commit | 676ead33f615fbc2affb3cb979d1316f0676daef (patch) (unidiff) | |
tree | 06e7afff01a0c1df631c7f635618403d7989572a | |
parent | b609e9157c1587b11f177edfa7fe65f6851e9706 (diff) | |
download | fireflix-676ead33f615fbc2affb3cb979d1316f0676daef.zip fireflix-676ead33f615fbc2affb3cb979d1316f0676daef.tar.gz fireflix-676ead33f615fbc2affb3cb979d1316f0676daef.tar.bz2 |
make file properties visible but readonly for non-pending downloads.
And while we're at it show failure reason for failed uploads.
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@238 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | content/fireflix-panel.xul | 57 | ||||
-rw-r--r-- | content/fireflix.css | 8 | ||||
-rw-r--r-- | content/fireflix.js | 25 |
3 files changed, 56 insertions, 34 deletions
diff --git a/content/fireflix-panel.xul b/content/fireflix-panel.xul index 0e511c5..aa3dbd6 100644 --- a/content/fireflix-panel.xul +++ b/content/fireflix-panel.xul | |||
@@ -2,304 +2,307 @@ | |||
2 | <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> | 2 | <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> |
3 | <?xml-stylesheet href="fireflix.css" type="text/css"?> | 3 | <?xml-stylesheet href="fireflix.css" type="text/css"?> |
4 | <!DOCTYPE page SYSTEM "chrome://fireflix/locale/fireflix.dtd"> | 4 | <!DOCTYPE page SYSTEM "chrome://fireflix/locale/fireflix.dtd"> |
5 | <page | 5 | <page |
6 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" | 6 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
7 | id="fireflixwindow" title="Fireflix" | 7 | id="fireflixwindow" title="Fireflix" |
8 | onload="fireflix.init()" | 8 | onload="fireflix.init()" |
9 | orient="vertical" | 9 | orient="vertical" |
10 | ondragover="nsDragAndDrop.dragOver(event,fireflix.uploadObserver)" | 10 | ondragover="nsDragAndDrop.dragOver(event,fireflix.uploadObserver)" |
11 | ondragdrop="nsDragAndDrop.drop(event,fireflix.uploadObserver)" | 11 | ondragdrop="nsDragAndDrop.drop(event,fireflix.uploadObserver)" |
12 | > | 12 | > |
13 | 13 | ||
14 | <script src="chrome://global/content/nsDragAndDrop.js"/> | 14 | <script src="chrome://global/content/nsDragAndDrop.js"/> |
15 | <script src="chrome://global/content/nsTransferable.js"/> | 15 | <script src="chrome://global/content/nsTransferable.js"/> |
16 | <script type="application/x-javascript" src="md5.js" /> | 16 | <script type="application/x-javascript" src="md5.js" /> |
17 | <script type="application/x-javascript" src="util.js" /> | 17 | <script type="application/x-javascript" src="util.js" /> |
18 | <script type="application/x-javascript" src="flickr.js" /> | 18 | <script type="application/x-javascript" src="flickr.js" /> |
19 | <script type="application/x-javascript" src="fireflix.js" /> | 19 | <script type="application/x-javascript" src="fireflix.js" /> |
20 | 20 | ||
21 | <stringbundleset> | 21 | <stringbundleset> |
22 | <stringbundle id="loc_strings" src="chrome://fireflix/locale/fireflix.properties" /> | 22 | <stringbundle id="loc_strings" src="chrome://fireflix/locale/fireflix.properties" /> |
23 | </stringbundleset> | 23 | </stringbundleset> |
24 | 24 | ||
25 | <commandset> | 25 | <commandset> |
26 | <command id="cmd_auth_auth" label="&panel.auth.auth.label;" | 26 | <command id="cmd_auth_auth" label="&panel.auth.auth.label;" |
27 | oncommand="fireflix.on_cmd_auth()"/> | 27 | oncommand="fireflix.on_cmd_auth()"/> |
28 | <command id="cmd_auth_done" label="&panel.auth.done.label;" | 28 | <command id="cmd_auth_done" label="&panel.auth.done.label;" |
29 | oncommand="fireflix.on_cmd_auth_done()" disabled="true"/> | 29 | oncommand="fireflix.on_cmd_auth_done()" disabled="true"/> |
30 | <command id="cmd_auth_open_flickr" label="&panel.auth.flickr.label;" | 30 | <command id="cmd_auth_open_flickr" label="&panel.auth.flickr.label;" |
31 | oncommand="fireflix.openTab('http://www.flickr.com/')" /> | 31 | oncommand="fireflix.openTab('http://www.flickr.com/')" /> |
32 | <command id="cmd_auth_unauth" label="&panel.auth.unauth.label;" | 32 | <command id="cmd_auth_unauth" label="&panel.auth.unauth.label;" |
33 | oncommand="fireflix.on_cmd_auth_unauth()" /> | 33 | oncommand="fireflix.on_cmd_auth_unauth()" /> |
34 | <command id="cmd_help" label="?" | 34 | <command id="cmd_help" label="?" |
35 | oncommand="fireflix.openTab('chrome://fireflix/content/help.xml')" /> | 35 | oncommand="fireflix.openTab('chrome://fireflix/content/help.xml')" /> |
36 | </commandset> | 36 | </commandset> |
37 | 37 | ||
38 | <popupset> | 38 | <popupset> |
39 | <popup id="auth_menu"> | 39 | <popup id="auth_menu"> |
40 | <menuitem command="cmd_auth_auth"/> | 40 | <menuitem command="cmd_auth_auth"/> |
41 | <menuitem command="cmd_auth_done" hidden="true" id="menu_auth_done"/> | 41 | <menuitem command="cmd_auth_done" hidden="true" id="menu_auth_done"/> |
42 | <menuitem command="cmd_auth_unauth" /> | 42 | <menuitem command="cmd_auth_unauth" /> |
43 | <menuseparator/> | 43 | <menuseparator/> |
44 | <menuitem command="cmd_auth_open_flickr"/> | 44 | <menuitem command="cmd_auth_open_flickr"/> |
45 | </popup> | 45 | </popup> |
46 | </popupset> | 46 | </popupset> |
47 | 47 | ||
48 | <commandset id="cmdset_search"> | 48 | <commandset id="cmdset_search"> |
49 | <command id="cmd_search" label="&panel.search.cmd_search.label;" | 49 | <command id="cmd_search" label="&panel.search.cmd_search.label;" |
50 | oncommand="fireflix.foundphotos.search_photos()"/> | 50 | oncommand="fireflix.foundphotos.search_photos()"/> |
51 | <command id="cmd_search_open" label="&panel.search.cmd_search_open.label;" | 51 | <command id="cmd_search_open" label="&panel.search.cmd_search_open.label;" |
52 | oncommand="fireflix.foundphotos.on_cmd_open(event)" /> | 52 | oncommand="fireflix.foundphotos.on_cmd_open(event)" /> |
53 | <command id="cmd_search_prev_page" | 53 | <command id="cmd_search_prev_page" |
54 | label="&panel.search.cmd_search_prev_page.label;" | 54 | label="&panel.search.cmd_search_prev_page.label;" |
55 | oncommand="fireflix.foundphotos.on_cmd_prev(event)" disabled="true"/> | 55 | oncommand="fireflix.foundphotos.on_cmd_prev(event)" disabled="true"/> |
56 | <command id="cmd_search_next_page" | 56 | <command id="cmd_search_next_page" |
57 | label="&panel.search.cmd_search_next_page.label;" | 57 | label="&panel.search.cmd_search_next_page.label;" |
58 | oncommand="fireflix.foundphotos.on_cmd_next(event)" disabled="true"/> | 58 | oncommand="fireflix.foundphotos.on_cmd_next(event)" disabled="true"/> |
59 | </commandset> | 59 | </commandset> |
60 | 60 | ||
61 | <commandset id="cmdset_sets"> | 61 | <commandset id="cmdset_sets"> |
62 | <command id="cmd_refresh_sets" label="&panel.sets.cmd_refresh_sets;" | 62 | <command id="cmd_refresh_sets" label="&panel.sets.cmd_refresh_sets;" |
63 | oncommand="fireflix.on_refresh_sets()" /> | 63 | oncommand="fireflix.on_refresh_sets()" /> |
64 | <command id="cmd_set_props" label="&panel.sets.cmd_properties;" | 64 | <command id="cmd_set_props" label="&panel.sets.cmd_properties;" |
65 | oncommand="fireflix.on_set_props()" disabled="true" /> | 65 | oncommand="fireflix.on_set_props()" disabled="true" /> |
66 | </commandset> | 66 | </commandset> |
67 | 67 | ||
68 | <popupset> | 68 | <popupset> |
69 | <popup id="sets_menu"> | 69 | <popup id="sets_menu"> |
70 | <menuitem command="cmd_set_props"/> | 70 | <menuitem command="cmd_set_props"/> |
71 | <menuitem command="cmd_refresh_sets"/> | 71 | <menuitem command="cmd_refresh_sets"/> |
72 | <menuseparator/> | 72 | <menuseparator/> |
73 | <menu label="&panel.sets.generate_html;" id="sets_html_menu"/> | 73 | <menu label="&panel.sets.generate_html;" id="sets_html_menu"/> |
74 | </popup> | 74 | </popup> |
75 | </popupset> | 75 | </popupset> |
76 | 76 | ||
77 | <commandset id="cmdset_setphotos"> | 77 | <commandset id="cmdset_setphotos"> |
78 | </commandset> | 78 | </commandset> |
79 | 79 | ||
80 | <popupset> | 80 | <popupset> |
81 | <popup id="setphotos_menu"> | 81 | <popup id="setphotos_menu"> |
82 | <menu label="&panel.setphotos.generate_html;" id="setphotos_html_menu"/> | 82 | <menu label="&panel.setphotos.generate_html;" id="setphotos_html_menu"/> |
83 | </popup> | 83 | </popup> |
84 | </popupset> | 84 | </popupset> |
85 | 85 | ||
86 | <commandset id="cmdset_uploads"> | 86 | <commandset id="cmdset_uploads"> |
87 | <command id="cmd_uploads_clear" label="&panel.uploads.clear.label;" | 87 | <command id="cmd_uploads_clear" label="&panel.uploads.clear.label;" |
88 | oncommand="fireflix.uploads.on_clear()" /> | 88 | oncommand="fireflix.uploads.on_clear()" /> |
89 | <command id="cmd_uploads_upload" label="&panel.uploads.upload.label;" | 89 | <command id="cmd_uploads_upload" label="&panel.uploads.upload.label;" |
90 | oncommand="fireflix.uploads.on_upload()" /> | 90 | oncommand="fireflix.uploads.on_upload()" /> |
91 | <command id="cmd_uploads_remove" label="&panel.uploads.remove.label;" | 91 | <command id="cmd_uploads_remove" label="&panel.uploads.remove.label;" |
92 | oncommand="fireflix.uploads.on_remove()" /> | 92 | oncommand="fireflix.uploads.on_remove()" /> |
93 | <command id="cmd_uploads_add" label="&panel.uploads.add.label;" | 93 | <command id="cmd_uploads_add" label="&panel.uploads.add.label;" |
94 | oncommand="fireflix.uploads.on_add()" /> | 94 | oncommand="fireflix.uploads.on_add()" /> |
95 | </commandset> | 95 | </commandset> |
96 | 96 | ||
97 | <popupset> | 97 | <popupset> |
98 | <popup id="uploads_menu"> | 98 | <popup id="uploads_menu"> |
99 | <menuitem command="cmd_uploads_add"/> | 99 | <menuitem command="cmd_uploads_add"/> |
100 | <menuitem command="cmd_uploads_clear"/> | 100 | <menuitem command="cmd_uploads_clear"/> |
101 | <menuitem command="cmd_uploads_remove"/> | 101 | <menuitem command="cmd_uploads_remove"/> |
102 | <menuseparator/> | 102 | <menuseparator/> |
103 | <menuitem command="cmd_uploads_upload"/> | 103 | <menuitem command="cmd_uploads_upload"/> |
104 | <menuseparator/> | 104 | <menuseparator/> |
105 | <menu label="&panel.uploads.generate_html;" id="uploads_html_menu"/> | 105 | <menu label="&panel.uploads.generate_html;" id="uploads_html_menu"/> |
106 | </popup> | 106 | </popup> |
107 | </popupset> | 107 | </popupset> |
108 | 108 | ||
109 | <vbox class="wholething" flex="1"> | 109 | <vbox class="wholething" flex="1"> |
110 | 110 | ||
111 | <groupbox context="auth_menu"> | 111 | <groupbox context="auth_menu"> |
112 | <caption label="&panel.auth_info;"/> | 112 | <caption label="&panel.auth_info;"/> |
113 | <hbox> | 113 | <hbox> |
114 | <vbox pack="center" flex="1"> | 114 | <vbox pack="center" flex="1"> |
115 | <label id="auth_info" value="&panel.no_auth_info;" disabled="true" crop="end"/> | 115 | <label id="auth_info" value="&panel.no_auth_info;" disabled="true" crop="end"/> |
116 | </vbox> | 116 | </vbox> |
117 | <button class="lean" id="b_auth" command="cmd_auth_auth"/> | 117 | <button class="lean" id="b_auth" command="cmd_auth_auth"/> |
118 | <button class="lean" id="b_auth_done" command="cmd_auth_done" hidden="true"/> | 118 | <button class="lean" id="b_auth_done" command="cmd_auth_done" hidden="true"/> |
119 | <button class="lean" command="cmd_auth_open_flickr" | 119 | <button class="lean" command="cmd_auth_open_flickr" |
120 | tooltiptext="&panel.auth.flickr.tip;"/> | 120 | tooltiptext="&panel.auth.flickr.tip;"/> |
121 | <button class="lean" command="cmd_help"/> | 121 | <button class="lean" command="cmd_help"/> |
122 | </hbox> | 122 | </hbox> |
123 | </groupbox> | 123 | </groupbox> |
124 | 124 | ||
125 | <tabbox flex="1" id="fireflix_tabs"> | 125 | <tabbox flex="1" id="fireflix_tabs"> |
126 | 126 | ||
127 | <tabs> | 127 | <tabs> |
128 | <tab label="&panel.tabs.search;"/> | 128 | <tab label="&panel.tabs.search;"/> |
129 | <tab label="&panel.tabs.sets;"/> | 129 | <tab label="&panel.tabs.sets;"/> |
130 | <tab label="&panel.tabs.tags;" hidden="true"/> <!-- TODO: --> | 130 | <tab label="&panel.tabs.tags;" hidden="true"/> <!-- TODO: --> |
131 | <tab id="tab_upload" label="&panel.tabs.upload;"/> | 131 | <tab id="tab_upload" label="&panel.tabs.upload;"/> |
132 | </tabs> | 132 | </tabs> |
133 | 133 | ||
134 | <tabpanels flex="1"> | 134 | <tabpanels flex="1"> |
135 | 135 | ||
136 | <tabpanel id="tabpanel_search" flex="1"> | 136 | <tabpanel id="tabpanel_search" flex="1"> |
137 | <vbox flex="1"> | 137 | <vbox flex="1"> |
138 | <groupbox class="search_params" orient="vertical" onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.search_photos()"> | 138 | <groupbox class="search_params" orient="vertical" onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.search_photos()"> |
139 | <hbox> | 139 | <hbox> |
140 | <vbox pack="center"> | 140 | <vbox pack="center"> |
141 | <label control="search_for" value="&panel.search.search_for.label;" accesskey="s"/> | 141 | <label control="search_for" value="&panel.search.search_for.label;" accesskey="s"/> |
142 | </vbox> | 142 | </vbox> |
143 | <textbox id="search_for" flex="1"/> | 143 | <textbox id="search_for" flex="1"/> |
144 | </hbox> | 144 | </hbox> |
145 | <hbox> | 145 | <hbox> |
146 | <checkbox id="search_tags" label="&panel.search.mode.tagsonly.label;" | 146 | <checkbox id="search_tags" label="&panel.search.mode.tagsonly.label;" |
147 | tooltiptext="&panel.search.mode.tagsonly.tip;" checked="false" | 147 | tooltiptext="&panel.search.mode.tagsonly.tip;" checked="false" |
148 | accesskey="t" /> | 148 | accesskey="t" /> |
149 | <checkbox id="search_mine" label="&panel.search.mode.mine.label;" checked="true" accesskey="m"/> | 149 | <checkbox id="search_mine" label="&panel.search.mode.mine.label;" checked="true" accesskey="m"/> |
150 | <spacer flex="1"/> | 150 | <spacer flex="1"/> |
151 | <button class="lean" command="cmd_search"/> | 151 | <button class="lean" command="cmd_search"/> |
152 | </hbox> | 152 | </hbox> |
153 | </groupbox> | 153 | </groupbox> |
154 | <hbox> | 154 | <hbox> |
155 | <button class="lean" command="cmd_search_prev_page"/> | 155 | <button class="lean" command="cmd_search_prev_page"/> |
156 | <spacer flex="1"/> | 156 | <spacer flex="1"/> |
157 | <label id="search_page" hidden="true"/> | 157 | <label id="search_page" hidden="true"/> |
158 | <spacer flex="1"/> | 158 | <spacer flex="1"/> |
159 | <button class="lean" command="cmd_search_next_page"/> | 159 | <button class="lean" command="cmd_search_next_page"/> |
160 | </hbox> | 160 | </hbox> |
161 | <tree id="searchresults" rows="2" flex="1" | 161 | <tree id="searchresults" rows="2" flex="1" |
162 | onselect="fireflix.foundphotos.on_select()" | 162 | onselect="fireflix.foundphotos.on_select()" |
163 | ondblclick="fireflix.foundphotos.on_cmd_open(event)" | 163 | ondblclick="fireflix.foundphotos.on_cmd_open(event)" |
164 | onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.on_cmd_open(event)"> | 164 | onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.foundphotos.on_cmd_open(event)"> |
165 | <treecols> | 165 | <treecols> |
166 | <treecol id="sr_title" label="&panel.search.col.title.label;" flex="2" crop="end" align="start" /> | 166 | <treecol id="sr_title" label="&panel.search.col.title.label;" flex="2" crop="end" align="start" /> |
167 | </treecols> | 167 | </treecols> |
168 | <treechildren/> | 168 | <treechildren/> |
169 | </tree> | 169 | </tree> |
170 | <groupbox id="searchresult_props" orient="horizontal" hidden="true"> | 170 | <groupbox id="searchresult_props" orient="horizontal" hidden="true"> |
171 | <vbox width="100" pack="center"> | 171 | <vbox width="100" pack="center"> |
172 | <hbox pack="center"> | 172 | <hbox pack="center"> |
173 | <image id="search_photo" | 173 | <image id="search_photo" |
174 | ondblclick="fireflix.foundphotos.on_cmd_open(event)"/> | 174 | ondblclick="fireflix.foundphotos.on_cmd_open(event)"/> |
175 | </hbox> | 175 | </hbox> |
176 | </vbox> | 176 | </vbox> |
177 | <vbox flex="1"> | 177 | <vbox flex="1"> |
178 | <label id="searchresult_title" crop="end"/> | 178 | <label id="searchresult_title" crop="end"/> |
179 | <hbox flex="1" pack="center"> | 179 | <hbox flex="1" pack="center"> |
180 | <div flex="1" id="searchresult_description" xmlns="http://www.w3.org/1999/xhtml"/> | 180 | <div flex="1" id="searchresult_description" xmlns="http://www.w3.org/1999/xhtml"/> |
181 | </hbox> | 181 | </hbox> |
182 | <hbox pack="end"> | 182 | <hbox pack="end"> |
183 | <button command="cmd_search_open"/> | 183 | <button command="cmd_search_open"/> |
184 | </hbox> | 184 | </hbox> |
185 | </vbox> | 185 | </vbox> |
186 | </groupbox> | 186 | </groupbox> |
187 | </vbox> | 187 | </vbox> |
188 | </tabpanel> | 188 | </tabpanel> |
189 | 189 | ||
190 | <tabpanel id="tabpanel_sets" flex="1" | 190 | <tabpanel id="tabpanel_sets" flex="1" |
191 | onkeypress="if(event.keyCode==event.DOM_VK_RETURN) | 191 | onkeypress="if(event.keyCode==event.DOM_VK_RETURN) |
192 | document.getElementById('setphotos').focus()"> | 192 | document.getElementById('setphotos').focus()"> |
193 | <vbox flex="1"> | 193 | <vbox flex="1"> |
194 | <tree id="setslist" rows="2" onselect="fireflix.photosets.on_select()" | 194 | <tree id="setslist" rows="2" onselect="fireflix.photosets.on_select()" |
195 | flex="1" context="sets_menu" | 195 | flex="1" context="sets_menu" |
196 | ondblclick="fireflix.photosets.on_cmd_open_in_flickr(event)" | 196 | ondblclick="fireflix.photosets.on_cmd_open_in_flickr(event)" |
197 | > | 197 | > |
198 | <treecols> | 198 | <treecols> |
199 | <treecol id="sl_name" label="&panel.sets.name.label;" flex="4" crop="end" align="start" tooltiptext="&panel.sets.name.tip;"/> | 199 | <treecol id="sl_name" label="&panel.sets.name.label;" flex="4" crop="end" align="start" tooltiptext="&panel.sets.name.tip;"/> |
200 | <splitter class="tree-splitter" /> | 200 | <splitter class="tree-splitter" /> |
201 | <treecol id="sl_photos" label="&panel.sets.photos.label;" flex="1" align="end" tooltiptext="&panel.sets.photos.tip;" /> | 201 | <treecol id="sl_photos" label="&panel.sets.photos.label;" flex="1" align="end" tooltiptext="&panel.sets.photos.tip;" /> |
202 | </treecols> | 202 | </treecols> |
203 | <treechildren/> | 203 | <treechildren/> |
204 | </tree> | 204 | </tree> |
205 | <hbox> | 205 | <hbox> |
206 | <button command="cmd_refresh_sets" /> | 206 | <button command="cmd_refresh_sets" /> |
207 | <button command="cmd_set_props" /> | 207 | <button command="cmd_set_props" /> |
208 | </hbox> | 208 | </hbox> |
209 | <tree id="setphotos" rows="2" onselect="fireflix.photoset.on_select()" | 209 | <tree id="setphotos" rows="2" onselect="fireflix.photoset.on_select()" |
210 | flex="1" ondblclick="fireflix.photoset.on_cmd_open(event)" | 210 | flex="1" ondblclick="fireflix.photoset.on_cmd_open(event)" |
211 | onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.photoset.on_cmd_open(event)" context="setphotos_menu"> | 211 | onkeypress="if(event.keyCode==event.DOM_VK_RETURN) fireflix.photoset.on_cmd_open(event)" context="setphotos_menu"> |
212 | <treecols> | 212 | <treecols> |
213 | <treecol id="sp_title" label="&panel.setphotos.title.label;" flex="1" crop="end" align="start" tooltiptext="&panel.setphotos.title.tip;" /> | 213 | <treecol id="sp_title" label="&panel.setphotos.title.label;" flex="1" crop="end" align="start" tooltiptext="&panel.setphotos.title.tip;" /> |
214 | <splitter class="tree-splitter" /> | 214 | <splitter class="tree-splitter" /> |
215 | <treecol id="sp_taken" label="&panel.setphotos.taken.label;" crop="end" align="start" tooltiptext="&panel.setphotos.taken.tip;" hidden="true" /> | 215 | <treecol id="sp_taken" label="&panel.setphotos.taken.label;" crop="end" align="start" tooltiptext="&panel.setphotos.taken.tip;" hidden="true" /> |
216 | <treecol id="sp_upload" label="&panel.setphotos.upload.label;" crop="end" align="start" tooltiptext="&panel.setphotos.upload.tip;" hidden="true" /> | 216 | <treecol id="sp_upload" label="&panel.setphotos.upload.label;" crop="end" align="start" tooltiptext="&panel.setphotos.upload.tip;" hidden="true" /> |
217 | </treecols> | 217 | </treecols> |
218 | <treechildren/> | 218 | <treechildren/> |
219 | </tree> | 219 | </tree> |
220 | <groupbox id="set_photo_props" orient="horizontal" hidden="true"> | 220 | <groupbox id="set_photo_props" orient="horizontal" hidden="true"> |
221 | <vbox width="100" pack="center"> | 221 | <vbox width="100" pack="center"> |
222 | <hbox pack="center"> | 222 | <hbox pack="center"> |
223 | <image id="set_photo" | 223 | <image id="set_photo" |
224 | ondblclick="fireflix.photoset.on_cmd_open(event)" /> | 224 | ondblclick="fireflix.photoset.on_cmd_open(event)" /> |
225 | </hbox> | 225 | </hbox> |
226 | </vbox> | 226 | </vbox> |
227 | <spacer flex="1"/> | 227 | <spacer flex="1"/> |
228 | </groupbox> | 228 | </groupbox> |
229 | </vbox> | 229 | </vbox> |
230 | </tabpanel> | 230 | </tabpanel> |
231 | 231 | ||
232 | <tabpanel id="tabpanel_tags"> | 232 | <tabpanel id="tabpanel_tags"> |
233 | <listbox id="tagslist" rows="8" flex="1"> | 233 | <listbox id="tagslist" rows="8" flex="1"> |
234 | <listhead> | 234 | <listhead> |
235 | <listheader label="&panel.tagslist.tag.label;"/> | 235 | <listheader label="&panel.tagslist.tag.label;"/> |
236 | </listhead> | 236 | </listhead> |
237 | <listcols> | 237 | <listcols> |
238 | <listcol flex="1"/> | 238 | <listcol flex="1"/> |
239 | </listcols> | 239 | </listcols> |
240 | </listbox> | 240 | </listbox> |
241 | </tabpanel> | 241 | </tabpanel> |
242 | 242 | ||
243 | <tabpanel id="tabpanel_upload"> | 243 | <tabpanel id="tabpanel_upload"> |
244 | <vbox flex="1"> | 244 | <vbox flex="1"> |
245 | <tree id="uploadlist" rows="2" flex="1" | 245 | <tree id="uploadlist" rows="2" flex="1" |
246 | onselect="fireflix.uploads.selectionChanged()" | 246 | onselect="fireflix.uploads.selectionChanged()" |
247 | context="uploads_menu"> | 247 | context="uploads_menu"> |
248 | <treecols> | 248 | <treecols> |
249 | <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/> | 249 | <treecol id="up_file" label="&panel.uploadlist.file.label;" flex="4" crop="start" align="start"/> |
250 | <splitter class="tree-splitter" /> | 250 | <splitter class="tree-splitter" /> |
251 | <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" /> | 251 | <treecol id="up_title" label="&panel.uploadlist.title.label;" flex="5" crop="end" align="start" /> |
252 | <splitter class="tree-splitter" /> | 252 | <splitter class="tree-splitter" /> |
253 | <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" /> | 253 | <treecol id="up_status" label="&panel.uploadlist.status.label;" flex="1" crop="end" align="start" /> |
254 | </treecols> | 254 | </treecols> |
255 | <treechildren/> | 255 | <treechildren/> |
256 | </tree> | 256 | </tree> |
257 | <progressmeter id="upload_progress" mode="undetermined" hidden="true" /> | 257 | <progressmeter id="upload_progress" mode="undetermined" hidden="true" /> |
258 | <groupbox id="upload_file_props" orient="horizontal" hidden="true"> | 258 | <groupbox id="upload_file_props" orient="vertical" hidden="true"> |
259 | <image id="upload_file_preview" width="100" height="100" /> | 259 | <hbox> |
260 | <grid flex="1"> | 260 | <image id="upload_file_preview" width="100" height="100" /> |
261 | <columns> | 261 | <grid flex="1"> |
262 | <column/> | 262 | <columns> |
263 | <column flex="1"/> | 263 | <column/> |
264 | </columns> | 264 | <column flex="1"/> |
265 | <rows> | 265 | </columns> |
266 | <row> | 266 | <rows> |
267 | <label control="upload_filename" | 267 | <row> |
268 | value="&panel.upload_props.filename.label;" /> | 268 | <label control="upload_filename" |
269 | <textbox id="upload_filename" | 269 | value="&panel.upload_props.filename.label;" /> |
270 | oninput="fireflix.uploads.propsToSel('filename')"/> | 270 | <textbox id="upload_filename" |
271 | </row> | 271 | oninput="fireflix.uploads.propsToSel('filename')"/> |
272 | <row> | 272 | </row> |
273 | <label control="upload_title" value="&panel.upload_props.title.label;" /> | 273 | <row> |
274 | <textbox id="upload_title" | 274 | <label control="upload_title" value="&panel.upload_props.title.label;" /> |
275 | oninput="fireflix.uploads.propsToSel('title')"/> | 275 | <textbox id="upload_title" |
276 | </row> | 276 | oninput="fireflix.uploads.propsToSel('title')"/> |
277 | <row> | 277 | </row> |
278 | <label control="uplod_tags" value="&panel.upload_props.tags.label;" /> | 278 | <row> |
279 | <textbox id="upload_tags" | 279 | <label control="upload_tags" value="&panel.upload_props.tags.label;" /> |
280 | oninput="fireflix.uploads.propsToSel('tags')"/> | 280 | <textbox id="upload_tags" |
281 | </row> | 281 | oninput="fireflix.uploads.propsToSel('tags')"/> |
282 | <!-- TODO: description, public, friend, family --> | 282 | </row> |
283 | </rows> | 283 | <!-- TODO: description, public, friend, family --> |
284 | </grid> | 284 | </rows> |
285 | </grid> | ||
286 | </hbox> | ||
287 | <description id="upload_failure" hidden="true"/> | ||
285 | </groupbox> | 288 | </groupbox> |
286 | <hbox> | 289 | <hbox> |
287 | <button class="lean" command="cmd_uploads_add" /> | 290 | <button class="lean" command="cmd_uploads_add" /> |
288 | <spacer flex="1"/> | 291 | <spacer flex="1"/> |
289 | <button class="lean" command="cmd_uploads_remove" /> | 292 | <button class="lean" command="cmd_uploads_remove" /> |
290 | <spacer flex="1"/> | 293 | <spacer flex="1"/> |
291 | <button class="lean" command="cmd_uploads_clear" /> | 294 | <button class="lean" command="cmd_uploads_clear" /> |
292 | </hbox> | 295 | </hbox> |
293 | <hbox pack="center"> | 296 | <hbox pack="center"> |
294 | <button command="cmd_uploads_upload" flex="1"/> | 297 | <button command="cmd_uploads_upload" flex="1"/> |
295 | </hbox> | 298 | </hbox> |
296 | </vbox> | 299 | </vbox> |
297 | </tabpanel> | 300 | </tabpanel> |
298 | 301 | ||
299 | </tabpanels> | 302 | </tabpanels> |
300 | 303 | ||
301 | </tabbox> | 304 | </tabbox> |
302 | 305 | ||
303 | </vbox> | 306 | </vbox> |
304 | 307 | ||
305 | </page> | 308 | </page> |
diff --git a/content/fireflix.css b/content/fireflix.css index ab90c11..06ae28a 100644 --- a/content/fireflix.css +++ b/content/fireflix.css | |||
@@ -1,125 +1,133 @@ | |||
1 | html#help, | 1 | html#help, |
2 | .generated.wholething, .about.wholething /* XXX:, | 2 | .generated.wholething, .about.wholething /* XXX:, |
3 | tabbox, tabpanels, tabpanel */ { | 3 | tabbox, tabpanels, tabpanel */ { |
4 | background: url("background.jpeg"); | 4 | background: url("background.jpeg"); |
5 | } | 5 | } |
6 | tabpanels { | 6 | tabpanels { |
7 | padding: 0px; | 7 | padding: 0px; |
8 | } | 8 | } |
9 | 9 | ||
10 | tree { | 10 | tree { |
11 | margin-top: 2px; | 11 | margin-top: 2px; |
12 | color: #2d354a; | 12 | color: #2d354a; |
13 | font-size: 90%; | 13 | font-size: 90%; |
14 | } | 14 | } |
15 | tree treechildren { /* for windows */ | 15 | tree treechildren { /* for windows */ |
16 | background: #c5ffc5; | 16 | background: #c5ffc5; |
17 | } | 17 | } |
18 | 18 | ||
19 | tree#uploadlist treechildren::-moz-tree-cell-text(pending) { | 19 | tree#uploadlist treechildren::-moz-tree-cell-text(pending) { |
20 | } | 20 | } |
21 | tree#uploadlist treechildren::-moz-tree-cell-text(completed) { | 21 | tree#uploadlist treechildren::-moz-tree-cell-text(completed) { |
22 | color: black; | 22 | color: black; |
23 | } | 23 | } |
24 | tree#uploadlist treechildren::-moz-tree-row(failed) { | 24 | tree#uploadlist treechildren::-moz-tree-row(failed) { |
25 | background: yellow; | 25 | background: yellow; |
26 | } | 26 | } |
27 | tree#uploadlist treechildren::-moz-tree-cell-text(failed) { | 27 | tree#uploadlist treechildren::-moz-tree-cell-text(failed) { |
28 | color: red; | 28 | color: red; |
29 | } | 29 | } |
30 | tree#uploadlist treechildren::-moz-tree-cell-text(uploading) { | 30 | tree#uploadlist treechildren::-moz-tree-cell-text(uploading) { |
31 | font-weight: bold; | 31 | font-weight: bold; |
32 | } | 32 | } |
33 | 33 | ||
34 | groupbox#searchresult_props, | 34 | groupbox#searchresult_props, |
35 | groupbox.search_params, | 35 | groupbox.search_params, |
36 | groupbox#upload_file_props, | 36 | groupbox#upload_file_props, |
37 | groupbox#set_props, | 37 | groupbox#set_props, |
38 | groupbox#set_photo_props { | 38 | groupbox#set_photo_props { |
39 | background: white; | 39 | background: white; |
40 | } | 40 | } |
41 | 41 | ||
42 | groupbox#upload_file_props label { | 42 | groupbox#upload_file_props label { |
43 | text-align: right; | 43 | text-align: right; |
44 | } | 44 | } |
45 | 45 | ||
46 | description#upload_failure { | ||
47 | border-top: solid 1px red; | ||
48 | margin: 0px; padding: 2px; | ||
49 | text-align: left; | ||
50 | font-size: 85%; | ||
51 | line-height: 105%; | ||
52 | } | ||
53 | |||
46 | image#search_photo, image#set_photo, image#set_primary { | 54 | image#search_photo, image#set_photo, image#set_primary { |
47 | border: black 1px solid; | 55 | border: black 1px solid; |
48 | } | 56 | } |
49 | 57 | ||
50 | .about .insides { | 58 | .about .insides { |
51 | margin: 1ex; | 59 | margin: 1ex; |
52 | } | 60 | } |
53 | .about .text { | 61 | .about .text { |
54 | border: yellow solid 1px; | 62 | border: yellow solid 1px; |
55 | background: green; | 63 | background: green; |
56 | } | 64 | } |
57 | .about .title { | 65 | .about .title { |
58 | font-size: 300%; | 66 | font-size: 300%; |
59 | font-weight: bold; | 67 | font-weight: bold; |
60 | color: yellow; | 68 | color: yellow; |
61 | } | 69 | } |
62 | .about .link { | 70 | .about .link { |
63 | text-decoration: underline; | 71 | text-decoration: underline; |
64 | color: white; | 72 | color: white; |
65 | cursor: pointer; | 73 | cursor: pointer; |
66 | } | 74 | } |
67 | 75 | ||
68 | menuitem.menuhead { | 76 | menuitem.menuhead { |
69 | background: gray; | 77 | background: gray; |
70 | color: black; | 78 | color: black; |
71 | font-weight: bold; | 79 | font-weight: bold; |
72 | } | 80 | } |
73 | 81 | ||
74 | div#searchresult_description { | 82 | div#searchresult_description { |
75 | min-height: 5em; max-height: 8em; | 83 | min-height: 5em; max-height: 8em; |
76 | overflow: auto; | 84 | overflow: auto; |
77 | font-size: 90%; | 85 | font-size: 90%; |
78 | margin: 0.1ex 0.5ex; | 86 | margin: 0.1ex 0.5ex; |
79 | } | 87 | } |
80 | 88 | ||
81 | #copying div { | 89 | #copying div { |
82 | margin: 1ex 1em; | 90 | margin: 1ex 1em; |
83 | font-family: courier, monospace; | 91 | font-family: courier, monospace; |
84 | font-size: 9pt; | 92 | font-size: 9pt; |
85 | padding: 2px; | 93 | padding: 2px; |
86 | border: dotted 1px gray; | 94 | border: dotted 1px gray; |
87 | background: white; | 95 | background: white; |
88 | } | 96 | } |
89 | 97 | ||
90 | label#search_page { | 98 | label#search_page { |
91 | font-weight: bold; | 99 | font-weight: bold; |
92 | background: white; color: #404040; | 100 | background: white; color: #404040; |
93 | border-color: #c0c0c0 #404040 #404040 #c0c0c0; | 101 | border-color: #c0c0c0 #404040 #404040 #c0c0c0; |
94 | border-style: solid; | 102 | border-style: solid; |
95 | border-width: 1px; | 103 | border-width: 1px; |
96 | -moz-border-radius: 1em; | 104 | -moz-border-radius: 1em; |
97 | padding: 0.5ex 1ex; | 105 | padding: 0.5ex 1ex; |
98 | } | 106 | } |
99 | 107 | ||
100 | html body { | 108 | html body { |
101 | font-family: arial, sans-serif; | 109 | font-family: arial, sans-serif; |
102 | font-size: 11pt; | 110 | font-size: 11pt; |
103 | margin: 1em 4em; | 111 | margin: 1em 4em; |
104 | padding: 1em 4em; | 112 | padding: 1em 4em; |
105 | border: double 3px gray; | 113 | border: double 3px gray; |
106 | background: #ffffc0; | 114 | background: #ffffc0; |
107 | } | 115 | } |
108 | html h1 { | 116 | html h1 { |
109 | font-size: 130%; color: maroon; | 117 | font-size: 130%; color: maroon; |
110 | } | 118 | } |
111 | html p { | 119 | html p { |
112 | text-align: justify; | 120 | text-align: justify; |
113 | } | 121 | } |
114 | 122 | ||
115 | html div.copyright { | 123 | html div.copyright { |
116 | font-size: 60%; | 124 | font-size: 60%; |
117 | text-align: right; | 125 | text-align: right; |
118 | } | 126 | } |
119 | html div.copyright a { | 127 | html div.copyright a { |
120 | text-decoration: none; | 128 | text-decoration: none; |
121 | } | 129 | } |
122 | 130 | ||
123 | button.lean { | 131 | button.lean { |
124 | min-width: 1ex; | 132 | min-width: 1ex; |
125 | } | 133 | } |
diff --git a/content/fireflix.js b/content/fireflix.js index 995ec5c..7291b68 100644 --- a/content/fireflix.js +++ b/content/fireflix.js | |||
@@ -79,722 +79,733 @@ var fireflix = { | |||
79 | on_cmd_auth_unauth: function() { | 79 | on_cmd_auth_unauth: function() { |
80 | this.flickr.reset_token(); | 80 | this.flickr.reset_token(); |
81 | this.set_auth_state(false,false); | 81 | this.set_auth_state(false,false); |
82 | }, | 82 | }, |
83 | 83 | ||
84 | refresh_sets: function() { this.photosets.refresh_sets(); }, | 84 | refresh_sets: function() { this.photosets.refresh_sets(); }, |
85 | refresh_stuff: function() { | 85 | refresh_stuff: function() { |
86 | this.refresh_sets(); | 86 | this.refresh_sets(); |
87 | this.refresh_user_tags(); | 87 | this.refresh_user_tags(); |
88 | }, | 88 | }, |
89 | 89 | ||
90 | /* photoset treeview */ | 90 | /* photoset treeview */ |
91 | photoset: { | 91 | photoset: { |
92 | photos: new Array(), | 92 | photos: new Array(), |
93 | fireflix: null, | 93 | fireflix: null, |
94 | init: function(f) { | 94 | init: function(f) { |
95 | this.fireflix = f; | 95 | this.fireflix = f; |
96 | pull_elements(this,document,[ 'set_photo', 'set_photo_props' ]); | 96 | pull_elements(this,document,[ 'set_photo', 'set_photo_props' ]); |
97 | document.getElementById('setphotos').view = this; | 97 | document.getElementById('setphotos').view = this; |
98 | }, | 98 | }, |
99 | rowCount: 0, | 99 | rowCount: 0, |
100 | getCellText: function(r,c) { | 100 | getCellText: function(r,c) { |
101 | var p = this.photos[r]; | 101 | var p = this.photos[r]; |
102 | if(c.id=='sp_title') return p.title; | 102 | if(c.id=='sp_title') return p.title; |
103 | if(c.id=='sp_taken') return p.datetaken; | 103 | if(c.id=='sp_taken') return p.datetaken; |
104 | if(c.id=='sp_upload') { | 104 | if(c.id=='sp_upload') { |
105 | var du = new Date(p.dateupload*1000); | 105 | var du = new Date(p.dateupload*1000); |
106 | var rv = du.getFullYear()+'-'+(du.getMonth()+1)+'-'+du.getDate() | 106 | var rv = du.getFullYear()+'-'+(du.getMonth()+1)+'-'+du.getDate() |
107 | +' '+ | 107 | +' '+ |
108 | du.getHours()+':'+du.getMinutes()+':'+du.getSeconds(); | 108 | du.getHours()+':'+du.getMinutes()+':'+du.getSeconds(); |
109 | return rv.replace(/(\D)(\d)(\D)/,'$10$2$3'); | 109 | return rv.replace(/(\D)(\d)(\D)/,'$10$2$3'); |
110 | } | 110 | } |
111 | return c.id; | 111 | return c.id; |
112 | }, | 112 | }, |
113 | setTree: function(t) { this.tree = t }, | 113 | setTree: function(t) { this.tree = t }, |
114 | isContainer: function(r) { return false; }, | 114 | isContainer: function(r) { return false; }, |
115 | isSeparator: function(r) { return false; }, | 115 | isSeparator: function(r) { return false; }, |
116 | isSorted: function(r) { return false; }, | 116 | isSorted: function(r) { return false; }, |
117 | getLevel: function(r) { return 0; }, | 117 | getLevel: function(r) { return 0; }, |
118 | getImageSrc: function(r,c) { return null }, | 118 | getImageSrc: function(r,c) { return null }, |
119 | getRowProperties: function(r,p) {}, | 119 | getRowProperties: function(r,p) {}, |
120 | getCellProperties: function(cid,cel,p) {}, | 120 | getCellProperties: function(cid,cel,p) {}, |
121 | getColumnProperties: function(cid,cel,p) { }, | 121 | getColumnProperties: function(cid,cel,p) { }, |
122 | cycleHeader: function(cid,e) { }, | 122 | cycleHeader: function(cid,e) { }, |
123 | getParentIndex: function(r) { return -1; }, | 123 | getParentIndex: function(r) { return -1; }, |
124 | drop: function(r,o) { }, | 124 | drop: function(r,o) { }, |
125 | canDropBeforeAfter: function(r,b) { return false }, | 125 | canDropBeforeAfter: function(r,b) { return false }, |
126 | 126 | ||
127 | importXPR: function(xp) { | 127 | importXPR: function(xp) { |
128 | this.tree.beginUpdateBatch(); | 128 | this.tree.beginUpdateBatch(); |
129 | this.photos = new Array(); | 129 | this.photos = new Array(); |
130 | var n; while(n=xp.iterateNext()) { | 130 | var n; while(n=xp.iterateNext()) { |
131 | this.photos.push(new Photo(n)); | 131 | this.photos.push(new Photo(n)); |
132 | } | 132 | } |
133 | this.rowCount = this.photos.length; | 133 | this.rowCount = this.photos.length; |
134 | this.tree.endUpdateBatch(); | 134 | this.tree.endUpdateBatch(); |
135 | this.selection.clearSelection(); | 135 | this.selection.clearSelection(); |
136 | }, | 136 | }, |
137 | load_photos: function(psid) { | 137 | load_photos: function(psid) { |
138 | var _this = this; | 138 | var _this = this; |
139 | this.fireflix.flickr.api_call( | 139 | this.fireflix.flickr.api_call( |
140 | { | 140 | { |
141 | method: 'flickr.photosets.getPhotos', | 141 | method: 'flickr.photosets.getPhotos', |
142 | auth_token: 'default', | 142 | auth_token: 'default', |
143 | photoset_id: psid, | 143 | photoset_id: psid, |
144 | extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update' | 144 | extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update' |
145 | }, function(xr) { | 145 | }, function(xr) { |
146 | var x = xr.responseXML; | 146 | var x = xr.responseXML; |
147 | var xp = x.evaluate( | 147 | var xp = x.evaluate( |
148 | '/rsp/photoset/photo', x, null, | 148 | '/rsp/photoset/photo', x, null, |
149 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); | 149 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); |
150 | _this.importXPR(xp); | 150 | _this.importXPR(xp); |
151 | }, function(x,s,c,m) { | 151 | }, function(x,s,c,m) { |
152 | _this.fireflix.flickr_failure(x,s,c,m); | 152 | _this.fireflix.flickr_failure(x,s,c,m); |
153 | } | 153 | } |
154 | ); | 154 | ); |
155 | }, | 155 | }, |
156 | on_select: function() { | 156 | on_select: function() { |
157 | if(this.selection.count==1) { | 157 | if(this.selection.count==1) { |
158 | var p = this.photos[this.selection.currentIndex]; | 158 | var p = this.photos[this.selection.currentIndex]; |
159 | this.set_photo.src = | 159 | this.set_photo.src = |
160 | this.fireflix.flickr.get_photo_url(p.server,p.id,p.secret,'t'); | 160 | this.fireflix.flickr.get_photo_url(p.server,p.id,p.secret,'t'); |
161 | this.set_photo_props.hidden = false; | 161 | this.set_photo_props.hidden = false; |
162 | }else{ | 162 | }else{ |
163 | this.set_photo_props.hidden = true; | 163 | this.set_photo_props.hidden = true; |
164 | } | 164 | } |
165 | }, | 165 | }, |
166 | on_cmd_open: function(ev) { | 166 | on_cmd_open: function(ev) { |
167 | if(this.selection.currentIndex<0) return; | 167 | if(this.selection.currentIndex<0) return; |
168 | var p = this.photos[this.selection.currentIndex]; | 168 | var p = this.photos[this.selection.currentIndex]; |
169 | if(!p.id) return; | 169 | if(!p.id) return; |
170 | this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); | 170 | this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); |
171 | } | 171 | } |
172 | }, | 172 | }, |
173 | 173 | ||
174 | /* photosets treeview */ | 174 | /* photosets treeview */ |
175 | photosets: { | 175 | photosets: { |
176 | sets: new Array(), | 176 | sets: new Array(), |
177 | fireflix: null, | 177 | fireflix: null, |
178 | init: function(f) { | 178 | init: function(f) { |
179 | this.fireflix = f; | 179 | this.fireflix = f; |
180 | document.getElementById('setslist').view = this; | 180 | document.getElementById('setslist').view = this; |
181 | }, | 181 | }, |
182 | rowCount: 0, | 182 | rowCount: 0, |
183 | getCellText: function(r,c) { | 183 | getCellText: function(r,c) { |
184 | var s = this.sets[r]; | 184 | var s = this.sets[r]; |
185 | if(c.id=='sl_name') return s.title; | 185 | if(c.id=='sl_name') return s.title; |
186 | if(c.id=='sl_photos') return s.photos; | 186 | if(c.id=='sl_photos') return s.photos; |
187 | return c.id; | 187 | return c.id; |
188 | }, | 188 | }, |
189 | setTree: function(t) { this.tree = t }, | 189 | setTree: function(t) { this.tree = t }, |
190 | isContainer: function(r) { return false; }, | 190 | isContainer: function(r) { return false; }, |
191 | isSeparator: function(r) { return false; }, | 191 | isSeparator: function(r) { return false; }, |
192 | isSorted: function() { return false; }, | 192 | isSorted: function() { return false; }, |
193 | getLevel: function(r) { return 0; }, | 193 | getLevel: function(r) { return 0; }, |
194 | getImageSrc: function(r,c) { return null }, | 194 | getImageSrc: function(r,c) { return null }, |
195 | getRowProperties: function(r,p) {}, | 195 | getRowProperties: function(r,p) {}, |
196 | getCellProperties: function(cid,cel,p) { }, | 196 | getCellProperties: function(cid,cel,p) { }, |
197 | getColumnProperties: function(cid,cel,p) { }, | 197 | getColumnProperties: function(cid,cel,p) { }, |
198 | cycleHeader: function(cid,e) { }, | 198 | cycleHeader: function(cid,e) { }, |
199 | getParentIndex: function(r) { return -1; }, | 199 | getParentIndex: function(r) { return -1; }, |
200 | drop: function(r,o) { }, | 200 | drop: function(r,o) { }, |
201 | canDropBeforeAfter: function(r,b) { return false }, | 201 | canDropBeforeAfter: function(r,b) { return false }, |
202 | 202 | ||
203 | importXPR: function(xp) { | 203 | importXPR: function(xp) { |
204 | this.tree.beginUpdateBatch(); | 204 | this.tree.beginUpdateBatch(); |
205 | this.sets = new Array(); | 205 | this.sets = new Array(); |
206 | var n; while(n=xp.iterateNext()) { | 206 | var n; while(n=xp.iterateNext()) { |
207 | this.sets.push(new Photoset(n)); | 207 | this.sets.push(new Photoset(n)); |
208 | } | 208 | } |
209 | this.rowCount = this.sets.length; | 209 | this.rowCount = this.sets.length; |
210 | this.tree.endUpdateBatch(); | 210 | this.tree.endUpdateBatch(); |
211 | }, | 211 | }, |
212 | refresh_sets: function() { | 212 | refresh_sets: function() { |
213 | var _this = this; | 213 | var _this = this; |
214 | this.fireflix.flickr.api_call( | 214 | this.fireflix.flickr.api_call( |
215 | { | 215 | { |
216 | method: 'flickr.photosets.getList', | 216 | method: 'flickr.photosets.getList', |
217 | auth_token: 'default' | 217 | auth_token: 'default' |
218 | }, function(xr) { | 218 | }, function(xr) { |
219 | var x = xr.responseXML; | 219 | var x = xr.responseXML; |
220 | var xp = x.evaluate( | 220 | var xp = x.evaluate( |
221 | '/rsp/photosets/photoset', x, null, | 221 | '/rsp/photosets/photoset', x, null, |
222 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); | 222 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); |
223 | _this.importXPR(xp); | 223 | _this.importXPR(xp); |
224 | }, function(x,s,c,m) { | 224 | }, function(x,s,c,m) { |
225 | _this.fireflix.flickr_failure(x,s,c,m); | 225 | _this.fireflix.flickr_failure(x,s,c,m); |
226 | } | 226 | } |
227 | ); | 227 | ); |
228 | }, | 228 | }, |
229 | on_select: function() { | 229 | on_select: function() { |
230 | if(this.selection.count==1) { | 230 | if(this.selection.count==1) { |
231 | this.fireflix.cmd_set_props.setAttribute('disabled','false'); | 231 | this.fireflix.cmd_set_props.setAttribute('disabled','false'); |
232 | var s = this.sets[this.selection.currentIndex]; | 232 | var s = this.sets[this.selection.currentIndex]; |
233 | this.fireflix.photoset.load_photos(s.id); | 233 | this.fireflix.photoset.load_photos(s.id); |
234 | }else{ | 234 | }else{ |
235 | this.fireflix.cmd_set_props.setAttribute('disabled','true'); | 235 | this.fireflix.cmd_set_props.setAttribute('disabled','true'); |
236 | } | 236 | } |
237 | }, | 237 | }, |
238 | on_cmd_open_in_flickr: function(ev) { | 238 | on_cmd_open_in_flickr: function(ev) { |
239 | if(this.selection.currentIndex<0) return; | 239 | if(this.selection.currentIndex<0) return; |
240 | var p = this.sets[this.selection.currentIndex]; | 240 | var p = this.sets[this.selection.currentIndex]; |
241 | if(!p.id) return; | 241 | if(!p.id) return; |
242 | this.fireflix.openTab(this.fireflix.flickr.make_photoset_url(p)); | 242 | this.fireflix.openTab(this.fireflix.flickr.make_photoset_url(p)); |
243 | } | 243 | } |
244 | }, | 244 | }, |
245 | 245 | ||
246 | refresh_user_tags: function() { | 246 | refresh_user_tags: function() { |
247 | var lb = document.getElementById('tagslist'); | 247 | var lb = document.getElementById('tagslist'); |
248 | var _this = this; | 248 | var _this = this; |
249 | this.flickr.api_call( | 249 | this.flickr.api_call( |
250 | { | 250 | { |
251 | method: 'flickr.tags.getListUser', | 251 | method: 'flickr.tags.getListUser', |
252 | auth_token: 'default', | 252 | auth_token: 'default', |
253 | }, function(xr) { | 253 | }, function(xr) { |
254 | var x = xr.responseXML; | 254 | var x = xr.responseXML; |
255 | var xp = x.evaluate( | 255 | var xp = x.evaluate( |
256 | '/rsp/who/tags/tag', x, null, | 256 | '/rsp/who/tags/tag', x, null, |
257 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); | 257 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); |
258 | // TODO: clear list | 258 | // TODO: clear list |
259 | var n; while(n=xp.iterateNext()) { | 259 | var n; while(n=xp.iterateNext()) { |
260 | lb.appendItem(n.firstChild.nodeValue); | 260 | lb.appendItem(n.firstChild.nodeValue); |
261 | } | 261 | } |
262 | }, function(x,s,c,m) { | 262 | }, function(x,s,c,m) { |
263 | _this.flickr_failure(x,s,c,m); | 263 | _this.flickr_failure(x,s,c,m); |
264 | } | 264 | } |
265 | ); | 265 | ); |
266 | }, | 266 | }, |
267 | 267 | ||
268 | uploadObserver: { | 268 | uploadObserver: { |
269 | fireflix: null, | 269 | fireflix: null, |
270 | init: function(f) { | 270 | init: function(f) { |
271 | this.fireflix = f; | 271 | this.fireflix = f; |
272 | }, | 272 | }, |
273 | getSupportedFlavours: function() { | 273 | getSupportedFlavours: function() { |
274 | var rv = new FlavourSet(); | 274 | var rv = new FlavourSet(); |
275 | rv.appendFlavour('application/x-moz-file','nsIFile'); | 275 | rv.appendFlavour('application/x-moz-file','nsIFile'); |
276 | rv.appendFlavour('application/x-moz-url'); | 276 | rv.appendFlavour('application/x-moz-url'); |
277 | rv.appendFlavour('text/uri-list'); | 277 | rv.appendFlavour('text/uri-list'); |
278 | rv.appendFlavour('text/unicode'); | 278 | rv.appendFlavour('text/unicode'); |
279 | return rv; | 279 | return rv; |
280 | }, | 280 | }, |
281 | canHandleMultipleItems: true, | 281 | canHandleMultipleItems: true, |
282 | onDragOver: function(ev,fl,sess) { | 282 | onDragOver: function(ev,fl,sess) { |
283 | return true; | 283 | return true; |
284 | }, | 284 | }, |
285 | onDrop: function(ev,dd,s) { | 285 | onDrop: function(ev,dd,s) { |
286 | var ldf = null; | 286 | var ldf = null; |
287 | for(var i in dd.dataList) { | 287 | for(var i in dd.dataList) { |
288 | var di = dd.dataList[i]; | 288 | var di = dd.dataList[i]; |
289 | var dif = di.first; | 289 | var dif = di.first; |
290 | if( | 290 | if( |
291 | ldf==null | 291 | ldf==null |
292 | || ldf.flavour.contentType!=dif.flavour.contentType | 292 | || ldf.flavour.contentType!=dif.flavour.contentType |
293 | || ldf.contentLength!=dif.contentLength | 293 | || ldf.contentLength!=dif.contentLength |
294 | || ldf.data!=dif.data ) | 294 | || ldf.data!=dif.data ) |
295 | this.drop_item(ev,di,s); | 295 | this.drop_item(ev,di,s); |
296 | ldf = dif; | 296 | ldf = dif; |
297 | } | 297 | } |
298 | }, | 298 | }, |
299 | drop_item: function(ev,di,s) { | 299 | drop_item: function(ev,di,s) { |
300 | var d = di.first; | 300 | var d = di.first; |
301 | switch(d.flavour.contentType) { | 301 | switch(d.flavour.contentType) { |
302 | case 'text/unicode': | 302 | case 'text/unicode': |
303 | this.drop_urilist(ev,d.data,s); | 303 | this.drop_urilist(ev,d.data,s); |
304 | break; | 304 | break; |
305 | case 'application/x-moz-file': | 305 | case 'application/x-moz-file': |
306 | this.fireflix.uploads.add(d.data.path); | 306 | this.fireflix.uploads.add(d.data.path); |
307 | document.getElementById('fireflix_tabs').selectedTab | 307 | document.getElementById('fireflix_tabs').selectedTab |
308 | = document.getElementById('tab_upload'); | 308 | = document.getElementById('tab_upload'); |
309 | break; | 309 | break; |
310 | case 'text/uri-list': | 310 | case 'text/uri-list': |
311 | // is it ascii or could it be utf8? | 311 | // is it ascii or could it be utf8? |
312 | this.drop_urilist(ev,splitascii(d.data),s); | 312 | this.drop_urilist(ev,splitascii(d.data),s); |
313 | break; | 313 | break; |
314 | default: alert(d.flavour.contentType+':'+d.data); break; | 314 | default: alert(d.flavour.contentType+':'+d.data); break; |
315 | }; | 315 | }; |
316 | }, | 316 | }, |
317 | drop_urilist: function(ev,ul,s) { | 317 | drop_urilist: function(ev,ul,s) { |
318 | // TODO: check for being a file? | 318 | // TODO: check for being a file? |
319 | var us = decodeURIComponent(ul).split(/[\r\n]/); | 319 | var us = decodeURIComponent(ul).split(/[\r\n]/); |
320 | for(var ui in us) | 320 | for(var ui in us) |
321 | if(/\S/.test(us[ui])) | 321 | if(/\S/.test(us[ui])) |
322 | this.fireflix.uploads.add(us[ui]); | 322 | this.fireflix.uploads.add(us[ui]); |
323 | document.getElementById('fireflix_tabs').selectedTab | 323 | document.getElementById('fireflix_tabs').selectedTab |
324 | = document.getElementById('tab_upload'); | 324 | = document.getElementById('tab_upload'); |
325 | } | 325 | } |
326 | }, | 326 | }, |
327 | 327 | ||
328 | uploads: { | 328 | uploads: { |
329 | fireflix: null, | 329 | fireflix: null, |
330 | init: function(f) { | 330 | init: function(f) { |
331 | this.fireflix=f; | 331 | this.fireflix=f; |
332 | pull_elements(this,document,[ | 332 | pull_elements(this,document,[ |
333 | 'upload_filename','upload_title','upload_file_preview', | 333 | 'upload_filename','upload_title','upload_file_preview', |
334 | 'upload_file_props','upload_progress','upload_tags', | 334 | 'upload_file_props','upload_progress','upload_tags', |
335 | 'cmd_uploads_upload' | 335 | 'cmd_uploads_upload', 'upload_failure' |
336 | ]); | 336 | ]); |
337 | document.getElementById('uploadlist').view = this; | 337 | document.getElementById('uploadlist').view = this; |
338 | }, | 338 | }, |
339 | files: new Array(), | 339 | files: new Array(), |
340 | rowCount: 0, | 340 | rowCount: 0, |
341 | getCellText: function(r,c) { | 341 | getCellText: function(r,c) { |
342 | var f = this.files[r]; | 342 | var f = this.files[r]; |
343 | if(c.id=='up_file') return f.file; | 343 | if(c.id=='up_file') return f.file; |
344 | if(c.id=='up_title') return f.title; | 344 | if(c.id=='up_title') return f.title; |
345 | if(c.id=='up_status') return f.state; | 345 | if(c.id=='up_status') return f.state; |
346 | return c.id; | 346 | return c.id; |
347 | }, | 347 | }, |
348 | setTree: function(t) { this.tree = t }, | 348 | setTree: function(t) { this.tree = t }, |
349 | isContainer: function(r) { return false; }, | 349 | isContainer: function(r) { return false; }, |
350 | isSeparator: function(r) { return false; }, | 350 | isSeparator: function(r) { return false; }, |
351 | isSorted: function(r) { return false; }, | 351 | isSorted: function(r) { return false; }, |
352 | getLevel: function(r) { return 0; }, | 352 | getLevel: function(r) { return 0; }, |
353 | getImageSrc: function(r,c) { return null }, | 353 | getImageSrc: function(r,c) { return null }, |
354 | getRowProperties: function(r,p) { | 354 | getRowProperties: function(r,p) { |
355 | try { | 355 | try { |
356 | if(!Components) return; | 356 | if(!Components) return; |
357 | }catch(e) { return } | 357 | }catch(e) { return } |
358 | var f = this.files[r]; | 358 | var f = this.files[r]; |
359 | var as = Components.classes['@mozilla.org/atom-service;1']. | 359 | var as = Components.classes['@mozilla.org/atom-service;1']. |
360 | getService(Components.interfaces.nsIAtomService); | 360 | getService(Components.interfaces.nsIAtomService); |
361 | p.AppendElement(as.getAtom(f.state)); | 361 | p.AppendElement(as.getAtom(f.state)); |
362 | }, | 362 | }, |
363 | getCellProperties: function(r,c,p) { this.getRowProperties(r,p); }, | 363 | getCellProperties: function(r,c,p) { this.getRowProperties(r,p); }, |
364 | getColumnProperties: function(c,p) { }, | 364 | getColumnProperties: function(c,p) { }, |
365 | cycleHeader: function(cid,e) { }, | 365 | cycleHeader: function(cid,e) { }, |
366 | getParentIndex: function(r) { return -1; }, | 366 | getParentIndex: function(r) { return -1; }, |
367 | drop: function(r,o) { }, | 367 | drop: function(r,o) { }, |
368 | canDropBeforeAfter: function(r,b) { return false }, | 368 | canDropBeforeAfter: function(r,b) { return false }, |
369 | 369 | ||
370 | add: function(f) { | 370 | add: function(f) { |
371 | if(f.indexOf('file:/')==0) { | 371 | if(f.indexOf('file:/')==0) { |
372 | f = f.substr(5); | 372 | f = f.substr(5); |
373 | while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-) | 373 | while(f.substr(0,2)=='//') { // XXX: not very performant, is it? ;-) |
374 | f = f.substr(1); | 374 | f = f.substr(1); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | var t = f; | 377 | var t = f; |
378 | var ls = t.lastIndexOf('/'); | 378 | var ls = t.lastIndexOf('/'); |
379 | if(ls>0) t = t.substr(ls+1); | 379 | if(ls>0) t = t.substr(ls+1); |
380 | ls = t.lastIndexOf('\\'); | 380 | ls = t.lastIndexOf('\\'); |
381 | if(ls>0) t = t.substr(ls+1); | 381 | if(ls>0) t = t.substr(ls+1); |
382 | var ld = t.lastIndexOf('.'); | 382 | var ld = t.lastIndexOf('.'); |
383 | if(ld>0) t = t.substr(0,ld); | 383 | if(ld>0) t = t.substr(0,ld); |
384 | this.files.push( { | 384 | this.files.push( { |
385 | file: f, | 385 | file: f, |
386 | title: t, | 386 | title: t, |
387 | tags: '', | 387 | tags: '', |
388 | state: 'pending' | 388 | state: 'pending' |
389 | } ); | 389 | } ); |
390 | this.rowCount = this.files.length; | 390 | this.rowCount = this.files.length; |
391 | this.tree.rowCountChanged(this.rowCount-1,1); | 391 | this.tree.rowCountChanged(this.rowCount-1,1); |
392 | }, | 392 | }, |
393 | 393 | ||
394 | upload_worker: function() { | 394 | upload_worker: function() { |
395 | for(var f in this.files) { | 395 | for(var f in this.files) { |
396 | if(this.files[f].state=='pending') { | 396 | if(this.files[f].state=='pending') { |
397 | var ff = this.files[f]; | 397 | var ff = this.files[f]; |
398 | this.on_file_upload(ff); | 398 | this.on_file_upload(ff); |
399 | ff.state='uploading'; | 399 | ff.state='uploading'; |
400 | this.tree.invalidate(); | 400 | this.tree.invalidate(); |
401 | var _this = this; | 401 | var _this = this; |
402 | this.fireflix.flickr.upload_file( | 402 | this.fireflix.flickr.upload_file( |
403 | ff.file, { title: ff.title, tags: ff.tags }, | 403 | ff.file, { title: ff.title, tags: ff.tags }, |
404 | function(x,p) { | 404 | function(x,p) { |
405 | ff.photoid = p; | 405 | ff.photoid = p; |
406 | _this.batch_ids.push(p); | 406 | _this.batch_ids.push(p); |
407 | ff.state='completed'; | 407 | ff.state='completed'; |
408 | _this.tree.invalidate(); | 408 | _this.tree.invalidate(); |
409 | window.setTimeout(_this.upload_to,0,_this); | 409 | window.setTimeout(_this.upload_to,0,_this); |
410 | }, function(x,s,c,m) { | 410 | }, function(x,s,c,m) { |
411 | ff.state='failed'; | 411 | ff.state='failed'; |
412 | ff.flickr_errcode = c; | 412 | ff.flickr_errcode = c; |
413 | ff.flickr_errmsg = m; | 413 | ff.flickr_errmsg = m; |
414 | _this.tree.invalidate(); | 414 | _this.tree.invalidate(); |
415 | window.setTimeout(_this.upload_to,0,_this); | 415 | window.setTimeout(_this.upload_to,0,_this); |
416 | } | 416 | } |
417 | ); | 417 | ); |
418 | return; | 418 | return; |
419 | } | 419 | } |
420 | } | 420 | } |
421 | this.on_finish_upload(); | 421 | this.on_finish_upload(); |
422 | }, | 422 | }, |
423 | upload_to: function(_this) { _this.upload_worker(); }, | 423 | upload_to: function(_this) { _this.upload_worker(); }, |
424 | on_file_upload: function(f) { | 424 | on_file_upload: function(f) { |
425 | this.cmd_uploads_upload.setAttribute('disabled','true'); | 425 | this.cmd_uploads_upload.setAttribute('disabled','true'); |
426 | for(var fi in this.files) { | 426 | for(var fi in this.files) { |
427 | if(this.files[fi].file==f.file) { | 427 | if(this.files[fi].file==f.file) { |
428 | this.tree.ensureRowIsVisible(fi); | 428 | this.tree.ensureRowIsVisible(fi); |
429 | this.selection.rangedSelect(fi,fi,false); | 429 | this.selection.rangedSelect(fi,fi,false); |
430 | this.selection.currentIndex = fi; | 430 | this.selection.currentIndex = fi; |
431 | this.selToProps(); | 431 | this.selToProps(); |
432 | break; | 432 | break; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | }, | 435 | }, |
436 | on_finish_upload: function() { | 436 | on_finish_upload: function() { |
437 | if(this.batch_ids.length) { | 437 | if(this.batch_ids.length) { |
438 | var psn = prompt(this.fireflix.loc_strings.getString('postUploadPhotoset')); | 438 | var psn = prompt(this.fireflix.loc_strings.getString('postUploadPhotoset')); |
439 | if(psn!=null) { | 439 | if(psn!=null) { |
440 | var pids = this.batch_ids.join(','); | 440 | var pids = this.batch_ids.join(','); |
441 | var ppid = this.batch_ids[0]; | 441 | var ppid = this.batch_ids[0]; |
442 | var _this = this; | 442 | var _this = this; |
443 | this.fireflix.flickr.api_call( | 443 | this.fireflix.flickr.api_call( |
444 | { | 444 | { |
445 | method: 'flickr.photosets.create', | 445 | method: 'flickr.photosets.create', |
446 | auth_token: 'default', | 446 | auth_token: 'default', |
447 | title: psn, | 447 | title: psn, |
448 | primary_photo_id: ppid | 448 | primary_photo_id: ppid |
449 | }, function(x) { | 449 | }, function(x) { |
450 | var npid = | 450 | var npid = |
451 | x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id'); | 451 | x.responseXML.getElementsByTagName('photoset').item(0).getAttribute('id'); |
452 | _this.fireflix.flickr.api_call( | 452 | _this.fireflix.flickr.api_call( |
453 | { | 453 | { |
454 | method: 'flickr.photosets.editPhotos', | 454 | method: 'flickr.photosets.editPhotos', |
455 | auth_token: 'default', | 455 | auth_token: 'default', |
456 | photoset_id: npid, | 456 | photoset_id: npid, |
457 | primary_photo_id: ppid, | 457 | primary_photo_id: ppid, |
458 | photo_ids: pids | 458 | photo_ids: pids |
459 | }, function(x) { | 459 | }, function(x) { |
460 | _this.fireflix.refresh_sets(); | 460 | _this.fireflix.refresh_sets(); |
461 | }, function(x,s,c,m) { | 461 | }, function(x,s,c,m) { |
462 | _this.fireflix.flickr_failure(x,s,c,m); | 462 | _this.fireflix.flickr_failure(x,s,c,m); |
463 | } | 463 | } |
464 | ); | 464 | ); |
465 | }, function(x,s,c,m) { | 465 | }, function(x,s,c,m) { |
466 | _this.fireflix.flickr_failure(x,s,c,m); | 466 | _this.fireflix.flickr_failure(x,s,c,m); |
467 | } | 467 | } |
468 | ); | 468 | ); |
469 | } | 469 | } |
470 | } | 470 | } |
471 | this.selection.clearSelection(); | 471 | this.selection.clearSelection(); |
472 | this.cmd_uploads_upload.setAttribute('disabled','false'); | 472 | this.cmd_uploads_upload.setAttribute('disabled','false'); |
473 | this.upload_progress.setAttribute('hidden','true'); | 473 | this.upload_progress.setAttribute('hidden','true'); |
474 | }, | 474 | }, |
475 | 475 | ||
476 | clear_list: function() { | 476 | clear_list: function() { |
477 | this.tree.beginUpdateBatch(); | 477 | this.tree.beginUpdateBatch(); |
478 | this.rowCount = 0; | 478 | this.rowCount = 0; |
479 | this.files = new Array(); | 479 | this.files = new Array(); |
480 | this.tree.endUpdateBatch(); | 480 | this.tree.endUpdateBatch(); |
481 | this.selToProps(); | 481 | this.selToProps(); |
482 | }, | 482 | }, |
483 | selectionChanged: function() { | 483 | selectionChanged: function() { |
484 | this.selToProps(); | 484 | this.selToProps(); |
485 | }, | 485 | }, |
486 | disableProps: function() { | 486 | disableProps: function() { |
487 | this.upload_filename.value=''; | 487 | this.upload_filename.value=''; |
488 | this.upload_filename.disabled = true; | 488 | this.upload_filename.disabled = true; |
489 | this.upload_title.value=''; | 489 | this.upload_title.value=''; |
490 | this.upload_title.disabled = true; | 490 | this.upload_title.disabled = true; |
491 | this.upload_file_preview.src = null; | 491 | this.upload_file_preview.src = null; |
492 | this.upload_file_props.hidden = true; | ||
493 | this.upload_tags.value=''; | 492 | this.upload_tags.value=''; |
494 | this.upload_tags.disabled = true; | 493 | this.upload_tags.disabled = true; |
494 | /* this.upload_file_props.hidden = true; */ | ||
495 | }, | 495 | }, |
496 | selToProps: function() { | 496 | selToProps: function() { |
497 | if(!this.selection.count) { | 497 | if(!this.selection.count) { |
498 | this.disableProps(); | 498 | this.disableProps(); |
499 | this.upload_file_props.hidden = true; | ||
499 | }else if(this.selection.count==1) { | 500 | }else if(this.selection.count==1) { |
500 | var f=this.files[this.selection.currentIndex]; | 501 | var f=this.files[this.selection.currentIndex]; |
501 | if(f==null || f.state!='pending') { | 502 | if(f==null) { |
502 | this.disableProps(); | 503 | this.disableProps(); |
504 | this.upload_file_props.hidden = true; | ||
503 | }else{ | 505 | }else{ |
506 | var inactives = f.state!='pending'; | ||
504 | this.upload_filename.value = f.file; | 507 | this.upload_filename.value = f.file; |
505 | this.upload_filename.disabled = false; | 508 | this.upload_filename.disabled = inactives; |
506 | this.upload_title.value = f.title; | 509 | this.upload_title.value = f.title; |
507 | this.upload_title.disabled = false; | 510 | this.upload_title.disabled = inactives; |
508 | this.upload_file_preview.src = 'file:///'+f.file; | 511 | this.upload_file_preview.src = 'file:///'+f.file; |
509 | this.upload_file_props.hidden = false; | ||
510 | this.upload_tags.value = f.tags; | 512 | this.upload_tags.value = f.tags; |
511 | this.upload_tags.disabled = false; | 513 | this.upload_tags.disabled = inactives; |
514 | if(f.state=='failed') { | ||
515 | this.upload_failure.textContent=f.flickr_errcode+': '+f.flickr_errmsg; | ||
516 | this.upload_failure.hidden = false; | ||
517 | }else{ | ||
518 | this.upload_failure.hidden = true; | ||
519 | } | ||
520 | this.upload_file_props.hidden = false; | ||
512 | } | 521 | } |
513 | }else{ | 522 | }else{ |
514 | var ftitle = null; var onetitle = true; | 523 | var ftitle = null; var onetitle = true; |
515 | var ftags = null; var onetag = true; | 524 | var ftags = null; var onetag = true; |
516 | var fs = 0; | 525 | var fs = 0; |
517 | for(var ff in this.files) { | 526 | for(var ff in this.files) { |
518 | if(this.selection.isSelected(ff) && this.files[ff].state=='pending' ) { | 527 | if(this.selection.isSelected(ff) && this.files[ff].state=='pending' ) { |
519 | ++fs; | 528 | ++fs; |
520 | if(ftitle==null) { | 529 | if(ftitle==null) { |
521 | ftitle = this.files[ff].title; | 530 | ftitle = this.files[ff].title; |
522 | }else if(ftitle!=this.files[ff].title) { | 531 | }else if(ftitle!=this.files[ff].title) { |
523 | onetitle = false; | 532 | onetitle = false; |
524 | } | 533 | } |
525 | if(ftags==null) { | 534 | if(ftags==null) { |
526 | ftags = this.files[ff].tags; | 535 | ftags = this.files[ff].tags; |
527 | }else if(ftags!=this.files[ff].tags) { | 536 | }else if(ftags!=this.files[ff].tags) { |
528 | onetag = false; | 537 | onetag = false; |
529 | } | 538 | } |
530 | } | 539 | } |
531 | } | 540 | } |
532 | if(fs) { | 541 | if(fs) { |
533 | this.upload_filename.value=''; | 542 | this.upload_filename.value=''; |
534 | this.upload_filename.disabled = true; | 543 | this.upload_filename.disabled = true; |
535 | if(onetitle) | 544 | if(onetitle) |
536 | this.upload_title.value = ftitle; | 545 | this.upload_title.value = ftitle; |
537 | this.upload_title.disabled = false; | 546 | this.upload_title.disabled = false; |
538 | if(onetag) | 547 | if(onetag) |
539 | this.upload_tags.value = ftags; | 548 | this.upload_tags.value = ftags; |
540 | this.upload_tags.disabled = false; | 549 | this.upload_tags.disabled = false; |
541 | this.upload_file_preview.src = null; | 550 | this.upload_file_preview.src = null; |
551 | this.upload_failure.hidden = true; | ||
542 | this.upload_file_props.hidden = false; | 552 | this.upload_file_props.hidden = false; |
543 | }else | 553 | }else |
544 | this.disableProps(); | 554 | this.disableProps(); |
555 | this.upload_file_props.hidden = true; | ||
545 | } | 556 | } |
546 | }, | 557 | }, |
547 | propsToSel: function(prop) { | 558 | propsToSel: function(prop) { |
548 | if(this.selection.count<=0) return; | 559 | if(this.selection.count<=0) return; |
549 | for(var ff in this.files) { | 560 | for(var ff in this.files) { |
550 | if(this.selection.isSelected(ff) && this.files[ff].state=='pending') { | 561 | if(this.selection.isSelected(ff) && this.files[ff].state=='pending') { |
551 | if(prop=='filename') | 562 | if(prop=='filename') |
552 | this.files[ff].file = this.upload_filename.value; | 563 | this.files[ff].file = this.upload_filename.value; |
553 | if(prop=='title') | 564 | if(prop=='title') |
554 | this.files[ff].title = this.upload_title.value; | 565 | this.files[ff].title = this.upload_title.value; |
555 | if(prop=='tags') | 566 | if(prop=='tags') |
556 | this.files[ff].tags = this.upload_tags.value; | 567 | this.files[ff].tags = this.upload_tags.value; |
557 | this.tree.invalidateRow(ff); | 568 | this.tree.invalidateRow(ff); |
558 | } | 569 | } |
559 | } | 570 | } |
560 | }, | 571 | }, |
561 | 572 | ||
562 | on_upload: function() { | 573 | on_upload: function() { |
563 | this.selToProps(); | 574 | this.selToProps(); |
564 | this.batch_ids = new Array(); | 575 | this.batch_ids = new Array(); |
565 | this.upload_progress.value=0; | 576 | this.upload_progress.value=0; |
566 | this.upload_progress.setAttribute('hidden','false'); | 577 | this.upload_progress.setAttribute('hidden','false'); |
567 | this.upload_worker(); | 578 | this.upload_worker(); |
568 | }, | 579 | }, |
569 | on_clear: function() { | 580 | on_clear: function() { |
570 | this.clear_list(); | 581 | this.clear_list(); |
571 | }, | 582 | }, |
572 | on_remove: function() { | 583 | on_remove: function() { |
573 | if(this.selection.count) { | 584 | if(this.selection.count) { |
574 | this.tree.beginUpdateBatch(); | 585 | this.tree.beginUpdateBatch(); |
575 | for(var i=this.files.length-1;i>=0;--i) { | 586 | for(var i=this.files.length-1;i>=0;--i) { |
576 | if(this.selection.isSelected(i)) { | 587 | if(this.selection.isSelected(i)) { |
577 | this.files.splice(i,1); | 588 | this.files.splice(i,1); |
578 | this.rowCount--; | 589 | this.rowCount--; |
579 | } | 590 | } |
580 | } | 591 | } |
581 | this.tree.endUpdateBatch(); | 592 | this.tree.endUpdateBatch(); |
582 | this.selection.clearSelection(); | 593 | this.selection.clearSelection(); |
583 | } | 594 | } |
584 | }, | 595 | }, |
585 | on_add: function() { | 596 | on_add: function() { |
586 | var ifp = Components.interfaces.nsIFilePicker; | 597 | var ifp = Components.interfaces.nsIFilePicker; |
587 | var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp); | 598 | var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(ifp); |
588 | fp.init(window, "Select a File", ifp.modeOpenMultiple); | 599 | fp.init(window, "Select a File", ifp.modeOpenMultiple); |
589 | fp.appendFilters(ifp.filterImages); | 600 | fp.appendFilters(ifp.filterImages); |
590 | var rv = fp.show(); | 601 | var rv = fp.show(); |
591 | if(rv==ifp.returnOK) { | 602 | if(rv==ifp.returnOK) { |
592 | var ff = fp.files; | 603 | var ff = fp.files; |
593 | while(ff.hasMoreElements()) { | 604 | while(ff.hasMoreElements()) { |
594 | var f = ff.getNext(); | 605 | var f = ff.getNext(); |
595 | f.QueryInterface(Components.interfaces.nsIFile); | 606 | f.QueryInterface(Components.interfaces.nsIFile); |
596 | this.add(f.path); | 607 | this.add(f.path); |
597 | } | 608 | } |
598 | } | 609 | } |
599 | } | 610 | } |
600 | }, | 611 | }, |
601 | 612 | ||
602 | on_set_props: function() { | 613 | on_set_props: function() { |
603 | var pset = this.photosets.sets[this.photosets.selection.currentIndex]; | 614 | var pset = this.photosets.sets[this.photosets.selection.currentIndex]; |
604 | window.openDialog( | 615 | window.openDialog( |
605 | "chrome://fireflix/content/photoset-props.xul", | 616 | "chrome://fireflix/content/photoset-props.xul", |
606 | null, "dependent,modal,dialog,chrome", this, | 617 | null, "dependent,modal,dialog,chrome", this, |
607 | pset ); | 618 | pset ); |
608 | if(pset.dirty) { | 619 | if(pset.dirty) { |
609 | var _this = this; | 620 | var _this = this; |
610 | this.flickr.api_call( | 621 | this.flickr.api_call( |
611 | { | 622 | { |
612 | method: 'flickr.photosets.editMeta', | 623 | method: 'flickr.photosets.editMeta', |
613 | auth_token: 'default', | 624 | auth_token: 'default', |
614 | photoset_id: pset.id, | 625 | photoset_id: pset.id, |
615 | title: pset.title, | 626 | title: pset.title, |
616 | description: pset.description | 627 | description: pset.description |
617 | }, function(xr) { | 628 | }, function(xr) { |
618 | pset.dirty = false; | 629 | pset.dirty = false; |
619 | _this.flickr.api_call( | 630 | _this.flickr.api_call( |
620 | { | 631 | { |
621 | method: 'flickr.photosets.getPhotos', | 632 | method: 'flickr.photosets.getPhotos', |
622 | auth_token: 'default', | 633 | auth_token: 'default', |
623 | photoset_id: pset.id | 634 | photoset_id: pset.id |
624 | }, function(xr) { | 635 | }, function(xr) { |
625 | var x = xr.responseXML; | 636 | var x = xr.responseXML; |
626 | var xp = x.evaluate( | 637 | var xp = x.evaluate( |
627 | '/rsp/photoset/photo', x, null, | 638 | '/rsp/photoset/photo', x, null, |
628 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); | 639 | XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); |
629 | var phids = new Array(); | 640 | var phids = new Array(); |
630 | var priph = null; | 641 | var priph = null; |
631 | var n; while(n=xp.iterateNext()) { | 642 | var n; while(n=xp.iterateNext()) { |
632 | var pid = n.getAttribute('id'); | 643 | var pid = n.getAttribute('id'); |
633 | phids.push( pid ); | 644 | phids.push( pid ); |
634 | if(pid==pset.primary && n.getAttribute('isprimary')!='1') | 645 | if(pid==pset.primary && n.getAttribute('isprimary')!='1') |
635 | priph = pid; | 646 | priph = pid; |
636 | } | 647 | } |
637 | if(priph) { | 648 | if(priph) { |
638 | _this.flickr.api_call( | 649 | _this.flickr.api_call( |
639 | { | 650 | { |
640 | method: 'flickr.photosets.editPhotos', | 651 | method: 'flickr.photosets.editPhotos', |
641 | auth_token: 'default', | 652 | auth_token: 'default', |
642 | photoset_id: pset.id, | 653 | photoset_id: pset.id, |
643 | primary_photo_id: priph, | 654 | primary_photo_id: priph, |
644 | photo_ids: phids.join(',') | 655 | photo_ids: phids.join(',') |
645 | }, function() { }, function(x,s,c,m) { /* flickr.photosets.editPhotos */ | 656 | }, function() { }, function(x,s,c,m) { /* flickr.photosets.editPhotos */ |
646 | _this.flickr_failure(x,s,c,m); | 657 | _this.flickr_failure(x,s,c,m); |
647 | } | 658 | } |
648 | ); | 659 | ); |
649 | } | 660 | } |
650 | }, function(x,s,c,m) { /* flickr.photosets.getPhotos */ | 661 | }, function(x,s,c,m) { /* flickr.photosets.getPhotos */ |
651 | _this.flickr_failure(x,s,c,m); | 662 | _this.flickr_failure(x,s,c,m); |
652 | } | 663 | } |
653 | ); | 664 | ); |
654 | }, function(x,s,c,m) { /* flickr.photosets.editMeta */ | 665 | }, function(x,s,c,m) { /* flickr.photosets.editMeta */ |
655 | _this.flickr_failure(x,s,c,m); | 666 | _this.flickr_failure(x,s,c,m); |
656 | } | 667 | } |
657 | ); | 668 | ); |
658 | } | 669 | } |
659 | }, | 670 | }, |
660 | on_refresh_sets: function() { | 671 | on_refresh_sets: function() { |
661 | this.refresh_sets(); | 672 | this.refresh_sets(); |
662 | }, | 673 | }, |
663 | on_cmd_sets_html: function(csfx,ev) { | 674 | on_cmd_sets_html: function(csfx,ev) { |
664 | var uti = csfx.charAt(0); var utl = csfx.charAt(1); | 675 | var uti = csfx.charAt(0); var utl = csfx.charAt(1); |
665 | var rv = this.build_html(this.photoset.photos,uti,utl); | 676 | var rv = this.build_html(this.photoset.photos,uti,utl); |
666 | this.popup_content(rv); | 677 | this.popup_content(rv); |
667 | }, | 678 | }, |
668 | on_cmd_setphotos_html: function(csfx,ev) { | 679 | on_cmd_setphotos_html: function(csfx,ev) { |
669 | var uti = csfx.charAt(0); var utl = csfx.charAt(1); | 680 | var uti = csfx.charAt(0); var utl = csfx.charAt(1); |
670 | var rv = ''; | 681 | var rv = ''; |
671 | for(var p in this.photoset.photos) { | 682 | for(var p in this.photoset.photos) { |
672 | if(this.photoset.selection.isSelected(p)) | 683 | if(this.photoset.selection.isSelected(p)) |
673 | rv += this.photo_html(this.photoset.photos[p],uti,utl)+'\n'; | 684 | rv += this.photo_html(this.photoset.photos[p],uti,utl)+'\n'; |
674 | } | 685 | } |
675 | this.popup_content(rv); | 686 | this.popup_content(rv); |
676 | }, | 687 | }, |
677 | 688 | ||
678 | on_cmd_uploads_html: function(csfx,ev) { | 689 | on_cmd_uploads_html: function(csfx,ev) { |
679 | var uti = csfx.charAt(0); var utl = csfx.charAt(1); | 690 | var uti = csfx.charAt(0); var utl = csfx.charAt(1); |
680 | var pids = new Array(); | 691 | var pids = new Array(); |
681 | for(var f in this.uploads.files) { | 692 | for(var f in this.uploads.files) { |
682 | if(this.uploads.selection.isSelected(f)) | 693 | if(this.uploads.selection.isSelected(f)) |
683 | if(this.uploads.files[f].photoid) | 694 | if(this.uploads.files[f].photoid) |
684 | pids.push(this.uploads.files[f].photoid); | 695 | pids.push(this.uploads.files[f].photoid); |
685 | } | 696 | } |
686 | var pp = this.uploads.rowCount*2; if(pp>500) pp = 500; | 697 | var pp = this.uploads.rowCount*2; if(pp>500) pp = 500; |
687 | var _this = this; | 698 | var _this = this; |
688 | this.flickr.api_call( | 699 | this.flickr.api_call( |
689 | { | 700 | { |
690 | method: 'flickr.photos.search', | 701 | method: 'flickr.photos.search', |
691 | auth_token: 'default', | 702 | auth_token: 'default', |
692 | extras: 'original_format', | 703 | extras: 'original_format', |
693 | user_id: 'me', | 704 | user_id: 'me', |
694 | per_page: pp | 705 | per_page: pp |
695 | }, | 706 | }, |
696 | function(xr) { | 707 | function(xr) { |
697 | var x = xr.responseXML; | 708 | var x = xr.responseXML; |
698 | var rv = ''; | 709 | var rv = ''; |
699 | for(var pn in pids) { | 710 | for(var pn in pids) { |
700 | var p = pids[pn]; | 711 | var p = pids[pn]; |
701 | var pp = new Photo(xp_node('/rsp/photos/photo[@id='+p+']',x)); | 712 | var pp = new Photo(xp_node('/rsp/photos/photo[@id='+p+']',x)); |
702 | rv += _this.photo_html(pp,uti,utl)+'\n'; | 713 | rv += _this.photo_html(pp,uti,utl)+'\n'; |
703 | } | 714 | } |
704 | _this.popup_content(rv); | 715 | _this.popup_content(rv); |
705 | }, function(x,s,c,m) { | 716 | }, function(x,s,c,m) { |
706 | _this.flickr_failure(x,s,c,m); | 717 | _this.flickr_failure(x,s,c,m); |
707 | } | 718 | } |
708 | ); | 719 | ); |
709 | }, | 720 | }, |
710 | 721 | ||
711 | /* | 722 | /* |
712 | * | 723 | * |
713 | */ | 724 | */ |
714 | foundphotos: { | 725 | foundphotos: { |
715 | fireflix: null, | 726 | fireflix: null, |
716 | init: function(f) { | 727 | init: function(f) { |
717 | this.fireflix = f; | 728 | this.fireflix = f; |
718 | pull_elements(this,document,[ | 729 | pull_elements(this,document,[ |
719 | 'search_for','search_tags','search_mine', | 730 | 'search_for','search_tags','search_mine', |
720 | 'searchresult_props','search_photo', | 731 | 'searchresult_props','search_photo', |
721 | 'searchresult_title','searchresult_description', | 732 | 'searchresult_title','searchresult_description', |
722 | 'search_page','cmd_search_prev_page','cmd_search_next_page' | 733 | 'search_page','cmd_search_prev_page','cmd_search_next_page' |
723 | ]); | 734 | ]); |
724 | document.getElementById('searchresults').view = this; | 735 | document.getElementById('searchresults').view = this; |
725 | }, | 736 | }, |
726 | photos: new Array(), | 737 | photos: new Array(), |
727 | rowCount: 0, | 738 | rowCount: 0, |
728 | getCellText: function(r,c) { | 739 | getCellText: function(r,c) { |
729 | var p = this.photos[r]; | 740 | var p = this.photos[r]; |
730 | if(c.id=='sr_title') return p.title; | 741 | if(c.id=='sr_title') return p.title; |
731 | return c.id; | 742 | return c.id; |
732 | }, | 743 | }, |
733 | setTree: function(t) { this.tree = t }, | 744 | setTree: function(t) { this.tree = t }, |
734 | isContainer: function(r) { return false }, | 745 | isContainer: function(r) { return false }, |
735 | isSeparator: function(r) { return false }, | 746 | isSeparator: function(r) { return false }, |
736 | isSorted: function(r) { return false }, | 747 | isSorted: function(r) { return false }, |
737 | getLevel: function(r) { return 0 }, | 748 | getLevel: function(r) { return 0 }, |
738 | getImageSrc: function(r,c) { return null }, | 749 | getImageSrc: function(r,c) { return null }, |
739 | getRowProperties: function(r,p) { }, | 750 | getRowProperties: function(r,p) { }, |
740 | getCellProperties: function(cid,cel,p) { }, | 751 | getCellProperties: function(cid,cel,p) { }, |
741 | getColumnProperties: function(cid,cel,p) { }, | 752 | getColumnProperties: function(cid,cel,p) { }, |
742 | cycleHeader: function(cid,e) { }, | 753 | cycleHeader: function(cid,e) { }, |
743 | getParentIndex: function(r) { return -1 }, | 754 | getParentIndex: function(r) { return -1 }, |
744 | drop: function(r,o) { }, | 755 | drop: function(r,o) { }, |
745 | canDropBeforeAfter: function(r,b) { return false }, | 756 | canDropBeforeAfter: function(r,b) { return false }, |
746 | 757 | ||
747 | importXPR: function(xp) { | 758 | importXPR: function(xp) { |
748 | this.selection.clearSelection(); | 759 | this.selection.clearSelection(); |
749 | this.selection.currentIndex = -1; | 760 | this.selection.currentIndex = -1; |
750 | this.searchresult_props.hidden = true; | 761 | this.searchresult_props.hidden = true; |
751 | this.tree.beginUpdateBatch(); | 762 | this.tree.beginUpdateBatch(); |
752 | this.photos = new Array(); | 763 | this.photos = new Array(); |
753 | var n; while(n=xp.iterateNext()) { | 764 | var n; while(n=xp.iterateNext()) { |
754 | this.photos.push(new Photo(n)); | 765 | this.photos.push(new Photo(n)); |
755 | } | 766 | } |
756 | this.rowCount = this.photos.length; | 767 | this.rowCount = this.photos.length; |
757 | this.tree.endUpdateBatch(); | 768 | this.tree.endUpdateBatch(); |
758 | }, | 769 | }, |
759 | paging: { | 770 | paging: { |
760 | pars: null, | 771 | pars: null, |
761 | page: null, pages: null, perpage: null, total: null | 772 | page: null, pages: null, perpage: null, total: null |
762 | }, | 773 | }, |
763 | search_photos: function() { | 774 | search_photos: function() { |
764 | var pars = { | 775 | var pars = { |
765 | method: 'flickr.photos.search', | 776 | method: 'flickr.photos.search', |
766 | auth_token: 'default', | 777 | auth_token: 'default', |
767 | extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update,geo' | 778 | extras: 'license,date_upload,date_taken,owner_name,icon_server,original_format,last_update,geo' |
768 | }; | 779 | }; |
769 | if(this.search_mine.checked) | 780 | if(this.search_mine.checked) |
770 | pars.user_id='me'; | 781 | pars.user_id='me'; |
771 | if(this.search_tags.checked) { | 782 | if(this.search_tags.checked) { |
772 | pars.tags=this.search_for.value.split(/ +/).join(','); | 783 | pars.tags=this.search_for.value.split(/ +/).join(','); |
773 | }else{ | 784 | }else{ |
774 | pars.text=this.search_for.value; | 785 | pars.text=this.search_for.value; |
775 | } | 786 | } |
776 | this.paging.pars = new Object(); | 787 | this.paging.pars = new Object(); |
777 | this.paging.page = null; this.paging.pages = null; | 788 | this.paging.page = null; this.paging.pages = null; |
778 | this.paging.perpage = null; this.paging.total = null; | 789 | this.paging.perpage = null; this.paging.total = null; |
779 | for(var p in pars) this.paging.pars[p] = pars[p]; | 790 | for(var p in pars) this.paging.pars[p] = pars[p]; |
780 | this.perform_search(pars); | 791 | this.perform_search(pars); |
781 | }, | 792 | }, |
782 | perform_search: function(p) { | 793 | perform_search: function(p) { |
783 | var _this = this; | 794 | var _this = this; |
784 | this.fireflix.flickr.api_call( p, | 795 | this.fireflix.flickr.api_call( p, |
785 | function(xr) { | 796 | function(xr) { |
786 | var x = xr.responseXML; | 797 | var x = xr.responseXML; |
787 | var xp = xp_nodes('/rsp/photos/photo',x); | 798 | var xp = xp_nodes('/rsp/photos/photo',x); |
788 | _this.importXPR(xp); | 799 | _this.importXPR(xp); |
789 | _this.tree.ensureRowIsVisible(0); | 800 | _this.tree.ensureRowIsVisible(0); |
790 | xp = xp_node('/rsp/photos',x); | 801 | xp = xp_node('/rsp/photos',x); |
791 | _this.paging.page = parseInt(xp.getAttribute('page')); | 802 | _this.paging.page = parseInt(xp.getAttribute('page')); |
792 | _this.paging.pages = parseInt(xp.getAttribute('pages')); | 803 | _this.paging.pages = parseInt(xp.getAttribute('pages')); |
793 | _this.paging.perpage = parseInt(xp.getAttribute('perpage')); | 804 | _this.paging.perpage = parseInt(xp.getAttribute('perpage')); |
794 | _this.paging.total = parseInt(xp.getAttribute('total')); | 805 | _this.paging.total = parseInt(xp.getAttribute('total')); |
795 | _this.update_paging(); | 806 | _this.update_paging(); |
796 | _this.on_select(); | 807 | _this.on_select(); |
797 | }, function(x,s,c,m) { | 808 | }, function(x,s,c,m) { |
798 | _this.fireflix.flickr_failure(x,s,c,m); | 809 | _this.fireflix.flickr_failure(x,s,c,m); |
799 | } | 810 | } |
800 | ); | 811 | ); |