PageRenderTime 44ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/bitrix/modules/main/jscore.php

https://bitbucket.org/alex_poluektov/itech_test
PHP | 426 lines | 416 code | 6 blank | 4 comment | 2 complexity | 11be0943c99f32905bd1b7b6d863aafb MD5 | raw file
Possible License(s): Apache-2.0
  1. <?
  2. $pathJS = '/bitrix/js/main/core';
  3. $pathCSS = '/bitrix/js/main/core/css';
  4. $pathCSSPanel = '/bitrix/panel/main';
  5. $pathLang = BX_ROOT.'/modules/main/lang/'.LANGUAGE_ID;
  6. //WARNING: Don't use CUserOptions here! CJSCore::Init can be called from php_interface/init.php where no $USER exists
  7. $amChartsPath = '/bitrix/js/main/amcharts/3.21/';
  8. $arJSCoreConfig = array(
  9. 'ajax' => array(
  10. 'js' => $pathJS.'/core_ajax.js',
  11. ),
  12. 'admin' => array(
  13. 'js' => $pathJS.'/core_admin.js',
  14. 'css' => array($pathCSS.'/core_panel.css', $pathCSSPanel.'/admin-public.css'),
  15. 'lang' => $pathLang.'/js_core_admin.php',
  16. 'rel' => array('ajax'),
  17. 'use' => CJSCore::USE_PUBLIC,
  18. ),
  19. 'admin_interface' => array(
  20. 'js' => $pathJS.'/core_admin_interface.js',
  21. 'lang' => $pathLang.'/js_core_admin_interface.php',
  22. 'css' => $pathCSSPanel.'/admin-public.css',
  23. 'rel' => array('ajax', 'popup', 'window', 'date', 'fx'),
  24. 'lang_additional' => array('TITLE_PREFIX' => CUtil::JSEscape(COption::GetOptionString("main", "site_name", $_SERVER["SERVER_NAME"]))." - ")
  25. ),
  26. "admin_login" => array(
  27. 'js' => $pathJS."/core_admin_login.js",
  28. 'css' => $pathCSSPanel."/login.css",
  29. 'rel' => array("ajax", "window"),
  30. ),
  31. 'autosave' => array(
  32. 'js' => $pathJS.'/core_autosave.js',
  33. 'lang' => $pathLang.'/js_core_autosave.php',
  34. 'rel' => array('ajax'),
  35. ),
  36. 'fx' => array(
  37. 'js' => $pathJS.'/core_fx.js',
  38. ),
  39. 'dd' => array(
  40. 'js' => $pathJS.'/core_dd.js',
  41. ),
  42. 'dnd' => array(
  43. 'js' => '/bitrix/js/main/dd.js',
  44. ),
  45. 'webrtc' => array(
  46. 'js' => $pathJS.'/core_webrtc.js',
  47. 'rel' => array('webrtc_adapter')
  48. ),
  49. 'popup' => array(
  50. 'js' => $pathJS.'/core_popup.js',
  51. 'css' => $pathCSS.'/core_popup.css',
  52. ),
  53. 'tags' => array(
  54. 'js' => $pathJS.'/core_tags.js',
  55. 'css' => $pathCSS.'/core_tags.css',
  56. 'lang' => $pathLang.'/js_core_tags.php',
  57. 'rel' => array('popup'),
  58. ),
  59. 'timer' => array(
  60. 'js' => $pathJS.'/core_timer.js',
  61. ),
  62. 'tooltip' => array(
  63. 'js' => $pathJS.'/core_tooltip.js',
  64. 'css' => $pathCSS.'/core_tooltip.css',
  65. 'rel' => array('ajax'),
  66. 'lang_additional' => array('TOOLTIP_ENABLED' => (IsModuleInstalled("socialnetwork") && COption::GetOptionString("socialnetwork", "allow_tooltip", "Y") == "Y" ? "Y" : "N")),
  67. ),
  68. 'translit' => array(
  69. 'js' => $pathJS.'/core_translit.js',
  70. 'lang' => $pathLang.'/js_core_translit.php',
  71. /* 'lang_additional' => array('BING_KEY' => COption::GetOptionString('main', 'translate_key_bing', '')),*/
  72. 'lang_additional' => array('YANDEX_KEY' => COption::GetOptionString('main', 'translate_key_yandex', '')),
  73. ),
  74. 'image' => array(
  75. 'js' => $pathJS.'/core_image.js',
  76. 'css' => $pathCSS.'/core_image.css',
  77. 'rel' => array('ls'),
  78. ),
  79. 'viewer' => array(
  80. 'js' => $pathJS.'/core_viewer.js',
  81. 'css' => $pathCSS.'/core_viewer.css',
  82. 'lang' => $pathLang.'/js_core_viewer.php',
  83. 'rel' => array('ls', 'ajax', 'popup'),
  84. 'lang_additional' => array('DISK_MYOFFICE' => COption::GetOptionString('disk', 'demo_myoffice', false))
  85. ),
  86. 'window' => array(
  87. 'js' => $pathJS.'/core_window.js',
  88. //'css' => $pathCSS.'/core_window.css',
  89. 'css' => $pathCSSPanel.'/popup.css',
  90. 'rel' => array('ajax'),
  91. ),
  92. 'access' => array(
  93. 'js' => $pathJS.'/core_access.js',
  94. 'css' => $pathCSS.'/core_access.css',
  95. 'rel' => array('popup', 'ajax', 'finder'),
  96. 'lang' => $pathLang.'/js_core_access.php',
  97. ),
  98. 'finder' => array(
  99. 'js' => $pathJS.'/core_finder.js',
  100. 'css' => $pathCSS.'/core_finder.css',
  101. 'rel' => array('popup', 'ajax', 'db_indexeddb'),
  102. ),
  103. 'user' => array(
  104. 'js' => $pathJS.'/core_user.js',
  105. 'lang' => $pathLang.'/js_core_user.php',
  106. 'rel' => array('date'),
  107. 'lang_additional' => array(
  108. 'LIMIT_ONLINE' => method_exists('CUser', 'GetSecondsForLimitOnline')? CUser::GetSecondsForLimitOnline(): 1440 // we use this condition because has a fatal error while running updater "main 17.5.0" witch calling the OnAfterEpilog event.
  109. ),
  110. ),
  111. 'date' => array(
  112. 'js' => $pathJS.'/core_date.js',
  113. 'css' => $pathCSS.'/core_date.css',
  114. 'lang' => $pathLang.'/date_format.php',
  115. 'lang_additional' => array(
  116. 'WEEK_START' => CSite::GetWeekStart(),
  117. 'AMPM_MODE' => IsAmPmMode(true),
  118. ),
  119. 'rel' => array('popup'),
  120. ),
  121. 'ls' => array(
  122. 'js' => $pathJS.'/core_ls.js',
  123. 'rel' => array('json')
  124. ),
  125. 'db' => array(
  126. 'js' => $pathJS.'/core_db.js',
  127. ),
  128. 'db_indexeddb' => array(
  129. 'js' => $pathJS.'/core_db_indexeddb.js',
  130. ),
  131. 'fc' => array(
  132. 'js' => $pathJS . '/core_frame_cache.js',
  133. 'rel' => array('db','ajax', 'ls', 'fx')
  134. ),
  135. 'avatar_editor' => array(
  136. 'js' => $pathJS.'/core_avatar_editor.js',
  137. 'css' => $pathCSS.'/core_avatar_editor.css',
  138. 'lang' => $pathLang.'/js_core_avatar_editor.php',
  139. 'rel' => array('canvas', 'popup', 'dd', 'uploader'),
  140. ),
  141. 'canvas' => array(
  142. 'js' => $pathJS.'/core_canvas.js',
  143. 'css' => $pathCSS.'/core_canvas.css',
  144. 'lang' => $pathLang.'/js_core_canvas.php',
  145. 'rel' => array('popup'),
  146. ),
  147. 'uploader' => array(
  148. 'js' => array(
  149. $pathJS.'/core_uploader/common.js',
  150. $pathJS.'/core_uploader/uploader.js',
  151. $pathJS.'/core_uploader/file.js',
  152. $pathJS.'/core_uploader/queue.js',
  153. ),
  154. 'lang_additional' => array(
  155. "phpMaxFileUploads" => ini_get("max_file_uploads"),
  156. "phpPostMaxSize" => CUtil::Unformat(ini_get("post_max_size")),
  157. "phpUploadMaxFilesize" => CUtil::Unformat(ini_get("upload_max_filesize")),
  158. "bxImageExtensions" => CFile::GetImageExtensions(),
  159. "bxUploaderLog" => COption::GetOptionString("main", "uploaderLog", "N"),
  160. "bxQuota"=> CDiskQuota::getInstance()->GetDiskQuota()
  161. ),
  162. 'lang' => $pathLang.'/js_core_uploader.php',
  163. 'rel' => array('ajax', 'dd'),
  164. 'bundle_js' => 'coreuploader'
  165. ),
  166. 'site_speed' => array(
  167. 'js' => $pathJS.'/site_speed/site_speed.js',
  168. 'lang' => $pathLang.'/js_site_speed.php',
  169. 'rel' => array('amcharts_serial', 'ajax', "date")
  170. ),
  171. 'qrcode' => array(
  172. 'js' => array(
  173. '/bitrix/js/main/qrcode/qrcode.js'
  174. )
  175. ),
  176. 'fileinput' => array(
  177. 'js' => $pathJS.'/core_fileinput.js',
  178. 'css' => $pathCSS.'/core_fileinput.css',
  179. 'lang' => $pathLang.'/js_core_fileinput.php',
  180. 'rel' => array("ajax", "window", "popup", "uploader", "canvas", "dd")
  181. ),
  182. 'clipboard' => array(
  183. 'js' => $pathJS.'/core_clipboard.js',
  184. 'lang' => $pathLang.'/js_core_clipboard.php',
  185. 'rel' => array("popup")
  186. ),
  187. 'recorder' => array(
  188. 'js' => '/bitrix/js/main/recorder/recorder.js',
  189. 'rel' => array('lamejs')
  190. ),
  191. 'pin' => array(
  192. 'js' => '/bitrix/js/main/pin/pin.js',
  193. 'css' => '/bitrix/js/main/pin/css/pin.css'
  194. ),
  195. 'ui_select' => array(
  196. 'js' => $pathJS.'/core_ui_select.js',
  197. 'css' => $pathCSS.'/core_ui_select.css',
  198. 'rel' => array('popup')
  199. ),
  200. 'ui_date' => array(
  201. 'js' => $pathJS.'/core_ui_date.js',
  202. 'css' => $pathCSS.'/core_ui_date.css',
  203. 'rel' => array('ui_factory')
  204. ),
  205. 'ui_factory' => array(
  206. 'js' => $pathJS.'/core_ui_factory.js',
  207. 'css' => $pathCSS.'/core_ui_control.css',
  208. 'rel' => array('decl')
  209. ),
  210. 'ui' => array(
  211. 'rel' => array(
  212. 'ui_factory',
  213. 'ui_select',
  214. 'ui_date'
  215. )
  216. ),
  217. 'resize_observer' => array(
  218. 'js' => array(
  219. $pathJS.'/resize_observer/resize_observer_collection.js',
  220. $pathJS.'/resize_observer/resize_observer_item_collection.js',
  221. $pathJS.'/resize_observer/resize_observer_item_rect.js',
  222. $pathJS.'/resize_observer/resize_observer_item.js',
  223. $pathJS.'/resize_observer/resize_observer.js'
  224. )
  225. ),
  226. 'decl' => array(
  227. 'js' => $pathJS.'/core_decl.js'
  228. ),
  229. 'drag_drop' => array(
  230. 'js' => $pathJS.'/core_dragdrop.js'
  231. ),
  232. 'kanban' => array(
  233. 'js' => array(
  234. '/bitrix/js/main/kanban/grid.js',
  235. '/bitrix/js/main/kanban/column.js',
  236. '/bitrix/js/main/kanban/item.js',
  237. '/bitrix/js/main/kanban/dropzone-area.js',
  238. '/bitrix/js/main/kanban/dropzone.js',
  239. '/bitrix/js/main/kanban/utils.js'
  240. ),
  241. 'css' => array(
  242. '/bitrix/js/main/kanban/css/kanban.css',
  243. ),
  244. 'lang' => $pathLang.'/js/kanban.php',
  245. 'rel' => array('color_picker', 'dnd'),
  246. 'bundle_js' => 'kanban',
  247. 'bundle_css' => 'kanban'
  248. ),
  249. 'color_picker' => array(
  250. 'js' => array(
  251. '/bitrix/js/main/colorpicker/colorpicker.js',
  252. ),
  253. 'css' => array(
  254. '/bitrix/js/main/colorpicker/css/colorpicker.css',
  255. ),
  256. 'lang' => $pathLang.'/js/colorpicker.php',
  257. 'rel' => array('popup'),
  258. ),
  259. 'masked_input' => array(
  260. 'js' => array(
  261. '/bitrix/js/main/masked_input.js'
  262. )
  263. ),
  264. 'fullscreen' => array(
  265. 'js' => $pathJS.'/core_fullscreen.js'
  266. ),
  267. 'spotlight' => array(
  268. 'js' => '/bitrix/js/main/spotlight/spotlight.js',
  269. 'css' => '/bitrix/js/main/spotlight/css/spotlight.css',
  270. 'lang' => $pathLang.'/js/spotlight.php',
  271. 'rel' => array('popup', 'ajax'),
  272. 'bundle_js' => 'spotlight',
  273. 'bundle_css' => 'spotlight',
  274. ),
  275. 'sidepanel' => array(
  276. 'js' => array(
  277. '/bitrix/js/main/sidepanel/manager.js',
  278. '/bitrix/js/main/sidepanel/slider.js'
  279. ),
  280. 'css' => '/bitrix/js/main/sidepanel/css/sidepanel.css',
  281. 'rel' => array('ajax', 'fx'),
  282. 'bundle_js' => 'sidepanel',
  283. 'bundle_css' => 'sidepanel'
  284. ),
  285. /* external libs */
  286. 'jquery' => array(
  287. 'js' => '/bitrix/js/main/jquery/jquery-1.8.3.min.js',
  288. 'skip_core' => true,
  289. ),
  290. 'jquery_src' => array(
  291. 'js' => '/bitrix/js/main/jquery/jquery-1.8.3.js',
  292. 'skip_core' => true,
  293. ),
  294. 'jquery2' => array(
  295. 'js' => '/bitrix/js/main/jquery/jquery-2.1.3.min.js',
  296. 'skip_core' => true,
  297. ),
  298. 'jquery2_src' => array(
  299. 'js' => '/bitrix/js/main/jquery/jquery-2.1.3.js',
  300. 'skip_core' => true,
  301. ),
  302. 'json' => array(
  303. 'js' => '/bitrix/js/main/json/json2.min.js',
  304. 'skip_core' => true,
  305. ),
  306. 'json_src' => array(
  307. 'js' => '/bitrix/js/main/json/json2.js',
  308. 'skip_core' => true,
  309. ),
  310. 'amcharts' => array(
  311. 'js' => $amChartsPath.'amcharts.js',
  312. 'lang_additional' => array(
  313. 'AMCHARTS_PATH' => $amChartsPath, // will be needed in 3.14
  314. 'AMCHARTS_IMAGES_PATH' => $amChartsPath.'images/',
  315. ),
  316. 'skip_core' => true,
  317. ),
  318. 'amcharts_i18n' => array(
  319. 'js' => $amChartsPath.LANGUAGE_ID.'/'.LANGUAGE_ID.'.js',
  320. 'skip_core' => true,
  321. ),
  322. 'amcharts_funnel' => array(
  323. 'js' => $amChartsPath.'funnel.js',
  324. 'rel' => array('amcharts'),
  325. 'skip_core' => true,
  326. ),
  327. 'amcharts_gauge' => array(
  328. 'js' => $amChartsPath.'gauge.js',
  329. 'rel' => array('amcharts'),
  330. 'skip_core' => true,
  331. ),
  332. 'amcharts_pie' => array(
  333. 'js' => $amChartsPath.'pie.js',
  334. 'rel' => array('amcharts'),
  335. 'skip_core' => true,
  336. ),
  337. 'amcharts_radar' => array(
  338. 'js' => $amChartsPath.'radar.js',
  339. 'rel' => array('amcharts'),
  340. 'skip_core' => true,
  341. ),
  342. 'amcharts_serial' => array(
  343. 'js' => $amChartsPath.'serial.js',
  344. 'rel' => array('amcharts'),
  345. 'skip_core' => true,
  346. ),
  347. 'amcharts_xy' => array(
  348. 'js' => $amChartsPath.'xy.js',
  349. 'rel' => array('amcharts'),
  350. 'skip_core' => true,
  351. ),
  352. 'helper' => array(
  353. 'js' => '/bitrix/js/main/helper/helper.js',
  354. 'css' => '/bitrix/js/main/helper/css/helper.css',
  355. ),
  356. 'webrtc_adapter' => array(
  357. 'js' => '/bitrix/js/main/webrtc/adapter.js'
  358. ),
  359. 'lamejs' => array(
  360. 'js' => '/bitrix/js/main/recorder/recorder.js'
  361. ),
  362. 'update_stepper' => array(
  363. 'js' => $pathJS.'/core_update_stepper.js',
  364. 'css' => $pathCSS.'/core_update_stepper.css',
  365. 'lang' => $pathLang.'/js_core_update_stepper.php',
  366. 'rel' => array('ajax'),
  367. ),
  368. 'uf' => array(
  369. 'js' => $pathJS.'/core_uf.js',
  370. 'css' => $pathCSS.'/core_uf.css',
  371. 'rel' => array('ajax'),
  372. 'oninit' => function()
  373. {
  374. return array(
  375. 'lang_additional' => array(
  376. 'UF_SITE_TPL' => SITE_TEMPLATE_ID,
  377. 'UF_SITE_TPL_SIGN' => \Bitrix\Main\UserField\Dispatcher::instance()->getSignatureManager()->getSignature(SITE_TEMPLATE_ID),
  378. ),
  379. );
  380. }
  381. ),
  382. 'phone_number' => array(
  383. 'js' => '/bitrix/js/main/phonenumber/phonenumber.js',
  384. 'css' => '/bitrix/js/main/phonenumber/css/phonenumber.css',
  385. 'oninit' => function()
  386. {
  387. return array(
  388. 'lang_additional' => array(
  389. 'phone_number_default_country' => \Bitrix\Main\PhoneNumber\Parser::getDefaultCountry(),
  390. 'user_default_country' => \Bitrix\Main\PhoneNumber\Parser::getUserDefaultCountry()
  391. )
  392. );
  393. },
  394. 'rel' => array('popup'),
  395. )
  396. );
  397. \Bitrix\Main\Page\Asset::getInstance()->addJsKernelInfo(
  398. 'main',
  399. array(
  400. '/bitrix/js/main/core/core.js', '/bitrix/js/main/core/core_ajax.js', '/bitrix/js/main/json/json2.min.js',
  401. '/bitrix/js/main/core/core_ls.js', '/bitrix/js/main/core/core_popup.js', '/bitrix/js/main/core/core_tooltip.js',
  402. '/bitrix/js/main/core/core_date.js','/bitrix/js/main/core/core_timer.js', '/bitrix/js/main/core/core_fx.js',
  403. '/bitrix/js/main/core/core_window.js', '/bitrix/js/main/core/core_autosave.js', '/bitrix/js/main/rating_like.js',
  404. '/bitrix/js/main/session.js', '/bitrix/js/main/dd.js', '/bitrix/js/main/utils.js',
  405. '/bitrix/js/main/core/core_dd.js', '/bitrix/js/main/core/core_webrtc.js',
  406. '/bitrix/js/main/core/core_uf.js'
  407. )
  408. );
  409. \Bitrix\Main\Page\Asset::getInstance()->addCssKernelInfo(
  410. 'main',
  411. array(
  412. '/bitrix/js/main/core/css/core.css', '/bitrix/js/main/core/css/core_popup.css',
  413. '/bitrix/js/main/core/css/core_tooltip.css', '/bitrix/js/main/core/css/core_date.css',
  414. '/bitrix/js/main/core/css/core_uf.css'
  415. )
  416. );
  417. foreach ($arJSCoreConfig as $ext => $arExt)
  418. {
  419. CJSCore::RegisterExt($ext, $arExt);
  420. }