Show
Ignore:
Timestamp:
01/27/06 15:53:20 (3 years ago)
Author:
sven
Message:

fixing eduforge bug 85

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/units/tinymce/main.php

    r180 r230  
    11<?php 
    22 
    3     /// TinyMCE editor 
     3       /// TinyMCE editor 
    44 
    5     global $CFG; 
    6     global $function; 
     5       global $CFG; 
     6       global $function; 
    77 
    8     // Add JS to embed file in weblog script 
    9       $function['files:embed:js'][] = path . "units/tinymce/file_embed_js.php"; 
     8       // Add JS to embed file in weblog script 
     9              $function['files:embed:js'][] = path . "units/tinymce/file_embed_js.php"; 
    1010 
    11     // Only load the editor in the following contexts 
    12         $function['weblogs:edit'][] = path . "units/tinymce/tinymce_js.php"; 
    13         $function['weblogs:posts:view:individual'][] = path . "units/tinymce/tinymce_js.php"; 
     11       // Only load the editor in the following contexts 
     12               $function['weblogs:edit'][] = path . "units/tinymce/tinymce_js.php"; 
     13               $function['weblogs:posts:view:individual'][] = path . "units/tinymce/tinymce_js.php"; 
    1414 
    15     // What is the user preference 
    16         $function['userdetails:editor'][] = path . "units/tinymce/tinymce_userdetails.php"; 
     15       // What is the user preference 
     16               $function['userdetails:editor'][] = path . "units/tinymce/tinymce_userdetails.php"; 
    1717 
    18     // Action handling 
    19         $function['userdetails:init'][] = path . "units/tinymce/tinymce_userdetails_actions.php"; 
    20     // TODO figure this out 
    21     // User details editable options 
    22         $function['userdetails:edit:details'][] = path . "units/tinymce/tinymce_userdetails_edit.php"; 
     18       // Action handling 
     19               $function['userdetails:init'][] = path . "units/tinymce/tinymce_userdetails_actions.php"; 
     20       // TODO figure this out 
     21       // User details editable options 
     22               $function['userdetails:edit:details'][] = path . "units/tinymce/tinymce_userdetails_edit.php"; 
    2323 
    24     // Let the system know we've got TinyMCE loaded 
    25     //$CFG->plugins->tinymce = true; 
     24       // Let the system know we've got TinyMCE loaded 
     25       //$CFG->plugins->tinymce = true; 
    2626 
    27     // Added editor section to enable future editor choice in user config 
    28     $CFG->plugins->editor["tinymce"] = true; 
     27       // Added editor section to enable future editor choice in user config 
     28       $CFG->plugins->editor["tinymce"] = true; 
    2929?> 
  • devel/units/tinymce/tinymce_js.php

    r180 r230  
    11<?php 
    2     // Language setting 
     2       // Language setting 
    33 
    4     global $language; 
    5     global $page_owner; 
     4       global $language; 
     5       global $page_owner; 
    66 
    7     if (run('userdetails:editor', $page_owner) == "yes") { 
    8         if (!$language) { 
    9             $language = locale; 
    10        
     7       if (run('userdetails:editor', $page_owner) == "yes") { 
     8               if (!$language) { 
     9                       $language = locale; 
     10               
    1111 
    12         // Keep base language, no variations for now 
    13         $lang = substr($language, 0, 2); 
     12               // Keep base language, no variations for now 
     13               $lang = substr($language, 0, 2); 
    1414 
    15         // Loose the trailing slash 
    16         $url = substr(url, 0, -1); 
     15               // Loose the trailing slash 
     16               $url = substr(url, 0, -1); 
    1717 
    18         global $metatags; 
     18               global $metatags; 
    1919 
    20         $metatags .= <<< END 
    21         <script language="javascript" type="text/javascript" src="$url/_tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script> 
    22         <script language="javascript" type="text/javascript"> 
    23         tinyMCE.init({ 
    24         language : "$lang", 
    25         mode : "exact", 
    26         convert_urls : false, 
    27         relative_urls : false, 
    28         elements : "new_weblog_post,new_weblog_comment", 
    29         theme : "advanced", 
    30         theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,image,undo,redo,link,unlink,code,fullscreen", 
    31       theme_advanced_buttons2 : "", 
    32       theme_advanced_buttons3 : "", 
    33       theme_advanced_toolbar_location : "top", 
    34       theme_advanced_toolbar_align : "left", 
    35       theme_advanced_path_location : "bottom", 
    36       extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", 
    37       remove_linebreaks: true, 
    38         theme_advanced_source_editor_width : "400", 
    39         theme_advanced_source_editor_height : "300", 
    40         plugins : "fullscreen", 
    41         document_base_url : "$url", 
    42         fullscreen_settings : { 
    43               theme_advanced_path_location : "top" 
    44       } 
    45        
    46         }); 
    47         </script>\n 
     20               $metatags .= <<< END 
     21               <script language="javascript" type="text/javascript" src="$url/_tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script> 
     22               <script language="javascript" type="text/javascript"> 
     23               tinyMCE.init({ 
     24               language : "$lang", 
     25               mode : "exact", 
     26               convert_urls : false, 
     27               relative_urls : false, 
     28               elements : "new_weblog_post,new_weblog_comment", 
     29               theme : "advanced", 
     30               theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,image,undo,redo,link,unlink,code,fullscreen", 
     31              theme_advanced_buttons2 : "", 
     32              theme_advanced_buttons3 : "", 
     33              theme_advanced_toolbar_location : "top", 
     34              theme_advanced_toolbar_align : "left", 
     35              theme_advanced_path_location : "bottom", 
     36              extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", 
     37              remove_linebreaks: true, 
     38               theme_advanced_source_editor_width : "400", 
     39               theme_advanced_source_editor_height : "300", 
     40               plugins : "fullscreen", 
     41               document_base_url : "$url", 
     42               fullscreen_settings : { 
     43                      theme_advanced_path_location : "top" 
     44              } 
     45               
     46               }); 
     47               </script>\n 
    4848END; 
    49    
     49       
    5050?> 
  • devel/units/tinymce/tinymce_userdetails.php

    r180 r230  
    11<?php 
    22 
    3     // Get the user preferences for the editor 
     3       // Get the user preferences for the editor 
    44 
    5     // Userid 
    6     $id = (int) $parameter; 
     5       // Userid 
     6       $id = (int) $parameter; 
    77 
    8     // Editor is enabeled by default 
    9     $value = "yes"; 
     8       // Editor is enabeled by default 
     9       $value = "yes"; 
    1010 
    11     // Query result 
    12     $result = db_query("select value from user_flags value where flag = 'visualeditor' and user_id = $id"); 
     11       // Query result 
     12       $result = db_query("select value from user_flags value where flag = 'visualeditor' and user_id = $id"); 
    1313 
    14     // Process resultset 
    15     if ($row = $result[0]) { 
    16         // We have a result, the preference has been set earlier 
    17         $value = $row->value; 
    18     } else { 
    19         // No result, store a default value 
    20         db_query("insert into user_flags set flag='visualeditor', value='$value', user_id=$id"); 
    21    
     14       // Process resultset 
     15       if ($row = $result[0]) { 
     16               // We have a result, the preference has been set earlier 
     17               $value = $row->value; 
     18       } else { 
     19               // No result, store a default value 
     20               db_query("insert into user_flags set flag='visualeditor', value='$value', user_id=$id"); 
     21       
    2222 
    23     $run_result = $value; 
     23       $run_result = $value; 
    2424?> 
  • devel/units/tinymce/tinymce_userdetails_actions.php

    r180 r230  
    11<?php 
    22 
    3     // Save the user's editor choice 
     3       // Save the user's editor choice 
    44 
    5     if (logged_on && isset($_REQUEST['action']) && run("permissions:check", 
    6         array("userdetails:change",((int) $_REQUEST['id'])))) { 
     5       if (logged_on && isset($_REQUEST['action']) && run("permissions:check", 
     6               array("userdetails:change",((int) $_REQUEST['id'])))) { 
    77 
    8         if (isset($_REQUEST['visualeditor']) && ($_REQUEST['visualeditor'] == "yes" || $_REQUEST['visualeditor'] == "no")) { 
     8               if (isset($_REQUEST['visualeditor']) && ($_REQUEST['visualeditor'] == "yes" || $_REQUEST['visualeditor'] == "no")) { 
    99 
    10             // Get the current value, will also create an initial entry if not yet set 
    11             $current = run('userdetails:editor', (int) $_REQUEST['id']); 
    12             $value   = $_REQUEST['visualeditor']; 
    13             $id      = (int) $_REQUEST['id']; 
     10                       // Get the current value, will also create an initial entry if not yet set 
     11                       $current = run('userdetails:editor', (int) $_REQUEST['id']); 
     12                       $value   = $_REQUEST['visualeditor']; 
     13                       $id       = (int) $_REQUEST['id']; 
    1414 
    15             if ($current == $value) { 
    16                 $messages[] .= gettext("Your editor preferences have been saved"); 
    17             } else { 
    18                 db_query("update user_flags set value = '$value' where flag = 'visualeditor' and user_id = $id"); 
    19                 $messages[] .= gettext("Your editor preferences have been changed"); 
    20            
    21        
    22    
     15                       if ($current == $value) { 
     16                               $messages[] .= gettext("Your editor preferences have been saved"); 
     17                       } else { 
     18                               db_query("update user_flags set value = '$value' where flag = 'visualeditor' and user_id = $id"); 
     19                               $messages[] .= gettext("Your editor preferences have been changed"); 
     20                       
     21               
     22       
    2323 
    2424?> 
  • devel/units/tinymce/tinymce_userdetails_edit.php

    r180 r230  
    11<?php 
    22 
    3     $visualEditor = gettext("Visual text editing"); 
    4     $visualEditorRules = gettext("Set this to 'yes' if you would like to use a visual (WYSIWYG) text editor for your posts and comments."); 
     3       $visualEditor = gettext("Visual text editing"); 
     4       $visualEditorRules = gettext("Set this to 'yes' if you would like to use a visual (WYSIWYG) text editor for your posts and comments."); 
    55 
    6     $body .= <<< END 
     6       $body .= <<< END 
    77 
    8     <h2>$visualEditor</h2> 
    9     <p> 
    10         $visualEditorRules 
    11     </p> 
     8       <h2>$visualEditor</h2> 
     9       <p> 
     10               $visualEditorRules 
     11       </p> 
    1212 
    1313END; 
    1414 
    15     $editor = run('userdetails:editor', $page_owner); 
     15       $editor = run('userdetails:editor', $page_owner); 
    1616 
    17     if ($editor == "yes") { 
    18             $body .= run("templates:draw", array( 
    19                     'context' => 'databox', 
    20                     'name' => gettext("Enable visual editor: "), 
    21                     'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" checked=\"checked\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" /> " . gettext("No") . "</label>" 
    22            
    23             ); 
    24     } else { 
    25             $body .= run("templates:draw", array( 
    26                     'context' => 'databox', 
    27                     'name' => gettext("Enable visual editor: "), 
    28                     'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" checked=\"checked\" /> " . gettext("No") . "</label>" 
    29            
    30             ); 
    31    
     17       if ($editor == "yes") { 
     18                       $body .= run("templates:draw", array( 
     19                                       'context' => 'databox', 
     20                                       'name' => gettext("Enable visual editor: "), 
     21                                       'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" checked=\"checked\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" /> " . gettext("No") . "</label>" 
     22                       
     23                       ); 
     24       } else { 
     25                       $body .= run("templates:draw", array( 
     26                                       'context' => 'databox', 
     27                                       'name' => gettext("Enable visual editor: "), 
     28                                       'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" checked=\"checked\" /> " . gettext("No") . "</label>" 
     29                       
     30                       ); 
     31       
    3232 
    3333 
    34     $run_result = $body; 
     34       $run_result .= $body; 
    3535 
    3636?>