Comparing revisions for GrabCodeHandler

Additions:
Documentation: ""GrabCodeHandlerInfo"".>>This is the development page for the Grab Code handler.::c::
In the future, admin-configurable options will be added to allow:
~1) //switching this option on/off//;
~1) display a download button only for code blocks //longer than n lines//.
''[2004-02-17] - I've uploaded this handler on this server as a beta feature. Feedback is welcome. See the **issues** section at the bottom of this page for more details.''
return $output;
}
//build form
$form = $wakka->FormOpen("grabcode");
$form .= '<input type="submit" class="grabcodebutton" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();

// output
return $output.'\n'.$form;
}
~~& Good point. As we discussed, I can't give a class to the form using the FormOpen action, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
// grabcode handler
elseif ($this->method == "grabcode")
{
print($this->Method($this->method));
}
CategoryDevelopment
Deletions:
Documentation: ""GrabCodeHandlerInfo""
Other: ImprovedFormatter.>>This is the development page for the Grab Code handler.::c::
===Changelog===
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy&rev=51&stop_rev=49&mode=stop_on_copy 49-51]]): code block syntax now accepts an optional value for filename: ##""%%(php;12;myfile.php) ... %%""##. If ##filename## is specified a small header for the code block is generated, and ##filename## is used as a title for the download button and as a name for the downloadable file.
~-[2004-02-17] --- I've uploaded this handler on this server as a beta feature. Feedback is welcome. See the **issues** section at the bottom of this page for more details.
return $output;
}
//build form
$form = $wakka->FormOpen("grabcode");
$form .= '<input type="submit" class="grabcodebutton" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();

// output
return "$output \n $form";
}
~~& Good point. As we discussed, I can't give a class to the form using the ##""FormOpen()""## method, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar
~~~&See AdvancedFormOpen for a solution. --JavaWoman
~&Now that AdvancedFormOpen and ImprovedFormatter have both been installed on this site as a [[WikkaBetaFeatures beta feature]], I've adapted the code above slightly to take advantage of the capability of the new ##""FormOpen()""## method to add a class to the form. The new code is now as follows:%%(php;334) #return $output;
// START DarTar modified 2005-02-17
// slight mod JavaWoman 2005-06-12: coding style, class for form
//build form
$form = $wakka->FormOpen('grabcode','','post','','grabcode');
$form .= '<input type="submit" name="save" class="grabcodebutton" style="line-height:10px; float:right; vertical-align: middle; margin-right:20px; margin-top:0px; font-size: 10px; color: #000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" value="Grab" title="Download this code" />';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();
// output
return $output."\n".$form;
// END DarTar modified 2005-02-17
%%---(See ImprovedFormatter for the full code.)
~&With this, every grabcode form gets a class 'grabcode' which can now be used to properly style the form (the styling still needs to be done, though, and will make the embedded style for the button superfluous). --JavaWoman
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
// grabcode handler
elseif ($this->method == "grabcode")
{
print($this->Method($this->method));
}
CategoryDevelopmentHandlers
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki