Merged V1.3 to HEAD(3126:3160)

svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3126 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3160 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3405 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-07-26 10:16:23 +00:00
parent 8330b9b924
commit 5cc8c52eac
8 changed files with 113 additions and 31 deletions

View File

@@ -26,6 +26,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigService;
import org.alfresco.web.app.servlet.ExternalAccessServlet;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.dialog.DialogManager;
import org.alfresco.web.bean.repository.Node;
@@ -623,14 +624,28 @@ public class AlfrescoNavigationHandler extends NavigationHandler
}
else
{
// we are trying to close a dialog when one hasn't been opened!
// log a warning and return a null outcome to stay on the same page
if (logger.isWarnEnabled())
// the details pages can be loaded via the external access servlet,
// if this is the case the details page would not have been loaded as
// a dialog, in this scenario just use the global "browse" outcome.
String referer = (String)context.getExternalContext().
getRequestHeaderMap().get("referer");
if ((referer != null) &&
((referer.indexOf(ExternalAccessServlet.OUTCOME_DOCDETAILS) != -1) ||
(referer.indexOf(ExternalAccessServlet.OUTCOME_SPACEDETAILS) != -1)))
{
logger.warn("Attempting to close a " + closingItem + " with an empty view stack, returning null outcome");
navigate(context, fromAction, "browse");
}
else
{
// we are trying to close a dialog when one hasn't been opened!
// log a warning and return a null outcome to stay on the same page
if (logger.isWarnEnabled())
{
logger.warn("Attempting to close a " + closingItem + " with an empty view stack, returning null outcome");
}
navigate(context, fromAction, null);
}
navigate(context, fromAction, null);
}
}

View File

@@ -62,11 +62,11 @@ public class ExternalAccessServlet extends BaseServlet
private static Log logger = LogFactory.getLog(ExternalAccessServlet.class);
private final static String OUTCOME_DOCDETAILS = "showDocDetails";
private final static String OUTCOME_SPACEDETAILS = "showSpaceDetails";
private final static String OUTCOME_BROWSE = "browse";
private final static String OUTCOME_MYALFRESCO = "myalfresco";
private final static String OUTCOME_LOGOUT = "logout";
public final static String OUTCOME_DOCDETAILS = "showDocDetails";
public final static String OUTCOME_SPACEDETAILS = "showSpaceDetails";
public final static String OUTCOME_BROWSE = "browse";
public final static String OUTCOME_MYALFRESCO = "myalfresco";
public final static String OUTCOME_LOGOUT = "logout";
private static final String ARG_TEMPLATE = "template";
private static final String ARG_PAGE = "page";

View File

