Skip to content

Commit

Permalink
S2U-38 Resources: Add "Download ZIP" event when downloading zip files…
Browse files Browse the repository at this point in the history
… from resources - MASTER (sakaiproject#11769)
  • Loading branch information
michaelkaimbacher authored Jul 21, 2023
1 parent 033ca64 commit fe7e4d5
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
import org.sakaiproject.entity.api.ResourcePropertiesEdit;
import org.sakaiproject.event.api.NotificationService;
import org.sakaiproject.event.api.SessionState;
import org.sakaiproject.event.api.EventTrackingService;
import org.sakaiproject.exception.IdInvalidException;
import org.sakaiproject.exception.IdLengthException;
import org.sakaiproject.exception.IdUniquenessException;
Expand Down Expand Up @@ -195,6 +196,8 @@ public class ResourcesAction
private static final ToolManager toolManager = ComponentManager.get(ToolManager.class);
private static final UserDirectoryService userDirectoryService = ComponentManager.get(UserDirectoryService.class);
private static final TimeService timeService = ComponentManager.get(TimeService.class);
private static final EventTrackingService eventTrackingService = ComponentManager.get(EventTrackingService.class);


public static final String MSG_KEY_COPYRIGHT_REQ_CHOICE = "copyright.requireChoice";
public static final String MSG_KEY_COPYRIGHT_REQ_CHOICE_ERROR = "copyright.requireChoice.error";
Expand Down Expand Up @@ -10361,6 +10364,7 @@ public void doFinalizeZipDownload(RunData data)
} else {
selectedFiles.add(listItem.getId());
}
eventTrackingService.post(eventTrackingService.newEvent(ContentHostingService.EVENT_RESOURCE_ZIP_DOWNLOAD, "/content" + listItem.getId() , false));
}

// Use the site title for the zip name, remove spaces though.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public interface ContentHostingService extends EntityProducer

/** Name of the event when reading a resource. */
public static final String EVENT_RESOURCE_READ = "content.read";

public static final String EVENT_RESOURCE_ZIP_DOWNLOAD = "content.zipdownload";

