r13636 - in Products.OrderableReferenceField/branches/alternative-widget: . Products/OrderableReferenceField Products/OrderableReferenceField/profiles/default Products/OrderableReferenceField/skins/orderablereferencefield
"Luca Fabbri" <[email protected]> Fri, 13 May 2011 09:38:40 +0000
| Newsgroups | gmane.comp.web.zope.plone.archetypes.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: keul
Date: Fri May 13 09:38:40 2011
New Revision: 13636
Added:
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css
- copied, changed from r13635, Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css.dtml
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css.metadata
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.js
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.js.metadata
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.pt
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/referencebrowser_popup.pt
Removed:
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css.dtml
Modified:
Products.OrderableReferenceField/branches/alternative-widget/CHANGES.txt
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/__init__.py
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/_field.py
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/configure.zcml
Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/profiles/default/jsregistry.xml
Products.OrderableReferenceField/branches/alternative-widget/setup.py
Log:
Applied our internal patch, adding the second widget
Modified: Products.OrderableReferenceField/branches/alternative-widget/CHANGES.txt
==============================================================================
--- Products.OrderableReferenceField/branches/alternative-widget/CHANGES.txt (original)
+++ Products.OrderableReferenceField/branches/alternative-widget/CHANGES.txt Fri May 13 09:38:40 2011
@@ -1,6 +1,16 @@
Changelog
=========
+1.3 (Unreleased)
+----------------
+
+- alternative OrderableReferenceBrowserWidget (using the original Plone pop-up to select objects)
+ (see also `#4`__) [marco.mariani]
+- removed z3c.autoinclude ``includeDependencies`` (see `#3`__) [keul]
+
+__ http://plone.org/products/orderablereferencefield/issues/4
+__ http://plone.org/products/orderablereferencefield/issues/3
+
1.2-beta4 (2010-11-17)
----------------------
Modified: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/__init__.py
==============================================================================
--- Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/__init__.py (original)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/__init__.py Fri May 13 09:38:40 2011
@@ -29,7 +29,7 @@
from Products.Archetypes import listTypes
from Products.OrderableReferenceField._field import OrderableReferenceField
-from Products.OrderableReferenceField._field import OrderableReferenceWidget
+from Products.OrderableReferenceField._field import OrderableReferenceWidget, OrderableReferenceBrowserWidget
from Products.OrderableReferenceField.config import *
Modified: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/_field.py
==============================================================================
--- Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/_field.py (original)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/_field.py Fri May 13 09:38:40 2011
@@ -25,6 +25,7 @@
from AccessControl import ClassSecurityInfo
from Products.Archetypes import atapi
from Products.Archetypes.Registry import registerField, registerWidget
+from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget
class OrderableReferenceWidget(atapi.ReferenceWidget):
@@ -35,6 +36,15 @@
'size': '6',
'helper_js': ('orderablereference.js',),
})
+
+class OrderableReferenceBrowserWidget(ReferenceBrowserWidget):
+ _properties = ReferenceBrowserWidget._properties.copy()
+ _properties.update({
+ 'type': 'orderablereferencebrowser',
+ 'macro': 'orderablereferencebrowser',
+ 'size': '6',
+ 'helper_js': ('orderablereferencebrowser.js',),
+ })
class OrderableReferenceField(atapi.ReferenceField):
@@ -90,6 +100,12 @@
used_for=('Products.OrderableReferenceField.OrderableReferenceField',)
)
+registerWidget(
+ OrderableReferenceBrowserWidget,
+ title='Orderable Reference Browser',
+ used_for=('Products.OrderableReferenceField.OrderableReferenceField',)
+ )
+
registerField(
OrderableReferenceField,
title="Orderable Reference Field",
Modified: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/configure.zcml
==============================================================================
--- Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/configure.zcml (original)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/configure.zcml Fri May 13 09:38:40 2011
@@ -6,11 +6,8 @@
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="Products.OrderableReferenceField">
- <!-- Not needed to register this package because it's in the Products-namespace -->
- <!-- <five:registerPackage package="." initialize=".initialize" /> -->
-
<!-- Include configuration for dependencies listed in setup.py -->
- <includeDependencies package="." />
+ <!-- includeDependencies package="." /-->
<!-- register all skins-folders -->
<cmf:registerDirectory name="skins" directory="skins" recursive="True" />
Modified: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/profiles/default/jsregistry.xml
==============================================================================
--- Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/profiles/default/jsregistry.xml (original)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/profiles/default/jsregistry.xml Fri May 13 09:38:40 2011
@@ -8,6 +8,14 @@
enabled="True"
expression=""
inline="False"/>
+
+ <javascript id="orderablereferencebrowser.js"
+ cacheable="True"
+ compression="none"
+ cookable="True"
+ enabled="True"
+ expression=""
+ inline="False"/>
</object>
Copied: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css (from r13635, Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css.dtml)
==============================================================================
--- Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css.dtml (original)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css Fri May 13 09:38:40 2011
@@ -1,5 +1,6 @@
-/* <dtml-with base_properties> (do not remove this :) */
-/* <dtml-call "REQUEST.set('portal_url', portal_url())"> (not this either :) */
+/*
+ * CSS for OrderableReferenceWidget
+ */
#box1, #box2 {
float: left;
@@ -29,4 +30,7 @@
.orfspacing {
clear: both;
}
-/* </dtml-with> */
+
+.orderablereferencebrowser_arrow {
+}
+
Added: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css.metadata
==============================================================================
--- (empty file)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereference.css.metadata Fri May 13 09:38:40 2011
@@ -0,0 +1,2 @@
+[default]
+cache=HTTPCache
Added: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.js
==============================================================================
--- (empty file)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.js Fri May 13 09:38:40 2011
@@ -0,0 +1,104 @@
+/*jslint browser: true */
+/*global window */
+
+
+var referencebrowser_openBrowser,
+ referencebrowser_setReference,
+ referencebrowser_removeReference,
+ referencebrowser_updateIndexItems;
+
+
+jQuery(function($) {
+
+"use strict";
+
+
+referencebrowser_updateIndexItems = function(id) {
+ var $lis = $('#'+id+' li');
+
+ $lis.each(function(li_idx, li) {
+ $('.orderablereferencebrowser_arrow', li).each(function(updn_idx, a) {
+ var handler = null;
+ if (updn_idx === 0 && li_idx > 0) {
+ handler = function(ev) {
+ $($lis[li_idx]).insertBefore($lis[li_idx-1]); // moveup
+ ev.preventDefault();
+ referencebrowser_updateIndexItems(id);
+ };
+ } else if (updn_idx === 1 && li_idx < $lis.length - 1) {
+ handler = function(ev) {
+ $($lis[li_idx]).insertAfter($lis[li_idx+1]); // movedown
+ ev.preventDefault();
+ referencebrowser_updateIndexItems(id);
+ };
+ }
+
+ $(a).unbind('click').css({'cursor': 'auto'});
+ if (handler) {
+ $(a).click(handler).css({'cursor': 'pointer', 'color': ''});
+ }
+ });
+ });
+};
+
+
+
+// function to open the popup window
+referencebrowser_openBrowser = function(path, fieldName, at_url, fieldRealName) {
+ window.open(path + '/referencebrowser_popup?fieldName=' + fieldName + '&fieldRealName=' + fieldRealName +'&at_url=' + at_url,
+ 'referencebrowser_popup',
+ 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=550');
+};
+
+
+// function to return a reference from the popup window back into the widget
+referencebrowser_setReference = function(widget_id, uid, label, multi) {
+ var $input;
+ // differentiate between the single and mulitselect widget
+ // since the single widget has an extra label field.
+ if (multi === 0) {
+ $('#'+widget_id).val(uid);
+ $('#'+widget_id+'_label').val(label);
+ } else {
+ // check if the item isn't already in the list
+ $('#'+widget_id+' input').each(function() {
+ if ($(this).val() === uid) {
+ return false;
+ }
+ });
+
+ $input = $('<input type="checkbox" checked="true">').val(uid).attr('name', widget_id+':list');
+
+ $('<li>').append(
+ $('<a class="orderablereferencebrowser_arrow">▲</a>'), ' ',
+ $('<a class="orderablereferencebrowser_arrow">▼</a>'), ' ',
+ $('<label>').append($input, document.createTextNode(' '+label))
+ ).appendTo('#'+widget_id);
+
+ $input.attr('checked', 'true'); // fix on IE7 - check *after* adding to DOM
+ referencebrowser_updateIndexItems(widget_id);
+ }
+};
+
+
+// function to clear the reference field or remove items
+// from the multivalued reference list.
+referencebrowser_removeReference = function(widget_id, multi) {
+ var x, list;
+ if (multi === 0) {
+ $('#'+widget_id).val('');
+ $('#'+widget_id+'_label').val('');
+ } else {
+ list = document.getElementById(widget_id);
+ for (x = list.length-1; x >= 0; x--) {
+ if (list[x].selected) {
+ list[x] = null;
+ }
+ }
+ for (x = 0; x < list.length; x++) {
+ list[x].selected = 'selected';
+ }
+ }
+};
+
+});
Added: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.js.metadata
==============================================================================
--- (empty file)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.js.metadata Fri May 13 09:38:40 2011
@@ -0,0 +1,2 @@
+[default]
+cache=HTTPCache
Added: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.pt
==============================================================================
--- (empty file)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/orderablereferencebrowser.pt Fri May 13 09:38:40 2011
@@ -0,0 +1,215 @@
+<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="atreferencebrowserwidget">
+
+ <head><title></title></head>
+
+ <body>
+
+ <metal:view_macro define-macro="view">
+ <tal:define define="refs python:here.getReferenceImpl(field.relationship);
+ image_portal_types field/widget/image_portal_types;
+ image_method field/widget/image_method|string:;
+ show_path field/widget/show_path|nothing;
+ portal_path python: '/'.join(context.portal_url.getPortalObject().getPhysicalPath());
+ hide_inaccessible field/widget/hide_inaccessible | nothing;"
+ condition="refs">
+
+ <tal:block tal:condition="python: not field.multiValued and (can_view or not hide_inaccessible)"
+ tal:define="ref python:refs[0];
+ obj ref/getTargetObject;
+ obj_path python: '/'.join(obj.getPhysicalPath());
+ can_view python: checkPermission('View', obj)">
+ <tal:if condition="image_portal_types">
+ <img src="#" alt="Image"
+ tal:condition="python: obj.portal_type in image_portal_types"
+ tal:attributes="src string:${obj/absolute_url}/$image_method"
+ />
+ </tal:if>
+
+ <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:if condition="show_path"
+ i18n:translate="label_directory">
+ ( Directory: <span i18n:name="directory" tal:replace="python: obj_path.replace(portal_path + '/', '')">directory</span>)
+ </tal:if>
+
+ </tal:block>
+
+ <ul tal:condition="field/multiValued">
+ <tal:sort tal:content="nothing"
+ tal:on-error="nothing"
+ tal:define="foo python:refs.sort(lambda x,y: cmp(x.order, y.order))">
+ If we are not using orderablereferencefield we don't have the order attribute
+ we swallow this error silently using tal:on-error
+ </tal:sort>
+ <tal:block tal:repeat="ref refs">
+ <tal:block tal:define="obj ref/getTargetObject;
+ obj_path python: '/'.join(obj.getPhysicalPath());
+ can_view python: checkPermission('View', obj)"
+ tal:condition="python: can_view or not hide_inaccessible">
+ <li>
+ <tal:if condition="image_portal_types">
+ <img tal:condition="python: obj.portal_type in image_portal_types"
+ tal:attributes="src string:${obj/absolute_url}/$image_method" />
+ </tal:if>
+ <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:if condition="show_path"
+ i18n:translate="label_directory">
+ (Directory: <span i18n:name="directory" tal:replace="python: obj_path.replace(portal_path + '/', '') ">directory</span>)
+ </tal:if>
+ </li>
+ </tal:block>
+ </tal:block>
+ </ul>
+
+ </tal:define>
+ </metal:view_macro>
+
+ <metal:reference_edit define-macro="reference_edit"
+ tal:define="multiVal python:test(field.multiValued, 1, 0);
+ show_path field/widget/show_path|nothing;
+ image_portal_types widget/image_portal_types;
+ image_method widget/image_method|string:;
+ portal_path python:'/'.join(context.portal_url.getPortalObject().getPhysicalPath());
+ fieldName fieldName;
+ fieldRealName field/getName;
+ uids python:same_type(value, []) and value or [value];
+ ">
+
+ <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);
+ obj_path python: '/'.join(obj.getPhysicalPath())" >
+ <input size=""
+ type="text"
+ value=""
+ id=""
+ tal:attributes="value obj/title_or_id;
+ size python:test(widget.size=='', 30, widget.size);
+ id string:${fieldName}_label" readonly="readonly" />
+
+ <img tal:condition="python: obj.portal_type in image_portal_types"
+ tal:attributes="src string:${obj/absolute_url}/$image_method" />
+
+ <tal:if condition="show_path"
+ i18n:translate="label_directory">
+ (Directory: <span i18n:name="directory" tal:replace="python: obj_path.replace(portal_path + '/', '')">directory</span>)
+ </tal:if>
+
+ </tal:block>
+ </tal:value>
+ <input id=""
+ size="50"
+ type="text"
+ value="No reference set. Click the add button to select."
+ readonly="readonly"
+ i18n:attributes="value label_no_reference_set;"
+ 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]">
+ <div style="float: left">
+<!-- This should be enabled if we can remove it when an item is inserted.
+ <p class="discreet"
+ tal:condition="not: targets">No items currently selected</p>
+-->
+ <ul class="visualNoMarker"
+ tal:attributes="id string:${fieldName};">
+ <li tal:repeat="set targets">
+ <a class="orderablereferencebrowser_arrow">▲</a>
+ <a class="orderablereferencebrowser_arrow">▼</a>
+ <label tal:define="title python: set[0].title_or_id();
+ obj_path python: '/'.join(set[0].getPhysicalPath());">
+ <input type="checkbox"
+ tal:attributes="name string:${fieldName}:list;
+ value python:set[1];"
+ checked="checked" />
+
+ <tal:block replace="python: show_path and '%s (%s)' % (title, obj_path.replace(portal_path, '')) or title" />
+ </label>
+
+ </li>
+ </ul>
+ </div>
+ </tal:multi>
+ <div style="clear: both"
+ tal:define="startup_directory python:here.referencebrowser_startupDirectory(widget.getStartupDirectory(here));
+ global at_url at_url|python:'/'.join(here.getPhysicalPath())">
+ <input type="button"
+ class="searchButton"
+ value="Add..."
+ onClick=""
+ i18n:attributes="value label_add;"
+ tal:attributes="onClick string:javascript:referencebrowser_openBrowser('${startup_directory}','${fieldName}', '${at_url}', '${fieldRealName}')" />
+ <input type="button"
+ class="destructive"
+ value="Remove reference"
+ onClick=""
+ i18n:attributes="value label_remove_reference;"
+ tal:condition="not: multiVal"
+ tal:attributes="onClick string:javascript:referencebrowser_removeReference('${fieldName}', ${multiVal})" />
+ </div>
+
+ <script type="text/javascript"
+ tal:content="string:jQuery(function($){referencebrowser_updateIndexItems('${fieldName}');})">
+ </script>
+ <metal:addable metal:use-macro="here/widgets/addable_support/macros/addable"/>
+ </metal:reference_edit>
+
+ <metal:edit_macro define-macro="edit">
+ <metal:use use-macro="field_macro | here/widgets/field/macros/edit">
+ <metal:fill fill-slot="widget_body">
+ <metal:use use-macro="here/orderablereferencebrowser/macros/reference_edit" />
+ </metal:fill>
+ </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: Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/referencebrowser_popup.pt
==============================================================================
--- (empty file)
+++ Products.OrderableReferenceField/branches/alternative-widget/Products/OrderableReferenceField/skins/orderablereferencefield/referencebrowser_popup.pt Fri May 13 09:38:40 2011
@@ -0,0 +1,336 @@
+<!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="atreferencebrowserwidget">
+
+<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}" />
+ <tal:styles define="view context/@@plone|nothing"
+ replace="structure provider:plone.resourceregistries.styles" />
+ <script language="javascript" type="text/javascript">
+ function showMessage(message) {
+ element = document.getElementById('message');
+ element.style.display='block';
+ inner = document.getElementById('messageTitle');
+ inner.innerHTML = message;
+ }
+ function submitHistoryForm() {
+ var form = document.history;
+ var path = form.path.options[form.path.selectedIndex].value;
+ form.action = path;
+ form.submit();
+ }
+ </script>
+</head>
+ <body class="popup atrefbrowser" onload="focus();self.name='referencebrowser_popup'" style="margin: 4px;padding:0.5em;"
+ tal:define="border_color here/base_properties/globalBorderColor;
+ at_url python:here.REQUEST.get('at_url');
+ fieldName python:here.REQUEST.get('fieldName');
+ fieldRealName python:here.REQUEST.get('fieldRealName');
+ at_obj python:here.restrictedTraverse(at_url);
+ field python:at_obj.Schema()[fieldRealName];
+ widget python:field.widget;
+ multi python:test(field.multiValued, '1', '0');
+ title python:widget.Label(at_obj);
+ description python:widget.Description(at_obj);
+ search_index python:here.REQUEST.get('search_index', widget.default_search_index);
+ show_indexes 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;
+ show_review_state widget/show_review_state;
+ always_show widget/show_results_without_query|nothing;
+ image_portal_types widget/image_portal_types;
+ image_method widget/image_method|string:;
+ restrict_browsing_to_startup_directory widget/restrict_browsing_to_startup_directory|python: True;
+ base_query python:widget.getBaseQuery(at_obj, field);
+ allowed_types base_query/portal_type;
+ only_for_review_states widget/only_for_review_states;
+ history_length widget/history_length;
+ filter_review_states python: only_for_review_states is not None;
+ dummy python: not allowed_types and base_query.pop('portal_type');
+ force_close_on_insert python:widget.force_close_on_insert;
+ search_catalog widget/search_catalog|string:portal_catalog;
+ close_window python:test(multi==0,0, test(force_close_on_insert, 0, 1));
+ getInfoFor python: context.portal_workflow.getInfoFor;
+ b_size python:20;
+ b_start python:0;
+ b_start request/b_start | b_start;
+ Batch python:modules['Products.CMFPlone'].Batch;">
+
+ <tal:if condition="python: history_length > 0">
+ <tal:insert define="dummy python: context.referencebrowser_insertHistory(request['PATH_TRANSLATED'], history_length)"/>
+ </tal:if>
+
+ <tal:if condition="request/clearHistory|nothing">
+ <tal:clear define="dummy python: request.SESSION.set('atrefbrowserwidget_history', [])" />
+ </tal:if>
+
+ <div style="text-align:right; position: absolute; top: 1.4em; right: 1.0em;">
+ <a href="javascript:history.back()" i18n:translate="referencebrowser_back">Back</a>
+ |
+ <a href="javascript:window.close()" i18n:translate="referencebrowser_close">Close window</a>
+ </div>
+ <div style="text-align:right;margin-bottom:1.5em; margin-top: 2.5em;">
+ <div tal:condition="python: history_length > 0 "
+ tal:define="history python: request.SESSION.get('atrefbrowserwidget_history', [])[:]">
+ <form tal:condition="history"
+ action="referencebrowser_popup" method="GET" name="history" id="history">
+ <input type="hidden" name="fieldRealName" tal:attributes="value fieldRealName" />
+ <input type="hidden" name="fieldName" tal:attributes="value fieldName" />
+ <input type="hidden" name="at_url" tal:attributes="value at_url" />
+ <input type="hidden" name="clear:int" value="1" />
+ <label for="path" i18n:translate="referencebrowser_history">History</label>
+ <select name="path" size="1">
+ <option value="" i18n:translate="" />
+ <option tal:repeat="tp history"
+ tal:content="python: tp[1]"
+ tal:attributes="value python: tp[0]"
+ />
+ </select>
+ <input class="context" type="button" value="Go"
+ onclick="submitHistoryForm()"
+ i18n:attributes="value label_go;" />
+ </form>
+ <div tal:condition="history">
+ <a tal:attributes="href string:${request/ACTUAL_URL}?${request/QUERY_STRING}&clearHistory=1" i18n:translate="referencebrowser_clearhistory">Clear history</a>
+ </div>
+ </div>
+ </div>
+
+ <h2 class="documentFirstHeading"
+ tal:content="title" />
+ <p class="formHelp"
+ tal:content="structure description"/>
+
+ <!-- Search form -->
+ <form action="search"
+ method="post"
+ name="search"
+ style="padding-bottom:0em;"
+ tal:condition="allow_search"
+ tal:define="DateTime python:modules['DateTime'].DateTime;
+ indexes python:getattr(here, search_catalog, here.portal_catalog).indexes();"
+ tal:attributes="action string:${here/absolute_url}/${template/getId}">
+ <tal:base_query tal:condition="base_query/keys|nothing">
+ <tal:alter_request tal:define="dummy python: request.form.update(base_query);"/>
+ </tal:base_query>
+
+ <div class="field" tal:condition="show_indexes">
+ <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"
+ value=""
+ tal:attributes="value search_text;"
+ />
+ <input class="searchButton"
+ type="submit"
+ name="submit"
+ value="Search"
+ i18n:domain="plone"
+ i18n:attributes="value label_search;"
+ />
+ </div>
+ <!-- add these to make sure that after a search result, we still have these paremeters -->
+ <input type="hidden" name="fieldName" value="" tal:attributes="value fieldName" />
+ <input type="hidden" name="fieldRealName" value="" tal:attributes="value fieldRealName" />
+ <input type="hidden" name="at_url" value="" tal:attributes="value at_url" />
+ </form>
+ <div id="message" class="portalMessage" style="display:none;margin-top:0px;">
+ <span i18n:translate="referencebrowser_text_added_reference">Added reference to:</span> <span id="messageTitle"></span>
+ </div>
+ <!-- actual list of objects, either searchresults or folder contents -->
+ <tal:block tal:define="query_results python:(always_show or search_text) and [brain.getObject() for brain in here.referencebrowser_queryCatalog(search_catalog=search_catalog)];">
+ <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;;
+ margin-top:1.5em;;"
+ tal:condition="python:((search_text!='' or not allow_browse) 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;;margin-top:1.5em;"
+ tal:condition= "python:search_text=='' and allow_browse"
+ tal:define= "portal here/portal_url/getPortalObject;
+ putils nocall:portal/plone_utils;
+ crumbs python:putils.createBreadCrumbs(here);
+ crumbs python: test(True, context.referencebrowser_filterBreadCrumbs(crumbs, widget.startup_directory), crumbs);
+ isRTL python:portal.restrictedTraverse('@@plone_portal_state').is_rtl();
+ parents request/PARENTS;
+ nil python: parents.reverse();
+ navroot context/@@plone_portal_state/navigation_root_url
+ ">
+
+ <img tal:attributes="src string:${here/portal_url}/logoIcon.gif"/>
+ <tal:if condition="not: restrict_browsing_to_startup_directory">
+ <a i18n:translate="tabs_home"
+ tal:attributes="href string:${navroot}/${template/getId}?fieldName=${fieldName}&fieldRealName=${fieldRealName}&at_url=${at_url}">
+ Home
+ </a>
+
+ <span tal:condition="crumbs" class="breadcrumbSeparator">
+ <tal:ltr condition="not: isRTL">→</tal:ltr>
+ <tal:rtl condition="isRTL">←</tal:rtl>
+ </span>
+ </tal:if>
+
+
+ <tal:crums tal:repeat="crumb crumbs">
+
+ <a tal:attributes="href string:${crumb/absolute_url}/${template/getId}?fieldName=${fieldName}&fieldRealName=${fieldRealName}&at_url=${at_url}">
+ <span tal:content="string:${crumb/Title}">
+ Breadcrumb Title
+ </span>
+ </a>
+
+ <span tal:condition="not: repeat/crumb/end"
+ class="breadcrumbSeparator">
+ <tal:ltr condition="not: isRTL">→</tal:ltr>
+ <tal:rtl condition="isRTL">←</tal:rtl>
+ </span>
+
+ </tal:crums>
+
+
+ </div>
+
+ <!-- object list -->
+ <tal:noresults tal:condition="python:(search_text!='' or not allow_browse) and query_results==[]">
+ <p i18n:translate="referencebrowser_no_items_found">No items found.</p>
+ </tal:noresults>
+ <tal:list tal:define="checkPermission python: here.portal_membership.checkPermission;
+ folder_contents here/listFolderContents|python:[];
+ results python: test(search_text!='' or not allow_browse, query_results, test(allow_browse, [item for item in folder_contents if checkPermission('View',item)], []));
+ batch python: Batch(results, b_size, int(b_start), orphan=1);">
+ <table class="group"
+ width="100%"
+ cellspacing="0"
+ cellpadding="2"
+ tal:condition="batch">
+ <tbody>
+
+
+ <tal:results tal:repeat="item batch">
+ <tal:row tal:define="uid item/aq_explicit/UID|string:'';
+ item_referenceable python:((allowed_types and (item.portal_type in allowed_types)) or not allowed_types);
+ review_state_allows python: test(filter_review_states, getInfoFor(item, 'review_state', None) in (only_for_review_states or ()), True);
+ has_uid python:hasattr(item.aq_explicit, 'UID');
+ referenceable python:has_uid and item_referenceable and review_state_allows and item!=at_obj;
+ color here/base_properties/discreetColor;">
+
+ <tr tal:define="oddrow repeat/item/odd"
+ tal:attributes="class python:test(oddrow, 'even', 'odd')">
+ <td tal:condition="image_portal_types">
+ <tal:if condition="python: item.getTypeInfo().Title() in image_portal_types" >
+ <img tal:attributes="src string:${item/absolute_url}/$image_method" />
+ </tal:if>
+ </td>
+ <td width="50%">
+ <img src="#" tal:attributes="src string:/${item/getIcon};alt item/Title" />
+ <a tal:condition="python: item.isPrincipiaFolderish and allow_browse"
+ tal:attributes="href python:item.absolute_url() + '/' + template.getId() + '?fieldName='+ fieldName + '&fieldRealName=' + fieldRealName + '&at_url='+at_url">
+ <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 allow_browse) 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>
+
+ <div tal:condition="show_review_state">
+ <span tal:define="state python: getInfoFor(item, 'review_state', None)"
+ tal:attributes="class string:state-$state"
+ i18n:translate="" i18n:domain="plone" tal:content="state"
+ />
+ </div>
+
+ <div class="additionalInfo" tal:content="structure item/additionalReferenceInfo | nothing" />
+ </td>
+
+ <td width="25%"
+ style=""
+ i18n:domain="plone"
+ i18n:translate=""
+ tal:attributes="style python:test(referenceable, '', 'color:' + color)"
+ tal:content="python:item.getTypeInfo().Title()">
+ Title
+ </td>
+ <td width="25%"
+ nowrap="nowrap"
+ style="text-align:right"
+ tal:define="title python:item.title_or_id().replace('\'', '\\\'')">
+ <tal:referenceable tal:condition="referenceable">
+ <a href=""
+ onclick=""
+ tal:attributes="href string:#;
+ onclick string:window.opener.referencebrowser_setReference('${fieldName}', '${uid}', '${title}', ${multi});; if (0==${close_window}) {window.close()} else {showMessage('${title}')};; ;">
+ <strong i18n:translate="referencebrowser_insert_reference">Insert</strong>
+ </a>
+ |
+ <a href="" target="_blank"
+ tal:attributes="href python:item.absolute_url();">
+ <strong i18n:translate="referencebrowser_browse">Browse</strong>
+ </a>
+ </tal:referenceable>
+ </td>
+ </tr>
+ </tal:row>
+ </tal:results>
+ </tbody>
+ </table>
+ <div metal:use-macro="here/batch_macros/macros/navigation" />
+ </tal:list>
+ </tal:block>
+ <div style="text-align:right;margin-top:1em;margin-bottom:2em;">
+ <a href="javascript:history.back()" i18n:translate="referencebrowser_back">Back</a>
+ |
+ <a href="javascript:window.close()" i18n:translate="referencebrowser_close">Close window</a>
+ </div>
+ </body>
+</html>
Modified: Products.OrderableReferenceField/branches/alternative-widget/setup.py
==============================================================================
--- Products.OrderableReferenceField/branches/alternative-widget/setup.py (original)
+++ Products.OrderableReferenceField/branches/alternative-widget/setup.py Fri May 13 09:38:40 2011
@@ -5,16 +5,12 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-version = '1.2-beta4'
+version = '1.3'
long_description = (
read('README.txt')
+ '\n' +
read('CHANGES.txt')
-# + '\n' +
-# read('Products', 'OrderableReferenceField', 'README.txt')
-# + '\n' +
-# read('CONTRIBUTORS.txt')
)
setup(name='Products.OrderableReferenceField',
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay