Index: tinymce.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tinymce/tinymce.install,v retrieving revision 1.5.2.1 diff -u -F^f -r1.5.2.1 tinymce.install --- tinymce.install 11 May 2006 16:59:34 -0000 1.5.2.1 +++ tinymce.install 27 May 2006 08:18:20 -0000 @@ -47,3 +47,7 @@ function tinymce_install() { function tinymce_update_1() { return _system_update_utf8(array('tinymce_settings', 'tinymce_role')); } + +function tinymce_update_2() { + return array(update_sql("ALTER TABLE {tinymce_settings} ADD weight tinyint(1) default '0' NOT NULL;")); +} Index: tinymce.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tinymce/tinymce.module,v retrieving revision 1.90 diff -u -F^f -r1.90 tinymce.module --- tinymce.module 25 Apr 2006 11:23:47 -0000 1.90 +++ tinymce.module 27 May 2006 08:18:22 -0000 @@ -85,7 +85,7 @@ function tinymce_process_textarea($eleme // Since tinymce_config() makes a db hit, only call it when we're pretty sure // we're gonna render tinymce. if (!$profile_name) { - $profile_name = db_result(db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s)', implode(',', array_keys($user->roles)))); + $profile_name = db_result(db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s) ORDER BY s.weight', implode(',', array_keys($user->roles)))); } $profile = tinymce_profile_load($profile_name); $init = tinymce_config($profile); @@ -236,7 +236,6 @@ function tinymce_user($type, &$edit, &$u $form['tinymce'] = array( '#type' => 'fieldset', '#title' => t('TinyMCE rich-text settings'), - '#weight' => 10, '#collapsible' => TRUE, '#collapsed' => TRUE ); @@ -295,6 +294,7 @@ function theme_tinymce_theme($init, $tex case 'user_mail_pass_body': // user config settings case 'synonyms': // taxonomy terms case 'description': // taxonomy terms + case 'workflow_comment': // workflow state comment unset($init); break; @@ -669,7 +669,15 @@ function tinymce_profile_form($edit) { '#description' => t('Enter a name for this profile. This name is only visible within the tinymce administration page.'), '#required' => TRUE ); - + + $form['basic']['weight'] = array( + '#type' => 'weight', + '#title' => t('Weight'), + '#default_value' => $edit->weight, + '#delta' => 10, + '#description' => t('The profile with the lightest weight will be shown to the user if he is member of more then one role.'), + ); + $form['basic']['rids'] = array( '#type' => 'checkboxes', '#title' => t('Roles allowed to use this profile'), @@ -1025,7 +1033,7 @@ function tinymce_profile_overview() { function tinymce_profile_save($edit) { db_query("DELETE FROM {tinymce_settings} WHERE name = '%s' or name = '%s'", $edit['name'], $edit['old_name']); db_query("DELETE FROM {tinymce_role} WHERE name = '%s' or name = '%s'", $edit['name'], $edit['old_name']); - db_query("INSERT INTO {tinymce_settings} (name, settings) VALUES ('%s', '%s')", $edit['name'], serialize($edit)); + db_query("INSERT INTO {tinymce_settings} (name, settings, weight) VALUES ('%s', '%s', '%d')", $edit['name'], serialize($edit), $edit['weight']); foreach ($edit['rids'] as $rid => $value) { db_query("INSERT INTO {tinymce_role} (name, rid) VALUES ('%s', %d)", $edit['name'], $rid); } @@ -1100,7 +1108,7 @@ function _tinymce_page_match($edit) { } function tinymce_user_get_profile($account) { - $profile_name = db_result(db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s)', implode(',', array_keys($account->roles)))); + $profile_name = db_result(db_query('SELECT s.name FROM {tinymce_settings} s INNER JOIN {tinymce_role} r ON r.name = s.name WHERE r.rid IN (%s) ORDER BY s.weight', implode(',', array_keys($account->roles)))); if ($profile_name){ return tinymce_profile_load($profile_name); }