summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrel O\'Pry2008-07-14 08:12:46 (GMT)
committer Darrel O\'Pry2008-07-14 08:12:46 (GMT)
commitbad2b17f0256a9a68f49e78786f43b81e742682c (patch)
tree2ed52b9041ab2bd4116f0fbf73cc223bd92f615a
parent0b75076c72f40d81ca5e6d8c855f5a74840f3bb8 (diff)
starting to clean up the forms a little.
-rw-r--r--filefield.css54
-rw-r--r--filefield.module7
-rw-r--r--filefield_widget.inc19
3 files changed, 49 insertions, 31 deletions
diff --git a/filefield.css b/filefield.css
index fcd42fc..ac2ecf2 100644
--- a/filefield.css
+++ b/filefield.css
@@ -2,34 +2,12 @@
* Overall styles
*/
-.filefield-icon img {
- display: inline;
-}
-
-/**
- * Clear the filefield-icon float, or any other floats
- * that custom widgets might have inserted but not cleared.
- * Stolen from "How To Clear Floats Without Structural Markup",
- * http://www.positioniseverything.net/easyclearing.html
- */
-.filefield-item:after, .filefield-file-edit:after {
- content: "";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
-}
-/* Hides from IE-mac \*/
-* html .filefield-item, .filefield-file-edit {height: 1%;}
-/* End hide from IE-mac */
-
-/* End overall styles */
/**
* Formatter styles
*/
-.filefield-item .filefield-icon {
+.filefield-icon {
float: left;
margin-right: 0.4em;
}
@@ -39,15 +17,33 @@
/**
* General widget form styles (applicable to all widgets)
*/
+.filefield-row {
+}
+
+.filefield-row .filefield-info {
+ float : left;
+ padding-right: 1em;
+}
-.filefield-file-edit-flags {
- float: right;
- text-align: right;
- margin-bottom: -4px; /* The "List" checkbox has too much bottom margin */
+.filefield-row .filefield-edit {
+ float : left;
+ width: 70%;
}
+
+
+.filefield-row .filefield-description {
+ width: 70%;
+}
+
+
+.filefield-row .filefield-list {
+ float : right;
+}
+
+
.filefield-file-edit-widget {
- width: 90%;
+ float: left;
}
/* Only applies to single-value fields, for which we provide our own table. */
@@ -85,7 +81,7 @@
/* The text field is made unnecessarily long by node.css - shorten it */
.filefield-generic-edit .form-text {
- width: 100%;
+ width: 99%;
}
.filefield-generic-edit .description {
white-space: normal;
diff --git a/filefield.module b/filefield.module
index c9ae936..ef85251 100644
--- a/filefield.module
+++ b/filefield.module
@@ -29,6 +29,8 @@ function filefield_init() {
// file hooks and callbacks.
module_load_include('inc', 'filefield', 'filefield_file');
+
+ drupal_add_css(drupal_get_path('module', 'filefield') .'/filefield.css');
}
/**
@@ -97,6 +99,11 @@ function filefield_theme() {
'arguments' => array('element' => NULL),
'file' => 'filefield_widget.inc',
),
+ 'filefield_row' => array(
+ 'arguments' => array('element' => NULL),
+ 'file' => 'filefield_widget.inc',
+ ),
+
'filefield_formatter_filefield_default' => array(
'arguments' => array('element' => NULL),
diff --git a/filefield_widget.inc b/filefield_widget.inc
index 0bada5c..c90c794 100644
--- a/filefield_widget.inc
+++ b/filefield_widget.inc
@@ -34,7 +34,7 @@ function filefield_widget_process($element, $edit, &$form_state, $form) {
//dsm('imagefield_widget_process');
//dsm($element);
//dsm($form_state);
-
+ $element['#theme'] = 'filefield_row';
$file = $element['#value'];
$delta = $element['#delta'];
$field_name = $element['#field_name'];
@@ -58,6 +58,7 @@ function filefield_widget_process($element, $edit, &$form_state, $form) {
'#type' => 'checkbox',
'#title' => t('List'),
'#default_value' => $file['list'],
+ '#attributes' => array('class' => 'filefield-list'),
);
$element['data'] = array(
@@ -199,10 +200,24 @@ function _filefield_widget_validate($element, &$form_state) {
/**
* FormAPI theme function. Theme the output of an image field.
*/
-function theme_filefield_widget(&$element) {
+function theme_filefield_widget($element) {
return $element['#children'];
}
+function theme_filefield_row($element) {
+ return '<div class="filefield-row clear-block">'.
+ '<div class="filefield-info clear-block">'.
+ '<div class="filefield-filename clear-block">'. drupal_render($element['preview']) . '</div>'.
+ //'<div class="filefield-filesize">filesize: 32Kb</div>'.
+ //'<div class="filefield-filemime">mimetype: text/patch</div>'.
+ '</div>' .
+ '<div class="fielfield-edit clear-block"'.
+ '<div class="filefield-list">'. drupal_render($element['list']) . '</div>' .
+ '<div class="filefield-description">'. drupal_render($element['description']) . '</div>' .
+ '<div class="filefield-stuff">'. drupal_render($element) .'</div>'.
+ '</div>'.
+ '</div>';
+}
/**