Hormold

VK Change (#1383412506)

Nov 2nd, 2013
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 155.46 KB | None | 0 0
  1. Файл - ads.css (Старый размер - 31512 | Новый - 0):
  2. 0.  - #ads_css { display: none; }
  3. 1.  -
  4. 2.  - /* ------- */
  5. 3.  - /* General */
  6. 4.  - /* ------- */
  7. 5.  -
  8. 6.  - ul.ads_listing {
  9. 7.  -   padding: 0 0 0 30px;
  10. 8.  -   margin: 0 0 15px 0;
  11. 9.  - }
  12. 10.  - ul.ads_listing li {
  13. 11.  -   list-style: square;
  14. 12.  -   color: #758EAC;
  15. 13.  -   line-height: 160%;
  16. 14.  - }
  17. 15.  - ul.ads_listing li span {
  18. 16.  -   color: #000000;
  19. 17.  - }
  20. 18.  -
  21. 19.  - a .ads_sub_link:hover {
  22. 20.  -   text-decoration: underline;
  23. 21.  - }
  24. 22.  -
  25. 23.  - .ads_h2_add {
  26. 24.  -   font-weight: normal;
  27. 25.  -   font-size: 11px;
  28. 26.  -   padding-top: 0.185em;
  29. 27.  - }
  30. 28.  - .font_medium .ads_h2_add {
  31. 29.  -   font-size: 12px;
  32. 30.  -   padding-top: 0.14em;
  33. 31.  - }
  34. 32.  -
  35. 33.  - .ads_gradient_progress_wrap {
  36. 34.  -   height: 18px;
  37. 35.  -   margin: 0 auto;
  38. 36.  -   background: #FFFFFF;
  39. 37.  -   border: 1px solid #CCCCCC;
  40. 38.  - }
  41. 39.  -
  42. 40.  - .ads_gradient_progress {
  43. 41.  -   height: 18px;
  44. 42.  -   background: #597DA3 url(/images/progress_grad.gif) repeat;
  45. 43.  -   border: 1px solid #45688E;
  46. 44.  -   margin: -1px;
  47. 45.  - }
  48. 46.  -
  49. 47.  - /* ---- */
  50. 48.  - /* Page */
  51. 49.  - /* ---- */
  52. 50.  -
  53. 51.  - #ads_page_wrap2 {
  54. 52.  -   border: 1px solid #EBF0F4;
  55. 53.  -   border-top: 0;
  56. 54.  -   width: 791px;
  57. 55.  -   float: right;
  58. 56.  - }
  59. 57.  -
  60. 58.  - #ads_page_wrap1 {
  61. 59.  -   border: 1px solid #DAE1E8;
  62. 60.  -   border-top: 0;
  63. 61.  -   width: 789px;
  64. 62.  -   overflow: hidden;
  65. 63.  - }
  66. 64.  -
  67. 65.  - #ads_page {
  68. 66.  -   padding: 20px;
  69. 67.  - }
  70. 68.  - #ads_page.ads_page_no_padding {
  71. 69.  -   padding: 0;
  72. 70.  - }
  73. 71.  -
  74. 72.  - #ads_page_top {
  75. 73.  -   padding-top: 10px;
  76. 74.  - }
  77. 75.  -
  78. 76.  - .ads_page_extra_wide #ads_page_wrap2,
  79. 77.  - .ads_page_extra_wide #ads_page_wrap1 {
  80. 78.  -   width: auto;
  81. 79.  - }
  82. 80.  -
  83. 81.  - .ads_page_extra_wide #ads_page_wrap2 {
  84. 82.  -   float: none;
  85. 83.  - }
  86. 84.  -
  87. 85.  - #ads_page_bottom_info {
  88. 86.  -   border-top: 1px solid #DAE1E8;
  89. 87.  -   background-color: #F7F7F7;
  90. 88.  -   text-align: center;
  91. 89.  -   padding: 6px 20px;
  92. 90.  -   color: #777777;
  93. 91.  - }
  94. 92.  -
  95. 93.  - .ads_page_small {
  96. 94.  -   padding: 0 60px;
  97. 95.  - }
  98. 96.  -
  99. 97.  - /* ----- */
  100. 98.  - /* Title */
  101. 99.  - /* ----- */
  102. 100.  -
  103. 101.  - #ads_page_title {
  104. 102.  -   background-color: #E9EDF1;
  105. 103.  -   padding: 7px 10px;
  106. 104.  -   margin: 0;
  107. 105.  -   font-weight: bold;
  108. 106.  -   color: #607387;
  109. 107.  -   line-height: 140%;
  110. 108.  - }
  111. 109.  -
  112. 110.  - #ads_page_title h1 {
  113. 111.  -   font-size: 1em;
  114. 112.  -   overflow: hidden;
  115. 113.  -   padding: 0;
  116. 114.  -   margin: 0;
  117. 115.  - }
  118. 116.  -
  119. 117.  - #ads_page_title h1 a {
  120. 118.  -   color: #2B587A;
  121. 119.  - }
  122. 120.  -
  123. 121.  - #ads_page_title b {
  124. 122.  -   color: #AAB7C5;
  125. 123.  -   float: right;
  126. 124.  - }
  127. 125.  -
  128. 126.  - /* --------------- */
  129. 127.  - /* Main navigation */
  130. 128.  - /* --------------- */
  131. 129.  -
  132. 130.  - .ads_page_extra_wide #ads_navigation {
  133. 131.  -   display: none;
  134. 132.  - }
  135. 133.  -
  136. 134.  - #ads_navigation {
  137. 135.  -   width: 150px;
  138. 136.  -   padding: 12px 0 12px 0;
  139. 137.  -   word-wrap: break-word;
  140. 138.  - }
  141. 139.  -
  142. 140.  - #ads_navigation .edit_button_wrap {
  143. 141.  -   padding-bottom: 10px;
  144. 142.  - }
  145. 143.  -
  146. 144.  - #ads_navigation.ads_nav .nav {
  147. 145.  -   max-width: 128px;
  148. 146.  - }
  149. 147.  -
  150. 148.  - #ads_navigation a:hover {
  151. 149.  -   text-decoration: none;
  152. 150.  - }
  153. 151.  -
  154. 152.  - /* ------------------------------ */
  155. 153.  - /* Main navigation - offices menu */
  156. 154.  - /* ------------------------------ */
  157. 155.  -
  158. 156.  - #ads_navigation.ads_nav #ads_navigation_offices_menu.nav {
  159. 157.  -   padding-right: 2px;
  160. 158.  -   width: 137px;
  161. 159.  -   max-width: 137px;
  162. 160.  - }
  163. 161.  -
  164. 162.  - #ads_navigation.ads_nav #ads_navigation_offices_menu.nav .dd_link {
  165. 163.  -   display: block;
  166. 164.  - }
  167. 165.  -
  168. 166.  - #ads_navigation.ads_nav #ads_navigation_offices_menu.nav .dd_link #ads_navigation_offices_menu_text_wrap {
  169. 167.  -   display: block;
  170. 168.  -   overflow: hidden;
  171. 169.  -   white-space: nowrap;
  172. 170.  -   font-size: 0; /* Remove extra margin from inline-block */
  173. 171.  - }
  174. 172.  -
  175. 173.  - #ads_navigation.ads_nav #ads_navigation_offices_menu.nav .dd_link #ads_navigation_offices_menu_text {
  176. 174.  -   display: inline-block;
  177. 175.  -   overflow: hidden;
  178. 176.  -   white-space: nowrap;
  179. 177.  -   font-size: 11px; /* Remove extra margin from inline-block */
  180. 178.  - }
  181. 179.  - .font_medium #ads_navigation.ads_nav #ads_navigation_offices_menu.nav .dd_link #ads_navigation_offices_menu_text {
  182. 180.  -   font-size: 12px;
  183. 181.  - }
  184. 182.  -
  185. 183.  - .dd_menu.ads_navigation_dd_menu_header_wrap {
  186. 184.  -   margin: 4px 0 0 7px;
  187. 185.  - }
  188. 186.  -
  189. 187.  - .dd_menu.ads_navigation_dd_menu_header_wrap .dd_menu_header {
  190. 188.  -   width: 148px;
  191. 189.  - }
  192. 190.  -
  193. 191.  - .dd_menu.ads_navigation_dd_menu_header_wrap .dd_menu_header div {
  194. 192.  -   background-position: right -14px;
  195. 193.  -   *background-position: right -13px;
  196. 194.  - }
  197. 195.  -
  198. 196.  - .dd_menu.ads_navigation_dd_menu_header_wrap .dd_menu_header div #ads_navigation_dd_menu_header_text {
  199. 197.  -   padding: 1px 0 1px 4px;
  200. 198.  -   display: block;
  201. 199.  -   overflow: hidden;
  202. 200.  -   white-space: nowrap;
  203. 201.  - }
  204. 202.  -
  205. 203.  - .dd_menu.ads_navigation_dd_menu_header_wrap .dd_menu_body .ads_office_name_wrap {
  206. 204.  -   display: inline-block;
  207. 205.  -   overflow: hidden;
  208. 206.  -   max-width: 300px;
  209. 207.  - }
  210. 208.  -
  211. 209.  - /* ---------------------- */
  212. 210.  - /* Main navigation - news */
  213. 211.  - /* ---------------------- */
  214. 212.  -
  215. 213.  - .ads_naviagation_news {
  216. 214.  -   padding: 20px 0 5px 11px;
  217. 215.  - }
  218. 216.  -
  219. 217.  - .ads_naviagation_news .news_title {
  220. 218.  -   font-weight: bold;
  221. 219.  -   color: #2B587A;
  222. 220.  -   padding-bottom: 10px;
  223. 221.  - }
  224. 222.  -
  225. 223.  - .ads_naviagation_news ul {
  226. 224.  -   padding: 0;
  227. 225.  -   margin: 0;
  228. 226.  -   list-style-type: none;
  229. 227.  -   color: #758EAC;
  230. 228.  - }
  231. 229.  -
  232. 230.  - .ads_naviagation_news li {
  233. 231.  -   padding-bottom: 10px;
  234. 232.  - }
  235. 233.  -
  236. 234.  - .ads_naviagation_news span {
  237. 235.  -   color: #666666;
  238. 236.  -   font-size: 0.91em;
  239. 237.  - }
  240. 238.  -
  241. 239.  - #ads_navigation .ads_naviagation_news a:hover {
  242. 240.  -   text-decoration: underline;
  243. 241.  - }
  244. 242.  -
  245. 243.  - /* ---------- */
  246. 244.  - /* Navigation */
  247. 245.  - /* ---------- */
  248. 246.  -
  249. 247.  - .ads_nav .nav {
  250. 248.  -   padding: 6px 11px 7px 11px;
  251. 249.  -   display: block;
  252. 250.  -   overflow: hidden;
  253. 251.  - }
  254. 252.  -
  255. 253.  - .ads_nav .nav:hover {
  256. 254.  -   background-color: #E1E7ED;
  257. 255.  -   text-decoration: none;
  258. 256.  - }
  259. 257.  -
  260. 258.  - .ads_nav .nav_selected,
  261. 259.  - .ads_nav .nav_selected:hover {
  262. 260.  -   background-color: #6186AD;
  263. 261.  -   color: white;
  264. 262.  - }
  265. 263.  -
  266. 264.  - .ads_nav .nav_separator {
  267. 265.  -   border-bottom: 1px solid #D3DBE1;
  268. 266.  -   height: 1px;
  269. 267.  -   overflow: hidden;
  270. 268.  -   margin: 7px 0px 8px 0;
  271. 269.  - }
  272. 270.  -
  273. 271.  - /* ---- */
  274. 272.  - /* Tabs */
  275. 273.  - /* ---- */
  276. 274.  -
  277. 275.  - .ads_tabs_filters {
  278. 276.  -   background-color: #F7F7F7;
  279. 277.  -   border-bottom: 1px solid #DAE1E8;
  280. 278.  -   padding: 10px 10px 5px 10px;
  281. 279.  - }
  282. 280.  - .ads_tabs_filters.separate {
  283. 281.  -   border-top: 1px solid #DAE1E8;
  284. 282.  - }
  285. 283.  - .ads_round_tab_wrap {
  286. 284.  -   padding: 0 5px 5px 0;
  287. 285.  -   text-align: center;
  288. 286.  - }
  289. 287.  - .ads_round_tab_wrap .round_tab.disabled:hover,
  290. 288.  - .ads_round_tab_wrap .round_tab.label:hover {
  291. 289.  -   background-color: transparent;
  292. 290.  -   cursor: default;
  293. 291.  - }
  294. 292.  - .ads_round_tab_wrap .round_tab.label {
  295. 293.  -   color: #555555;
  296. 294.  - }
  297. 295.  - .ads_round_tabs_period_day .round_tab {
  298. 296.  -   width: 100px;
  299. 297.  - }
  300. 298.  - .ads_round_tabs_period_week .round_tab {
  301. 299.  -   width: 180px;
  302. 300.  - }
  303. 301.  - .ads_round_tabs_period_month .round_tab {
  304. 302.  -   width: 100px;
  305. 303.  - }
  306. 304.  -
  307. 305.  - /* ----- */
  308. 306.  - /* Intro */
  309. 307.  - /* ----- */
  310. 308.  -
  311. 309.  - .ads_intro_page,
  312. 310.  - .ads_intro_section_title {
  313. 311.  -   line-height: 160%;
  314. 312.  - }
  315. 313.  -
  316. 314.  - .ads_intro_title,
  317. 315.  - .ads_intro_section_title,
  318. 316.  - .ads_intro_subsection_title,
  319. 317.  - .ads_intro_new_title {
  320. 318.  -   color: #5c7b9b;
  321. 319.  - }
  322. 320.  -
  323. 321.  - .ads_intro_title {
  324. 322.  -   font-size: 1.3em;
  325. 323.  -   font-weight: bold;
  326. 324.  -   padding-bottom: 16px;
  327. 325.  - }
  328. 326.  -
  329. 327.  - .ads_intro_section_title {
  330. 328.  -   font-size: 1.2em;
  331. 329.  -   font-weight: bold;
  332. 330.  -   padding: 8px 10px 0 10px;
  333. 331.  - }
  334. 332.  -
  335. 333.  - .ads_intro_subsection_title {
  336. 334.  -   font-size: 1.2em;
  337. 335.  -   font-weight: bold;
  338. 336.  -   padding-bottom: 8px;
  339. 337.  - }
  340. 338.  -
  341. 339.  - .ads_intro_new_title {
  342. 340.  -   font-size: 1.2em;
  343. 341.  -   font-weight: bold;
  344. 342.  -   border-bottom: 1px solid #dae1e8;
  345. 343.  - }
  346. 344.  -
  347. 345.  - .ads_intro_subsection_text {
  348. 346.  -   color: #808080;
  349. 347.  - }
  350. 348.  -
  351. 349.  - .ads_intro_header_wrap2 {
  352. 350.  -   height: 380px;
  353. 351.  - }
  354. 352.  -
  355. 353.  - .ads_intro_header_wrap1 {
  356. 354.  -   height: 280px;
  357. 355.  -   background-color: #edf1f5;
  358. 356.  -   padding: 22px 40px 0 40px;
  359. 357.  -   position: relative;
  360. 358.  - }
  361. 359.  -
  362. 360.  - .ads_intro_text {
  363. 361.  -   width: 440px;
  364. 362.  - }
  365. 363.  -
  366. 364.  - .ads_intro_sections {
  367. 365.  -   margin-right: -100px;
  368. 366.  -   top: 190px;
  369. 367.  -   position: absolute;
  370. 368.  - }
  371. 369.  -
  372. 370.  - .ads_intro_section_button {
  373. 371.  -   width: 188px;
  374. 372.  -   height: 162px;
  375. 373.  -   background-color: #f4f6f8;
  376. 374.  -   border: 1px solid #e1e6eb;
  377. 375.  -   border-bottom: 2px solid #dce1e6;
  378. 376.  -   display: inline-block;
  379. 377.  -   margin-right: 43px;
  380. 378.  -   -moz-border-radius: 3px;
  381. 379.  -   -webkit-border-radius: 3px;
  382. 380.  -   -khtml-border-radius: 3px;
  383. 381.  -   border-radius: 3px;
  384. 382.  -   text-align: center;
  385. 383.  -   position: relative;
  386. 384.  -   top: 0;
  387. 385.  -
  388. 386.  -   -webkit-transition: all 200ms ease-out;
  389. 387.  -   -moz-transition: all 200ms ease-out;
  390. 388.  -   -o-transition: all 200ms ease-out;
  391. 389.  -   transition: all 200ms ease-out;
  392. 390.  - }
  393. 391.  -
  394. 392.  - .ads_intro_section_button:hover {
  395. 393.  -   text-decoration: none;
  396. 394.  -   top: -8px;
  397. 395.  - }
  398. 396.  -
  399. 397.  - .ads_intro_section_image {
  400. 398.  -   width: 95px;
  401. 399.  -   height: 82px;
  402. 400.  -   background-size: 95px auto;
  403. 401.  -   background-image: url(/images/ads_intro_icons.png);
  404. 402.  -   background-color: argb(77, 77, 77, 77);
  405. 403.  -   display: inline-block;
  406. 404.  -   margin-top: 16px;
  407. 405.  - }
  408. 406.  - .is_2x .ads_intro_section_image {
  409. 407.  -   background-image: url(/images/ads_intro_icons_2x.png);
  410. 408.  - }
  411. 409.  -
  412. 410.  - .ads_intro_section_button2 .ads_intro_section_image {
  413. 411.  -   background-position: 0 -82px;
  414. 412.  - }
  415. 413.  - .ads_intro_section_button3 .ads_intro_section_image {
  416. 414.  -   background-position: 0 -164px;
  417. 415.  - }
  418. 416.  -
  419. 417.  - .ads_intro_section_label {
  420. 418.  -   width: 60px;
  421. 419.  -   height: 60px;
  422. 420.  -   background-size: 60px auto;
  423. 421.  -   position: absolute;
  424. 422.  -   left: -2px;
  425. 423.  -   top: -2px;
  426. 424.  - }
  427. 425.  -
  428. 426.  - .ads_intro_section_label.label_ru {
  429. 427.  -   background-image: url(/images/ads_intro_label_new_ru.png);
  430. 428.  - }
  431. 429.  - .is_2x .ads_intro_section_label.label_ru {
  432. 430.  -   background-image: url(/images/ads_intro_label_new_ru_2x.png);
  433. 431.  - }
  434. 432.  - .ads_intro_section_label.label_en {
  435. 433.  -   background-image: url(/images/ads_intro_label_new_en.png);
  436. 434.  - }
  437. 435.  - .is_2x .ads_intro_section_label.label_en {
  438. 436.  -   background-image: url(/images/ads_intro_label_new_en_2x.png);
  439. 437.  - }
  440. 438.  - .ads_intro_section_label.label_ua {
  441. 439.  -   background-image: url(/images/ads_intro_label_new_ua.png);
  442. 440.  - }
  443. 441.  - .is_2x .ads_intro_section_label.label_ua {
  444. 442.  -   background-image: url(/images/ads_intro_label_new_ua_2x.png);
  445. 443.  - }
  446. 444.  -
  447. 445.  - .ads_intro_subsections {
  448. 446.  -   padding: 3px 25px 20px 20px;
  449. 447.  -   display: inline-block;
  450. 448.  -   vertical-align: top;
  451. 449.  - }
  452. 450.  -
  453. 451.  - .ads_intro_subsection {
  454. 452.  -   padding: 15px 20px;
  455. 453.  -   display: block;
  456. 454.  -   width: 423px;
  457. 455.  - }
  458. 456.  -
  459. 457.  - .ads_intro_subsection:hover {
  460. 458.  -   text-decoration: none;
  461. 459.  -   background: #F7F7F7;
  462. 460.  - }
  463. 461.  -
  464. 462.  - .ads_intro_news {
  465. 463.  -   width: 200px;
  466. 464.  -   padding-top: 18px;
  467. 465.  -   display: inline-block;
  468. 466.  - }
  469. 467.  -
  470. 468.  - .ads_intro_news_widget_wrap {
  471. 469.  -   margin-left: -10px;
  472. 470.  -   padding-top: 8px;
  473. 471.  - }
  474. 472.  -
  475. 473.  - /* ------ */
  476. 474.  - /* Office */
  477. 475.  - /* ------ */
  478. 476.  -
  479. 477.  - .ads_create_button_office {
  480. 478.  -   float: right;
  481. 479.  -   position: relative;
  482. 480.  -   width: 0;
  483. 481.  - }
  484. 482.  - .ads_create_button_office .edit_button_wrap {
  485. 483.  -   position: absolute;
  486. 484.  -   right: 0;
  487. 485.  - }
  488. 486.  -
  489. 487.  - /* Other */
  490. 488.  -
  491. 489.  - /* --- */
  492. 490.  - /* OLD */
  493. 491.  - /* --- */
  494. 492.  -
  495. 493.  - /* From rustyle.css */
  496. 494.  -
  497. 495.  - /* Uses in paginated_table.js */
  498. 496.  - .ads_lite_cb {
  499. 497.  -   background: transparent url(/images/icons/check_lt.gif) 0px 0px no-repeat;
  500. 498.  -   line-height: 0.81em;
  501. 499.  -   vertical-align: baseline;
  502. 500.  -   padding: 0px 0px 1px 20px;
  503. 501.  -   cursor: pointer;
  504. 502.  - }
  505. 503.  - .ads_lite_cb:hover {
  506. 504.  -   background-position: 0px -32px;
  507. 505.  -   text-decoration: none;
  508. 506.  - }
  509. 507.  - .ads_lite_cb.on {
  510. 508.  -   background-position: 0px -16px;
  511. 509.  - }
  512. 510.  - .ads_lite_cb.on:hover {
  513. 511.  -   background-position: 0px -48px;
  514. 512.  - }
  515. 513.  -
  516. 514.  - .ads_mass_act_container {
  517. 515.  -   text-align: right;
  518. 516.  - }
  519. 517.  - .ads_mass_act_container div {
  520. 518.  -   margin-right: 8px;
  521. 519.  -   margin-bottom: 5px;
  522. 520.  - }
  523. 521.  - .ads_mass_act_container button {
  524. 522.  -   height: 21px;
  525. 523.  -   line-height: 0.9em;
  526. 524.  -   padding: 4px 10px 4px;
  527. 525.  - }
  528. 526.  - .ads_search_cell {
  529. 527.  -   width: 140px;
  530. 528.  - }
  531. 529.  - .ads_search_cell div.pt_search_container {
  532. 530.  -   margin: 0px -3px 5px -3px;
  533. 531.  - }
  534. 532.  -
  535. 533.  - div.ads_selecting_subclasses {
  536. 534.  -   margin-bottom: 4px;
  537. 535.  - }
  538. 536.  -
  539. 537.  - .dd_menu_header.ads_dd_wide.ads_dd_header_popup div {
  540. 538.  -   background: url(/images/flydead.gif) no-repeat right 6px #FFFFFF;
  541. 539.  -   padding-right: 17px;
  542. 540.  -   border: 1px solid #FFFFFF;
  543. 541.  -   color: #2B587A;
  544. 542.  -   font-weight: normal;
  545. 543.  -   text-decoration: none;
  546. 544.  - }
  547. 545.  -
  548. 546.  - .dd_menu_header.ads_dd_wide div {
  549. 547.  -   background: #5e82a8 url(/images/flydead.gif) no-repeat right -12px;
  550. 548.  -   width: 106px;
  551. 549.  - }
  552. 550.  -
  553. 551.  - .dd_menu_body.ads_dd_wide .dd_menu_rows a {
  554. 552.  -   height: 20px;
  555. 553.  - }
  556. 554.  - .dd_menu_body.ads_dd_wide .dd_menu_rows a .ads_status_image_span {
  557. 555.  -   margin: 4px 5px -2px -1px;
  558. 556.  - }
  559. 557.  -
  560. 558.  - .dd_menu_header.ads_dd_wide div .ads_status_image_span {
  561. 559.  -   margin: 4px 5px -1px -1px;
  562. 560.  - }
  563. 561.  - .dd_menu_header.ads_dd_wide div {
  564. 562.  -   line-height: 1.45em;
  565. 563.  - }
  566. 564.  -
  567. 565.  - td.paginated_table_cell.column_status_view {
  568. 566.  -   padding-left: 10px;
  569. 567.  - }
  570. 568.  -
  571. 569.  - .ads_status_selector_box {
  572. 570.  -   display: block;
  573. 571.  -   margin: 0px auto;
  574. 572.  -   width: 20px;
  575. 573.  -   height: 20px;
  576. 574.  - }
  577. 575.  -
  578. 576.  - .ads_status_selector_box.pnt {
  579. 577.  -   cursor: pointer;
  580. 578.  - }
  581. 579.  -
  582. 580.  - .ads_status_selector_box.pnt:hover {
  583. 581.  -   background-color: #E1E7ED;
  584. 582.  -   border-radius: 3px;
  585. 583.  -   -moz-border-radius: 3px;
  586. 584.  - }
  587. 585.  -
  588. 586.  - #ads_unions_content .table_label {
  589. 587.  -   min-width: 150px;
  590. 588.  -   max-width: 180px;
  591. 589.  -   color: rgb(102, 102, 102);
  592. 590.  -   padding: 0 10px 7px 0;
  593. 591.  -   vertical-align: top;
  594. 592.  -   word-wrap: break-word;
  595. 593.  - }
  596. 594.  - #ads_unions_content .table_value {
  597. 595.  -   padding: 0 0 7px 0;
  598. 596.  -   vertical-align: top;
  599. 597.  -   word-wrap: break-word;
  600. 598.  - }
  601. 599.  -
  602. 600.  - #ads_unions_content.ad_help {
  603. 601.  -   padding: 0;
  604. 602.  - }
  605. 603.  -
  606. 604.  - #ads_unions_content {
  607. 605.  -   vertical-align: top;
  608. 606.  - }
  609. 607.  -
  610. 608.  - #ads_union_children,
  611. 609.  - #ads_unions_budget,
  612. 610.  - #ads_unions_budget_posts {
  613. 611.  -   padding-top: 20px;
  614. 612.  - }
  615. 613.  -
  616. 614.  - #ads_union_children_graph {
  617. 615.  -   padding: 30px 0 15px 0;
  618. 616.  - }
  619. 617.  -
  620. 618.  - #ads_union_children .row_div.control_label {
  621. 619.  -   padding-left: 0;
  622. 620.  - }
  623. 621.  -
  624. 622.  - .ads_unions_box td.label {
  625. 623.  -   color: #777;
  626. 624.  -   padding: 5px 10px 5px 0px;
  627. 625.  -   text-align: right;
  628. 626.  - }
  629. 627.  - .ads_unions_box td.labeled {
  630. 628.  -   padding: 2px 0;
  631. 629.  - }
  632. 630.  - .ads_unions_box td.labeled_info {
  633. 631.  -   padding: 2px 0 2px 5px;
  634. 632.  - }
  635. 633.  -
  636. 634.  - .ads_unions_box input {
  637. 635.  -   width: 150px;
  638. 636.  - }
  639. 637.  -
  640. 638.  - .ads_unions_list table {
  641. 639.  -   border-collapse: collapse;
  642. 640.  -   border-left: 1px solid;
  643. 641.  -   border-right: 1px solid;
  644. 642.  -   width: 100%;
  645. 643.  - }
  646. 644.  -
  647. 645.  - .ads_unions_list th,
  648. 646.  - .ads_unions_list td {
  649. 647.  -   height: 32px;
  650. 648.  -   vertical-align: middle;
  651. 649.  - }
  652. 650.  -
  653. 651.  - .ads_unions_list .checkbox_container td {
  654. 652.  -   height: 20px;
  655. 653.  - }
  656. 654.  -
  657. 655.  - .ads_unions_list th {
  658. 656.  -   text-align: right;
  659. 657.  -   background-color: rgb(227, 233, 238);
  660. 658.  -   border: 1px solid;
  661. 659.  -   padding: 0;
  662. 660.  - }
  663. 661.  - .ads_table_header th th,
  664. 662.  - .ads_table_header th th * {
  665. 663.  -   background-color: transparent !important;
  666. 664.  - }
  667. 665.  -
  668. 666.  - .ads_unions_list th,
  669. 667.  - .ads_unions_list th * {
  670. 668.  -   color: rgb(81, 103, 122);
  671. 669.  - }
  672. 670.  -
  673. 671.  - .ads_unions_list td {
  674. 672.  -   text-align: right;
  675. 673.  - }
  676. 674.  -
  677. 675.  - .ads_unions_list .column_date_view,
  678. 676.  - .ads_unions_list .column_date_view *,
  679. 677.  - .ads_unions_list .column_action_view,
  680. 678.  - .ads_unions_list .column_action_view *,
  681. 679.  - .ads_unions_list .column_access_view,
  682. 680.  - .ads_unions_list .column_access_view *,
  683. 681.  - .ads_unions_list .column_name_view,
  684. 682.  - .ads_unions_list .column_name_view *,
  685. 683.  - .ads_unions_list .column_name,
  686. 684.  - .ads_unions_list .column_name *,
  687. 685.  - .ads_unions_list .column_status,
  688. 686.  - .ads_unions_list .column_status * {
  689. 687.  -   text-align: left;
  690. 688.  - }
  691. 689.  -
  692. 690.  - .ads_unions_list td.column_name_view {
  693. 691.  -   max-width: 160px;
  694. 692.  - }
  695. 693.  -
  696. 694.  - .ads_unions_list .table_footer td {
  697. 695.  -   background-color: rgb(246, 247, 249);
  698. 696.  -   border-top: 1px solid rgb(211, 219, 225);
  699. 697.  -   border-bottom: 1px solid rgb(211, 219, 225);
  700. 698.  - }
  701. 699.  -
  702. 700.  - .ads_unions_list table,
  703. 701.  - .ads_unions_list th,
  704. 702.  - .ads_unions_list td {
  705. 703.  -   border-color: rgb(211, 219, 225);
  706. 704.  - }
  707. 705.  -
  708. 706.  - .ads_unions_list th * {
  709. 707.  -   border: 0;
  710. 708.  -   padding: 0;
  711. 709.  -   height: auto;
  712. 710.  - }
  713. 711.  -
  714. 712.  - .ads_unions_list th table {
  715. 713.  -   height: 100%;
  716. 714.  -   border: 0;
  717. 715.  - }
  718. 716.  -
  719. 717.  - .ads_unions_list tr.ads_table_header th th {
  720. 718.  -   border-left: 1px solid rgb(239, 242, 245);
  721. 719.  -   white-space: nowrap;
  722. 720.  - }
  723. 721.  -
  724. 722.  - .ads_unions_list tr.ads_table_header th.first_table_header,
  725. 723.  - .ads_unions_list tr.ads_table_header th.first_table_header * {
  726. 724.  -   border-left: 0 none;
  727. 725.  - }
  728. 726.  -
  729. 727.  - .ads_unions_list th th,
  730. 728.  - .ads_unions_list td {
  731. 729.  -   padding: 0 8px;
  732. 730.  - }
  733. 731.  -
  734. 732.  - .ads_unions_list th.first_table_header th,
  735. 733.  - .ads_unions_list td.first_table_column {
  736. 734.  -   padding-left: 10px;
  737. 735.  - }
  738. 736.  -
  739. 737.  - .ads_unions_list th.last_table_header th,
  740. 738.  - .ads_unions_list td.last_table_column {
  741. 739.  -   padding-right: 10px;
  742. 740.  - }
  743. 741.  -
  744. 742.  - .ads_unions_list td.even_row {
  745. 743.  -   background-color: #F0F2F4;
  746. 744.  - }
  747. 745.  -
  748. 746.  - .ads_unions_table {
  749. 747.  -   margin-top: 7px;
  750. 748.  - }
  751. 749.  -
  752. 750.  - .paginated_table .ads_unions_table {
  753. 751.  -   margin-top: 0px;
  754. 752.  - }
  755. 753.  -
  756. 754.  - .ads_unions_list td.column_day_limit_view a,
  757. 755.  - .ads_unions_list td.column_all_limit_view a,
  758. 756.  - .ads_unions_list td.column_cost_per_click_view a {
  759. 757.  -   border-bottom: 1px dashed #2B587A;
  760. 758.  -   text-decoration: none;
  761. 759.  - }
  762. 760.  -
  763. 761.  - tr.ads_union_empty_row td.ads_union_empty_cell {
  764. 762.  -   height: auto;
  765. 763.  - }
  766. 764.  -
  767. 765.  - tr.ads_union_empty_row td.ads_union_empty_cell {
  768. 766.  -   text-align: center !important;
  769. 767.  -   color: #666666;
  770. 768.  -   line-height: 150%;
  771. 769.  -   background-color: #F7F7F7;
  772. 770.  -   padding: 15px 0;
  773. 771.  - }
  774. 772.  -
  775. 773.  - .ads_unions_list_p .paginated_table_cell {
  776. 774.  -   text-align: right;
  777. 775.  - }
  778. 776.  -
  779. 777.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_date_view,
  780. 778.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_date_view *,
  781. 779.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_action_view,
  782. 780.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_action_view *,
  783. 781.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_access_view,
  784. 782.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_access_view *,
  785. 783.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name_view,
  786. 784.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name_view *,
  787. 785.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name,
  788. 786.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name *,
  789. 787.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_status,
  790. 788.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_status * {
  791. 789.  -   text-align: left;
  792. 790.  - }
  793. 791.  -
  794. 792.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name_view,
  795. 793.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name_view *,
  796. 794.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name,
  797. 795.  - .ads_unions_list_p .paginated_table .paginated_table_cell.column_name *,
  798. 796.  - .paginated_table .paginated_table_cell.column_client_name,
  799. 797.  - .paginated_table .paginated_table_cell.column_client_name *,
  800. 798.  - .paginated_table .paginated_table_cell.column_campaign_name,
  801. 799.  - .paginated_table .paginated_table_cell.column_campaign_name * {
  802. 800.  -   white-space: normal !important;
  803. 801.  - }
  804. 802.  -
  805. 803.  - .ads_unions_list_p td.paginated_table_cell.column_name_view,
  806. 804.  - .ads_unions_list_p td.paginated_table_cell.column_name {
  807. 805.  -   max-width: 160px;
  808. 806.  -   overflow: visible;
  809. 807.  - }
  810. 808.  - .ads_unions_list_p td.paginated_table_cell.column_date_view {
  811. 809.  -   min-width: 20%;
  812. 810.  - }
  813. 811.  - .ads_unions_list_p .paginated_table td.paginated_table_cell.column_day_limit_view a,
  814. 812.  - .ads_unions_list_p .paginated_table td.paginated_table_cell.column_all_limit_view a,
  815. 813.  - .ads_unions_list_p .paginated_table td.paginated_table_cell.column_cost_per_click_view a {
  816. 814.  -   border-bottom: 1px dashed #2B587A;
  817. 815.  -   text-decoration: none;
  818. 816.  - }
  819. 817.  -
  820. 818.  - .ads_unions_list_p .paginated_table td.column_video_views_count_view {
  821. 819.  -   width: 1px;
  822. 820.  - }
  823. 821.  -
  824. 822.  - tr.ads_union_empty_row td.ads_union_empty_cell {
  825. 823.  -   height: auto;
  826. 824.  - }
  827. 825.  -
  828. 826.  - tr.ads_union_empty_row td.ads_union_empty_cell {
  829. 827.  -   text-align: center !important;
  830. 828.  -   color: #666666;
  831. 829.  -   line-height: 150%;
  832. 830.  -   background-color: #F7F7F7;
  833. 831.  -   padding: 15px 0;
  834. 832.  - }
  835. 833.  -
  836. 834.  - /* Some navigation - begin */
  837. 835.  -
  838. 836.  - #ads_graph_navigation a.nav,
  839. 837.  - #ads_demography_navigation a.nav {
  840. 838.  -   padding: 6px 6px 7px 11px;
  841. 839.  -   display: block;
  842. 840.  -   overflow: hidden;
  843. 841.  - }
  844. 842.  - #ads_graph_navigation a.nav:hover,
  845. 843.  - #ads_demography_navigation a.nav:hover {
  846. 844.  -   background-color: #DAE1E8;
  847. 845.  -   text-decoration: none;
  848. 846.  - }
  849. 847.  - #ads_graph_navigation a.nav_selected,
  850. 848.  - #ads_graph_navigation a.nav_selected:hover,
  851. 849.  - #ads_demography_navigation a.nav_selected,
  852. 850.  - #ads_demography_navigation a.nav_selected:hover {
  853. 851.  -   background-color: #6186AD;
  854. 852.  -   color: white;
  855. 853.  - }
  856. 854.  -
  857. 855.  - /* Some navigation - end */
  858. 856.  -
  859. 857.  - a.ads_status_link,
  860. 858.  - a.ads_inline_dropdown {
  861. 859.  -   background: none !important;
  862. 860.  -   border-bottom: 1px dashed #2B587A;
  863. 861.  -   padding-right: 0 !important;
  864. 862.  - }
  865. 863.  -
  866. 864.  - .ads_main_notice {
  867. 865.  -   background-color: #F6F7F9;
  868. 866.  -   border: 1px solid #D8DFEA;
  869. 867.  -   padding: 10px;
  870. 868.  -   margin-bottom: 15px;
  871. 869.  -   line-height: 160%;
  872. 870.  - }
  873. 871.  -
  874. 872.  - .ads_warning {
  875. 873.  -   background-color: #F9F6E7;
  876. 874.  -   border: 1px solid #D4BC4C;
  877. 875.  -   padding: 8px 11px;
  878. 876.  -   line-height: 160%;
  879. 877.  - }
  880. 878.  -
  881. 879.  - .ads_warning_light {
  882. 880.  -   background-color: #FFFFFF;
  883. 881.  -   border: 1px solid #B9C4DA;
  884. 882.  -   padding: 8px 11px;
  885. 883.  - }
  886. 884.  -
  887. 885.  - .ads_small_info {
  888. 886.  -   background: none repeat scroll 0 0 #F7F7F7;
  889. 887.  -   border: 1px solid #DAE1E8;
  890. 888.  -   font-size: 0.91em;
  891. 889.  -   margin-top: 10px;
  892. 890.  -   padding: 5px 10px;
  893. 891.  -   vertical-align: top;
  894. 892.  - }
  895. 893.  -
  896. 894.  - #ads_change_budget_box .ads_warning {
  897. 895.  -   margin-top: 10px;
  898. 896.  - }
  899. 897.  -
  900. 898.  - #ads_change_budget_box td {
  901. 899.  -   padding: 0px;
  902. 900.  - }
  903. 901.  -
  904. 902.  - .ads_union_status_image {
  905. 903.  -   background: url("/images/icons/ad_status.gif?3") no-repeat scroll left top transparent;
  906. 904.  -   width: 5px;
  907. 905.  -   height: 5px;
  908. 906.  -   margin: 0 5px 1px 0;
  909. 907.  -   display: block;
  910. 908.  -
  911. 909.  -   display:   -moz-inline-stack;
  912. 910.  -   display:   inline-block;
  913. 911.  -   _overflow: hidden;
  914. 912.  -   *zoom:     1;
  915. 913.  -   *display:  inline;
  916. 914.  - }
  917. 915.  -
  918. 916.  - .ads_union_status_image_on {
  919. 917.  -   background-position: left 0;
  920. 918.  - }
  921. 919.  - .ads_union_status_image_off {
  922. 920.  -   background-position: left -5px;
  923. 921.  - }
  924. 922.  - .ads_union_status_image_part_on {
  925. 923.  -   background-position: left -10px;
  926. 924.  - }
  927. 925.  - .ads_union_status_image_part_off {
  928. 926.  -   background-position: left -15px;
  929. 927.  - }
  930. 928.  - .ads_union_status_image_disapproved {
  931. 929.  -   background-position: left -20px;
  932. 930.  - }
  933. 931.  - .ads_union_status_image_deleted {
  934. 932.  -   background-position: left -25px;
  935. 933.  - }
  936. 934.  -
  937. 935.  - .ads_status_image_span {
  938. 936.  -   background: url("/images/icons/ad_status_new.gif") no-repeat scroll left top transparent;
  939. 937.  -   width: 11px;
  940. 938.  -   height: 11px;
  941. 939.  -   margin: 5px 0px 3px 2px;
  942. 940.  -   display: block;
  943. 941.  -
  944. 942.  -   display:   -moz-inline-stack;
  945. 943.  -   display:   inline-block;
  946. 944.  -   _overflow: hidden;
  947. 945.  -   *zoom:     1;
  948. 946.  -   *display:  inline;
  949. 947.  - }
  950. 948.  -
  951. 949.  - .dd_menu_header.ads_dd_header_popup .ads_status_image_span.status_on,
  952. 950.  - .ads_status_image_span.status_on {
  953. 951.  -   background-position: left -0px;
  954. 952.  - }
  955. 953.  - .dd_menu_header.ads_dd_header_popup .ads_status_image_span.status_off,
  956. 954.  - .ads_status_image_span.status_off {
  957. 955.  -   background-position: left -170px;
  958. 956.  - }
  959. 957.  - .dd_menu_header.ads_dd_header_popup .ads_status_image_span.status_pending,
  960. 958.  - .ads_status_image_span.status_pending {
  961. 959.  -   background-position: left -157px;
  962. 960.  - }
  963. 961.  - .dd_menu_header.ads_dd_header_popup .ads_status_image_span.status_off_red,
  964. 962.  - .ads_status_image_span.status_off_red {
  965. 963.  -   background-position: left -128px;
  966. 964.  - }
  967. 965.  - .dd_menu_header.ads_dd_header_popup .ads_status_image_span.status_deleted,
  968. 966.  - .ads_status_image_span.status_deleted {
  969. 967.  -   background-position: left -183px;
  970. 968.  - }
  971. 969.  - .dd_menu_header.ads_dd_header_popup .ads_status_image_span.status_cross,
  972. 970.  - .ads_status_image_span.status_cross {
  973. 971.  -   background-position: left -141px;
  974. 972.  - }
  975. 973.  -
  976. 974.  - .dd_menu_header .ads_status_image_span.status_on {
  977. 975.  -   background-position: left -16px;
  978. 976.  - }
  979. 977.  - .dd_menu_header .ads_status_image_span.status_off {
  980. 978.  -   background-position: left -29px;
  981. 979.  - }
  982. 980.  - .dd_menu_header .ads_status_image_span.status_pending {
  983. 981.  -   background-position: left -69px;
  984. 982.  - }
  985. 983.  - .dd_menu_header .ads_status_image_span.status_off_red {
  986. 984.  -   background-position: left -29px;
  987. 985.  - }
  988. 986.  - .dd_menu_header .ads_status_image_span.status_deleted {
  989. 987.  -   background-position: left -41px;
  990. 988.  - }
  991. 989.  - .dd_menu_header .ads_status_image_span.status_cross {
  992. 990.  -   background-position: left -55px;
  993. 991.  - }
  994. 992.  -
  995. 993.  - .dd_menu_body.ads_dd_wide .dd_menu_rows a .ads_status_image_span.status_on {
  996. 994.  -   background-position: left -85px;
  997. 995.  - }
  998. 996.  - .dd_menu_body.ads_dd_wide .dd_menu_rows a .ads_status_image_span.status_off {
  999. 997.  -   background-position: left -98px;
  1000. 998.  - }
  1001. 999.  - .dd_menu_body.ads_dd_wide .dd_menu_rows a .ads_status_image_span.status_deleted {
  1002. 1000.  -   background-position: left -111px;
  1003. 1001.  - }
  1004. 1002.  -
  1005. 1003.  - .ads_unions_list tr.ads_table_header th.paginated_table td.paginated_table_cell.column_commit_date,
  1006. 1004.  - .ads_unions_list tr.ads_table_header th.paginated_table td.paginated_table_cell.column_commit_date * {
  1007. 1005.  -   border-left: 0 none;
  1008. 1006.  - }
  1009. 1007.  -
  1010. 1008.  - #ads_unions_budget * {
  1011. 1009.  -   text-align: left;
  1012. 1010.  - }
  1013. 1011.  -
  1014. 1012.  - #ads_general_info_status_selector {
  1015. 1013.  -   border-bottom: 1px dashed #2B587A;
  1016. 1014.  - }
  1017. 1015.  -
  1018. 1016.  - table.ads_unions_content_label {
  1019. 1017.  -   border-collapse: collapse;
  1020. 1018.  - }
  1021. 1019.  -
  1022. 1020.  - #ads_unions_content .ads_export_prefs .ads_export_date_row .table_label {
  1023. 1021.  -   padding-top: 4px;
  1024. 1022.  - }
  1025. 1023.  - .ads_export_prefs .table_value {
  1026. 1024.  -   width: 300px;
  1027. 1025.  - }
  1028. 1026.  -
  1029. 1027.  - #ads_unions_content .export_prefs_web .summary td {
  1030. 1028.  -   padding-top: 10px !important;
  1031. 1029.  - }
  1032. 1030.  -
  1033. 1031.  - .ads_export_stats .ads_unions_table th.paginated_table td.paginated_table_cell.column_checked {
  1034. 1032.  -   width: 34px;
  1035. 1033.  - }
  1036. 1034.  -
  1037. 1035.  - .ads_unions_list .checkbox_container table {
  1038. 1036.  -   border: 0px;
  1039. 1037.  - }
  1040. 1038.  -
  1041. 1039.  - .ads_unions_table .hovered_header,
  1042. 1040.  - .ads_unions_table .hovered_header_hover {
  1043. 1041.  -   cursor: pointer;
  1044. 1042.  - }
  1045. 1043.  - .ads_unions_table .hovered_header_hover {
  1046. 1044.  -   background-color: #EFF2F5;
  1047. 1045.  - }
  1048. 1046.  -
  1049. 1047.  - .ads_inline_edit_remove_value {
  1050. 1048.  -   margin-left: 5px;
  1051. 1049.  -   white-space: nowrap;
  1052. 1050.  - }
  1053. 1051.  -
  1054. 1052.  - .ads_inline_edit_table {
  1055. 1053.  -   border-collapse: collapse;
  1056. 1054.  - }
  1057. 1055.  - table.ads_inline_edit_table td {
  1058. 1056.  -   padding: 0;
  1059. 1057.  - }
  1060. 1058.  - .ads_inline_fast_error_row {
  1061. 1059.  -   display: none;
  1062. 1060.  - }
  1063. 1061.  - .ads_inline_fast_error {
  1064. 1062.  -   background-color: #F9F6E7;
  1065. 1063.  -   border: 1px solid #D4BC4C;
  1066. 1064.  -   padding: 8px 11px;
  1067. 1065.  -   margin-top: 5px;
  1068. 1066.  - }
  1069. 1067.  -
  1070. 1068.  - .ads_inline_recommended_cost_text {
  1071. 1069.  -   font-size: 0.91em;
  1072. 1070.  -   color: #777777;
  1073. 1071.  -   display: none;
  1074. 1072.  - }
  1075. 1073.  -
  1076. 1074.  - .ads_moder_comment_rules_wrap ul {
  1077. 1075.  -   list-style: square outside none;
  1078. 1076.  -   color: #758EAC;
  1079. 1077.  -   margin: 11px 0 0 0;
  1080. 1078.  - }
  1081. 1079.  - .ads_moder_comment_rules_wrap span {
  1082. 1080.  -   color: black;
  1083. 1081.  - }
  1084. 1082.  - .ads_moder_comment_rules_separator {
  1085. 1083.  -   height: 11px;
  1086. 1084.  - }
  1087. 1085.  -
  1088. 1086.  - #ads_admin_box_wrapper a:hover {
  1089. 1087.  -   text-decoration: underline;
  1090. 1088.  - }
  1091. 1089.  -
  1092. 1090.  - .ads_admin_table_cell {
  1093. 1091.  -   border-bottom: 1px solid #DAE2E8;
  1094. 1092.  - }
  1095. 1093.  -
  1096. 1094.  - .admin_table_cell_last {
  1097. 1095.  -   border-bottom: none;
  1098. 1096.  - }
  1099. 1097.  -
  1100. 1098.  - .ads_admin_box_label {
  1101. 1099.  -   color: #777777;
  1102. 1100.  -   text-align: right;
  1103. 1101.  -   width: 125px;
  1104. 1102.  -   padding-right: 10px;
  1105. 1103.  - }
  1106. 1104.  - .ads_admin_box_labeled {
  1107. 1105.  -   width: 270px;
  1108. 1106.  - }
  1109. 1107.  -
  1110. 1108.  - .ads_general_info_hidden {
  1111. 1109.  -   display: none;
  1112. 1110.  - }
  1113. 1111.  -
  1114. 1112.  - .ads_general_info .table_large_text {
  1115. 1113.  -   width: 400px;
  1116. 1114.  - }
  1117. 1115.  -
  1118. 1116.  - #ads_unions_content h4 span {
  1119. 1117.  -   font-weight: bold
  1120. 1118.  - }
  1121. 1119.  -
  1122. 1120.  - .ads_users_stats_dark {
  1123. 1121.  -   background-color: #597DA3;
  1124. 1122.  - }
  1125. 1123.  -
  1126. 1124.  - .ads_users_stats_light {
  1127. 1125.  -   background-color: #DAE1E8;
  1128. 1126.  - }
  1129. 1127.  -
  1130. 1128.  - .ads_users_stats_bars_title {
  1131. 1129.  -   padding-bottom: 16px;
  1132. 1130.  -   color: #45688E;
  1133. 1131.  -   font-weight: bold;
  1134. 1132.  - }
  1135. 1133.  -
  1136. 1134.  - .ads_users_stats_bar_label {
  1137. 1135.  -   height: 30px;
  1138. 1136.  -   text-align: right;
  1139. 1137.  -   padding-right: 16px;
  1140. 1138.  -   padding-top: 2px;
  1141. 1139.  -   vertical-align: top;
  1142. 1140.  -   color: #45688E;
  1143. 1141.  -   font-weight: bold;
  1144. 1142.  - }
  1145. 1143.  - .ads_users_stats_bar_wrap table {
  1146. 1144.  -   border: 0px;
  1147. 1145.  -   border-collapse: collapse;
  1148. 1146.  - }
  1149. 1147.  - .ads_users_stats_bar_wrap table td {
  1150. 1148.  -   padding: 0px;
  1151. 1149.  - }
  1152. 1150.  - .ads_users_stats_bar_wrap {
  1153. 1151.  -   height: 30px;
  1154. 1152.  -   vertical-align: top;
  1155. 1153.  - }
  1156. 1154.  - .ads_users_stats_bar_wrap table td.ads_users_stats_bar_value {
  1157. 1155.  -   padding-left: 11px;
  1158. 1156.  - }
  1159. 1157.  - .ads_users_stats_bar {
  1160. 1158.  -   -moz-border-radius: 0 3px 3px 0;
  1161. 1159.  -   -webkit-border-radius: 0 3px 3px 0;
  1162. 1160.  -   -khtml-border-radius: 0 3px 3px 0;
  1163. 1161.  -   border-radius: 0 3px 3px 0;
  1164. 1162.  -   height: 17px;
  1165. 1163.  - }
  1166. 1164.  -
  1167. 1165.  - #ads_demography_wrap .summary_right .summary_tab2 {
  1168. 1166.  -   background-color: transparent;
  1169. 1167.  - }
  1170. 1168.  -
  1171. 1169.  - .ads_dropdown_menu_scrollbar {
  1172. 1170.  -   position: absolute;
  1173. 1171.  -   z-index: 1500;
  1174. 1172.  -   background-color: #000;
  1175. 1173.  -
  1176. 1174.  -   opacity: 0.4;
  1177. 1175.  -   -moz-opacity: 0.4;
  1178. 1176.  -   filter: alpha(opacity=40);
  1179. 1177.  -
  1180. 1178.  -   border-radius: 3px;
  1181. 1179.  -   -webkit-border-radius: 3px;
  1182. 1180.  -   -moz-border-radius: 3px;
  1183. 1181.  -   -khtml-border-radius: 3px;
  1184. 1182.  - }
  1185. 1183.  - .ads_dropdown_menu_scrollbar:hover,
  1186. 1184.  - .ads_dropdown_menu_scrollbar.hovered {
  1187. 1185.  -   opacity: 0.6;
  1188. 1186.  -   -moz-opacity: 0.6;
  1189. 1187.  -   filter: alpha(opacity=60);
  1190. 1188.  - }
  1191. 1189.  -
  1192. 1190.  - #ads_admin_box_wrapper h2 {
  1193. 1191.  -   padding: 0;
  1194. 1192.  -   margin: 0;
  1195. 1193.  -   border: none;
  1196. 1194.  - }
  1197. 1195.  -
  1198. 1196.  - #ads_reqs_edit td.ads_req_label {
  1199. 1197.  -   color: #666666;
  1200. 1198.  -   text-align: right;
  1201. 1199.  -   vertical-align: top;
  1202. 1200.  -   padding-top: 5px;
  1203. 1201.  - }
  1204. 1202.  -
  1205. 1203.  - #ads_reqs_edit td.ads_req_right {
  1206. 1204.  -   width: 100px;
  1207. 1205.  - }
  1208. 1206.  -
  1209. 1207.  - #ads_reqs_edit_form input.ads_req_edit,
  1210. 1208.  - #ads_reqs_edit_form textarea.ads_req_edit {
  1211. 1209.  -   margin: 0px;
  1212. 1210.  -   width: 250px;
  1213. 1211.  - }
  1214. 1212.  -
  1215. 1213.  - #ads_legal_info_box div {
  1216. 1214.  -   padding: 8px 11px;
  1217. 1215.  -   border: 1px solid #C0CAD5;
  1218. 1216.  - }
  1219. 1217.  -
  1220. 1218.  - /*
  1221. 1219.  -  *   About section
  1222. 1220.  -  */
  1223. 1221.  -
  1224. 1222.  - .ads_help_section.section_wrap {
  1225. 1223.  -   padding: 20px 25px 25px 26px;
  1226. 1224.  -   line-height: 130%;
  1227. 1225.  - }
  1228. 1226.  -
  1229. 1227.  - .ads_help_section .header {
  1230. 1228.  -   font-size: 1.09em;
  1231. 1229.  -   margin: 0px 0px 20px 1px;
  1232. 1230.  -   border: none;
  1233. 1231.  - }
  1234. 1232.  - .ads_help_section .sub_header {
  1235. 1233.  -   border-bottom: 1px solid #DAE1E8;
  1236. 1234.  -   font-size: 1em;
  1237. 1235.  -   margin-bottom: 10px;
  1238. 1236.  -   padding-bottom: 2px;
  1239. 1237.  - }
  1240. 1238.  - .ads_help_section .sub_header,
  1241. 1239.  - .ads_help_section .header {
  1242. 1240.  -   color: #45688E;
  1243. 1241.  -   font-weight: bold;
  1244. 1242.  - }
  1245. 1243.  -
  1246. 1244.  - .ads_help_section .listing li {
  1247. 1245.  -   padding-top: 2px;
  1248. 1246.  - }
  1249. 1247.  -
  1250. 1248.  - .ads_help_section .listing,
  1251. 1249.  - .ads_help_section ol {
  1252. 1250.  -   padding-bottom: 0px;
  1253. 1251.  -   margin-bottom: 0px;
  1254. 1252.  - }
  1255. 1253.  -
  1256. 1254.  - .ads_help_section .par_divider {
  1257. 1255.  -   margin-bottom: 31px;
  1258. 1256.  - }
  1259. 1257.  -
  1260. 1258.  - .ads_help_section .emph_link {
  1261. 1259.  -   margin-left: 26px;
  1262. 1260.  - }
  1263. 1261.  -
  1264. 1262.  - #unions_navigation {
  1265. 1263.  -   vertical-align: top;
  1266. 1264.  - }
  1267. 1265.  -
  1268. 1266.  - #unions_navigation {
  1269. 1267.  -   width: 150px;
  1270. 1268.  -   padding: 12px 12px 12px 0;
  1271. 1269.  - }
  1272. 1270.  -
  1273. 1271.  - #unions_navigation .edit_button_wrap {
  1274. 1272.  -   padding-bottom: 10px;
  1275. 1273.  - }
  1276. 1274.  -
  1277. 1275.  - #unions_navigation .nav_separator {
  1278. 1276.  -   border-bottom: 1px solid rgb(211, 219, 225);
  1279. 1277.  -   height: 1px;
  1280. 1278.  -   overflow: hidden;
  1281. 1279.  -   margin: 7px 0px 8px 0;
  1282. 1280.  - }
  1283. 1281.  -
  1284. 1282.  - #unions_navigation a.nav {
  1285. 1283.  -   padding: 6px 6px 7px 11px;
  1286. 1284.  -   display: block;
  1287. 1285.  -   overflow: hidden;
  1288. 1286.  -   max-width: 133px;
  1289. 1287.  -   word-wrap: break-word;
  1290. 1288.  - }
  1291. 1289.  - #unions_navigation a.nav:hover {
  1292. 1290.  -   background-color: #E1E7ED;
  1293. 1291.  -   text-decoration: none;
  1294. 1292.  - }
  1295. 1293.  - #unions_navigation a.nav_selected,
  1296. 1294.  - #unions_navigation a.nav_selected:hover {
  1297. 1295.  -   background-color: #6186AD;
  1298. 1296.  -   color: white;
  1299. 1297.  - }
  1300. 1298.  -
  1301. 1299.  -
  1302. 1300.  - #unions_navigation.ads_unions_navigation_about {
  1303. 1301.  -   background-color: #F7F7F7;
  1304. 1302.  -   border-left: 1px solid #DAE1E8;
  1305. 1303.  -   padding: 14px 10px;
  1306. 1304.  - }
  1307. 1305.  -
  1308. 1306.  - #unions_navigation.ads_unions_navigation_about .nav {
  1309. 1307.  -   border-color: #F7F7F7;
  1310. 1308.  - }
  1311. 1309.  -
  1312. 1310.  - #unions_navigation.ads_unions_navigation_about .nav_selected {
  1313. 1311.  -   border-color: #517295;
  1314. 1312.  - }
  1315. 1313.  -
  1316. 1314.  - .ads_unions_navigation_about .ad_box_preview {
  1317. 1315.  -   border: 1px solid #DCE3E9
  1318. 1316.  - }
  1319. 1317.  -
  1320. 1318.  - #ads_contacts_form {
  1321. 1319.  -   margin: 20px 0 0 0;
  1322. 1320.  - }
  1323. 1321.  - #ads_contacts_form .label_slide {
  1324. 1322.  -   vertical-align: top;
  1325. 1323.  - }
  1326. 1324.  - #ads_contacts_form .label {
  1327. 1325.  -   width: 100px;
  1328. 1326.  -   color: #555;
  1329. 1327.  -   padding: 4px 10px 0 0;
  1330. 1328.  -   text-align: right;
  1331. 1329.  -   vertical-align: top;
  1332. 1330.  - }
  1333. 1331.  - #ads_contacts_form .labeled {
  1334. 1332.  -   padding-bottom: 10px;
  1335. 1333.  - }
  1336. 1334.  - #ads_contacts_form .row_checkbox .labeled {
  1337. 1335.  -   padding-bottom: 6px;
  1338. 1336.  - }
  1339. 1337.  - #ads_contacts_form .row_checkbox_prev .labeled {
  1340. 1338.  -   padding-bottom: 8px;
  1341. 1339.  - }
  1342. 1340.  - #ads_contacts_form .row_checkbox_last .labeled {
  1343. 1341.  -   padding-bottom: 8px;
  1344. 1342.  - }
  1345. 1343.  - #ads_contacts_form td.label_slide {
  1346. 1344.  -   overflow: hidden;
  1347. 1345.  - }
  1348. 1346.  - #ads_contacts_form div.label_slide {
  1349. 1347.  -   height: 0;
  1350. 1348.  - }
  1351. 1349.  - #ads_contacts_form .checkbox_wrap {
  1352. 1350.  -   margin: -5px 0;
  1353. 1351.  - }
  1354. 1352.  - #ads_contacts_form input.txt {
  1355. 1353.  -   width: 242px;
  1356. 1354.  - }
  1357. 1355.  - #ads_contacts_form textarea.txt {
  1358. 1356.  -   width: 242px;
  1359. 1357.  -   height: 40px;
  1360. 1358.  - }
  1361. 1359.  - #ads_contacts_form textarea.txt#message {
  1362. 1360.  -   height: 90px;
  1363. 1361.  - }
  1364. 1362.  - #ads_contacts_form .msg {
  1365. 1363.  -   background-color: #f9f6e7;
  1366. 1364.  -   border-color: #c3b988;
  1367. 1365.  -   font-weight: normal;
  1368. 1366.  - }
  1369. 1367.  -
  1370. 1368.  - .ads_contacts_nonresident_message {
  1371. 1369.  -   padding: 7px 0 20px 0;
  1372. 1370.  - }
  1373. 1371.  -
  1374. 1372.  - .wk_ads_intro .wk_wiki_content {
  1375. 1373.  -   font-size: 1em;
  1376. 1374.  -   line-height: 100%;
  1377. 1375.  - }
  1378. 1376.  - .wk_ads_intro #wk_content {
  1379. 1377.  -   width: 564px;
  1380. 1378.  - }
  1381. 1379.  - .wk_ads_intro #wk_summary {
  1382. 1380.  -   width: 400px;
  1383. 1381.  - }
  1384. 1382.  -
  1385. 1383.  - .wk_ads_intro #ads_contacts_form .label {
  1386. 1384.  -   width: 140px;
  1387. 1385.  -   padding-top: 9px;
  1388. 1386.  - }
  1389. 1387.  -
  1390. 1388.  - .wk_ads_intro #ads_contacts_form input.txt,
  1391. 1389.  - .wk_ads_intro #ads_contacts_form textarea.txt {
  1392. 1390.  -   width: 254px;
  1393. 1391.  -   height: 17px;
  1394. 1392.  -   line-height: 17px;
  1395. 1393.  -   padding: 5px 6px 6px 10px;
  1396. 1394.  - }
  1397. 1395.  - @-moz-document url-prefix() {
  1398. 1396.  - .wk_ads_intro #ads_contacts_form input.txt,
  1399. 1397.  - .wk_ads_intro #ads_contacts_form textarea.txt {
  1400. 1398.  -   padding-left: 9px;
  1401. 1399.  -   width: 255px;
  1402. 1400.  - }
  1403. 1401.  - }
  1404. 1402.  - .wk_ads_intro #ads_contacts_form textarea.txt {
  1405. 1403.  -   height: 52px;
  1406. 1404.  - }
  1407. 1405.  - .wk_ads_intro #ads_contacts_form textarea.txt#message {
  1408. 1406.  -   height: 90px;
  1409. 1407.  - }
  1410. 1408.  -
  1411. 1409.  - .wk_ads_intro .ads_contacts_nonresident_message {
  1412. 1410.  -   line-height: 160%;
  1413. 1411.  - }
  1414. 1412.  -
  1415. 1413.  -
  1416. 1414.  - /* Multi dropdown menu - begin */
  1417. 1415.  -
  1418. 1416.  - a.ads_dd_menu_item_checkbox_on,
  1419. 1417.  - a.ads_dd_menu_item_checkbox_off {
  1420. 1418.  -   padding-left: 22px !important;
  1421. 1419.  -   background-image: none !important;
  1422. 1420.  -   background-position: 4px 2px !important;
  1423. 1421.  - }
  1424. 1422.  - a.ads_dd_menu_item_checkbox_on {
  1425. 1423.  -   background-image: url("/images/dropdead_check.gif") !important;
  1426. 1424.  - }
  1427. 1425.  -
  1428. 1426.  - /* Multi dropdown menu - end */
  1429. 1427.  -
  1430. 1428.  - .ads_paginated_table_name {
  1431. 1429.  -   overflow: hidden;
  1432. 1430.  -   white-space: nowrap;
  1433. 1431.  - }
  1434. 1432.  -
  1435. 1433.  - .ad_new_user td.label {
  1436. 1434.  -   text-align: right;
  1437. 1435.  -   padding: 6px 15px 6px 0;
  1438. 1436.  -   width: 120px;
  1439. 1437.  -   color: gray;
  1440. 1438.  - }
  1441. 1439.  - .ad_new_user td.labeled input {
  1442. 1440.  -   width: 160px;
  1443. 1441.  - }
  1444. 1442.  -
  1445. 1443.  - #ads_page_simple .ads_reg_row {
  1446. 1444.  -   height: 30px;
  1447. 1445.  - }
  1448. 1446.  - #ads_page_simple .ads_reg_label {
  1449. 1447.  -   width: 231px;
  1450. 1448.  -   float: left;
  1451. 1449.  -   text-align: right;
  1452. 1450.  -   color: #777777;
  1453. 1451.  -   padding: 4px 10px 0 0;
  1454. 1452.  - }
  1455. 1453.  - #ads_page_simple .ads_reg_labeled {
  1456. 1454.  -   float: left;
  1457. 1455.  - }
  1458. 1456.  - #ads_page_simple .ads_reg_labeled_input {
  1459. 1457.  -   margin: 0;
  1460. 1458.  - }
  1461. 1459.  - #ads_page_simple .ads_reg_labeled input#first_name,
  1462. 1460.  - #ads_page_simple .ads_reg_labeled input#last_name,
  1463. 1461.  - #ads_page_simple .ads_reg_labeled input#regemail,
  1464. 1462.  - #ads_page_simple .ads_reg_labeled input#regpass {
  1465. 1463.  -   width: 217px;
  1466. 1464.  - }
  1467. 1465.  -
  1468. 1466.  - .box_body .ads_disapproved_message {
  1469. 1467.  -   line-height: 150%;
  1470. 1468.  - }
  1471. 1469.  -
  1472. 1470.  - .ads_wiki_wrap {
  1473. 1471.  -   line-height: 160%;
  1474. 1472.  - }
  1475. 1473.  -
  1476. 1474.  - .ads_wiki_bonus {
  1477. 1475.  -   padding-bottom: 10px;
  1478. 1476.  - }
  1479. 1477.  -
  1480. 1478.  - #ads_bonus_activation_form .ads_unions_content_label td {
  1481. 1479.  -   padding: 0 0 4px 0;
  1482. 1480.  - }
  1483. 1481.  -
  1484. 1482.  - #ads_unions_content .payments_systems_container {
  1485. 1483.  -   padding: 7px 102px 0 50px;
  1486. 1484.  - }
  1487. 1485.  -
  1488. 1486.  - #ads_unions_content .payments_systems_container .ps_desc_short {
  1489. 1487.  -   padding-right: 120px;
  1490. 1488.  - }
  1491. 1489.  -
  1492. 1490.  - #ads_unions_content .payments_systems_container .term_info {
  1493. 1491.  -   min-height: 24px;
  1494. 1492.  - }
  1495. 1493.  -
  1496. 1494.  - #ads_unions_content .payments_landing div {
  1497. 1495.  -   margin-bottom: 20px;
  1498. 1496.  - }
  1499. 1497.  -
  1500. 1498.  - #ads_retargeting_groups_table {
  1501. 1499.  -   margin-top: 15px;
  1502. 1500.  - }
  1503. 1501.  - #ads_retargeting_groups_table .column_action_view {
  1504. 1502.  -   width: 100px;
  1505. 1503.  -   white-space: nowrap;
  1506. 1504.  - }
  1507. 1505.  - #ads_retargeting_groups .ads_retargeting_controls {
  1508. 1506.  -   padding-top: 15px;
  1509. 1507.  - }
  1510. 1508.  - .ads_retargeting_box {
  1511. 1509.  -   line-height: 160%;
  1512. 1510.  - }
  1513. 1511.  - .ads_retargeting_box_text {
  1514. 1512.  -   padding-bottom: 10px;
  1515. 1513.  - }
  1516. 1514.  - .ads_retargeting_box td.label {
  1517. 1515.  -   color: #777;
  1518. 1516.  -   padding: 5px 10px 5px 0px;
  1519. 1517.  -   text-align: right;
  1520. 1518.  -   width: 100px;
  1521. 1519.  - }
  1522. 1520.  - .ads_retargeting_box td.labeled {
  1523. 1521.  -   padding: 2px 0;
  1524. 1522.  - }
  1525. 1523.  - .ads_retargeting_box td.labeled_info {
  1526. 1524.  -   padding: 2px 0 2px 5px;
  1527. 1525.  - }
  1528. 1526.  - .ads_retargeting_box input {
  1529. 1527.  -   width: 190px;
  1530. 1528.  - }
  1531. 1529.  - #ads_retargeting_box_error {
  1532. 1530.  -   margin-bottom: 10px;
  1533. 1531.  -   display: none;
  1534. 1532.  - }
  1535. 1533.  - .ads_retargeting_box .box_msg {
  1536. 1534.  -   margin-bottom: 10px;
  1537. 1535.  -   font-weight: normal;
  1538. 1536.  - }
  1539. 1537.  - .ads_retargeting_box_notice {
  1540. 1538.  -   font-size: 0.91em;
  1541. 1539.  -   color: #777;
  1542. 1540.  - }
  1543. 1541.  - #retargeting_group_pixel {
  1544. 1542.  -   background-color: #F2F2F2;
  1545. 1543.  -   height: 110px;
  1546. 1544.  -   width: 245px;
  1547. 1545.  - }
  1548. 1546.  - .ads_retargeting_text {
  1549. 1547.  -   line-height: 150%;
  1550. 1548.  - }
  1551. 1549.  -
  1552. 1550.  - .ads_settings_notifacations {
  1553. 1551.  -   margin: 10px 0 0 10px;
  1554. 1552.  -   border-collapse: collapse;
  1555. 1553.  - }
  1556. 1554.  - .ads_settings_notifacations th,
  1557. 1555.  - .ads_settings_notifacations td {
  1558. 1556.  -   padding: 0 5px;
  1559. 1557.  -   text-align: center;
  1560. 1558.  - }
  1561. 1559.  - td.ads_settings_notifacations_label {
  1562. 1560.  -   padding: 0 30px 0 0;
  1563. 1561.  -   text-align: left;
  1564. 1562.  - }
  1565. 1563.  - .ads_settings_notifacations .checkbox_container {
  1566. 1564.  -   margin: 0 auto;
  1567. 1565.  - }
  1568. ------
  1569. Файл - ads.js (Старый размер - 89391 | Новый - 0):
  1570. 0.  - var Ads = {};
  1571. 1.  -
  1572. 2.  - Ads.init = function() {
  1573. 3.  -   showBackLink();
  1574. 4.  - }
  1575. 5.  -
  1576. 6.  - Ads.initOfficesMenu = function(event) {
  1577. 7.  -
  1578. 8.  -   if (!window.DropdownMenu || !cur.mainNavigationOfficesItems) {
  1579. 9.  -     return;
  1580. 10.  -   }
  1581. 11.  -
  1582. 12.  -   if (cur.navigationOficesMenu) {
  1583. 13.  -     return;
  1584. 14.  -   }
  1585. 15.  -
  1586. 16.  -   ge('ads_navigation_offices_menu').removeAttribute('onmouseover');
  1587. 17.  -
  1588. 18.  -   function hideMenu() {
  1589. 19.  -     cur.navigationOficesMenu.hide();
  1590. 20.  -   }
  1591. 21.  -
  1592. 22.  -   var realLocation = '';
  1593. 23.  -   if (location.hash.indexOf('#/') != -1 || location.hash.indexOf('#!') != -1) {
  1594. 24.  -     realLocation = location.hash.replace('#/', '').replace('#!', '');
  1595. 25.  -   } else {
  1596. 26.  -     realLocation = location.pathname + location.search;
  1597. 27.  -   }
  1598. 28.  -
  1599. 29.  -   var unionId;
  1600. 30.  -   var unionIdReal;
  1601. 31.  -   var unionIdParam = '';
  1602. 32.  -   var curItems = [];
  1603. 33.  -   for (var i in cur.mainNavigationOfficesItems) {
  1604. 34.  -     curItems[i] = {};
  1605. 35.  -     curItems[i].onClick = hideMenu;
  1606. 36.  -     for (var j in cur.mainNavigationOfficesItems[i]) {
  1607. 37.  -       curItems[i][j] = cur.mainNavigationOfficesItems[i][j];
  1608. 38.  -     }
  1609. 39.  -     if (curItems[i].i == 'all') {
  1610. 40.  -       curItems[i].h = "/ads?act=offices_list";
  1611. 41.  -     } else {
  1612. 42.  -       unionId = '';
  1613. 43.  -       unionIdReal = intval(curItems[i].i);
  1614. 44.  -       unionIdParam = '';
  1615. 45.  -       if (curItems[i].i.indexOf('default') == -1) {
  1616. 46.  -         unionId = unionIdReal;
  1617. 47.  -         unionIdParam = "&union_id=" + unionIdReal;
  1618. 48.  -       }
  1619. 49.  -
  1620. 50.  -       var link = "/ads?act=office" + unionIdParam;
  1621. 51.  -       if (!unionIdReal) {
  1622. 52.  -         link = "/ads?act=no_office";
  1623. 53.  -       } else if (cur.getOfficeLink) {
  1624. 54.  -         link = cur.getOfficeLink(unionId);
  1625. 55.  -       } else if (realLocation.match(/act=budget(&|$)/)) {
  1626. 56.  -         link = "/ads?act=budget" + unionIdParam;
  1627. 57.  -       } else if (realLocation.match(/act=export_stats(&|$)/)) {
  1628. 58.  -         link = "/ads?act=export_stats" + unionIdParam;
  1629. 59.  -       } else if (realLocation.match(/act=settings(&|$)/)) {
  1630. 60.  -         link = "/ads?act=settings" + unionIdParam;
  1631. 61.  -       }
  1632. 62.  -
  1633. 63.  -       curItems[i].h = link;
  1634. 64.  -     }
  1635. 65.  -   }
  1636. 66.  -
  1637. 67.  -   var options = {
  1638. 68.  -     title: '<span id="ads_navigation_dd_menu_header_text">' + ge('ads_navigation_offices_menu_text').innerHTML + '</span>',
  1639. 69.  -     containerClass: 'ads_navigation_dd_menu_header_wrap',
  1640. 70.  -     target: ge('ads_navigation_offices_menu'),
  1641. 71.  -     showHover: false,
  1642. 72.  -     updateTarget: false,
  1643. 73.  -     onSelect: function(e) {
  1644. 74.  -     }
  1645. 75.  -   };
  1646. 76.  -   cur.navigationOficesMenu = new DropdownMenu(curItems, options);
  1647. 77.  -   cur.destroy.push(function(){ cur.navigationOficesMenu.destroy(); });
  1648. 78.  - }
  1649. 79.  -
  1650. 80.  - Ads.lock = function(lockKey, onLock, onUnlock) {
  1651. 81.  -   if (!cur.locks) {
  1652. 82.  -     cur.locks = {};
  1653. 83.  -   }
  1654. 84.  -   if (cur.locks[lockKey]) {
  1655. 85.  -     return false;
  1656. 86.  -   }
  1657. 87.  -   cur.locks[lockKey] = {onLock: onLock, onUnlock: onUnlock};
  1658. 88.  -   if (isFunction(cur.locks[lockKey].onLock)) {
  1659. 89.  -     cur.locks[lockKey].onLock();
  1660. 90.  -   }
  1661. 91.  -   return true;
  1662. 92.  - }
  1663. 93.  -
  1664. 94.  - Ads.unlock = function(lockKey) {
  1665. 95.  -   if (!cur.locks) {
  1666. 96.  -     cur.locks = {};
  1667. 97.  -   }
  1668. 98.  -   if (cur.locks[lockKey] && isFunction(cur.locks[lockKey].onUnlock)) {
  1669. 99.  -     cur.locks[lockKey].onUnlock();
  1670. 100.  -   }
  1671. 101.  -   delete cur.locks[lockKey];
  1672. 102.  - }
  1673. 103.  -
  1674. 104.  - Ads.simpleAjax = function(url, elem) {
  1675. 105.  -   if (elem) {
  1676. 106.  -     var elemRect = elem.getBoundingClientRect();
  1677. 107.  -     var imgTop   = (elemRect.bottom - elemRect.top - 8) / 2;
  1678. 108.  -     var span     = ce('span', {}, {position: 'relative'})
  1679. 109.  -     var img      = ce('img', {src:'/images/upload.gif'}, {position: 'absolute', top: imgTop + 'px'});
  1680. 110.  -     span.appendChild(img);
  1681. 111.  -     elem.appendChild(span);
  1682. 112.  -   }
  1683. 113.  -
  1684. 114.  -   ajax.post(url, {}, {onDone: onComplete, onFail: onComplete});
  1685. 115.  -   function onComplete(response) {
  1686. 116.  -     if (elem) {
  1687. 117.  -       elem.removeChild(span);
  1688. 118.  -     }
  1689. 119.  -     if (response && response.html) {
  1690. 120.  -       var boxOptions = {};
  1691. 121.  -       boxOptions.title  = '���������';
  1692. 122.  -       boxOptions.onHide = nav.reload;
  1693. 123.  -       showFastBox(boxOptions, response.html);
  1694. 124.  -     } else {
  1695. 125.  -       nav.reload();
  1696. 126.  -     }
  1697. 127.  -     return true;
  1698. 128.  -   }
  1699. 129.  - }
  1700. 130.  -
  1701. 131.  - Ads.escapeValue = function(value) {
  1702. 132.  -   return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  1703. 133.  - }
  1704. 134.  -
  1705. 135.  - Ads.onInputEvent = function(event, func) {
  1706. 136.  -   if (event.keyCode == KEY.RETURN) {
  1707. 137.  -     func();
  1708. 138.  -     return false;
  1709. 139.  -   }
  1710. 140.  -   return true;
  1711. 141.  - }
  1712. 142.  -
  1713. 143.  - Ads.onSubLinkEvent = function(event) {
  1714. 144.  -   event = normEvent(event);
  1715. 145.  -   var elem = event.target
  1716. 146.  -   var newLink = elem.getAttribute('href_');
  1717. 147.  -   if (!newLink) {
  1718. 148.  -     return;
  1719. 149.  -   }
  1720. 150.  -   var linkElem = elem;
  1721. 151.  -   while (linkElem && linkElem.nodeName !== 'A') {
  1722. 152.  -     linkElem = linkElem.parentNode;
  1723. 153.  -   }
  1724. 154.  -   if (!linkElem) {
  1725. 155.  -     return;
  1726. 156.  -   }
  1727. 157.  -   if (event.type === 'mouseover') {
  1728. 158.  -     elem.setAttribute('href_old', linkElem.href);
  1729. 159.  -     linkElem.href = newLink;
  1730. 160.  -   } else if (event.type === 'mouseout') {
  1731. 161.  -     var oldLink = elem.getAttribute('href_old');
  1732. 162.  -     if (oldLink) {
  1733. 163.  -       linkElem.href = oldLink;
  1734. 164.  -     } else {
  1735. 165.  -       linkElem.removeAttribute('href');
  1736. 166.  -     }
  1737. 167.  -   }
  1738. 168.  - }
  1739. 169.  -
  1740. 170.  - Ads.onBoxFail = function(message) {
  1741. 171.  -   if (!message) {
  1742. 172.  -     message = getLang('global_unknown_error');
  1743. 173.  -   }
  1744. 174.  -   setTimeout(function(){
  1745. 175.  -     showFastBox(getLang('ads_error_box_title'), message);
  1746. 176.  -   }, 1);
  1747. 177.  -   return true;
  1748. 178.  - }
  1749. 179.  -
  1750. 180.  - Ads.setLoginHandlers = function(onLoginDoneNew, onLoginFailedNew) {
  1751. 181.  -   var restoreOnLoginDone = function(handler) {
  1752. 182.  -     if (cur.onLoginDoneWindowOld && window.onLoginDone == handler) {
  1753. 183.  -       window.onLoginDone = cur.onLoginDoneWindowOld;
  1754. 184.  -       delete cur.onLoginDoneWindowOld;
  1755. 185.  -     }
  1756. 186.  -   }
  1757. 187.  -   var restoreOnLoginFailed = function(handler) {
  1758. 188.  -     if (cur.onLoginFailedWindowOld && window.onLoginFailed == handler) {
  1759. 189.  -       window.onLoginFailed = cur.onLoginFailedWindowOld;
  1760. 190.  -       delete cur.onLoginFailedWindowOld;
  1761. 191.  -     }
  1762. 192.  -   }
  1763. 193.  -
  1764. 194.  -   if (onLoginDoneNew) {
  1765. 195.  -     if (window.onLoginDone != onLoginDoneNew) {
  1766. 196.  -       cur.onLoginDoneWindowOld = window.onLoginDone;
  1767. 197.  -       window.onLoginDone = onLoginDoneNew;
  1768. 198.  -       cur.destroy.push(restoreOnLoginDone.pbind(onLoginDoneNew));
  1769. 199.  -     }
  1770. 200.  -   } else {
  1771. 201.  -     restoreOnLoginDone(window.onLoginDone);
  1772. 202.  -   }
  1773. 203.  -
  1774. 204.  -   if (onLoginFailedNew) {
  1775. 205.  -     if (window.onLoginFailed != onLoginFailedNew) {
  1776. 206.  -       cur.onLoginFailedWindowOld = window.onLoginFailed;
  1777. 207.  -       window.onLoginFailed = onLoginFailedNew;
  1778. 208.  -       cur.destroy.push(restoreOnLoginFailed.pbind(onLoginFailedNew));
  1779. 209.  -     }
  1780. 210.  -   } else {
  1781. 211.  -     restoreOnLoginFailed(window.onLoginFailed);
  1782. 212.  -   }
  1783. 213.  - }
  1784. 214.  -
  1785. 215.  - Ads.scrollToError = function(errorElem) {
  1786. 216.  -   errorElem = ge(errorElem);
  1787. 217.  -   var scrollY = scrollGetY();
  1788. 218.  -   var errorY = getXY(errorElem)[1];
  1789. 219.  -   if (errorY < scrollY || errorY > (scrollY + lastWindowHeight / 2)) {
  1790. 220.  -     errorY -= 15;
  1791. 221.  -     scrollToY(errorY);
  1792. 222.  -   }
  1793. 223.  - }
  1794. 224.  -
  1795. 225.  - Ads.initFixed = function(elemWrap) {
  1796. 226.  -   elemWrap = ge(elemWrap);
  1797. 227.  -   if (!elemWrap) return;
  1798. 228.  -   var elemFixed = elemWrap.firstChild;
  1799. 229.  -   if (!elemFixed) return;
  1800. 230.  -
  1801. 231.  -   var scrolledNode = browser.msie6 ? pageNode : window;
  1802. 232.  -   addEvent(scrolledNode, 'scroll', onScroll);
  1803. 233.  -   cur.destroy.push(function() { removeEvent(scrolledNode, 'scroll', onScroll); });
  1804. 234.  -
  1805. 235.  -   var poistionTop = 20;
  1806. 236.  -
  1807. 237.  -   var elemWrapSize = getSize(elemWrap);
  1808. 238.  -   setStyle(elemWrap, {width: elemWrapSize[0] + 'px', height: elemWrapSize[1] + 'px'});
  1809. 239.  -
  1810. 240.  -   onScroll();
  1811. 241.  -
  1812. 242.  -   function onScroll() {
  1813. 243.  -     var elemWrapXY = getXY(elemWrap);
  1814. 244.  -     var scrollY = scrollGetY();
  1815. 245.  -     if (scrollY + poistionTop < elemWrapXY[1]) {
  1816. 246.  -       setStyle(elemFixed, {position: 'static', top: 'auto', left: 'auto'});
  1817. 247.  -     } else {
  1818. 248.  -       setStyle(elemFixed, {position: 'fixed', top: poistionTop, left: elemWrapXY[0]});
  1819. 249.  -     }
  1820. 250.  -   }
  1821. 251.  - }
  1822. 252.  -
  1823. 253.  - Ads.initIntroPage = function(widgetParamsMore) {
  1824. 254.  -   var widgetParams = {}
  1825. 255.  -   widgetParams.mode    = 2;
  1826. 256.  -   widgetParams.width   = 212;
  1827. 257.  -   widgetParams.height  = 340;
  1828. 258.  -   widgetParams.no_head = 1;
  1829. 259.  -   extend(widgetParams, widgetParamsMore);
  1830. 260.  -   VK.Widgets.Group('ads_intro_news_widget', widgetParams, 19542789);
  1831. 261.  - }
  1832. 262.  -
  1833. 263.  - //////////////////////////////////////////////////////////////////////
  1834. 264.  - // OLD
  1835. 265.  - //////////////////////////////////////////////////////////////////////
  1836. 266.  -
  1837. 267.  - Ads.updateUnionName = function(unionId, unionName) {
  1838. 268.  -   var elemsTitle = geByClass('title_union_name_' + unionId);
  1839. 269.  -   for (var i in elemsTitle) {
  1840. 270.  -     elemsTitle[i].innerHTML = Ads.escapeValue(unionName);
  1841. 271.  -   }
  1842. 272.  -
  1843. 273.  -   var elemNavigation = ge('ads_navigation_union_' + unionId);
  1844. 274.  -   if (elemNavigation) {
  1845. 275.  -     unionName = replaceEntities(unionName);
  1846. 276.  -     unionName = (unionName.length > 40 ? unionName.substr(0, 40) + '...' : unionName);
  1847. 277.  -     elemNavigation.innerHTML = Ads.escapeValue(unionName);
  1848. 278.  -   }
  1849. 279.  -
  1850. 280.  -   var elemGeneralInfoHeader = ge('general_info_header_name_' + unionId);
  1851. 281.  -   if (elemGeneralInfoHeader) {
  1852. 282.  -     elemGeneralInfoHeader.innerHTML = Ads.escapeValue(unionName);
  1853. 283.  -   }
  1854. 284.  - }
  1855. 285.  -
  1856. 286.  - Ads.openUnionsGeneralInfoBox = function(unionId, params) {
  1857. 287.  -   var ajaxParams = {};
  1858. 288.  -   ajaxParams.union_id = unionId;
  1859. 289.  -   ajaxParams = extend({}, ajaxParams, params);
  1860. 290.  -
  1861. 291.  -   var showOptions = {params: {}};
  1862. 292.  -   showOptions.onFail = Ads.onBoxFail;
  1863. 293.  -   showOptions.params.width = 300;
  1864. 294.  -
  1865. 295.  -   showBox('/ads?act=a_unions_general_info_box', ajaxParams, showOptions);
  1866. 296.  - }
  1867. 297.  -
  1868. 298.  - Ads.openUnionCreateBox = function(unionId) {
  1869. 299.  -   var ajaxParams = {}
  1870. 300.  -   ajaxParams.union_id = unionId;
  1871. 301.  -
  1872. 302.  -   var showOptions = {params: {}};
  1873. 303.  -   showOptions.onFail = Ads.onBoxFail;
  1874. 304.  -   showOptions.params.width = 250;
  1875. 305.  -
  1876. 306.  -   showBox('/ads?act=a_union_create_box', ajaxParams, showOptions);
  1877. 307.  - }
  1878. 308.  -
  1879. 309.  - Ads.openDeleteUnionBox = function(unionType, unionId, hash, lock, unlock, updateStatus, newclass) {
  1880. 310.  -   var boxTitle = '';
  1881. 311.  -   var boxContent = '';
  1882. 312.  -   switch (unionType) {
  1883. 313.  -     case 'ad':
  1884. 314.  -       boxTitle = getLang('ads_archive_box_ad_title');
  1885. 315.  -       boxContent = getLang('ads_archive_box_ad_warning');
  1886. 316.  -       break;
  1887. 317.  -     case 'campaign':
  1888. 318.  -       boxTitle = getLang('ads_archive_box_campaign_title');
  1889. 319.  -       boxContent = getLang('ads_archive_box_campaign_warning');
  1890. 320.  -       break;
  1891. 321.  -     case 'client':
  1892. 322.  -       boxTitle = getLang('ads_archive_box_client_title');
  1893. 323.  -       boxContent = getLang('ads_archive_box_client_warning');
  1894. 324.  -       break;
  1895. 325.  -   }
  1896. 326.  -
  1897. 327.  -   var boxOptions = {};
  1898. 328.  -   boxOptions.title = boxTitle;
  1899. 329.  -   boxOptions.bodyStyle = 'line-height: 160%;';
  1900. 330.  -
  1901. 331.  -   cur.deleteConfirmBox = new MessageBox();
  1902. 332.  -   cur.deleteConfirmBox.setOptions(boxOptions);
  1903. 333.  -   cur.deleteConfirmBox.content(boxContent);
  1904. 334.  -   cur.deleteConfirmBox.removeButtons();
  1905. 335.  -   cur.deleteConfirmBox.addButton(getLang('box_cancel'), false, 'no');
  1906. 336.  -   cur.deleteConfirmBox.addButton(getLang('ads_archive_box_action'), function() { Ads.deleteUnion(unionType, unionId, hash, lock, unlock, updateStatus, newclass); });
  1907. 337.  -   cur.deleteConfirmBox.setControlsText('<img id="delete_union_progress" src="/images/upload.gif" style="top: 1px; display: none;">');
  1908. 338.  -   cur.deleteConfirmBox.show();
  1909. 339.  - }
  1910. 340.  -
  1911. 341.  - Ads.deleteUnion = function(unionType, unionId, hash, lock, unlock, updateStatus, newclass) {
  1912. 342.  -   if (!lockDeletion()) {
  1913. 343.  -     return;
  1914. 344.  -   }
  1915. 345.  -
  1916. 346.  -   var ajaxParams = {};
  1917. 347.  -   ajaxParams.union_id = unionId;
  1918. 348.  -   ajaxParams.hash = hash;
  1919. 349.  -   if (newclass) ajaxParams.newclass = 1;
  1920. 350.  -
  1921. 351.  -   ajax.post('/ads?act=a_union_delete', ajaxParams, {onDone: onRequestComplete, onFail: onRequestComplete});
  1922. 352.  -
  1923. 353.  -   function onRequestComplete(response) {
  1924. 354.  -     unlockDeletion();
  1925. 355.  -     if (!isObject(response) || response.error) {
  1926. 356.  -       if (!isObject(response)) {
  1927. 357.  -         showMessage(getLang('ads_error_unexpected_error_try_later'));
  1928. 358.  -       } else {
  1929. 359.  -         showMessage(response.error);
  1930. 360.  -       }
  1931. 361.  -       return true;
  1932. 362.  -     }
  1933. 363.  -     if (response && (response.ok || newclass == 2)) {
  1934. 364.  -       var completeMessage = '';
  1935. 365.  -       switch (unionType) {
  1936. 366.  -         case 'ad':       completeMessage = getLang('ads_archive_box_ad_complete'); break;
  1937. 367.  -         case 'campaign': completeMessage = getLang('ads_archive_box_campaign_complete'); break;
  1938. 368.  -         case 'client':   completeMessage = getLang('ads_archive_box_client_complete'); break;
  1939. 369.  -       }
  1940. 370.  -       if (updateStatus) {
  1941. 371.  -         if (newclass == 2) {
  1942. 372.  -           updateStatus(response);
  1943. 373.  -         } else {
  1944. 374.  -           updateStatus(response.status, response.status_class, response.status_type, response.status_variants);
  1945. 375.  -         }
  1946. 376.  -       } else {
  1947. 377.  -         showMessage(completeMessage, true, function() { nav.reload(); }, unionType);
  1948. 378.  -       }
  1949. 379.  -     }
  1950. 380.  -     return true;
  1951. 381.  -   }
  1952. 382.  -
  1953. 383.  -   function showMessage(message, isSuccess, onHide, unionType) {
  1954. 384.  -     var boxTitle = '';
  1955. 385.  -     switch (unionType) {
  1956. 386.  -       case 'ad':       boxTitle = getLang('ads_archive_box_ad_title'); break;
  1957. 387.  -       case 'campaign': boxTitle = getLang('ads_archive_box_campaign_title'); break;
  1958. 388.  -       case 'client':   boxTitle = getLang('ads_archive_box_client_title'); break;
  1959. 389.  -     }
  1960. 390.  -
  1961. 391.  -     var boxOptions = {};
  1962. 392.  -     boxOptions.title = (isSuccess ? boxTitle : '������');
  1963. 393.  -     boxOptions.width = 350;
  1964. 394.  -     boxOptions.onHide = onHide;
  1965. 395.  -     showFastBox(boxOptions, message);
  1966. 396.  -   }
  1967. 397.  -
  1968. 398.  -   function lockDeletion() {
  1969. 399.  -     if (lock) {
  1970. 400.  -       if (!lock()) {
  1971. 401.  -         return false;
  1972. 402.  -       }
  1973. 403.  -       cur.deleteConfirmBox.hide();
  1974. 404.  -     } else {
  1975. 405.  -       if (cur.deleteUnionLocked) {
  1976. 406.  -         return false;
  1977. 407.  -       }
  1978. 408.  -       cur.deleteUnionLocked = true;
  1979. 409.  -       show('delete_union_progress');
  1980. 410.  -     }
  1981. 411.  -     return true;
  1982. 412.  -   }
  1983. 413.  -   function unlockDeletion() {
  1984. 414.  -     if (unlock) {
  1985. 415.  -       unlock()
  1986. 416.  -     } else {
  1987. 417.  -       cur.deleteUnionLocked = false;
  1988. 418.  -       hide('delete_union_progress');
  1989. 419.  -     }
  1990. 420.  -   }
  1991. 421.  - }
  1992. 422.  -
  1993. 423.  - Ads.openHelpBox = function(type, unionId) {
  1994. 424.  -   var ajaxParams = {}
  1995. 425.  -   ajaxParams.type = type;
  1996. 426.  -   ajaxParams.union_id = unionId;
  1997. 427.  -
  1998. 428.  -   var showOptions = {params: {}};
  1999. 429.  -   showOptions.onFail = Ads.onBoxFail;
  2000. 430.  -   showOptions.cache = 1;
  2001. 431.  -   showOptions.params.width = 450;
  2002. 432.  -
  2003. 433.  -   showBox('/ads?act=a_help_text', ajaxParams, showOptions);
  2004. 434.  - }
  2005. 435.  -
  2006. 436.  - Ads.openCreateOfficeBox = function() {
  2007. 437.  -   var ajaxParams = {};
  2008. 438.  -
  2009. 439.  -   var showOptions = {params: {}};
  2010. 440.  -   showOptions.onFail = Ads.onBoxFail;
  2011. 441.  -   showOptions.params.width = 350;
  2012. 442.  -
  2013. 443.  -   showBox('/ads?act=a_create_office_box', ajaxParams, showOptions);
  2014. 444.  - }
  2015. 445.  -
  2016. 446.  - Ads.openDisableOfficeBox = function(unionId, hash, isCompany) {
  2017. 447.  -   cur.lang.ads_disable_office_box_title       = '�������� ���������� ��������';
  2018. 448.  -   cur.lang.ads_disable_office_box_button      = '������� �������';
  2019. 449.  -   cur.lang.ads_disable_office_confirm_message = '�� ������� ��� ������ ������� ��������� �������?<br><br>����� �������� �������� � ��� ��������� ������ � ����������, �� ����� �������� �������� ����� ����������.';
  2020. 450.  -   if (isCompany) {
  2021. 451.  -     cur.lang.ads_disable_office_confirm_message += '<br><br>������ ����� �������� �������� ���� �������� ������ ���������� �����, ������������ � ����� ��������.';
  2022. 452.  -   }
  2023. 453.  -   var messageBox = showFastBox(getLang('ads_disable_office_box_title'), getLang('ads_disable_office_confirm_message'), getLang('ads_disable_office_box_button'), function() { Ads.disableOffice(unionId, hash, messageBox); }, getLang('box_cancel'));
  2024. 454.  - }
  2025. 455.  -
  2026. 456.  - Ads.disableOffice = function(unionId, hash, box) {
  2027. 457.  -   var ajaxParams = {};
  2028. 458.  -   ajaxParams.union_id = unionId;
  2029. 459.  -   ajaxParams.hash = hash;
  2030. 460.  -
  2031. 461.  -   ajax.post('/adsmoder?act=a_disable_office', ajaxParams, {onDone: onRequestComplete, onFail: onRequestComplete});
  2032. 462.  -
  2033. 463.  -   function onRequestComplete(response) {
  2034. 464.  -     if (response && response.redirect) {
  2035. 465.  -       nav.reload();
  2036. 466.  -     } else {
  2037. 467.  -       box.hide();
  2038. 468.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_error_text'));
  2039. 469.  -     }
  2040. 470.  -     return true;
  2041. 471.  -   }
  2042. 472.  - }
  2043. 473.  -
  2044. 474.  - Ads.createExportSubmitButton = function(elem, bindingId, topUnionId) {
  2045. 475.  -   var postIframe = ce((browser.msie && browser.version < 9.0) ? '<iframe name="secret_iframe">' : 'iframe', {name: 'secret_iframe', id: 'secret_iframe'});
  2046. 476.  -   postIframe.style.display = 'none';
  2047. 477.  -   document.body.appendChild(postIframe);
  2048. 478.  -   var topUnionIdParam = (topUnionId ? '&union_id=' + topUnionId : '');
  2049. 479.  -   var postForm = ce('form', {method: 'post', action: '/ads?act=get_export_stats' + topUnionIdParam, target: 'secret_iframe'});
  2050. 480.  -   document.body.appendChild(postForm);
  2051. 481.  -   var valueNames = [
  2052. 482.  -     'group_time',
  2053. 483.  -     'group_ads',
  2054. 484.  -     'method',
  2055. 485.  -     'stats_type',
  2056. 486.  -     'from_day',
  2057. 487.  -     'from_month',
  2058. 488.  -     'from_year',
  2059. 489.  -     'to_day',
  2060. 490.  -     'to_month',
  2061. 491.  -     'to_year',
  2062. 492.  -     'Ids'
  2063. 493.  -   ];
  2064. 494.  -   var valueContainers = {};
  2065. 495.  -   for (var i = 0; i < valueNames.length; i++) {
  2066. 496.  -     var curName = valueNames[i];
  2067. 497.  -     valueContainers[curName] = ce('input', {
  2068. 498.  -       type: 'hidden',
  2069. 499.  -       id: curName + '_container_' + bindingId,
  2070. 500.  -       name: curName
  2071. 501.  -     });
  2072. 502.  -     postForm.appendChild(valueContainers[curName]);
  2073. 503.  -   }
  2074. 504.  -
  2075. 505.  -   var errorBox;
  2076. 506.  -   var action = function() {
  2077. 507.  -     var postData = {}, elem, day;
  2078. 508.  -     elem = geByClass('grouping_time_' + bindingId)[0];
  2079. 509.  -     if (!elem) return;
  2080. 510.  -     valueContainers.group_time.value = elem.getIndex();
  2081. 511.  -
  2082. 512.  -     elem = geByClass('grouping_ads_' + bindingId)[0];
  2083. 513.  -     if (!elem) return;
  2084. 514.  -     valueContainers.group_ads.value = elem.getIndex();
  2085. 515.  -
  2086. 516.  -     elem = geByClass('client_choose_' + bindingId);
  2087. 517.  -     if (elem.length > 0) {
  2088. 518.  -       elem = elem[0];
  2089. 519.  -       var curClientId = elem.getIndex();
  2090. 520.  -     }
  2091. 521.  -
  2092. 522.  -     elem = geByClass('export_method_' + bindingId)[0];
  2093. 523.  -     if (!elem) return;
  2094. 524.  -     valueContainers.method.value = elem.getIndex();
  2095. 525.  -     if (valueContainers.method.value == 3/*Web-interface*/) {
  2096. 526.  -       postForm.target = '';
  2097. 527.  -     }
  2098. 528.  -
  2099. 529.  -     elem = geByClass('stats_type_' + bindingId)[0];
  2100. 530.  -     if (!elem) return;
  2101. 531.  -     valueContainers.stats_type.value = elem.getIndex();
  2102. 532.  -
  2103. 533.  -     day = cur.exportParamsData.start_time;
  2104. 534.  -     valueContainers.from_day.value = day.day;
  2105. 535.  -     valueContainers.from_month.value = day.month;
  2106. 536.  -     valueContainers.from_year.value = day.year;
  2107. 537.  -
  2108. 538.  -     day = cur.exportParamsData.stop_time;
  2109. 539.  -     valueContainers.to_day.value = day.day;
  2110. 540.  -     valueContainers.to_month.value = day.month;
  2111. 541.  -     valueContainers.to_year.value = day.year;
  2112. 542.  -
  2113. 543.  -     if ((new Date(valueContainers.to_year.value,   valueContainers.to_month.value,   valueContainers.to_day.value)) <
  2114. 544.  -         (new Date(valueContainers.from_year.value, valueContainers.from_month.value, valueContainers.from_day.value))) {
  2115. 545.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_error_export_stat_invalid_period'));
  2116. 546.  -       return;
  2117. 547.  -     }
  2118. 548.  -
  2119. 549.  -     var ids = [];
  2120. 550.  -
  2121. 551.  -     elem = ge('paginated_table');
  2122. 552.  -     var pt = elem.tableObj;
  2123. 553.  -     var selection = pt.getSelection(0);
  2124. 554.  -     switch (parseInt(valueContainers.group_ads.value)) {
  2125. 555.  -       case 0:
  2126. 556.  -         ids.push(elem.topId);
  2127. 557.  -         break;
  2128. 558.  -       case 1:
  2129. 559.  -         for (var j = 0; j < selection.length; j++) {
  2130. 560.  -           var clId = pt.content.extra['union_id'][selection[j]];
  2131. 561.  -           ids.push(clId);
  2132. 562.  -         }
  2133. 563.  -         break;
  2134. 564.  -       case 2:
  2135. 565.  -         if (curClientId == 'aca') {
  2136. 566.  -           for (var p in elem.contentDep) {
  2137. 567.  -             if (!isNaN(Number(p))) {
  2138. 568.  -               for (var i in elem.contentDep[p].extra['union_id']) {
  2139. 569.  -                 ids.push(elem.contentDep[p].extra['union_id'][i]);
  2140. 570.  -               }
  2141. 571.  -             }
  2142. 572.  -           }
  2143. 573.  -         } else {
  2144. 574.  -           for (var i = 0; i < selection.length; i++) {
  2145. 575.  -             ids.push(pt.content.extra['union_id'][selection[i]]);
  2146. 576.  -           }
  2147. 577.  -         }
  2148. 578.  -         break;
  2149. 579.  -       case 3:
  2150. 580.  -         for (var i = 0; i < selection.length; i++) {
  2151. 581.  -           ids.push(pt.content.extra['union_id'][selection[i]]);
  2152. 582.  -         }
  2153. 583.  -         break;
  2154. 584.  -       default:
  2155. 585.  -         return;
  2156. 586.  -     }
  2157. 587.  -
  2158. 588.  -     if (ids.length == 0) {
  2159. 589.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_error_export_stat_no_campaigns_selected'));
  2160. 590.  -       return;
  2161. 591.  -
  2162. 592.  -     }
  2163. 593.  -
  2164. 594.  -     valueContainers.Ids.value = '' + ids.join(',');
  2165. 595.  -
  2166. 596.  -     postForm.submit();
  2167. 597.  -   };
  2168. 598.  -
  2169. 599.  -   createButton(elem, action);
  2170. 600.  - }
  2171. 601.  -
  2172. 602.  - Ads.createStaticDatePicker = function(elem, bindingId, classid, defaultDate) {
  2173. 603.  -   elem = ge(elem);
  2174. 604.  -   if (classid) elem.className = classid + '_' + bindingId;
  2175. 605.  -
  2176. 606.  -   var spanDay   = ce('span', {id: elem.id + '_day'}),
  2177. 607.  -       spanMonth = ce('span', {id: elem.id + '_month'});
  2178. 608.  -
  2179. 609.  -   if (!cur.exportParamsData) {
  2180. 610.  -     cur.exportParamsData = {};
  2181. 611.  -   }
  2182. 612.  -   cur.exportParamsData[classid] = defaultDate;
  2183. 613.  -
  2184. 614.  -   var params = {
  2185. 615.  -     mode: 'd',
  2186. 616.  -     day: defaultDate.day,
  2187. 617.  -     month: defaultDate.month,
  2188. 618.  -     year: defaultDate.year,
  2189. 619.  -     width: 124,
  2190. 620.  -     pastActive: true,
  2191. 621.  -     onUpdate: function(d, m) {
  2192. 622.  -       if (m == 'h') {
  2193. 623.  -         cur.exportParamsData[classid].day = defaultDate.day;
  2194. 624.  -         cur.exportParamsData[classid].month = defaultDate.month;
  2195. 625.  -         cur.exportParamsData[classid].year = defaultDate.year;
  2196. 626.  -         return;
  2197. 627.  -       }
  2198. 628.  -       if (m == 'd') {
  2199. 629.  -         cur.exportParamsData[classid].day = d.d;
  2200. 630.  -       } else if (m == 'm') {
  2201. 631.  -         cur.exportParamsData[classid].day = 1;
  2202. 632.  -       }
  2203. 633.  -       cur.exportParamsData[classid].month = d.m;
  2204. 634.  -       cur.exportParamsData[classid].year = d.y;
  2205. 635.  -     }
  2206. 636.  -   };
  2207. 637.  -
  2208. 638.  -   if (!cur.exportUi) {
  2209. 639.  -     cur.exportUi = {};
  2210. 640.  -   }
  2211. 641.  -   cur.exportUi[classid] = new Datepicker(elem, params);
  2212. 642.  - }
  2213. 643.  -
  2214. 644.  - Ads.openInnerTable = function(id, bindingId) {
  2215. 645.  -   if (!id) id = 'acl';
  2216. 646.  -
  2217. 647.  -   var tab = ge('paginated_table');
  2218. 648.  -
  2219. 649.  -   var newOptions;
  2220. 650.  -   switch (id) {
  2221. 651.  -     case 'cli':
  2222. 652.  -       newOptions = tab.optionsDep['cli'];
  2223. 653.  -       break;
  2224. 654.  -     case 'aca':
  2225. 655.  -     case 'acl':
  2226. 656.  -       newOptions = tab.optionsDep['default'];
  2227. 657.  -       break;
  2228. 658.  -     default:
  2229. 659.  -       newOptions = tab.optionsDep['cam'];
  2230. 660.  -       break;
  2231. 661.  -   }
  2232. 662.  -
  2233. 663.  -   if (id in tab.contentDep && tab.contentDep[id]) {
  2234. 664.  -     var newContent = tab.contentDep[id];
  2235. 665.  -     tab.tableObj.setOptions(newOptions);
  2236. 666.  -     tab.tableObj.setContent(newContent);
  2237. 667.  -     tab.tableObj.applyData();
  2238. 668.  -   } else {
  2239. 669.  -     function onDone(data) {
  2240. 670.  -       var newContent = data;
  2241. 671.  -       tab.contentDep[id] = newContent;
  2242. 672.  -       tab.tableObj.setOptions(newOptions);
  2243. 673.  -       tab.tableObj.setContent(newContent);
  2244. 674.  -       tab.tableObj.applyData();
  2245. 675.  -       hide('getting_campaigns_upload');
  2246. 676.  -     }
  2247. 677.  -     function onFail() {
  2248. 678.  -       hide('getting_campaigns_upload');
  2249. 679.  -       return true;
  2250. 680.  -     };
  2251. 681.  -     show('getting_campaigns_upload');
  2252. 682.  -     ajax.post('/ads?act=a_get_client_children', {client_id: id}, {onDone: onDone, onFail: onFail});
  2253. 683.  -   }
  2254. 684.  - }
  2255. 685.  -
  2256. 686.  - Ads.createStaticDropdownMenuAds = function(elem, bindingId, values, params) {
  2257. 687.  -   elem = ge(elem);
  2258. 688.  -
  2259. 689.  -   if (params.classname) elem.className = params.classname + '_' + bindingId;
  2260. 690.  -   elem.className = elem.className + ' dd_link';
  2261. 691.  -
  2262. 692.  -   elem.valueList = values;
  2263. 693.  -   elem.getValue = function() {return elem.value;}
  2264. 694.  -   elem.getIndex = function() {
  2265. 695.  -     if (elem.index !== undefined) return elem.index;
  2266. 696.  -
  2267. 697.  -     for (var i = 0; i < elem.valueList.length; i++) {
  2268. 698.  -       if (elem.valueList[i][1] == elem.value) {
  2269. 699.  -         return elem.valueList[i][0];
  2270. 700.  -       }
  2271. 701.  -     }
  2272. 702.  -     return -1;
  2273. 703.  -   }
  2274. 704.  -
  2275. 705.  -   if (params.classname == 'client_choose') {
  2276. 706.  -     onDomReady(function() {
  2277. 707.  -       hide(geByClass('client_choose_row_' + bindingId)[0]);
  2278. 708.  -     });
  2279. 709.  -   }
  2280. 710.  -   params.updateHeader = function(i, t) {
  2281. 711.  -     if (!i) i = 'aca';
  2282. 712.  -     Ads.openInnerTable(i, bindingId);
  2283. 713.  -     elem.index = i;
  2284. 714.  -     elem.value = t;
  2285. 715.  -     return t;
  2286. 716.  -   }
  2287. 717.  -   params.onSelect = function(value) {
  2288. 718.  -     if (value === undefined) value = uiDropdown.val();
  2289. 719.  -     elem.value = value;
  2290. 720.  -     elem.innerHTML = value;
  2291. 721.  -   };
  2292. 722.  -   params.target = elem;
  2293. 723.  -   params.showHover = true;
  2294. 724.  -   //params.alwaysMenuToUp = true;
  2295. 725.  -
  2296. 726.  -   params.onSelect(values[0][1]);
  2297. 727.  -
  2298. 728.  -   elem.uiDropdown = new DropdownMenu(values, params);
  2299. 729.  -   Ads.makeDDScrollable(elem.uiDropdown);
  2300. 730.  - }
  2301. 731.  -
  2302. 732.  - // threshold is height of container
  2303. 733.  - Ads.makeDDScrollable = function(dd, threshold) {
  2304. 734.  -   if (!dd) return;
  2305. 735.  -   if (threshold === undefined) {
  2306. 736.  -     threshold = 300;
  2307. 737.  -   }
  2308. 738.  -
  2309. 739.  -   var uiBody = dd.body,
  2310. 740.  -       uiTable = geByClass('dd_menu_rows', uiBody)[0].firstChild,
  2311. 741.  -       uiTableS = getSize(uiBody),
  2312. 742.  -       uiTableW = uiTableS[0],
  2313. 743.  -       uiTableH = uiTableS[1] - 4, // dont understand why
  2314. 744.  -       barW = 6,
  2315. 745.  -       barH = Math.max(20, intval(threshold * threshold / uiTableH)),
  2316. 746.  -       scrollBar = ce('div', {className: 'ads_dropdown_menu_scrollbar'}, {
  2317. 747.  -         top: barH / 10,
  2318. 748.  -         right: 3,
  2319. 749.  -         width: barW,
  2320. 750.  -         height: barH
  2321. 751.  -       });
  2322. 752.  -
  2323. 753.  -   if (uiTableH < threshold) {
  2324. 754.  -     return;
  2325. 755.  -   }
  2326. 756.  -
  2327. 757.  -   setStyle(uiTable.parentNode, {
  2328. 758.  -     overflowY: 'hidden',
  2329. 759.  -     height: threshold
  2330. 760.  -   });
  2331. 761.  -   uiBody.appendChild(scrollBar);
  2332. 762.  -   setStyle(uiTable, 'position', 'relative');
  2333. 763.  -
  2334. 764.  -   var startY = null,
  2335. 765.  -       startTop = 0,
  2336. 766.  -       hoverState = 0,
  2337. 767.  -       hoverTimer = null;
  2338. 768.  -   var onScroll = function(e) {
  2339. 769.  -     var oldTop = parseFloat(getStyle(uiTable, 'top'));
  2340. 770.  -     if (isNaN(oldTop)) {
  2341. 771.  -       oldTop = 0;
  2342. 772.  -     }
  2343. 773.  -
  2344. 774.  -     var delta = e.wheelDelta ? e.wheelDelta / 120 : -e.detail / 3;
  2345. 775.  -     scrollBody(oldTop + delta * 20);
  2346. 776.  -
  2347. 777.  -     if (hoverTimer) {
  2348. 778.  -       clearTimeout(hoverTimer);
  2349. 779.  -     } else {
  2350. 780.  -       doHover(1);
  2351. 781.  -     }
  2352. 782.  -     hoverTimer = setTimeout(function() {
  2353. 783.  -       hoverTimer = null;
  2354. 784.  -       doHover(-1);
  2355. 785.  -       }, 200);
  2356. 786.  -
  2357. 787.  -     cancelEvent(e);
  2358. 788.  -     return false;
  2359. 789.  -   }
  2360. 790.  -   var onMouseMove = function(e) {
  2361. 791.  -     if (startY === null) return;
  2362. 792.  -     var y = e.pageY;
  2363. 793.  -     var localD = startY - y,
  2364. 794.  -         delta = 1.0 * localD * (uiTableH - threshold) / (threshold - barH - 5);
  2365. 795.  -     scrollBody(startTop + delta);
  2366. 796.  -   }
  2367. 797.  -   var scrollBody = function(newTop) {
  2368. 798.  -     newTop = Math.min(0, newTop);
  2369. 799.  -     newTop = Math.max(-uiTableH + threshold, newTop);
  2370. 800.  -
  2371. 801.  -     var barTop = 3 - 1.0 * newTop / (uiTableH - threshold) * (threshold - barH - 5);
  2372. 802.  -     setStyle(uiTable, 'top', newTop);
  2373. 803.  -     setStyle(scrollBar, 'top', barTop);
  2374. 804.  -   }
  2375. 805.  -   var onDown = function(e) {
  2376. 806.  -     startY = e.pageY;
  2377. 807.  -     startTop = parseFloat(getStyle(uiTable, 'top'));
  2378. 808.  -     if (isNaN(startTop)) startTop = 0;
  2379. 809.  -
  2380. 810.  -     doHover(1);
  2381. 811.  -     cancelEvent(e);
  2382. 812.  -   }
  2383. 813.  -   var onUp = function(e) {
  2384. 814.  -     if (startY !== null) {
  2385. 815.  -       doHover(-1);
  2386. 816.  -     }
  2387. 817.  -     startY = null;
  2388. 818.  -   }
  2389. 819.  -   var doHover = function(dh) {
  2390. 820.  -     hoverState += dh;
  2391. 821.  -     if (hoverState == 0) removeClass(scrollBar, 'hovered');
  2392. 822.  -     if (hoverState == 1) addClass(scrollBar, 'hovered');
  2393. 823.  -   }
  2394. 824.  -
  2395. 825.  -   dd.options.onShow = function() {
  2396. 826.  -     scrollBody(100000);
  2397. 827.  -   }
  2398. 828.  -   addEvent(uiBody, 'mousewheel DOMMouseScroll', onScroll);
  2399. 829.  -   addEvent(scrollBar, 'mousedown', onDown);
  2400. 830.  -   addEvent(document.body, 'mouseup dragend', onUp);
  2401. 831.  -   addEvent(uiBody, 'mousemove', onMouseMove);
  2402. 832.  -
  2403. 833.  -   cur.destroy.push(function() {
  2404. 834.  -     removeEvent(uiBody, 'mousewheel DOMMouseScroll', onScroll);
  2405. 835.  -     removeEvent(scrollBar, 'mousedown', onDown);
  2406. 836.  -     removeEvent(document.body, 'mouseup dragend', onUp);
  2407. 837.  -     removeEvent(uiBody, 'mousemove', onMouseMove);
  2408. 838.  -   });
  2409. 839.  - }
  2410. 840.  -
  2411. 841.  - // params must be ready to go to contructor
  2412. 842.  - Ads.createStaticDropdown = function(elem, bindingId, values, params) {
  2413. 843.  -   elem = ge(elem);
  2414. 844.  -   if (params.classname) elem.className = params.classname + '_' + bindingId;
  2415. 845.  -   elem.className = elem.className + ' dd_link';
  2416. 846.  -
  2417. 847.  -   elem.valueList = values;
  2418. 848.  -   elem.getValue = function() {return elem.value;}
  2419. 849.  -   elem.getIndex = function() {
  2420. 850.  -     if (elem.index !== undefined) return elem.index;
  2421. 851.  -
  2422. 852.  -     for (var i = 0; i < elem.valueList.length; i++) {
  2423. 853.  -       if (elem.valueList[i][1] == elem.value) {
  2424. 854.  -         return elem.valueList[i][0];
  2425. 855.  -       }
  2426. 856.  -     }
  2427. 857.  -     return -1;
  2428. 858.  -   }
  2429. 859.  -
  2430. 860.  -   if (params.classname == 'client_choose') {
  2431. 861.  -     onDomReady(function() {
  2432. 862.  -       hide(geByClass('client_choose_row_' + bindingId)[0]);
  2433. 863.  -     });
  2434. 864.  -   }
  2435. 865.  -
  2436. 866.  -   params.updateHeader = function(i, t) {
  2437. 867.  -     if (!i) i = 0;
  2438. 868.  -     //
  2439. 869.  -     // grouping_time
  2440. 870.  -     //
  2441. 871.  -     if (elem.className.substring(0, 'grouping_time'.length) == 'grouping_time') {
  2442. 872.  -       var modes = ['d', 'm', 'h'];
  2443. 873.  -       cur.exportUi['start_time'].setMode(modes[i]);
  2444. 874.  -       cur.exportUi['stop_time'].setMode(modes[i]);
  2445. 875.  -     } else
  2446. 876.  -     //
  2447. 877.  -     // client_choose
  2448. 878.  -     //
  2449. 879.  -     if (elem.className.substring(0, 'client_choose'.length) == 'client_choose') {
  2450. 880.  -       if (!i) i = 'aca';
  2451. 881.  -       Ads.openInnerTable(i, bindingId);
  2452. 882.  -     } else
  2453. 883.  -     //
  2454. 884.  -     // grouping_ads
  2455. 885.  -     //
  2456. 886.  -     if (elem.className.substring(0, 'grouping_ads'.length) == 'grouping_ads') {
  2457. 887.  -       var label_el;
  2458. 888.  -       switch (i) {
  2459. 889.  -         case 0:
  2460. 890.  -           hide(geByClass('client_choose_row_' + bindingId)[0]);
  2461. 891.  -           Ads.openInnerTable('acl', bindingId);
  2462. 892.  -
  2463. 893.  -           label_el = ge('unions_table_label_' + bindingId);
  2464. 894.  -           label_el.innerHTML = getLang('ads_export_stat_data_title_campaigns');
  2465. 895.  -           break;
  2466. 896.  -         case 1:
  2467. 897.  -           hide(geByClass('client_choose_row_' + bindingId)[0]);
  2468. 898.  -           Ads.openInnerTable('cli', bindingId);
  2469. 899.  -
  2470. 900.  -           label_el = ge('unions_table_label_' + bindingId);
  2471. 901.  -           label_el.innerHTML = getLang('ads_export_stat_data_title_clients');
  2472. 902.  -           break;
  2473. 903.  -         case 2:
  2474. 904.  -           var chser = geByClass('client_choose_' + bindingId)[0];
  2475. 905.  -           var dd = chser.uiDropdown;
  2476. 906.  -
  2477. 907.  -           var text = dd.options.updateHeader(0, chser.valueList[0][1]);
  2478. 908.  -           dd.header.innerHTML = '<div>' + text + '</div>';
  2479. 909.  -           if (dd.options.target) dd.options.target.innerHTML = text;
  2480. 910.  -
  2481. 911.  -           show(geByClass('client_choose_row_' + bindingId)[0]);
  2482. 912.  -           Ads.openInnerTable('aca', bindingId);
  2483. 913.  -
  2484. 914.  -           label_el = ge('unions_table_label_' + bindingId);
  2485. 915.  -           label_el.innerHTML = getLang('ads_export_stat_data_title_campaigns');
  2486. 916.  -           break;
  2487. 917.  -         case 3:
  2488. 918.  -           Ads.openInnerTable('cam', bindingId);
  2489. 919.  -         default:
  2490. 920.  -           break;
  2491. 921.  -       }
  2492. 922.  -     }
  2493. 923.  -
  2494. 924.  -     elem.index = i;
  2495. 925.  -     elem.value = t;
  2496. 926.  -     return t;
  2497. 927.  -   }
  2498. 928.  -   params.onSelect = function(value) {
  2499. 929.  -     if (value === undefined) value = uiDropdown.val();
  2500. 930.  -     elem.value = value;
  2501. 931.  -     elem.innerHTML = value;
  2502. 932.  -   };
  2503. 933.  -   params.target = elem;
  2504. 934.  -   params.showHover = true;
  2505. 935.  -   //params.alwaysMenuToUp = true;
  2506. 936.  -
  2507. 937.  -   params.onSelect(values[0][1]);
  2508. 938.  -
  2509. 939.  -   elem.uiDropdown = new DropdownMenu(values, params);
  2510. 940.  - }
  2511. 941.  -
  2512. 942.  - Ads.createInlineStaticEdit = function(editElem, bindingId, params) {
  2513. 943.  -   if (!params) params = {};
  2514. 944.  -   editElem = ge(editElem);
  2515. 945.  -   if (params.classname) editElem.className = params.classname + '_' + bindingId;
  2516. 946.  -
  2517. 947.  -   var uiTimeDay, uiTimeMonth, uiTimeYear, uiAbstractDropdown;
  2518. 948.  -
  2519. 949.  -   if (!params['type'] && !params['values']) return false;
  2520. 950.  -
  2521. 951.  -   var defaultValue;
  2522. 952.  -   if (params['default']) {
  2523. 953.  -     defaultValue = params['default'];
  2524. 954.  -   }
  2525. 955.  -
  2526. 956.  -   var type = params['type'] || 'dropdown';
  2527. 957.  -
  2528. 958.  -   switch (type) {
  2529. 959.  -     case 'dropdown':
  2530. 960.  -       if (params['values'] === undefined) {
  2531. 961.  -         return false;
  2532. 962.  -       }
  2533. 963.  -       if (defaultValue === undefined) {
  2534. 964.  -         defaultValue = 0;
  2535. 965.  -       }
  2536. 966.  -       break;
  2537. 967.  -     case 'time':
  2538. 968.  -       break;
  2539. 969.  -     default:
  2540. 970.  -       break;
  2541. 971.  -   }
  2542. 972.  -
  2543. 973.  -   monthNames = [
  2544. 974.  -     getLang('ads_jan'),
  2545. 975.  -     getLang('ads_feb'),
  2546. 976.  -     getLang('ads_mar'),
  2547. 977.  -     getLang('ads_apr'),
  2548. 978.  -     getLang('ads_may'),
  2549. 979.  -     getLang('ads_jun'),
  2550. 980.  -     getLang('ads_jul'),
  2551. 981.  -     getLang('ads_aug'),
  2552. 982.  -     getLang('ads_sep'),
  2553. 983.  -     getLang('ads_oct'),
  2554. 984.  -     getLang('ads_nov'),
  2555. 985.  -     getLang('ads_dec')
  2556. 986.  -   ];
  2557. 987.  -   saveValue(defaultValue);
  2558. 988.  -
  2559. 989.  -   function saveValue(newValue) {
  2560. 990.  -     editElem.value = newValue;
  2561. 991.  -
  2562. 992.  -     var newText = '';
  2563. 993.  -     switch (type) {
  2564. 994.  -       case 'time':
  2565. 995.  -         if (newValue && newValue.day && newValue.month && newValue.year) {
  2566. 996.  -           newText = newValue.day + ' ' + monthNames[newValue.month - 1] + ' ' + newValue.year;
  2567. 997.  -         }
  2568. 998.  -         break;
  2569. 999.  -       case 'dropdown':
  2570. 1000.  -         if (parseInt(newValue) !== undefined) {
  2571. 1001.  -           newText = params['values'][parseInt(newValue)];
  2572. 1002.  -         } else
  2573. 1003.  -         if (typeof newValue == 'string') {
  2574. 1004.  -           newText = newValue;
  2575. 1005.  -         }  else {
  2576. 1006.  -           for (var index in newValue) {
  2577. 1007.  -             saveValue.call(this, newValue[index]);
  2578. 1008.  -             return;
  2579. 1009.  -           }
  2580. 1010.  -         }
  2581. 1011.  -         break;
  2582. 1012.  -       default:
  2583. 1013.  -         break;
  2584. 1014.  -     }
  2585. 1015.  -
  2586. 1016.  -     applyNewValue.call(this, newValue, newText);
  2587. 1017.  -   }
  2588. 1018.  -   function applyNewValue(newValue, newText) {
  2589. 1019.  -     editElem.value = newValue;
  2590. 1020.  -     editElem.innerHTML = newText;
  2591. 1021.  -   }
  2592. 1022.  -   function checkValue(value) {
  2593. 1023.  -     return true;
  2594. 1024.  -   }
  2595. 1025.  -   function showLongError(error) {
  2596. 1026.  -     showFastBox(getLang('ads_error_box_title'), error);
  2597. 1027.  -   }
  2598. 1028.  -   function updateTimeDays(month) {
  2599. 1029.  -     uiTimeDay.setData(getDays(month));
  2600. 1030.  -   }
  2601. 1031.  -
  2602. 1032.  -   //
  2603. 1033.  -   // Helpers
  2604. 1034.  -   //
  2605. 1035.  -   function getDays(month, year) {
  2606. 1036.  -     var ret = [], days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  2607. 1037.  -     if (!year) year = (new Date()).getFullYear();
  2608. 1038.  -     if (month == 2 && year % 4 == 0) {
  2609. 1039.  -       days[2] = 29
  2610. 1040.  -     }
  2611. 1041.  -     for (var i = 1, days = days[month]; i <= days; i++) {
  2612. 1042.  -       ret.push(i);
  2613. 1043.  -     }
  2614. 1044.  -     return ret;
  2615. 1045.  -   }
  2616. 1046.  -   function getMonths() {
  2617. 1047.  -     var months = [];
  2618. 1048.  -     for (var i = 1; i <= 12; i++) {
  2619. 1049.  -       months.push([i, monthNames[i - 1]]);
  2620. 1050.  -     }
  2621. 1051.  -     return months;
  2622. 1052.  -   }
  2623. 1053.  -   function getYears() {
  2624. 1054.  -     var ret = [];
  2625. 1055.  -     var curY = (new Date()).getFullYear();
  2626. 1056.  -     for (var i = curY; i >= curY - 10; i--) {
  2627. 1057.  -       ret.push(i);
  2628. 1058.  -     }
  2629. 1059.  -     return ret;
  2630. 1060.  -   }
  2631. 1061.  -   function getAssocFromValues(array) {
  2632. 1062.  -     var res = [];
  2633. 1063.  -     for (var i = 0; i < array.length; i++) {
  2634. 1064.  -       res.push([i, array[i]]);
  2635. 1065.  -     }
  2636. 1066.  -     return res;
  2637. 1067.  -   }
  2638. 1068.  -
  2639. 1069.  -   //
  2640. 1070.  -   // Events
  2641. 1071.  -   //
  2642. 1072.  -   function afterInit() {
  2643. 1073.  -     var self = this;
  2644. 1074.  -
  2645. 1075.  -     switch (type) {
  2646. 1076.  -       case 'time':
  2647. 1077.  -         uiTimeDay = new Dropdown(
  2648. 1078.  -           geByClass('inline_time_day', this.contentTable)[0],
  2649. 1079.  -           getDays(1),
  2650. 1080.  -           {width: 45, height: 150, selectedItem: 1}
  2651. 1081.  -         );
  2652. 1082.  -         uiTimeMonth = new Dropdown(
  2653. 1083.  -           geByClass('inline_time_month', this.contentTable)[0],
  2654. 1084.  -           getMonths(),
  2655. 1085.  -           {width: 80, height: 150, selectedItem: 1, onChange: function(value) { updateTimeDays.call(this, value); }}
  2656. 1086.  -         );
  2657. 1087.  -         uiTimeYear = new Dropdown(
  2658. 1088.  -           geByClass('inline_time_year', this.contentTable)[0],
  2659. 1089.  -           getYears(),
  2660. 1090.  -           {width: 65, height: 150, selectedItem: (new Date()).getFullYear()}
  2661. 1091.  -         );
  2662. 1092.  -         break;
  2663. 1093.  -
  2664. 1094.  -       case 'dropdown':
  2665. 1095.  -         uiAbstractDropdown = new Dropdown(
  2666. 1096.  -           geByClass('ads_inline_dropdown', this.contentTable)[0],
  2667. 1097.  -           getAssocFromValues(params['values']),
  2668. 1098.  -           {height: 150, selectedItem: 0}
  2669. 1099.  -         );
  2670. 1100.  -         break;
  2671. 1101.  -
  2672. 1102.  -       default:
  2673. 1103.  -         break;
  2674. 1104.  -     }
  2675. 1105.  -   }
  2676. 1106.  -   function onBeforeShow() {
  2677. 1107.  -     switch (type) {
  2678. 1108.  -       case 'time':
  2679. 1109.  -         if (defaultValue && defaultValue.day && defaultValue.month && defaultValue.year) {
  2680. 1110.  -           uiTimeDay.val(defaultValue.day);
  2681. 1111.  -           uiTimeMonth.val(defaultValue.month);
  2682. 1112.  -           uiTimeYear.val(defaultValue.year);
  2683. 1113.  -         } else {
  2684. 1114.  -           editElem.innerHTML = "�� ������";
  2685. 1115.  -         }
  2686. 1116.  -         break;
  2687. 1117.  -
  2688. 1118.  -       case 'dropdown':
  2689. 1119.  -         uiAbstractDropdown.val(defaultValue);
  2690. 1120.  -         break;
  2691. 1121.  -
  2692. 1122.  -       default:
  2693. 1123.  -         break;
  2694. 1124.  -     }
  2695. 1125.  -   }
  2696. 1126.  -   function onShow() {
  2697. 1127.  -   }
  2698. 1128.  -   function onConfirm() {
  2699. 1129.  -     var newValue;
  2700. 1130.  -     if (type == 'time') {
  2701. 1131.  -       newValue = {};
  2702. 1132.  -       newValue.day   = uiTimeDay.val();
  2703. 1133.  -       newValue.month = uiTimeMonth.val();
  2704. 1134.  -       newValue.year  = uiTimeYear.val();
  2705. 1135.  -     } else
  2706. 1136.  -     if (type == 'dropdown') {
  2707. 1137.  -       newValue = uiAbstractDropdown.val();
  2708. 1138.  -     }
  2709. 1139.  -
  2710. 1140.  -     saveValue.call(this, newValue);
  2711. 1141.  -     return true;
  2712. 1142.  -   }
  2713. 1143.  -
  2714. 1144.  -   var options = {
  2715. 1145.  -     afterInit: afterInit,
  2716. 1146.  -     onBeforeShow: onBeforeShow,
  2717. 1147.  -     onShow: onShow,
  2718. 1148.  -     onConfirm: onConfirm
  2719. 1149.  -   };
  2720. 1150.  -
  2721. 1151.  -   switch (type) {
  2722. 1152.  -     case 'time':
  2723. 1153.  -       options.contentHTML =
  2724. 1154.  -         '<tr>' +
  2725. 1155.  -         '<td colspan="2">' +
  2726. 1156.  -         '<table class="ads_inline_edit_table">' +
  2727. 1157.  -         '<tr>' +
  2728. 1158.  -           '<td style="white-space: nowrap; width: 200px;">' +
  2729. 1159.  -             '<table class="ads_inline_edit_table">' +
  2730. 1160.  -             '<tr>' +
  2731. 1161.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_day text" style="width: 30px;" /></td>' +
  2732. 1162.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_month text" style="width: 30px;" /></td>' +
  2733. 1163.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_year text" style="width: 30px;" /></td>' +
  2734. 1164.  -             '</tr>' +
  2735. 1165.  -             '</table>' +
  2736. 1166.  -           '</td>' +
  2737. 1167.  -         '</tr>' +
  2738. 1168.  -         '</table>' +
  2739. 1169.  -         '</td>' +
  2740. 1170.  -         '</tr>';
  2741. 1171.  -       break;
  2742. 1172.  -     case 'dropdown':
  2743. 1173.  -       options.contentHTML =
  2744. 1174.  -         '<tr>' +
  2745. 1175.  -         '<td colspan="2">' +
  2746. 1176.  -         '<table class="ads_inline_edit_table" style="width: 100%;">' +
  2747. 1177.  -           '<tr><td><input type="text" class="ads_inline_dropdown text" /></td></tr>' +
  2748. 1178.  -         '</table>' +
  2749. 1179.  -         '</td>' +
  2750. 1180.  -         '</tr>';
  2751. 1181.  -       break;
  2752. 1182.  -     default:
  2753. 1183.  -       break;
  2754. 1184.  -   }
  2755. 1185.  -
  2756. 1186.  -   new InlineEdit(editElem, options);
  2757. 1187.  - }
  2758. 1188.  -
  2759. 1189.  - Ads.onInlineEditClick = function(elem, callback, rown, coln) {
  2760. 1190.  -   var _t = this;
  2761. 1191.  -
  2762. 1192.  -   var editElem = elem,
  2763. 1193.  -       progressElem = _t.content.extra.progress_elem[rown][coln],
  2764. 1194.  -       unionId = _t.content.extra.union_id[rown][coln],
  2765. 1195.  -       unionType = _t.content.extra.union_type[rown][coln],
  2766. 1196.  -       valueType = _t.content.extra.value_type[rown][coln],
  2767. 1197.  -       initValue = _t.content.extra.init_value[rown][coln],
  2768. 1198.  -       hash = _t.content.extra.hash[rown][coln],
  2769. 1199.  -       additionalParams = extend(_t.content.extra.additional_params[rown][coln], {
  2770. 1200.  -         valCallback: function(val) {
  2771. 1201.  -           callback({
  2772. 1202.  -             value: val,
  2773. 1203.  -             extra: {
  2774. 1204.  -               init_value: val
  2775. 1205.  -             }
  2776. 1206.  -           });
  2777. 1207.  -         }
  2778. 1208.  -       });
  2779. 1209.  -
  2780. 1210.  -   var ret = Ads.createInlineEdit(editElem, progressElem, unionType, unionId, valueType, initValue, hash, additionalParams);
  2781. 1211.  -   ret.obj.show();
  2782. 1212.  - }
  2783. 1213.  -
  2784. 1214.  - Ads.createInlineEdit = function(editElem, progressElem, unionType, unionId, valueType, initValue, hash, additionalParams) {
  2785. 1215.  -   editElem     = ge(editElem);
  2786. 1216.  -   progressElem = ge(progressElem);
  2787. 1217.  -   var defaultValue = initValue;
  2788. 1218.  -   var bad_this = this;
  2789. 1219.  -
  2790. 1220.  -   var uiTimeDay, uiTimeMonth, uiTimeHour;
  2791. 1221.  -
  2792. 1222.  -   var valueGeneralType;
  2793. 1223.  -   switch (valueType) {
  2794. 1224.  -     case 'cost_per_click':
  2795. 1225.  -       valueGeneralType = 'cost_per_click';
  2796. 1226.  -       break;
  2797. 1227.  -     case 'day_limit':
  2798. 1228.  -     case 'month_limit':
  2799. 1229.  -     case 'all_limit':
  2800. 1230.  -     case 'contract_limit':
  2801. 1231.  -       valueGeneralType = 'limit';
  2802. 1232.  -       break;
  2803. 1233.  -     case 'start_time':
  2804. 1234.  -     case 'stop_time':
  2805. 1235.  -       valueGeneralType = 'time';
  2806. 1236.  -       break;
  2807. 1237.  -     default:
  2808. 1238.  -       valueGeneralType = 'text';
  2809. 1239.  -       break;
  2810. 1240.  -   }
  2811. 1241.  -
  2812. 1242.  -   function saveValue(newValue, isRemoveValue) {
  2813. 1243.  -
  2814. 1244.  -     if (valueGeneralType == 'limit') {
  2815. 1245.  -       if ((!isRemoveValue && defaultValue == newValue) || (isRemoveValue && defaultValue == 0)) {
  2816. 1246.  -         if (isRemoveValue) {
  2817. 1247.  -           this.hide();
  2818. 1248.  -         }
  2819. 1249.  -         return;
  2820. 1250.  -       }
  2821. 1251.  -     } else {
  2822. 1252.  -       if (defaultValue == newValue) {
  2823. 1253.  -         return;
  2824. 1254.  -       }
  2825. 1255.  -     }
  2826. 1256.  -
  2827. 1257.  -     var unknownError = getLang('ads_error_unexpected_error_try_later');
  2828. 1258.  -
  2829. 1259.  -     var params = {};
  2830. 1260.  -     params.union_id = unionId;
  2831. 1261.  -     params.hash = hash;
  2832. 1262.  -     extend(params, additionalParams);
  2833. 1263.  -
  2834. 1264.  -     if (isRemoveValue) {
  2835. 1265.  -       params[valueType] = 0;
  2836. 1266.  -     } else {
  2837. 1267.  -       if (valueGeneralType == 'time') {
  2838. 1268.  -         params[valueType + '_day'] = newValue.day;
  2839. 1269.  -         params[valueType + '_month'] = newValue.month;
  2840. 1270.  -         params[valueType + '_hour'] = newValue.hour;
  2841. 1271.  -       } else {
  2842. 1272.  -         params[valueType] = newValue;
  2843. 1273.  -       }
  2844. 1274.  -     }
  2845. 1275.  -
  2846. 1276.  -     var self = this;
  2847. 1277.  -
  2848. 1278.  -     function onAjaxComplete(response) {
  2849. 1279.  -       if (isObject(response)) {
  2850. 1280.  -         if (response.error) {
  2851. 1281.  -           showLongError.call(self, response.error);
  2852. 1282.  -         } else if (!response.not_changed) {
  2853. 1283.  -           if ((valueType + '_value') in response) {
  2854. 1284.  -             applyNewValue.call(self, response[valueType + '_value'], response[valueType + '_text']);
  2855. 1285.  -           } else if (response[valueType + '_value_day']) {
  2856. 1286.  -             var newValue = {};
  2857. 1287.  -             newValue.day   = response[valueType + '_value_day'];
  2858. 1288.  -             newValue.month = response[valueType + '_value_month'];
  2859. 1289.  -             newValue.hour  = response[valueType + '_value_hour'];
  2860. 1290.  -             applyNewValue.call(self, newValue, response[valueType + '_text']);
  2861. 1291.  -           } else {
  2862. 1292.  -             showLongError.call(self, unknownError);
  2863. 1293.  -           }
  2864. 1294.  -         }
  2865. 1295.  -       } else {
  2866. 1296.  -         showLongError.call(self, unknownError);
  2867. 1297.  -       }
  2868. 1298.  -
  2869. 1299.  -       hide(progressElem);
  2870. 1300.  -       show(editElem);
  2871. 1301.  -
  2872. 1302.  -       return true;
  2873. 1303.  -     }
  2874. 1304.  -     ajax.post('/ads?act=a_unions_general_info_save', params, {onDone: onAjaxComplete, onFail: onAjaxComplete});
  2875. 1305.  -
  2876. 1306.  -     hide(editElem);
  2877. 1307.  -     show(progressElem);
  2878. 1308.  -     if (isRemoveValue) {
  2879. 1309.  -       this.hide();
  2880. 1310.  -     }
  2881. 1311.  -   }
  2882. 1312.  -   function applyNewValue(newValue, newText) {
  2883. 1313.  -     if (valueType == 'name') {
  2884. 1314.  -       Ads.updateUnionName(unionId, newText);
  2885. 1315.  -     }
  2886. 1316.  -     defaultValue = newValue;
  2887. 1317.  -     if (additionalParams.valCallback) {
  2888. 1318.  -       additionalParams.valCallback(newValue);
  2889. 1319.  -     } else {
  2890. 1320.  -       editElem.innerHTML = newText;
  2891. 1321.  -     }
  2892. 1322.  -   }
  2893. 1323.  -   function checkValue(value) {
  2894. 1324.  -     switch (valueGeneralType) {
  2895. 1325.  -       case 'cost_per_click':
  2896. 1326.  -         if (value == '' || value == '0' || value == 0) {
  2897. 1327.  -           return (additionalParams.is_cost_per_click ? getLang('ads_error_cost_per_click_no_value') : getLang('ads_error_cost_per_views_no_value'));
  2898. 1328.  -         }
  2899. 1329.  -         if (!value.match(/[0-9.,]/)) {
  2900. 1330.  -           return (additionalParams.is_cost_per_click ? getLang('ads_error_cost_per_click_invalid_value') : getLang('ads_error_cost_per_views_invalid_value'));
  2901. 1331.  -         }
  2902. 1332.  -         value = value.replace(',', '.');
  2903. 1333.  -
  2904. 1334.  -         var valueFloat      = parseFloat(value);
  2905. 1335.  -         var suffixesAll     = '';
  2906. 1336.  -         suffixesAll        += (additionalParams.is_cost_per_click ? '_click' : '_views');
  2907. 1337.  -         suffixesAll        += (additionalParams.is_exclusive_ad ? '_exclusive' : '');
  2908. 1338.  -         suffixesAll        += (additionalParams.is_app_admin ? '_app' : '');
  2909. 1339.  -         var minValue        = cur.unionsLimits['cost_per' + suffixesAll + '_min'];
  2910. 1340.  -         var maxValue        = cur.unionsLimits['cost_per' + suffixesAll + '_max'];
  2911. 1341.  -         var minErrorLangKey = (additionalParams.is_cost_per_click ? 'ads_error_cost_per_click_min_value' : 'ads_error_cost_per_views_min_value');
  2912. 1342.  -         var maxErrorLangKey = (additionalParams.is_cost_per_click ? 'ads_error_cost_per_click_max_value' : 'ads_error_cost_per_views_max_value');
  2913. 1343.  -         if (valueFloat < minValue) {
  2914. 1344.  -           return getLang(minErrorLangKey).replace('{money}', getLang('global_money_amount_rub', minValue));
  2915. 1345.  -         }
  2916. 1346.  -         if (valueFloat > maxValue) {
  2917. 1347.  -           return getLang(maxErrorLangKey).replace('{money}', getLang('global_money_amount_rub', maxValue));
  2918. 1348.  -         }
  2919. 1349.  -
  2920. 1350.  -         if (!value.match(cur.unionsLimits.cost_per_click_pattern)) {
  2921. 1351.  -           return (additionalParams.is_cost_per_click ? getLang('ads_error_cost_per_click_invalid_value') : getLang('ads_error_cost_per_views_invalid_value'));
  2922. 1352.  -         }
  2923. 1353.  -         return true;
  2924. 1354.  -       case 'limit':
  2925. 1355.  -         if (value == '' || value == '0' || value == 0) {
  2926. 1356.  -           return getLang('ads_error_limit_no_value');
  2927. 1357.  -         }
  2928. 1358.  -         if (!value.match(/[0-9.,]/)) {
  2929. 1359.  -           return getLang('ads_error_limit_invalid_value');
  2930. 1360.  -         }
  2931. 1361.  -         if (value.indexOf('.') != -1 || value.indexOf(',') != -1) {
  2932. 1362.  -           return getLang('ads_error_limit_integer_value');
  2933. 1363.  -         }
  2934. 1364.  -         if (parseInt(value) < cur.unionsLimits.limit_min) {
  2935. 1365.  -           return getLang('ads_error_limit_min_value').replace('{money}', getLang('global_money_amount_rub', cur.unionsLimits.limit_min));
  2936. 1366.  -         }
  2937. 1367.  -         if (parseInt(value) > cur.unionsLimits.limit_max) {
  2938. 1368.  -           return getLang('ads_error_limit_large_value');
  2939. 1369.  -         }
  2940. 1370.  -         if (!value.match(cur.unionsLimits.limit_pattern)) {
  2941. 1371.  -           return getLang('ads_error_limit_invalid_value');
  2942. 1372.  -         }
  2943. 1373.  -         return true;
  2944. 1374.  -     }
  2945. 1375.  -     switch (valueType) {
  2946. 1376.  -       case 'name':
  2947. 1377.  -         if (value == '') {
  2948. 1378.  -           if (unionType == 4) { // Top union
  2949. 1379.  -             // Nothing
  2950. 1380.  -           } else if (unionType == 2) {
  2951. 1381.  -             return getLang('ads_error_client_name_no_value');
  2952. 1382.  -           } else if (unionType == 1) {
  2953. 1383.  -             return getLang('ads_error_campaign_name_no_value');
  2954. 1384.  -           }
  2955. 1385.  -         }
  2956. 1386.  -         return true;
  2957. 1387.  -     }
  2958. 1388.  -     if (additionalParams.server_check) {
  2959. 1389.  -       return true;
  2960. 1390.  -     } else {
  2961. 1391.  -       return false;
  2962. 1392.  -     }
  2963. 1393.  -   }
  2964. 1394.  -
  2965. 1395.  -   function showFastError(error) {
  2966. 1396.  -     geByClass('ads_inline_fast_error', this.fastErrorRow)[0].innerHTML = error;
  2967. 1397.  -     show(this.fastErrorRow);
  2968. 1398.  -   }
  2969. 1399.  -   function hideFastError() {
  2970. 1400.  -     hide(this.fastErrorRow);
  2971. 1401.  -     geByClass('ads_inline_fast_error', this.fastErrorRow)[0].innerHTML = '';
  2972. 1402.  -   }
  2973. 1403.  -   function showLongError(error) {
  2974. 1404.  -     showFastBox(getLang('ads_error_box_title'), error);
  2975. 1405.  -   }
  2976. 1406.  -   function removeValue() {
  2977. 1407.  -     saveValue.call(this, false, true);
  2978. 1408.  -     return true;
  2979. 1409.  -   }
  2980. 1410.  -   function updateTimeDays(month) {
  2981. 1411.  -     uiTimeDay.setData(getDays(month));
  2982. 1412.  -   }
  2983. 1413.  -
  2984. 1414.  -   //
  2985. 1415.  -   // Helpers
  2986. 1416.  -   //
  2987. 1417.  -   function getDays(month) {
  2988. 1418.  -     var ret = [], days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  2989. 1419.  -     if (month == 2 && (new Date()).getFullYear() % 4 == 0) {
  2990. 1420.  -       days[2] = 29
  2991. 1421.  -     }
  2992. 1422.  -     for (var i = 1, days = days[month]; i <= days; i++) {
  2993. 1423.  -       ret.push(i);
  2994. 1424.  -     }
  2995. 1425.  -     return ret;
  2996. 1426.  -   }
  2997. 1427.  -   function getMonths() {
  2998. 1428.  -     var months = [];
  2999. 1429.  -     months.push([1,  getLang('ads_jan')]);
  3000. 1430.  -     months.push([2,  getLang('ads_feb')]);
  3001. 1431.  -     months.push([3,  getLang('ads_mar')]);
  3002. 1432.  -     months.push([4,  getLang('ads_apr')]);
  3003. 1433.  -     months.push([5,  getLang('ads_may')]);
  3004. 1434.  -     months.push([6,  getLang('ads_jun')]);
  3005. 1435.  -     months.push([7,  getLang('ads_jul')]);
  3006. 1436.  -     months.push([8,  getLang('ads_aug')]);
  3007. 1437.  -     months.push([9,  getLang('ads_sep')]);
  3008. 1438.  -     months.push([10, getLang('ads_oct')]);
  3009. 1439.  -     months.push([11, getLang('ads_nov')]);
  3010. 1440.  -     months.push([12, getLang('ads_dec')]);
  3011. 1441.  -     return months;
  3012. 1442.  -   }
  3013. 1443.  -   function getHours() {
  3014. 1444.  -     var ret = [];
  3015. 1445.  -     for (var i = 0; i < 24; i++) {
  3016. 1446.  -       ret.push([i, i + ':00']);
  3017. 1447.  -     }
  3018. 1448.  -     return ret;
  3019. 1449.  -   }
  3020. 1450.  -
  3021. 1451.  -   //
  3022. 1452.  -   // Events
  3023. 1453.  -   //
  3024. 1454.  -   function afterInit() {
  3025. 1455.  -     var self = this;
  3026. 1456.  -
  3027. 1457.  -     if (valueGeneralType == 'limit' || valueGeneralType == 'time') {
  3028. 1458.  -       this.removeValueAnchor = geByClass('ads_inline_edit_remove_value', this.contentTable)[0];
  3029. 1459.  -       addEvent(this.removeValueAnchor, 'click', function() { removeValue.call(self); return false; });
  3030. 1460.  -     }
  3031. 1461.  -
  3032. 1462.  -     if (valueGeneralType == 'time') {
  3033. 1463.  -       uiTimeDay = new Dropdown(
  3034. 1464.  -         geByClass('inline_time_day', this.contentTable)[0],
  3035. 1465.  -         getDays(1),
  3036. 1466.  -         {width: 45, height: 150, selectedItem: 1}
  3037. 1467.  -       );
  3038. 1468.  -       uiTimeMonth = new Dropdown(
  3039. 1469.  -         geByClass('inline_time_month', this.contentTable)[0],
  3040. 1470.  -         getMonths(),
  3041. 1471.  -         {width: 80, height: 150, selectedItem: 1, onChange: function(value) { updateTimeDays.call(this, value); }}
  3042. 1472.  -       );
  3043. 1473.  -       uiTimeHour = new Dropdown(
  3044. 1474.  -         geByClass('inline_time_hour', this.contentTable)[0],
  3045. 1475.  -         getHours(),
  3046. 1476.  -         {width: 65, height: 150, selectedItem: 0}
  3047. 1477.  -       );
  3048. 1478.  -     }
  3049. 1479.  -
  3050. 1480.  -     this.fastErrorRow = geByClass('ads_inline_fast_error_row', this.contentTable)[0];
  3051. 1481.  -
  3052. 1482.  -     if (this.input) {
  3053. 1483.  -       this.is_user_action = true;
  3054. 1484.  -       addEvent(this.input, 'keyup', function(event) {
  3055. 1485.  -           if (event.keyCode != 13) {
  3056. 1486.  -             hideFastError.call(self);
  3057. 1487.  -           }
  3058. 1488.  -         }
  3059. 1489.  -       );
  3060. 1490.  -     }
  3061. 1491.  -   }
  3062. 1492.  -   function onBeforeShow() {
  3063. 1493.  -     if (this.input) {
  3064. 1494.  -       this.input.value = defaultValue;
  3065. 1495.  -     }
  3066. 1496.  -
  3067. 1497.  -     if (valueGeneralType == 'time') {
  3068. 1498.  -       uiTimeDay.val(defaultValue.day);
  3069. 1499.  -       uiTimeMonth.val(defaultValue.month);
  3070. 1500.  -       uiTimeHour.val(defaultValue.hour);
  3071. 1501.  -     }
  3072. 1502.  -
  3073. 1503.  -     hideFastError.call(this);
  3074. 1504.  -
  3075. 1505.  -     var self = this;
  3076. 1506.  -     if (valueGeneralType == 'cost_per_click' && !this.recommended_cost_loaded) {
  3077. 1507.  -       var recommendedCostProgress = geByClass('inline_recommended_cost_progress', this.contentTable)[0];
  3078. 1508.  -       var recommendedCostText     = geByClass('ads_inline_recommended_cost_text',     this.contentTable)[0];
  3079. 1509.  -
  3080. 1510.  -       function onDone(response) {
  3081. 1511.  -         if (response && response.recommended_costs && response.recommended_costs.cost_text) {
  3082. 1512.  -           recommendedCostText.innerHTML = response.recommended_costs.cost_text;
  3083. 1513.  -           hide(recommendedCostProgress);
  3084. 1514.  -           show(recommendedCostText);
  3085. 1515.  -           if (!this.is_user_action && self.input.value == '0') {
  3086. 1516.  -             self.input.value = response.recommended_costs.cost_value;
  3087. 1517.  -           }
  3088. 1518.  -           self.recommended_cost_loaded = true;
  3089. 1519.  -         }
  3090. 1520.  -       };
  3091. 1521.  -       var ajaxParams = {ad_id: unionId};
  3092. 1522.  -       ajax.post('/ads?act=a_get_recommended_cost', ajaxParams, {onDone: onDone});
  3093. 1523.  -     }
  3094. 1524.  -   }
  3095. 1525.  -   function onShow() {
  3096. 1526.  -     if (this.input) {
  3097. 1527.  -       elfocus(this.input);
  3098. 1528.  -     }
  3099. 1529.  -   }
  3100. 1530.  -   function onConfirm() {
  3101. 1531.  -     var newValue;
  3102. 1532.  -     if (valueGeneralType == 'time') {
  3103. 1533.  -       newValue = {};
  3104. 1534.  -       newValue.day   = uiTimeDay.val();
  3105. 1535.  -       newValue.month = uiTimeMonth.val();
  3106. 1536.  -       newValue.hour  = uiTimeHour.val();
  3107. 1537.  -     } else {
  3108. 1538.  -       newValue = this.input.value;
  3109. 1539.  -
  3110. 1540.  -       var checkResult = checkValue.call(this, newValue, valueType);
  3111. 1541.  -       if (typeof(checkResult) == 'string') {
  3112. 1542.  -         showFastError.call(this, checkResult);
  3113. 1543.  -         return false;
  3114. 1544.  -       }
  3115. 1545.  -       if (checkResult !== true) {
  3116. 1546.  -         showFastError.call(this, getLang('ads_error_unknown_error'));
  3117. 1547.  -         return false;
  3118. 1548.  -       }
  3119. 1549.  -     }
  3120. 1550.  -
  3121. 1551.  -     saveValue.call(this, newValue, false);
  3122. 1552.  -     return true;
  3123. 1553.  -   }
  3124. 1554.  -
  3125. 1555.  -   var options = {
  3126. 1556.  -     afterInit: afterInit,
  3127. 1557.  -     onBeforeShow: onBeforeShow,
  3128. 1558.  -     onShow: onShow,
  3129. 1559.  -     onConfirm: onConfirm
  3130. 1560.  -   };
  3131. 1561.  -
  3132. 1562.  -   switch (valueGeneralType) {
  3133. 1563.  -     case 'cost_per_click':
  3134. 1564.  -       options.contentHTML =
  3135. 1565.  -         '<tr>' +
  3136. 1566.  -         '<td colspan="2">' +
  3137. 1567.  -         '<table class="ads_inline_edit_table" style="width: 100%;">' +
  3138. 1568.  -         '<tr><td><input class="inlInput text" type="text" /></td></tr>' +
  3139. 1569.  -         '<tr><td style="padding-top: 7px; height: 22px;">' +
  3140. 1570.  -           '<img class="inline_recommended_cost_progress" src="/images/upload.gif" />' +
  3141. 1571.  -           '<span class="ads_inline_recommended_cost_text"></span>' +
  3142. 1572.  -           '<div style="width: 275px; height: 1px;"></div>' +
  3143. 1573.  -           '</td></tr>' +
  3144. 1574.  -         '<tr class="ads_inline_fast_error_row"><td><div class="ads_inline_fast_error"></div></td></tr>' +
  3145. 1575.  -         '</table>' +
  3146. 1576.  -         '</td>' +
  3147. 1577.  -         '</tr>';
  3148. 1578.  -       break;
  3149. 1579.  -     case 'limit':
  3150. 1580.  -       options.contentHTML =
  3151. 1581.  -         '<tr>' +
  3152. 1582.  -         '<td colspan="2">' +
  3153. 1583.  -         '<table class="ads_inline_edit_table">' +
  3154. 1584.  -         '<tr>' +
  3155. 1585.  -         '<td><input class="inlInput text" type="text" /></td>' +
  3156. 1586.  -         '<td><a class="ads_inline_edit_remove_value" href="#">' + getLang('ads_inline_edit_remove_limit') + '</a></td>' +
  3157. 1587.  -         '</tr>' +
  3158. 1588.  -         '<tr class="ads_inline_fast_error_row"><td colspan="2"><div class="ads_inline_fast_error"></div></td></tr>' +
  3159. 1589.  -         '</table>' +
  3160. 1590.  -         '</td>' +
  3161. 1591.  -         '</tr>';
  3162. 1592.  -       break;
  3163. 1593.  -     case 'time':
  3164. 1594.  -       var removeValueText;
  3165. 1595.  -       switch (valueType) {
  3166. 1596.  -         case 'start_time': removeValueText = getLang('ads_inline_edit_remove_start_time'); break;
  3167. 1597.  -         case 'stop_time': removeValueText = getLang('ads_inline_edit_remove_stop_time'); break;
  3168. 1598.  -       }
  3169. 1599.  -       options.contentHTML =
  3170. 1600.  -         '<tr>' +
  3171. 1601.  -         '<td colspan="2">' +
  3172. 1602.  -         '<table class="ads_inline_edit_table">' +
  3173. 1603.  -         '<tr>' +
  3174. 1604.  -           '<td style="white-space: nowrap; width: 200px;">' +
  3175. 1605.  -             '<table class="ads_inline_edit_table">' +
  3176. 1606.  -             '<tr>' +
  3177. 1607.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_day text" style="width: 30px;" /></td>' +
  3178. 1608.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_month text" style="width: 30px;" /></td>' +
  3179. 1609.  -               '<td style="padding-right: 5px;"><input type="text" class="inline_time_hour text" style="width: 30px;" /></td>' +
  3180. 1610.  -             '</tr>' +
  3181. 1611.  -             '</table>' +
  3182. 1612.  -           '</td>' +
  3183. 1613.  -         '</tr>' +
  3184. 1614.  -         '<tr><td style="padding-top: 7px;"><a class="ads_inline_edit_remove_value" style="padding-left: 0;" href="#">' + removeValueText + '</a></td></tr>' +
  3185. 1615.  -         '<tr class="ads_inline_fast_error_row"><td colspan="2"><div class="ads_inline_fast_error"></div></td></tr>' +
  3186. 1616.  -         '</table>' +
  3187. 1617.  -         '</td>' +
  3188. 1618.  -         '</tr>';
  3189. 1619.  -       break;
  3190. 1620.  -     case 'text':
  3191. 1621.  -       options.contentHTML =
  3192. 1622.  -         '<tr>' +
  3193. 1623.  -         '<td colspan="2">' +
  3194. 1624.  -         '<table class="ads_inline_edit_table" style="width: 100%;">' +
  3195. 1625.  -         '<tr><td><input class="inlInput text" type="text" /></td></tr>' +
  3196. 1626.  -         '<tr class="ads_inline_fast_error_row"><td><div class="ads_inline_fast_error"></div></td></tr>' +
  3197. 1627.  -         '</table>' +
  3198. 1628.  -         '</td>' +
  3199. 1629.  -         '</tr>';
  3200. 1630.  -       break;
  3201. 1631.  -   }
  3202. 1632.  -
  3203. 1633.  -   var ret = {
  3204. 1634.  -     target: editElem,
  3205. 1635.  -     options: options
  3206. 1636.  -   };
  3207. 1637.  -   if (this.getOptionsOnly) { // dirty hack.
  3208. 1638.  -     return ret;
  3209. 1639.  -   }
  3210. 1640.  -   ret.obj = new InlineEdit(editElem, options);
  3211. 1641.  -
  3212. 1642.  -   var accessFunctions = {
  3213. 1643.  -     applyNewValue: applyNewValue
  3214. 1644.  -   }
  3215. 1645.  -
  3216. 1646.  -   if (!cur.inlineEditControls) {
  3217. 1647.  -     cur.inlineEditControls = {};
  3218. 1648.  -   }
  3219. 1649.  -   cur.inlineEditControls[valueType + '_' + unionId] = accessFunctions;
  3220. 1650.  -
  3221. 1651.  -   return ret;
  3222. 1652.  - }
  3223. 1653.  -
  3224. 1654.  - Ads.createInlineDropdownMenu = function(menuElem, boxElem, progressElem, unionId, valueType, items, initValue, hash, additionalParams) {
  3225. 1655.  -   menuElem     = ge(menuElem);
  3226. 1656.  -   boxElem      = ge(boxElem);
  3227. 1657.  -   progressElem = ge(progressElem);
  3228. 1658.  -   var defaultValue = initValue;
  3229. 1659.  -
  3230. 1660.  -   var self;
  3231. 1661.  -
  3232. 1662.  -   function saveValue(newValue) {
  3233. 1663.  -
  3234. 1664.  -     if (newValue == defaultValue) {
  3235. 1665.  -       return;
  3236. 1666.  -     }
  3237. 1667.  -
  3238. 1668.  -     var unknownError = getLang('ads_error_unexpected_error_try_later');
  3239. 1669.  -
  3240. 1670.  -     var params = {};
  3241. 1671.  -     params.union_id = unionId;
  3242. 1672.  -     params.hash = hash;
  3243. 1673.  -     extend(params, additionalParams);
  3244. 1674.  -     params[valueType] = newValue;
  3245. 1675.  -
  3246. 1676.  -     function onAjaxComplete(response) {
  3247. 1677.  -       if (isObject(response)) {
  3248. 1678.  -         if (response.error) {
  3249. 1679.  -           showLongError.call(self, response.error);
  3250. 1680.  -         } else if (!response.not_changed) {
  3251. 1681.  -           if (response[valueType + '_value'] !== undefined) {
  3252. 1682.  -             applyNewValue(response[valueType + '_value'], response[valueType + '_text']);
  3253. 1683.  -             if (additionalParams.reload) {
  3254. 1684.  -               nav.reload();
  3255. 1685.  -             }
  3256. 1686.  -           } else {
  3257. 1687.  -             showLongError.call(self, unknownError);
  3258. 1688.  -           }
  3259. 1689.  -         }
  3260. 1690.  -       } else {
  3261. 1691.  -         showLongError.call(self, unknownError);
  3262. 1692.  -       }
  3263. 1693.  -
  3264. 1694.  -       hide(progressElem);
  3265. 1695.  -       show(boxElem);
  3266. 1696.  -
  3267. 1697.  -       return true;
  3268. 1698.  -     }
  3269. 1699.  -     ajax.post('/ads?act=a_unions_general_info_save', params, {onDone: onAjaxComplete, onFail: onAjaxComplete});
  3270. 1700.  -
  3271. 1701.  -     hide(boxElem);
  3272. 1702.  -     show(progressElem);
  3273. 1703.  -   }
  3274. 1704.  -
  3275. 1705.  -   function applyNewValue(newValue, newText) {
  3276. 1706.  -     defaultValue = newValue;
  3277. 1707.  -     self.setOptions({title: newText});
  3278. 1708.  -     menuElem.innerHTML = newText;
  3279. 1709.  -   }
  3280. 1710.  -   function showLongError(error) {
  3281. 1711.  -     showFastBox(getLang('ads_error_box_title'), error);
  3282. 1712.  -   }
  3283. 1713.  -
  3284. 1714.  -   function onMenuChange(event) {
  3285. 1715.  -     var newValue = event.target.index;
  3286. 1716.  -     saveValue(newValue);
  3287. 1717.  -   }
  3288. 1718.  -
  3289. 1719.  -   var options = {};
  3290. 1720.  -   options.target = menuElem;
  3291. 1721.  -   options.onSelect = onMenuChange;
  3292. 1722.  -   options.showHover = false;
  3293. 1723.  -   options.updateTarget = false;
  3294. 1724.  -   self = new DropdownMenu(items, options);
  3295. 1725.  - }
  3296. 1726.  -
  3297. 1727.  - Ads.MultiDropdownMenu = function(items, options) {
  3298. 1728.  -   var dropdownMenu;
  3299. 1729.  -   var selectedItems = {};
  3300. 1730.  -   var curItems = [];
  3301. 1731.  -
  3302. 1732.  -   function onItemClick(e) {
  3303. 1733.  -     if (e.target.className == 'ads_dd_menu_item_checkbox_on') {
  3304. 1734.  -       selectedItems[e.target.index] = false;
  3305. 1735.  -       e.target.className = 'ads_dd_menu_item_checkbox_off';
  3306. 1736.  -     } else {
  3307. 1737.  -       selectedItems[e.target.index] = true;
  3308. 1738.  -       e.target.className = 'ads_dd_menu_item_checkbox_on';
  3309. 1739.  -     }
  3310. 1740.  -     return false;
  3311. 1741.  -   }
  3312. 1742.  -
  3313. 1743.  -   for (var i in items) {
  3314. 1744.  -     curItems[i] = {};
  3315. 1745.  -     for (var j in items[i]) {
  3316. 1746.  -       curItems[i][j] = items[i][j];
  3317. 1747.  -     }
  3318. 1748.  -     curItems[i].onClick = onItemClick;
  3319. 1749.  -     curItems[i].c = 'ads_dd_menu_item_checkbox_off';
  3320. 1750.  -     selectedItems[curItems[i].i] = false;
  3321. 1751.  -   }
  3322. 1752.  -
  3323. 1753.  -   dropdownMenu = new DropdownMenu(curItems, options);
  3324. 1754.  -   dropdownMenu.getSelectedItems = function() {
  3325. 1755.  -     var selectedItemsResult = [];
  3326. 1756.  -     for (var i in selectedItems) {
  3327. 1757.  -       if (selectedItems[i]) {
  3328. 1758.  -         selectedItemsResult.push(i);
  3329. 1759.  -       }
  3330. 1760.  -     }
  3331. 1761.  -     return selectedItemsResult;
  3332. 1762.  -   }
  3333. 1763.  -
  3334. 1764.  -   return dropdownMenu;
  3335. 1765.  - }
  3336. 1766.  -
  3337. 1767.  - Ads.getCampaignsTotalLabel = function(total) {
  3338. 1768.  -   var type = this._curFilter;
  3339. 1769.  -   if (typeof type == 'object') type = type[0];
  3340. 1770.  -   if (!this._curSearchString || this._curSearchString == '') {
  3341. 1771.  -     switch (type) {
  3342. 1772.  -       case 0: return getLang('ads_stopped_campaigns_total', total);
  3343. 1773.  -       case 1: return getLang('ads_running_campaigns_total', total);
  3344. 1774.  -       case 3: return getLang('ads_planned_campaigns_total', total);
  3345. 1775.  -       case 4: return getLang('ads_archived_campaigns_total', total);
  3346. 1776.  -       default: return getLang('ads_active_campaigns_total', total);
  3347. 1777.  -     }
  3348. 1778.  -   } else {
  3349. 1779.  -     switch (type) {
  3350. 1780.  -       case 0: return getLang('ads_stopped_campaigns_found', total);
  3351. 1781.  -       case 1: return getLang('ads_running_campaigns_found', total);
  3352. 1782.  -       case 3: return getLang('ads_planned_campaigns_found', total);
  3353. 1783.  -       case 4: return getLang('ads_archived_campaigns_found', total);
  3354. 1784.  -       default: return getLang('ads_active_campaigns_found', total);
  3355. 1785.  -     }
  3356. 1786.  -   }
  3357. 1787.  - }
  3358. 1788.  -
  3359. 1789.  - Ads.getNoCampaignsLabel = function() {
  3360. 1790.  -   var type = this._curFilter;
  3361. 1791.  -   if (typeof type == 'object') type = type[0];
  3362. 1792.  -   if (!this._curSearchString || this._curSearchString == '') {
  3363. 1793.  -     switch (type) {
  3364. 1794.  -       case 0: return getLang('ads_no_stopped_campaigns');
  3365. 1795.  -       case 1: return getLang('ads_no_running_campaigns');
  3366. 1796.  -       case 3: return getLang('ads_no_planned_campaigns');
  3367. 1797.  -       case 4: return getLang('ads_no_archived_campaigns');
  3368. 1798.  -       default: return getLang('ads_no_active_campaigns');
  3369. 1799.  -     }
  3370. 1800.  -   } else {
  3371. 1801.  -     switch (type) {
  3372. 1802.  -       case 0: return getLang('ads_no_stopped_campaigns_found');
  3373. 1803.  -       case 1: return getLang('ads_no_running_campaigns_found');
  3374. 1804.  -       case 3: return getLang('ads_no_planned_campaigns_found');
  3375. 1805.  -       case 4: return getLang('ads_no_archived_campaigns_found');
  3376. 1806.  -       default: return getLang('ads_no_active_campaigns_found');
  3377. 1807.  -     }
  3378. 1808.  -   }
  3379. 1809.  - }
  3380. 1810.  -
  3381. 1811.  - Ads.getAdsTotalLabel = function(total) {
  3382. 1812.  -   var type = this._curFilter;
  3383. 1813.  -   if (typeof type == 'object') type = type[0];
  3384. 1814.  -   if (!this._curSearchString || this._curSearchString == '') {
  3385. 1815.  -     switch (type) {
  3386. 1816.  -       case 0: return getLang('ads_stopped_ads_total', total);
  3387. 1817.  -       case 1: return getLang('ads_running_ads_total', total);
  3388. 1818.  -       case 3: return getLang('ads_planned_ads_total', total);
  3389. 1819.  -       case 4: return getLang('ads_archived_ads_total', total);
  3390. 1820.  -       default: return getLang('ads_active_ads_total', total);
  3391. 1821.  -     }
  3392. 1822.  -   } else {
  3393. 1823.  -     switch (type) {
  3394. 1824.  -       case 0: return getLang('ads_stopped_ads_found', total);
  3395. 1825.  -       case 1: return getLang('ads_running_ads_found', total);
  3396. 1826.  -       case 3: return getLang('ads_planned_ads_found', total);
  3397. 1827.  -       case 4: return getLang('ads_archived_ads_found', total);
  3398. 1828.  -       default: return getLang('ads_active_ads_found', total);
  3399. 1829.  -     }
  3400. 1830.  -   }
  3401. 1831.  - }
  3402. 1832.  -
  3403. 1833.  - Ads.getNoAdsLabel = function() {
  3404. 1834.  -   var type = this._curFilter;
  3405. 1835.  -   if (typeof type == 'object') type = type[0];
  3406. 1836.  -   if (!this._curSearchString || this._curSearchString == '') {
  3407. 1837.  -     switch (type) {
  3408. 1838.  -       case 0: return getLang('ads_no_stopped_ads');
  3409. 1839.  -       case 1: return getLang('ads_no_running_ads');
  3410. 1840.  -       case 3: return getLang('ads_no_planned_ads');
  3411. 1841.  -       case 4: return getLang('ads_no_archived_ads');
  3412. 1842.  -       default: return getLang('ads_no_active_ads');
  3413. 1843.  -     }
  3414. 1844.  -   } else {
  3415. 1845.  -     switch (type) {
  3416. 1846.  -       case 0: return getLang('ads_no_stopped_ads_found');
  3417. 1847.  -       case 1: return getLang('ads_no_running_ads_found');
  3418. 1848.  -       case 3: return getLang('ads_no_planned_ads_found');
  3419. 1849.  -       case 4: return getLang('ads_no_archived_ads_found');
  3420. 1850.  -       default: return getLang('ads_no_active_ads_found');
  3421. 1851.  -     }
  3422. 1852.  -   }
  3423. 1853.  - }
  3424. 1854.  -
  3425. 1855.  - Ads.getClientsTotalLabel = function(total) {
  3426. 1856.  -   var type = this._curFilter;
  3427. 1857.  -   if (typeof type == 'object') type = type[0];
  3428. 1858.  -   if (!this._curSearchString || this._curSearchString == '') {
  3429. 1859.  -     switch (type) {
  3430. 1860.  -       case 4: return getLang('ads_archived_clients_total', total);
  3431. 1861.  -       default: return getLang('ads_active_clients_total', total);
  3432. 1862.  -     }
  3433. 1863.  -   } else {
  3434. 1864.  -     switch (type) {
  3435. 1865.  -       case 4: return getLang('ads_archived_clients_found', total);
  3436. 1866.  -       default: return getLang('ads_active_clients_found', total);
  3437. 1867.  -     }
  3438. 1868.  -   }
  3439. 1869.  - }
  3440. 1870.  -
  3441. 1871.  - Ads.getNoClientsLabel = function() {
  3442. 1872.  -   var type = this._curFilter;
  3443. 1873.  -   if (typeof type == 'object') type = type[0];
  3444. 1874.  -   if (!this._curSearchString || this._curSearchString == '') {
  3445. 1875.  -     switch (type) {
  3446. 1876.  -       case 4: return getLang('ads_no_archived_clients');
  3447. 1877.  -       default: return getLang('ads_no_active_clients');
  3448. 1878.  -     }
  3449. 1879.  -   } else {
  3450. 1880.  -     switch (type) {
  3451. 1881.  -       case 4: return getLang('ads_no_archived_clients_found');
  3452. 1882.  -       default: return getLang('ads_no_active_clients_found');
  3453. 1883.  -     }
  3454. 1884.  -   }
  3455. 1885.  - }
  3456. 1886.  -
  3457. 1887.  - Ads.addOfficeFormatFunctions = function(options) {
  3458. 1888.  -   var arrFind = function(arr, val) {
  3459. 1889.  -     var i = 0;
  3460. 1890.  -     for (; i < arr.length; i++) {
  3461. 1891.  -       if (arr[i] === val) {
  3462. 1892.  -         return i;
  3463. 1893.  -       }
  3464. 1894.  -     }
  3465. 1895.  -     return -1;
  3466. 1896.  -   }
  3467. 1897.  -
  3468. 1898.  -   var ind = arrFind(options.columnClasses, 'column_name_view');
  3469. 1899.  -   options.columnFormatting[ind] = function(data, rown) {
  3470. 1900.  -     if (rown == -1) return data;
  3471. 1901.  -     var unionId = this.content.extra.unionId[rown];
  3472. 1902.  -     return '<div class="ads_paginated_table_name"><a href="/ads?act=office&union_id=' + unionId + '">' + data + '</a></div>';
  3473. 1903.  -   }
  3474. 1904.  -
  3475. 1905.  -   var limitFormat = function(data, rown, coln) {
  3476. 1906.  -     if (rown == -1) return data;
  3477. 1907.  -     var wrap;
  3478. 1908.  -     try {
  3479. 1909.  -       var uid = this.content.extra.uid[rown][coln];
  3480. 1910.  -       if (uid) {
  3481. 1911.  -         wrap = "<img id=\"inline_edit_progress" + uid + "\" src=\"/images/upload.gif\" style=\"display: none;\" /><a id=\"inline_edit_value" + uid + "\" >{value}</a>";
  3482. 1912.  -       }
  3483. 1913.  -     } catch (e) {
  3484. 1914.  -       // Nothing
  3485. 1915.  -     }
  3486. 1916.  -     if (!wrap) {
  3487. 1917.  -       wrap = '{value}';
  3488. 1918.  -     }
  3489. 1919.  -     var value = data;
  3490. 1920.  -     if (data == 0) {
  3491. 1921.  -       value = getLang('ads_no_money_limit');
  3492. 1922.  -     } else {
  3493. 1923.  -       value = this._formatData(data, 'currency_int');
  3494. 1924.  -     }
  3495. 1925.  -     return wrap.replace('{value}', value);
  3496. 1926.  -   }
  3497. 1927.  -   ind = arrFind(options.columnClasses, 'column_day_limit_view');
  3498. 1928.  -   if (ind != -1) options.columnFormatting[ind] = limitFormat;
  3499. 1929.  -   ind = arrFind(options.columnClasses, 'column_month_limit_view');
  3500. 1930.  -   if (ind != -1) options.columnFormatting[ind] = limitFormat;
  3501. 1931.  -   ind = arrFind(options.columnClasses, 'column_all_limit_view');
  3502. 1932.  -   if (ind != -1) options.columnFormatting[ind] = limitFormat;
  3503. 1933.  -
  3504. 1934.  -   return options;
  3505. 1935.  - }
  3506. 1936.  -
  3507. 1937.  - Ads.createOfficePaginatedTable = function(container, options, content) {
  3508. 1938.  -   var getButton = function(label, callback) {
  3509. 1939.  -     var div = ce('div', {className: 'button_blue'});
  3510. 1940.  -     var butt = ce('button', {innerHTML: label, onclick: callback});
  3511. 1941.  -     div.appendChild(butt);
  3512. 1942.  -     return div;
  3513. 1943.  -   }
  3514. 1944.  -
  3515. 1945.  -   var statusCol = 1;
  3516. 1946.  -
  3517. 1947.  -   var selected;
  3518. 1948.  -
  3519. 1949.  -   var buttons = [],
  3520. 1950.  -       labels = [getLang('ads_status_do_disable'),
  3521. 1951.  -                 getLang('ads_status_do_enable'),
  3522. 1952.  -                 getLang('ads_status_do_archive')];
  3523. 1953.  -
  3524. 1954.  -
  3525. 1955.  -   var changeStatus = function(val) {
  3526. 1956.  -     return function() {
  3527. 1957.  -       var unionIds = [],
  3528. 1958.  -           hashes = [],
  3529. 1959.  -           hashesDel = [],
  3530. 1960.  -           enable = val; // 1 - on, 0 - off, 2 - delete
  3531. 1961.  -       var i;
  3532. 1962.  -       for (i in selected) {
  3533. 1963.  -         unionIds.push(pt.content.extra.union_id[selected[i]][statusCol]);
  3534. 1964.  -         hashes.push(pt.content.extra.hash[selected[i]][statusCol]);
  3535. 1965.  -         hashesDel.push(pt.content.extra.hash_delete[selected[i]][statusCol]);
  3536. 1966.  -       }
  3537. 1967.  -
  3538. 1968.  -       unionIds = unionIds.join(',');
  3539. 1969.  -       hashes = hashes.join(',');
  3540. 1970.  -       hashesDel = hashesDel.join(',');
  3541. 1971.  -
  3542. 1972.  -       if (val == 2) { // delete
  3543. 1973.  -         Ads.openDeleteUnionBox(cur.tableUnionTypeForDelete, unionIds, hashesDel, lockChangeStatus, unlockChangeStatus, updateStatusInTable, 2);
  3544. 1974.  -         return;
  3545. 1975.  -       }
  3546. 1976.  -
  3547. 1977.  -       var params = {
  3548. 1978.  -         union_id: unionIds,
  3549. 1979.  -         hash: hashes,
  3550. 1980.  -         newclass: 1,
  3551. 1981.  -         enable: val
  3552. 1982.  -       };
  3553. 1983.  -
  3554. 1984.  -       lockChangeStatus();
  3555. 1985.  -
  3556. 1986.  -       function lockChangeStatus() {
  3557. 1987.  -         lockButton(buttons[val]);
  3558. 1988.  -         return true;
  3559. 1989.  -       };
  3560. 1990.  -       function unlockChangeStatus() {
  3561. 1991.  -         unlockButton(buttons[val]);
  3562. 1992.  -       }
  3563. 1993.  -       function updateStatusInTable(ans) {
  3564. 1994.  -         if (ans['status_class']) ans = [ans];
  3565. 1995.  -
  3566. 1996.  -         var errored = 0;
  3567. 1997.  -         for (var i in selected) {
  3568. 1998.  -           if (!ans[i]) continue;
  3569. 1999.  -           if (!ans[i]['status_class']) {
  3570. 2000.  -             if (ans[i]['error'] && !errored) {
  3571. 2001.  -               errored = 1;
  3572. 2002.  -               showFastBox(getLang('ads_cant_start_ad_box_title'), ans[i]['error']);
  3573. 2003.  -             }
  3574. 2004.  -             continue;
  3575. 2005.  -           }
  3576. 2006.  -           pt.content.types[selected[i]] = ans[i]['status_type'];
  3577. 2007.  -           pt.content.extra.status_text[selected[i]][statusCol] = ans[i]['status'];
  3578. 2008.  -           pt.content.extra.status_variants[selected[i]][statusCol] = ans[i]['status_variants'];
  3579. 2009.  -           pt._updateValue(selected[i], statusCol, ans[i]['status_class']);
  3580. 2010.  -         }
  3581. 2011.  -         updateButtons.apply(pt);
  3582. 2012.  -       }
  3583. 2013.  -
  3584. 2014.  -       function onRequestComplete(response) {
  3585. 2015.  -         // response may be object or array
  3586. 2016.  -
  3587. 2017.  -         unlockChangeStatus();
  3588. 2018.  -
  3589. 2019.  -         if (!response || response.error) { // no isObject or isArray check here
  3590. 2020.  -           debugLog('onFail change status');
  3591. 2021.  -           var errorMessage = ((response && response.error) ? response.error : getLang('ads_error_unexpected_error_try_later'));
  3592. 2022.  -           showFastBox(getLang('ads_cant_start_ad_box_title'), errorMessage);
  3593. 2023.  -           return true;
  3594. 2024.  -         }
  3595. 2025.  -
  3596. 2026.  -         var info = '';
  3597. 2027.  -         if (response && response.info) {
  3598. 2028.  -           info = response.info;
  3599. 2029.  -         }
  3600. 2030.  -         debugLog('onDone change status, ' + info);
  3601. 2031.  -
  3602. 2032.  -         updateStatusInTable(response);
  3603. 2033.  -         return true;
  3604. 2034.  -       }
  3605. 2035.  -
  3606. 2036.  -       ajax.post('/ads?act=a_union_change_status', params, {onDone: onRequestComplete, onFail: onRequestComplete});
  3607. 2037.  -     };
  3608. 2038.  -   }
  3609. 2039.  -
  3610. 2040.  -   var updateButtons = function() {
  3611. 2041.  -     selected = this.getSelection(0, 1);
  3612. 2042.  -     var i;
  3613. 2043.  -     for (i in buttons) {
  3614. 2044.  -       hide(buttons[i]);
  3615. 2045.  -     }
  3616. 2046.  -     if (selected.length == 0) {
  3617. 2047.  -     } else {
  3618. 2048.  -       var was = [false, false];
  3619. 2049.  -       var on = {on: 1, pending: 1},
  3620. 2050.  -           off = {off: 1, off_red: 1, cross: 1};
  3621. 2051.  -       for (i in selected) {
  3622. 2052.  -         var stat = this.content.data[selected[i]][statusCol];
  3623. 2053.  -         if (on[stat]) was[0] = 1;
  3624. 2054.  -         if (off[stat]) was[1] = 1;
  3625. 2055.  -       }
  3626. 2056.  -       if (was[0]) show(buttons[0]);
  3627. 2057.  -       if (was[1]) show(buttons[1]);
  3628. 2058.  -       show(buttons[2]);
  3629. 2059.  -     }
  3630. 2060.  -   }
  3631. 2061.  -
  3632. 2062.  -   options.onCheckboxPick = updateButtons;
  3633. 2063.  -   options.onRefresh = updateButtons;
  3634. 2064.  -
  3635. 2065.  -   options = Ads.addOfficeFormatFunctions(options);
  3636. 2066.  -
  3637. 2067.  -   var i;
  3638. 2068.  -   for (i = 0; i < 3; i++) {
  3639. 2069.  -     buttons[i] = getButton(labels[i], changeStatus(i));
  3640. 2070.  -   }
  3641. 2071.  -
  3642. 2072.  -   var pt = new PaginatedTable(container, options, content);
  3643. 2073.  - //  pt.getData('/ads?act=a_unions_table&union_id=1000157403&period_key=20111018&sort_key=default_r&offset={offset}&limit={limit}');
  3644. 2074.  -
  3645. 2075.  -   // mass actions
  3646. 2076.  -   var container = ge('pt_' + pt.globalNum + '_mass_act_default_container');
  3647. 2077.  -   if (container) {
  3648. 2078.  -     addClass(container, 'ads_mass_act_container');
  3649. 2079.  -     container.appendChild(buttons[1]);
  3650. 2080.  -     container.appendChild(buttons[0]);
  3651. 2081.  -     container.appendChild(buttons[2]);
  3652. 2082.  -     for (i in buttons) {
  3653. 2083.  -       hide(buttons[i]);
  3654. 2084.  -     }
  3655. 2085.  -     show(container);
  3656. 2086.  -   }
  3657. 2087.  -
  3658. 2088.  -   // selecting subclasses
  3659. 2089.  -   var selectSubclass = function(classes) {
  3660. 2090.  -     return function() {
  3661. 2091.  -       var corr = 1;
  3662. 2092.  -       for (i = 0; i < pt.tableSize; i++) {
  3663. 2093.  -         if (i < pt.curFrom || i > pt.curTo) continue;
  3664. 2094.  -         var j = pt.permutation[i];
  3665. 2095.  -         var curClass = pt.content.data[j][statusCol];
  3666. 2096.  -         corr &= ((pt.selection[j] == 1) == (classes[curClass] == 1));
  3667. 2097.  -       }
  3668. 2098.  -       var checked = 1 ^ corr;
  3669. 2099.  -       for (i = 0; i < pt.tableSize; i++) {
  3670. 2100.  -         if (i < pt.curFrom || i > pt.curTo) continue;
  3671. 2101.  -         var j = pt.permutation[i];
  3672. 2102.  -         var curClass = pt.content.data[j][statusCol];
  3673. 2103.  -         var curToggle = classes[curClass] ? checked : 0;
  3674. 2104.  -         var el = ge('cb_row_' + j + '_' + pt.globalNum);
  3675. 2105.  -         if (el) {
  3676. 2106.  -           window[curToggle ? 'addClass' : 'removeClass'](el, 'on');
  3677. 2107.  -         }
  3678. 2108.  -         pt.toggleCheckbox(false, j, curToggle);
  3679. 2109.  -       }
  3680. 2110.  -     };
  3681. 2111.  -   }
  3682. 2112.  -   container = ge('select_all_link');
  3683. 2113.  -   if (container) {
  3684. 2114.  -     container.onclick = selectSubclass({on: 1, off: 1, off_red: 1, cross: 1, pending: 1});
  3685. 2115.  -   }
  3686. 2116.  -   container = ge('select_running_link');
  3687. 2117.  -   if (container) {
  3688. 2118.  -     container.onclick = selectSubclass({on: 1});
  3689. 2119.  -   }
  3690. 2120.  -   container = ge('select_stopped_link');
  3691. 2121.  -   if (container) {
  3692. 2122.  -     container.onclick = selectSubclass({off: 1, off_red: 1, cross: 1});
  3693. 2123.  -   }
  3694. 2124.  - }
  3695. 2125.  -
  3696. 2126.  - Ads.onStatusHover = function(elem, callback, rown, coln) {
  3697. 2127.  -   var _t = this;
  3698. 2128.  -   var options = {
  3699. 2129.  -     status: {type: this.content.data[rown][coln], title: this.content.extra.status_text[rown][coln]},
  3700. 2130.  -     items: this.content.extra.status_variants[rown][coln],
  3701. 2131.  -     popupTime: -1,
  3702. 2132.  -     onSelect: function(event) { // copypasted
  3703. 2133.  -       var index = event.target.index,
  3704. 2134.  -           unionId = _t.content.extra.union_id[rown][coln],
  3705. 2135.  -           hash = _t.content.extra.hash[rown][coln],
  3706. 2136.  -           hashDelete = _t.content.extra.hash_delete[rown][coln];
  3707. 2137.  -
  3708. 2138.  -       if (index == 'archived') {
  3709. 2139.  -         setTimeout(function(){
  3710. 2140.  -           Ads.openDeleteUnionBox(cur.tableUnionTypeForDelete, unionId, hashDelete, lockChangeStatus, unlockChangeStatus, updateStatusInTable, 1);
  3711. 2141.  -         }, 1);
  3712. 2142.  -         return;
  3713. 2143.  -       }
  3714. 2144.  -
  3715. 2145.  -       var params = {};
  3716. 2146.  -       params.union_id = unionId;
  3717. 2147.  -       params.hash = hash;
  3718. 2148.  -       params.newclass = 1;
  3719. 2149.  -
  3720. 2150.  -       params.enable = ((index == 'on') ? 1 : 0);
  3721. 2151.  -
  3722. 2152.  -       lockChangeStatus();
  3723. 2153.  -
  3724. 2154.  -       function lockChangeStatus() {
  3725. 2155.  -         var selectorBox   = ge('union_' + unionId + '_status_selector_box');
  3726. 2156.  -         var progress      = ge('union_' + unionId + '_status_progress');
  3727. 2157.  -         hide(selectorBox);
  3728. 2158.  -         show(progress);
  3729. 2159.  -         return true;
  3730. 2160.  -       };
  3731. 2161.  -       function unlockChangeStatus() {
  3732. 2162.  -         var selectorBox   = ge('union_' + unionId + '_status_selector_box');
  3733. 2163.  -         var progress      = ge('union_' + unionId + '_status_progress');
  3734. 2164.  -         hide(progress)
  3735. 2165.  -         show(selectorBox);
  3736. 2166.  -       }
  3737. 2167.  -       function updateStatusInTable(status, status_class, status_type, status_variants) {
  3738. 2168.  -         if (!status && !status_class) return;
  3739. 2169.  -
  3740. 2170.  -         var ret = {
  3741. 2171.  -           value: status_class,
  3742. 2172.  -           extra: {
  3743. 2173.  -             status_text: status,
  3744. 2174.  -             status_variants: status_variants
  3745. 2175.  -           },
  3746. 2176.  -           type: status_type
  3747. 2177.  -         };
  3748. 2178.  -
  3749. 2179.  -         if (status_class == 'deleted') {
  3750. 2180.  -           ret.listeners = false;
  3751. 2181.  -           ret.extra.link_class = '';
  3752. 2182.  -         }
  3753. 2183.  -         callback(ret);
  3754. 2184.  -       }
  3755. 2185.  -
  3756. 2186.  -       function onRequestComplete(response) {
  3757. 2187.  -         unlockChangeStatus();
  3758. 2188.  -
  3759. 2189.  -         if (!isObject(response) || response.error) {
  3760. 2190.  -           debugLog('onFail change status');
  3761. 2191.  -           var errorMessage = (isObject(response) ? response.error : getLang('ads_error_unexpected_error_try_later'));
  3762. 2192.  -           showFastBox(getLang('ads_cant_start_ad_box_title'), errorMessage);
  3763. 2193.  -           return true;
  3764. 2194.  -         }
  3765. 2195.  -
  3766. 2196.  -         var info = '';
  3767. 2197.  -         if (response && response.info) {
  3768. 2198.  -           info = response.info;
  3769. 2199.  -         }
  3770. 2200.  -         debugLog('onDone change status, ' + info);
  3771. 2201.  -
  3772. 2202.  -         updateStatusInTable(response.status, response.status_class, response.status_type, response.status_variants);
  3773. 2203.  -         return true;
  3774. 2204.  -       }
  3775. 2205.  -
  3776. 2206.  -       ajax.post('/ads?act=a_union_change_status', params, {onDone: onRequestComplete, onFail: onRequestComplete});
  3777. 2207.  -     }
  3778. 2208.  -   };
  3779. 2209.  -
  3780. 2210.  -   var sdd;
  3781. 2211.  -   if (!cur._statusDropdown) {
  3782. 2212.  -     var handler = elem.getAttribute('onclick');
  3783. 2213.  -     sdd = cur._statusDropdown = Ads.statusDropdown(elem, options);
  3784. 2214.  -     elem.setAttribute('onclick', handler);
  3785. 2215.  -     elem.onclick = function(){eval(handler);};
  3786. 2216.  -   } else {
  3787. 2217.  -     sdd = cur._statusDropdown;
  3788. 2218.  -     sdd.hideHeader();
  3789. 2219.  -     clearTimeout(sdd.timer);
  3790. 2220.  -     sdd.setContainer(elem);
  3791. 2221.  -     sdd.setStatus(options.status);
  3792. 2222.  -     sdd.setItems(options.items);
  3793. 2223.  -     sdd.setHandler(options.onSelect);
  3794. 2224.  -   }
  3795. 2225.  -
  3796. 2226.  -   sdd.onOver();
  3797. 2227.  - }
  3798. 2228.  -
  3799. 2229.  - Ads.statusDropdown = function(container, options) {
  3800. 2230.  -   container = ge(container);
  3801. 2231.  -   if (!container) return false;
  3802. 2232.  -
  3803. 2233.  -   options = extend({
  3804. 2234.  -     popupTime: 200,   // -1 means 'always show entire body'
  3805. 2235.  -     status: {type: 'off', title: 'Disabled'},
  3806. 2236.  -     onSelect: function() {}
  3807. 2237.  -   }, options);
  3808. 2238.  -
  3809. 2239.  -   var compareTypes = function(type1, type2) {
  3810. 2240.  -     var same = {
  3811. 2241.  -       on: {
  3812. 2242.  -         on: 1,
  3813. 2243.  -         pending: 1
  3814. 2244.  -       },
  3815. 2245.  -       off: {
  3816. 2246.  -         off: 1,
  3817. 2247.  -         off_red: 1,
  3818. 2248.  -         cross: 1
  3819. 2249.  -       },
  3820. 2250.  -       archived: {
  3821. 2251.  -         deleted: 1
  3822. 2252.  -       }
  3823. 2253.  -     };
  3824. 2254.  -     if (!same[type1]) return 0;
  3825. 2255.  -     return same[type1][type2] || 0;
  3826. 2256.  -   }
  3827. 2257.  -
  3828. 2258.  -   var items = clone(options.items);
  3829. 2259.  -   for (var i in items) {
  3830. 2260.  -     if (compareTypes(items[i]['i'], options.status.type)) {
  3831. 2261.  -       delete items[i];
  3832. 2262.  -     }
  3833. 2263.  -   }
  3834. 2264.  -
  3835. 2265.  -   var imgSpanFake = {className: geByClass('ads_status_image_span', container)[0].className};
  3836. 2266.  -   var imgSpanHTML = '<span class="' + imgSpanFake.className + '"></span>';
  3837. 2267.  -
  3838. 2268.  -   var deltaTop = 0, deltaLeft = 0;
  3839. 2269.  -   if (browser.opera) deltaTop += -1;
  3840. 2270.  -   if (browser.mozilla) deltaTop += -1;
  3841. 2271.  -   if (browser.msie) { deltaTop += -1; deltaLeft += 1; }
  3842. 2272.  -
  3843. 2273.  -   var dd = new DropdownMenu(items, {
  3844. 2274.  -     title: imgSpanHTML + options.status.title,
  3845. 2275.  -     target: container,
  3846. 2276.  -     onSelect: options.onSelect,
  3847. 2277.  -     showHover: false,
  3848. 2278.  -     updateTarget: false,
  3849. 2279.  -     offsetTop: -2 + deltaTop,
  3850. 2280.  -     offsetLeft: -1 + deltaLeft
  3851. 2281.  -   });
  3852. 2282.  -   dd.hide();
  3853. 2283.  -   addClass(dd.header, 'ads_dd_wide');
  3854. 2284.  -   addClass(dd.body, 'ads_dd_wide');
  3855. 2285.  -
  3856. 2286.  -   var showTimer, hideTimer;
  3857. 2287.  -   var overListener = function() {
  3858. 2288.  -     if (hideTimer) {
  3859. 2289.  -       clearTimeout(hideTimer);
  3860. 2290.  -       hideTimer = false;
  3861. 2291.  -     }
  3862. 2292.  -     if (options.popupTime == -1) {
  3863. 2293.  -       dd.show();
  3864. 2294.  -       return true;
  3865. 2295.  -     }
  3866. 2296.  -     showTimer = setTimeout(function() {
  3867. 2297.  -       showTimer = false;
  3868. 2298.  -       ret.showHeader();
  3869. 2299.  -     }, options.popupTime);
  3870. 2300.  -   };
  3871. 2301.  -   var outListenerSoft = function() {
  3872. 2302.  -     if (showTimer) {
  3873. 2303.  -       clearTimeout(showTimer);
  3874. 2304.  -       showTimer = false;
  3875. 2305.  -     } else {
  3876. 2306.  -       hideTimer = setTimeout(function() {
  3877. 2307.  -         hideTimer = false;
  3878. 2308.  -         ret.hideHeader();
  3879. 2309.  -       }, 500);
  3880. 2310.  -     }
  3881. 2311.  -   };
  3882. 2312.  -   var outListenerHard = function() {
  3883. 2313.  -     hideTimer = setTimeout(function() {
  3884. 2314.  -       hideTimer = false;
  3885. 2315.  -       ret.hideHeader();
  3886. 2316.  -     }, 500);
  3887. 2317.  -   };
  3888. 2318.  -
  3889. 2319.  -   if (options.popupTime != -1) {
  3890. 2320.  -     addEvent(dd.header, 'click', function() {removeClass(dd.header, 'ads_dd_header_popup');});
  3891. 2321.  -     addEvent(container, 'click', function() {ret.showBody();});
  3892. 2322.  -
  3893. 2323.  -     addEvent(container, 'mouseover', overListener);
  3894. 2324.  -     addEvent(container, 'mouseout', outListenerSoft);
  3895. 2325.  -     addEvent(dd.header, 'mouseover', overListener);
  3896. 2326.  -     addEvent(dd.header, 'mouseout', outListenerHard);
  3897. 2327.  -     addEvent(dd.body, 'mouseover', overListener);
  3898. 2328.  -     addEvent(dd.body, 'mouseout', outListenerHard);
  3899. 2329.  -   }
  3900. 2330.  -
  3901. 2331.  -   var clearTimers = function() {
  3902. 2332.  -     if (showTimer) {
  3903. 2333.  -       clearTimeout(showTimer);
  3904. 2334.  -       showTimer = false;
  3905. 2335.  -     }
  3906. 2336.  -     if (hideTimer) {
  3907. 2337.  -       clearTimeout(hideTimer);
  3908. 2338.  -       hideTimer = false;
  3909. 2339.  -     }
  3910. 2340.  -   }
  3911. 2341.  -
  3912. 2342.  -   var ret = {
  3913. 2343.  -     getStatus: function() {
  3914. 2344.  -       return options.status;
  3915. 2345.  -     },
  3916. 2346.  -     setStatus: function(status) {
  3917. 2347.  -       removeClass(imgSpanFake, 'status_' + options.status.type);
  3918. 2348.  -       options.status = status;
  3919. 2349.  -       addClass(imgSpanFake, 'status_' + options.status.type);
  3920. 2350.  -       dd.setOptions({title: '<span class="' + imgSpanFake.className + '"></span>' + options.status.title});
  3921. 2351.  -     },
  3922. 2352.  -     setContainer: function(newContainer) {
  3923. 2353.  -       if (!newContainer) return false;
  3924. 2354.  -       clearTimers();
  3925. 2355.  -       if (options.popupTime != -1) {
  3926. 2356.  -         removeEvent(container, 'mouseover', overListener);
  3927. 2357.  -         removeEvent(container, 'mouseout', outListenerSoft);
  3928. 2358.  -         removeEvent(dd.header, 'mouseover', overListener);
  3929. 2359.  -         removeEvent(dd.header, 'mouseout', outListenerHard);
  3930. 2360.  -         removeEvent(dd.body, 'mouseover', overListener);
  3931. 2361.  -         removeEvent(dd.body, 'mouseout', outListenerHard);
  3932. 2362.  -       }
  3933. 2363.  -       container = newContainer;
  3934. 2364.  -       dd.setOptions({target: container});
  3935. 2365.  -       dd.moveToTarget();
  3936. 2366.  -       if (options.popupTime != -1) {
  3937. 2367.  -         addEvent(container, 'mouseover', overListener);
  3938. 2368.  -         addEvent(container, 'mouseout', outListenerSoft);
  3939. 2369.  -         addEvent(dd.header, 'mouseover', overListener);
  3940. 2370.  -         addEvent(dd.header, 'mouseout', outListenerHard);
  3941. 2371.  -         addEvent(dd.body, 'mouseover', overListener);
  3942. 2372.  -         addEvent(dd.body, 'mouseout', outListenerHard);
  3943. 2373.  -       }
  3944. 2374.  -     },
  3945. 2375.  -     setItems: function(newItems) {
  3946. 2376.  -       var items = clone(newItems);
  3947. 2377.  -       for (var i in items) {
  3948. 2378.  -         if (compareTypes(items[i]['i'], options.status.type)) {
  3949. 2379.  -           delete items[i];
  3950. 2380.  -         }
  3951. 2381.  -       }
  3952. 2382.  -       dd.setData(items);
  3953. 2383.  -     },
  3954. 2384.  -     setHandler: function(handler) {
  3955. 2385.  -       dd.setOptions({onSelect: handler});
  3956. 2386.  -     },
  3957. 2387.  -     showHeader: function() {
  3958. 2388.  -       if (!dd.visible) {
  3959. 2389.  -         addClass(dd.header, 'ads_dd_header_popup');
  3960. 2390.  -       }
  3961. 2391.  -       dd.moveToTarget();
  3962. 2392.  -       show(dd.header);
  3963. 2393.  -     },
  3964. 2394.  -     hideHeader: function() {
  3965. 2395.  -       dd.hide();
  3966. 2396.  -       hide(dd.header);
  3967. 2397.  -       removeClass(dd.header, 'ads_dd_header_popup');
  3968. 2398.  -     },
  3969. 2399.  -     showBody: function() {
  3970. 2400.  -       removeClass(dd.header, 'ads_dd_header_popup');
  3971. 2401.  -       dd.show();
  3972. 2402.  -     },
  3973. 2403.  -     hideBody: function() {
  3974. 2404.  -       dd.hide();
  3975. 2405.  -     },
  3976. 2406.  -     onOver: overListener,
  3977. 2407.  -     onOut: outListenerHard
  3978. 2408.  -   };
  3979. 2409.  -
  3980. 2410.  -   return ret;
  3981. 2411.  - }
  3982. 2412.  -
  3983. 2413.  - Ads.changeDemographyView = function(name, unionId, updateOnly) {
  3984. 2414.  -
  3985. 2415.  -   // Change navigation
  3986. 2416.  -   var navCur = ge('ads_demography_navigation_tab_' + name);
  3987. 2417.  -   if (!navCur) {
  3988. 2418.  -     return;
  3989. 2419.  -   }
  3990. 2420.  -   navCur = navCur.parentNode;
  3991. 2421.  -   var navCurSelected = hasClass(navCur, 'summary_tab_sel');
  3992. 2422.  -   if (navCurSelected && !updateOnly || !navCurSelected && updateOnly) {
  3993. 2423.  -     return;
  3994. 2424.  -   }
  3995. 2425.  -   var navElems = [
  3996. 2426.  -     ge('ads_demography_navigation_tab_bars_all').parentNode,
  3997. 2427.  -     ge('ads_demography_navigation_tab_graphs').parentNode
  3998. 2428.  -   ];
  3999. 2429.  -   for (var i in navElems) {
  4000. 2430.  -     var navElem = navElems[i];
  4001. 2431.  -     addClass(navElem, 'summary_tab');
  4002. 2432.  -     removeClass(navElem, 'summary_tab_sel');
  4003. 2433.  -   }
  4004. 2434.  -   addClass(navCur, 'summary_tab_sel');
  4005. 2435.  -   removeClass(navCur, 'summary_tab');
  4006. 2436.  -
  4007. 2437.  -   // Change graph
  4008. 2438.  -   var bars1   = ge('ads_demography_bars_all_wrap1');
  4009. 2439.  -   var bars2   = ge('ads_demography_bars_all_wrap2');
  4010. 2440.  -   var graphs1 = ge('ads_demography_graphs_wrap1');
  4011. 2441.  -   var graphs2 = ge('ads_demography_graphs_wrap2');
  4012. 2442.  -
  4013. 2443.  -   if (name === 'bars_all') {
  4014. 2444.  -     setStyle(bars1,   {visibility: 'visible', height: getSize(bars2)[1] + 'px'})
  4015. 2445.  -     setStyle(bars2,   {top: '0'})
  4016. 2446.  -     setStyle(graphs1, {visibility: 'hidden', height: '0'});
  4017. 2447.  -   } else if (name === 'graphs') {
  4018. 2448.  -     if (!Ads.loadDemography(unionId)) {
  4019. 2449.  -       return;
  4020. 2450.  -     }
  4021. 2451.  -
  4022. 2452.  -     !cur.graphUsersStatsSexEmpty && cur.pageGraphs['ads_graph_users_stats_day_sex'].loadGraph(intval(cur.lastDemographySourceOffset));
  4023. 2453.  -     !cur.graphUsersStatsAgeEmpty && cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset));
  4024. 2454.  -     !cur.graphUsersStatsCitiesEmpty && cur.pageGraphs['ads_graph_users_stats_day_cities'].loadGraph(intval(cur.lastDemographySourceOffset));
  4025. 2455.  -
  4026. 2456.  -     setStyle(graphs2, {width: getSize(graphs1)[0] + 'px'});
  4027. 2457.  -     setStyle(graphs1, {visibility: 'visible', height: getSize(graphs2)[1] + 'px'});
  4028. 2458.  -     setStyle(bars1,   {visibility: 'hidden', height: '0'});
  4029. 2459.  -     setStyle(bars2,   {position: 'absolute', top: '-100000px'});
  4030. 2460.  -   }
  4031. 2461.  - }
  4032. 2462.  -
  4033. 2463.  - Ads.changeDemographySource = function(name) {
  4034. 2464.  -
  4035. 2465.  -   // Change navigation
  4036. 2466.  -   var clicksSideNav = ge('ads_demography_navigation_clicks');
  4037. 2467.  -   var viewsSideNav  = ge('ads_demography_navigation_views');
  4038. 2468.  -   var clicksTabNav = ge('ads_demography_navigation_tab_clicks');
  4039. 2469.  -   var viewsTabNav  = ge('ads_demography_navigation_tab_views');
  4040. 2470.  -   if (clicksTabNav) {
  4041. 2471.  -     clicksTabNav = clicksTabNav.parentNode;
  4042. 2472.  -     viewsTabNav  = viewsTabNav.parentNode;
  4043. 2473.  -   }
  4044. 2474.  -   if (name == 'clicks') {
  4045. 2475.  -     if (clicksSideNav) {
  4046. 2476.  -       if (hasClass(clicksSideNav, 'nav_selected')) {
  4047. 2477.  -         return;
  4048. 2478.  -       }
  4049. 2479.  -       addClass(clicksSideNav, 'nav_selected');
  4050. 2480.  -       removeClass(viewsSideNav, 'nav_selected');
  4051. 2481.  -     }
  4052. 2482.  -     if (clicksTabNav) {
  4053. 2483.  -       if (hasClass(clicksTabNav, 'summary_tab_sel')) {
  4054. 2484.  -         return;
  4055. 2485.  -       }
  4056. 2486.  -       addClass(clicksTabNav, 'summary_tab_sel');
  4057. 2487.  -       addClass(viewsTabNav, 'summary_tab');
  4058. 2488.  -       removeClass(clicksTabNav, 'summary_tab');
  4059. 2489.  -       removeClass(viewsTabNav, 'summary_tab_sel');
  4060. 2490.  -     }
  4061. 2491.  -   } else {
  4062. 2492.  -     if (clicksSideNav) {
  4063. 2493.  -       if (hasClass(viewsSideNav, 'nav_selected')) {
  4064. 2494.  -         return;
  4065. 2495.  -       }
  4066. 2496.  -       addClass(viewsSideNav, 'nav_selected');
  4067. 2497.  -       removeClass(clicksSideNav, 'nav_selected');
  4068. 2498.  -     }
  4069. 2499.  -     if (clicksTabNav) {
  4070. 2500.  -       if (hasClass(viewsTabNav, 'summary_tab_sel')) {
  4071. 2501.  -         return;
  4072. 2502.  -       }
  4073. 2503.  -       addClass(viewsTabNav, 'summary_tab_sel');
  4074. 2504.  -       addClass(clicksTabNav, 'summary_tab');
  4075. 2505.  -       removeClass(viewsTabNav, 'summary_tab');
  4076. 2506.  -       removeClass(clicksTabNav, 'summary_tab_sel');
  4077. 2507.  -     }
  4078. 2508.  -   }
  4079. 2509.  -
  4080. 2510.  -   // Change graph
  4081. 2511.  -   if (name == 'clicks') {
  4082. 2512.  -     cur.lastDemographySourceOffset = 0;
  4083. 2513.  -     if (cur.isDemographySvg) {
  4084. 2514.  -       each(geByClass('ads_demography_bars_clicks'), function(i, el) { el.style.visibility = 'visible'; el.style.position = 'relative'; });
  4085. 2515.  -       each(geByClass('ads_demography_bars_views'),  function(i, el) { el.style.visibility = 'hidden';  el.style.position = 'absolute'; });
  4086. 2516.  -     } else {
  4087. 2517.  -       each(geByClass('ads_demography_bars_clicks'), show);
  4088. 2518.  -       each(geByClass('ads_demography_bars_views'),  hide);
  4089. 2519.  -     }
  4090. 2520.  -     try { cur.pageGraphs['ads_graph_users_stats_day_sex'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  4091. 2521.  -     try { cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset)); } catch(e) {}
  4092. 2522.  -     try { cur.pageGraphs['ads_graph_users_stats_day_cities'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  4093. 2523.  -   } else {
  4094. 2524.  -     cur.lastDemographySourceOffset = 1;
  4095. 2525.  -     if (cur.isDemographySvg) {
  4096. 2526.  -       each(geByClass('ads_demography_bars_views'),  function(i, el) { el.style.visibility = 'visible'; el.style.position = 'relative'; });
  4097. 2527.  -       each(geByClass('ads_demography_bars_clicks'), function(i, el) { el.style.visibility = 'hidden';  el.style.position = 'absolute'; });
  4098. 2528.  -     } else {
  4099. 2529.  -       each(geByClass('ads_demography_bars_views'),  show);
  4100. 2530.  -       each(geByClass('ads_demography_bars_clicks'), hide);
  4101. 2531.  -     }
  4102. 2532.  -     try { cur.pageGraphs['ads_graph_users_stats_day_sex'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  4103. 2533.  -     try { cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset)); } catch(e) {}
  4104. 2534.  -     try { cur.pageGraphs['ads_graph_users_stats_day_cities'].loadGraph(intval(cur.lastDemographySourceOffset)); } catch(e) {}
  4105. 2535.  -   }
  4106. 2536.  - }
  4107. 2537.  -
  4108. 2538.  - Ads.changeDemographyAge = function(name) {
  4109. 2539.  -   // Change navigation
  4110. 2540.  -   var allNav    = ge('ads_demography_navigation_tab_age_all').parentNode;
  4111. 2541.  -   var femaleNav = ge('ads_demography_navigation_tab_age_female').parentNode;
  4112. 2542.  -   var maleNav   = ge('ads_demography_navigation_tab_age_male').parentNode;
  4113. 2543.  -   switch (name) {
  4114. 2544.  -     case 'all':
  4115. 2545.  -       if (hasClass(allNav, 'summary_tab_sel')) {
  4116. 2546.  -         return;
  4117. 2547.  -       }
  4118. 2548.  -       addClass(allNav,       'summary_tab_sel');
  4119. 2549.  -       addClass(femaleNav,    'summary_tab');
  4120. 2550.  -       addClass(maleNav,      'summary_tab');
  4121. 2551.  -       removeClass(allNav,    'summary_tab');
  4122. 2552.  -       removeClass(femaleNav, 'summary_tab_sel');
  4123. 2553.  -       removeClass(maleNav,   'summary_tab_sel');
  4124. 2554.  -       break;
  4125. 2555.  -     case 'female':
  4126. 2556.  -       if (hasClass(femaleNav, 'summary_tab_sel')) {
  4127. 2557.  -         return;
  4128. 2558.  -       }
  4129. 2559.  -       addClass(femaleNav,    'summary_tab_sel');
  4130. 2560.  -       addClass(allNav,       'summary_tab');
  4131. 2561.  -       addClass(maleNav,      'summary_tab');
  4132. 2562.  -       removeClass(femaleNav, 'summary_tab');
  4133. 2563.  -       removeClass(allNav,    'summary_tab_sel');
  4134. 2564.  -       removeClass(maleNav,   'summary_tab_sel');
  4135. 2565.  -       break;
  4136. 2566.  -     case 'male':
  4137. 2567.  -       if (hasClass(maleNav, 'summary_tab_sel')) {
  4138. 2568.  -         return;
  4139. 2569.  -       }
  4140. 2570.  -       addClass(maleNav,      'summary_tab_sel');
  4141. 2571.  -       addClass(allNav,       'summary_tab');
  4142. 2572.  -       addClass(femaleNav,    'summary_tab');
  4143. 2573.  -       removeClass(maleNav,   'summary_tab');
  4144. 2574.  -       removeClass(allNav,    'summary_tab_sel');
  4145. 2575.  -       removeClass(femaleNav, 'summary_tab_sel');
  4146. 2576.  -       break;
  4147. 2577.  -     default:
  4148. 2578.  -       return;
  4149. 2579.  -   }
  4150. 2580.  -
  4151. 2581.  -   // Change graph
  4152. 2582.  -   switch (name) {
  4153. 2583.  -     case 'all':    cur.lastDemographyAgeOffset = 0; break;
  4154. 2584.  -     case 'female': cur.lastDemographyAgeOffset = 1; break;
  4155. 2585.  -     case 'male':   cur.lastDemographyAgeOffset = 2; break;
  4156. 2586.  -     default:       return;
  4157. 2587.  -   }
  4158. 2588.  -   try { cur.pageGraphs['ads_graph_users_stats_day_age'].loadGraph(intval(cur.lastDemographySourceOffset) * 3 + intval(cur.lastDemographyAgeOffset)); } catch(e) {}
  4159. 2589.  - }
  4160. 2590.  -
  4161. 2591.  - Ads.loadDemography = function(unionId) {
  4162. 2592.  -   if (!cur.demographyDelayed) {
  4163. 2593.  -     return true;
  4164. 2594.  -   }
  4165. 2595.  -   if (!Ads.lock('load_demography', lock, unlock)) {
  4166. 2596.  -     return false;
  4167. 2597.  -   }
  4168. 2598.  -
  4169. 2599.  -   var ajaxParams = {};
  4170. 2600.  -   ajaxParams.union_id = unionId;
  4171. 2601.  -
  4172. 2602.  -   ajax.post('/ads?act=a_users_stats', ajaxParams, {onDone: onComplete, onFail: onComplete});
  4173. 2603.  -
  4174. 2604.  -   function lock() {
  4175. 2605.  -     setStyle('ads_demography_navigation_tab_progress', {visibility: 'visible'});
  4176. 2606.  -   }
  4177. 2607.  -   function unlock() {
  4178. 2608.  -     setStyle('ads_demography_navigation_tab_progress', {visibility: 'hidden'});
  4179. 2609.  -   }
  4180. 2610.  -   function onComplete(response) {
  4181. 2611.  -     Ads.unlock('load_demography');
  4182. 2612.  -     if (response && response.graphs_html && response.graphs_js) {
  4183. 2613.  -       cur.demographyDelayed = false;
  4184. 2614.  -       ge('ads_demography_graphs_wrap2').innerHTML = response.graphs_html;
  4185. 2615.  -       eval(response.graphs_js);
  4186. 2616.  -       Ads.changeDemographyView('graphs', unionId, true);
  4187. 2617.  -     }
  4188. 2618.  -     return true;
  4189. 2619.  -   }
  4190. 2620.  -
  4191. 2621.  -   return false;
  4192. 2622.  - }
  4193. 2623.  -
  4194. 2624.  - Ads.showEditAdminBox = function(event, unionId, userId, userEmail, isRemove) {
  4195. 2625.  -   if (event && (event.which > 1 || event.button > 1 || event.ctrlKey)) {
  4196. 2626.  -     return;
  4197. 2627.  -   }
  4198. 2628.  -
  4199. 2629.  -   userId = intval(userId);
  4200. 2630.  -
  4201. 2631.  -   if (!userId && !userEmail) {
  4202. 2632.  -     var userLink = ge('ads_user_link').getValue();
  4203. 2633.  -     if (!userLink) {
  4204. 2634.  -       showFastBox(getLang('ads_error_box_title'), getLang('ads_edit_admin_no_user_link'));
  4205. 2635.  -       return;
  4206. 2636.  -     }
  4207. 2637.  -   }
  4208. 2638.  -
  4209. 2639.  -   if (isRemove) {
  4210. 2640.  -     cur.editAdminBoxTitle = getLang('ads_edit_admin_box_title_remove');
  4211. 2641.  -   } else {
  4212. 2642.  -     if (userId || userEmail) {
  4213. 2643.  -       cur.editAdminBoxTitle = getLang('ads_edit_admin_box_title_edit');
  4214. 2644.  -     } else {
  4215. 2645.  -       cur.editAdminBoxTitle = getLang('ads_edit_admin_box_title_add');
  4216. 2646.  -     }
  4217. 2647.  -   }
  4218. 2648.  -
  4219. 2649.  -   var ajaxParams = {};
  4220. 2650.  -   ajaxParams.union_id = unionId;
  4221. 2651.  -   if (isRemove) {
  4222. 2652.  -     ajaxParams.action = 'remove';
  4223. 2653.  -   } else {
  4224. 2654.  -     ajaxParams.action = 'edit';
  4225. 2655.  -   }
  4226. 2656.  -   if (userId) {
  4227. 2657.  -     ajaxParams.user_link = userId;
  4228. 2658.  -   } else if (userEmail) {
  4229. 2659.  -     ajaxParams.user_link = userEmail;
  4230. 2660.  -   } else {
  4231. 2661.  -     ajaxParams.user_link = userLink;
  4232. 2662.  -   }
  4233. 2663.  -
  4234. 2664.  -   var showOptions = {params: {}};
  4235. 2665.  -   showOptions.onFail = Ads.onBoxFail;
  4236. 2666.  -   showOptions.params.width = 440;
  4237. 2667.  -
  4238. 2668.  -   showBox('/ads?act=a_edit_admin_box', ajaxParams, showOptions);
  4239. 2669.  -
  4240. 2670.  -   return false;
  4241. 2671.  - }
  4242. 2672.  -
  4243. 2673.  - Ads.showRetargetingGroupBox = function(unionId, groupId) {
  4244. 2674.  -   groupId = intval(groupId);
  4245. 2675.  -
  4246. 2676.  -   var ajaxParams = {};
  4247. 2677.  -   ajaxParams.union_id = unionId;
  4248. 2678.  -   if (groupId) {
  4249. 2679.  -     ajaxParams.group_id = groupId;
  4250. 2680.  -   }
  4251. 2681.  -
  4252. 2682.  -   var showOptions = {params: {}};
  4253. 2683.  -   showOptions.onFail = Ads.onBoxFail;
  4254. 2684.  -   showOptions.params.width = 400;
  4255. 2685.  -
  4256. 2686.  -   showBox('/ads?act=a_retargeting_group_box', ajaxParams, showOptions);
  4257. 2687.  -
  4258. 2688.  -   return false;
  4259. 2689.  - }
  4260. 2690.  -
  4261. 2691.  - Ads.showRetargetingGroupPixel = function(unionId, groupId, hash) {
  4262. 2692.  -   groupId = intval(groupId);
  4263. 2693.  -
  4264. 2694.  -   var ajaxParams = {};
  4265. 2695.  -   ajaxParams.union_id = unionId;
  4266. 2696.  -   ajaxParams.group_id = groupId;
  4267. 2697.  -   ajaxParams.hash = hash;
  4268. 2698.  -
  4269. 2699.  -   var showOptions = {params: {}};
  4270. 2700.  -   showOptions.onFail = Ads.onBoxFail;
  4271. 2701.  -   showOptions.params.width = 400;
  4272. 2702.  -
  4273. 2703.  -   showBox('/ads?act=a_get_retargeting_pixel', ajaxParams, showOptions);
  4274. 2704.  -
  4275. 2705.  -   return false;
  4276. 2706.  - }
  4277. 2707.  -
  4278. 2708.  - Ads.deleteRetargetingGroup = function(unionId, groupId, hash) {
  4279. 2709.  -   groupId = intval(groupId);
  4280. 2710.  -
  4281. 2711.  -   curBox().hide();
  4282. 2712.  -   showFastBox(getLang('ads_retargeting_del_confirm_title'), getLang('ads_retargeting_del_confirm_message'), getLang('box_yes'), function() {
  4283. 2713.  -     ajax.post('/ads', {act: 'a_del_retargeting_group', union_id: unionId, group_id: groupId, hash: hash}, {
  4284. 2714.  -       onDone: function(html) {
  4285. 2715.  -         ge('ads_retargeting_groups_table').innerHTML = html;
  4286. 2716.  -         curBox().hide();
  4287. 2717.  -       }
  4288. 2718.  -     });
  4289. 2719.  -   }, getLang('box_no'));
  4290. 2720.  -
  4291. 2721.  -   return false;
  4292. 2722.  - }
  4293. 2723.  -
  4294. 2724.  - Ads.initContacts = function(selectData, ajaxParams, isBig) {
  4295. 2725.  -
  4296. 2726.  -   if (cur.contacts && cur.contacts.destroy) {
  4297. 2727.  -     cur.contacts.destroy();
  4298. 2728.  -   }
  4299. 2729.  -
  4300. 2730.  -   var destroy = [];
  4301. 2731.  -
  4302. 2732.  -   cur.contacts = {};
  4303. 2733.  -   cur.contacts.ajaxParams = ajaxParams;
  4304. 2734.  -
  4305. 2735.  -   cur.contacts.destroy = function() {
  4306. 2736.  -     for (var i in destroy) {
  4307. 2737.  -       destroy[i]();
  4308. 2738.  -     }
  4309. 2739.  -     destroy = [];
  4310. 2740.  -   }
  4311. 2741.  -   cur.destroy.push(function() { cur.contacts.destroy(); });
  4312. 2742.  -
  4313. 2743.  -   var uiWidth = 250 + (isBig ? 22 : 0);
  4314. 2744.  -
  4315. 2745.  -   var uiCountry = null;
  4316. 2746.  -   var uiCity = null;
  4317. 2747.  -
  4318. 2748.  -   uiCountry = new Dropdown(ge('country'), selectData.countries, {
  4319. 2749.  -     selectedItem: [selectData.country_val],
  4320. 2750.  -
  4321. 2751.  -     big: isBig,
  4322. 2752.  -     width: uiWidth,
  4323. 2753.  -     multiselect: false,
  4324. 2754.  -
  4325. 2755.  -     onChange: function(value) {
  4326. 2756.  -       if (value == 1) {
  4327. 2757.  -         hide('ads_contacts_form_nonresident', 'cis_msg');
  4328. 2758.  -         show('ads_contacts_form_rus');
  4329. 2759.  -       } else if (value > 1) {
  4330. 2760.  -         hide('ads_contacts_form_rus');
  4331. 2761.  -         show('ads_contacts_form_nonresident');
  4332. 2762.  -         if (value < 4) show('cis_msg');
  4333. 2763.  -         else hide('cis_msg');
  4334. 2764.  -       }
  4335. 2765.  -       if (value == -1) {
  4336. 2766.  -         getAllCountries();
  4337. 2767.  -         return;
  4338. 2768.  -       } else if (value > 3) {
  4339. 2769.  -         hide('city_row');
  4340. 2770.  -         return;
  4341. 2771.  -       }
  4342. 2772.  -       uiCity.clear();
  4343. 2773.  -       uiCity.setURL('/select_ajax.php?act=a_get_cities&country=' + value);
  4344. 2774.  -       selectsData.getCountryInfo(value, 1, function(response) {
  4345. 2775.  -         var new_options = {
  4346. 2776.  -           defaultItems: response.cities,
  4347. 2777.  -           dropdown: true
  4348. 2778.  -         };
  4349. 2779.  -         uiCity.setOptions(new_options);
  4350. 2780.  -         if (selectData.country == value) {
  4351. 2781.  -           uiCity.selectItem(selectData.city_val);
  4352. 2782.  -         }
  4353. 2783.  -       });
  4354. 2784.  -       show(ge('city_row'));
  4355. 2785.  -     }
  4356. 2786.  -   });
  4357. 2787.  -   destroy.push(function(){ uiCountry.destroy(); });
  4358. 2788.  -
  4359. 2789.  -   uiCity = new Selector(ge('city'), '/select_ajax.php?act=a_get_cities&country='+selectData.country, {
  4360. 2790.  -     defaultItems: selectData.cities,
  4361. 2791.  -     selectedItems: [selectData.city_val],
  4362. 2792.  -
  4363. 2793.  -     big: isBig,
  4364. 2794.  -     width: uiWidth,
  4365. 2795.  -     multiselect: false,
  4366. 2796.  -     dropdown: true,
  4367. 2797.  -
  4368. 2798.  -     placeholder: getLang('select_city_not_selected'),
  4369. 2799.  -     introText: getLang('select_city_select'),
  4370. 2800.  -     noResult: getLang('select_city_not_found'),
  4371. 2801.  -     otherCity: getLang('select_city_other_city')
  4372. 2802.  -   });
  4373. 2803.  -   destroy.push(function(){ uiCity.destroy(); });
  4374. 2804.  -
  4375. 2805.  -   var uiAgency = new Checkbox(ge('agency'), {
  4376. 2806.  -     checked: 1,
  4377. 2807.  -     width: uiWidth,
  4378. 2808.  -     label: getLang('ads_help_contacts_agency'),
  4379. 2809.  -
  4380. 2810.  -     onChange: function(state) {
  4381. 2811.  -       if (state == 1) {
  4382. 2812.  -         slideDown(ge("agency_fields"), 200);
  4383. 2813.  -       } else {
  4384. 2814.  -         if (isVisible('agency_fields')) {
  4385. 2815.  -           slideUp(ge("agency_fields"), 200);
  4386. 2816.  -         }
  4387. 2817.  -       }
  4388. 2818.  -     }
  4389. 2819.  -   });
  4390. 2820.  -   destroy.push(function(){ uiAgency.destroy(); });
  4391. 2821.  -
  4392. 2822.  -   var uiDating = new Checkbox(ge('dating'), {
  4393. 2823.  -     checked: 0,
  4394. 2824.  -     width: uiWidth,
  4395. 2825.  -     label: getLang('ads_help_contacts_dating')
  4396. 2826.  -   });
  4397. 2827.  -   destroy.push(function(){ uiDating.destroy(); });
  4398. 2828.  -
  4399. 2829.  -   var uiMedicine = new Checkbox(ge('medicine'), {
  4400. 2830.  -     checked: 0,
  4401. 2831.  -     width: uiWidth,
  4402. 2832.  -     label: getLang('ads_help_contacts_medicine')
  4403. 2833.  -   });
  4404. 2834.  -   destroy.push(function(){ uiMedicine.destroy(); });
  4405. 2835.  -
  4406. 2836.  -   var uiBudget = new Dropdown(ge('budget'), selectData.budget, {
  4407. 2837.  -     selectedItems: '0',
  4408. 2838.  -     big: isBig,
  4409. 2839.  -     width: uiWidth,
  4410. 2840.  -     zeroPlaceholder: true,
  4411. 2841.  -     multiselect: false
  4412. 2842.  -   });
  4413. 2843.  -   destroy.push(function(){ uiBudget.destroy(); });
  4414. 2844.  -
  4415. 2845.  -   var uiBudgetNr = new Dropdown(ge('budget_nr'), selectData.budget, {
  4416. 2846.  -     selectedItems: '0',
  4417. 2847.  -     big: isBig,
  4418. 2848.  -     width: uiWidth,
  4419. 2849.  -     zeroPlaceholder: true,
  4420. 2850.  -     multiselect: false
  4421. 2851.  -   });
  4422. 2852.  -   destroy.push(function(){ uiBudgetNr.destroy(); });
  4423. 2853.  -
  4424. 2854.  -   if (selectData.offices) {
  4425. 2855.  -     var uiOffice = new Dropdown(ge('office'), selectData.offices, {
  4426. 2856.  -       selectedItems: selectData.office,
  4427. 2857.  -       big: isBig,
  4428. 2858.  -       width: uiWidth,
  4429. 2859.  -       multiselect: false
  4430. 2860.  -     });
  4431. 2861.  -     destroy.push(function(){ uiOffice.destroy(); });
  4432. 2862.  -   }
  4433. 2863.  -
  4434. 2864.  -   function getAllCountries() {
  4435. 2865.  -     function onDone(response) {
  4436. 2866.  -       if (response && isArray(response.countries)) {
  4437. 2867.  -         response.countries.splice(0, 1);
  4438. 2868.  -         uiCountry.setData(response.countries);
  4439. 2869.  -         uiCountry.val('');
  4440. 2870.  -         uiCity.clear();
  4441. 2871.  -         uiCity.setOptions({defaultItems: []});
  4442. 2872.  -       }
  4443. 2873.  -     }
  4444. 2874.  -     ajax.post('/ads?act=a_get_countries', {}, {onDone: onDone});
  4445. 2875.  -   }
  4446. 2876.  - }
  4447. 2877.  -
  4448. 2878.  - Ads.sendContactsForm = function(button) {
  4449. 2879.  -   if (!Ads.lock('sendContactsForm', onLock, onUnlock)) {
  4450. 2880.  -     return false;
  4451. 2881.  -   }
  4452. 2882.  -
  4453. 2883.  -   var ajaxParams = extend({}, cur.contacts.ajaxParams);
  4454. 2884.  -   ajaxParams.country  = ge('country').value;
  4455. 2885.  -   ajaxParams.city     = ge('city').value;
  4456. 2886.  -   ajaxParams.agency   = ge('agency').value;
  4457. 2887.  -   ajaxParams.dating   = ge('dating').value;
  4458. 2888.  -   ajaxParams.medicine = ge('medicine').value;
  4459. 2889.  -   ajaxParams = extend(ajaxParams, serializeForm(ge(ajaxParams.country == 1 ? 'ads_contacts_form_rus' : 'ads_contacts_form_nonresident')));
  4460. 2890.  -
  4461. 2891.  -   ajax.post('/ads?act=a_send_contacts', ajaxParams, {onDone: onDone, onFail: onDone});
  4462. 2892.  -
  4463. 2893.  -   function onDone(response) {
  4464. 2894.  -     Ads.unlock('sendContactsForm');
  4465. 2895.  -     if (!response || !response.result) {
  4466. 2896.  -       if (!response || !response.msg) {
  4467. 2897.  -         tryErrorBox(getLang('ads_error_unexpected_error_try_later'));
  4468. 2898.  -       } else {
  4469. 2899.  -         tryErrorBox(response.msg);
  4470. 2900.  -       }
  4471. 2901.  -       return true;
  4472. 2902.  -     }
  4473. 2903.  -     ge('ads_contacts_form').innerHTML = response.msg;
  4474. 2904.  -   }
  4475. 2905.  -   function tryErrorBox(message) {
  4476. 2906.  -     showFastBox(getLang('global_error'), message);
  4477. 2907.  -   }
  4478. 2908.  -   function onLock() {
  4479. 2909.  -     lockButton(button);
  4480. 2910.  -   }
  4481. 2911.  -   function onUnlock() {
  4482. 2912.  -     unlockButton(button);
  4483. 2913.  -   }
  4484. 2914.  - }
  4485. 2915.  -
  4486. 2916.  - try{stManager.done('ads.js');}catch(e){}
  4487. ------
Advertisement
Add Comment
Please, Sign In to add comment