[brlcad-commits] SF.net SVN: brlcad:[34730] web/trunk/htdocs/more/sites/all/modules/ filefield/file
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <eb...@us...> - 2009-06-17 15:18:41
|
Revision: 34730 http://brlcad.svn.sourceforge.net/brlcad/?rev=34730&view=rev Author: ebautu Date: 2009-06-17 15:18:38 +0000 (Wed, 17 Jun 2009) Log Message: ----------- Add option to filefield fields to select local files (required for ftp model uploading) Modified Paths: -------------- web/trunk/htdocs/more/sites/all/modules/filefield/filefield.module Modified: web/trunk/htdocs/more/sites/all/modules/filefield/filefield.module =================================================================== --- web/trunk/htdocs/more/sites/all/modules/filefield/filefield.module 2009-06-17 15:17:40 UTC (rev 34729) +++ web/trunk/htdocs/more/sites/all/modules/filefield/filefield.module 2009-06-17 15:18:38 UTC (rev 34730) @@ -313,6 +313,23 @@ if (function_exists('token_replace')) { $form['file_path']['#description'] .= theme('token_help', 'user'); } + $form['local_path'] = array( + '#type' => 'textfield', + '#title' => t('Path for local files on server'), + '#default_value' => isset($widget['local_path']) ? $widget['local_path'] : '', + '#size' => 64, + '#description' => t('Leave blank to disable selection of local files.'), + ); + $form['local_handle'] = array( + '#type' => 'select', + '#title' => t('Local files handling'), + '#options' => array( + '' => t('Do nothing'), + 'move' => t('Move to Drupal\'s files folder'), + 'copy' => t('Copy to Drupal\'s files folder'), + 'link' => t('Create link in Drupal\'s files folder'), + ) + ); // Let extension modules add their settings to the form. foreach (module_implements('filefield_widget_settings') as $module) { $function = $module .'_filefield_widget_settings'; @@ -323,7 +340,7 @@ module_invoke_all('filefield_widget_settings', $op, $widget, NULL); break; case 'save': - $core_settings = array('file_extensions', 'file_path'); + $core_settings = array('file_extensions', 'file_path', 'local_path', 'local_handle'); $additional_settings = module_invoke_all( 'filefield_widget_settings', $op, $widget, NULL ); @@ -516,6 +533,12 @@ '#tree' => FALSE, '#weight' => 10, ); + + $form[$fieldname]['new']['local_file'] = array( + '#type' => 'textfield', + '#title' => t('Or select one of the local files.'), + '#weight' => 11, + ); if (is_array($items) && count($items)) { $form[$fieldname]['files'] = array( @@ -678,7 +701,6 @@ * Validate the form widget. */ function _filefield_widget_validate($node, $field, $items) { - if (!$field['required']) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |