[2268] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
| 2 | |
---|
| 3 | <html xmlns:tal="http://xml.zope.org/namespaces/tal" |
---|
| 4 | xmlns:metal="http://xml.zope.org/namespaces/metal" |
---|
| 5 | i18n:domain="atreferencebrowserwidget"> |
---|
| 6 | |
---|
| 7 | <head tal:define="ztu modules/ZTUtils;"> |
---|
| 8 | <title tal:content="here/title_or_id">Title or Id</title> |
---|
| 9 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" |
---|
| 10 | tal:define="charset here/portal_properties/site_properties/default_charset; |
---|
| 11 | dummy python:request.RESPONSE.setHeader('Content-Type', 'text/html;;charset=%s' % charset)" |
---|
| 12 | tal:attributes="content string:text/html;;charset=${charset}" /> |
---|
| 13 | <tal:styles define="view context/@@plone|nothing" |
---|
| 14 | replace="structure provider:plone.resourceregistries.styles" /> |
---|
| 15 | <script language="javascript" type="text/javascript"> |
---|
| 16 | function showMessage(message) { |
---|
| 17 | element = document.getElementById('message'); |
---|
| 18 | element.style.display='block'; |
---|
| 19 | inner = document.getElementById('messageTitle'); |
---|
| 20 | inner.innerHTML = message; |
---|
| 21 | } |
---|
| 22 | function submitHistoryForm() { |
---|
| 23 | var form = document.history; |
---|
| 24 | var path = form.path.options[form.path.selectedIndex].value; |
---|
| 25 | form.action = path; |
---|
| 26 | form.submit(); |
---|
| 27 | } |
---|
| 28 | </script> |
---|
| 29 | </head> |
---|
| 30 | <body class="popup atrefbrowser" onload="focus();self.name='referencebrowser_popup'" style="margin: 4px;padding:0.5em;" |
---|
| 31 | tal:define="border_color here/base_properties/globalBorderColor; |
---|
| 32 | at_url python:here.REQUEST.get('at_url'); |
---|
| 33 | fieldName python:here.REQUEST.get('fieldName'); |
---|
[2279] | 34 | fieldTitleName python:here.REQUEST.get('fieldTitleName',''); |
---|
| 35 | fieldLinkName python:here.REQUEST.get('fieldLinkName',''); |
---|
[2270] | 36 | order_idx python:here.REQUEST.get('order_idx', -1); |
---|
[2268] | 37 | fieldRealName python:here.REQUEST.get('fieldRealName'); |
---|
| 38 | at_obj python:here.restrictedTraverse(at_url); |
---|
| 39 | field python:at_obj.Schema()[fieldRealName]; |
---|
| 40 | widget python:field.widget; |
---|
| 41 | multi python:test(field.multiValued, '1', '0'); |
---|
| 42 | title python:widget.Label(at_obj); |
---|
| 43 | description python:widget.Description(at_obj); |
---|
| 44 | search_index python:here.REQUEST.get('search_index', widget.default_search_index); |
---|
| 45 | show_indexes widget/show_indexes; |
---|
| 46 | search_text python:here.REQUEST.get('searchValue', ''); |
---|
| 47 | dummy python:here.REQUEST.set(search_index, search_text); |
---|
| 48 | available_indexes python:widget.available_indexes; |
---|
| 49 | allow_search python:widget.allow_search; |
---|
| 50 | allow_browse python:widget.allow_browse; |
---|
| 51 | show_review_state widget/show_review_state; |
---|
| 52 | always_show widget/show_results_without_query|nothing; |
---|
| 53 | image_portal_types widget/image_portal_types; |
---|
| 54 | image_method widget/image_method|string:; |
---|
| 55 | restrict_browsing_to_startup_directory widget/restrict_browsing_to_startup_directory|python: True; |
---|
| 56 | base_query python:widget.getBaseQuery(at_obj, field); |
---|
| 57 | allowed_types base_query/portal_type; |
---|
| 58 | only_for_review_states widget/only_for_review_states; |
---|
| 59 | history_length widget/history_length; |
---|
| 60 | filter_review_states python: only_for_review_states is not None; |
---|
| 61 | dummy python: not allowed_types and base_query.pop('portal_type'); |
---|
| 62 | force_close_on_insert python:widget.force_close_on_insert; |
---|
| 63 | search_catalog widget/search_catalog|string:portal_catalog; |
---|
| 64 | close_window python:test(multi==0,0, test(force_close_on_insert, 0, 1)); |
---|
| 65 | getInfoFor python: context.portal_workflow.getInfoFor; |
---|
| 66 | b_size python:20; |
---|
| 67 | b_start python:0; |
---|
| 68 | b_start request/b_start | b_start; |
---|
| 69 | Batch python:modules['Products.CMFPlone'].Batch;"> |
---|
| 70 | |
---|
| 71 | <tal:if condition="python: history_length > 0"> |
---|
| 72 | <tal:insert define="dummy python: context.referencebrowser_insertHistory(request['PATH_TRANSLATED'], history_length)"/> |
---|
| 73 | </tal:if> |
---|
| 74 | |
---|
| 75 | <tal:if condition="request/clearHistory|nothing"> |
---|
| 76 | <tal:clear define="dummy python: request.SESSION.set('atrefbrowserwidget_history', [])" /> |
---|
| 77 | </tal:if> |
---|
| 78 | |
---|
| 79 | <div style="text-align:right; position: absolute; top: 1.4em; right: 1.0em;"> |
---|
| 80 | <a href="javascript:history.back()" i18n:translate="referencebrowser_back">Back</a> |
---|
| 81 | | |
---|
| 82 | <a href="javascript:window.close()" i18n:translate="referencebrowser_close">Close window</a> |
---|
| 83 | </div> |
---|
| 84 | <div style="text-align:right;margin-bottom:1.5em; margin-top: 2.5em;"> |
---|
| 85 | <div tal:condition="python: history_length > 0 " |
---|
| 86 | tal:define="history python: request.SESSION.get('atrefbrowserwidget_history', [])[:]"> |
---|
| 87 | <form tal:condition="history" |
---|
| 88 | action="referencebrowser_popup" method="GET" name="history" id="history"> |
---|
| 89 | <input type="hidden" name="fieldRealName" tal:attributes="value fieldRealName" /> |
---|
| 90 | <input type="hidden" name="fieldName" tal:attributes="value fieldName" /> |
---|
[2279] | 91 | <input type="hidden" name="fieldTitleName" tal:attributes="value fieldTitleName" /> |
---|
| 92 | <input type="hidden" name="fieldLinkName" tal:attributes="value fieldLinkName" /> |
---|
[2268] | 93 | <input type="hidden" name="order_idx" tal:attributes="value order_idx" /> |
---|
| 94 | <input type="hidden" name="at_url" tal:attributes="value at_url" /> |
---|
| 95 | <input type="hidden" name="clear:int" value="1" /> |
---|
| 96 | <label for="path" i18n:translate="referencebrowser_history">History</label> |
---|
| 97 | <select name="path" size="1"> |
---|
| 98 | <option value="" i18n:translate="" /> |
---|
| 99 | <option tal:repeat="tp history" |
---|
| 100 | tal:content="python: tp[1]" |
---|
| 101 | tal:attributes="value python: tp[0]" |
---|
| 102 | /> |
---|
| 103 | </select> |
---|
| 104 | <input class="context" type="button" value="Go" |
---|
| 105 | onclick="submitHistoryForm()" |
---|
| 106 | i18n:attributes="value label_go;" /> |
---|
| 107 | </form> |
---|
| 108 | <div tal:condition="history"> |
---|
| 109 | <a tal:attributes="href string:${request/ACTUAL_URL}?${request/QUERY_STRING}&clearHistory=1" i18n:translate="referencebrowser_clearhistory">Clear history</a> |
---|
| 110 | </div> |
---|
| 111 | </div> |
---|
| 112 | </div> |
---|
| 113 | |
---|
| 114 | <h2 class="documentFirstHeading" |
---|
| 115 | tal:content="title" /> |
---|
| 116 | <p class="formHelp" |
---|
| 117 | tal:content="structure description"/> |
---|
| 118 | |
---|
| 119 | <!-- Search form --> |
---|
| 120 | <form action="search" |
---|
| 121 | method="post" |
---|
| 122 | name="search" |
---|
| 123 | style="padding-bottom:0em;" |
---|
| 124 | tal:condition="allow_search" |
---|
| 125 | tal:define="DateTime python:modules['DateTime'].DateTime; |
---|
| 126 | indexes python:getattr(here, search_catalog, here.portal_catalog).indexes();" |
---|
| 127 | tal:attributes="action string:${here/absolute_url}/${template/getId}"> |
---|
| 128 | <tal:base_query tal:condition="base_query/keys|nothing"> |
---|
| 129 | <tal:alter_request tal:define="dummy python: request.form.update(base_query);"/> |
---|
| 130 | </tal:base_query> |
---|
| 131 | |
---|
| 132 | <div class="field" tal:condition="show_indexes"> |
---|
| 133 | <label i18n:translate="referencebrowser_search_index_label">Search index</label><br/> |
---|
| 134 | <select name="search_index" |
---|
| 135 | style="" |
---|
| 136 | id="indexSelector" |
---|
| 137 | tal:attributes="style string:font-family:${here/base_properties/fontFamily};;font-size:100%;"> |
---|
| 138 | <tal:indexes tal:repeat="index indexes"> |
---|
| 139 | <tal:filter tal:condition="python:(available_indexes!={} and available_indexes.has_key(index)) or available_indexes=={}"> |
---|
| 140 | <option value="" |
---|
| 141 | selected="" |
---|
| 142 | tal:attributes="value index; |
---|
| 143 | selected python:test(index==search_index, 'selected', '')" |
---|
| 144 | tal:content= "python:available_indexes[index]" |
---|
| 145 | tal:condition= "python:available_indexes.has_key(index)"/> |
---|
| 146 | |
---|
| 147 | <option value="" |
---|
| 148 | selected="" |
---|
| 149 | tal:attributes="value index; |
---|
| 150 | selected python:test(index==search_index, 'selected', '')" |
---|
| 151 | tal:content= "index" |
---|
| 152 | tal:condition= "python:not available_indexes.has_key(index)"/> |
---|
| 153 | </tal:filter> |
---|
| 154 | </tal:indexes> |
---|
| 155 | </select> |
---|
| 156 | </div> |
---|
| 157 | <div class="field"> |
---|
| 158 | <label i18n:translate="referencebrowser_search_term">Search terms</label><br/> |
---|
| 159 | <input type="text" |
---|
| 160 | id="searchGadget" |
---|
| 161 | name="searchValue" |
---|
| 162 | size="25" |
---|
| 163 | value="" |
---|
| 164 | tal:attributes="value search_text;" |
---|
| 165 | /> |
---|
| 166 | <input class="searchButton" |
---|
| 167 | type="submit" |
---|
| 168 | name="submit" |
---|
| 169 | value="Search" |
---|
| 170 | i18n:domain="plone" |
---|
| 171 | i18n:attributes="value label_search;" |
---|
| 172 | /> |
---|
| 173 | </div> |
---|
| 174 | <!-- add these to make sure that after a search result, we still have these paremeters --> |
---|
| 175 | <input type="hidden" name="fieldName" value="" tal:attributes="value fieldName" /> |
---|
[2279] | 176 | <input type="hidden" name="fieldTitleName" value="" tal:attributes="value fieldTitleName" /> |
---|
| 177 | <input type="hidden" name="fieldLinkName" value="" tal:attributes="value fieldLinkName" /> |
---|
[2268] | 178 | <input type="hidden" name="order_idx" value="" tal:attributes="value order_idx" /> |
---|
| 179 | <input type="hidden" name="fieldRealName" value="" tal:attributes="value fieldRealName" /> |
---|
| 180 | <input type="hidden" name="at_url" value="" tal:attributes="value at_url" /> |
---|
| 181 | </form> |
---|
| 182 | <div id="message" class="portalMessage" style="display:none;margin-top:0px;"> |
---|
| 183 | <span i18n:translate="referencebrowser_text_added_reference">Added reference to:</span> <span id="messageTitle"></span> |
---|
| 184 | </div> |
---|
| 185 | <!-- actual list of objects, either searchresults or folder contents --> |
---|
| 186 | <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)];"> |
---|
| 187 | <div style="border-top:1px solid black;border-bottom:1px solid black;" |
---|
| 188 | tal:attributes="style string:border-top:1px solid ${border_color};; |
---|
| 189 | border-bottom:1px solid ${border_color};; |
---|
| 190 | margin-bottom:1em;;padding:0.2em 0 0.1em 0;; |
---|
| 191 | margin-top:1.5em;;" |
---|
| 192 | tal:condition="python:((search_text!='' or not allow_browse) and query_results!=[])"> |
---|
| 193 | <span i18n:translate="referencebrowser_heading_search_results">Search results</span> |
---|
| 194 | </div> |
---|
| 195 | <!-- breadcrums --> |
---|
| 196 | <div style="border-top:1px solid black;border-bottom:1px solid black;" |
---|
| 197 | tal:attributes="style string:border-top:1px solid ${border_color};; |
---|
| 198 | border-bottom:1px solid ${border_color};; |
---|
| 199 | margin-bottom:1em;;padding:0.2em 0 0.1em 0;;margin-top:1.5em;" |
---|
| 200 | tal:condition= "python:search_text=='' and allow_browse" |
---|
| 201 | tal:define= "portal here/portal_url/getPortalObject; |
---|
| 202 | putils nocall:portal/plone_utils; |
---|
| 203 | crumbs python:putils.createBreadCrumbs(here); |
---|
| 204 | crumbs python: test(True, context.referencebrowser_filterBreadCrumbs(crumbs, widget.startup_directory), crumbs); |
---|
| 205 | isRTL python:portal.restrictedTraverse('@@plone_portal_state').is_rtl(); |
---|
| 206 | parents request/PARENTS; |
---|
| 207 | nil python: parents.reverse(); |
---|
| 208 | navroot context/@@plone_portal_state/navigation_root_url |
---|
| 209 | "> |
---|
| 210 | |
---|
| 211 | <img tal:attributes="src string:${here/portal_url}/logoIcon.gif"/> |
---|
| 212 | <tal:if condition="not: restrict_browsing_to_startup_directory"> |
---|
| 213 | <a i18n:translate="tabs_home" |
---|
[2279] | 214 | tal:attributes="href string:${navroot}/${template/getId}?fieldName=${fieldName}&fieldRealName=${fieldRealName}&at_url=${at_url}&order_idx=${order_idx}&fieldTitleName=${fieldTitleName}&fieldLinkName=${fieldLinkName}"> |
---|
[2268] | 215 | Home |
---|
| 216 | </a> |
---|
| 217 | |
---|
| 218 | <span tal:condition="crumbs" class="breadcrumbSeparator"> |
---|
| 219 | <tal:ltr condition="not: isRTL">→</tal:ltr> |
---|
| 220 | <tal:rtl condition="isRTL">←</tal:rtl> |
---|
| 221 | </span> |
---|
| 222 | </tal:if> |
---|
| 223 | |
---|
| 224 | |
---|
| 225 | <tal:crums tal:repeat="crumb crumbs"> |
---|
| 226 | |
---|
[2279] | 227 | <a tal:attributes="href string:${crumb/absolute_url}/${template/getId}?fieldName=${fieldName}&fieldRealName=${fieldRealName}&at_url=${at_url}&order_idx=${order_idx}&fieldTitleName=${fieldTitleName}&fieldLinkName=${fieldLinkName}"> |
---|
[2268] | 228 | <span tal:content="string:${crumb/Title}"> |
---|
| 229 | Breadcrumb Title |
---|
| 230 | </span> |
---|
| 231 | </a> |
---|
| 232 | |
---|
| 233 | <span tal:condition="not: repeat/crumb/end" |
---|
| 234 | class="breadcrumbSeparator"> |
---|
| 235 | <tal:ltr condition="not: isRTL">→</tal:ltr> |
---|
| 236 | <tal:rtl condition="isRTL">←</tal:rtl> |
---|
| 237 | </span> |
---|
| 238 | |
---|
| 239 | </tal:crums> |
---|
| 240 | |
---|
| 241 | |
---|
| 242 | </div> |
---|
| 243 | |
---|
| 244 | <!-- object list --> |
---|
| 245 | <tal:noresults tal:condition="python:(search_text!='' or not allow_browse) and query_results==[]"> |
---|
| 246 | <p i18n:translate="referencebrowser_no_items_found">No items found.</p> |
---|
| 247 | </tal:noresults> |
---|
| 248 | <tal:list tal:define="checkPermission python: here.portal_membership.checkPermission; |
---|
| 249 | folder_contents here/listFolderContents|python:[]; |
---|
| 250 | results python: test(search_text!='' or not allow_browse, query_results, test(allow_browse, [item for item in folder_contents if checkPermission('View',item)], [])); |
---|
| 251 | batch python: Batch(results, b_size, int(b_start), orphan=1);"> |
---|
| 252 | <table class="group" |
---|
| 253 | width="100%" |
---|
| 254 | cellspacing="0" |
---|
| 255 | cellpadding="2" |
---|
| 256 | tal:condition="batch"> |
---|
| 257 | <tbody> |
---|
| 258 | |
---|
| 259 | |
---|
| 260 | <tal:results tal:repeat="item batch"> |
---|
| 261 | <tal:row tal:define="uid item/aq_explicit/UID|string:''; |
---|
| 262 | item_referenceable python:((allowed_types and (item.portal_type in allowed_types)) or not allowed_types); |
---|
| 263 | review_state_allows python: test(filter_review_states, getInfoFor(item, 'review_state', None) in (only_for_review_states or ()), True); |
---|
| 264 | has_uid python:hasattr(item.aq_explicit, 'UID'); |
---|
| 265 | referenceable python:has_uid and item_referenceable and review_state_allows and item!=at_obj; |
---|
| 266 | color here/base_properties/discreetColor;"> |
---|
| 267 | |
---|
| 268 | <tr tal:define="oddrow repeat/item/odd" |
---|
| 269 | tal:attributes="class python:test(oddrow, 'even', 'odd')"> |
---|
| 270 | <td tal:condition="image_portal_types"> |
---|
| 271 | <tal:if condition="python: item.getTypeInfo().Title() in image_portal_types" > |
---|
| 272 | <img tal:attributes="src string:${item/absolute_url}/$image_method" /> |
---|
| 273 | </tal:if> |
---|
| 274 | </td> |
---|
| 275 | <td width="50%"> |
---|
| 276 | <img src="#" tal:attributes="src string:${here/portal_url}/${item/getIcon};alt item/Title" /> |
---|
| 277 | <a tal:condition="python: item.isPrincipiaFolderish and allow_browse" |
---|
[2279] | 278 | tal:attributes="href python:item.absolute_url() + '/' + template.getId() + '?fieldName='+ fieldName + '&fieldRealName=' + fieldRealName + '&at_url='+at_url + '&order_idx='+order_idx + '&fieldTitleName='+fieldTitleName + '&fieldLinkName='+fieldLinkName"> |
---|
[2268] | 279 | <strong tal:condition="referenceable" |
---|
| 280 | tal:content="item/title_or_id">Title</strong> |
---|
| 281 | <span style="" |
---|
| 282 | tal:condition="not: referenceable" |
---|
| 283 | tal:content="item/title_or_id"/> |
---|
| 284 | </a> |
---|
| 285 | <tal:foldercheck tal:condition="python: not ((item.isPrincipiaFolderish and allow_browse) and item <> here)" > |
---|
| 286 | <strong tal:condition="referenceable" |
---|
| 287 | tal:content="item/title_or_id">Title |
---|
| 288 | </strong> |
---|
| 289 | <span style="" |
---|
| 290 | tal:condition="python:not referenceable" |
---|
| 291 | tal:content="item/title_or_id" |
---|
| 292 | tal:attributes="style string:color:${color}" /> |
---|
| 293 | </tal:foldercheck> |
---|
| 294 | |
---|
| 295 | <div tal:condition="show_review_state"> |
---|
| 296 | <span tal:define="state python: getInfoFor(item, 'review_state', None)" |
---|
| 297 | tal:attributes="class string:state-$state" |
---|
| 298 | i18n:translate="" i18n:domain="plone" tal:content="state" |
---|
| 299 | /> |
---|
| 300 | </div> |
---|
| 301 | |
---|
| 302 | <div class="additionalInfo" tal:content="structure item/additionalReferenceInfo | nothing" /> |
---|
| 303 | </td> |
---|
| 304 | |
---|
| 305 | <td width="25%" |
---|
| 306 | style="" |
---|
| 307 | i18n:domain="plone" |
---|
| 308 | i18n:translate="" |
---|
| 309 | tal:attributes="style python:test(referenceable, '', 'color:' + color)" |
---|
| 310 | tal:content="python:item.getTypeInfo().Title()"> |
---|
| 311 | Title |
---|
| 312 | </td> |
---|
| 313 | <td width="25%" |
---|
| 314 | nowrap="nowrap" |
---|
| 315 | style="text-align:right" |
---|
[2279] | 316 | tal:define="title python:item.title_or_id().replace('\'', '\\\''); |
---|
[2281] | 317 | path python:'/'+item.absolute_url(1)"> |
---|
[2268] | 318 | <tal:referenceable tal:condition="referenceable"> |
---|
| 319 | <a href="" |
---|
| 320 | onclick="" |
---|
| 321 | tal:attributes="href string:#; |
---|
[2279] | 322 | onclick string:window.opener.referencebrowser_setReference('${fieldName}', '${uid}', '${title}', ${multi}, ${order_idx}, '${fieldTitleName}', '${title}', '${fieldLinkName}', '${path}');; if (0==${close_window}) {window.close()} else {showMessage('${title}')};; ;"> |
---|
[2268] | 323 | <strong i18n:translate="referencebrowser_insert_reference">Insert</strong> |
---|
| 324 | </a> |
---|
| 325 | | |
---|
| 326 | <a href="" target="_blank" |
---|
| 327 | tal:attributes="href python:item.absolute_url();"> |
---|
| 328 | <strong i18n:translate="referencebrowser_browse">Browse</strong> |
---|
| 329 | </a> |
---|
| 330 | </tal:referenceable> |
---|
| 331 | </td> |
---|
| 332 | </tr> |
---|
| 333 | </tal:row> |
---|
| 334 | </tal:results> |
---|
| 335 | </tbody> |
---|
| 336 | </table> |
---|
| 337 | <div metal:use-macro="here/batch_macros/macros/navigation" /> |
---|
| 338 | </tal:list> |
---|
| 339 | </tal:block> |
---|
| 340 | <div style="text-align:right;margin-top:1em;margin-bottom:2em;"> |
---|
| 341 | <a href="javascript:history.back()" i18n:translate="referencebrowser_back">Back</a> |
---|
| 342 | | |
---|
| 343 | <a href="javascript:window.close()" i18n:translate="referencebrowser_close">Close window</a> |
---|
| 344 | </div> |
---|
| 345 | </body> |
---|
| 346 | </html> |
---|