UseBB Community

The official board for UseBB help and discussion

UseBB Community » Resources & Customization » Friendly URL insertion idea

Friendly URL insertion idea

Moderators: Gaia.

Page: 1

Author Post
Member
Registered: Jun 2007
Posts: 122
Location: Gatineau, QC, Canada
Hi,

For those who have followed this thread:
http://www.usebb.net/community/topic-1822.html

I was wondering if this could be implemented, when the user clicks on URL, a drop-down panel would appear (see pic) and after inserting the link name and URL, it would simply insert the right code into the post (the panel would also have a "Submit" or "Insert" button).

This inspiration came from Gaia's Links Page Mod and I've also seen this on a few forums.

User posted image

Thanks,
Gene
« Last edit by Raygene on Mon Dec 03, 2007 10:58 pm. »
Member
Registered: Jun 2007
Posts: 122
Location: Gatineau, QC, Canada
Found some code for doing that, wonder if it could be made to work with UseBB.

<file name="$themedir/Post.template.php">

<operation>

<search position="after"><![CDATA[ // Print a drop down list for all the colors we allow!]]>

</search>



<add><![CDATA[ // Java script to handle URL input boxes ...

echo '<script language="JavaScript" type="text/javascript">

// <!' . '--

function urlINPT()

{

// Enter URL .........................................

var urlLINK = prompt("Please enter URL address:","http://");

if (urlLINK == null )

{

//cancel pressed . . .

}

else if (urlLINK == "" || urlLINK == " ")

{

//ok pressed but with Notext . . .

alert("Sorry no text entered!");

}

else

{

//ok pressed and there is something :)

// Enter Description ...................................

var urlNAME = prompt("Please enter URL name:","");

if (urlNAME == null )

{

//cancel pressed . . .

}

else if (urlNAME == "" || urlNAME == " ")

{

//ok pressed but with notext so use URL only!

surroundText(\'[url]\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');

}

else //ok pressed with text so use URL and Name!

surroundText(\'[url=\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');

}

}

// --' . '>

</script>';]]>

</add>

</operation>



<operation>

<search position="before"><![CDATA[ foreach ($context['bbc_tags'][1] as $image => $tag)

{

if (isset($tag['before']))

{

// Is this tag disabled?

if (!empty($context['disabled_tags'][$tag['code']]))

continue;]]></search>

<add><![CDATA[ // only replace the URL tag! . . . . . . . . . . .

if (isset($tag['code']) && $tag['code'] == 'url')

{

echo '<a href="javascript&#058;void(0);" onclick="urlINPT(); return false;"><img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';

continue;

}]]>

</add>

</operation>

</file>



Would end-up looking like this:

http://img2.freeimagehosting.net/image.php?51dd244358.jpg

http://img2.freeimagehosting.net/image.php?f4c967adbb.jpg

Cheers,
Gene
Member
Registered: Jun 2007
Posts: 122
Location: Gatineau, QC, Canada
Hmm, no takers?

Is this something that could be implemented in UseBB 2?
Developer
Registered: Apr 2004
Posts: 2180
Location: Belgium
Something like this probably will be in v2.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Jun 2007
Posts: 122
Location: Gatineau, QC, Canada
Dietrich wrote
Something like this probably will be in v2.


Wonderful!

Gene

Page: 1

UseBB Community » Resources & Customization » Friendly URL insertion idea

UseBB Community is powered by UseBB 1 Forum Software