1 delweldj May 20, 2009 16:25
3 delweldj May 20, 2009 17:16
I don't use the wysiwyg editors, do they not have default text ( <a href="foo">bar</a> ), in which case user should just need to edit bar?
The wysiwyg editors do allow you to highlight the text you want to use as the link text, but the problem is that the user has to know exactly where the file is that he wants to link to. Since most of my users can't remember where they've stored documents _locally_, I'm sure it would be a nightmare for them to remember the file path to the document in the b2evo system.
I guess I'm asking for the best of both worlds, huh?
4 yabba May 20, 2009 17:23
delweldj wrote:
If I go into the files manager and do an "insert IMB/link into post" it will insert the code as HTML
I'm guessing you need to clarify this bit.
Can your users ( currently ) goto post -> type some text -> click files -> pick file -> add to post? ... in which case, is there no default text ( shown in post ) that they can type over ? ( sorry I really don't play with the wysi' stuff )
¥
5 delweldj May 20, 2009 17:33
Can your users ( currently ) goto post -> type some text -> click files -> pick file -> add to post? ... in which case, is there no default text ( shown in post ) that they can type over ? ( sorry I really don't play with the wysi' stuff )
No, they can't. If they type in their text, then select that text and go to files and select a file, the text they typed in disappears, and the link to the file doesn't appear either. It IS there, but since there is no "link text," the link doesn't appear on the page.
To get it to work using this method, once they insert the code to link their file, they have to view the HTML and insert the link text between the <a href> </a> tags. However, since my users are not HTLM savvy, this is very problematic. I just spent an hour with one user, and when I showed him what he had to do, he said, "NO WAY! I'll just wait until you get it fixed."
6 sam2kb May 20, 2009 17:34
Here's a quick hack to display a list of all files linked to the post.
// Get list of attached files
if( function_exists( 'get_attachment_FileList' ) )
{ // b2evo 3.x
$FileList = $Item->get_attachment_FileList( 1000 );
}
else
{ // b2evo 2.x
load_class('_core/model/dataobjects/_dataobjectlist2.class.php');
$FileCache = & get_Cache( 'FileCache' );
$FileList = new DataObjectList2( $FileCache ); // IN FUNC
$SQL = & new SQL();
$SQL->SELECT( 'file_ID, file_title, file_root_type, file_root_ID, file_path, file_alt, file_desc' );
$SQL->FROM( 'T_links INNER JOIN T_files ON link_file_ID = file_ID' );
$SQL->WHERE( 'link_itm_ID = '.$Item->ID );
$SQL->ORDER_BY( 'link_ID' );
$SQL->LIMIT( 1000 );
$FileList->sql = $SQL->get();
$FileList->query( false, false, false );
}
$File = NULL;
$r_file = array();
while( $File = & $FileList->get_next() )
{
if( $File->exists() && !$File->is_image() && !$File->is_dir() )
{ // Display file download link, if not an image or directory
$r = '<li>';
$r .= action_icon( T_('Download file'), 'download', $File->get_url(), '', 5 ).' ';
$r .= $File->get_view_link( $File->get_name() );
$r .= ' <i>('.number_format( $File->get_size()/1024, 2, '.', '' ).' '.T_('KB').')</i>';
$r .= '</li>';
$r_file[] = $r;
}
}
if( !empty($r_file) ) echo '<ol>'.implode( "\n", $r_file ).'</ol>';
Add this code in skins/_item_content.inc.php before the images code
if( !empty($params['image_size']) )
{
// Display images that are linked to this post:
$Item->images( array(
7 delweldj May 20, 2009 17:36
crud...too bad I'm using 2.4.6. Not ready to upgrade...still figuring out how to use this version.
8 sam2kb May 20, 2009 17:39
Ok, wait a minute, I'll make it 2.x friendly ;)
9 sam2kb May 20, 2009 17:47
I updated the code, now it works in b2evo 2.x and 3.x
10 yabba May 20, 2009 17:52
delweldj wrote:
No, they can't. If they type in their text, then select that text and go to files and select a file, the text they typed in disappears, and the link to the file doesn't appear either. It IS there, but since there is no "link text," the link doesn't appear on the page.
Once again, excuse my wysiwyg ignorance, what happens if they don't select text -> click files -> select file ? do you get some form of default link text then ?
¥
11 delweldj May 20, 2009 18:30
Once again, excuse my wysiwyg ignorance, what happens if they don't select text -> click files -> select file ? do you get some form of default link text then ?
Nothing...If you look at the HTML, it inserts the link, but with no text at all, so again, it doesn't show up when you view the blog.
12 yabba May 20, 2009 18:43
Ok,. this is based on a cvs version of the file, so line numbers may have changed :
find function get_tag() [ approx 966 ] in /inc/files/model/_file.class.php and then meander down to the link section and change it to look like this :
else
{ // Make an A HREF link:
$r = '<a href="'.$this->get_url()
.'" title="'.$this->dget('desc', 'htmlattr').'">'
.( $this->dget('title') ? $this->dget('title') : T_('your file') ).'</a>';
}
With a tad of luck that'll work ;)
¥
13 delweldj May 20, 2009 23:09
¥åßßå - that worked! Thanks...I knew the b2evo experts could help me out.
14 delweldj May 20, 2009 23:10
Sam2kb - haven't tried your fix yet. It's been hectic enough here today that just getting one thing done is a huge accomplishment...
I don't use the wysiwyg editors, do they not have default text ( <a href="foo">bar</a> ), in which case user should just need to edit bar?
Or do you mean the hover text ( title="hello world" ) ?
¥