Class CommentClientSideElement
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.ui.StaticFileImportsClientSideElement
org.ametys.core.ui.StaticClientSideElement
org.ametys.cms.repository.comment.ui.CommentClientSideElement
- All Implemented Interfaces:
ClientSideElement
,LogEnabled
,PluginAware
,Configurable
,Serviceable
This client site elements creates a button representing the validation state of a content's comment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.core.ui.ClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile
-
Field Summary
Modifier and TypeFieldDescriptionprotected ObservationManager
The observation managerprotected AmetysObjectResolver
The Ametys object resolverstatic final String
The constant for the email of the author from parametersstatic final String
The constant for the hidden status of the email of the author from parametersstatic final String
The constant for the name of the author from parametersstatic final String
The constant for the url of the author from parametersstatic final String
The constant for the comment id from parametersstatic final String
The constant for the content id from parametersstatic final String
The constant for the text from parametersFields inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_isParentCommentAlreadyDelete
(List<String> deleteCommentIds, String commentId) True if the a parent comment of the comment id is already deleted_jsonifyComment
(Comment comment, Content content) Jsonify the comment._jsonifyContent
(Content content) Jsonify the content.deleteComments
(Map<String, List<String>> contents) Removes commentseditComment
(Map<String, Object> parameters) Edit a comment if connected user has sufficient rightsgetComment
(String contentId, String commentId) Get a comment propertiesgetCommentParameters
(Content content, Comment comment) Get the parameters for a commentgetComments
(Map<String, Object> parameters) Return the list of comments with its validation stategetContentDefaultParameters
(Content content) Get the default content's parametersprotected UserIdentity
Get the current userprotected boolean
Determines if connected user has right on contentinvalidateComments
(Map<String, List<String>> contents) Invalidates comments when it is possible.void
service
(ServiceManager smanager) validateComments
(Map<String, List<String>> contents) Validates comments when it is possible.Methods inherited from class org.ametys.core.ui.StaticClientSideElement
_configureClass, _configureParameters, _configureScript, configureInitialParameters
Methods inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, configure, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toString
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
PARAMETER_AUTHOR_NAME
The constant for the name of the author from parameters- See Also:
-
PARAMETER_AUTHOR_EMAIL
The constant for the email of the author from parameters- See Also:
-
PARAMETER_AUTHOR_EMAILHIDDEN
The constant for the hidden status of the email of the author from parameters- See Also:
-
PARAMETER_AUTHOR_URL
The constant for the url of the author from parameters- See Also:
-
PARAMETER_TEXT
The constant for the text from parameters- See Also:
-
PARAMETER_CONTENT_ID
The constant for the content id from parameters- See Also:
-
PARAMETER_COMMENT_ID
The constant for the comment id from parameters- See Also:
-
_resolver
The Ametys object resolver -
_observationManager
The observation manager
-
-
Constructor Details
-
CommentClientSideElement
public CommentClientSideElement()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classStaticFileImportsClientSideElement
- Throws:
ServiceException
-
getComments
Return the list of comments with its validation state- Parameters:
parameters
- The contents and their comments- Returns:
- The comments and their validated status
-
getComment
public Map<String,Object> getComment(String contentId, String commentId) throws IOException, ProcessingException Get a comment properties- Parameters:
contentId
- the id of the contentcommentId
- the id of the comment. Can be null- Returns:
- results the server's response in JSON.
- Throws:
IOException
- If an error occurredProcessingException
- If an error occurred
-
getContentDefaultParameters
Get the default content's parameters- Parameters:
content
- The content- Returns:
- The default parameters
-
editComment
Edit a comment if connected user has sufficient rights- Parameters:
parameters
- the JS parameters. Necessarily contains the content and comment id, and the values to edit- Returns:
- An empty map
-
deleteComments
Removes comments- Parameters:
contents
- the contents with comments to remove- Returns:
- the JSON result with deleted comments or not
-
_isParentCommentAlreadyDelete
True if the a parent comment of the comment id is already deleted- Parameters:
deleteCommentIds
- the delete comment idscommentId
- the comment id- Returns:
- true if the a parent comment of the comment id is already deleted
-
validateComments
Validates comments when it is possible.- Parameters:
contents
- the contents with comments to validate- Returns:
- the JSON result with validated comments or not
-
invalidateComments
Invalidates comments when it is possible.- Parameters:
contents
- the contents with comments to invalidate- Returns:
- the JSON result with invalidated comments or not
-
_jsonifyComment
Jsonify the comment.- Parameters:
comment
- The commentcontent
- The content- Returns:
- commentMap the comment map
-
_jsonifyContent
Jsonify the content.- Parameters:
content
- The content- Returns:
- contentMap the content map
-
getCommentParameters
Get the parameters for a comment- Parameters:
content
- The contentcomment
- The comment- Returns:
- The parameters
-
getCurrentUser
Get the current user- Returns:
- The current user
-
hasRight
Determines if connected user has right on content- Parameters:
rightId
- The right idcontent
- The content- Returns:
- true if user has right
-