mourningdove/htdocs/imguploadrte.bml
2026-05-24 01:03:05 +00:00

233 lines
12 KiB
Text

<?_c
# This code was forked from the LiveJournal project owned and operated
# by Live Journal, Inc. The code has been modified and expanded by
# Dreamwidth Studios, LLC. These files were originally licensed under
# the terms of the license supplied by Live Journal, Inc, which can
# currently be found at:
#
# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
#
# In accordance with the original license, this code and all its
# modifications are provided under the GNU General Public License.
# A copy of that license can be found in the LICENSE file included as
# part of this distribution.
_c?>
<?_code
{
use strict;
use vars qw(%GET);
# $_[1] is a pre-request scratch area
# put variables here so that we can access them later
# outside of this _code block
my $head = \$_[1]->{'head'};
my $body = \$_[1]->{'body'};
my $u = LJ::User->remote;
return "<?needlogin?>" unless $u;
LJ::need_res( "stc/display_none.css",
"js/browserdetect.js" );
my $js = "";
if ($GET{upload_count} || LJ::did_post()) {
if (my $ct = $GET{upload_count}) {
$js .= "<script>\n";
for my $pn (1..$ct) {
my $swidth = int($GET{"sw_$pn"});
my $sheight = int($GET{"sh_$pn"});
my $esurl = LJ::ejs($GET{"su_$pn"});
my $eppurl = LJ::ejs($GET{"pp_$pn"});
$js .= "window.onload = function () { window.setTimeout(\"InObFCK.onUpload('$esurl','$eppurl',$swidth,$sheight);\",500) }\n";
}
$js .= "</script>\n";
}
}
my $step = 1;
my $ret = '';
$$head .= qq{
<style>
.insobjOuter { }
.insobjTitle { vertical-align: top; }
.insobjNav { text-align: right; vertical-align: middle; padding-top: 6px;}
.insobjContent { padding-bottom: 15px; }
table { margin: 0px}
div.insobjOuter p.wintitle { font: 12pt; font-weight: bold; }
.insobjOuter div.ex { font: 8pt sans-serif; color: #888; font-style: italic;}
.img_error { color: red; font-weight: bold; text-align: center; }
</style>
<script src="$LJ::STATPREFIX/fck/editor/dialog/common/fck_dialog_common.js" type="text/javascript"></script>
<script src="$LJ::STATPREFIX/fck/editor/dialog/fck_image/fck_image.js" type="text/javascript"></script>
$js
<link href="$LJ::STATPREFIX/fck/editor/dialog/common/fck_dialog_common.css" rel="stylesheet" type="text/css" />
};
#taken from the original fck_image.html
#insert HTML for an image tag, given an image URL and assorted metadata (alt text, dimensions, etc)
# get the link to the alt text faq
my $faq;
unless ( $faq = LJ::Hooks::run_hook( 'faqlink', 'alttext', $ML{'/imgupload.bml.insertimage.alt.faqlink'} ) ) {
$faq = $ML{'/imgupload.bml.insertimage.alt.faqlink'};
}
$ret .= qq{
<div id="divInfo">
<table summary='' cellspacing="1" cellpadding="1" border="0" width="99%" height="99%">
<tr>
<td>
<table summary='' cellspacing="0" cellpadding="0" width="99%" border="0">
<tr>
<td width="100%"><span fckLang="DlgImgURL">URL</span></td>
<td id="tdBrowse" style="DISPLAY: none" nowrap rowspan="2">&nbsp; <input id="btnBrowse" onclick="BrowseServer();" type="button" value="Browse Server" fckLang="DlgBtnBrowseServer"></td></tr>
<tr>
<td valign="top"><input id="txtUrl" style="WIDTH: 99%" type="text" onblur="UpdatePreview();"></td></tr>
</table>
</td></tr>
<tr>
<td><span fckLang="DlgImgAlt">Short Description</span><br />
<input id="txtAlt" style="WIDTH: 80%" type="text"><br />
$ML{'/imgupload.bml.insertimage.alt.body'} $faq.<br />
</td></tr>
<tr height="100%">
<td valign="top">
<table summary='' cellspacing="0" cellpadding="0" width="99%" border="0" height="99%">
<tr>
<td valign="top">
<br />
<table summary='' cellspacing="0" cellpadding="0" border="0">
<tr>
<td nowrap><span fckLang="DlgImgWidth">Width</span>&nbsp;</td>
<td>
<input type="text" size="3" id="txtWidth" onkeyup="OnSizeChanged('Width',this.value);"></td>
<td nowrap rowspan="2"> <div id="btnLockSizes" class="BtnLocked" onmouseover="this.className = (bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ) + ' BtnOver';"
onmouseout="this.className = (bLockRatio ? 'BtnLocked' : 'BtnUnlocked' );" title="Lock Sizes" onclick="SwitchLock(this);"></div>
<div id="btnResetSize" class="BtnReset" onmouseover="this.className='BtnReset BtnOver';" onmouseout="this.className='BtnReset';" title="Reset Size" onclick="ResetSizes();"></div>
</td></tr>
<tr>
<td nowrap><span fckLang="DlgImgHeight">Height</span>&nbsp;</td>
<td><input type="text" size="3" id="txtHeight" onkeyup="OnSizeChanged('Height',this.value);"></td></tr>
</table>
<br />
<table summary='' cellspacing="0" cellpadding="0" border="0">
<tr>
<td nowrap><span fckLang="DlgImgBorder">Border</span>&nbsp;</td>
<td><input type="text" size="2" value="" id="txtBorder" onkeyup="UpdatePreview();"></td></tr>
<tr>
<td nowrap><span fckLang="DlgImgHSpace">HSpace</span>&nbsp;</td>
<td><input type="text" size="2" id="txtHSpace" onkeyup="UpdatePreview();"></td></tr>
<tr>
<td nowrap><span fckLang="DlgImgVSpace">VSpace</span>&nbsp;</td>
<td><input type="text" size="2" id="txtVSpace" onkeyup="UpdatePreview();"></td></tr>
<tr>
<td nowrap><span fckLang="DlgImgAlign">Align</span>&nbsp;</td>
<td>
<select id="cmbAlign" onchange="UpdatePreview();">
<option value="" selected></option>
<option fckLang="DlgImgAlignLeft" value="left">Left</option>
<option fckLang="DlgImgAlignAbsBottom" value="absBottom">Abs Bottom</option>
<option fckLang="DlgImgAlignAbsMiddle" value="absMiddle">Abs Middle</option>
<option fckLang="DlgImgAlignBaseline" value="baseline">Baseline</option>
<option fckLang="DlgImgAlignBottom" value="bottom">Bottom</option>
<option fckLang="DlgImgAlignMiddle" value="middle">Middle</option>
<option fckLang="DlgImgAlignRight" value="right">Right</option>
<option fckLang="DlgImgAlignTextTop" value="textTop">Text Top</option>
<option fckLang="DlgImgAlignTop" value="top">Top</option>
</select></td></tr>
</table></td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td width="100%" valign="top">
<table summary='' cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT: fixed">
<tr>
<td><span fckLang="DlgImgPreview">Preview</span></td></tr>
<tr>
<td valign="top">
<iframe class="ImagePreviewArea" src="$LJ::SITEROOT/imgpreview" frameborder="no" marginheight="0" marginwidth="0"></iframe>
</td></tr>
</table></td></tr>
</table></td></tr>
</table>
</div>
};
# taken from orig fck_image.html
# link tab
$ret .= qq{
<script>InObFCK.setupIframeHandlers();</script>
<div id="divLink" style="DISPLAY: none">
<table summary='' cellspacing="1" cellpadding="1" border="0" width="100%">
<tr>
<td>
<div>
<span fckLang="DlgLnkURL">URL</span><br />
<input id="txtLnkUrl" style="WIDTH: 100%" type="text" onblur="UpdatePreview();" />
</div>
<div>This link will wrap around the image you have inserted.</div>
<div id="divLnkBrowseServer" align="right">
<input type="button" value="Browse Server" fckLang="DlgBtnBrowseServer" onclick="LnkBrowseServer();" />
</div>
</td></tr>
</table>
</div>
<div id="divAdvanced" style="DISPLAY: none">
<table summary='' cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tr>
<td valign="top" width="50%">
<span fckLang="DlgGenId">Id</span><br />
<input id="txtAttId" style="WIDTH: 100%" type="text">
</td>
<td width="1">&nbsp;&nbsp;</td>
<td valign="top">
<table summary='' cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tr>
<td width="60%">
<span fckLang="DlgGenLangDir">Language Direction</span><br />
<select id="cmbAttLangDir" style="WIDTH: 100%">
<option value="" fckLang="DlgGenNotSet" selected>&lt;not set&gt;</option>
<option value="ltr" fckLang="DlgGenLangDirLtr">Left to Right (LTR)</option>
<option value="rtl" fckLang="DlgGenLangDirRtl">Right to Left (RTL)</option>
</select>
</td>
<td width="1%">&nbsp;&nbsp;</td>
<td nowrap>
<span fckLang="DlgGenLangCode">Language Code</span><br />
<input id="txtAttLangCode" style="WIDTH: 100%" type="text">&nbsp;
</td></tr>
</table></td></tr>
<tr>
<td colspan="3">&nbsp;</td></tr>
<tr>
<td colspan="3">
<span fckLang="DlgGenLongDescr">Long Description URL</span><br />
<input id="txtLongDesc" style="WIDTH: 100%" type="text">
</td></tr>
<tr>
<td colspan="3">&nbsp;</td></tr>
<tr>
<td valign="top">
<span fckLang="DlgGenClass">Stylesheet Classes</span><br />
<input id="txtAttClasses" style="WIDTH: 100%" type="text">
</td>
<td></td>
<td valign="top">&nbsp;<span fckLang="DlgGenTitle">Advisory Title</span><br />
<input id="txtAttTitle" style="WIDTH: 100%" type="text">
</td></tr>
</table>
<span fckLang="DlgGenStyle">Style</span><br />
<input id="txtAttStyle" style="WIDTH: 100%" type="text">
</div>
};
$$body = $ret;
$$head .= LJ::res_includes();
return;
}
_code?>
<html>
<head>
<?_code return $_[1]->{'head'}; _code?>
</head>
<body>
<?_code return $_[1]->{'body'}; _code?>
</body>
</html>