xlawrence 2005/06/07 11:49:13 CEST
Modified files:
core/src/webapp/jsp/jahia/htmleditors/fckeditor/editor/plugins/JahiaLinker
utils.js
core/src/webapp/jsp/jahia/htmleditors/fckeditor
fckeditor_htmleditor.jsp
utils.jsp
Log:
The editor now displays the sitemap using different colors for the page
titles according to the state of the page. It also checks that the target page
referenced in the bigtext can be read by the same groups as the ones found in
the current field ACL. In case, the target page is not in the "Active" state
and/or the target page has less rights than the current field, the editor
displays a Warning confirmation message to the user.
Revision Changes Path
1.3 +56 -15
jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/editor/plugins/JahiaLinker/utils.js
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/editor/plugins/JahiaLinker/utils.js.diff?r1=1.2&r2=1.3&f=h
1.5 +1 -1
jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/fckeditor_htmleditor.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/fckeditor_htmleditor.jsp.diff?r1=1.4&r2=1.5&f=h
1.3 +17 -13
jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/utils.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/utils.jsp.diff?r1=1.2&r2=1.3&f=h
Index: utils.js
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/editor/plugins/JahiaLinker/utils.js,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- utils.js 2 Jun 2005 12:25:35 -0000 1.2
+++ utils.js 7 Jun 2005 09:49:12 -0000 1.3
@@ -6,19 +6,17 @@
var pagesList = null;
var basePath = "";
var webdavPath = "";
-function Init()
-{
+
+function Init() {
window.resizeTo(800, 600);
FCK = window.opener.FCK;
FCKConfig = window.opener.FCKConfig;
pagesList = FCKConfig.PagesList;
-
basePath = FCKConfig.basePath;
- try
- {
+ try {
pagesList = eval(pagesList);
}
catch(e){}
@@ -34,19 +32,46 @@
ddTree.innerHTML = dTree.toString();
}
-function Set(pageUrl)
-{
- try
- {
- window.opener.SetUrl(pageUrl);
+function Set (linkValue) {
+
+ var urlValue = linkValue.split("&state=")[0];
+ var state = linkValue.split("&state=")[1];
+ var groups = state.split("&groups=")[1];
+
+ if (groups) {
+ state = state.split("&groups=")[0];
+ }
+
+ if (groups || state != "active") {
+
+ var message = "WARNING !!!\n\n";
+ if (state == "markForDeleted") {
+ message += "- You have selected a page which is marked for
deletion.";
+ message += "Once publication is made, this page will no longer be
accessible (404 Error).\n\n";
+
+ } else if (state != "active") {
+ message += "- You have selected a page which is in state '"+ state
+"'.";
+ message += "The content will not be accessible in 'Live' mode until
publication is made (Possible 404 Error).\n\n";
+ }
+
+ if (groups) {
+ message += "- The page you have selected cannot be seen by groups
'"+ groups +"', ";
+ message += "which however have access to the field you are editing
(403 Error).\n\n"
+ }
+
+ message += "Continue anyway ?";
+ if (!confirm(message)) return;
+ }
+
+ try {
+ window.opener.SetUrl(urlValue);
}
catch(e){}
window.close();
}
-function onCancel() // cancel selection
-{
+function onCancel() { // cancel selection
window.close();
return false;
}
@@ -61,13 +86,29 @@
currentParent = parent;
}
+ var pageTitle = files[i][2];
+ var urlLink = files[i][3];
var state = files[i][4];
+ var groups = files[i][5];
+ var access;
+
+ urlLink += "&state=" + state;
+
+ if (groups) {
+ access = "Group(s) not having access: " + groups;
+ pageTitle += " *";
+ urlLink += "&groups=" + groups;
+
+ } else {
+ access = "Access: accessible by all groups";
+ groups = "none";
+ }
dTree.add(id,
currentParent,
- "<span class="+ state +">"+ files[i][2].replace(/^.*\//, '') +
"</span>",
- 'javascript:Set(decodeURIComponent(\'' +
encodeURIComponent(files[i][3]) + '\'));void(0);',
- files[i][2]+ " (" + state + ")");
+ "<span class="+ state +">"+ pageTitle.replace(/^.*\//, '') +
"</span>",
+ 'javascript:Set(decodeURIComponent(\'' + encodeURIComponent(urlLink)
+ '\'));void(0);',
+ pageTitle + ", State: " + state + ", " + access);
levels[files[i][0]] = id;
}
Index: fckeditor_htmleditor.jsp
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/fckeditor_htmleditor.jsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- fckeditor_htmleditor.jsp 2 Jun 2005 12:25:35 -0000 1.4
+++ fckeditor_htmleditor.jsp 7 Jun 2005 09:49:12 -0000 1.5
@@ -100,7 +100,7 @@
String pageContent = "null";
String files = "null";
try {
- pageContent = getSitemapToJs(jData, jahiaPath.toString());
+ pageContent = getSitemapToJs(jData, jahiaPath.toString(), theField,
engineMap);
if (pageContent != null && !pageContent.equals("")) {
pageContent = pageContent.trim();
if (!pageContent.startsWith("[")) {
Index: utils.jsp
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/webapp/jsp/jahia/htmleditors/fckeditor/utils.jsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- utils.jsp 2 Jun 2005 12:25:35 -0000 1.2
+++ utils.jsp 7 Jun 2005 09:49:12 -0000 1.3
@@ -15,6 +15,7 @@
<%@ page import="org.jahia.utils.*" %>
<%@ page import="org.jahia.engines.shared.*" %>
<%@ page import="org.jahia.exceptions.*" %>
+<%@ page import="org.jahia.content.*" %>
<%!
String types[] = {"application/pdf", "application/msword",
"application/vnd.ms-excel", "application/vnd.ms-powerpoint",
@@ -106,17 +107,17 @@
jsOperations.append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'createDir';\n").
append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'fileUpload';\n");
}
- if(curObj.hasRevisions()) {
+ if (curObj.hasRevisions()) {
jsOperations.append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'edit';\n");
}
- if(curObj.hasRevisions() &&
curObj.hasPermission(DAVFileAccess.MANAGE)) {
+ if (curObj.hasRevisions() &&
curObj.hasPermission(DAVFileAccess.MANAGE)) {
jsOperations.append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'rightsMgmt';\n");
}
jsOperations.append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'view&act=copy';\n");
if (parentObj.hasPermission(DAVFileAccess.WRITE) &&
parentObj.isWriteable()) {
jsOperations.append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'view&act=move';\n").
append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'fileRename';\n");
- if(curObj.hasPermission(DAVFileAccess.WRITE) &&
curObj.isWriteable()) {
+ if (curObj.hasPermission(DAVFileAccess.WRITE) &&
curObj.isWriteable()) {
jsOperations.append("fo").append(counterOperations).append(".operationsList[fo").append(counterOperations).append(".operationsList.length]
= 'fileDelete';\n");
}
}
@@ -162,7 +163,7 @@
final double fileSizeKo = size / 1024;
DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(2);
- df.setMinimumIntegerDigits( 1 );
+ df.setMinimumIntegerDigits(1);
fileSize = df.format(fileSizeKo) + " ko";
}
}
@@ -182,7 +183,8 @@
return html.toString();
}
-public String getSitemapToJs(JahiaData jData, String jahiaPath) throws
JahiaException {
+public String getSitemapToJs(JahiaData jData, String jahiaPath, JahiaField
theField,
+ HashMap engineMap) throws JahiaException {
ParamBean jParams = jData.params();
StringBuffer buff = new StringBuffer();
buff.append("[[0,0,\'root\','/'],");
@@ -237,15 +239,17 @@
StringBuffer pageUrl = new StringBuffer();
pageUrl.append(jahiaPath).append("/site/").append(jParams.getSiteKey())
- .append("/lang/").append(jParams.getLocale().toString())
- .append("/pid/").append(pageId);
-
+ .append("/lang/").append(jParams.getLocale().toString())
+ .append("/pid/").append(pageId);
+
buff.append("[").append((treeJahiaSiteMap.getPageLevel(i) +
1))
- .append(",").append((i + 1)).append(",\'")
- .append(pageTitle2.replaceAll("'", "\\\\'"))
-
.append("\','").append(pageUrl.toString().replaceAll("'", "\\\\'"))
- .append("\',\'").append(getPageState(pageId, jParams))
- .append("'],");
+ .append(",").append((i + 1)).append(",\'")
+ .append(pageTitle2.replaceAll("'", "\\\\'"))
+ .append("\','").append(pageUrl.toString().replaceAll("'",
"\\\\'"))
+ .append("\',\'").append(getPageState(pageId, jParams))
+ .append("\',\'")
+
.append(BigText_Field.getInstance().getFieldGroupsNotHavingAccessOnPageAsString(
+ pageId, theField, jParams, engineMap)).append("'],");
}
}
}