summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-11-16 22:08:51 (UTC)
committer Michael Krelin <hacker@klever.net>2006-11-16 22:08:51 (UTC)
commit4b21b4fc5248322c10ffb24edfd5ec78ebcce824 (patch) (unidiff)
tree54557f61052727010a06d7ab243353a06204d155
parentdd82dbcb0be6f49d58594bfbe3a3ae5f01c54e5c (diff)
downloadfireflix-4b21b4fc5248322c10ffb24edfd5ec78ebcce824.zip
fireflix-4b21b4fc5248322c10ffb24edfd5ec78ebcce824.tar.gz
fireflix-4b21b4fc5248322c10ffb24edfd5ec78ebcce824.tar.bz2
clear selection in photoset photos when changing the set
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@228 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/content/fireflix.js b/content/fireflix.js
index 2ee408f..24894df 100644
--- a/content/fireflix.js
+++ b/content/fireflix.js
@@ -87,96 +87,97 @@ var fireflix = {
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' ]); 96 pull_elements(this,document,[ 'set_photo' ]);
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 }, 136 },
136 load_photos: function(psid) { 137 load_photos: function(psid) {
137 var _this = this; 138 var _this = this;
138 this.fireflix.flickr.api_call( 139 this.fireflix.flickr.api_call(
139 { 140 {
140 method: 'flickr.photosets.getPhotos', 141 method: 'flickr.photosets.getPhotos',
141 auth_token: 'default', 142 auth_token: 'default',
142 photoset_id: psid, 143 photoset_id: psid,
143 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'
144 }, function(xr) { 145 }, function(xr) {
145 var x = xr.responseXML; 146 var x = xr.responseXML;
146 var xp = x.evaluate( 147 var xp = x.evaluate(
147 '/rsp/photoset/photo', x, null, 148 '/rsp/photoset/photo', x, null,
148 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); 149 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
149 _this.importXPR(xp); 150 _this.importXPR(xp);
150 }, function(x,s,c,m) { 151 }, function(x,s,c,m) {
151 _this.fireflix.flickr_failure(x,s,c,m); 152 _this.fireflix.flickr_failure(x,s,c,m);
152 } 153 }
153 ); 154 );
154 }, 155 },
155 on_select: function() { 156 on_select: function() {
156 if(this.selection.count==1) { 157 if(this.selection.count==1) {
157 var p = this.photos[this.selection.currentIndex]; 158 var p = this.photos[this.selection.currentIndex];
158 this.set_photo.src = 159 this.set_photo.src =
159 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');
160 this.set_photo.hidden = false; 161 this.set_photo.hidden = false;
161 }else{ 162 }else{
162 this.set_photo.hidden = true; 163 this.set_photo.hidden = true;
163 } 164 }
164 }, 165 },
165 on_cmd_open: function(ev) { 166 on_cmd_open: function(ev) {
166 if(this.selection.currentIndex<0) 167 if(this.selection.currentIndex<0)
167 return; 168 return;
168 var p = this.photos[this.selection.currentIndex]; 169 var p = this.photos[this.selection.currentIndex];
169 if(!p.id) 170 if(!p.id)
170 return; 171 return;
171 this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p')); 172 this.fireflix.openTab(this.fireflix.flickr.make_photo_url(p,'p'));
172 } 173 }
173 }, 174 },
174 175
175 /* photosets treeview */ 176 /* photosets treeview */
176 photosets: { 177 photosets: {
177 sets: new Array(), 178 sets: new Array(),
178 fireflix: null, 179 fireflix: null,
179 init: function(f) { 180 init: function(f) {
180 this.fireflix = f; 181 this.fireflix = f;
181 document.getElementById('setslist').view = this; 182 document.getElementById('setslist').view = this;
182 }, 183 },