removing hardcoded 'view image' string ("fixes" title in lightbox)

This commit is contained in:
real_nowhereman 2009-02-25 13:00:34 +00:00
parent 0ec2ae43a3
commit 5944f87bb8
9 changed files with 998 additions and 673 deletions

View File

@ -18,7 +18,7 @@
{html_form}
<div id="admin-config">
<div id="admin-config" class="option-set">
<div id="admin-config-general">

View File

@ -468,11 +468,11 @@ li.widget-class {
/* ===== CONFIG PANEL ===== */
#admin-config dl {
.option-set dl {
margin-bottom: 4em;
}
#admin-config dt {
.option-set dt {
width: 33%;
text-align:right;
margin-top: 1.8em;
@ -480,23 +480,23 @@ li.widget-class {
font-weight: bold;
}
#admin-config dt label {
.option-set dt label {
padding-top: .2em;
}
#admin-config dd {
.option-set dd {
margin-left: 35%;
margin-top: -1.7em;
line-height: 1.5em;
}
#admin-config dd p {
.option-set dd p {
margin: 0;
}
#admin-config dd input{
.option-set dd input{
margin-bottom: .2em;
}
@ -508,18 +508,18 @@ li.widget-class {
font-weight: bold;
}
#admin-config input.textinput ,
#admin-config select.textinput {
.option-set input.textinput ,
.option-set select.textinput {
width: 20em;
}
#admin-config input.bigtextinput {
.option-set input.bigtextinput {
width: 30em;
}
#admin-config input.smalltextinput {
.option-set input.smalltextinput {
width: 5em;
}

View File

@ -0,0 +1,56 @@
<?php
$lang['admin']['plugin']['submenu']['bbcode'] = 'BBCode';
$lang['admin']['plugin']['bbcode'] = array(
'head' => 'BBCode Configuration',
'desc1' => 'This plugin allows using <a href="http://www.phpbb.com/'.
'phpBB/faq.php?mode=bbcode">BBCode</a> markup and provides '.
'automatic integration with lightbox (when also enabled).',
'options' => 'Options',
'editing' => 'Editing',
'allow_html'=> 'Inline HTML',
'allow_html_long' => 'Enable using HTML along with BBCode',
'toolbar' => 'Toolbar',
'toolbar_long' => 'Enable the editor toolbar.',
'other' => 'Other options',
'comments' => 'Comments',
'comments_long' => 'Allow BBCode in comments',
'urlmaxlen' => 'URL max length',
'urlmaxlen_long_pre' => 'Shorten URLs longer than ',
'urlmaxlen_long_post'=>' characters.',
'submit' => 'Save configuration',
'msgs' => array(
1 => 'BBCode configuration successful saved.',
-1 => 'BBCode configuration not saved.'
),
'editor' => array(
'formatting' => 'Formatting',
'textarea' => 'Textarea: ',
'expand' => 'Expand',
'expandtitle' => 'Expand Textarea Height',
'reduce' => 'Reduce',
'reducetitle' => 'Reduce Textarea Height',
// note: accesskeys are not internationalized...
// btw. why not :-D
'bold' => 'B',
'boldtitle' => 'Bold',
'italic' => 'I',
'italictitle' => 'Italic',
'underline' => 'U',
'underlinetitle' => 'Underlined',
'quote' => 'Quote',
'quotetitle' => 'Quote',
'code' => 'Code',
'codetitle' => 'Code',
'help' => 'BBCode Help',
// currently not used
'status' => 'Status bar',
'statusbar' => 'Normal mode. Press &lt;Esc&gt; to switch editing mode.'
)
);
?>

View File

@ -0,0 +1,69 @@
<?php
if (class_exists('AdminPanelAction')){
/**
* Provides an admin panel entry for QuickSpam setup.
*/
class admin_plugin_bbcode extends AdminPanelAction {
var $langres = 'plugin:bbcode';
/**
* Initializes this panel.
*/
function setup() {
$this->smarty->assign('admin_resource', "plugin:bbcode/admin.plugin.bbcode");
}
/**
* Setups the default panel.
*/
function main() {
$bbconf = plugin_getoptions('bbcode');
// pass sane values to form... is this really needed?
$this->smarty->assign(
'bbchecked',
array(
isset($bbconf['escape-html']) && $bbconf['escape-html']
? 1
: 0,
isset($bbconf['escape-html']) && $bbconf['comments']
? 1
: 0,
isset($bbconf['escape-html']) && $bbconf['editor']
? 1
: 0
)
);
$bbconf['number'] = isset($bbconf['url-maxlen']) && is_numeric($bbconf['url-maxlen'])
? $bbconf['url-maxlen']
: 40;
$this->smarty->assign('bbconf', $bbconf);
}
/**
* Will be executed when the BBCode configuration is send.
*
* @return int
*/
function onsubmit() {
if (isset($_POST['bb-conf'])){
$maxlen = isset($_POST['bb-maxlen']) && is_numeric($_POST['bb-maxlen'])
? (int)$_POST['bb-maxlen']
: 40;
plugin_addoption('bbcode', 'escape-html', isset($_POST['bb-allow-html']));
plugin_addoption('bbcode', 'comments', isset($_POST['bb-comments']));
plugin_addoption('bbcode', 'editor', isset($_POST['bb-toolbar']));
plugin_addoption('bbcode', 'url-maxlen', $maxlen);
plugin_saveoptions('bbcode');
$this->smarty->assign('success', 1);
} else {
$this->smarty->assign('success', -1);
}
return 2;
}
}
admin_addpanelaction('plugin', 'bbcode', true);
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,9 @@
img.floatleft
{
float:left;
padding-right:10px;
}
img.floatright
{
float:right;
padding-left:10px;
img.floatleft {
float:left;
padding-right:10px;
}
img.floatright {
float:right;
padding-left:10px;
}

View File

@ -1,88 +1,66 @@

// --------------------------------------------------------------------------
function insertAtCursor(element, start, end) {
element = document.getElementById(element);
// IE
if (document.selection) {
element.focus();
caretPos = document.selection.createRange().duplicate();
caretPos.text = start + caretPos.text + end;
if (caretPos.text.length == 0)
{
caretPos.moveStart("character", -end.length);
caretPos.moveEnd("character", -end.length);
caretPos.select();
}
element.focus(caretPos);
// MOZILLA
} else if (element.selectionStart || element.selectionStart == '0') {
element.focus();
var startPos = element.selectionStart;
var endPos = element.selectionEnd;
var preTxt = element.value.substring(0, startPos);
var selTxt = element.value.substring(startPos, endPos) ;
var follTxt = element.value.substring(endPos, element.value.length);
var scrollPos = element.scrollTop;
element.value = preTxt + start + selTxt + end + follTxt;
if (element.setSelectionRange)
{
if (selTxt.length == 0)
element.setSelectionRange(startPos + start.length, startPos + start.length);
else
element.setSelectionRange(startPos, startPos + start.length + selTxt.length + end.length);
element = document.getElementById(element);
if (document.selection) {
// IE
element.focus();
caretPos = document.selection.createRange().duplicate();
caretPos.text = start + caretPos.text + end;
if (caretPos.text.length == 0) {
caretPos.moveStart("character", -end.length);
caretPos.moveEnd("character", -end.length);
caretPos.select();
}
element.focus(caretPos);
} else if (element.selectionStart || element.selectionStart == '0') {
// MOZILLA
element.focus();
var startPos = element.selectionStart;
var endPos = element.selectionEnd;
var preTxt = element.value.substring(0, startPos);
var selTxt = element.value.substring(startPos, endPos) ;
var follTxt = element.value.substring(endPos, element.value.length);
var scrollPos = element.scrollTop;
element.value = preTxt + start + selTxt + end + follTxt;
if (element.setSelectionRange) {
if (selTxt.length == 0) {
element.setSelectionRange(startPos + start.length, startPos + start.length);
} else {
element.setSelectionRange(startPos, startPos + start.length + selTxt.length + end.length);
}
element.focus();
}
element.scrollTop = scrollPos;
} else {
element.value += start + end;
}
element.scrollTop = scrollPos;
} else {
element.value += start + end;
}
}
// calling the function
// insertAtCursor(document.formName.fieldName, this value);
function insBBCode(code) {
insertAtCursor('content', '[' + code + ']','[/' + code + ']');
}
function insImage(val) {
if (val !='--')
insertAtCursor('content', '[img=images/'+val+']',' ');
if (val != '--') {
insertAtCursor('content', '[img=images/'+val+']',' ');
}
}
function insAttach(val) {
if (val !='--')
insertAtCursor('content', '[url=attachs/'+val+']','[/url]');
if (val !='--') {
insertAtCursor('content', '[url=attachs/'+val+']','[/url]');
}
}
//-------------------------------------------------------------------------
// if false, tab move to next element
var bbcode_editmode = true;
var bbcode_editmode = true; // if false, tab move to next element
function tabKeyOverrider() {
// Observe keypress on these fields
if (Event.observe)
if (Event.observe) {
Event.observe($('content'), 'keypress', checkTab);
}
}
var bbcode_mode_trapTab = false;
@ -93,7 +71,6 @@ var bbcode_mode_trapTab = false;
// At this time we're just using the altkey function (which is not that bad anyway)
function checkTab(evt) {
if (evt.keyCode == Event.KEY_ESC) {
if (bbcode_mode_trapTab) {
var bar = $('bbcode_statusbar');
@ -107,50 +84,43 @@ function checkTab(evt) {
bbcode_mode_trapTab = true;
}
}
if (!bbcode_mode_trapTab)
if (!bbcode_mode_trapTab) {
return;
}
// Set desired tab- defaults to four space softtab
var tab = "\t";
var t = evt.target;
var ss = t.selectionStart;
var se = t.selectionEnd;
// Tab key - insert tab expansion
if (evt.keyCode == 9) {
evt.preventDefault();
// Special case of multi line selection
if (ss != se && t.value.slice(ss,se).indexOf("\n") != -1) {
// In case selection was not of entire lines (e.g. selection begins in the middle of a line)
// we ought to tab at the beginning as well as at the start of every following line.
var pre = t.value.slice(0,ss);
var sel = t.value.slice(ss,se).replace(/\n/g,"\n"+tab);
var post = t.value.slice(se,t.value.length);
t.value = pre.concat(tab).concat(sel).concat(post);
t.selectionStart = ss + tab.length;
t.selectionEnd = se + tab.length;
}
var t = evt.target;
var ss = t.selectionStart;
var se = t.selectionEnd;
// Tab key - insert tab expansion
if (evt.keyCode == 9) {
evt.preventDefault();
// Special case of multi line selection
if (ss != se && t.value.slice(ss,se).indexOf("\n") != -1) {
// In case selection was not of entire lines (e.g. selection begins in the middle of a line)
// we ought to tab at the beginning as well as at the start of every following line.
var pre = t.value.slice(0, ss);
var sel = t.value.slice(ss, se).replace(/\n/g, "\n"+tab);
var post = t.value.slice(se, t.value.length);
t.value = pre.concat(tab).concat(sel).concat(post);
t.selectionStart = ss + tab.length;
t.selectionEnd = se + tab.length;
}
// "Normal" case (no selection or selection on one line only)
else {
t.value = t.value.slice(0,ss).concat(tab).concat(t.value.slice(ss,t.value.length));
if (ss == se) {
t.selectionStart = t.selectionEnd = ss + tab.length;
}
else {
t.selectionStart = ss + tab.length;
t.selectionEnd = se + tab.length;
}
t.value = t.value.slice(0, ss).concat(tab).concat(t.value.slice(ss, t.value.length));
if (ss == se) {
t.selectionStart = t.selectionEnd = ss + tab.length;
}
else {
t.selectionStart = ss + tab.length;
t.selectionEnd = se + tab.length;
}
}
}
}
if (typeof(Event.observe)=='function') //prototype is loaded
{ Event.observe(window, 'load', tabKeyOverrider, false) }
if (typeof(Event.observe) == 'function') {
//prototype is loaded
Event.observe(window, 'load', tabKeyOverrider, false)
}

View File

@ -0,0 +1,60 @@
<h2>{$plang.head}</h2>
<p>{$plang.desc1}</p>
{include file=shared:errorlist.tpl}
{html_form class="config-panel"}
<h2>{$plang.editing}</h2>
<dl>
<dt><label for="bb-escape-html">
{$plang.allow_html}
</label></dt>
<dd>
<p><input type="checkbox" name="bb-allow-html" id="bb-allow-html" {if $bbchecked[0]}checked="checked"{/if} />
{$plang.allow_html_long}</p>
</dd>
<dt><label for="bb-toolbar">
{$plang.toolbar}
</label></dt>
<dd>
<p><input type="checkbox" name="bb-toolbar" id="bb-toolbar" {if $bbchecked[2]}checked="checked"{/if} />
{$plang.toolbar_long}</p>
</dd>
</dl>
<h2>{$plang.other}</h2>
<dl>
<dt><label for="bb-comments">
{$plang.comments}
</label></dt>
<dd>
<p><input type="checkbox" name="bb-comments" id="bb-comments" {if $bbchecked[1]}checked="checked"{/if} />
{$plang.comments_long} </p>
</dd>
<dt><label for="bb-urlmaxlen">
{$plang.urlmaxlen}
</label></dt>
<dd>
<p>{$plang.urlmaxlen_long_pre}
<input type="text" name="bb-maxlen" size="3" value="{$bbconf.number}">
{$plang.urlmaxlen_long_post}</p>
</dd>
</dl>
<label>
{$plang.opn4pre}
{$plang.opn4post}
</label>
<p class="buttonbar">
<input type="submit" name="bb-conf" value="{$plang.submit}"/>
</p>
{/html_form}

View File

@ -1,30 +1,34 @@
<fieldset id="admin-bbcode-toolbar"><legend>Formatting</legend>
<fieldset id="admin-bbcode-toolbar">
<legend>{$lang.admin.plugin.bbcode.editor.formatting}</legend>
<div class="alignright">
Textarea:
<input type="button" name="expand" id="expand" value="Expand" title="Expand Textarea Height" onclick="form.content.rows+=5;" />
<input type="button" name="reduce" id="reduce" value="Reduce" title="Reduece Textarea Height" onclick="form.content.rows-=5;" />
{$lang.admin.plugin.bbcode.editor.textarea}
<input type="button" name="expand" id="expand" value="{$lang.admin.plugin.bbcode.editor.expand}" title="{$lang.admin.plugin.bbcode.editor.expandtitle}" onclick="form.content.rows+=5;" />
<input type="button" name="reduce" id="reduce" value="{$lang.admin.plugin.bbcode.editor.reduce}" title="{$lang.admin.plugin.bbcode.editor.reducetitle}" onclick="form.content.rows-=5;" />
</div>
<p><input type="button" name="bb_b" id="bb_b" value="B" accesskey="b" title="Bold" onclick="insBBCode('b');" />
<input type="button" name="bb_i" id="bb_i" value="I" accesskey="i" title="Italic" onclick="insBBCode('i');" />
<input type="button" name="bb_u" id="bb_u" value="U" accesskey="u" title="Underlined" onclick="insBBCode('u');" />
<input type="button" name="bb_c" id="bb_c" value="Quote" accesskey="q" title="Quote" onclick="insBBCode('quote');" />
<input type="button" name="bb_q" id="bb_q" value="Code" accesskey="c" title="Code" onclick="insBBCode('code');" />
</p>
<p>
{html_options name=attachselect values=$attachs_list output=$attachs_list onchange="insAttach(this.form.attachselect.value)"}
{html_options name=imageselect values=$images_list output=$images_list onchange="insImage(this.form.imageselect.value)"}
<input type="button" name="bb_b" id="bb_b" value="{$lang.admin.plugin.bbcode.editor.bold}" accesskey="b" title="{$lang.admin.plugin.bbcode.editor.boldtitle}" onclick="insBBCode('b');" />
<input type="button" name="bb_i" id="bb_i" value="{$lang.admin.plugin.bbcode.editor.italic}" accesskey="i" title="{$lang.admin.plugin.bbcode.editor.italictitle}" onclick="insBBCode('i');" />
<input type="button" name="bb_u" id="bb_u" value="{$lang.admin.plugin.bbcode.editor.underline}" accesskey="u" title="{$lang.admin.plugin.bbcode.editor.underlinetitle}" onclick="insBBCode('u');" />
<input type="button" name="bb_c" id="bb_c" value="{$lang.admin.plugin.bbcode.editor.quote}" accesskey="q" title="{$lang.admin.plugin.bbcode.editor.quotetitle}" onclick="insBBCode('quote');" />
<input type="button" name="bb_q" id="bb_q" value="{$lang.admin.plugin.bbcode.editor.code}" accesskey="c" title="{$lang.admin.plugin.bbcode.editor.codetitle}" onclick="insBBCode('code');" />
</p>
</fieldset>
<p class="alignright"><a class="hint externlink" href="http://wiki.flatpress.org/doc:plugins:bbcode">BBCode Help</a></p>
{*
{if function_exists('plugin_jsutils_head')}
<fieldset><legend>Status bar</legend>
<div id="bbcode_statusbar" style="background: green; color: white;">Normal mode. Press &lt;Esc&gt; to switch editing mode.</div>
</fieldset>
{/if}
*}
<p>
{html_options name=attachselect values=$attachs_list output=$attachs_list onchange="insAttach(this.form.attachselect.value)"}
{html_options name=imageselect values=$images_list output=$images_list onchange="insImage(this.form.imageselect.value)"}
</p>
</fieldset>
<p class="alignright">
<a class="hint externlink" href="http://wiki.flatpress.org/doc:plugins:bbcode">{$lang.admin.plugin.bbcode.editor.help}</a>
</p>
{*
{if function_exists('plugin_jsutils_head')}
<fieldset>
<legend>{$lang.admin.plugin.bbcode.editor.status}</legend>
<div id="bbcode_statusbar" style="background: green; color: white;">
{$lang.admin.plugin.bbcode.editor.statusbar}
</div>
</fieldset>
{/if}
*}