Fonts drop down selection & URL in post screen

Started by codenaught, October 09, 2004, 12:37:49 PM

Previous topic - Next topic

TechnoDragon

Thank you...just edited the post though to show 15 of the 16 web standard font colors. (I left out white)
Don't tell me to get into shape...I have a shape...It is round!


tthmaz

Saw a small bug in the coding...

In the font size options:
<option value="10pt" style="font-size:8px">8pt</option>

which i think should be:
<option value="10pt" style="font-size:8px">10pt</option>

or:
<option value="10pt" style="font-size:8px">8px</option>

TechnoDragon

No, the reason behind that is px is different than pt...pt wouldn't work for the style segment, so i had to use px.  Once i did that the pt size came out like it should in the post
Don't tell me to get into shape...I have a shape...It is round!


underdog

ok it's along time ago that tis is post but i downloaded this mod and installed in RC3.
But i can't find it! Where do i found the configuration of this mod? :(
Blijf proberen en je zult het snappen!

TechnoDragon

there was no mod for this...it was simply a code edit to various files in smf
Don't tell me to get into shape...I have a shape...It is round!


snifftheglove

The following code works in RC3, however is their a way so that the link will open in the same window and not (as it currently does) in a new window. Makes things difficult if you are posting a link to another post and another window opens up, thus having 2 windows of the same site open.

Thanks

Quote from: TechnoDragon on June 09, 2006, 03:22:19 AM

for the pop-up tags (IMG and URL):
In your post.template.php file (usually in the default theme directory) find this code:
// Print a drop down list for all the colors we allow!

