Recent Topics

1 May 20, 2009 16:25    

My b2evolution Version: 2.x

Good day...I've searched for an answer to this and can't seem to find exactly what I'm looking for unless I'm just not putting in the correct search terms, so I'm hoping someone will have an answer for my question...even if it is that "it's not possible."

I'm the webmaster for our company, but we've installed b2evo to allow some of our employees (about 50) to communicate more easily with their clients by posting updates for their various areas of responsibility. Most of our employees have no HTML experience, and I'm trying to find the "easiest" ways to show them how to do what they want to do in b2evo without them or me pulling our hair out.

I have been able to teach them to upload files with no problem. I've showed them how to insert pictures and create alt tags for the images - that was relatively easy. However, they all have _documents_ they want their clients to have access to. The problem comes when they go to link to those documents. If I use the "link" button in the default editor or the TinyMCE editor, it requires that I know _exactly_ what file I'm linking to. This is fine if they are linking to a website, but not great for these folks who can barely remember their username and password, much less the file path to find the documents they've uploaded. If I go into the files manager and do an "insert IMB/link into post" it will insert the code as HTML, but since my employees are using the WYSIWYG, nothing shows up unless they go in and view the HTML. It's no problem for _me_ to go in and insert the link text into the "a href" tags, but it _is_ a problem for my employees, who do not read HTML. Is there a plugin or some way that the link text can be inserted at the time they select the file to link to?

I hope this makes some sense to those reading it.

2 May 20, 2009 17:00

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" ) ?

¥

3 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 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 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 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 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 May 20, 2009 17:39

Ok, wait a minute, I'll make it 2.x friendly ;)

9 May 20, 2009 17:47

I updated the code, now it works in b2evo 2.x and 3.x

10 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 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 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 May 20, 2009 23:09

¥åßßå - that worked! Thanks...I knew the b2evo experts could help me out.

14 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...


Form is loading...