* Creates a database for use of multi-layered default formats and sets
* Creates a database for use of multi-layered default formats and sets
* default settings.
*/
...
...
@@ -60,27 +60,27 @@ function better_formats_schema() {
functionbetter_formats_install(){
// Create tables.
drupal_install_schema('better_formats');
// Increase module weight to prevent compatibility issues.
$sql="UPDATE {system}
SET weight = 100
$sql="UPDATE {system}
SET weight = 100
WHERE name = 'better_formats'";
db_query($sql);
// Insert format defaults.
$roles=user_roles();
$sql="INSERT INTO {better_formats_defaults}
$sql="INSERT INTO {better_formats_defaults}
VALUES (%d, '%s', %d, %d, %d)";
foreach($rolesas$rid=>$role){
db_query($sql,$rid,'node',0,1,0);
db_query($sql,$rid,'comment',0,1,0);
}
// Set default perms to be like core defaults.
$default_perms=', show format selection, show format tips, show more format tips link, collapsible format selection, collapse format fieldset by default';
// Get current core perms.
$sql="SELECT *
FROM {permission}
$sql="SELECT *
FROM {permission}
WHERE rid IN (1,2)";
$result=db_query($sql);
$row_perms=array();
...
...
@@ -89,12 +89,12 @@ function better_formats_install() {
}
// Add perms to core roles (anonymous user, authenticated user).
* Allows setting of defaults per role and content type,
* Allows setting of defaults per role and content type,
* controls format display options, works with CCK fields.
*/
...
...
@@ -17,13 +17,13 @@ function better_formats_help($path, $arg) {
case'admin/help/better_formats':
$output='<p>'.t('See the module README.txt file in the better_formats module directory for help.').'</p>';
break;
case'admin/settings/filters/defaults':
$output='<p>'.t('Set the global default formats per role for NEW nodes and comments. These settings will be applied to all nodes and comments in the site unless overriden by specific content type defaults.').'</p>';
$output.='<p>'.t('Arrange the roles to provide weight that will determine what format is selected when a user has more than one role. Remember, that all logged in users are automatically given the authenticated user role in addition to their other assigned roles. For example, if you have an admin role place it at the top and generally you would want your anonymous user role at the bottom.').'</p>';
break;
default:
default:
$output='';
}
return$output;
...
...
@@ -47,7 +47,7 @@ function better_formats_perm() {
*/
functionbetter_formats_menu(){
$items=array();
$items['admin/settings/filters/settings']=array(
'title'=>'Settings',
'description'=>'Manage input formats',
...
...
@@ -68,7 +68,7 @@ function better_formats_menu() {
'weight'=>2,
'file'=>'better_formats_defaults.admin.inc',
);
return$items;
}
...
...
@@ -92,20 +92,20 @@ function better_formats_theme() {
// Build array of all formats for allowed checkboxes.
$formats=filter_formats();
foreach($formatsas$format){
$format_boxes[$format->format]=$format->name;
}
$key='better_formats';
$form[$key]=array(
'#type'=>'fieldset',
...
...
@@ -166,18 +166,18 @@ function better_formats_node_type_form(&$form, $form_state) {
'#description'=>t('Limit the formats users have to choose from even if they have permission to use that format. This will NOT allow a user to use a format they do not have access rights to use. It will only hide additional formats they do have access rights to. If no boxes are checked, all formats that the user has permission to use will be allowed.'),