/** Name of the event when writing a resource. */
public static final String EVENT_RESOURCE_WRITE = "content.revise";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@
<event eventId="content.read" selected="true" resolvable="true"/>
<event eventId="content.revise" selected="true" resolvable="true"/>
<event eventId="content.delete" selected="true" resolvable="true"/>
<event eventId="content.zipdownload" selected="true" resolvable="true"/>
<!-- Format: varies, but generally conforms to:
/content/<content_reference> where <content_reference> typically contains <site_id> -->
<eventParserTip for="contextId" separator="/" index="3"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
<event eventId="content.read" selected="true"/>
<event eventId="content.revise" selected="true"/>
<event eventId="content.delete" selected="true"/>
<event eventId="content.zipdownload" selected="true"/>
<eventParserTip for="contextId" separator="/" index="3"/>
</tool>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
<event eventId="content.read" selected="true"/>
<event eventId="content.revise" selected="true"/>
<event eventId="content.delete" selected="true"/>
<event eventId="content.zipdownload" selected="true"/>
<eventParserTip for="contextId" separator="/" index="3"/>
</tool>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public interface ReportManager {
public static final String WHAT_RESOURCES = "what-resources";
public static final String WHAT_RESOURCES_ACTION_NEW = "new";
public static final String WHAT_RESOURCES_ACTION_READ = "read";
public static final String WHAT_RESOURCES_ACTION_DOW = "zipdownload";
public static final String WHAT_RESOURCES_ACTION_REVS = "revise";
public static final String WHAT_RESOURCES_ACTION_DEL = "delete";
public static final String WHAT_LESSONPAGES = "what-lessonpages";
Expand Down
1 change: 1 addition & 0 deletions sitestats/sitestats-bundle/src/resources/Events.properties
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ content.new=Content new
content.read=Content opened
content.revise=Content revise
content.delete=Content delete
content.zipdownload=Download Zip

# roster
roster.view=Roster view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ content.new=Creaci\u00f3 d\u2019un recurs
content.read=Lectura d\u2019un recurs
content.revise=Revisi\u00f3 d\u2019un recurs
content.delete=Eliminaci\u00f3 d\u2019un recurs
content.zipdownload=Descarregar Zip

# roster
roster.view=Visualitzaci\u00f3 de la llista
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ content.new=Crear recurso
content.read=Leer recurso
content.revise=Revisar recurso
content.delete=Borrar recurso
content.zipdownload=Descargar Zip

# roster
roster.view=Ver participantes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ content.new=Sortu edukia
content.read=Irakurri edukia
content.revise=Berrikusi edukia
content.delete=Ezabatu edukia
content.zipdownload=Deskargatu Zip

# roster
roster.view=Bistaratu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ action_read=Read
action_update=Update
action_revise=Revise
action_delete=Delete
action_zipdownload=Downloaded as Zip
no_data=No data available
site_unknown=[nonexistent site]
user_unknown=[nonexistent user]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ action_read=Llegeix
action_update=Actualitza
action_revise=Revisa
action_delete=Elimina
action_zipdownload=Descarregar Zip
no_data=Sense dades disponibles
site_unknown=[espai inexistent]
user_unknown=[usuari no existent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ action_all=Todas
action_create=Crear
action_new=Nuevas
action_read=Leer
action_zipdownload=Descargar Zip
action_update=Actualizar
action_revise=Revisar
action_delete=Eliminar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ action_read=Irakurri
action_update=Eguneratu
action_revise=Berrikusi
action_delete=Kendu
action_zipdownload=Deskargatu Zip
no_data=Ez da informaziorik erabilgarri
site_unknown=[ez da horrelako gunerik]
user_unknown=[ez da horrelako erabiltzailerik]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ public boolean saveReportDefinition(final ReportDef reportDef) {
if (eventId.equals(ReportManager.WHAT_RESOURCES_ACTION_NEW)
|| eventId.equals(ReportManager.WHAT_RESOURCES_ACTION_READ)
|| eventId.equals(ReportManager.WHAT_RESOURCES_ACTION_REVS)
|| eventId.equals(ReportManager.WHAT_RESOURCES_ACTION_DEL)) {
|| eventId.equals(ReportManager.WHAT_RESOURCES_ACTION_DEL)
|| eventId.equals(ReportManager.WHAT_RESOURCES_ACTION_DOW)) {
isResourceEvent = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ public String getIdValue(Object object, int index) {
resourceActions.add(ReportManager.WHAT_RESOURCES_ACTION_READ);
resourceActions.add(ReportManager.WHAT_RESOURCES_ACTION_REVS);
resourceActions.add(ReportManager.WHAT_RESOURCES_ACTION_DEL);
resourceActions.add(ReportManager.WHAT_RESOURCES_ACTION_DOW);
DropDownChoice whatResourceAction = new DropDownChoice("reportParams.whatResourceAction", resourceActions, new IChoiceRenderer() {
public Object getDisplayValue(Object object) {
if(object == null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,12 @@ protected void onUpdate(AjaxRequestTarget target) {
toolFilter.setOutputMarkupId(true);
add(toolFilter);
toolFilter.setVisible(filters.contains(FILTER_TOOL));


// RESOURCE_ACTION Filter
List<String> resactionFilterOptions = Arrays.asList(
null,
ReportManager.WHAT_RESOURCES_ACTION_NEW, ReportManager.WHAT_RESOURCES_ACTION_READ,
ReportManager.WHAT_RESOURCES_ACTION_REVS, ReportManager.WHAT_RESOURCES_ACTION_DEL
ReportManager.WHAT_RESOURCES_ACTION_REVS, ReportManager.WHAT_RESOURCES_ACTION_DEL,
ReportManager.WHAT_RESOURCES_ACTION_DOW
);
IChoiceRenderer resactionFilterRenderer = new IChoiceRenderer() {
private static final long serialVersionUID = 1L;
Expand Down

0 comments on commit fe7e4d5

Please sign in to comment.