Author: raintang
Date: 2009-06-26 07:08:53 +0200 (Fri, 26 Jun 2009)
New Revision: 36438
Modified:
CMSContainer/branches/b1_6/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
CMSContainer/branches/b1_6/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
CMSContainer/branches/b1_6/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/branches/b1_6/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
===================================================================
---
CMSContainer/branches/b1_6/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
2009-06-26 03:39:50 UTC (rev 36437)
+++
CMSContainer/branches/b1_6/CMSContainer/cmsc/basicmodel/src/webapp/editors/config/urls/search_article_posrel_urls.xml
2009-06-26 05:08:53 UTC (rev 36438)
@@ -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/branches/b1_6/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
===================================================================
---
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
2009-06-26 03:39:50 UTC (rev 36437)
+++
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/java/com/finalist/cmsc/resources/forms/SearchInitAction.java
2009-06-26 05:08:53 UTC (rev 36438)
@@ -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,20 +32,28 @@
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
*/
private static final Logger log =
Logging.getLoggerInstance(SearchInitAction.class.getName());
-
+
private static final String REPOSITORY_SEARCH_RESULTS_PER_PAGE =
"repository.search.results.per.page";
+
@Override
- public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm,
- HttpServletRequest request, HttpServletResponse httpServletResponse,
Cloud cloud) throws Exception {
- SearchForm searchForm = (SearchForm) actionForm;
-
+ public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm, HttpServletRequest request,
+ HttpServletResponse httpServletResponse, Cloud cloud) throws
Exception {
+ SearchForm searchForm = (SearchForm) actionForm;
+
// Initialize
-
NodeManager nodeManager =
cloud.getNodeManager(searchForm.getContenttypes());
NodeQuery query = cloud.createNodeQuery();
@@ -61,16 +74,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.
@@ -84,9 +120,9 @@
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");
}
@@ -95,6 +131,6 @@
searchForm.setDirection(SortOrder.ORDER_ASCENDING);
}
request.setAttribute(STRICT, searchForm.getStrict());
- return actionMapping.findForward("searchoptions");
+ return actionMapping.findForward(SEARCHOPTIONS);
}
}
Modified:
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
===================================================================
---
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
2009-06-26 03:39:50 UTC (rev 36437)
+++
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/attachmentsearch.jsp
2009-06-26 05:08:53 UTC (rev 36438)
@@ -8,6 +8,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);
@@ -15,7 +19,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/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
===================================================================
---
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
2009-06-26 03:39:50 UTC (rev 36437)
+++
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/imagesearch.jsp
2009-06-26 05:08:53 UTC (rev 36438)
@@ -8,6 +8,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);
@@ -15,7 +19,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/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
===================================================================
---
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
2009-06-26 03:39:50 UTC (rev 36437)
+++
CMSContainer/branches/b1_6/CMSContainer/cmsc/contentrepository/src/webapp/editors/resources/urlsearch.jsp
2009-06-26 05:08:53 UTC (rev 36438)
@@ -8,6 +8,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);
@@ -15,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/branches/b1_6/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
===================================================================
---
CMSContainer/branches/b1_6/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
2009-06-26 03:39:50 UTC (rev 36437)
+++
CMSContainer/branches/b1_6/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/javascript/override.js
2009-06-26 05:08:53 UTC (rev 36438)
@@ -1,412 +1,414 @@
-var select_fid = '';
-var select_did = '';
-
-function selectPage(param, path, pos) {
- if (select_fid != null && select_did != null) {
- doAdd(param, 'cmd/add-item/' + select_fid + '/' + select_did + '//');
- }
-}
-
-function selectChannel(param, path, pos) {
- if (select_fid != null && select_did != null) {
- doAdd(param, 'cmd/add-item/' + select_fid + '/' + select_did + '//');
- }
-}
-
-function selectContent(param, path, pos) {
- if (select_fid != null && select_did != null) {
- doAdd(param, 'cmd/add-item/' + select_fid + '/' + select_did + '//');
- }
-}
-
-function setWorkflowCommand(command) {
- var workflowCommand = document.getElementById("workflowcommand");
- if (workflowCommand) {
- workflowCommand.value = command;
- }
-}
-
-function setWorkflowComment() {
- var workflowComment = document.getElementById("workflowcomment");
- if (workflowComment) {
- var comment = prompt("Opmerking ?","");
- if (comment != null && comment != ""){ // OK pressed
- workflowComment.value = comment;
- }
- }
-}
-
-function doFinish() {
- if (!isSaveInactive()) {
- setWorkflowCommand("finish");
- clearScroll();
- setButtonsInactive();
- doSendDelayedCommand("cmd/commit////");
- }
-}
-
-function doAccept() {
- if (!isSaveInactive()) {
- setWorkflowCommand("accept");
- clearScroll();
- setButtonsInactive();
- doSendDelayedCommand("cmd/commit////");
- }
-}
-
-function doPublish() {
- if (!isSaveInactive()) {
- setWorkflowCommand("publish");
- clearScroll();
- setButtonsInactive();
- doSendDelayedCommand("cmd/commit////");
- }
-}
-
-function doReject() {
- setWorkflowComment();
- setWorkflowCommand("reject");
- clearScroll();
- setButtonsInactive();
- doSendDelayedCommand("cmd/cancel////");
-}
-
-function doCancel() {
- setWorkflowCommand("cancel");
- clearScroll();
- setButtonsInactive();
- doSendDelayedCommand("cmd/cancel////");
-}
-
-function updateHtml(el, err, silent) {
- updateErrormesg(el, err, silent)
- updatePrompt(el, err, silent);
-}
-
-function updateErrormesg(el, err, silent) {
- var prompt = document.getElementById("errormesg_" + el.name);
- if (prompt && !silent) {
- var orgprompt = prompt.getAttribute("prompt");
- var description = prompt.getAttribute("description");
- if (err.length > 0) {
- prompt.innerHTML = err;
-
- } else {
- prompt.innerHTML = "";
- }
- }
-}
-
-function updatePrompt(el, err, silent) {
- var prompt = document.getElementById("prompt_" + el.name);
- if (prompt && !silent) {
- var orgprompt = prompt.getAttribute("prompt");
- var description = prompt.getAttribute("description");
- if (err.length > 0) {
- prompt.title = description+"
\n\n"+getToolTipValue(form,"message_thisnotvalid",
- "This field is not valid")+":\n "+err;
- prompt.className = "notvalid";
- } else {
- prompt.className = "valid";
- prompt.title = description;
- }
- }
-}
-
-function updateButtons(allvalid) {
- var savebut = document.getElementById("bottombutton-save");
- var saveonlybut = document.getElementById("bottombutton-saveonly");
- if (allvalid) {
- setSaveInactive("false");
- enableButton(savebut,"titlesave", "Stores all changes.");
- if (saveonlybut != null) {
- enableButton(saveonlybut,"titlesave", "Stores all changes.");
- }
- enableButton(document.getElementById("bottombutton-finish"),
"titlefinish", "Store all changes");
- enableButton(document.getElementById("bottombutton-accept"),
"titleaccept", "Store all changes");
- enableButton(document.getElementById("bottombutton-reject"),
"titlereject", "Store all changes");
- enableButton(document.getElementById("bottombutton-publish"),
"titlepublish", "Store all changes");
- } else {
- setSaveInactive("true");
- disableButton(savebut,"titlenosave", "You cannot save because one or
more forms are invalid.");
- if (saveonlybut != null) {
- disableButton(saveonlybut,"titlenosave", "You cannot save because
one or more forms are invalid.");
- }
-
disableButton(document.getElementById("bottombutton-finish"),"titlenofinish",
"The changes cannot be saved, since some data is not filled in correctly.");
-
disableButton(document.getElementById("bottombutton-accept"),"titlenoaccept",
"The changes cannot be saved, since some data is not filled in correctly.");
-
disableButton(document.getElementById("bottombutton-reject"),"titlenoreject",
"The changes cannot be saved, since some data is not filled in correctly.");
-
disableButton(document.getElementById("bottombutton-publish"),"titlenopublish",
"The changes cannot be saved, since some data is not filled in correctly.");
- }
-}
-
-function resizeEditTable() {
- var divButtonsHeight =
document.getElementById("commandbuttonbar").offsetHeight;
- var divTop = findPosY(document.getElementById("editform"));
-
- var isIE = (navigator.appVersion.indexOf('MSIE')!=-1);
-
- if (isIE && (navigator.appVersion.indexOf('Mac')!=-1)) {
-
- // IE on the Mac has some overflow problems.
- // These statements will move the button div to the right position and
- // resizes the editform div.
- var docHeight = getDimensions().documentHeight;
- document.getElementById("editform").style.height = docHeight - (divTop +
divButtonsHeight);
- // The div is relative positioned to the surrounding table.
- // +10, because we have a padding of 10 in the css.
- document.getElementById("commandbuttonbar").style.top = docHeight -
(2*divButtonsHeight + 10);
- }
- else {
- var docHeight = getDimensions().windowHeight;
- document.getElementById("editform").style.height = docHeight - (divTop
+ divButtonsHeight);
- }
- var docWidth = getDimensions().windowWidth;
- document.getElementById("editform").style.width = docWidth-((isIE)?5:0);
-
- var textareas = document.getElementsByTagName("textarea");
-
- for (var i = 0 ; i < textareas.length ; i++) {
- if(isSubEditElement(textareas[i])) {
- //textareas[i].style.width = docWidth - 355;
- textareas[i].style.width = '99%';
- }
- else {
- //removetextareas[i].style.width = docWidth - 100;
- textareas[i].style.width = '99%';
- }
- }
-
- var iframes = document.getElementsByTagName("iframe");
-
- for (var i = 0 ; i < iframes.length ; i++) {
- iframes[i].style.width = '99%';
- }
-}
-
-function inits(){
- var inputs =document.getElementsByTagName("input");
- var calvalue = "";
- var message = "";
- for (var i = 0; i < inputs.length ;i++ ) {
- if(inputs[i].title == 'new-calendar') {
- calvalue = inputs[i].value;
- break;
- }
- }
-
- if(calvalue == null || calvalue == "") {
- return;
- }
-
- var calendartype =document.getElementById("calendar-type");
- var calendarexpression =document.getElementById("calendar-expression");
-
- var expression = calvalue.split('|');
- var type;
- if(expression != null && expression.length >0) {
- type = expression[0];
- }
- calendartype.options[type].selected = true;
- if(type == '1') {
- message += "Once,start datetime:"+expression[1]+"
"+expression[2]+":"+expression[3];
- }
- else if(type == '2') {
- message += "Per day,start datetime:"+expression[1]+"
"+expression[2]+":"+expression[3];
- if(expression[4] == "0") {
- message += "<br/> dayly";
- }
- else if(expression[4] == "1") {
- message += "<br/> weekday";
- }
- else if(expression[4] == "2") {
- message += "<br/> frequency: "+expression[5] +" day(s) ";
- }
- }
- else if(type == '3') {
- message += "Per week,start time:"+expression[1]+":"+expression[2];
- message += "<br/> frequency: "+expression[3]+" week(s) ";
-
- var varWeek = "";
- for(var i = 0 ; i < expression[4].length;i++) {
- var month = expression[4].substr(i,1);
- if(month == "1") {
- varWeek += "Monday,";
- }
- else if(month == "2") {
- varWeek += "Tuesday,";
- }
- else if(month == "3") {
- varWeek += "Wednesday,";
- }
- else if(month == "4") {
- varWeek += "Thursday,";
- }
- else if(month == "5") {
- varWeek += "Friday,";
- }
- else if(month == "6") {
- varWeek += "Saturday,";
- }
- else if(month == "7") {
- varWeek += "Sunday,";
- }
- }
- if(varWeek != null && varWeek != ""){
- if(varWeek.substr(varWeek.length-1,1) ==","){
- varWeek = varWeek.substr(0,varWeek.length-1) ;
- }
- }
- message += "<br/> week: "+varWeek;
- }
- else if(type == '4') {
- message += "Per month,start time:"+expression[1]+":"+expression[2];
- var months = "";
- if(expression[3] == "0") {
- message += "<br/> months: "+expression[4]+"";
- if(expression[4] == "1") {
- message += "st";
- }
- else if (expression[4] == "2") {
- message += "nd";
- }
- else if (expression[4] == "3") {
- message += "rd";
- }
- else {
- message += "th";
- }
- months = expression[5];
- }
- else if(expression[3] == "1") {
- message += "<br/> Week: ";
-
- if(expression[4] == '1') {
- message += "the First Week,";
- }
- else if (expression[4] == '2') {
- message += "the Second Week,";
- }
- else if (expression[4] == '3') {
- message += "the Third Week,";
- }
- else if (expression[4] == '4') {
- message += "the Forth Week,";
- }
- else if (expression[4] == '5') {
- message += "the Last Week,";
- }
-
- if(expression[5] == '1') {
- message += "Monday.";
- }
- else if (expression[5] == '2') {
- message += "Tuesday.";
- }
- else if (expression[5] == '3') {
- message += "Wednesday.";
- }
- else if (expression[5] == '4') {
- message += "Thursday.";
- }
- else if (expression[5] == '5') {
- message += "Friday.";
- }
- else if (expression[5] == '6') {
- message += "Saturday.";
- }
- else if (expression[5] == '7') {
- message += "Sunday.";
- }
- months = expression[6];
- }
- var temp = "";
- for(var i = 0 ; i < months.length;i++) {
- var month = months.substr(i,1);
- if(month == "0") {
- temp+="January,";
- }
- else if(month == "1") {
- temp+="February,";
- }
- else if(month == "2") {
- temp+="March,";
- }
- else if(month == "3") {
- temp+="April,";
- }
- else if(month == "4") {
- temp+="May,";
- }
- else if(month == "5") {
- temp+="June,";
- }
- else if(month == "6") {
- temp+="July,";
- }
- else if(month == "7") {
- temp+="August,";
- }
- else if(month == "8") {
- temp+="September,";
- }
- else if(month == "9") {
- temp+="October,";
- }
- else if(month == "a") {
- temp+="November,";
- }
- else if(month == "b") {
- temp+="December,";
- }
- }
- if(temp != null && temp != ""){
- if(temp.substr(temp.length-1,1) ==","){
- temp = temp.substr(0,temp.length-1) ;
- }
- }
- message += "<br/> Month: "+temp;
-
- }
- calendarexpression.innerHTML = message;
-}
-
-function resetCalendar(calendarType,fieldName) {
- if(calendarType == '0') {
- document.getElementById('calendar-expression').innerHTML='';
- document.getElementById(fieldName).value='';
- }
-}
-
-function selectAssets(ele,type){
- Data[type] = ele.value;
-}
-
-var Data = {
- attachments: "",
- images:"",
- urls:""
-}
-
-function getAssets(type, channelid){
- //alert(Data[type]);
- var iWidth=800;
- var iHeight=200;
- var xposition = 0;
- var yposition = 0;
- if ((parseInt(navigator.appVersion) >= 4)) {
- xposition = (screen.width-iWidth ) / 2;
- yposition = (screen.height-iHeight - 25) / 2;
- }
- 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';
- }
- window.open(url,
- 'contentselector',
'width=730,height=550,status=yes,toolbar=no,titlebar=no,scrollbars=yes,resizable=yes,left='+xposition+',top='+yposition+',menubar=no');
+var select_fid = '';
+var select_did = '';
+
+function selectPage(param, path, pos) {
+ if (select_fid != null && select_did != null) {
+ doAdd(param, 'cmd/add-item/' + select_fid + '/' + select_did + '//');
+ }
+}
+
+function selectChannel(param, path, pos) {
+ if (select_fid != null && select_did != null) {
+ doAdd(param, 'cmd/add-item/' + select_fid + '/' + select_did + '//');
+ }
+}
+
+function selectContent(param, path, pos) {
+ if (select_fid != null && select_did != null) {
+ doAdd(param, 'cmd/add-item/' + select_fid + '/' + select_did + '//');
+ }
+}
+
+function setWorkflowCommand(command) {
+ var workflowCommand = document.getElementById("workflowcommand");
+ if (workflowCommand) {
+ workflowCommand.value = command;
+ }
+}
+
+function setWorkflowComment() {
+ var workflowComment = document.getElementById("workflowcomment");
+ if (workflowComment) {
+ var comment = prompt("Opmerking ?","");
+ if (comment != null && comment != ""){ // OK pressed
+ workflowComment.value = comment;
+ }
+ }
+}
+
+function doFinish() {
+ if (!isSaveInactive()) {
+ setWorkflowCommand("finish");
+ clearScroll();
+ setButtonsInactive();
+ doSendDelayedCommand("cmd/commit////");
+ }
+}
+
+function doAccept() {
+ if (!isSaveInactive()) {
+ setWorkflowCommand("accept");
+ clearScroll();
+ setButtonsInactive();
+ doSendDelayedCommand("cmd/commit////");
+ }
+}
+
+function doPublish() {
+ if (!isSaveInactive()) {
+ setWorkflowCommand("publish");
+ clearScroll();
+ setButtonsInactive();
+ doSendDelayedCommand("cmd/commit////");
+ }
+}
+
+function doReject() {
+ setWorkflowComment();
+ setWorkflowCommand("reject");
+ clearScroll();
+ setButtonsInactive();
+ doSendDelayedCommand("cmd/cancel////");
+}
+
+function doCancel() {
+ setWorkflowCommand("cancel");
+ clearScroll();
+ setButtonsInactive();
+ doSendDelayedCommand("cmd/cancel////");
+}
+
+function updateHtml(el, err, silent) {
+ updateErrormesg(el, err, silent)
+ updatePrompt(el, err, silent);
+}
+
+function updateErrormesg(el, err, silent) {
+ var prompt = document.getElementById("errormesg_" + el.name);
+ if (prompt && !silent) {
+ var orgprompt = prompt.getAttribute("prompt");
+ var description = prompt.getAttribute("description");
+ if (err.length > 0) {
+ prompt.innerHTML = err;
+
+ } else {
+ prompt.innerHTML = "";
+ }
+ }
+}
+
+function updatePrompt(el, err, silent) {
+ var prompt = document.getElementById("prompt_" + el.name);
+ if (prompt && !silent) {
+ var orgprompt = prompt.getAttribute("prompt");
+ var description = prompt.getAttribute("description");
+ if (err.length > 0) {
+ prompt.title = description+"
\n\n"+getToolTipValue(form,"message_thisnotvalid",
+ "This field is not valid")+":\n "+err;
+ prompt.className = "notvalid";
+ } else {
+ prompt.className = "valid";
+ prompt.title = description;
+ }
+ }
+}
+
+function updateButtons(allvalid) {
+ var savebut = document.getElementById("bottombutton-save");
+ var saveonlybut = document.getElementById("bottombutton-saveonly");
+ if (allvalid) {
+ setSaveInactive("false");
+ enableButton(savebut,"titlesave", "Stores all changes.");
+ if (saveonlybut != null) {
+ enableButton(saveonlybut,"titlesave", "Stores all changes.");
+ }
+ enableButton(document.getElementById("bottombutton-finish"),
"titlefinish", "Store all changes");
+ enableButton(document.getElementById("bottombutton-accept"),
"titleaccept", "Store all changes");
+ enableButton(document.getElementById("bottombutton-reject"),
"titlereject", "Store all changes");
+ enableButton(document.getElementById("bottombutton-publish"),
"titlepublish", "Store all changes");
+ } else {
+ setSaveInactive("true");
+ disableButton(savebut,"titlenosave", "You cannot save because one or
more forms are invalid.");
+ if (saveonlybut != null) {
+ disableButton(saveonlybut,"titlenosave", "You cannot save because
one or more forms are invalid.");
+ }
+
disableButton(document.getElementById("bottombutton-finish"),"titlenofinish",
"The changes cannot be saved, since some data is not filled in correctly.");
+
disableButton(document.getElementById("bottombutton-accept"),"titlenoaccept",
"The changes cannot be saved, since some data is not filled in correctly.");
+
disableButton(document.getElementById("bottombutton-reject"),"titlenoreject",
"The changes cannot be saved, since some data is not filled in correctly.");
+
disableButton(document.getElementById("bottombutton-publish"),"titlenopublish",
"The changes cannot be saved, since some data is not filled in correctly.");
+ }
+}
+
+function resizeEditTable() {
+ var divButtonsHeight =
document.getElementById("commandbuttonbar").offsetHeight;
+ var divTop = findPosY(document.getElementById("editform"));
+
+ var isIE = (navigator.appVersion.indexOf('MSIE')!=-1);
+
+ if (isIE && (navigator.appVersion.indexOf('Mac')!=-1)) {
+
+ // IE on the Mac has some overflow problems.
+ // These statements will move the button div to the right position and
+ // resizes the editform div.
+ var docHeight = getDimensions().documentHeight;
+ document.getElementById("editform").style.height = docHeight - (divTop +
divButtonsHeight);
+ // The div is relative positioned to the surrounding table.
+ // +10, because we have a padding of 10 in the css.
+ document.getElementById("commandbuttonbar").style.top = docHeight -
(2*divButtonsHeight + 10);
+ }
+ else {
+ var docHeight = getDimensions().windowHeight;
+ document.getElementById("editform").style.height = docHeight - (divTop
+ divButtonsHeight);
+ }
+ var docWidth = getDimensions().windowWidth;
+ document.getElementById("editform").style.width = docWidth-((isIE)?5:0);
+
+ var textareas = document.getElementsByTagName("textarea");
+
+ for (var i = 0 ; i < textareas.length ; i++) {
+ if(isSubEditElement(textareas[i])) {
+ //textareas[i].style.width = docWidth - 355;
+ textareas[i].style.width = '99%';
+ }
+ else {
+ //removetextareas[i].style.width = docWidth - 100;
+ textareas[i].style.width = '99%';
+ }
+ }
+
+ var iframes = document.getElementsByTagName("iframe");
+
+ for (var i = 0 ; i < iframes.length ; i++) {
+ iframes[i].style.width = '99%';
+ }
+}
+
+function inits(){
+ var inputs =document.getElementsByTagName("input");
+ var calvalue = "";
+ var message = "";
+ for (var i = 0; i < inputs.length ;i++ ) {
+ if(inputs[i].title == 'new-calendar') {
+ calvalue = inputs[i].value;
+ break;
+ }
+ }
+
+ if(calvalue == null || calvalue == "") {
+ return;
+ }
+
+ var calendartype =document.getElementById("calendar-type");
+ var calendarexpression =document.getElementById("calendar-expression");
+
+ var expression = calvalue.split('|');
+ var type;
+ if(expression != null && expression.length >0) {
+ type = expression[0];
+ }
+ calendartype.options[type].selected = true;
+ if(type == '1') {
+ message += "Once,start datetime:"+expression[1]+"
"+expression[2]+":"+expression[3];
+ }
+ else if(type == '2') {
+ message += "Per day,start datetime:"+expression[1]+"
"+expression[2]+":"+expression[3];
+ if(expression[4] == "0") {
+ message += "<br/> dayly";
+ }
+ else if(expression[4] == "1") {
+ message += "<br/> weekday";
+ }
+ else if(expression[4] == "2") {
+ message += "<br/> frequency: "+expression[5] +" day(s) ";
+ }
+ }
+ else if(type == '3') {
+ message += "Per week,start time:"+expression[1]+":"+expression[2];
+ message += "<br/> frequency: "+expression[3]+" week(s) ";
+
+ var varWeek = "";
+ for(var i = 0 ; i < expression[4].length;i++) {
+ var month = expression[4].substr(i,1);
+ if(month == "1") {
+ varWeek += "Monday,";
+ }
+ else if(month == "2") {
+ varWeek += "Tuesday,";
+ }
+ else if(month == "3") {
+ varWeek += "Wednesday,";
+ }
+ else if(month == "4") {
+ varWeek += "Thursday,";
+ }
+ else if(month == "5") {
+ varWeek += "Friday,";
+ }
+ else if(month == "6") {
+ varWeek += "Saturday,";
+ }
+ else if(month == "7") {
+ varWeek += "Sunday,";
+ }
+ }
+ if(varWeek != null && varWeek != ""){
+ if(varWeek.substr(varWeek.length-1,1) ==","){
+ varWeek = varWeek.substr(0,varWeek.length-1) ;
+ }
+ }
+ message += "<br/> week: "+varWeek;
+ }
+ else if(type == '4') {
+ message += "Per month,start time:"+expression[1]+":"+expression[2];
+ var months = "";
+ if(expression[3] == "0") {
+ message += "<br/> months: "+expression[4]+"";
+ if(expression[4] == "1") {
+ message += "st";
+ }
+ else if (expression[4] == "2") {
+ message += "nd";
+ }
+ else if (expression[4] == "3") {
+ message += "rd";
+ }
+ else {
+ message += "th";
+ }
+ months = expression[5];
+ }
+ else if(expression[3] == "1") {
+ message += "<br/> Week: ";
+
+ if(expression[4] == '1') {
+ message += "the First Week,";
+ }
+ else if (expression[4] == '2') {
+ message += "the Second Week,";
+ }
+ else if (expression[4] == '3') {
+ message += "the Third Week,";
+ }
+ else if (expression[4] == '4') {
+ message += "the Forth Week,";
+ }
+ else if (expression[4] == '5') {
+ message += "the Last Week,";
+ }
+
+ if(expression[5] == '1') {
+ message += "Monday.";
+ }
+ else if (expression[5] == '2') {
+ message += "Tuesday.";
+ }
+ else if (expression[5] == '3') {
+ message += "Wednesday.";
+ }
+ else if (expression[5] == '4') {
+ message += "Thursday.";
+ }
+ else if (expression[5] == '5') {
+ message += "Friday.";
+ }
+ else if (expression[5] == '6') {
+ message += "Saturday.";
+ }
+ else if (expression[5] == '7') {
+ message += "Sunday.";
+ }
+ months = expression[6];
+ }
+ var temp = "";
+ for(var i = 0 ; i < months.length;i++) {
+ var month = months.substr(i,1);
+ if(month == "0") {
+ temp+="January,";
+ }
+ else if(month == "1") {
+ temp+="February,";
+ }
+ else if(month == "2") {
+ temp+="March,";
+ }
+ else if(month == "3") {
+ temp+="April,";
+ }
+ else if(month == "4") {
+ temp+="May,";
+ }
+ else if(month == "5") {
+ temp+="June,";
+ }
+ else if(month == "6") {
+ temp+="July,";
+ }
+ else if(month == "7") {
+ temp+="August,";
+ }
+ else if(month == "8") {
+ temp+="September,";
+ }
+ else if(month == "9") {
+ temp+="October,";
+ }
+ else if(month == "a") {
+ temp+="November,";
+ }
+ else if(month == "b") {
+ temp+="December,";
+ }
+ }
+ if(temp != null && temp != ""){
+ if(temp.substr(temp.length-1,1) ==","){
+ temp = temp.substr(0,temp.length-1) ;
+ }
+ }
+ message += "<br/> Month: "+temp;
+
+ }
+ calendarexpression.innerHTML = message;
+}
+
+function resetCalendar(calendarType,fieldName) {
+ if(calendarType == '0') {
+ document.getElementById('calendar-expression').innerHTML='';
+ document.getElementById(fieldName).value='';
+ }
+}
+
+function selectAssets(ele,type){
+ Data[type] = ele.value;
+}
+
+var Data = {
+ attachments: "",
+ images:"",
+ urls:""
+}
+
+function getAssets(type, searchfields, searchterm){
+ var iWidth=800;
+ var iHeight=200;
+ var xposition = 0;
+ var yposition = 0;
+ if ((parseInt(navigator.appVersion) >= 4)) {
+ xposition = (screen.width-iWidth ) / 2;
+ yposition = (screen.height-iHeight - 25) / 2;
+ }
+ 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';
+ }
+ url += '&searchfields='+searchfield+"&term="+term;
+ window.open(url,
+ 'contentselector',
'width=730,height=550,status=yes,toolbar=no,titlebar=no,scrollbars=yes,resizable=yes,left='+xposition+',top='+yposition+',menubar=no');
}
\ No newline at end of file
Modified:
CMSContainer/branches/b1_6/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/xsl/wizard.xsl
===================================================================
---
CMSContainer/branches/b1_6/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/xsl/wizard.xsl
2009-06-26 03:39:50 UTC (rev 36437)
+++
CMSContainer/branches/b1_6/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editwizards_new/xsl/wizard.xsl
2009-06-26 05:08:53 UTC (rev 36438)
@@ -530,7 +530,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>
@@ -568,7 +568,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