165
166
def page_list(request):
166
167
from MoinMoin import search
167
name = request.form.get("pagename", [""])[0]
168
name = request.values.get("pagename", "")
169
170
searchresult = search.searchPages(request, 't:"%s"' % name)
170
171
pages = [p.page_name for p in searchresult.hits]
173
request.emit_http_headers()
175
175
'''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
365
##############################################################################
366
### Attachment dialog
367
##############################################################################
369
363
def attachment_dialog(request):
370
request.emit_http_headers()
372
name = request.form.get("pagename", [""])[0]
374
from MoinMoin import search
375
# XXX error handling!
376
searchresult = search.searchPages(request, 't:"%s"' % name)
378
pages = [p.page_name for p in searchresult.hits]
384
<select id="sctPagename" size="1" onchange="OnChangePagename(this.value);">
389
''' % "\n".join(['<option value="%s">%s</option>' % (page, page)
364
""" Attachment dialog for GUI editor. """
365
""" Features: This dialog can... """
366
""" - list attachments in a drop down list """
367
""" - list attachments also for a different page than the current one """
368
""" - create new attachment """
370
url_prefix_static = request.cfg.url_prefix_static
373
action = request.script_root + "/"
375
# The following code lines implement the feature "list attachments for a different page".
376
# Meaning of the variables:
377
# - requestedPagename : Name of the page where attachments shall be listed from.
378
# - attachmentsPagename : Name of the page where the attachments where retrieved from.
379
# - destinationPagename : Name of the page where attachment will be placed on.
381
requestedPagename = wikiutil.escape(request.values.get("requestedPagename", ""), quote=True)
382
destinationPagename = wikiutil.escape(request.values.get("destinationPagename", request.page.page_name), quote=True)
384
attachmentsPagename = requestedPagename or request.page.page_name
385
attachments = _get_files(request, attachmentsPagename)
388
<select id="sctAttachments" size="10" style="width:100%%;visibility:hidden;" onchange="OnAttachmentListChange();">
391
''' % "\n".join(['<option value="%s">%s</option>' % (wikiutil.escape(attachment, quote=True), wikiutil.escape(attachment, quote=True))
392
for attachment in attachments])
394
# Translation of dialog texts.
395
langAttachmentLocation = _("Attachment location")
396
langPagename = _("Page name")
397
langAttachmentname = _("Attachment name")
398
langListAttachmentsButton = _("Refresh attachment list")
399
langAttachmentList = _("List of attachments")
401
if len(attachmentsPagename) > 50:
402
shortenedPagename = "%s ... %s" % (attachmentsPagename[0:25], attachmentsPagename[-25:])
404
shortenedPagename = attachmentsPagename
405
langAvailableAttachments = "%s: %s" % (_("Available attachments for page"), shortenedPagename)
395
url_prefix_static = request.cfg.url_prefix_static
396
scriptname = request.getScriptname()
397
if not scriptname or scriptname[-1] != "/":
400
407
request.write('''
402
409
* FCKeditor - The text editor for internet
430
437
<script src="%(url_prefix_static)s/applets/moinFCKplugins/moinurllib.js" type="text/javascript"></script>
432
439
<body scroll="no" style="OVERFLOW: hidden">
434
<div id="divLinkTypeAttachment">
435
<table height="100%%" cellSpacing="0" cellPadding="0" width="100%%" border="0">
438
<form action=%(action)s method="GET">
439
<input type="hidden" name="action" value="fckdialog">
440
<input type="hidden" name="dialog" value="attachment">
441
<table cellSpacing="0" cellPadding="0" align="center" border="0">
444
<span fckLang="AttachmentDlgName">Attachment Name</span><br>
445
<input id="txtAttachmentname" name="pagename" size="30" value="%(name)s">
440
<form id="DlgAttachmentForm" name="DlgAttachmentForm" action=%(action)s method="GET">
441
<input type="hidden" name="action" value="fckdialog">
442
<input type="hidden" name="dialog" value="attachment">
443
<input type="hidden" id="requestedPagename" name="requestedPagename" value="%(requestedPagename)s">
444
<input type="hidden" id="attachmentsPagename" name="attachmentsPagename" value="%(attachmentsPagename)s">
445
<input type="hidden" id="destinationPagename" name="destinationPagename" value="%(destinationPagename)s">
447
<div id="divInfo" style="valign=top;">
448
<div id="divLinkTypeAttachment">
450
<legend>%(langAttachmentLocation)s</legend>
451
<table cellSpacing="0" cellPadding="0" width="100%%" border="0">
453
<td valign="bottom" style="width:90%%" style="padding-bottom:10px">
454
<span>%(langPagename)s</span><br>
458
<td valign="bottom" style="width:100%%" style="padding-bottom:10px;padding-right:10px;">
459
<input id="txtPagename" type="text" onkeyup="OnPagenameChange();" onchange="OnPagenameChange();" style="width:98%%">
463
<td valign="bottom" style="width:90%%" style="padding-bottom:10px;">
464
<span>%(langAttachmentname)s</span><br>
468
<td valign="bottom" style="width:100%%" style="padding-bottom:10px;padding-right:10px;">
469
<input id="txtAttachmentname" type="text" onkeyup="OnAttachmentnameChange();" onchange="OnPagenameChange();" style="width:98%%"><br>
475
<legend>%(langAvailableAttachments)s</legend>
476
<table cellSpacing="0" cellPadding="0" width="100%%" border="0">
478
<td valign="bottom" style="width:100%%" style="padding-bottom:10px">
479
<input id="btnListAttachments" type="submit" value="%(langListAttachmentsButton)s">
483
<td valign="top" style="padding-top:10px">
484
<label for="sctAttachments">%(langAttachmentList)s</label><br>
459
498
##############################################################################
461
500
##############################################################################
463
502
def image_dialog(request):
464
request.emit_http_headers()
465
503
url_prefix_static = request.cfg.url_prefix_static
466
504
request.write('''