Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorgarvin
    • CommentTimeJan 16th 2007 edited
     # 1
    Not sure if this would be an addon or just a CSS modification, but I'm looking for assistance to do this. Basically, I use one of my installs as a client manager. Ideally, all of our clients would use Vanilla to send in work orders or troubleshooting requests, etc. Unfortunately, not all do or want to because they are a bit technologically limited/knowledgable. So, clients will still call or email with their requests.

    BUT - We committed our staff to use Vanilla to keep track of all work order requests, etc. As it stands right now, if a client calls, we'll use BBCode, hit the quote button, and then insert the info that they provided either by copy/pasting the email or transcribing the main notes from the phone call. I'd like to organize it a bit better so that we aren't just quoting, as sometimes we also use the quote feature to reference to something also written in that specific discussion.

    It gets confusing, but without the Annotation extension out yet, I'm wondering if this would be an easier add-on to create and it would definitely help me and my situation. This is what I'm thinking.

    Basically, when you go to enter in a comment, you'd hit quote, and put the transcription or email into the quote area. But, you'd add another item to the quote tag:



    When you do this, it would call to a CSS file, which would place the specific icon and enter in text which would be pulled from the dictionary (that is created in the default.php). Like this:



    It would look exactly like the quote feature, except that it would say "Call From:" or "Email From:" and in some cases, "Notes from Meeting With:"

    How difficult would this be to create? Any takers? What I see is that it would be a small CSS file that includes the types and their icons, a default.php that would add an effect to the BBCode extension and would build a few definitions.
    •  
      CommentAuthorgarvin
    • CommentTimeJan 16th 2007
     # 2
    Icons from FamFamFam, by the way. Thanks to them for helping me with my concept art.
    •  
      CommentAuthor[-Stash-]
    • CommentTimeJan 16th 2007
     # 3
    I'd imagine this is something that could be worked into BBCodeParser along with a stylesheet/icons (a nice way to switch between styles would be good...). I've not looked too closely, but basically, we can do what we like with BBCode :)

    As this is really extending the original parser, an additional extension would make the most sense in my eyes.
    • CommentAuthorSirNot
    • CommentTimeJan 16th 2007 edited
     # 4
    I'll leave you with the css, but...
    $bbcode_quote_types = array(
    'email' => 'Email From',
    'call' => 'Call From',
    'notes' => 'Notes from Meeting with'
    );

    function _bbcode_quote($matches)
    {
    $type = strtolower($matches[6]);
    $name = $matches[3];

    $head = '';
    $extra = '';
    if(!empty($name))
    {
    $extra .= ' cite="'.htmlspecialchars($name).'"';
    $head .= '<h2>';

    if(isset($GLOBALS['bbcode_quote_types'][$type]))
    {
    $head .= $GLOBALS['bbcode_quote_types'][$type].': ';
    $extra .= ' class="'.ucfirst($type).'"';
    }

    $head .= $name.'</h2>';
    }

    return ('<blockquote'.$extra.'>'.$head.$matches[7].'</blockquote>');
    }

    function bbcode_quote($text)
    {
    $out = $text;

    do
    {
    $text = $out;
    $out = preg_replace_callback(
    '/\[quote(=(["\']?)([^\]]*?)\2)?(\s+type=(["\']?)([\w]+)\5)?]((.*?)|(?R))\[\/quote\]/is',
    '_bbcode_quote',
    $text
    );
    }
    while($out != $text);

    return $out;
    }
    •  
      CommentAuthorgarvin
    • CommentTimeJan 16th 2007
     # 5
    Sir Not, this would be added to the BBCode Parser extension, or the BBCode extension or... added to a new extension? I thank you for the code, just confused on where to add this.

    Thanks for the speedy replies, both of you.
    • CommentAuthorSirNot
    • CommentTimeJan 16th 2007
     # 6
    tell me which extension you're using and I'll see what you'd have to do
    •  
      CommentAuthorgarvin
    • CommentTimeJan 16th 2007
     # 7
    I am using BBInsertBar 0.1.5 and Better BB Code 1.0
    • CommentAuthorSirNot
    • CommentTimeJan 16th 2007
     # 8
    ugh, this is specialized enough that you can't really easily add it in there... I suppose your best bet is to shove a call somewhere after _buildParsedString() is finished (and also remove the quote functionality of parser).
    •  
      CommentAuthorgarvin
    • CommentTimeJan 16th 2007
     # 9
    Would it make more sense if I installed BBCode Parser? Then, add the above code to that?
    •  
      CommentAuthor[-Stash-]
    • CommentTimeJan 16th 2007
     # 10
    SirNot, what about slotting it into the BBCodeParser? Any easier in there?
    • CommentAuthorSirNot
    • CommentTimeJan 16th 2007
     # 11
    ok, try this...

    in the BBCodeParser.php, either comment out or delete lines 140-143 ('quote' array index), change line 71 of default.php ($String = $parser->qparse($String);) to $String = bbcode_quote($parser->qparse($String)); and then add in what I previously posted between the comment and class BetterBBCode... of default.php.
    •  
      CommentAuthorgarvin
    • CommentTimeJan 17th 2007
     # 12
    Ok. Made that update, however - I insert anything into the comment field and it doesn't show any of the comment, regardless if I put it inside of a quote tag or leave it without any bbcode markup. What would cause that?
    • CommentAuthorSirNot
    • CommentTimeJan 18th 2007 edited
     # 13
    you sure? you deleted/commented out this from the bbcodeparser.php:
                              'quote' => array( 'htmlopen'  => 'blockquote',
    'htmlclose' => 'blockquote',
    'allowed' => 'all',
    'attributes'=> array()),
    ? and added everything in the right spots in default.php? Everything's working fine on my installation.
    •  
      CommentAuthorgarvin
    • CommentTimeJan 18th 2007
     # 14
    Let me start off with a fresh version of Better BBCode, and I'll post if I continue to have the problems.
    •  
      CommentAuthorgarvin
    • CommentTimeJan 18th 2007
     # 15
    Here is my default.php of the Better BBCode extension:

    <?php
    /*
    Extension Name: Better BB Code
    Extension Url: http://lussumo.com/community/discussion/2161
    Description: A BBCode-to-HTML conversion tool for discussion comments
    Version: 1.0
    Author: Joel Bernstein
    Author Url: http://pong.uwstout.edu/
    */

    require_once('BBCodeParser.php');

    class BetterBBCodeFormatter extends StringFormatter
    {

    function Parse($String, $Object, $FormatPurpose)
    {
    $parser = new HTML_BBCodeParser();

    if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY)
    {
    $String = $this->ProtectString($String);
    return $parser->qparse($String);
    }
    else
    return $String;
    }

    function ProtectString ($String) {
    $String = str_replace("<", "&lt;", $String);
    $String = str_replace("\r\n", "<br />", $String);
    return $String;
    }

    }
    // Instantiate the bbcode object and add it to the string manipulation methods
    $BetterBBCodeFormatter = $Context->ObjectFactory->NewObject($Context, "BetterBBCodeFormatter");
    $Context->StringManipulator->AddManipulator("BBCode", $BetterBBCodeFormatter);
    ?>
    There are only 39 lines, and the line you said to change isn't in there. So I changed something that was similar and that caused it to not show anything. This is what I changed: {
    $String = $this->ProtectString($String);
    return $parser->qparse($String);
    }
    to {
    $String = $this->ProtectString($String);
    return bbcode_quote($parser->qparse($String));
    }
    That obviously doesn't work. Am I working on the wrong file? I think I am.
    • CommentAuthorSirNot
    • CommentTimeJan 18th 2007
     # 16
    oops, that's line 71 after the addition of the code...

    but yes, the line you changed is correct, now you need to add the code I posted above somewhere between the require_once('BBCodeParser.php'); and class BetterBBCodeFormatter ...
    •  
      CommentAuthorgarvin
    • CommentTimeJan 18th 2007
     # 17
    There it is. Awesome. Ok - I'll throw the CSS together to make this how I want. Thanks for the help, man. This looks great and fits exactly what I needed.
    •  
      CommentAuthorgarvin
    • CommentTimeJan 18th 2007 edited
     # 18
    Ok - Feeling kind of salty. I need the help of a CSS guy. This is what I am using for this in my vanilla.css file: #Comments .CommentBody blockquote .Email { background-image: url(images/icon_email.jpg); background-repeat: no-repeat; padding-left: 25px } Its not working though. Should I be calling for blockquote's email class differently? It doesn't seem to be effecting the blockquote at all.
    •  
      CommentAuthorgarvin
    • CommentTimeFeb 2nd 2007
     # 19
    Nevermind. Did what I needed to do. Thank you so much everyone that helped here.
Add your comments
    Username Password
  • Format comments as