add this before:
    // Java script to handle IMG input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function imgINPT(){
          // Enter IMG .........................................
          var imgLINK = prompt("Please enter IMG address:","http://");
          if (imgLINK == null ){ //cancel pressed . . .
          }
          else if (imgLINK == "" || imgLINK == " "){ //ok pressed but with Notext . . .
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed with text so use IMG and Name!
                    surroundText(\'[img]\'+imgLINK+\'\', \'[/img]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';
 
    // 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>';


then find this code:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link. Now for the image and the closing </a>!
echo '<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'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


and replace it with this:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the IMG tag! . . . . . . . . . . .
      if ($tag['code'] == 'img')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="imgINPT(); 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="Insert Image" title="Insert Image" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// only replace the URL tag! . . . . . . . . . . .
      elseif ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript: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>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<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>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


When this is done, any new posts that are made, when the IMG or URL BBC tag is selected will pop-up a box.  For the IMG tag it is simply to put the url of the image, for the URL tag it will first ask for the link, then the text you want to display (if any) for the link.


TC Carl

I have performed the code changes for the font face, font size and font color for 1.1 RC2 and I also notice that only the font color "effect" works under IE6 - i.e. the colors show "colored" in the drop-down list, but the font face and font size all appear uniform (default).

Can someone explain, briefly, why this doesn't work in IE6, and if there's any point in pursuing it? I think 95% of the value in this mod lies in the drop-down lists, and the WYSIWYG "effect" is icing on the cake.

Cheers,

TC Carl

snifftheglove

Hi All, having been answered in another thread about open links in same page, could some Javascript Wizard modify the code from this thread to add an additional bbc button and use the tag , therefore the post screen will have 2 insert url buttons (one for one in new window //and%20another%20to%20open%20in%20same%20window%20[iurl])%20with%20the%20popup%20javascript%20window.This%20would%20be%20great.Thanks,%20if%20i%20need%20to%20post%20elsewhere%20for%20this%20request%20could%20someone%20point%20me%20to%20this%20right%20location%20as%20I%20have%20just%20tagged%20the%20request%20to%20the%20end%20of%20this%20relevant%20thread.[quote%20author=snifftheglove%20link=topic=17867.msg724399#msg724399%20date=1157917038]The%20following%20code%20works%20in%20RC3,%20however%20is%20their%20a%20way%20so%20that%20the%20link%20will%20open%20in%20the%20same%20window%20and%20not%20(as%20it%20currently%20does)%20in%20a%20new%20window.%20Makes%20things%20difficult%20if%20you%20are%20posting%20a%20link%20to%20another%20post%20and%20another%20window%20opens%20up,%20thus%20having%202%20windows%20of%20the%20same%20site%20open.Thanks[quote%20author=TechnoDragon%20link=topic=17867.msg604774#msg604774%20date=1149837739][b]for%20the%20pop-up%20tags%20(IMG%20and%20URL):[/b]In%20your%20post.template.php%20file%20(usually%20in%20the%20default%20theme%20directory)%20find%20this%20code:[code]//%20Print%20a%20drop%20down%20list%20for%20all%20the%20colors%20we%20allow![/code]add%20this%20before:[code] %20 %20//%20Java%20script%20to%20handle%20IMG%20input%20boxes%20... %20 %20echo%20'<script%20language="JavaScript"%20type="text/javascript"> %20 %20 %20 %20 %20<!-- %20 %20 %20 %20 %20function%20imgINPT(){ %20 %20 %20 %20 %20//%20Enter%20IMG%20......................................... %20 %20 %20 %20 %20var%20imgLINK%20=%20prompt("Please%20enter%20IMG%20address:","http://"); %20 %20 %20 %20 %20if%20(imgLINK%20==%20null%20){%20//cancel%20pressed%20.%20.%20. %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else%20if%20(imgLINK%20==%20""%20||%20imgLINK%20==%20"%20"){%20//ok%20pressed%20but%20with%20Notext%20.%20.%20. %20 %20 %20 %20 %20 %20 %20 %20 %20alert("Sorry%20no%20text%20entered!"); %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else %20 %20 %20 %20 %20{%20//ok%20pressed%20with%20text%20so%20use%20IMG%20and%20Name! %20 %20 %20 %20 %20 %20 %20 %20 %20 %20surroundText(\'[img]\'+imgLINK+\'\',%20\'[/img]\',%20document.',%20$context['post_form'],%20'.',%20$context['post_box_name'],%20'); %20 %20 %20 %20 %20} %20 %20 %20 %20 %20} %20 %20 %20 %20 %20//%20--> %20 %20 %20 %20 %20</script>'; %20 %20 %20//%20Java%20script%20to%20handle%20URL%20input%20boxes%20... %20 %20echo%20'<script%20language="JavaScript"%20type="text/javascript"> %20 %20 %20 %20 %20<!-- %20 %20 %20 %20 %20function%20urlINPT(){ %20 %20 %20 %20 %20//%20Enter%20URL%20......................................... %20 %20 %20 %20 %20var%20urlLINK%20=%20prompt("Please%20enter%20URL%20address:","http://"); %20 %20 %20 %20 %20if%20(urlLINK%20==%20null%20){%20//cancel%20pressed%20.%20.%20. %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else%20if%20(urlLINK%20==%20""%20||%20urlLINK%20==%20"%20"){%20//ok%20pressed%20but%20with%20Notext%20.%20.%20. %20 %20 %20 %20 %20 %20 %20 %20 %20alert("Sorry%20no%20text%20entered!"); %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else %20 %20 %20 %20 %20{%20//ok%20pressed%20and%20there%20is%20something%20:) %20 %20 %20 %20 %20//%20Enter%20Description%20................................... %20 %20 %20 %20 %20var%20urlNAME%20=%20prompt("Please%20enter%20URL%20name:",""); %20 %20 %20 %20 %20if%20(urlNAME%20==%20null%20){%20//cancel%20pressed%20.%20.%20. %20 %20 %20 %20 %20} %20 %20 %20 %20 %20else%20if%20(urlNAME%20==%20""%20||%20urlNAME%20==%20"%20"){ %20//ok%20pressed%20but%20with%20notext%20so%20use%20URL%20only! %20 %20 %20 %20 %20 %20 %20 %20 %20 %20surroundText(\'[url]\'+urlLINK+\'\',%20\'\', document.', $context['post_form'], '.', $context['post_box_name'], ');
             }
             else //ok pressed with text so use URL and Name!
                    surroundText(\'\'+urlNAME+\'\', \'\', document.', $context['post_form'], '.', $context['post_box_name'], ');
             }
          }
          // -->
          </script>';   [/code]

then find this code:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link. Now for the image and the closing </a>!
echo '<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'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


and replace it with this:
// Print the buttom row of buttons!
foreach ($context['bbc_tags'][1] as $image => $tag)
{
  if (isset($tag['before']))
{
// Is this tag disabled?
if (!empty($context['disabled_tags'][$tag['code']]))
continue;

// only replace the IMG tag! . . . . . . . . . . .
      if ($tag['code'] == 'img')
   {
global $tag;
echo '<a href="javascript:void(0);" onclick="imgINPT(); 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="Insert Image" title="Insert Image" border="0" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
// only replace the URL tag! . . . . . . . . . . .
      elseif ($tag['code'] == 'url')
   {
global $tag;
echo '<a href="javascript: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>';
}
else{
// If there's no after, we're just replacing the entire selection in the post box.
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';
// On the other hand, if there is one we are surrounding the selection ;).
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">';

// Okay... we have the link.  Now for the image and the closing </a>!
echo '<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>';
}
}
// I guess it's a divider...
else
echo '<img src="', $settings['images_url'], '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />';
}

echo '
</td>
</tr>';
}


When this is done, any new posts that are made, when the IMG or URL BBC tag is selected will pop-up a box.  For the IMG tag it is simply to put the url of the image, for the URL tag it will first ask for the link, then the text you want to display (if any) for the link.

[/quote]
[/quote]

Vinspire

Is it just me or this font colour is not working ?

is not working

unrelenting

Quote from: Vinspire on September 17, 2006, 11:40:40 AM
Is it just me or this font colour is not working ?

is not working

I can't get it to work either. It's been driving me nuts trying to fix it to no avail.

SMF 1.1 RC2

apristel

If I email or upload my Post.template.php file to someone, could you please make it so I have the drop down boxes and the input box for the hyperlink.. I'm not sure if this will make it pop up a box asking for the URL for the hyperlink..that is what  I want. That and the text size and whatever else. I guess anything  is better than without.

Thanks much

Here's my Post.template.php hosted on rapidshare.
hxxp:rapidshare.de/files/34746006/Post.template.php.htmlplate.php.html [nonactive]
This is the  one from the themes/default  folder of my forum. Is this the correct one?

TechnoDragon

as long as the post.template.php in your default is used by all of your other themes...then it will be the right one.

Here is the modified one...make sure to back up your old one just in case!

This makes the IMG, URL, FTP, and EMAIL tags pop-up when they are clicked...also adds the drop-down list for color, font, and size.

EDIT: oops, can't attach anything to these posts...I'll leave the zip file for you to download on my server for a few days to give you a chance to download it!
Post.Template.php
Don't tell me to get into shape...I have a shape...It is round!


tones_ie

Hi TechnoDragon...thanks for taking the time to edit and upload the post file.....However, would u know y i get the following error after replacing the default one with ures...

running SMF RC3...juno RC3

Template Parse Error!
There was a problem loading the Themes/default/Post.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
syntax error, unexpected T_ELSE


thanks in advance

TechnoDragon

usually that is a sign the the file was corrupted during upload...try uploading again and if it still does not work, then I will try and see what may have been coded wrong.
Don't tell me to get into shape...I have a shape...It is round!


tones_ie

Hay bud....thanks fo rthe reply....tried again and still the samme error....tried upload the file as is...and also editing the orig via ftp...both gave me the above error.... :(

TechnoDragon

Ok, think i figured it out...try downloading again as I corrected what I believe is the issue and let me know
Don't tell me to get into shape...I have a shape...It is round!


tones_ie

Hay there :)

tried again...same error... :(    appreciate ya trying....

TechnoDragon

Ok, now try...LOL...we'll get this figured out sooner or later!
Don't tell me to get into shape...I have a shape...It is round!


tones_ie

U da man !!  :)


Thank u sooo much for taking the time to fix this for RC3 :)  WORKS :)

promise...last request...

i attached an image of what i see....



2 questions,

How do i get the "boxes" the same sixe...(change color / font size)
how do i get those boxes  (drop down menus) to be under all the other buttons...


thanks again  :)

TechnoDragon

it is a unction of what is in there (the text) if you make the fonts and sizes generic (not disply the font face or size) then they would be the same height but not length.

As far as moving them, you would have to rearrange the code for the boxes to move them
Don't tell me to get into shape...I have a shape...It is round!


Advertisement: