Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/weight/README.txt,v retrieving revision 1.4 diff -u -p -r1.4 README.txt --- README.txt 14 Nov 2006 07:30:51 -0000 1.4 +++ README.txt 15 Dec 2008 22:45:20 -0000 @@ -15,3 +15,13 @@ products. Nodes will be sorted first by stickiness, then by weight, then by creation date. +TO CREATE AN ORDERABLE VIEW (Admins can reweight nodes using drag-and-drop): + +Create a view as normal with a "page" display +Change the view style to "weight changer" +Include Field Weight (though not as the first field you include). +Sort by Weight DESC. +Ensure only appropriate roles have access to the view. +Load up the view, reorder, and save! + + Index: weight-view-weight-form.tpl.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/weight/weight-view-weight-form.tpl.php,v retrieving revision 1.2 diff -u -p -r1.2 weight-view-weight-form.tpl.php --- weight-view-weight-form.tpl.php 13 Nov 2008 18:35:39 -0000 1.2 +++ weight-view-weight-form.tpl.php 15 Dec 2008 22:45:20 -0000 @@ -1,29 +1,34 @@ + - $label): ?> - - + + $label): ?> + + + - $row): ?> - - $content): ?> - - - - + + $row): ?> + + $content): ?> + + + + +
- - + +
- -
+ +
Index: weight.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/weight/weight.module,v retrieving revision 1.26 diff -u -p -r1.26 weight.module --- weight.module 13 Nov 2008 17:48:14 -0000 1.26 +++ weight.module 15 Dec 2008 22:45:20 -0000 @@ -405,4 +405,28 @@ function weight_theme() { 'template' => 'weight-view-weight-form', ), ); +} + +/** + * Prepare the weight form for its template file. + */ +function template_preprocess_weight_view_weight_form(&$vars) { + $vars['header'] = $vars['form']['#variables']['header']; + $vars['class'] = $vars['form']['#variables']['class']; + $vars['id'] = $vars['form']['#variables']['id']; + $vars['fields'] = $vars['form']['#variables']['fields']; + foreach ($vars['form']['rows'] as $count => $item) { + if (is_numeric($count)) { + foreach ($item as $field => $value) { + if (substr($field, 0, 1) != '#') { + if (substr($field, 0, 6) == 'weight') { + $value['#attributes']['class'] = 'weight_dragger'; + } + $vars['rows'][$count][$field] = drupal_render($value); + } + } + } + } + unset($vars['form']['rows']); + $vars['submit'] = drupal_render($vars['form']); } \ No newline at end of file Index: weight.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/weight/weight.views.inc,v retrieving revision 1.5 diff -u -p -r1.5 weight.views.inc --- weight.views.inc 14 Nov 2008 01:41:05 -0000 1.5 +++ weight.views.inc 15 Dec 2008 22:45:21 -0000 @@ -69,7 +69,7 @@ function weight_views_plugins() { function weight_views_handlers() { return array( 'info' => array( - 'path' => drupal_get_path('module', 'weight') /*.'/handlers'*/, + 'path' => drupal_get_path('module', 'weight'), ), 'handlers' => array( 'weight_handler_field_sticky' => array( @@ -173,6 +173,7 @@ function theme_weight_view_weight($view, $id = $view->name .'_drag'; return drupal_get_form('weight_view_weight_form', $header, $rows, $weight_fields, $class, $id); } + /** * Display a view as a weight changing table. */ @@ -236,26 +237,3 @@ function weight_view_weight_form_submit( drupal_set_message('Your weight changes have been saved.'); } -/** - * Prepare the weight form for its template file. - */ -function template_preprocess_weight_view_weight_form(&$vars) { - $vars['header'] = $vars['form']['#variables']['header']; - $vars['class'] = $vars['form']['#variables']['class']; - $vars['id'] = $vars['form']['#variables']['id']; - $vars['fields'] = $vars['form']['#variables']['fields']; - foreach ($vars['form']['rows'] as $count => $item) { - if (is_numeric($count)) { - foreach ($item as $field => $value) { - if (substr($field, 0, 1) != '#') { - if (substr($field, 0, 6) == 'weight') { - $value['#attributes']['class'] = 'weight_dragger'; - } - $vars['rows'][$count][$field] = drupal_render($value); - } - } - } - } - unset($vars['form']['rows']); - $vars['submit'] = drupal_render($vars['form']); -} \ No newline at end of file