@@ -57,6 +57,7 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.CachingDateFormat;
import org.alfresco.util.ISO9075;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.SearchContext.RangeProperties;
import org.alfresco.web.bean.repository.MapNode;
@@ -1375,7 +1376,8 @@ public class AdvancedSearchBean
{
FacesContext fc = FacesContext.getCurrentInstance();
User user = Application.getCurrentUser(fc);
String xpath = NamespaceService.APP_MODEL_PREFIX + ":" + QName.createValidLocalName(user.getUserName());
String userName = ISO9075.encode(user.getUserName());
String xpath = NamespaceService.APP_MODEL_PREFIX + ":" + QName.createValidLocalName(userName);
List<NodeRef> results = null;
try

View File

@@ -35,6 +35,7 @@ import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.util.ISO9075;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
import org.alfresco.web.app.context.UIContextService;
@@ -413,10 +414,11 @@ public class UsersBean implements IContextListener
tx.begin();
// define the query to find people by their first or last name
String search = ISO9075.encode(this.searchCriteria);
String query = "( TYPE:\"{http://www.alfresco.org/model/content/1.0}person\") AND " +
"((@\\{http\\://www.alfresco.org/model/content/1.0\\}firstName:" + this.searchCriteria +
"*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}lastName:" + this.searchCriteria +
"*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}userName:" + this.searchCriteria +
"((@\\{http\\://www.alfresco.org/model/content/1.0\\}firstName:" + search +
"*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}lastName:" + search +
"*) OR (@\\{http\\://www.alfresco.org/model/content/1.0\\}userName:" + search +
"*)))";
if (logger.isDebugEnabled())

View File

@@ -50,6 +50,7 @@ public class ImagePickerRadioRenderer extends BaseRenderer
private int columns;
private int position;
private boolean open;
private boolean imageSelected = false;
// ------------------------------------------------------------------------------
// Renderer implemenation
@@ -89,6 +90,7 @@ public class ImagePickerRadioRenderer extends BaseRenderer
this.columns = 1;
this.position = 0;
this.open = false;
this.imageSelected = false;
ResponseWriter out = context.getResponseWriter();
@@ -210,6 +212,14 @@ public class ImagePickerRadioRenderer extends BaseRenderer
ResponseWriter out = context.getResponseWriter();
out.write("</table>");
// if we didn't select any image, default to the first one
if (this.imageSelected == false)
{
out.write("\n<script type='text/javascript'>document.getElementById('");
out.write(component.getClientId(context));
out.write("').checked = true;</script>\n");
}
}
/**
@@ -275,6 +285,7 @@ public class ImagePickerRadioRenderer extends BaseRenderer
if (itemValue != null && itemValue.equals(currentValue))
{
out.write(" checked='true'");
this.imageSelected = true;
}
if (tooltip != null)

View File

@@ -32,6 +32,7 @@ import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.FacesEvent;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -698,9 +699,17 @@ public abstract class BaseAssociationEditor extends UIInput
}
out.write("'>");
out.write(Repository.getDisplayPath(nodeService.getPath(targetRef)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, targetRef));
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetRef)))
{
out.write((String)nodeService.getProperty(targetRef, ContentModel.PROP_USERNAME));
}
else
{
out.write(Repository.getDisplayPath(nodeService.getPath(targetRef)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, targetRef));
}
out.write("</td><td class='");
if (this.highlightedRow)
{
@@ -815,9 +824,17 @@ public abstract class BaseAssociationEditor extends UIInput
out.write("<option value='");
out.write(item.getId());
out.write("'>");
out.write(Repository.getDisplayPath(nodeService.getPath(item)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, item));
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(item)))
{
out.write((String)nodeService.getProperty(item, ContentModel.PROP_USERNAME));
}
else
{
out.write(Repository.getDisplayPath(nodeService.getPath(item)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, item));
}
out.write("</option>");
}
}
@@ -852,17 +869,31 @@ public abstract class BaseAssociationEditor extends UIInput
if (assocDef != null)
{
// find and show all the available options for the current association
String type = assocDef.getTargetClass().getName().toString();
StringBuilder query = new StringBuilder("+TYPE:\"");
query.append(assocDef.getTargetClass().getName().toString());
query.append(type);
query.append("\"");
if (contains != null && contains.length() > 0)
{
String safeContains = Utils.remove(contains.trim(), "\"");
String nameAttr = Repository.escapeQName(QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "name"));
query.append(" AND +@");
query.append(nameAttr);
// if the association's target is the person type search on the
// username instead of the name property
if (type.equals(ContentModel.TYPE_PERSON.toString()))
{
String userName = Repository.escapeQName(QName.createQName(
NamespaceService.CONTENT_MODEL_1_0_URI, "userName"));
query.append(userName);
}
else
{
String nameAttr = Repository.escapeQName(QName.createQName(
NamespaceService.CONTENT_MODEL_1_0_URI, "name"));
query.append(nameAttr);
}
query.append(":*" + safeContains + "*");
}

View File

@@ -26,6 +26,7 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -152,9 +153,18 @@ public class UIAssociationEditor extends BaseAssociationEditor
{
out.write("<tr><td>");
AssociationRef assoc = (AssociationRef)iter.next();
out.write(Repository.getDisplayPath(nodeService.getPath(assoc.getTargetRef())));
out.write("/");
out.write(Repository.getNameForNode(nodeService, assoc.getTargetRef()));
NodeRef targetNode = assoc.getTargetRef();
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
{
out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME));
}
else
{
out.write(Repository.getDisplayPath(nodeService.getPath(targetNode)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, targetNode));
}
out.write("</td></tr>");
}

View File

@@ -26,6 +26,7 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -152,9 +153,19 @@ public class UIChildAssociationEditor extends BaseAssociationEditor
{
out.write("<tr><td>");
ChildAssociationRef assoc = (ChildAssociationRef)iter.next();
out.write(Repository.getDisplayPath(nodeService.getPath(assoc.getChildRef())));
out.write("/");
out.write(Repository.getNameForNode(nodeService, assoc.getChildRef()));
NodeRef targetNode = assoc.getChildRef();
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
{
out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME));
}
else
{
out.write(Repository.getDisplayPath(nodeService.getPath(targetNode)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, targetNode));
}
out.write("</tr></td>");
}