Author: raintang
Date: 2009-06-26 08:51:23 +0200 (Fri, 26 Jun 2009)
New Revision: 36440
Modified:
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_contentelement_posrel_urls.xml
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_faqitem_posrel_urls.xml
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_link_posrel_urls.xml
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/xsl/wizard.xsl
Log:
CMSC-1437 Relate assets in Edit Wizard neglects input field
Modified:
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
2009-06-26 06:51:23 UTC (rev 36440)
@@ -28,15 +28,15 @@
<prompt xml:lang="nl">Zoek url</prompt>
<prompt xml:lang="zh">查找Url</prompt>
<search-filter>
- <name xml:lang="en">Name / Description</name>
- <name xml:lang="nl">Naam / Omschrijving</name>
- <name xml:lang="zh">名称 / 描述</name>
+ <name xml:lang="en">Title / Description</name>
+ <name xml:lang="nl">Titel / Omschrijving</name>
+ <name xml:lang="zh">标题 / 描述</name>
<search-fields>[title]|[description]</search-fields>
</search-filter>
<search-filter>
- <name xml:lang="en">Name contains</name>
- <name xml:lang="nl">Naam bevat</name>
- <name xml:lang="zh">名称包含</name>
+ <name xml:lang="en">Title contains</name>
+ <name xml:lang="nl">Titel bevat</name>
+ <name xml:lang="zh">标题包含</name>
<search-fields>[title]</search-fields>
</search-filter>
<search-filter>
Modified:
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_contentelement_posrel_urls.xml
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_contentelement_posrel_urls.xml
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_contentelement_posrel_urls.xml
2009-06-26 06:51:23 UTC (rev 36440)
@@ -27,19 +27,19 @@
<prompt xml:lang="en">Search URL</prompt>
<prompt xml:lang="nl">Zoek URL</prompt>
<prompt xml:lang="zh">查找URL</prompt>
+ <search-filter>
+ <name xml:lang="en">Title / Description</name>
+ <name xml:lang="nl">Titel / Omschrijving</name>
+ <name xml:lang="zh">标题 / 描述</name>
+ <search-fields>[title]|[description]</search-fields>
+ </search-filter>
+ <search-filter>
+ <name xml:lang="en">Title contains</name>
+ <name xml:lang="nl">Titel bevat</name>
+ <name xml:lang="zh">标题包含</name>
+ <search-fields>[title]</search-fields>
+ </search-filter>
<search-filter>
- <name xml:lang="en">Name / Description</name>
- <name xml:lang="nl">Naam / Omschrijving</name>
- <name xml:lang="zh">名称 / 描述</name>
- <search-fields>[title]|[description]</search-fields>
- </search-filter>
- <search-filter>
- <name xml:lang="en">Name contains</name>
- <name xml:lang="nl">Naam bevat</name>
- <name xml:lang="zh">名称包含</name>
- <search-fields>[title]</search-fields>
- </search-filter>
- <search-filter>
<name xml:lang="en">URL contains</name>
<name xml:lang="nl">URL bevat</name>
<name xml:lang="zh">名URL包含</name>
Modified:
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_faqitem_posrel_urls.xml
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_faqitem_posrel_urls.xml
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_faqitem_posrel_urls.xml
2009-06-26 06:51:23 UTC (rev 36440)
@@ -27,19 +27,19 @@
<prompt xml:lang="en">Search url</prompt>
<prompt xml:lang="nl">Zoek url</prompt>
<prompt xml:lang="zh">查找Url</prompt>
+ <search-filter>
+ <name xml:lang="en">Title / Description</name>
+ <name xml:lang="nl">Titel / Omschrijving</name>
+ <name xml:lang="zh">标题 / 描述</name>
+ <search-fields>[title]|[description]</search-fields>
+ </search-filter>
+ <search-filter>
+ <name xml:lang="en">Title contains</name>
+ <name xml:lang="nl">Titel bevat</name>
+ <name xml:lang="zh">标题包含</name>
+ <search-fields>[title]</search-fields>
+ </search-filter>
<search-filter>
- <name xml:lang="en">Name / Description</name>
- <name xml:lang="nl">Naam / Omschrijving</name>
- <name xml:lang="zh">名称 / 描述</name>
- <search-fields>[title]|[description]</search-fields>
- </search-filter>
- <search-filter>
- <name xml:lang="en">Name contains</name>
- <name xml:lang="nl">Naam bevat</name>
- <name xml:lang="zh">Name包含</name>
- <search-fields>[title]</search-fields>
- </search-filter>
- <search-filter>
<name xml:lang="en">Url contains</name>
<name xml:lang="nl">Url bevat</name>
<name xml:lang="zh">Url包含</name>
Modified:
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_link_posrel_urls.xml
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_link_posrel_urls.xml
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_link_posrel_urls.xml
2009-06-26 06:51:23 UTC (rev 36440)
@@ -27,19 +27,19 @@
<prompt xml:lang="en">Search url</prompt>
<prompt xml:lang="nl">Zoek url</prompt>
<prompt xml:lang="zh">查找Url</prompt>
+ <search-filter>
+ <name xml:lang="en">Title / Description</name>
+ <name xml:lang="nl">Titel / Omschrijving</name>
+ <name xml:lang="zh">标题 / 描述</name>
+ <search-fields>[title]|[description]</search-fields>
+ </search-filter>
+ <search-filter>
+ <name xml:lang="en">Title contains</name>
+ <name xml:lang="nl">Titel bevat</name>
+ <name xml:lang="zh">标题包含</name>
+ <search-fields>[title]</search-fields>
+ </search-filter>
<search-filter>
- <name xml:lang="en">Name / Description</name>
- <name xml:lang="nl">Naam / Omschrijving</name>
- <name xml:lang="zh">名称 / 描述</name>
- <search-fields>[title]|[description]</search-fields>
- </search-filter>
- <search-filter>
- <name xml:lang="en">Name contains</name>
- <name xml:lang="nl">Naam bevat</name>
- <name xml:lang="zh">名称包含</name>
- <search-fields>[title]</search-fields>
- </search-filter>
- <search-filter>
<name xml:lang="en">Url contains</name>
<name xml:lang="nl">Url bevat</name>
<name xml:lang="zh">Url包含</name>
Modified:
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
2009-06-26 06:51:23 UTC (rev 36440)
@@ -1,5 +1,8 @@
package com.finalist.cmsc.resources.forms;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -8,11 +11,13 @@
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.mmbase.bridge.Cloud;
+import org.mmbase.bridge.Field;
import org.mmbase.bridge.NodeList;
import org.mmbase.bridge.NodeManager;
import org.mmbase.bridge.NodeQuery;
import org.mmbase.bridge.util.Queries;
import org.mmbase.bridge.util.SearchUtil;
+import org.mmbase.storage.search.Constraint;
import org.mmbase.storage.search.FieldCompareConstraint;
import org.mmbase.storage.search.FieldValueConstraint;
import org.mmbase.storage.search.SortOrder;
@@ -27,6 +32,14 @@
public class SearchInitAction extends MMBaseAction {
+ private static final String RESULT_COUNT = "resultCount";
+ private static final String RESULTS = "results";
+ private static final String SEARCHOPTIONS = "searchoptions";
+ private static final String REGULAREXP = "\\[([a-zA-Z]+)\\]";
+ private static final String NAME = "name";
+ private static final String TERM = "term";
+ private static final String SEARCHFIELDS = "searchfields";
+ private static final String TITLE = "title";
private static final String STRICT = "strict";
/**
* MMbase logging system
@@ -60,16 +73,39 @@
String order = searchForm.getOrder();
// set default order field
if (StringUtils.isEmpty(order)) {
- if (nodeManager.hasField("title")) {
- order = "title";
+ if (nodeManager.hasField(TITLE)) {
+ order = TITLE;
}
- if (nodeManager.hasField("name")) {
- order = "name";
+ if (nodeManager.hasField(NAME)) {
+ order = NAME;
}
}
if (StringUtils.isNotEmpty(order)) {
query.addSortOrder(query.getStepField(nodeManager.getField(order)),
searchForm.getDirection());
}
+ // CMSC-1436 Relate assets in Edit Wizard neglects input field
+ String searchfields = request.getParameter(SEARCHFIELDS);
+ String term = request.getParameter(TERM);
+ if (StringUtils.isNotEmpty(searchfields) &&
StringUtils.isNotEmpty(term)) {
+ Pattern p = Pattern.compile(REGULAREXP);
+ Matcher mach = p.matcher(searchfields);
+ boolean hasTitle = false;
+ while (mach.find()) {
+ String search = mach.group(1);
+ if (nodeManager.hasField(search)) {
+ Field field = nodeManager.getField(search);
+ Constraint constraint = SearchUtil.createLikeConstraint(query,
field, term);
+ if (!hasTitle) {
+ SearchUtil.addConstraint(query, constraint);
+ request.setAttribute(search, term);
+ hasTitle = true;
+ } else {
+ SearchUtil.addORConstraint(query, constraint);
+ }
+ }
+ }
+ }
+ // end of CMSC-1436
query.setDistinct(true);
// Set the maximum result size.
@@ -83,8 +119,8 @@
int resultCount = Queries.count(query);
NodeList results = nodeManager.getList(query);
- request.setAttribute("results",results);
- request.setAttribute("resultCount",resultCount);
+ request.setAttribute(RESULTS,results);
+ request.setAttribute(RESULT_COUNT,resultCount);
if (StringUtils.isEmpty(searchForm.getOffset())) {
searchForm.setOffset("0");
}
@@ -93,6 +129,6 @@
searchForm.setDirection(SortOrder.ORDER_ASCENDING);
}
request.setAttribute(STRICT, searchForm.getStrict());
- return actionMapping.findForward("searchoptions");
+ return actionMapping.findForward(SEARCHOPTIONS);
}
}
Modified:
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
2009-06-26 06:51:23 UTC (rev 36440)
@@ -9,6 +9,10 @@
<script src="../repository/search.js" type="text/javascript"></script>
<script src="../resources/assetsearch.js" type="text/javascript"></script>
<script type="text/javascript">
+ function setDefaultSearchCondition(){
+ document.forms[0].title.value = "${title}";
+ document.forms[0].description.value = "${description}";
+ }
function showInfo(objectnumber) {
openPopupWindow('attachmentinfo', '900', '500',
'../resources/attachmentinfo.jsp?objectnumber='
+ objectnumber);
@@ -16,7 +20,7 @@
</script>
<link rel="stylesheet" type="text/css" href="../css/assetsearch.css" />
</cmscedit:head>
-<body>
+<body onload="setDefaultSearchCondition()">
<mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
<mm:import externid="action">search</mm:import><%-- either often or search --%>
<mm:import externid="assetShow">list</mm:import><%-- either list or thumbnail
--%>
Modified:
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
2009-06-26 06:51:23 UTC (rev 36440)
@@ -9,6 +9,10 @@
<script src="../repository/search.js" type="text/javascript"></script>
<script src="../resources/assetsearch.js" type="text/javascript"></script>
<script type="text/javascript">
+ function setDefaultSearchCondition(){
+ document.forms[0].title.value = "${title}";
+ document.forms[0].description.value = "${description}";
+ }
function showInfo(objectnumber) {
openPopupWindow('imageinfo', '900', '500',
'../resources/imageinfo.jsp?objectnumber=' + objectnumber);
@@ -16,7 +20,7 @@
</script>
<link rel="stylesheet" type="text/css" href="../css/assetsearch.css" />
</cmscedit:head>
-<body>
+<body onload="setDefaultSearchCondition()">
<mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
<mm:import externid="action">search</mm:import><%-- either often or search --%>
<mm:import externid="assetShow">list</mm:import><%-- either list or thumbnail
--%>
Modified:
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
2009-06-26 06:51:23 UTC (rev 36440)
@@ -9,6 +9,11 @@
<script src="../repository/search.js" type="text/javascript"></script>
<script src="../resources/assetsearch.js" type="text/javascript"></script>
<script type="text/javascript">
+ function setDefaultSearchCondition(){
+ document.forms[0].title.value = "${title}";
+ document.forms[0].description.value = "${description}";
+ document.forms[0].url.value = "${url}";
+ }
function showInfo(objectnumber) {
openPopupWindow('urlinfo', '900', '500',
'../resources/urlinfo.jsp?objectnumber=' +
objectnumber);
@@ -16,7 +21,7 @@
</script>
<link rel="stylesheet" type="text/css" href="../css/assetsearch.css"
/>
</cmscedit:head>
-<body>
+<body onload="setDefaultSearchCondition()">
<mm:cloud jspvar="cloud" loginpage="../../editors/login.jsp">
<mm:import externid="action">search</mm:import><%-- either often or search --%>
<mm:import externid="assetShow">list</mm:import><%-- either list or thumbnail
--%>
Modified:
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
2009-06-26 06:51:23 UTC (rev 36440)
@@ -387,21 +387,23 @@
urls:""
}
-function getAssets(type, channelid){
- //alert(Data[type]);
+function getAssets(type, searchfields, searchterm){
var width=730;
var height=550;
+ var searchfield = document.getElementsByName(searchfields)[0].value;
+ var term = document.getElementsByName(searchterm)[0].value;
var url='../../../../editors/resources/';
- if(type.toLowerCase() == 'attachments') {
- url += 'AttachmentInitAction.do?strict=attachments';
- }
- else if (type.toLowerCase() == 'images') {
- url += 'ImageInitAction.do?strict=images';
- }
- else if (type.toLowerCase() == 'urls') {
- url += 'UrlInitAction.do?strict=urls';
- }
- var windowName='contentselector';
+ if(type.toLowerCase() == 'attachments') {
+ url += 'AttachmentInitAction.do?strict=attachments';
+ }
+ else if (type.toLowerCase() == 'images') {
+ url += 'ImageInitAction.do?strict=images';
+ }
+ else if (type.toLowerCase() == 'urls') {
+ url += 'UrlInitAction.do?strict=urls';
+ }
+ url += '&searchfields='+searchfield+"&term="+term;
+ var windowName='contentselector';
var options = getPopupPositionProps(width, height) +
',status=yes,toolbar=no,titlebar=no,scrollbars=yes,resizable=yes,menubar=no';
window.open(url, windowName, options);
}
Modified:
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/xsl/wizard.xsl
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/xsl/wizard.xsl
2009-06-26 06:20:59 UTC (rev 36439)
+++
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/xsl/wizard.xsl
2009-06-26 06:51:23 UTC (rev 36440)
@@ -639,7 +639,7 @@
<!-- on change the current value is copied back to the option's
default, because of that, the user's search is stored between different types
of search-actions -->
</td>
<td>
- <a href="#"
onclick="select_fid='{../@fid}';select_did='{../comma...@name='add-item']/@value}';getAssets('{...@nodepath}','current')"
class="button">
+ <a href="#"
onclick="select_fid='{../@fid}';select_did='{../comma...@name='add-item']/@value}';getAssets('{...@nodepath}','searchfields_{../comma...@name='add-item']/@cmd}','searchterm_{../comma...@name='add-item']/@cmd}')"
class="button">
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
@@ -677,7 +677,7 @@
<!-- on change the current value is copied back to the option's
default, because of that, the user's search is stored between different types
of search-actions -->
</td>
<td>
- <a href="#"
onclick="select_fid='{../@fid}';select_did='{../comma...@name='add-item']/@value}';getAssets('{...@nodepath}','siteassets')"
class="button">
+ <a href="#"
onclick="select_fid='{../@fid}';select_did='{../comma...@name='add-item']/@value}';getAssets('{...@nodepath}','searchfields_{../comma...@name='add-item']/@cmd}','searchterm_{../comma...@name='add-item']/@cmd}')"
class="button">
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs