head.tpl 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <meta charset="{{ system_charset }}" />
  2. <link href="http://www.chamilo.org/documentation.php" rel="help" />
  3. <link href="http://www.chamilo.org/team.php" rel="author" />
  4. <link href="http://www.chamilo.org" rel="copyright" />
  5. {{ prefetch }}
  6. {{ favico }}
  7. <link rel="apple-touch-icon" href="{{ _p.web }}apple-touch-icon.png" />
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <meta name="Generator" content="{{ _s.software_name }} {{ _s.system_version|slice(0,1) }}" />
  10. {# Use the latest engine in ie8/ie9 or use google chrome engine if available #}
  11. {# Improve usability in portal devices #}
  12. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  13. <title>{{ title_string }}</title>
  14. {{ css_file_to_string }}
  15. {{ css_style_print }}
  16. {{ js_file_to_string }}
  17. {{ extra_headers }}
  18. {% block header_end %}{% endblock header_end %}
  19. <script>
  20. // This is a patch for the "__flash__removeCallback" bug, see FS#4378.
  21. {% raw %}
  22. if ((navigator.userAgent.toLowerCase().indexOf('msie') != -1 ) && ( navigator.userAgent.toLowerCase().indexOf('opera') == -1 )) {
  23. window.attachEvent( 'onunload', function() {
  24. window['__flash__removeCallback'] = function ( instance, name ) {
  25. try {
  26. if ( instance ) {
  27. instance[name] = null ;
  28. }
  29. } catch ( flashEx ) {
  30. }
  31. } ;
  32. });
  33. }
  34. {% endraw %}
  35. function setCheckbox(value, table_id) {
  36. checkboxes = $("#"+table_id+" input:checkbox");
  37. $.each(checkboxes, function(index, checkbox) {
  38. checkbox.checked = value;
  39. if (value) {
  40. $(checkbox).parentsUntil("tr").parent().addClass("row_selected");
  41. } else {
  42. $(checkbox).parentsUntil("tr").parent().removeClass("row_selected");
  43. }
  44. });
  45. return false;
  46. }
  47. function action_click(element, table_id) {
  48. d = $("#"+table_id);
  49. if (!confirm('{{ "ConfirmYourChoice"|get_lang }}')) {
  50. return false;
  51. } else {
  52. var action =$(element).attr("data-action");
  53. $('#'+table_id+' input[name="action"] ').attr("value", action);
  54. d.submit();
  55. return false;
  56. }
  57. }
  58. /* Global chat variables */
  59. var ajax_url = '{{ _p.web_ajax }}chat.ajax.php';
  60. var online_button = '{{ online_button |e('js') }}';
  61. var offline_button = '{{ offline_button |e('js') }}';
  62. var connect_lang = '{{ "ChatConnected"|get_lang |e('js') }}';
  63. var disconnect_lang = '{{ "ChatDisconnected"|get_lang |e('js') }}';
  64. function get_url_params(q, attribute) {
  65. var vars;
  66. var hash;
  67. if (q != undefined) {
  68. q = q.split('&');
  69. for(var i = 0; i < q.length; i++){
  70. hash = q[i].split('=');
  71. if (hash[0] == attribute) {
  72. return hash[1];
  73. }
  74. }
  75. }
  76. }
  77. function check_brand() {
  78. if ($('.subnav').length) {
  79. if ($(window).width() >= 969) {
  80. $('.subnav .brand').hide();
  81. } else {
  82. $('.subnav .brand').show();
  83. }
  84. }
  85. }
  86. $(window).resize(function() {
  87. check_brand();
  88. });
  89. $(document).scroll(function() {
  90. // Top bar scroll effect
  91. if ($('body').width() > 959) {
  92. if ($('.subnav').length) {
  93. if (!$('.subnav').attr('data-top')) {
  94. // If already fixed, then do nothing
  95. if ($('.subnav').hasClass('subnav-fixed')) return;
  96. // Remember top position
  97. var offset = $('.subnav').offset();
  98. $('.subnav').attr('data-top', offset.top);
  99. }
  100. if ($('.subnav').attr('data-top') - $('.subnav').outerHeight() <= $(this).scrollTop()) {
  101. $('.subnav').addClass('subnav-fixed');
  102. } else {
  103. $('.subnav').removeClass('subnav-fixed');
  104. }
  105. //$('.subnav .brand').show();
  106. }
  107. } else {
  108. //$('.subnav .brand').hide();
  109. }
  110. //Exercise warning fixed at the top
  111. var fixed = $("#exercise_clock_warning");
  112. if (fixed.length) {
  113. if (!fixed.attr('data-top')) {
  114. // If already fixed, then do nothing
  115. if (fixed.hasClass('subnav-fixed')) return;
  116. // Remember top position
  117. var offset = fixed.offset();
  118. fixed.attr('data-top', offset.top);
  119. fixed.css('width', '100%');
  120. }
  121. if (fixed.attr('data-top') - fixed.outerHeight() <= $(this).scrollTop()) {
  122. fixed.addClass('subnav-fixed');
  123. fixed.css('width', '100%');
  124. } else {
  125. fixed.removeClass('subnav-fixed');
  126. fixed.css('width', '200px');
  127. }
  128. }
  129. // Admin -> Settings toolbar.
  130. if ($('body').width() > 959) {
  131. if ($('.new_actions').length) {
  132. if (!$('.new_actions').attr('data-top')) {
  133. // If already fixed, then do nothing
  134. if ($('.new_actions').hasClass('new_actions-fixed')) return;
  135. // Remember top position
  136. var offset = $('.new_actions').offset();
  137. var more_top = 0;
  138. if ($('.subnav').hasClass('new_actions-fixed')) {
  139. more_top = 50;
  140. }
  141. $('.new_actions').attr('data-top', offset.top + more_top);
  142. }
  143. if ($('.new_actions').attr('data-top') - $('.new_actions').outerHeight() <= $(this).scrollTop()) {
  144. $('.new_actions').addClass('new_actions-fixed');
  145. } else {
  146. $('.new_actions').removeClass('new_actions-fixed');
  147. }
  148. }
  149. }
  150. // Bottom actions.
  151. if ($('.bottom_actions').length) {
  152. if (!$('.bottom_actions').attr('data-top')) {
  153. // If already fixed, then do nothing
  154. if ($('.bottom_actions').hasClass('bottom_actions_fixed')) return;
  155. // Remember top position
  156. var offset = $('.bottom_actions').offset();
  157. $('.bottom_actions').attr('data-top', offset.top);
  158. }
  159. if ($('.bottom_actions').attr('data-top') > $('body').outerHeight()) {
  160. if ( ($('.bottom_actions').attr('data-top') - $('body').outerHeight() - $('.bottom_actions').outerHeight()) >= $(this).scrollTop()) {
  161. $('.bottom_actions').addClass('bottom_actions_fixed');
  162. $('.bottom_actions').css("width", "100%");
  163. } else {
  164. $('.bottom_actions').css("width", "");
  165. $('.bottom_actions').removeClass('bottom_actions_fixed');
  166. }
  167. } else {
  168. if ( ($('.bottom_actions').attr('data-top') - $('.bottom_actions').outerHeight()) <= $(this).scrollTop()) {
  169. $('.bottom_actions').addClass('bottom_actions_fixed');
  170. $('.bottom_actions').css("width", "100%");
  171. } else {
  172. $('.bottom_actions').removeClass('bottom_actions_fixed');
  173. $('.bottom_actions').css("width", "");
  174. }
  175. }
  176. }
  177. });
  178. $(function() {
  179. check_brand();
  180. //Removes the yellow input in Chrome
  181. if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
  182. $(window).load(function(){
  183. $('input:-webkit-autofill').each(function(){
  184. var text = $(this).val();
  185. var name = $(this).attr('name');
  186. $(this).after(this.outerHTML).remove();
  187. //var has_string = $(name).find(":contains('[')");
  188. $('input[name=' + name + ']').val(text);
  189. });
  190. });
  191. }
  192. // Fixes buttons to the new btn class.
  193. if (!$('#button').hasClass('btn')) {
  194. $("button").addClass('btn');
  195. }
  196. // Dropdown effect.
  197. $('.dropdown-toggle').dropdown();
  198. // Responsive effect.
  199. $(".collapse").collapse();
  200. $(".accordion_jquery").accordion({
  201. autoHeight: false,
  202. active: false, // all items closed by default
  203. collapsible: true,
  204. header: ".accordion-heading"
  205. });
  206. // Global popup
  207. $('.ajax').on('click', function() {
  208. var url = this.href;
  209. var dialog = $("#dialog");
  210. if ($("#dialog").length == 0) {
  211. dialog = $('<div id="dialog" style="display:none"></div>').appendTo('body');
  212. }
  213. width_value = 580;
  214. height_value = 450;
  215. resizable_value = true;
  216. new_param = get_url_params(url, 'width');
  217. if (new_param) {
  218. width_value = new_param;
  219. }
  220. new_param = get_url_params(url, 'height')
  221. if (new_param) {
  222. height_value = new_param;
  223. }
  224. new_param = get_url_params(url, 'resizable');
  225. if (new_param) {
  226. resizable_value = new_param;
  227. }
  228. // load remote content
  229. dialog.load(url,{}, function(responseText, textStatus, XMLHttpRequest) {
  230. dialog.dialog({
  231. modal : true,
  232. width : width_value,
  233. height : height_value,
  234. resizable : resizable_value
  235. });
  236. });
  237. //prevent the browser to follow the link
  238. return false;
  239. });
  240. //old jquery.menu.js
  241. $('#navigation a').stop().animate({
  242. 'marginLeft':'50px'
  243. }, 1000);
  244. $('#navigation > li').hover(
  245. function () {
  246. $('a',$(this)).stop().animate({
  247. 'marginLeft':'1px'
  248. },200);
  249. },
  250. function () {
  251. $('a',$(this)).stop().animate({
  252. 'marginLeft':'50px'
  253. },200);
  254. }
  255. );
  256. // Tiny mce
  257. /*tinymce.init({
  258. plugins: "media,image,elfinder",
  259. selector: "textarea"
  260. });*/
  261. /*
  262. $(".td_actions").hide();
  263. $(".td_actions").parent('tr').mouseover(function() {
  264. $(".td_actions").show();
  265. });
  266. $(".td_actions").parent('tr').mouseout(function() {
  267. $(".td_actions").hide();
  268. });*/
  269. });
  270. </script>
  271. {% block extraHead %}
  272. {% endblock %}
  273. {{ header_extra_content }}