Turkish translation for TinyMCE module
[project/tinymce.git] / tinymce.module
CommitLineData
6f760c55
MW
1<?php
2// $Id$
6f760c55 3
6f760c55
MW
4function tinymce_help($section) {
5 switch ($section) {
0b663943
W
6 case 'admin/help#tinymce':
7 $output = '<p>'. t('The most popular WYSIWYG editor for advance content.') .'</p>';
8 $output .= t("<p><ul>"
9 ."<li>Editor mode: full, compact and simple.</li>"
10 ."</ul>"
11 ."</p>");
12 return $output;
6f760c55 13 case 'admin/modules#description':
0b663943 14 return t('Enable WYSIWYG Editor to your site.');
6f760c55
MW
15 }
16}
17
6f760c55 18function tinymce_perm() {
0cc5775a 19 $array = array('administer tinymce', 'access tinymce');
0b663943 20 $array[] = 'enable tinymce file manager';
0cc5775a
TS
21
22 return $array;
6f760c55
MW
23}
24
0b663943 25function tinymce_menu($may_cache) {
5120a0c6 26
0b663943 27 $items = array();
de22ba4a 28
0b663943
W
29 $items[] = array(
30 'path' => 'admin/settings/tinymce',
31 'title' => t('TinyMCE'),
32 'description' => t('Tinymce settings.'),
33 'callback' => 'drupal_get_form',
34 'callback arguments' => array('tinymce_admin_settings'),
35 'access' => user_access('administer tinymce'),
36 'type' => MENU_NORMAL_ITEM);
0cc5775a 37
0b663943 38 return $items;
6f760c55
MW
39}
40
0b663943
W
41function tinymce_admin_settings() {
42 // only administrators can access this function
43 // Generate the form - settings applying to all patterns first
7a2a524b 44
0b663943
W
45 $form['tinymce_settings'] = array(
46 '#type' => 'fieldset',
47 '#weight' => -20,
48 '#title' => t('Basic settings'),
49 '#collapsible' => TRUE,
50 '#collapsed' => FALSE
51 );
52
53 $form['tinymce_settings']['editor_mode'] = array(
54 '#type' => 'radios',
55 '#title' => t('Editor Mode'),
56 '#default_value' => variable_get('editor_mode', 0),
57 '#options' => array(t('Full'), t('Compact'), t('Simple')),
83acecec
W
58 '#description' => t("FULL: enable all TinyMCE features. COMPACT: enable most used features. SIMPLE: just enable simple editor.<hr>")
59 );
60
61 $form['tinymce_settings']['editor_element'] = array(
62 '#type' => 'radios',
63 '#title' => t('Enable TinyMCE for'),
64 '#default_value' => variable_get('editor_element', 0),
65 '#options' => array(t('Edit-body only'), t('Edit-comment only'), t('Both')),
66 '#description' => t("If you want TinyMCE available for textarea of edit-body and comment then you should select <b>Both</b> option.")
67 );
7a2a524b 68
c46695fa
W
69 $form['tinymce_settings']['editor_node_type'] = array(
70 '#type' => 'textfield',
71 '#title' => t('Enable TinyMCE for this node types'),
72 '#default_value' => variable_get('editor_node_type', 'page,story,blog'),
73 '#description' => t("Node type in case-sensitive name, i.e: page,story,data_product,blog")
74 );
75
0b663943 76 return system_settings_form($form);
6739c75d
MW
77}
78
0b663943 79function tinymce_form_alter($form_id, &$form) {
c46695fa
W
80 $editor_node_type = variable_get("editor_node_type", 'page,story,blog');
81 $form_type = $form['type']['#value'];
82
83 if (!preg_match("/\b$form_type\b/i", $editor_node_type)) return;
84
0b663943
W
85 if ($form_id == 'comment_form' || (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) && user_access('access tinymce')) {
86 $queries = array("textarea#body", "textarea#comment");
87 tinymce_add_javascript();
6f760c55 88 }
6f760c55
MW
89}
90
0b663943
W
91function tinymce_add_javascript() {
92 $editor_mode = variable_get("editor_mode", 0);
83acecec 93 $editor_element = variable_get("editor_element", 0);
7248584b 94
0b663943
W
95 drupal_add_js(drupal_get_path('module', 'tinymce') . '/includes/jscripts/tiny_mce/tiny_mce.js');
96 //drupal_add_js(drupal_get_path('module', 'tinymce') . '/imce/imce_set.js');
ef6204c6 97
0b663943
W
98 if ($editor_mode==0) { drupal_add_js(drupal_get_path('module', 'tinymce') . '/themes/tinymce_full.js'); }
99 elseif ($editor_mode==1) { drupal_add_js(drupal_get_path('module', 'tinymce') . '/themes/tinymce_compact.js'); }
100 else { drupal_add_js(drupal_get_path('module', 'tinymce') . '/themes/tinymce_simple.js'); }
0cc5775a 101
83acecec
W
102 //tinyMCE.configs[i]['file_browser_callback'] = 'imceImageBrowser';
103 if ($editor_element==0) {$tinymce_elements = 'edit-body';}
104 elseif ($editor_element==1) {$tinymce_elements = 'edit-comment';}
105 else {$tinymce_elements = 'edit-body,edit-comment';}
106
107
108 drupal_add_js("
109 if ('undefined' != typeof(window.tinyMCE)) {
110 for (var i=0; i<tinyMCE.configs.length; i++) {
111 tinyMCE.configs[i]['elements'] = '$tinymce_elements';
112 }
113 }
114 "
115 , 'inline');
01a85ffd 116}