? .DS_Store ? drupal-6--1.pathc Index: inline.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/inline/inline.info,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 inline.info --- inline.info 27 Mar 2007 03:52:31 -0000 1.1.2.1 +++ inline.info 20 Jun 2008 20:32:54 -0000 @@ -2,4 +2,6 @@ name = Inline description = Allows attached files to be placed into the body of a node either automatically or by using simple tags. package = "Input filters" -dependencies = filter upload \ No newline at end of file +dependencies[] = filter +dependencies[] = upload +core = 6.x Index: inline.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/inline/inline.module,v retrieving revision 1.19.2.7 diff -u -p -r1.19.2.7 inline.module --- inline.module 18 Apr 2007 11:22:27 -0000 1.19.2.7 +++ inline.module 20 Jun 2008 20:32:55 -0000 @@ -1,23 +1,20 @@ 'admin/settings/inline', - 'title' => t('Inline'), - 'description' => t('Manage automatic and manual inclusion of attachments in the content of your posts.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('inline_settings'), - 'access' => user_access('administer inline settings'), - ); - } + + $items['admin/settings/inline'] = array( + 'title' => 'Inline', + 'description' => t('Manage automatic and manual inclusion of attachments in the content of your posts.'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('inline_settings'), + 'access arguments' => array('administer inline settings'), + ); return $items; } @@ -25,15 +22,15 @@ function inline_perm() { return array('administer inline settings'); } -function inline_help($section = 'admin/help#inline') { +function inline_help($path, $arg) { $output = ''; - switch ($section) { + switch ($path) { case 'admin/help#inline': return t('
Sometimes a user may want to add an image or a file inside the body of a node. This can be done with special tags that are replaced by links to the corresponding uploaded file. If the file is an image, it will be displayed inline, otherwise a link to the file will be inserted. To enable this feature and learn the proper syntax, visit the filters configuration screen.
', array('!filters' => url('admin/filters'))); - + case 'filter#short-tip': - return t('You may add links to files uploaded with this node using special tags', array('!explanation-url' => url('filter/tips', NULL, 'image'))); - + return t('You may add links to files uploaded with this node using special tags', array('!explanation-url' => url('filter/tips', array('fragment' => 'image')))); + case 'filter#long-tip': return t('You may link to files uploaded with the current node using special tags. The tags will be replaced by the corresponding files. Syntax: [inline:file_id]. Parameter: file_id represents the file uploaded with the node in which to link, assuming that the first uploaded file is labeled as 1 and so on.
If the file is an image, it will be displayed inline, otherwise a link to the file will be inserted.
'); @@ -42,7 +39,7 @@ function inline_help($section = 'admin/h function inline_settings() { $form = array(); - + // Check if Inline filter is enabled $inline_activated = false; foreach (filter_formats() as $format) { @@ -56,7 +53,7 @@ function inline_settings() { if ($inline_activated == false) { drupal_set_message(t('Inline filter is not yet enabled for at least one input format.', array('!formats' => url('admin/settings/filters'))), 'error'); } - + $form['inline']['upload']['image_link'] = array( '#type' => 'fieldset', '#title' => t('Image output'), @@ -72,20 +69,20 @@ function inline_settings() { '1' => t('Display image with a link to the image file') ), ); - + $form['inline']['upload']['image_scaling'] = array( '#type' => 'fieldset', '#title' => t('Image dimensions and scaling'), '#collapsible' => true, '#description' => (module_exists('imagecache') ? t('Select the Imagecache presets to use for inlined images.', array('!presets' => url('admin/settings/imagecache'))) : t('Note: If Imagecache module is installed, Inline provides support for image scaling.', array('!imagecache' => url('http://drupal.org/project/imagecache')))), ); - + if (module_exists('imagecache')) { $options = array(); $options[''] = 'No Imagecache processing'; - $presets = _imagecache_get_presets(); + $presets = imagecache_presets(); foreach ($presets as $id => $name) { - $options[$name] = $name; + $options[$name['presetname']] = $name['presetname']; } $form['inline']['upload']['image_scaling']['inline_teaser_preset'] = array( '#title' => t('Teaser preset'), @@ -113,11 +110,11 @@ function inline_settings() { '#description' => t('This setting limits the dimensions of displayed images in pixels. They will not be resized. Images exceeding these dimensions are automatically not displayed.', array('!content-types' => url('admin/content/types'))), ); } - + return system_settings_form($form); } -function inline_form_alter($form_id, &$form) { +function inline_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'node_type_form') { $node_type = $form['orig_type']['#value']; $form['workflow']['upload_inline'] = array( @@ -134,14 +131,14 @@ function inline_filter($op, $delta = 0, if ($op == 'list') { return array(0 => t('Inline file filter')); } - + switch ($op) { case 'description': return t('Substitutes [inline:xx] tags with the xxth file uploaded with the node.'); - + case 'prepare': return $text; - + case 'process': return $text; } @@ -170,22 +167,27 @@ function inline_filter_tips($delta, $for will be replaced by<a href=file1.pdf.png>test</a>');
}
else {
- return t('You may use [inline:xx] tags to display uploaded files or images inline.', array("!inline_help" => url("filter/tips/$format", NULL, 'filter-inline')));
+ return t('You may use [inline:xx] tags to display uploaded files or images inline.', array("!inline_help" => url("filter/tips/$format", array('fragment' => 'filter-inline'))));
}
}
function inline_nodeapi(&$node, $op, $arg) {
- if (!is_array($node->files)) {
+ if (empty($node->files) || !is_array($node->files)) {
return;
}
+
switch ($op) {
case 'alter':
case 'print':
// only nodes with our inline filter in the format may be altered
foreach (filter_list_format($node->format) as $filter) {
if ($filter->module == 'inline') {
- $node->teaser = _inline_substitute_tags($node, 'teaser');
- $node->body = _inline_substitute_tags($node, 'body');
+ if (!empty($node->teaser)) {
+ $node->teaser = _inline_substitute_tags($node, 'teaser');
+ }
+ if (!empty($node->body)) {
+ $node->body = _inline_substitute_tags($node, 'body');
+ }
break;
}
}
@@ -193,9 +195,9 @@ function inline_nodeapi(&$node, $op, $ar
$node = _inline_auto_add($node);
}
return;
-
+
case 'prepare':
- case 'submit':
+ case 'presave':
$node->teaser = _inline_replace_numbers($node, 'teaser');
$node->body = _inline_replace_numbers($node, 'body');
return;
@@ -238,55 +240,28 @@ function inline_prepare_file_object($fil
return $file;
}
-function theme_inline_as_link($file) {
- // prepare link text with title or filename
- $linktext = ($file->title ? $file->title : $file->filename);
-
- return l($linktext, file_create_url($file->filepath), array('title' => t('Download: @name (@size)', array('@name' => $file->filename, '@size' => format_size($file->filesize)))));
-}
-
-function theme_inline_img($file, $field) {
- $title = (!empty($file->title) ? $file->title : $file->filename);
- $inline_preset = $field == 'teaser' ? 'inline_teaser_preset' : 'inline_full_preset';
-
- if (module_exists('imagecache') && variable_get($inline_preset, '') != '') {
- $image = theme('imagecache',
- variable_get($inline_preset, ''),
- $file->filepath,
- $title,
- $title,
- array('class' => 'inline')
- );
- }
- else {
- $image = theme('image',
- $file->filepath,
- $title,
- $title,
- array('class' => 'inline')
- );
- }
-
- if (variable_get('inline_link_img', '1')) {
- $attributes = array(
- 'class' => 'inline-image-link',
- 'title' => t("View") .': '. $title,
+/**
+ * Implementation of hook_theme()
+ */
+function inline_theme() {
+ return array(
+ 'inline_as_link' => array(
+ 'arguments' => array('link' => NULL),
+ 'file' => 'inline.theme.inc'
+ ),
+ 'inline_img' => array(
+ 'arguments' => array('file' => NULL, 'field' => NULL),
+ 'file' => 'inline.theme.inc'
+ ),
+ 'inline_add_to_teaser' => array(
+ 'arguments' => array('node' => NULL, 'file' => NULL, 'field' => NULL),
+ 'file' => 'inline.theme.inc'
+ ),
+ 'inline_add_to_body' => array(
+ 'arguments' => array('node' => NULL, 'file' => NULL, 'field' => NULL),
+ 'file' => 'inline.theme.inc'
+ )
);
- $html = l($image, $file->filepath, $attributes, NULL, NULL, FALSE, TRUE);
- }
- else {
- $html = $image;
- }
-
- return $html;
-}
-
-function theme_inline_add_to_teaser($node, $file, $field) {
- return theme('inline_img', $file, $field) . $node->teaser;
-}
-
-function theme_inline_add_to_body($node, $file, $field) {
- return theme('inline_img', $file, $field) . $node->body;
}
function _inline_auto_add($node) {
@@ -307,7 +282,7 @@ function _inline_auto_add($node) {
}
}
break;
-
+
case 2:
foreach ($node->files as $fid => $file) {
$file = inline_prepare_file_object($file);
@@ -320,7 +295,7 @@ function _inline_auto_add($node) {
}
}
break;
-
+
case 3:
foreach ($node->files as $fid => $file) {
$file = inline_prepare_file_object($file);
@@ -423,14 +398,14 @@ function _inline_decide_img_tag($file) {
else {
// read settings
list($maxwidth, $maxheight) = explode(',', variable_get('inline_img_dim', '150,150'));
-
+
if ($file->preview) {
list($width, $height) = getimagesize($file->real_path);
}
else {
list($width, $height) = getimagesize($file->filepath);
}
-
+
if (($width && $height) && ($width <= $maxwidth && $height <= $maxheight)) {
return TRUE;
}
@@ -438,4 +413,3 @@ function _inline_decide_img_tag($file) {
}
return FALSE;
}
-
Index: inline.theme.inc
===================================================================
RCS file: inline.theme.inc
diff -N inline.theme.inc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ inline.theme.inc 20 Jun 2008 20:32:55 -0000
@@ -0,0 +1,52 @@
+title ? $file->title : $file->filename);
+
+ return l($linktext, file_create_url($file->filepath), array('attributes' => array('title' => t('Download: @name (@size)', array('@name' => $file->filename, '@size' => format_size($file->filesize))))));
+}
+
+function theme_inline_img($file, $field) {
+ $title = (!empty($file->title) ? $file->title : $file->filename);
+ $inline_preset = $field == 'teaser' ? 'inline_teaser_preset' : 'inline_full_preset';
+
+ if (module_exists('imagecache') && variable_get($inline_preset, '') != '') {
+ $image = theme('imagecache',
+ variable_get($inline_preset, ''),
+ $file->filepath,
+ $title,
+ $title,
+ array('class' => 'inline')
+ );
+ }
+ else {
+ $image = theme('image',
+ $file->filepath,
+ $title,
+ $title,
+ array('class' => 'inline')
+ );
+ }
+
+ if (variable_get('inline_link_img', '1')) {
+ $attributes = array(
+ 'class' => 'inline-image-link',
+ 'title' => t("View") .': '. $title,
+ );
+ $html = l($image, $file->filepath, array('attributes' => $attributes, 'html' => true));
+ }
+ else {
+ $html = $image;
+ }
+
+ return $html;
+}
+
+function theme_inline_add_to_teaser($node, $file, $field) {
+ return theme('inline_img', $file, $field) . $node->teaser;
+}
+
+function theme_inline_add_to_body($node, $file, $field) {
+ return theme('inline_img', $file, $field) . $node->body;
+}