function outline_designer_suffix in Outline Designer 6
Same name and namespace in other branches
- 7 outline_designer.module \outline_designer_suffix()
Suffix adds the info to tak on the edn of the form
1 call to outline_designer_suffix()
File
- ./
outline_designer.module, line 808 - Massive usability improvement for quickly structuring / creating content.
Code
function outline_designer_suffix() {
// Select only those that the book module say can be outlined
$types_ary = variable_get('book_allowed_types', array(
'page',
));
// make sure the user can submit these types via permissions
$result = db_query("SELECT type,name FROM {node_type} ORDER BY name");
$typeoutput = '<table><tr>';
$count = 0;
while ($value = db_fetch_array($result)) {
// ensure there is no permission escalation in type switching
if (array_search($value['type'], $types_ary) === FALSE) {
}
elseif (node_access('create', $value['type'])) {
$count++;
$typeoutput .= '<td><input type="radio" class="type_radio" name="content_type[]" value="' . $value['type'] . '"/> <img src="' . base_path() . variable_get("outline_designer_" . $value['type'] . "_icon", drupal_get_path('module', 'outline_designer') . "/images/page.png") . '" />' . $value['name'] . '</td>';
if ($count % 3 == 0) {
$typeoutput .= '</tr><tr>';
}
}
}
$typeoutput .= '</tr></table>';
$duplicate_form['od_duplicate_number'] = array(
'#title' => t('How many copies would you like?'),
'#type' => 'select',
'#id' => 'od_duplicate_number',
'#description' => t('Duplicates will be performed one at a time to avoid load issues'),
'#options' => array(
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
),
'#required' => TRUE,
'#default_value' => 1,
'#weight' => 0,
);
$duplicate_form['od_duplicate_multiple'] = array(
'#title' => t('Duplicate Hierarchy'),
'#id' => 'od_duplicate_multiple',
'#type' => 'checkbox',
'#attributes' => array(
'checked' => 'checked',
),
'#description' => t('If checked, the current content and all child pages will be duplicated'),
'#weight' => 1,
);
$duplicate_form['od_duplicate_title'] = array(
'#title' => t('Title format'),
'#id' => 'od_duplicate_title',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 20,
'#description' => t('Tokens: @title = content title; @i = duplicate number'),
'#weight' => 2,
);
// delete form
$delete_form['od_delete_multiple'] = array(
'#title' => t('Delete Hierarchy'),
'#id' => 'od_delete_multiple',
'#type' => 'checkbox',
'#description' => t('Warning: This action cannot be undone.'),
'#weight' => 0,
);
// add form
$add_form['od_add_content_title'] = array(
'#title' => t('Title'),
'#id' => 'od_add_content_title',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 20,
'#description' => t('Make sure you edit content after creation if it has "required fields"
'),
'#weight' => 0,
'#suffix' => $typeoutput,
);
return '
<div id="od_popup_overlay"></div>
<div id="od_popup" class="context-menu context-menu-theme-' . variable_get('outline_designer_theme', 'vista') . '">
<div class="popup-statusbar"></div>
<div class="popup-content"></div>
<div class="popup-buttons">
<input type="button" name="Save" value="Save" class="od_submit_button" />
</div>
<img src="' . base_path() . drupal_get_path('module', 'outline_designer') . '/images/close.png" class="od_cancel_button" />
</div>
<div id="od_popup_toolbox">
<div id="od_duplicate" class="od_uiscreen">
' . drupal_render($duplicate_form) . '
</div>
<div id="od_delete" class="od_uiscreen">
' . drupal_render($delete_form) . '
</div>
<div id="od_change_type" class="od_uiscreen">
<div class="description">' . t('Warning: Changing content types can have undesirable effects') . '</div>
' . $typeoutput . '
</div>
<div id="od_add_content" class="od_uiscreen">
' . drupal_render($add_form) . '
</div>
</div>';
}