Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Файл - groups_edit.js (Старый размер - 56616 | Новый - 0):
- 0. - var GroupsEdit = {
- 1. - uInit: function(opts) {
- 2. - GroupsEdit.uInitScroll();
- 3. - extend(cur, {
- 4. - opts: opts,
- 5. - oid: -opts.id,
- 6. - tab: opts.tab,
- 7. - searchInp: ge('gedit_users_search_inp'),
- 8. - index: {},
- 9. - cache: {},
- 10. - offsets: {},
- 11. - htmls: {},
- 12. - allshown: {},
- 13. - rnd: irand(0, 10000),
- 14. -
- 15. - bigphCache: {},
- 16. - bigphShown: {},
- 17. - lang: extend(cur.lang || {}, opts.lang)
- 18. - });
- 19. - placeholderSetup(cur.searchInp, {back: true});
- 20. - elfocus(cur.searchInp);
- 21. - cur.nav.push(GroupsEdit.uNav);
- 22. - cur.destroy.push(function(c) {
- 23. - if (c == cur) GroupsEdit.uDeinitScroll();
- 24. - });
- 25. - if (cur.opts.admin) GroupsEdit.uIndex('admins', cur.opts.data.admins);
- 26. - GroupsEdit.uStart();
- 27. - },
- 28. - uNav: function(ch, from, to) {
- 29. - if (ch[0] || cur.noLocNav) return;
- 30. - var oldTab = cur.tab, newTab = to.tab || 'members';
- 31. - delete(ch.tab);
- 32. - if (!isEmpty(ch) || newTab == oldTab) return;
- 33. -
- 34. - GroupsEdit.uResetSearch();
- 35. -
- 36. - replaceClass(domPN(ge('gedit_tab_' + oldTab)), 'summary_tab_sel', 'summary_tab');
- 37. - replaceClass(domPN(ge('gedit_tab_' + newTab)), 'summary_tab', 'summary_tab_sel');
- 38. - hide('gedit_users_' + oldTab);
- 39. - show('gedit_users_' + newTab);
- 40. -
- 41. - cur.tab = newTab;
- 42. -
- 43. - GroupsEdit.uResetSearch();
- 44. - GroupsEdit.uStart();
- 45. -
- 46. - nav.setLoc(to);
- 47. - return false;
- 48. - },
- 49. - uStart: function() {
- 50. - var tab = cur.tab, d = cur.opts.data[tab], nd = d, rnd = cur.rnd, ph = getLang('groups_users_search');
- 51. - cur.qShown = false;
- 52. - if (cur.opts.counts[tab] > 1000) {
- 53. - if (!d) {
- 54. - cur.offsets[tab] = ge('gedit_users_rows_' + tab).childNodes.length;
- 55. - nd = 'notavail';
- 56. - if (cur.offsets[tab] < cur.opts.counts[tab]) {
- 57. - ajax.post('groupsedit.php', {
- 58. - act: 'get_more', id: cur.opts.id, tab: tab, offset: cur.offsets[tab]
- 59. - }, {cache: 1});
- 60. - }
- 61. - }
- 62. - } else if (!d || d == 'notavail') {
- 63. - nd = 'loading';
- 64. - delete(cur.offsets[tab]);
- 65. - ajax.post('groupsedit.php', {act: 'get_list', id: cur.opts.id, tab: tab}, {onDone: function(cnt, res) {
- 66. - if (cur.rnd != rnd) return;
- 67. - cur.opts.counts[tab] = cnt;
- 68. - GroupsEdit.uIndex(tab, res);
- 69. - }});
- 70. - }
- 71. - if (tab == 'admins') {
- 72. - show('gedit_users_admsearch_btn');
- 73. - hide('gedit_users_search_btn');
- 74. - removeClass(ge('gedit_reset_search'), 'gedit_search_wide');
- 75. - removeClass(ge('gedit_users_search_inp'), 'gedit_search_wide');
- 76. - } else {
- 77. - hide('gedit_users_admsearch_btn');
- 78. - show('gedit_users_search_btn');
- 79. - addClass(ge('gedit_reset_search'), 'gedit_search_wide');
- 80. - addClass(ge('gedit_users_search_inp'), 'gedit_search_wide');
- 81. - }
- 82. - cur.opts.data[tab] = nd;
- 83. - if (nd == 'notavail' && (tab == 'declined' || tab == 'requests' || tab == 'invites')) {
- 84. - ph = getLang('groups_users_lnksearch');
- 85. - }
- 86. - val(geByClass1('input_back_content', domPS(cur.searchInp)), ph);
- 87. - GroupsEdit.uUpdateBack();
- 88. - },
- 89. - uInitScroll: function() {
- 90. - GroupsEdit.scrollnode = browser.msie6 ? pageNode : window;
- 91. - GroupsEdit.uDeinitScroll();
- 92. - addEvent(GroupsEdit.scrollnode, 'scroll', GroupsEdit.uScroll);
- 93. - addEvent(window, 'resize', GroupsEdit.uScroll);
- 94. - },
- 95. - uDeinitScroll: function() {
- 96. - removeEvent(GroupsEdit.scrollnode, 'scroll', GroupsEdit.uScroll);
- 97. - removeEvent(window, 'resize', GroupsEdit.uScroll);
- 98. - },
- 99. - uScroll: function() {
- 100. - if (browser.mobile) return;
- 101. -
- 102. - var docEl = document.documentElement;
- 103. - var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 104. - var st = scrollGetY(), lnk = ge('gedit_users_more_' + cur.tab);
- 105. -
- 106. - if (!isVisible(lnk)) return;
- 107. - if (st + ch > lnk.offsetTop) {
- 108. - lnk.onclick();
- 109. - }
- 110. - },
- 111. - uUpdateBack: function() {
- 112. - var text = (cur.tab == 'members' || cur.tab == 'unsure') ? getLang('groups_back_to_people') : ((cur.tab == 'admins') ? getLang('groups_back_to_leaders') : false);
- 113. - if (text) {
- 114. - cur._back = {
- 115. - text: text,
- 116. - show: [GroupsEdit.uInitScroll, elfocus.pbind(cur.searchInp)],
- 117. - hide: [GroupsEdit.uDeinitScroll]
- 118. - };
- 119. - } else {
- 120. - cur._back = false;
- 121. - }
- 122. - },
- 123. - uIndex: function(tab, res, noRefresh) {
- 124. - cur.opts.data[tab] = res;
- 125. - cur.cache[tab] = {all: []};
- 126. - for (var i = 0, count = res.length; i < count; ++i) {
- 127. - cur.cache[tab].all.push(i);
- 128. - }
- 129. - cur.index[tab] = new vkIndexer(cur.cache[tab].all, function(obj) {
- 130. - return cur.opts.data[tab][obj][2];
- 131. - }, noRefresh ? function(){} : GroupsEdit.uSearchUpdate);
- 132. - },
- 133. - uResetSearch: function() {
- 134. - val(cur.searchInp, '');
- 135. - elfocus(cur.searchInp);
- 136. - GroupsEdit.uSearchUpdate();
- 137. - },
- 138. - uSearch: function() {
- 139. - var q = trim(val(cur.searchInp)), tab = cur.tab, d = cur.opts.data[tab];
- 140. - clearTimeout(cur.updateTimer);
- 141. - if (d == 'notavail') {
- 142. - if (q.match(/^(https?:\/\/)?([a-z0-9]+\.)*(vkontakte\.ru|vk\.com)\/.+/)) {
- 143. - return GroupsEdit.uGetPage();
- 144. - }
- 145. - }
- 146. - if (tab == 'admins' && q.match(/^(https?:\/\/)?([a-z0-9]+\.)*(vkontakte\.ru|vk\.com)\/.+/)) {
- 147. - return GroupsEdit.uEditAdmin(GroupsEdit.uGetAddr(q));
- 148. - }
- 149. - if (tab == 'members' || tab == 'unsure' || tab == 'admins') {
- 150. - return nav.go('/search?c[section]=people&gid=' + cur.opts.id + '&c[q]=' + encodeURIComponent(q) + '&from=' + tab, false, {noback: false});
- 151. - }
- 152. - return GroupsEdit.uSearchUpdate(true);
- 153. - },
- 154. - uGetAddr: function(lnk) {
- 155. - var m = lnk.match(/^(https?:\/\/)?([a-z0-9]+\.)*(vkontakte\.ru|vk\.com)\/(.+)$/), result = m[4].substr(m[4].indexOf('#') + 1).replace(/^[\/\!]*/, '');
- 156. - if (m = result.match(/^profile\.php\?id=(\d+)/)) {
- 157. - result = intval(m[1]);
- 158. - } else {
- 159. - if (result.indexOf('?') !== -1) result = result.substr(0, result.indexOf('?'));
- 160. - if (m = result.match(/^id(\d+)/)) {
- 161. - result = intval(m[1]);
- 162. - }
- 163. - }
- 164. - return result;
- 165. - },
- 166. - uSearchUpdate: function(force) {
- 167. - if ((cur.searchInp || {}).id != 'gedit_users_search_inp') return;
- 168. -
- 169. - var q = trim(val(cur.searchInp)), tab = cur.tab, d = cur.opts.data[tab];
- 170. - toggle('gedit_reset_search', !!q);
- 171. - toggle('gedit_users_additional_admins', !q && domFC(ge('gedit_users_rows_additional_admins')));
- 172. - if (!q) cur.searched = false;
- 173. - clearTimeout(cur.updateTimer);
- 174. - if (d == 'notavail') {
- 175. - if (q.match(/^(https?:\/\/)?([a-z0-9]+\.)*(vkontakte\.ru|vk\.com)\/.+/)) {
- 176. - cur.updateTimer = setTimeout(GroupsEdit.uGetPage, 1000);
- 177. - return;
- 178. - }
- 179. - if (q && force !== true) {
- 180. - cur.updateTimer = setTimeout(GroupsEdit.uSearchUpdate.pbind(true), 1000);
- 181. - return;
- 182. - }
- 183. - var cont = ge('gedit_users_rows_' + tab), more = ge('gedit_users_more_' + tab), el;
- 184. - if (q) {
- 185. - if (!cur.htmls[tab]) cur.htmls[tab] = cont;
- 186. - hide(more, 'gedit_users_summaryw_' + tab);
- 187. - domPN(cont).replaceChild(ce('div', {
- 188. - id: 'gedit_users_tmp_' + tab,
- 189. - className: 'gedit_users_rows',
- 190. - innerHTML: GroupsEdit.uGenEmpty(getLang((tab == 'members' || tab == 'unsure' || tab == 'admins' ? 'groups_too_many_enter' : 'groups_too_many_for_search')))
- 191. - }), cont);
- 192. - } else {
- 193. - if (cur.htmls[tab]) {
- 194. - el = ge('gedit_users_tmp_' + tab);
- 195. - domPN(el).replaceChild(cur.htmls[tab], el);
- 196. - debugLog(domPN(ge(domFC(el).id)));
- 197. - if (domFC(el).className == 'gedit_user' && domPN(ge(domFC(el).id)) == cur.htmls[tab]) {
- 198. - cur.htmls[tab].replaceChild(domFC(el), ge(domFC(el).id));
- 199. - }
- 200. - toggle(more, cur.offsets[tab] < cur.opts.counts[tab]);
- 201. - show('gedit_users_summaryw_' + tab);
- 202. - cur.htmls[tab] = el = false;
- 203. - }
- 204. - GroupsEdit.uUpdateSummary();
- 205. - }
- 206. - } else if (d != 'loading') {
- 207. - GroupsEdit.uShowMore(true);
- 208. - }
- 209. - },
- 210. - uUpdateSummary: function() {
- 211. - var tab = cur.tab, add = (tab == 'requests') ? '<span class="divide">|</span><span><a onclick="GroupsEdit.uApproveAll()">' + getLang('groups_approve_all') + '</a></span>' : '';
- 212. - if (trim(val(cur.searchInp)) || !isVisible('gedit_users_summaryw_' + tab)) return;
- 213. -
- 214. - if (cur.opts.counts[tab] > 0) {
- 215. - val('gedit_users_summary_' + tab, getLang(cur.opts.summaries[tab], cur.opts.counts[tab], true) + add);
- 216. - } else {
- 217. - val('gedit_users_summary_' + tab, cur.opts.noSummaries[tab]);
- 218. - }
- 219. - },
- 220. - uApproveAll: function() {
- 221. - var box = showFastBox(
- 222. - getLang('groups_invitations_title'),
- 223. - getLang('groups_sure_approve_all'),
- 224. - getLang('groups_approve_all'),
- 225. - GroupsEdit.uDoApproveAll.pbind(0),
- 226. - getLang('global_cancel')
- 227. - );
- 228. - },
- 229. - uDoApproveAll: function(partcount) {
- 230. - if (!curBox()) return;
- 231. -
- 232. - ajax.post('groupsedit.php', {act: 'approve_all', id: cur.opts.id, hash: cur.opts.hash, part_count: partcount}, {
- 233. - onDone: function(text, done) {
- 234. - if (text === false) return GroupsEdit.uDoApproveAll(done);
- 235. -
- 236. - if (curBox()) curBox().hide();
- 237. - GroupsEdit.uShowMessage(text);
- 238. -
- 239. - var l = nav.objLoc;
- 240. - if (done) {
- 241. - delete(l.tab);
- 242. - } else {
- 243. - l.tab = 'requests';
- 244. - }
- 245. - nav.go(l, false, {nocur: true});
- 246. - }, progress: curBox().progress
- 247. - });
- 248. - },
- 249. - uShowMore: function(force) {
- 250. - var tab = cur.tab, d = cur.opts.data[tab], q = trim(val(cur.searchInp)), highlight = false, rnd = cur.rnd;
- 251. - if (!d || d == 'loading' || d == 'notavail' && force) return;
- 252. -
- 253. - if (d == 'notavail') {
- 254. - ajax.post('groupsedit.php', {
- 255. - act: 'get_more',
- 256. - id: cur.opts.id,
- 257. - tab: tab,
- 258. - offset: cur.offsets[tab]
- 259. - }, {onDone: function(count, html) {
- 260. - if (cur.rnd != rnd || cur.searched) return;
- 261. -
- 262. - cur.opts.counts[tab] = count;
- 263. - var el = ce('div', {innerHTML: html}), cont = ge('gedit_users_rows_' + tab), i;
- 264. - for (i = domFC(el); i; i = domFC(el)) {
- 265. - if (ge(i.id)) {
- 266. - el.removeChild(i);
- 267. - } else {
- 268. - cont.appendChild(i);
- 269. - ++cur.offsets[tab];
- 270. - }
- 271. - }
- 272. - if (cur.offsets[tab] < cur.opts.counts[tab]) {
- 273. - ajax.post('groupsedit.php', {
- 274. - act: 'get_more', id: cur.opts.id, tab: tab, offset: cur.offsets[tab]
- 275. - }, {cache: 1});
- 276. - }
- 277. - }, cache: 1});
- 278. - return;
- 279. - }
- 280. - var lst = cur.cache[tab].all, m;
- 281. - if (force) {
- 282. - GroupsEdit.uUpdateSummary();
- 283. - if (cur.qShown === q) return;
- 284. - cur.qShown = q;
- 285. - }
- 286. - if (q) {
- 287. - if (q.match(/^(https?:\/\/)?([a-z0-9]+\.)*(vkontakte\.ru|vk\.com)\/.+/)) {
- 288. - var addr = GroupsEdit.uGetAddr(q);
- 289. - lst = [];
- 290. - for (var i = 0, l = d.length; i < l; ++i) {
- 291. - if (d[i][0] == addr || d[i][1] == '/' + addr) {
- 292. - lst.push(i);
- 293. - }
- 294. - }
- 295. - } else {
- 296. - lst = cur.cache[tab]['_' + q];
- 297. - if (lst === undefined) {
- 298. - var tmp = cur.index[tab].search(q), mp = {};
- 299. - lst = [];
- 300. - for (var i = 0, l = tmp.length; i < l; ++i) {
- 301. - if (!mp[tmp[i]]) {
- 302. - mp[tmp[i]] = true;
- 303. - lst.push(tmp[i]);
- 304. - }
- 305. - }
- 306. - lst.sort(function(a,b){return a-b;});
- 307. - cur.cache[tab]['_' + q] = lst;
- 308. - }
- 309. - highlight = GroupsEdit.uGetHighlight(q);
- 310. - }
- 311. - }
- 312. -
- 313. - var len = lst.length, cont = ge('gedit_users_rows_' + tab), more = ge('gedit_users_more_' + tab);
- 314. - if (!len) {
- 315. - hide(more, 'gedit_users_summaryw_' + tab);
- 316. - val(cont, GroupsEdit.uGenEmpty(q ? cur.opts.nfound[tab] : getLang('groups_no_users_in_club')));
- 317. - return;
- 318. - }
- 319. -
- 320. - var start = force ? 0 : cont.childNodes.length, end = Math.min(len, start + 20), html = [];
- 321. - for (var i = start; i < end; ++i) {
- 322. - var row = d[lst[i]], name = (row || {})[2];
- 323. - if (!row) continue;
- 324. - if (highlight) {
- 325. - name = name.replace(highlight.re, highlight.val);
- 326. - }
- 327. - html.push(GroupsEdit.uGenRow(tab, row, name));
- 328. - }
- 329. -
- 330. - if (force) {
- 331. - val(cont, html.join(''));
- 332. - show('gedit_users_summaryw_' + tab);
- 333. - if (q) {
- 334. - val('gedit_users_summary_' + tab, getLang('groups_found_n_users', len, true));
- 335. - } else {
- 336. - GroupsEdit.uUpdateSummary();
- 337. - }
- 338. - } else {
- 339. - cont.innerHTML += html.join('');
- 340. - }
- 341. - toggle(more, end < len);
- 342. - },
- 343. - uGetPage: function(force) {
- 344. - var q = trim(val(cur.searchInp)), tab = cur.tab, rnd = cur.rnd;
- 345. - if (force !== true && cur.searched === q) return;
- 346. -
- 347. - cur.searched = q;
- 348. - ajax.post('groupsedit.php', {act: 'get_page', id: cur.opts.id, tab: tab, addr: GroupsEdit.uGetAddr(q)}, {
- 349. - onDone: function(html, found) {
- 350. - if (cur.rnd != rnd) return;
- 351. -
- 352. - var cont = ge('gedit_users_rows_' + tab);
- 353. - if (!cur.htmls[tab]) cur.htmls[tab] = cont;
- 354. - hide('gedit_users_more_' + tab);
- 355. - if (found) {
- 356. - show('gedit_users_summaryw_' + tab);
- 357. - val('gedit_users_summary_' + tab, getLang('groups_found_n_users', 1, true));
- 358. - } else {
- 359. - hide('gedit_users_summaryw_' + tab);
- 360. - }
- 361. - if (cont) {
- 362. - domPN(cont).replaceChild(ce('div', {
- 363. - id: 'gedit_users_tmp_' + tab,
- 364. - className: 'gedit_users_rows',
- 365. - innerHTML: html
- 366. - }), cont);
- 367. - } else {
- 368. - val('gedit_users_tmp_' + tab, html);
- 369. - }
- 370. - }
- 371. - });
- 372. - },
- 373. - uGetHighlight: function(q) {
- 374. - var indxr = cur.index[cur.tab], delimiter = indxr.delimiter, trimmer = indxr.trimmer;
- 375. -
- 376. - q += ' ' + (parseLatin(q) || '');
- 377. - q = escapeRE(q).replace(/&/g, '&');
- 378. - q = q.replace(trimmer, '').replace(delimiter, '|');
- 379. - return {
- 380. - re: new RegExp('(' + q + ')', 'gi'),
- 381. - val: '<span class="gedit_user_highlight">$1</span>'
- 382. - }
- 383. - },
- 384. - uGenEmpty: function(text) {
- 385. - return '<div class="gedit_users_none">' + text + '</div>';
- 386. - },
- 387. - uGenRow: function(tab, row, name) {
- 388. - var oid = row[0], href = row[1], photo = row[3], sex = row[4], infoArr = row[5], level = row[6], hash = row[7], info = '', btns = '', actions = '', nm = name || row[2], q = cur.qShown;
- 389. - if (!name && q && !q.match(/^(https?:\/\/)?([a-z0-9]+\.)*(vkontakte\.ru|vk\.com)\/.+/)) {
- 390. - highlight = GroupsEdit.uGetHighlight(q);
- 391. - nm = nm.replace(highlight.re, highlight.val);
- 392. - }
- 393. - if (infoArr[0]) { // uni
- 394. - info += '<div class="gedit_user_uni">' + infoArr[0] + '</div>';
- 395. - }
- 396. - if (level > 0) {
- 397. - info += '<div class="gedit_user_level">' + cur.opts.levels[level] + '</div>';
- 398. - }
- 399. - if (infoArr[1]) { // online
- 400. - info += '<div class="gedit_user_online">' + (getLang('global_online', sex) + (infoArr[1] != 1 ? '<b class="mob_onl gedit_mob_onl" onmouseover="mobileOnlineTip(this, {mid: ' + oid + '})" onclick="mobilePromo()"></b>' : '')) + '</div>';
- 401. - }
- 402. -
- 403. - switch (tab) {
- 404. - case 'requests':
- 405. - if (level != -1) { // declined or approved request
- 406. - btns = [
- 407. - '<div class="gedit_user_buttons">',
- 408. - '<div class="gedit_btns_text">', getLang(level < 0 ? 'groups_request_declined' : 'groups_request_accepted'),
- 409. - ' <a onclick="GroupsEdit.uAction(this, ', oid, ', \'', hash, '\', 0)">', getLang('global_cancel'), '</a>',
- 410. - '</div>',
- 411. - '</div>'].join('');
- 412. - } else { // request
- 413. - btns = [
- 414. - '<div class="gedit_user_buttons">',
- 415. - '<div class="button_blue fl_l">',
- 416. - '<button onclick="GroupsEdit.uAction(this, ', oid, ', \'', hash, '\', 1)">', getLang('groups_members_application_admit'), '</button>',
- 417. - '</div>',
- 418. - '<div class="button_cancel gedit_user_cancel_button fl_l">',
- 419. - '<div class="button" onclick="GroupsEdit.uAction(this, ', oid, ', \'', hash, '\', -1)">', getLang('groups_members_application_decline'), '</div>',
- 420. - '</div>',
- 421. - '</div>'].join('');
- 422. - }
- 423. - break;
- 424. -
- 425. - case 'members':
- 426. - case 'unsure':
- 427. - case 'admins':
- 428. - if (level > 3) {
- 429. - if (level < 6) {
- 430. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uMainAdmin()">' + getLang('Edit') + '</a>';
- 431. - }
- 432. - } else if (level > 0) {
- 433. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uEditAdmin(' + oid + ')">' + getLang('Edit') + '</a>';
- 434. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uRemoveAdmin(' + oid + ')">' + getLang('group_managers_demote') + '</a>';
- 435. - } else if (!level && cur.opts.admin) {
- 436. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uEditAdmin(' + oid + ')">' + getLang('groups_members_appoint_manager') + '</a>';
- 437. - }
- 438. - if (level < 0) {
- 439. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uAction(this, ' + oid + ', \'' + hash + '\', 0)">' + getLang('groups_restore_member') + '</a>';
- 440. - } else if (level < 4) {
- 441. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uAction(this, ' + oid + ', \'' + hash + '\', -1)">' + getLang('groups_members_delete') + '</a>';
- 442. - }
- 443. - break;
- 444. -
- 445. - case 'declined':
- 446. - if (level < 0) {
- 447. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uAction(this, ' + oid + ', \'' + hash + '\', 0)">' + getLang('groups_restore_member') + '</a>';
- 448. - } else {
- 449. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uAction(this, ' + oid + ', \'' + hash + '\', -1)">' + getLang('groups_members_delete') + '</a>';
- 450. - }
- 451. - break;
- 452. -
- 453. - case 'invites':
- 454. - if (level < 0) {
- 455. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uAction(this, ' + oid + ', \'' + hash + '\', 0)">' + getLang('groups_send_invitation') + '</a>';
- 456. - } else {
- 457. - actions += '<a class="gedit_user_action" onclick="GroupsEdit.uAction(this, ' + oid + ', \'' + hash + '\', -1)">' + getLang('groups_members_invitations_cancel') + '</a>';
- 458. - }
- 459. - break;
- 460. - }
- 461. -
- 462. - return [
- 463. - '<div id="gedit_user_', tab, oid, '" class="gedit_user">',
- 464. - '<div class="gedit_user_bigph_wrap fl_l" onmouseover="GroupsEdit.bigphOver(this, ', oid, ')">',
- 465. - '<a class="gedit_user_thumb" href="', href, '"><img class="gedit_user_img" src="', photo, '" /></a>',
- 466. - '</div>',
- 467. - '<div class="gedit_user_info fl_l">',
- 468. - '<div class="gedit_user_name"><a class="gedit_user_lnk" href="', href, '">', nm, '</a></div>',
- 469. - info,
- 470. - '<div class="gedit_user_btns">', btns, '</div>',
- 471. - '</div>',
- 472. - '<div class="gedit_user_actions fl_r">', actions, '</div>',
- 473. - '</div>'].join('');
- 474. - },
- 475. - bigphOver: function(obj, uid) {
- 476. - if (!cur.lang || !cur.lang.global_photo_full_size || browser.mobile) return;
- 477. - var o = obj.firstChild, ch = cur.bigphCache[uid];
- 478. - if (o.tagName != 'A' || o.className != 'gedit_bigph') {
- 479. - o = obj.insertBefore(ce('a', {className: 'gedit_bigph', href: ch && ch._id ? ('/photo' + ch._id + '?all=1') : ('/albums' + uid), innerHTML: '<span class="gedit_bigph_label">' + getLang('global_photo_full_size') + '</span>'}), obj.firstChild);
- 480. - }
- 481. - if (!o.onclick) o.onclick = GroupsEdit.bigphClick.pbind(uid);
- 482. - if (!o._uid) o._uid = uid;
- 483. -
- 484. - clearTimeout(o.hideTO);
- 485. - animate(o, {marginTop: 75}, {duration: 200, transition: Fx.Transitions.easeOutCirc});
- 486. - cur.bigphShown[uid] = o;
- 487. -
- 488. - if (!obj.onmouseout) obj.onmouseout = GroupsEdit.bigphOut.pbind(obj);
- 489. - },
- 490. - bigphOut: function(obj) {
- 491. - var o = obj.firstChild;
- 492. - if (!o || o.tagName != 'A' || o.className != 'gedit_bigph') return;
- 493. -
- 494. - clearTimeout(o.hideTO);
- 495. - o.hideTO = setTimeout(function() {
- 496. - animate(o, {marginTop: 100}, 200);
- 497. - delete(cur.bigphShown[o._uid]);
- 498. - }, 150);
- 499. - },
- 500. - bigphClick: function(uid, ev) {
- 501. - if (checkEvent(ev) !== false) return;
- 502. -
- 503. - var ch = cur.bigphCache[uid], o = cur.bigphShown[uid], obj = domPN(o);
- 504. - if (!o || !obj) return;
- 505. - if (ch === undefined) {
- 506. - ch = cur.bigphCache[uid] = 'show';
- 507. - ajax.post('al_photos.php', {act: 'fast_get_photo', oid: uid}, {onDone: function(res) {
- 508. - if (!res) {
- 509. - obj.onmouseover = function() {};
- 510. - re(o);
- 511. - return;
- 512. - }
- 513. - var sh = (cur.bigphCache[uid] == 'show');
- 514. - cur.bigphCache[uid] = res;
- 515. - o.href = '/photo' + res._id + '?all=1';
- 516. - if (sh) GroupsEdit.bigphClick(uid);
- 517. - }, onFail: function() {
- 518. - obj.onmouseover = function() {};
- 519. - re(o);
- 520. - return true;
- 521. - }});
- 522. - }
- 523. - if (ch == 'show') {
- 524. - return cancelEvent(ev);
- 525. - }
- 526. - if (!ch) return;
- 527. - return showPhoto(ch._id, 'album' + uid + '_0/rev', extend({jumpTo: {z: 'albums' + uid}}, ch), ev);
- 528. - },
- 529. - uShowMessage: function(txt) {
- 530. - showDoneBox(txt);
- 531. - },
- 532. - uEditAdmin: function(user) {
- 533. - showBox('groupsedit.php', {act: 'edit_admin', id: cur.opts.id, addr: user});
- 534. - },
- 535. - uRemoveAdmin: function(user) {
- 536. - return showBox('groupsedit.php', {act: 'edit_admin', id: cur.opts.id, addr: user, remove: 1});
- 537. - },
- 538. - uDoneAdmin: function(mid, hash) {
- 539. - var level = intval(radioBtns['admlevel'].val);
- 540. - if (cur.notSureAdmin && level >= 3) {
- 541. - return showFastBox(getLang('groups_admin_warning_title'), cur.notSureAdmin, getLang('groups_admin_do_add'), function() {
- 542. - curBox().hide();
- 543. - cur.notSureAdmin = false;
- 544. - GroupsEdit.uDoneAdmin(mid, hash);
- 545. - }, getLang('global_back'));
- 546. - }
- 547. - ajax.post('groupsedit.php', {
- 548. - act: 'done_admin',
- 549. - id: cur.opts.id,
- 550. - addr: mid,
- 551. - level: level,
- 552. - contact: isChecked('gedit_admbox_check'),
- 553. - position: val('gedit_admbox_position'),
- 554. - email: val('gedit_admbox_email'),
- 555. - phone: val('gedit_admbox_phone'),
- 556. - hash: hash
- 557. - }, {onDone: function(msg, row) {
- 558. - var tabs = ['members', 'unsure', 'admins'], i;
- 559. -
- 560. - var rem = curBox().uRemove;
- 561. - if (!rem) {
- 562. - curBox().hide();
- 563. - if (msg) GroupsEdit.uShowMessage(msg);
- 564. - }
- 565. - if (!row) return;
- 566. -
- 567. - for (i = 0; i < 3; ++i) {
- 568. - var t = tabs[i], d = cur.opts.data[t], found = false, j, k, l, el;
- 569. - if (isArray(d)) {
- 570. - for (j = 0, l = d.length; j < l; ++j) {
- 571. - if (d[j][0] == mid) {
- 572. - found = true;
- 573. - if (t == 'admins') {
- 574. - if (row[6] > 0 && d[j][6] <= 0) {
- 575. - ++cur.opts.counts[t];
- 576. - } else if (row[6] <= 0 && d[j][6] > 0) {
- 577. - --cur.opts.counts[t];
- 578. - }
- 579. - }
- 580. - cur.opts.data[t][j] = row;
- 581. - break;
- 582. - }
- 583. - }
- 584. - }
- 585. - if (t == 'admins' && !found && level) {
- 586. - cur.opts.data[t].unshift(row);
- 587. - ++cur.opts.counts['admins'];
- 588. - val(cur.searchInp, '');
- 589. - GroupsEdit.uIndex(t, cur.opts.data[t]);
- 590. - } else {
- 591. - if (el = ge('gedit_user_' + t + mid)) {
- 592. - domPN(el).replaceChild(se(GroupsEdit.uGenRow(t, row)), el);
- 593. - }
- 594. - if (!found) {
- 595. - ajaxCache = {};
- 596. - }
- 597. - }
- 598. - GroupsEdit.uUpdateSummary();
- 599. - }
- 600. - if (rem) GroupsEdit.uAction(false, rem[0], rem[1], rem[2]);
- 601. - }, showProgress: curBox().showProgress, hideProgress: curBox().hideProgress});
- 602. - },
- 603. - uMainAdmin: function() {
- 604. - showBox('groupsedit.php', {act: 'main_admin', id: cur.opts.id});
- 605. - },
- 606. - uInitAdmin: function(box, hosts, extcur, lng) {
- 607. - box.setOptions({onClean: function() {
- 608. - if (window.WideDropdown) {
- 609. - WideDropdown.deinit('gedit_host_dd');
- 610. - }
- 611. - }});
- 612. - extend(cur, extcur, {
- 613. - lang: extend(cur.lang || {}, lng)
- 614. - });
- 615. - WideDropdown.init('gedit_host_dd', {
- 616. - defaultItems: hosts,
- 617. - noResult: getLang('groups_host_not_found'),
- 618. - introText: getLang('groups_choose_host'),
- 619. - onItemSelect: function(sel) {
- 620. - ge('gedit_hostbox_thumb').href = ge('gedit_hostbox_name').href = sel[4];
- 621. - ge('gedit_hostbox_img').src = sel[3];
- 622. - val(ge('gedit_hostbox_name'), sel[1]);
- 623. - cur.hostSel = sel;
- 624. - WideDropdown.clear('gedit_host_dd');
- 625. - return false;
- 626. - }
- 627. - });
- 628. - WideDropdown.select('gedit_host_dd', false, cur.hostSel);
- 629. - box.removeButtons().addButton(getLang('global_cancel'), box.hide, 'no');
- 630. - box.addButton(getLang('global_save'), GroupsEdit.uSaveAdmin);
- 631. - },
- 632. - uSaveAdmin: function() {
- 633. - ajax.post('groupsedit.php', {
- 634. - act: 'save_admin', id: cur.hostGid, oid: cur.hostSel[0], from: cur.hostFrom, hash: cur.hostHash
- 635. - }, {
- 636. - onDone: function(row, admrows, msg) {
- 637. - if (cur.hostFrom == 'page') {
- 638. - curBox().hide();
- 639. - showDoneBox(msg);
- 640. - domPN(ge('event_admin')).replaceChild(se(row), ge('event_admin'));
- 641. - return;
- 642. - }
- 643. - var t = 'admins';
- 644. - toggle('gedit_users_additional_' + t, !!admrows);
- 645. - val('gedit_users_rows_additional_' + t, admrows);
- 646. - var last = cur.opts.data[t][cur.opts.data[t].length - 1];
- 647. - if (el = ge('gedit_user_' + t + row[0])) {
- 648. - domPN(el).replaceChild(se(GroupsEdit.uGenRow(t, row)), el);
- 649. - }
- 650. - if (row[0] > 0 && last[0] < 0) {
- 651. - cur.opts.data[t].pop();
- 652. - --cur.opts.counts[t];
- 653. - if (el = ge('gedit_user_' + t + last[0])) {
- 654. - domPN(el).removeChild(el);
- 655. - }
- 656. - } else if (row[0] < 0 && last[0] > 0) {
- 657. - cur.opts.data[t].push(row);
- 658. - ++cur.opts.counts[t];
- 659. - if (el = ge('gedit_user_' + t + last[0])) {
- 660. - domPN(el).appendChild(se(GroupsEdit.uGenRow(t, row)), el);
- 661. - }
- 662. - } else {
- 663. - cur.opts.data[t][cur.opts.data[t].length - 1] = row;
- 664. - if (el = ge('gedit_user_' + t + last[0])) {
- 665. - domPN(el).replaceChild(se(GroupsEdit.uGenRow(t, row)), el);
- 666. - }
- 667. - }
- 668. - GroupsEdit.uIndex(t, cur.opts.data[t], true);
- 669. - curBox().hide();
- 670. - GroupsEdit.uShowMessage(msg);
- 671. - if (cur.tab != 'admins') nav.go(extend(nav.objLoc, {tab: 'admins'}));
- 672. - },
- 673. - showProgress: curBox().showProgress,
- 674. - hideProgress: curBox().hideProgress
- 675. - });
- 676. - },
- 677. - uAction: function(el, mid, hash, act) {
- 678. - if (!curBox() && (buttonLocked(el) || (domFC(el) || {}).className == 'progress_inline')) return;
- 679. - var tab = cur.tab;
- 680. - ajax.post('groupsedit.php', {act: 'user_action', id: cur.opts.id, addr: mid, hash: hash, action: act}, {
- 681. - onDone: function(row) {
- 682. - if (curBox()) curBox().hide();
- 683. - if (isArray(row)) {
- 684. - var tabs = (tab == 'requests' || tab == 'declined' || tab == 'invites') ? [tab] : ['members', 'unsure', 'admins'], cnt = tabs.length, i;
- 685. - for (i = 0; i < cnt; ++i) {
- 686. - var t = tabs[i], d = cur.opts.data[t], found = false, j, k, l, el;
- 687. - if (isArray(d)) {
- 688. - for (j = 0, l = d.length; j < l; ++j) {
- 689. - if (d[j][0] == mid) {
- 690. - found = true;
- 691. - cur.opts.data[t][j] = row;
- 692. - if (t != 'admins') {
- 693. - if (act) {
- 694. - --cur.opts.counts[t];
- 695. - } else {
- 696. - ++cur.opts.counts[t];
- 697. - }
- 698. - }
- 699. - break;
- 700. - }
- 701. - }
- 702. - }
- 703. - if (el = ge('gedit_user_' + t + mid)) {
- 704. - domPN(el).replaceChild(se(GroupsEdit.uGenRow(t, row)), el);
- 705. - if (t != 'admins' && d == 'notavail') {
- 706. - if (act) {
- 707. - --cur.opts.counts[t];
- 708. - --cur.offsets[t];
- 709. - } else {
- 710. - ++cur.opts.counts[t];
- 711. - ++cur.offsets[t];
- 712. - }
- 713. - }
- 714. - }
- 715. - if (!found) {
- 716. - ajaxCache = {};
- 717. - }
- 718. - }
- 719. - if (tab == 'requests' && act > 0 || tab == 'admins' && act < 0) {
- 720. - cur.noLocNav = true;
- 721. - }
- 722. - GroupsEdit.uUpdateSummary();
- 723. - } else if (row) {
- 724. - GroupsEdit.uShowMessage(row);
- 725. - } else {
- 726. - GroupsEdit.uRemoveAdmin(mid).uRemove = [mid, hash, act];
- 727. - }
- 728. - },
- 729. - showProgress: function() {
- 730. - if (curBox()) {
- 731. - curBox().showProgress();
- 732. - } else if (el && el.tagName == 'BUTTON') {
- 733. - lockButton(el);
- 734. - } else {
- 735. - if (!el._s) el._s = val(el);
- 736. - val(el, '<span class="progress_inline"></span>');
- 737. - }
- 738. - },
- 739. - hideProgress: function() {
- 740. - if (curBox()) {
- 741. - curBox().hideProgress();
- 742. - } else if (el && el.tagName == 'BUTTON') {
- 743. - unlockButton(el);
- 744. - } else {
- 745. - if (el._s) {
- 746. - val(el, el._s);
- 747. - el._s = false;
- 748. - }
- 749. - }
- 750. - }
- 751. - });
- 752. - },
- 753. -
- 754. - waitTwitter: function() {
- 755. - ajax.post('al_groups.php', {act: 'get_twitter_auth', gid: cur.gid}, {onDone: function(url) {
- 756. - if (url) {
- 757. - hide(cur.twitterBox.progress);
- 758. - ge('group_status_export_data').innerHTML = getLang('groups_authorize_please');
- 759. - cur.twitterBox.addButton(getLang('groups_auth_in_twitter'), function() {
- 760. - location.href = url;
- 761. - });
- 762. - } else {
- 763. - cur.twitterTimer = setTimeout(GroupsEdit.waitTwitter, 1000);
- 764. - }
- 765. - }});
- 766. - },
- 767. - startTwitter: function() {
- 768. - cur.twitterBox = showFastBox(getLang('groups_status_export'), '\
- 769. - <div class="group_status_export_info">\
- 770. - <img class="groups_twitter_icon fl_l" src="/images/twitter_sync.png" />\
- 771. - <div class="groups_twitter_info fl_l">\
- 772. - <b>Twitter</b><br />' + getLang('groups_twitter_desc') + '\
- 773. - </div>\
- 774. - <br class="clear" />\
- 775. - </div>\
- 776. - <center id="group_status_export_data">' + getLang('groups_external_site_request') + '</center>\
- 777. - ');
- 778. - cur.twitterBox.setOptions({onHide: clearTimeout.bind(window).pbind(cur.twitterTimer)});
- 779. - cur.twitterBox.removeButtons().addButton(getLang('global_cancel'), cur.twitterBox.hide, 'no');
- 780. - show(cur.twitterBox.progress);
- 781. - ajax.post('al_groups.php', {act: 'get_twitter_auth', gid: cur.gid, first: 1}, {onDone: function() {
- 782. - cur.twitterTimer = setTimeout(GroupsEdit.waitTwitter, 1000);
- 783. - }});
- 784. - },
- 785. - checkTwitter: function() {
- 786. - ajax.post('al_groups.php', {act: 'get_twitter_name', gid: cur.gid}, {onDone: function(name) {
- 787. - if (name) {
- 788. - cur.twitterCheckTimer = false;
- 789. - var lnk = ge('name_service1');
- 790. - lnk.innerHTML = name;
- 791. - lnk.href = 'http://twitter.com/' + name;
- 792. - } else {
- 793. - cur.twitterCheckTimer = setTimeout(GroupsEdit.checkTwitter, 1000);
- 794. - }
- 795. - }});
- 796. - },
- 797. - removeTwitter: function() {
- 798. - var box = showFastBox(getLang('groups_status_export'), '<center>' + getLang('groups_status_confirm') + '</center>', getLang('global_continue'), function() {
- 799. - ajax.post('al_groups.php', {act: 'clear_twitter', gid: cur.gid, hash: cur.hash}, {progress: box.progress});
- 800. - }, getLang('global_cancel'));
- 801. - },
- 802. -
- 803. - getFields: function() {
- 804. - var result = {};
- 805. - for (var i = 0; i < arguments.length; ++i) {
- 806. - var n = arguments[i];
- 807. - result[n] = cur.privacy['g_' + n][0];
- 808. - }
- 809. - return result;
- 810. - },
- 811. - nbAddr: function() {
- 812. - var tbl = ge('group_edit_addr_table');
- 813. - setStyle(tbl, 'backgroundColor', '#FAEAEA');
- 814. - setTimeout(animate.pbind(tbl, {backgroundColor: '#FFFFFF'}, 300), 400);
- 815. - elfocus('group_edit_addr');
- 816. - },
- 817. - saveInfo: function() {
- 818. - var name = trim(ge('group_edit_name').value), addr = trim(ge('group_edit_addr').value);
- 819. - if (!name) {
- 820. - return notaBene(ge('group_edit_name'));
- 821. - }
- 822. - if (!addr) {
- 823. - return GroupsEdit.nbAddr();
- 824. - }
- 825. -
- 826. - var params = {
- 827. - act: 'save',
- 828. - gid: cur.gid,
- 829. - name: name,
- 830. - addr: addr,
- 831. - description: trim(ge('group_edit_desc').value),
- 832. - website: trim(ge('group_website').value),
- 833. - rss: trim(ge('group_rss').value),
- 834. - hash: cur.hash
- 835. - }, btn = ge('group_save');
- 836. - if (cur.cls == 0 || cur.cls == 2) {
- 837. - extend(params, GroupsEdit.getFields(
- 838. - 'wall', 'photos', 'video', 'audio', 'docs', 'topics', 'wiki', 'access'
- 839. - ));
- 840. - params.subject = cur.subjectDD.val();
- 841. - if (cur.cls == 2) {
- 842. - extend(params, {
- 843. - start_date: val('group_start_date'),
- 844. - finish_date: isVisible('group_edit_finish_time') ? val('group_finish_date') : 0,
- 845. - host: cur.hostDD ? cur.hostDD.val() : false,
- 846. - email: val('event_mail'),
- 847. - phone: val('event_phone')
- 848. - });
- 849. - }
- 850. - } else if (cur.cls == 1) {
- 851. - extend(params, {
- 852. - pcategory: cur.pcategoryDD.val(),
- 853. - psubcategory: cur.psubcategoryDD.val(),
- 854. - public_date: val('gedit_public_date')
- 855. - });
- 856. - each(['enable_replies', 'enable_topics', 'enable_photos', 'enable_video', 'enable_audio', 'enable_links', 'enable_events', 'enable_places', 'enable_contacts'], function(i, v) {
- 857. - params[v] = isChecked(v);
- 858. - });
- 859. - }
- 860. -
- 861. - ajax.post('al_groups.php', params, {onDone: function(result, oldaddr) {
- 862. - if (result < 0) {
- 863. - return GroupsEdit.nbAddr();
- 864. - }
- 865. - if (result === false) {
- 866. - return notaBene(ge('group_edit_name'));
- 867. - }
- 868. - if (nav.objLoc.act == 'edit_first') {
- 869. - return nav.go(nav.objLoc[0]);
- 870. - }
- 871. - ((cur.privacy['g_wall'][0] > 1 || cur.twitterVal) ? show : hide)('group_edit_twitter');
- 872. - var msg = ge('group_saved_msg');
- 873. - show(msg);
- 874. - msg.style.backgroundColor = '#F4EBBD';
- 875. - animate(msg, {backgroundColor: '#F9F6E7'}, 2000);
- 876. - scrollToTop();
- 877. - if (oldaddr != addr) {
- 878. - each(geByTag('a'), function() {
- 879. - this.href = this.href.replace(new RegExp('/' + oldaddr + '\\?', 'g'), '/' + addr + '?').replace(new RegExp('/' + oldaddr + '$', 'g'), '/' + addr);
- 880. - });
- 881. - nav.setLoc({0: addr, act: 'edit'});
- 882. - globalHistoryDestroy(oldaddr);
- 883. - }
- 884. - globalHistoryDestroy(addr);
- 885. - }, showProgress: lockButton.pbind(btn), hideProgress: unlockButton.pbind(btn)});
- 886. - },
- 887. -
- 888. - checkAddr: function(timeout) {
- 889. - clearTimeout(cur.checkAddrTimer);
- 890. - if (timeout) {
- 891. - var inp = ge('group_edit_addr'), tmp = inp.value.replace(/[^0-9a-zA-Z_\.]/g, '');
- 892. - if (tmp != inp.value) inp.value = tmp;
- 893. - cur.checkAddrTimer = setTimeout(GroupsEdit.checkAddr.pbind(false), 1000);
- 894. - return;
- 895. - }
- 896. - var val = ge('group_edit_addr').value;
- 897. - if (val) {
- 898. - ajax.post('al_settings.php', {act: 'check_addr', addr: val, oid: -cur.gid}, {onDone: function(result, text) {
- 899. - ge('group_edit_about_addr').innerHTML = text;
- 900. - }});
- 901. - }
- 902. - },
- 903. - show: function(elem) {
- 904. - if (!isVisible(elem)) {
- 905. - slideDown(elem, 150);
- 906. - }
- 907. - },
- 908. - hide: function(elem) {
- 909. - if (isVisible(elem)) {
- 910. - slideUp(elem, 150);
- 911. - }
- 912. - },
- 913. - init: function(selData) {
- 914. - autosizeSetup('group_edit_desc', {
- 915. - minHeight: 50,
- 916. - maxHeight: 600
- 917. - });
- 918. -
- 919. - cur.twitterVal = selData.twitter;
- 920. - extend(cur, {
- 921. - module: 'groups_edit',
- 922. - privacy: cur.privacy || {},
- 923. - cls: selData.cls
- 924. - });
- 925. - if (cur.cls == 0 || cur.cls == 2) {
- 926. - extend(cur, {
- 927. - subjectDD: new Dropdown(ge('group_subject'), selData.subjects, {
- 928. - width: cur.cls == 2 ? 266 : 186,
- 929. - multiselect: false,
- 930. - autocomplete: true,
- 931. - introText: getLang('groups_start_typing_subject'),
- 932. - noResult: '',
- 933. - placeholder: getLang('groups_choose_subject')
- 934. - })
- 935. - });
- 936. - if (selData.subject && selData.subject != '0') {
- 937. - cur.subjectDD.val(selData.subject);
- 938. - }
- 939. - }
- 940. - if (cur.cls == 1) {
- 941. - extend(cur, {
- 942. - pcategoryDD: new Dropdown(ge('public_type'), selData.pcategories, {
- 943. - width: 266,
- 944. - multiselect: false,
- 945. - autocomplete: false,
- 946. - onChange: function(v) {
- 947. - v = intval(v);
- 948. - if (v && (selData.psubcategories[v] || {}).length > 1) {
- 949. - cur.psubcategoryDD.setOptions({defaultItems: selData.psubcategories[v]});
- 950. - cur.psubcategoryDD.val(0);
- 951. - GroupsEdit.show(ge('group_edit_psubcategory'));
- 952. - } else {
- 953. - GroupsEdit.hide(ge('group_edit_psubcategory'));
- 954. - }
- 955. - if (selData.plabelsmap[v] !== undefined) {
- 956. - val('gedit_public_date_label', selData.plabels[selData.plabelsmap[v]]);
- 957. - } else {
- 958. - val('gedit_public_date_label', selData.plabels[selData.plabelsmap[0]]);
- 959. - }
- 960. - }
- 961. - }),
- 962. - psubcategoryDD: new Dropdown(ge('public_subtype'), selData.psubcategories[selData.pcategory || 0] || [], {
- 963. - width: 266,
- 964. - multiselect: false,
- 965. - autocomplete: false
- 966. - }),
- 967. - bdPicker: new Daypicker('gedit_public_date', {startYear: 1800, width: 266})
- 968. - });
- 969. - cur.pcategoryDD.val(selData.pcategory, true);
- 970. - cur.psubcategoryDD.val(selData.psubcategory);
- 971. - } else if (cur.cls == 2) {
- 972. - new Datepicker('group_start_date', {time: 'group_start_time', width: 140, resfmt: 'plain'});
- 973. - new Datepicker('group_finish_date', {time: 'group_finish_time', width: 140, resfmt: 'plain'});
- 974. - var width = 140 + 2 * 47 + 10, el = geByClass1('group_edit_at', ge('group_edit_start_time'));
- 975. -
- 976. - width += el.offsetWidth;
- 977. - var toAdd = (266 - width), toAddLeft = Math.floor(toAdd / 2), toAddRight = toAdd - toAddLeft;
- 978. - var st = {paddingLeft: toAddLeft + 'px', paddingRight: toAddRight + 'px'};
- 979. - setStyle(el, st);
- 980. - setStyle(geByClass1('group_edit_at', ge('group_edit_finish_time')), st);
- 981. -
- 982. - if (selData.hosts) {
- 983. - extend(cur, {
- 984. - hostDD: new Dropdown(ge('event_host'), selData.hosts, {
- 985. - width: 266,
- 986. - multiselect: false,
- 987. - autocomplete: false,
- 988. - selectedItems: [selData.host]
- 989. - })
- 990. - });
- 991. - }
- 992. - }
- 993. -
- 994. - cur.destroy.push(function(c) {
- 995. - if (c.cls == 0) {
- 996. - c.subjectDD.destroy();
- 997. - } else if (c.cls == 1) {
- 998. - c.pcategoryDD.destroy();
- 999. - c.psubcategoryDD.destroy();
- 1000. - } else if (c.cls == 2) {
- 1001. - c.subjectDD.destroy();
- 1002. - if (c.hostDD) c.hostDD.destroy();
- 1003. - }
- 1004. - });
- 1005. -
- 1006. - placeholderSetup('group_rss');
- 1007. - },
- 1008. -
- 1009. - doSearchBlacklist: function() {
- 1010. - var inp = ge('group_bl_search'), name = trim(inp.value), btn = ge('group_bl_submit');
- 1011. - if (!name) {
- 1012. - return elfocus(inp);
- 1013. - }
- 1014. -
- 1015. - return showBox('al_groups.php', {act: 'bl_edit', name: name, gid: cur.gid}, {stat: ['page.css', 'ui_controls.js', 'ui_controls.css'], dark: 1});
- 1016. - },
- 1017. - toggleBlacklist: function(mid, el) {
- 1018. - if ((domFC(el) || {}).className == 'progress_inline') return;
- 1019. - ajax.post('al_groups.php', {act: 'bl_user', mid: mid, gid: cur.gid, hash: cur.hash}, {
- 1020. - onDone: GroupsEdit.updateBlacklist.pbind(cur.gid),
- 1021. - showProgress: function() {
- 1022. - if (!el._s) el._s = val(el);
- 1023. - val(el, '<span class="progress_inline"></span>');
- 1024. - }, hideProgress: function() {
- 1025. - if (el._s) {
- 1026. - val(el, el._s);
- 1027. - el._s = false;
- 1028. - }
- 1029. - }
- 1030. - });
- 1031. - },
- 1032. - editBlacklist: function(mid) {
- 1033. - showBox('al_groups.php', {act: 'bl_edit', name: 'id' + mid, gid: cur.gid}, {stat: ['page.css', 'ui_controls.js', 'ui_controls.css'], dark: 1});
- 1034. - },
- 1035. - updateBlacklist: function(gid, msg, mid, html, delta) {
- 1036. - if (mid && curBox()) curBox().hide();
- 1037. - if (msg === 0) return GroupsEdit.editBlacklist(mid);
- 1038. - if (msg) showDoneBox(msg, {out: 3000});
- 1039. - if (nav.objLoc[0] == 'search' && nav.objLoc.from == 'ban' && nav.objLoc.gid && mid) {
- 1040. - return nav.go(
- 1041. - (ge('club_bl_lnk') || {href: 'club' + nav.objLoc.gid + '?act=blacklist'}).href,
- 1042. - false,
- 1043. - {noback: true}
- 1044. - );
- 1045. - }
- 1046. - if (ge('group_bl_rows') && cur.gid == gid) {
- 1047. - var row = ge('group_bl' + mid), newrow = se(html);
- 1048. - if (!row && !(delta > 0)) return;
- 1049. -
- 1050. - if (row) {
- 1051. - domPN(row).replaceChild(newrow, row);
- 1052. - } else if (delta > 0) {
- 1053. - var rows = ge('group_bl_rows');
- 1054. - rows.insertBefore(newrow, domFC(rows));
- 1055. - re('group_bl_no');
- 1056. - }
- 1057. - GroupsEdit.recache(cur.offset, delta);
- 1058. - GroupsEdit.updateBlacklistSummary(delta);
- 1059. - }
- 1060. - },
- 1061. - updateBlacklistSummary: function(delta) {
- 1062. - cur.count += delta;
- 1063. - if (cur.count > 0) {
- 1064. - ge('group_bl_summary').innerHTML = getLang('groups_X_banned_members', cur.count);
- 1065. - } else {
- 1066. - ge('group_bl_summary').innerHTML = getLang('group_no_banned_users');
- 1067. - }
- 1068. - },
- 1069. - scrollResize: function() {
- 1070. - if (browser.mobile) return;
- 1071. -
- 1072. - var docEl = document.documentElement;
- 1073. - var ch = window.innerHeight || docEl.clientHeight || bodyNode.clientHeight;
- 1074. - var st = scrollGetY();
- 1075. - var lnk = ge(cur.moreLink);
- 1076. -
- 1077. - if (!isVisible(lnk)) return;
- 1078. - if (st + ch > lnk.offsetTop) {
- 1079. - cur.showMore();
- 1080. - }
- 1081. - },
- 1082. - initScroll: function() {
- 1083. - GroupsEdit.scrollnode = browser.msie6 ? pageNode : window;
- 1084. - window.scrollTop = bodyNode.scrollTop = pageNode.scrollTop = htmlNode.scrollTop = 0;
- 1085. -
- 1086. - addEvent(GroupsEdit.scrollnode, 'scroll', GroupsEdit.scrollResize);
- 1087. - addEvent(window, 'resize', GroupsEdit.scrollResize);
- 1088. - removeEvent(window, 'load', GroupsEdit.initScroll);
- 1089. - },
- 1090. - deinitScroll: function() {
- 1091. - removeEvent(GroupsEdit.scrollnode, 'scroll', GroupsEdit.scrollResize);
- 1092. - removeEvent(window, 'resize', GroupsEdit.scrollResize);
- 1093. - },
- 1094. - recache: function(from, delta) {
- 1095. - if (cur.loading) {
- 1096. - cur.loading = 1;
- 1097. - setTimeout(GroupsEdit.recache.pbind(from, delta), 100);
- 1098. - return;
- 1099. - }
- 1100. -
- 1101. - var i = cur.offset, key = '/' + nav.objLoc[0] + '#' + ajx2q(extend({offset: 12345, part: 1}, cur.moreParams));
- 1102. - var a = ajaxCache[key.replace('12345', i)];
- 1103. - if (a) {
- 1104. - a[0] += delta;
- 1105. - ajaxCache[key.replace('12345', i + delta)] = a;
- 1106. - delete(ajaxCache[key.replace('12345', i)]);
- 1107. - }
- 1108. - cur.offset += delta;
- 1109. - },
- 1110. - loaded: function(off, rows) {
- 1111. - cur.offset = off;
- 1112. -
- 1113. - var cont = ge('group_bl_rows'), d = ce('div', {innerHTML: rows});
- 1114. - while (d.firstChild) {
- 1115. - cont.appendChild(d.firstChild);
- 1116. - }
- 1117. -
- 1118. - if (off >= cur.count || !rows) {
- 1119. - hide('group_users_more');
- 1120. - return;
- 1121. - }
- 1122. - cur.loading = 1;
- 1123. - ajax.post(nav.objLoc[0], extend({offset: cur.offset, part: 1}, cur.moreParams), {cache: 1, onDone: function() {
- 1124. - if (cur.loading == 2) {
- 1125. - GroupsEdit.loaded.apply(window, arguments);
- 1126. - } else {
- 1127. - cur.loading = false;
- 1128. - }
- 1129. - }, onFail: function() {
- 1130. - cur.loading = 0;
- 1131. - return true;
- 1132. - }});
- 1133. - },
- 1134. - load: function() {
- 1135. - if (!isVisible('group_users_more') || isVisible('group_more_progress')) return;
- 1136. - if (cur.loading) {
- 1137. - cur.loading = 2;
- 1138. - return;
- 1139. - }
- 1140. -
- 1141. - ajax.post(nav.objLoc[0], extend({offset: cur.offset, part: 1}, cur.moreParams), {onDone: GroupsEdit.loaded, onFail: function() {
- 1142. - cur.loading = 0;
- 1143. - return true;
- 1144. - }, showProgress: function() {
- 1145. - show('group_more_progress');
- 1146. - hide(ge('group_users_more').firstChild);
- 1147. - }, hideProgress: function() {
- 1148. - show(ge('group_users_more').firstChild);
- 1149. - hide('group_more_progress');
- 1150. - }, cache: 1});
- 1151. - },
- 1152. -
- 1153. - initLinks: function() {
- 1154. - placeholderSetup('group_l_search', {back: true});
- 1155. - elfocus('group_l_search');
- 1156. - cur.module = 'groups_edit';
- 1157. - if (!ge('group_l_no')) {
- 1158. - var cont = ge('group_l_rows');
- 1159. - sorter.init(cont, {onReorder: GroupsEdit.reorderLinks, dh: 1});
- 1160. - cur.destroy.push(cont.sorter.destroy);
- 1161. - }
- 1162. - },
- 1163. - reorderLinks: function(lnk, before, after) {
- 1164. - var lnk_id = lnk.id.replace('group_l_row', '');
- 1165. - for (; after && (!after.id || isVisible('group_l_restore' + after.id.replace('group_l_row', ''))); ) {
- 1166. - after = after.previousSibling;
- 1167. - }
- 1168. - var after_id = (after && after.id || '').replace('group_l_row', '');
- 1169. - ajax.post('al_groups.php', {act: 'reorder_links', gid: cur.gid, hash: cur.hash, lid: lnk_id, after: after_id}, {onDone: GroupsEdit.invalidateBack});
- 1170. - },
- 1171. - editLink: function(id) {
- 1172. - showBox('al_groups.php', {act: 'edit_link', lid: id, gid: cur.gid, hash: cur.hash});
- 1173. - },
- 1174. - invalidateBack: function() {
- 1175. - globalHistoryDestroy(nav.objLoc[0]);
- 1176. - globalHistoryDestroy('club' + cur.gid);
- 1177. - globalHistoryDestroy('event' + cur.gid);
- 1178. - },
- 1179. - linkAction: function(el, act, id) {
- 1180. - var del = (act == 'delete_link');
- 1181. - if (!del && cur.count >= cur.linksLimit) {
- 1182. - return GroupsEdit.linkMessage('<b>' + getLang('global_unknown_error') + '.</b>', true);
- 1183. - }
- 1184. -
- 1185. - var params = {act: act, lid: id, gid: cur.gid, hash: cur.hash};
- 1186. - GroupsEdit.linksCount(cur.count + (del ? -1 : 1));
- 1187. - if (!del) { // say after what link is that one
- 1188. - var after = ge('group_l_row' + id).previousSibling
- 1189. - for (; after && (!after.id || isVisible('group_l_restore' + after.id.replace('group_l_row', ''))); ) {
- 1190. - after = after.previousSibling;
- 1191. - }
- 1192. - params.after = (after && after.id || '').replace('group_l_row', '');
- 1193. - }
- 1194. - ajax.post('al_groups.php', params, {onDone: function() {
- 1195. - GroupsEdit.invalidateBack();
- 1196. - (del ? hide : show)('group_l_actions' + id);
- 1197. - (del ? show : hide)('group_l_restore' + id);
- 1198. - }, onFail: function() {
- 1199. - GroupsEdit.linksCount(cur.count + (del ? 1 : -1));
- 1200. - }, showProgress: function() {
- 1201. - hide('group_l_actions' + id, 'group_l_restore' + id);
- 1202. - show('group_l_progress' + id);
- 1203. - }, hideProgress: function() {
- 1204. - hide('group_l_progress' + id);
- 1205. - show((del ? 'group_l_actions' : 'group_l_restore') + id);
- 1206. - }});
- 1207. - },
- 1208. - updateImgs: function() {
- 1209. - if (cur.lnkImages.length > 1) {
- 1210. - ge('group_al_thumb_img').parentNode.style.cursor = 'pointer';
- 1211. - }
- 1212. - },
- 1213. - rotateImgs: function() {
- 1214. - if (cur.lnkImages.length < 2) return;
- 1215. -
- 1216. - var index = ((cur.lnkIndex || 0) + 1) % cur.lnkImages.length;
- 1217. - ge('group_al_thumb_img').src = cur.lnkImages[index];
- 1218. - cur.lnkIndex = index;
- 1219. - },
- 1220. - parseLink: function(url, cuteurl) {
- 1221. - if (!/https?:\/\//i.test(url)) {
- 1222. - url = 'http://' + url;
- 1223. - }
- 1224. - if (cuteurl && !/https?:\/\//i.test(cuteurl)) {
- 1225. - cuteurl = 'http://' + cuteurl;
- 1226. - }
- 1227. - lockButton(ge('group_l_submit'));
- 1228. -
- 1229. - var cont = ge('group_l_bar');
- 1230. - re(cur.lnkParse);
- 1231. - cur.lnkParse = cont.insertBefore(ce('div', {innerHTML: '\
- 1232. - <iframe class="upload_frame" name="link_parse_iframe"></iframe>\
- 1233. - '}), cont.firstChild);
- 1234. -
- 1235. - var parseForm = cur.lnkParse.appendChild(ce('form', {action: cur.parseUrl, method: 'post', target: 'link_parse_iframe'}));
- 1236. - each({
- 1237. - act: 'parse_share',
- 1238. - from_host: locHost,
- 1239. - mid: vk.id,
- 1240. - hash: cur.parseHash,
- 1241. - rhash: cur.parseRHash,
- 1242. - url: url
- 1243. - }, function(i, v) {
- 1244. - parseForm.appendChild(ce('input', {type: 'hidden', name: i, value: v}));
- 1245. - });
- 1246. -
- 1247. - cur.lnkImages = ['/images/lnkouter100.gif'];
- 1248. - window.onParseDone = function(data) {
- 1249. - unlockButton(ge('group_l_submit'));
- 1250. - GroupsEdit.addLinkBox(data.title || '', cuteurl || url);
- 1251. - if (!data.images || !data.images.length) {
- 1252. - return;
- 1253. - }
- 1254. - cur.addBox.setOptions({onClean: function() {
- 1255. - clearInterval(cur.imgLoadInterval);
- 1256. - }});
- 1257. - for (var i in data.images) {
- 1258. - var src = '', img = vkImage();
- 1259. - if (/^\//.test(data.images[i])) {
- 1260. - src = (/^https:\/\//i.test(url) ? 'https://' : 'http://') + GroupsEdit.getDomain(url);
- 1261. - } else if (!/^https?:\/\//i.test(data.images[i])) {
- 1262. - src = url.replace(/[^\/]*$/, '');
- 1263. - if (/^https?:\/\/$/i.test(src)) {
- 1264. - src = url + '/';
- 1265. - }
- 1266. - }
- 1267. - img.src = src + data.images[i];
- 1268. - data.images[i] = img;
- 1269. - }
- 1270. - cur.imgLoadInterval = setInterval(function() {
- 1271. - var nl = 0;
- 1272. - for (var i in data.images) {
- 1273. - var img = data.images[i];
- 1274. - if (!img) continue;
- 1275. - var w = img.width, h = img.height;
- 1276. - if (w || h) {
- 1277. - if (w >= 50 && h >= 20) {
- 1278. - cur.lnkImages.push(img.src);
- 1279. - GroupsEdit.updateImgs();
- 1280. - if (!cur.lnkIndex) GroupsEdit.rotateImgs();
- 1281. - }
- 1282. - data.images[i] = false;
- 1283. - } else {
- 1284. - ++nl;
- 1285. - }
- 1286. - }
- 1287. - if (!nl) {
- 1288. - clearInterval(cur.imgLoadInterval);
- 1289. - cur.imgLoadInterval = true;
- 1290. - }
- 1291. - }, 200);
- 1292. - }
- 1293. -
- 1294. - window.onParseFail = function() {
- 1295. - unlockButton(ge('group_l_submit'));
- 1296. - GroupsEdit.addLinkBox('', cuteurl || url);
- 1297. - }
- 1298. -
- 1299. - parseForm.submit();
- 1300. - },
- 1301. - getDomain: function(url) {
- 1302. - if (url.charAt(0) == '/') return locDomain;
- 1303. - return url.match(/^(https?:\/\/)?([^\/]+)(\/|$)/)[2];
- 1304. - },
- 1305. - addLinkBox: function(title, url) {
- 1306. - var img = cur.lnkImages[0];
- 1307. - cur.lnk = url;
- 1308. - cur.lnkOwnerId = cur.lnkPhotoId = false;
- 1309. - cur.editing = false;
- 1310. - cur.addBox = showFastBox(cur.boxTitle, '\
- 1311. - <div class="group_al_thumb select_fix fl_l" onclick="GroupsEdit.rotateImgs()">\
- 1312. - <img src="' + img + '" id="group_al_thumb_img" />\
- 1313. - </div>\
- 1314. - <div class="group_al_info fl_l">\
- 1315. - <input type="text" class="text" id="group_al_title" value="' + trim(title) + '" onkeypress="if (event.keyCode == 10 || event.keyCode == 13) GroupsEdit.doAddLink()" placeholder="' + getLang('group_link_add_title') + '" />\
- 1316. - <div class="group_al_position">' + GroupsEdit.getDomain(url) + '</div>\
- 1317. - </div>\
- 1318. - <br class="clear" />', getLang('global_add'), GroupsEdit.doAddLink, getLang('global_cancel'));
- 1319. - var inp = ge('group_al_title');
- 1320. - placeholderSetup(inp, {back: true});
- 1321. - elfocus(inp);
- 1322. - },
- 1323. - addLink: function() {
- 1324. - var lnk = trim(ge('group_l_search').value).replace(/\s/g, '+');
- 1325. - if (!lnk) {
- 1326. - return elfocus('group_l_search');
- 1327. - }
- 1328. - cur.lnkIndex = 0;
- 1329. - ajax.post('al_groups.php', {act: 'add_link_box', lnk: lnk}, {onDone: function(code, innerlnk, html, js) {
- 1330. - if (code > 0) {
- 1331. - if (code & 1) { // inner link
- 1332. - ajax.plainpost(innerlnk, {_tmp: 1}, function(text) {
- 1333. - var title = trim((text.match(/<title>([^<]*)/i) || {})[1] || '');
- 1334. - cur.lnkImages = ['/images/lnkinner100.gif'];
- 1335. - cur.lnk = innerlnk;
- 1336. - GroupsEdit.addLinkBox(title, innerlnk);
- 1337. - }, (code & 2) ? GroupsEdit.parseLink.pbind(html, js) : function(text) {
- 1338. - GroupsEdit.linkMessage(getLang('groups_bad_link'), true);
- 1339. - return elfocus('group_l_search');
- 1340. - }, true);
- 1341. - } else if (code & 2) {
- 1342. - GroupsEdit.parseLink(innerlnk, html);
- 1343. - }
- 1344. - } else if (code < 0) {
- 1345. - GroupsEdit.linkMessage(getLang('groups_bad_link'), true);
- 1346. - return elfocus('group_l_search');
- 1347. - } else {
- 1348. - cur.lnk = innerlnk;
- 1349. - cur.lnkOwnerId = cur.lnkPhotoId = false;
- 1350. - cur.addBox = showFastBox(cur.boxTitle, html, getLang('global_add'), GroupsEdit.doAddLink, getLang('global_cancel'));
- 1351. - cur.addBox.evalBox(js);
- 1352. - }
- 1353. - }, showProgress: lockButton.pbind(ge('group_l_submit')), hideProgress: unlockButton.pbind(ge('group_l_submit'))});
- 1354. - },
- 1355. - uploadImg: function() {
- 1356. - show(cur.addBox.progress);
- 1357. - var cont = ge('group_l_bar');
- 1358. - var uploadCont = cont.appendChild(ce('div', {innerHTML: '<iframe class="upload_frame" name="link_upload_iframe"></iframe>'})),
- 1359. - uploadForm = uploadCont.appendChild(ce('form', {action: '/share.php', method: 'post', target: 'link_upload_iframe'}));
- 1360. - each({
- 1361. - act: 'a_photo',
- 1362. - index: 0,
- 1363. - image: cur.lnkImages[cur.lnkIndex],
- 1364. - extra: 'link'
- 1365. - }, function (i, v) {
- 1366. - uploadForm.appendChild(ce('input', {type: 'hidden', name: i, value: v}));
- 1367. - });
- 1368. - window.onUploadDone = function(index, params) {
- 1369. - window.onUploadFail = window.onUploadDone = function () {};
- 1370. - cur.lnkOwnerId = params.user_id;
- 1371. - cur.lnkPhotoId = params.photo_id;
- 1372. - cont.removeChild(uploadCont);
- 1373. - cur.lnkIndex = 0;
- 1374. - GroupsEdit.doAddLink(true);
- 1375. - }
- 1376. - window.onUploadFail = function(index, msg) {
- 1377. - window.onUploadFail = window.onUploadDone = function () {};
- 1378. - cont.removeChild(uploadCont);
- 1379. - cur.lnkIndex = 0;
- 1380. - GroupsEdit.doAddLink(true);
- 1381. - }
- 1382. - cur.lnkOwnerId = cur.lnkPhotoId = false;
- 1383. - uploadForm.submit();
- 1384. - },
- 1385. - linkMessage: function(text, error) {
- 1386. - var msg = ge('group_l_msg');
- 1387. - msg.innerHTML = text;
- 1388. - show(msg);
- 1389. - var colors = error ? ['#FACEBB', '#FFEFE8', '#E89B88'] : ['#F4EBBD', '#F9F6E7', '#D4BC4C'];
- 1390. - msg.style.backgroundColor = colors[0];
- 1391. - each(['Left', 'Top', 'Right', 'Bottom'], function() {
- 1392. - msg.style['border' + this + 'Color'] = colors[2];
- 1393. - });
- 1394. - animate(msg, {backgroundColor: colors[1]}, 2000);
- 1395. - },
- 1396. - linksCount: function(count) {
- 1397. - cur.count = count;
- 1398. - ge('group_l_summary').innerHTML = count ? getLang('links_count', count) : getLang('links_no_count');
- 1399. - (count >= cur.linksLimit ? hide : show)('group_l_bar');
- 1400. - },
- 1401. - doAddLink: function(force) {
- 1402. - if (!force && isVisible(cur.addBox.progress)) return;
- 1403. -
- 1404. - var title = ge('group_al_title');
- 1405. - if (title && cur.lnkIndex) {
- 1406. - return GroupsEdit.uploadImg();
- 1407. - }
- 1408. - var str = (title ? title : ge('group_al_position')).value;
- 1409. - var params = {
- 1410. - lnk: cur.lnk,
- 1411. - index: cur.lnkIndex,
- 1412. - owner_id: cur.lnkOwnerId,
- 1413. - photo_id: cur.lnkPhotoId,
- 1414. - str: str,
- 1415. - gid: cur.gid,
- 1416. - lid: cur.editing,
- 1417. - hash: cur.hash
- 1418. - }, callback;
- 1419. - if (cur.editing) {
- 1420. - params.act = 'do_edit_link';
- 1421. - callback = function(lid, thumb, title, position) {
- 1422. - cur.addBox.hide();
- 1423. - GroupsEdit.invalidateBack();
- 1424. - if (thumb !== false) ge('group_l_photo' + lid).src = thumb;
- 1425. - if (title !== false) ge('group_l_title' + lid).innerHTML = title;
- 1426. - if (position !== false) ge('group_l_position' + lid).innerHTML = position;
- 1427. - }
- 1428. - } else {
- 1429. - params.act = 'add_link';
- 1430. - callback = function(count, text, row) {
- 1431. - cur.addBox.hide();
- 1432. - GroupsEdit.invalidateBack();
- 1433. - GroupsEdit.linkMessage(text);
- 1434. - var cont = ge('group_l_rows');
- 1435. - cont.appendChild(ce('div', {innerHTML: row}).firstChild);
- 1436. - var no = ge('group_l_no');
- 1437. - if (no) {
- 1438. - cont.removeChild(no);
- 1439. - sorter.init(cont, {onReorder: GroupsEdit.reorderLinks, dh: 1});
- 1440. - cur.destroy.push(cont.sorter.destroy);
- 1441. - } else {
- 1442. - sorter.added(cont);
- 1443. - sorter.shift(cont);
- 1444. - }
- 1445. - GroupsEdit.linksCount(count);
- 1446. - var s = ge('group_l_search');
- 1447. - s.setValue('');
- 1448. - elfocus(s);
- 1449. - }
- 1450. - }
- 1451. - setTimeout(ajax.post.pbind('al_groups.php', params, {onDone: callback, onFail: function(text) {
- 1452. - cur.addBox.hide();
- 1453. - GroupsEdit.linkMessage(text || getLang('groups_bad_link'), true);
- 1454. - return true;
- 1455. - }, progress: cur.addBox.progress}), 0);
- 1456. - },
- 1457. -
- 1458. - failed: function(old, text) {
- 1459. - GroupsEdit.setActive(old);
- 1460. - if (!text) return;
- 1461. -
- 1462. - setTimeout(showFastBox(getLang('global_error'), text).hide, 2000);
- 1463. - return true;
- 1464. - },
- 1465. - getsect: function() {
- 1466. - var filters = ge('group_edit_filters');
- 1467. - if (!filters) return;
- 1468. -
- 1469. - var current = filters.firstChild;
- 1470. - for (; !current.tagName || !hasClass(current, 'active_link');) {
- 1471. - current = current.nextSibling;
- 1472. - }
- 1473. - return current;
- 1474. - },
- 1475. - setActive: function(el) {
- 1476. - var filters = ge('group_edit_filters');
- 1477. - if (!filters) return;
- 1478. -
- 1479. - var current = GroupsEdit.getsect();
- 1480. - if (current != el) {
- 1481. - current.className = '';
- 1482. - el.className = 'active_link';
- 1483. - }
- 1484. - },
- 1485. - go: function(el, ev) {
- 1486. - var result = nav.go(el, ev, {onFail: GroupsEdit.failed.pbind(GroupsEdit.getsect())});
- 1487. - if (result === false) {
- 1488. - GroupsEdit.setActive(el.parentNode);
- 1489. - }
- 1490. - },
- 1491. -
- 1492. - editPlace: function() {
- 1493. - showBox('al_page.php', {act: 'edit_group_place', gid: cur.gid}, {stat: ['maps.js', 'ui_controls.js', 'ui_controls.css', 'selects.js', 'page.css'], dark: 1});
- 1494. - },
- 1495. - onPlaceSave: function(res) {
- 1496. - ge('group_edit_address_link').innerHTML = res;
- 1497. - },
- 1498. -
- 1499. - showStickersTT: function(text) {
- 1500. - var ttEl = ge('group_edit_addr_table');
- 1501. - showTooltip(ttEl, {
- 1502. - text: '<div class="stickers_side_tt_pointer"></div>' + text.replace('{link}', "<a href=\"#\" onclick=\"showBox('al_groups.php', {act: 'stickers_box', gid: cur.gid}); return false;\">").replace('{/link}', '</a>'),
- 1503. - className: 'stickers_side_tt',
- 1504. - slideX: 15,
- 1505. - shift: [-276, -43, 3],
- 1506. - nohide: 1,
- 1507. - hasover: 1
- 1508. - });
- 1509. - ge('group_edit_addr').onblur = function () {
- 1510. - GroupsEdit.checkAddr();
- 1511. - if (!ttEl.tt || !ttEl.tt.hide) return;
- 1512. - ttEl.tt.hide();
- 1513. - }
- 1514. - },
- 1515. -
- 1516. - switchAdSubTab: function(el, wrap, link, evt, params) {
- 1517. - if (checkEvent(evt) || hasClass(el, 'active')) return false;
- 1518. - each(geByClass('group_ad_subtab1', ge(wrap)), function(i, v) {
- 1519. - removeClass(v, 'active');
- 1520. - });
- 1521. - addClass(el, 'active');
- 1522. - if (params.part) {
- 1523. - var obj = nav.fromStr(link), url = obj[0];
- 1524. - delete obj[0];
- 1525. - ajax.post(url, extend(obj, {part: 1}), {
- 1526. - cache: 1,
- 1527. - onDone: params.onDone.pbind(obj)
- 1528. - });
- 1529. - return false;
- 1530. - }
- 1531. - return nav.go(link, evt);
- 1532. - },
- 1533. - getAdPage: function(offset, wrap) {
- 1534. - var obj = clone(nav.objLoc), url = obj[0];
- 1535. - delete obj[0];
- 1536. - ajax.post(url, extend(obj, {offset: offset, part: 1}), {
- 1537. - onDone: function(res) {
- 1538. - ge(wrap || 'group_ad_requests_table_warp').innerHTML = res;
- 1539. - nav.setLoc(extend(nav.objLoc, {offset: offset}));
- 1540. - }
- 1541. - });
- 1542. - return false;
- 1543. - },
- 1544. - updateAdRequest: function(ad_id, request_id, status, hash) {
- 1545. - return !showBox('/al_groups.php', {act: 'a_adspost_update_request', gid: cur.gid, ad_id: ad_id, request_id: request_id, status: status, hash: hash}, { params: {dark: true}});
- 1546. - }
- 1547. - }
- 1548. -
- 1549. - try{stManager.done('groups_edit.js');}catch(e){}
- ------
Advertisement
Add Comment
Please, Sign In to add comment