Author: k_vertigo
Date: Sun Aug 29 16:26:37 2004
New Revision: 2920
Added:
ATReferenceBrowserWidget/
ATReferenceBrowserWidget/trunk/
ATReferenceBrowserWidget/trunk/ATRefBrowserDemo.py
ATReferenceBrowserWidget/trunk/ATReferenceBrowserWidget.py
ATReferenceBrowserWidget/trunk/Extensions/
ATReferenceBrowserWidget/trunk/Extensions/Install.py
ATReferenceBrowserWidget/trunk/__init__.py
ATReferenceBrowserWidget/trunk/config.py
ATReferenceBrowserWidget/trunk/readme.txt
ATReferenceBrowserWidget/trunk/refresh.txt
ATReferenceBrowserWidget/trunk/skins/
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser.js
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser.pt
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser_popup.pt
ATReferenceBrowserWidget/trunk/version.txt
Log:
- import for ender - danny bloemendaal
Added: ATReferenceBrowserWidget/trunk/ATRefBrowserDemo.py
==============================================================================
--- (empty file)
+++ ATReferenceBrowserWidget/trunk/ATRefBrowserDemo.py Sun Aug 29 16:26:37 2004
@@ -0,0 +1,36 @@
+""" demonstrates the use of ATReferenceBrowserWidget """
+
+from Products.Archetypes.public import *
+from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import *
+
+
+schema = BaseSchema + Schema((
+ ReferenceField('singleRef',
+ multiValued=0,
+ allowed_types=('ATDocument','ATFile', 'Article',
'ATRefBrowserDemo'),
+ relationship='Rel1',
+
widget=ReferenceBrowserWidget(default_search_index='SearchableText',
description='This is the first field. Pick an object.')),
+ ReferenceField('multiRef',
+ multiValued=1,
+ relationship='Rel2',
+ widget=ReferenceBrowserWidget(show_indexes=1,
description='And here is another field.')) ,
+ ReferenceField('multiRef2',
+ multiValued=1,
+ relationship='Rel3',
+ widget=ReferenceBrowserWidget(allow_search=1,
+ allow_browse=0,
+ show_indexes=1,
+
available_indexes={'SearchableText':'Free text search',
+
'Description': "Object's description"},
+ description='And here is
another field.')) ,
+ ))
+
+class ATRefBrowserDemo(BaseContent):
+ """
+ Demo from ATReferenceBrowserWidget
+ """
+ content_icon = "document_icon.gif"
+ schema = schema
+
+
+registerType(ATRefBrowserDemo)
Added: ATReferenceBrowserWidget/trunk/ATReferenceBrowserWidget.py
==============================================================================
--- (empty file)
+++ ATReferenceBrowserWidget/trunk/ATReferenceBrowserWidget.py Sun Aug 29
16:26:37 2004
@@ -0,0 +1,44 @@
+from Globals import InitializeClass
+
+from Products.Archetypes.Widget import ReferenceWidget
+from Products.Archetypes.Registry import registerWidget,registerPropertyType
+from AccessControl import ClassSecurityInfo
+
+class ReferenceBrowserWidget(ReferenceWidget):
+ _properties = ReferenceWidget._properties.copy()
+ _properties.update({
+ 'macro' : "referencebrowser",
+ 'size' : '',
+ 'helper_js': ('referencebrowser.js',),
+ 'default_search_index':'SearchableText',
+ 'show_indexes':0,
+ 'available_indexes':{},
+ 'allow_search':1,
+ 'allow_browse':1,
+ })
+
+ # default_search_index: when a user searches in the popup, this index is
used by default
+ # show_index_selector: in the popup, when set to True, a drop-down list is
shown with the index to be
+ # used for searching. If set to False, default_search_index will be
used.
+ # size: in case of single-select widget, the default is set to 30. In case
of multi-select, default is 8.
+ # available_indexes: optional dictionary that lists all the indexes that
can be used
+ # for searching. Format: {'<catalog index>':'<friendly name'>, ... } The
friendly name
+ # is what the end-users sees to make the indexes more sensible for him.
+ # allow_search: shows the search section in the popup
+ # allow_browse: shows the browse section in the popup
+
+ security = ClassSecurityInfo()
+
+
+registerWidget(ReferenceBrowserWidget,
+ title='Reference Browser',
+ description=('Reference widget that allows you to browse or
search the portal for objects to refer to.'),
+ used_for=('Products.Archetypes.Field.ReferenceField',)
+ )
+
+registerPropertyType('default_search_index', 'string', ReferenceBrowserWidget)
+registerPropertyType('show_index_selector', 'boolean', ReferenceBrowserWidget)
+registerPropertyType('available_indexes', 'dictionary', ReferenceBrowserWidget)
+registerPropertyType('allow_search', 'boolean', ReferenceBrowserWidget)
+registerPropertyType('allow_browse', 'boolean', ReferenceBrowserWidget)
+
Added: ATReferenceBrowserWidget/trunk/Extensions/Install.py
==============================================================================
--- (empty file)
+++ ATReferenceBrowserWidget/trunk/Extensions/Install.py Sun Aug 29
16:26:37 2004
@@ -0,0 +1,13 @@
+from StringIO import StringIO
+from Products.CMFCore.utils import getToolByName
+from Products.Archetypes.public import listTypes
+from Products.Archetypes.Extensions.utils import installTypes, install_subskin
+
+from Products.ATReferenceBrowserWidget.config import *
+
+def install(self):
+ out = StringIO()
+ installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME)
+ install_subskin(self, out, GLOBALS)
+ out.write("Successfully installed %s." % PROJECTNAME)
+ return out.getvalue()
Added: ATReferenceBrowserWidget/trunk/__init__.py
==============================================================================
--- (empty file)
+++ ATReferenceBrowserWidget/trunk/__init__.py Sun Aug 29 16:26:37 2004
@@ -0,0 +1,20 @@
+from Products.CMFCore import utils
+from Products.CMFCore.DirectoryView import registerDirectory
+from Products.Archetypes.public import process_types, listTypes
+from config import *
+
+registerDirectory(SKINS_DIR, GLOBALS)
+
+import ATRefBrowserDemo
+
+def initialize(context):
+ content_types, constructors, ftis = process_types(
+ listTypes(PROJECTNAME),
+ PROJECTNAME)
+ utils.ContentInit(
+ PROJECTNAME + ' Content',
+ content_types = content_types,
+ permission = ADD_CONTENT_PERMISSION,
+ extra_constructors = constructors,
+ fti = ftis,
+ ).initialize(context)
\ No newline at end of file
Added: ATReferenceBrowserWidget/trunk/config.py
==============================================================================
--- (empty file)
+++ ATReferenceBrowserWidget/trunk/config.py Sun Aug 29 16:26:37 2004
@@ -0,0 +1,9 @@
+# just to be compatible with the general AT approach
+
+PROJECTNAME = "ATReferenceBrowserWidget"
+SKINS_DIR = 'skins'
+GLOBALS = globals()
+
+from Products.CMFCore.CMFCorePermissions import AddPortalContent
+
+ADD_CONTENT_PERMISSION = AddPortalContent
\ No newline at end of file
Added: ATReferenceBrowserWidget/trunk/readme.txt
==============================================================================
--- (empty file)
+++ ATReferenceBrowserWidget/trunk/readme.txt Sun Aug 29 16:26:37 2004
@@ -0,0 +1,81 @@
+Intro
+
+ ATReferenceBrowserWidget is an add-on to Archtetypes. It adds a new
reference widget
+that allows you to search or browse the portal when creating references.
+This new widget inherits from the standard reference widget so you can use all
it's
+properties. For now, the addable feature has not been implemented/activated
+but that's not difficult. The only reason I haven't so far is that I have
+my doubts for it's usefulness. But of course, I can be wrong ;-)
+
+When you use this widget, there are two buttons presented for each widget. One
+that opens a popup-window that let's you do the search/browsing and one that
+let's you clear the reference or selected references (will be in effect after
the
+form's Save).
+
+The popop window basically consists of two parts. The top half is a search
form and
+the bottom half is the browser/search results part. Both parts can be turned
off or on
+using the widget's properties.
+
+The search part has additional configuration in the widget (see properties
below).
+
+Properties
+
+ The popup window can be configured using the following widget properties:
+
+ * default_search_index: when a user searches in the popup, this index is
used by default
+
+ * show_index_selector: in the popup, when set to True, a drop-down list is
shown with the index to be
+used for searching. If set to False, default_search_index will be used.
+
+ * size: in case of single-select widget, the default is set to 30. In case
of multi-select, default is 8.
+
+ * available_indexes: optional dictionary that lists all the indexes that
can be used
+for searching. Format: {'<catalog index>':'<friendly name'>, ... } The
friendly name
+is what the end-users sees to make the indexes more sensible for him. If you
do not use this
+property then all the indexes will be shown (I think nobody should allow this
to happen!).
+
+ * allow_search: shows the search section in the popup
+
+ * allow_browse: shows the browse section in the popup
+
+This add-on comes with an example content type that uses this widget. You can
turn the
+type off in portal_factory (uncheck implicitly addable). See
ATReferenceBrowserDemo.py.
+
+Installing
+
+ Copy this folder and its subfolders in your products directory and install
it using
+the Quickinstaller in your Plone portal.
+
+This product requires Archetypes 1.3+
+
+Design notes
+
+ Both the templates (widget and popup) are prototypes. There are still some
inline styles,
+especially in the popup because I didn't want to tweak with plone's css stuff
and I
+didn't want to do hacking and tricking to incorporate a stylesheet myself.
+So, that's still a point of interest.
+
+Furthermore I made some design decisions. Right now, in the popup window, all
objects are shown (when
+browsing) and objects that may be referenced to are bold and the other objects
are greyed out.
+I chose to show the non-referenceable objects too because they may be an
important
+part of the context that help the user search for the desired objects to
browse to.
+Another thing that I chose for is that in case of a multi-value widget, the
popup remains open so that you
+can continue to add references without having to reopen the popup over and
over again. Problem is that
+you have to close the window yourself. This may change if it turns out to be
an annoyance.
+
+A thing that is more related to forms in general is that the items in the
multiselect listbox need to be
+selected before Save is clicked otherwise only the selected items are
submitted. That kinda sucks
+usability-wise because now the user basically has to make two selections:
first by choosing the items in the
+popup and secondly by selecting them again in the listbox. Right now I made it
so that the items are selected
+by default but if the user starts clicking in the list, then there might be an
issue. Btw, the inandout widget
+has the same problem.
+Best would be to select all the items in a script just before the form is
submitted so that the complete list
+is submitted. But that requires changes in the base_edit form I think. But
it's something to think about since
+there are now already two widgets that needs to be prepared like this
(inandout and this one, haven't looked
+at picklist though, could have the same problem).
+
+Anyway, have fun with it and if you have suggestions please let me know. If
you see problems, please fix
+them when you can.
+
+Danny Bloemendaal
+danny.bloemendaal@xxxxxxxxxxxx
\ No newline at end of file
Added: ATReferenceBrowserWidget/trunk/refresh.txt
==============================================================================
Added:
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser.js
==============================================================================
--- (empty file)
+++
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser.js
Sun Aug 29 16:26:37 2004
@@ -0,0 +1,54 @@
+// function to open the popup window
+function referencebrowser_openBrowser(path, fieldName, at_uid)
+{
+ window.open(path + '/referencebrowser_popup?fieldName=' + fieldName +
'&at_uid=' +
at_uid,'referencebrowser_popup','toolbar=no,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=400,height=500');
+}
+
+// function to return a reference from the popup window back into the widget
+function referencebrowser_setReference(widget_id, uid, label, multi)
+{
+ // differentiate between the single and mulitselect widget
+ // since the single widget has an extra label field.
+ if (multi==0) {
+ element=document.getElementById(widget_id)
+ label_element=document.getElementById(widget_id + '_label')
+ element.value=uid
+ label_element.value=label
+ } else {
+ list=document.getElementById(widget_id)
+ // check if the item isn't already in the list
+ for (var x=0; x < list.length; x++) {
+ if (list[x].value == uid) {
+ return false;
+ }
+ }
+ // now add the new item
+ theLength=list.length;
+ list[theLength] = new Option(label);
+ list[theLength].selected='selected';
+ list[theLength].value=uid
+ }
+}
+
+// function to clear the reference field or remove items
+// from the multivalued reference list.
+function referencebrowser_removeReference(widget_id, multi)
+{
+ if (multi) {
+ list=document.getElementById(widget_id)
+ for (var x=list.length-1; x >= 0; x--) {
+ if (list[x].selected) {
+ list[x]=null;
+ }
+ }
+ for (var x=0; x < list.length; x++) {
+ list[x].selected='selected';
+ }
+ } else {
+ element=document.getElementById(widget_id);
+ label_element=document.getElementById(widget_id + '_label');
+ label_element.value = "";
+ element.value="";
+ }
+}
+
Added:
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser.pt
==============================================================================
--- (empty file)
+++
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser.pt
Sun Aug 29 16:26:37 2004
@@ -0,0 +1,156 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:tal="http://xml.zope.org/namespaces/tal"
+ xmlns:metal="http://xml.zope.org/namespaces/metal"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+ i18n:domain="plone">
+
+ <head><title></title></head>
+
+ <body>
+
+ <metal:view_macro define-macro="view">
+ <tal:define define="refs
python:here.getReferenceImpl(field.relationship)"
+ condition="refs">
+
+ <tal:block tal:condition="not:field/multiValued"
+ tal:define="ref python:refs[0];
+ obj ref/getTargetObject">
+
+ <a href="#"
+ tal:attributes="href obj/absolute_url;
+ class python:obj.portal_type.replace(' ', '_')"
+ tal:content="python:obj.Title() or
obj.absolute_url(relative=1)">
+ Sole target object's title
+ </a>
+
+ <a href="#"
+
tal:condition="python:portal.portal_interface.objectImplements(ref,'Products.Archetypes.interfaces.referenceengine.IContentReference')"
+ tal:attributes="href
python:ref.getContentObject().absolute_url();
+ class python:obj.portal_type.replace(' ', '_')"
+ tal:content="field/relationship">
+ reference object link
+ </a>
+
+ </tal:block>
+
+ <ul tal:condition="field/multiValued">
+ <li tal:repeat="ref refs">
+ <tal:block tal:define="obj ref/getTargetObject">
+ <a href="#"
+ tal:attributes="href obj/absolute_url;
+ class python:obj.portal_type.replace(' ',
'_')"
+ tal:content="python:obj.Title() or
obj.absolute_url(relative=1)">
+ Target Title
+ </a>
+
+ <a href="#"
+
tal:condition="python:portal.portal_interface.objectImplements(ref,'Products.Archetypes.interfaces.referenceengine.IContentReference')"
+ tal:attributes="href
python:ref.getContentObject().absolute_url();
+ class python:obj.portal_type.replace(' ',
'_')"
+ tal:content="field/relationship">
+ reference object link
+ </a>
+ </tal:block>
+ </li>
+ </ul>
+
+ </tal:define>
+ </metal:view_macro>
+
+ <metal:edit_macro define-macro="edit">
+ <metal:use use-macro="field_macro | here/widgets/field/macros/edit">
+
+ <div metal:fill-slot="widget_body"
+ tal:define="multiVal field/multiValued;
+ fieldName python:fieldName;
+ uids python:same_type(value, []) and value or [value];
+ types_param python:','.join(field.allowed_types)
+ ">
+
+ <input type="hidden"
+ value=""
+ tal:condition="python:not field.required and
multiVal"
+ tal:attributes="name
string:$fieldName:default:list"
+ />
+
+ <tal:single tal:condition="not: multiVal" >
+ <tal:value tal:condition="value">
+ <tal:block tal:define="obj
python:here.reference_catalog.lookupObject(value)">
+ <input size=""
+ type="text"
+ value=""
+ id=""
+ tal:attributes="value obj/title_or_id;
+ tabindex tabindex/next;
+ size
python:test(widget.size=='', 30, widget.size);
+ id
string:${fieldName}_label" readonly="readonly" />
+ </tal:block>
+ </tal:value>
+ <input id=""
+ size="50"
+ type="text"
+ value="No reference set. Click the browse button to
select."
+ readonly="readonly"
+ i18n:attributes="value"
+ tal:condition="not: value"
+ tal:attributes="id string:${fieldName}_label"/>
+ <input type="hidden"
+ value=""
+ name=""
+ tal:attributes="name fieldName;
+ value value;
+ id string:${fieldName}" />
+ </tal:single>
+ <tal:multi tal:condition="multiVal" tal:define="targets
python:[(here.reference_catalog.lookupObject(u),u) for u in uids if (u!=None
and u!='')]">
+ <select
+ multiple="multiple"
+ tabindex=""
+ tal:attributes="name string:${fieldName}:list;
+ id string:${fieldName};
+ size python:test(widget.size=='', 8,
widget.size);
+ tabindex tabindex/next;">
+ <tal:block tal:repeat="set targets">
+ <option value=""
+ selected="selected"
+ tal:attributes="value python:set[1];"
+ tal:content="python:set[0].title_or_id()">
+ option
+ </option>
+ </tal:block>
+ </select>
+ </tal:multi>
+ <div>
+ <input type="button"
+ class="searchButton"
+ value="Browse..."
+ onClick=""
+ i18n:attributes="value"
+ tal:attributes="onClick
string:javascript:referencebrowser_openBrowser('${here/absolute_url}','${fieldName}',
'${here/UID}')" />
+ <input type="button"
+ class="context"
+ value="Remove reference"
+ onClick=""
+ style="margin-top:0.9em;font-size:100%"
+ i18n:attributes="value"
+ tal:condition="not: multiVal"
+ tal:attributes="onClick
string:javascript:referencebrowser_removeReference('${fieldName}',
${multiVal})" />
+ <input type="button"
+ class="context"
+ value="Remove selected items"
+ onClick=""
+ style="margin-top:0.9em;font-size:100%"
+ i18n:attributes="value"
+ tal:condition="multiVal"
+ tal:attributes="onClick
string:javascript:referencebrowser_removeReference('${fieldName}',
${multiVal})" />
+ </div>
+ <!-- Todo? -->
+ <!-- metal:addable
metal:use-macro="here/widgets/addable_support/macros/addable"/-->
+ </div>
+ </metal:use>
+ </metal:edit_macro>
+
+ <metal:search_macro define-macro="search">
+ <div metal:use-macro="here/widgets/reference/macros/edit"></div>
+ </metal:search_macro>
+ </body>
+</html>
Added:
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser_popup.pt
==============================================================================
--- (empty file)
+++
ATReferenceBrowserWidget/trunk/skins/ATReferenceBrowserWidget/referencebrowser_popup.pt
Sun Aug 29 16:26:37 2004
@@ -0,0 +1,208 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns:tal="http://xml.zope.org/namespaces/tal"
+ xmlns:metal="http://xml.zope.org/namespaces/metal"
+ i18n:domain="plone">
+
+<head tal:define="ztu modules/ZTUtils;">
+ <title tal:content="here/title_or_id">Title or Id</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
+ tal:define="charset
here/portal_properties/site_properties/default_charset;
+ dummy python:request.RESPONSE.setHeader('Content-Type',
'text/html;;charset=%s' % charset)"
+ tal:attributes="content string:text/html;;charset=${charset}" />
+ <style type="text/css" media="all"
+ tal:define="current_skin
python:ztu.make_query(skin=request.get(here.portal_skins.getRequestVarname(),
''))"
+ tal:content="string: @import
url(${here/portal_url}/plone.css?${current_skin});">
+ </style>
+</head>
+ <body onload="focus();self.name='referencebrowser_popup'" style="margin:
4px;padding:0.5em;"
+ tal:define="border_color here/base_properties/globalBorderColor;
+ at_uid python:here.REQUEST.get('at_uid');
+ fieldName python:here.REQUEST.get('fieldName');
+ at_obj
python:here.reference_catalog.lookupObject(at_uid);
+ field python:at_obj.Schema()[fieldName];
+ widget python:field.widget;
+ multi python:str(field.multiValued);
+ title python:widget.Label(at_obj);
+ description python:widget.Description(at_obj);
+ allowed_types python:list(field.allowed_types);
+ search_index python:here.REQUEST.get('search_index',
widget.default_search_index);
+ show_indexes python:str(widget.show_indexes);
+ search_text python:here.REQUEST.get('searchValue', '');
+ dummy python:here.REQUEST.set(search_index, search_text);
+ available_indexes python:widget.available_indexes;
+ allow_search python:widget.allow_search;
+ allow_browse python:widget.allow_browse;">
+
+ <h2 tal:content="title" />
+ <p class="formHelp"
+ style="font-size:105%"
+ tal:content="structure description"/>
+
+ <!-- Search form -->
+ <form action="search"
+ method="get"
+ name="search"
+ style="padding-bottom:1em;"
+ tal:condition="allow_search"
+ tal:define="DateTime python:modules['DateTime'].DateTime;
+ indexes python:here.portal_catalog.indexes();"
+ tal:attributes="action string:
${here/absolute_url}/${template/getId}">
+ <fieldset>
+ <legend
i18n:translate="referencebrowser_search_terms">Search</legend>
+ <div class="field" tal:condition="python:show_indexes=='1'">
+ <label
i18n:translate="referencebrowser_search_index_label">Search index</label><br/>
+ <select name="search_index"
+ style=""
+ id="indexSelector"
+ tal:attributes="style
string:font-family:${here/base_properties/fontFamily};;font-size:100%;">
+ <tal:indexes tal:repeat="index indexes">
+ <tal:filter
tal:condition="python:(available_indexes!={} and
available_indexes.has_key(index)) or available_indexes=={}">
+ <option value=""
+ selected=""
+ tal:attributes="value index;
+ selected
python:test(index==search_index, 'selected', '')"
+ tal:content=
"python:available_indexes[index]"
+ tal:condition=
"python:available_indexes.has_key(index)"/>
+
+ <option value=""
+ selected=""
+ tal:attributes="value index;
+ selected
python:test(index==search_index, 'selected', '')"
+ tal:content= "index"
+ tal:condition= "python:not
available_indexes.has_key(index)"/>
+ </tal:filter>
+ </tal:indexes>
+ </select>
+ </div>
+ <div class="field">
+ <label i18n:translate="referencebrowser_search_term">Search
terms</label><br/>
+ <input type="text"
+ id="searchGadget"
+ name="searchValue"
+ size="25"
+ tabindex=""
+ value=""
+ tal:attributes="value search_text;"
+ />
+ <input tabindex=""
+ class="searchButton"
+ type="submit"
+ name="submit"
+ value="Search"
+ i18n:attributes="value"
+ />
+ </div>
+ <!-- add these to make sure that after a search result, we still
have these paremeters -->
+ <!-- build up the portal_type request so searches only take place
within allowed_types -->
+ <tal:types tal:condition="python: allowed_types!=[]"
tal:repeat="type allowed_types">
+ <input type="hidden" name="portal_type:list" value=""
tal:attributes="value type" />
+ </tal:types>
+ <input type="hidden" name="fieldName" value=""
tal:attributes="value fieldName" />
+ <input type="hidden" name="at_uid" value="" tal:attributes="value
at_uid" />
+ </fieldset>
+ </form>
+ <!-- actual list of objects, either searchresults or folder contents
-->
+ <tal:block tal:define="query_results python:[brain.getObject() for
brain in here.queryCatalog()];">
+ <div style="border-top:1px solid black;border-bottom:1px solid
black;"
+ tal:attributes="style string:border-top:1px solid
${border_color};;
+ border-bottom:1px solid
${border_color};;
+ margin-bottom:1em;;padding:0.2em 0
0.1em 0"
+ tal:condition="python:(search_text!='' and
query_results!=[])">
+ <span
i18n:translate="referencebrowser_heading_search_results">Search results</span>
+ </div>
+ <!-- breadcrums -->
+ <div style="border-top:1px solid black;border-bottom:1px solid
black;"
+ tal:attributes="style string:border-top:1px solid
${border_color};;
+ border-bottom:1px solid
${border_color};;
+ margin-bottom:1em;;padding:0.2em 0
0.1em 0"
+ tal:condition= "python:search_text=='' and allow_browse"
+ tal:define= "parents request/PARENTS;
+ nil python: parents.reverse();
+ portal here/portal_url/getPortalObject;">
+ <tal:crums tal:repeat="parent parents">
+ <img tal:condition="repeat/parent/start"
+ tal:attributes="src
string:${here/portal_url}/logoIcon.gif"/>
+ <tal:path tal:condition="not: repeat/parent/start">
+ <a tal:attributes="href python:parent.absolute_url() +
'/' + template.getId() + '?fieldName=' + fieldName + '&at_uid=' + at_uid">
+ <span tal:content="string: ${parent/title_or_id}"
+ tal:condition="python:
parent.absolute_url()!=portal.absolute_url()"/>
+ <span tal:content="string:Home"
tal:condition="python: parent.absolute_url()==portal.absolute_url()"/>
+ <span class="breadcrumbSeparator"
+ tal:condition="not: repeat/parent/end"
>»</span>
+ </a>
+ </tal:path>
+ </tal:crums>
+ </div>
+
+ <!-- object list -->
+ <tal:noresults tal:condition="python:search_text!='' and
query_results==[]">
+ <p i18n:translate="referencebrowser">No items found.</p>
+ </tal:noresults>
+ <tal:list tal:define="checkPermission python:
here.portal_membership.checkPermission;
+ results python: test(search_text!='',
query_results, test(allow_browse, [item for item in here.listFolderContents()
if checkPermission('View',item)], []));">
+ <table class="group"
+ width="100%"
+ cellspacing="0"
+ cellpadding="2"
+ tal:condition="results">
+ <tbody>
+ <tal:results tal:repeat="item results">
+ <tal:row tal:define="uid
item/aq_explicit/UID|string:'';
+ item_referenceable
python:(allowed_types!=[] and (item.portal_type in allowed_types) or
(allowed_types==[]));
+ has_uid
python:hasattr(item.aq_explicit, 'UID');
+ referenceable python:has_uid
and item_referenceable;
+ color
here/base_properties/discreetColor;
+ color
string:rgb(175,175,175);">
+ <tr tal:define="oddrow repeat/item/odd"
+ tal:attributes="class python:test(oddrow,
'even', 'odd')">
+ <td width="50%">
+ <img src="#" tal:attributes="src
string:${here/portal_url}/${item/getIcon};alt item/Title" />
+ <a tal:condition="python:
item.isPrincipiaFolderish and item<>here"
+ tal:attributes="href
python:item.absolute_url() + '/' + template.getId() + '?fieldName='+ fieldName
+ '&at_uid='+at_uid">
+ <strong
tal:condition="referenceable"
+
tal:content="item/title_or_id">Title</strong>
+ <span style=""
+ tal:condition="not:
referenceable"
+
tal:content="item/title_or_id"/>
+ </a>
+ <tal:foldercheck
tal:condition="python: not (item.isPrincipiaFolderish and item <> here)" >
+ <strong
tal:condition="referenceable"
+
tal:content="item/title_or_id">Title
+ </strong>
+ <span style=""
+ tal:condition="python:not
referenceable"
+
tal:content="item/title_or_id"
+ tal:attributes="style
string:color:${color}" />
+ </tal:foldercheck>
+ </td>
+ <td width="25%"
+ style=""
+ tal:attributes="style
python:test(referenceable, '', 'color:' + color)"
+
tal:content="python:item.getTypeInfo().Title()">Metatype
+ </td>
+ <td width="25%" nowrap="nowrap"
tal:define="title python:item.title_or_id().replace('\'', '\\\'')">
+ <a href=""
+ onclick=""
+ tal:attributes="href string: #;
+ onclick string:
window.opener.referencebrowser_setReference('${fieldName}', '${uid}',
'${title}', ${multi});; if (0==${multi}) {window.close()};; ;"
+ tal:condition="referenceable">
+ <strong
i18n:translate="referencebrowser_insert_reference">Insert reference</strong>
+ </a>
+ </td>
+ </tr>
+ </tal:row>
+ </tal:results>
+ </tbody>
+ </table>
+ </tal:list>
+ </tal:block>
+ <br/><br/>
+ <input type="button"
+ value="Close window"
+ class="standalone"
+ onclick="javascript:window.close()"
+ i18n:attributes="value" />
+ </body>
+</html>
Added: ATReferenceBrowserWidget/trunk/version.txt
==============================================================================
--- (empty file)
+++ ATReferenceBrowserWidget/trunk/version.txt Sun Aug 29 16:26:37 2004
@@ -0,0 +1 @@
+0.1
\ No newline at end of file
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
|