Subversion Repositories wimsdev

Rev

Rev 13648 | Rev 13721 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13648 Rev 13695
Line 1... Line 1...
1
!! insert this before `!header` : `!read js/external/tinymce.phtml xxxx`
1
!! insert this before `!header` : `!read js/external/tinymce.phtml xxxx`
2
!!  with xxxx pointing to an existing DOM element (a textarea)
2
!!  with xxxx pointing to an existing DOM element (a textarea)
3
 
3
 
4
!if $wims_read_parm!=
4
!if $wims_read_parm!=
5
 
5
 
-
 
6
  !let name_WYSIWYG_activate=Activate editor
-
 
7
  !let name_WYSIWYG_disable=Disable editor
6
  !if $lang=fr
8
  !if $lang=fr
7
    !set tiny_lang=language: 'fr_FR',
9
    !set tiny_lang=language: 'fr_FR',
-
 
10
    !let name_WYSIWYG_activate=Activer l'éditeur
-
 
11
    !let name_WYSIWYG_disable=Désactiver l'éditeur
8
  !endif
12
  !endif
9
  !if $lang=it
13
  !if $lang=it
10
    !set tiny_lang=language: 'it',
14
    !set tiny_lang=language: 'it',
-
 
15
    !let name_WYSIWYG_activate=Activate editor
-
 
16
    !let name_WYSIWYG_disable=Disable editor
11
  !endif
17
  !endif
12
  !if $lang=cn
18
  !if $lang=cn
13
    !set tiny_lang=language: 'zh_CN',
19
    !set tiny_lang=language: 'zh_CN',
-
 
20
    !let name_WYSIWYG_activate=Activate editor
-
 
21
    !let name_WYSIWYG_disable=Disable editor
14
  !endif
22
  !endif
15
 
23
 
16
  !set wims_html_header= !append line <script src="scripts/js/external/tinymce/tinymce.min.js"></script>\
24
  !set wims_html_header= !append line <script src="scripts/js/external/tinymce/tinymce.min.js"></script>\
-
 
25
  <style>.hidden_btn{display:none}.wysiwyg_btns{text-align:right;font-size:.6em}</style>\
17
  <script>\
26
  <script>\
-
 
27
  document.addEventListener("DOMContentLoaded", function() {\
-
 
28
    /* Insert "enable/disable editor" buttons */\
-
 
29
    var ed_instances = document.querySelectorAll("$wims_read_parm");\
-
 
30
    ed_instances.forEach(function(ed) {\
18
  (function() {\
31
      if(ed.id){\
-
 
32
        var div = document.createElement('div');\
-
 
33
        div.classList.add('wysiwyg_btns');\
-
 
34
        var a1 = document.createElement('a');\
-
 
35
        var linkText = document.createTextNode("$name_WYSIWYG_disable");\
-
 
36
        a1.appendChild(linkText);\
-
 
37
        a1.setAttribute("onclick","javascript:tinymce.execCommand('mceRemoveEditor',true,'"+ed.id+"');this.classList.add('hidden_btn');this.nextElementSibling.classList.remove('hidden_btn');");\
-
 
38
        div.appendChild(a1);\
-
 
39
        var a2 = document.createElement('a');\
-
 
40
        var linkText = document.createTextNode("$name_WYSIWYG_activate");\
-
 
41
        a2.appendChild(linkText);\
-
 
42
        a2.setAttribute("onclick","javascript:tinymce.execCommand('mceAddEditor',true,'"+ed.id+"');this.classList.add('hidden_btn');this.previousElementSibling.classList.remove('hidden_btn');");\
-
 
43
        a2.classList.add("hidden_btn");\
-
 
44
        div.appendChild(a2);\
-
 
45
        /* insert just after editor */\
-
 
46
        ed.parentNode.insertBefore(div, ed.nextSibling);\
-
 
47
      }\
-
 
48
    });\
-
 
49
    /* Initialize editors */\
19
    tinymce.init({\
50
    tinymce.init({\
20
      selector:'$wims_read_parm',\
51
      selector:'$wims_read_parm',\
21
      plugins: 'code help hr link lists',\
52
      plugins: 'code help hr link lists',\
22
      menubar: false,\
53
      menubar: false,\
23
      branding: false,\
54
      branding: false,\
Line 25... Line 56...
25
      $tiny_lang\
56
      $tiny_lang\
26
      content_css : 'html/themes/$wims_theme/css.css',\
57
      content_css : 'html/themes/$wims_theme/css.css',\
27
      body_class: 'main_body',\
58
      body_class: 'main_body',\
28
      content_style : 'a, .ui-widget-content a{color:$wims_link_color;}a:hover, a:focus {color:$wims_hlink_color;}table.wimstable th{background-color: $wims_ref_bgcolor;color: $wims_ref_menucolor;}table.wimstable th a{color: $wims_ref_menucolor;}.wimstable caption a{color: $wims_ref_menucolor;}.wims_emph {color:$wims_ref_bgcolor;}input[type="submit"],input[type="button"],.main_body .wims_button{background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.main_body .wims_button_help{background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}.property_fields{border-color:$wims_ref_bgcolor;}.property_fields legend{background-color: $wims_ref_bgcolor;}.property_fields legend,.property_fields legend>a{color:$wims_ref_menucolor;}.wims_color1 {background-color: $wims_ref_bgcolor;color:$wims_ref_menucolor;}.wims_color2 {background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.wims_color3 {background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}'\
59
      content_style : 'a, .ui-widget-content a{color:$wims_link_color;}a:hover, a:focus {color:$wims_hlink_color;}table.wimstable th{background-color: $wims_ref_bgcolor;color: $wims_ref_menucolor;}table.wimstable th a{color: $wims_ref_menucolor;}.wimstable caption a{color: $wims_ref_menucolor;}.wims_emph {color:$wims_ref_bgcolor;}input[type="submit"],input[type="button"],.main_body .wims_button{background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.main_body .wims_button_help{background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}.property_fields{border-color:$wims_ref_bgcolor;}.property_fields legend{background-color: $wims_ref_bgcolor;}.property_fields legend,.property_fields legend>a{color:$wims_ref_menucolor;}.wims_color1 {background-color: $wims_ref_bgcolor;color:$wims_ref_menucolor;}.wims_color2 {background-color:$wims_ref_button_bgcolor;color:$wims_ref_button_color;}.wims_color3 {background-color:$wims_ref_button_help_bgcolor;color:$wims_ref_button_help_color;}'\
29
    });\
60
    });\
30
  })();</script> to $wims_html_header
61
  });</script> to $wims_html_header
31
!endif
62
!endif