--- attachment.module Thu Aug 2 17:37:32 2007
+++ attachment.module Tue Sep 9 11:43:09 2008
@@ -58,6 +58,7 @@
$form['attachments'][$key]['hidden'] = array('#type'=>'checkbox', '#return_value'=>1, '#default_value'=>$attachment['hidden']);
$form['attachments'][$key]['title'] = array('#type'=>'textfield', '#size'=>30, '#maxlength'=>255, '#default_value'=>$attachment['title']);
$form['attachments'][$key]['description'] = array('#type'=>'textfield', '#size'=>100, '#maxlength'=>255, '#default_value'=>$attachment['description']);
+ $form['attachments'][$key]['weight'] = array('#type'=>'weight','#default_value'=>$attachment['weight']);
$form['attachments'][$key]['display'] = array('#type'=>'markup', '#value'=> 'Filename:'. $attachment['filename'] .'
URL:');
}
@@ -126,11 +127,11 @@
if (!$attachment['deleted']) {
module_invoke('filemanager', 'promote_working', $attachment['fid']);
if ($attachment['aid']) {
- db_query("UPDATE {attachment} SET title='%s', description = '%s', size=%d, hidden='%s' WHERE aid=%d", $attachment['title'], $attachment['description'], $attachment['size'], $attachment['hidden'], $attachment['aid']);
+ db_query("UPDATE {attachment} SET title='%s', description = '%s', size=%d, hidden='%s', weight='%d' WHERE aid=%d", $attachment['title'], $attachment['description'], $attachment['size'], $attachment['hidden'], $attachment['weight'], $attachment['aid']);
}
else {
$aid = db_next_id('{attachment}_aid');
- db_query("INSERT INTO {attachment} (aid,title,description,nid,fid,filename,size,hidden) VALUES (%d,'%s','%s',%d,%d,'%s',%d,'%s')", $aid, $attachment['title'],$attachment['description'],$node->nid, $attachment['fid'], $attachment['filename'], $attachment['size'], $attachment['hidden']);
+ db_query("INSERT INTO {attachment} (aid,title,description,nid,fid,filename,size,hidden,weight) VALUES (%d,'%s','%s',%d,%d,'%s',%d,'%s',%d)", $aid, $attachment['title'],$attachment['description'],$node->nid, $attachment['fid'], $attachment['filename'], $attachment['size'], $attachment['hidden'], $attachment['weight']);
}
}
else {
@@ -269,35 +270,36 @@
* Theme the attachment form
*/
function theme_attachment_form($form) {
+ _attachments_enable_dragdrop();
$output = '';
$header = array(
t('Delete'),
t('Hidden'),
+ t('Weight'),
t('Title'),
t('Description'),
);
$rows = array();
+
+ $output .= "