public class CommentClientSideElement extends StaticClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile
Modifier and Type | Field and Description |
---|---|
private ContentHelper |
_contentHelper
The content helper
|
protected ObservationManager |
_observationManager
The observation manager
|
protected AmetysObjectResolver |
_resolver
The Ametys object resolver
|
protected CurrentUserProvider |
_userProvider
The current user provider
|
static String |
PARAMETER_AUTHOR_EMAIL
The constant for the email of the author from parameters
|
static String |
PARAMETER_AUTHOR_EMAILHIDDEN
The constant for the hidden status of the email of the author from parameters
|
static String |
PARAMETER_AUTHOR_NAME
The constant for the name of the author from parameters
|
static String |
PARAMETER_AUTHOR_URL
The constant for the url of the author from parameters
|
static String |
PARAMETER_COMMENT_ID
The constant for the comment id from parameters
|
static String |
PARAMETER_CONTENT_ID
The constant for the content id from parameters
|
static String |
PARAMETER_TEXT
The constant for the text from parameters
|
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script
Constructor and Description |
---|
CommentClientSideElement() |
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
_jsonifyComment(Comment comment,
Content content)
Jsonify the comment.
|
protected Map<String,Object> |
_jsonifyContent(Content content)
Jsonify the content.
|
Map<String,Object> |
deleteComments(Map<String,List<String>> contents)
Removes comments
|
Map<String,Object> |
editComment(Map<String,Object> parameters)
Edit a comment if connected user has sufficient rights
|
Map<String,Object> |
getComment(String contentId,
String commentId)
Get a comment properties
|
protected Map<String,Object> |
getCommentParameters(Content content,
Comment comment)
Get the parameters for a comment
|
Map<String,Object> |
getComments(Map<String,Object> parameters)
Return the list of comments with its validation state
|
protected UserIdentity |
getCurrentUser()
Get the current user
|
protected boolean |
hasRight(String rightId,
Content content)
Determines if connected user has right on content
|
Map<String,Object> |
invalidateComments(Map<String,List<String>> contents)
Invalidates comments when it is possible.
|
void |
service(ServiceManager smanager) |
Map<String,Object> |
validateComments(Map<String,List<String>> contents)
Validates comments when it is possible.
|
_configureClass, _configureParameters, _configureScript, configureInitialParameters
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, configure, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toString
getLogger, setLogger
public static final String PARAMETER_AUTHOR_NAME
public static final String PARAMETER_AUTHOR_EMAIL
public static final String PARAMETER_AUTHOR_EMAILHIDDEN
public static final String PARAMETER_AUTHOR_URL
public static final String PARAMETER_TEXT
public static final String PARAMETER_CONTENT_ID
public static final String PARAMETER_COMMENT_ID
protected AmetysObjectResolver _resolver
protected CurrentUserProvider _userProvider
protected ObservationManager _observationManager
private ContentHelper _contentHelper
public CommentClientSideElement()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class StaticFileImportsClientSideElement
ServiceException
public Map<String,Object> getComments(Map<String,Object> parameters)
parameters
- The contents and their commentspublic Map<String,Object> getComment(String contentId, String commentId) throws IOException, ProcessingException
contentId
- the id of the contentcommentId
- the id of the comment. Can be nullIOException
- If an error occuredProcessingException
- If an error occuredpublic Map<String,Object> editComment(Map<String,Object> parameters)
parameters
- the JS parameters. Necessarily contains the content and comment id, and the values to editpublic Map<String,Object> deleteComments(Map<String,List<String>> contents)
contents
- the contents with comments to removepublic Map<String,Object> validateComments(Map<String,List<String>> contents)
contents
- the contents with comments to validatepublic Map<String,Object> invalidateComments(Map<String,List<String>> contents)
contents
- the contents with comments to invalidateprotected Map<String,Object> _jsonifyComment(Comment comment, Content content)
comment
- The commentcontent
- The contentprotected Map<String,Object> _jsonifyContent(Content content)
content
- The contentprotected Map<String,Object> getCommentParameters(Content content, Comment comment)
content
- The contentcomment
- The commentprotected UserIdentity getCurrentUser()