Skip to content

Commit

Permalink
BC-57 - Updated Video Dropdown to Include Name and ID in Values
Browse files Browse the repository at this point in the history
  • Loading branch information
hngrylobster committed Apr 7, 2022
1 parent ad56a32 commit 85e847f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import java.util.UUID;
import org.apache.jackrabbit.util.Text;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Model(
adaptables=SlingHttpServletRequest.class
)
Expand Down Expand Up @@ -222,14 +225,23 @@ protected void init(){
LOGGER.info("found asset video id : " + droppedVideoId);
LOGGER.info("current video id : " + currentNode.getProperty("videoPlayer").getString());
currentNode.setProperty("videoPlayer", droppedVideoId);

// now delete the property for next time to be clean
currentNode.setProperty("videoPlayerDropPath", "");

currentNode.getSession().save();
}

videoID = properties.get("videoPlayer", "").trim();

// check to see if the video ID is actually in the format "name [ID]"
Pattern p = Pattern.compile("\\[(.*?)\\]");
Matcher m = p.matcher(videoID);

if (m.find()) {
videoID = m.group(1);
}

playlistID = properties.get("videoPlayerPL", "").trim();

account = properties.get("account", "").trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private JSONObject deletePlaylist(SlingHttpServletRequest request) throws JSONEx
result = serviceUtil.deletePlaylist(request.getParameter("playlist"));
return result;
}

private JSONObject getVideosInFolder(SlingHttpServletRequest request) throws JSONException {
JSONObject result = new JSONObject();
result = new JSONObject(serviceUtil.getVideosInFolder(request.getParameter("folder"), Integer.parseInt(request.getParameter(Constants.START))));
Expand Down Expand Up @@ -681,8 +681,9 @@ private void executeRequest(final SlingHttpServletRequest request,
StringBuilder builder = new StringBuilder();
for (int i = 0; i < itemsArray.length(); i++) {
JSONObject item = new JSONObject();
builder.append("<li class=\"coral-SelectList-item coral-SelectList-item--option\" data-value=\"" + itemsArray.getJSONObject(i).getString("id") + "\">" + itemsArray.getJSONObject(i).getString("name") + "</li>");
builder.append("<li class=\"coral-SelectList-item coral-SelectList-item--option\" data-value=\"" + itemsArray.getJSONObject(i).getString("name") + " [" + itemsArray.getJSONObject(i).getString("id") + "]\">" + itemsArray.getJSONObject(i).getString("name") + " [" + itemsArray.getJSONObject(i).getString("id") + "]</li>");
}
LOGGER.debug("dropdown values requested");
response.getWriter().write(builder.toString());
break try_loop;
}
Expand Down
7 changes: 3 additions & 4 deletions current/ui.apps/src/main/content/META-INF/vault/filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
-->
<workspaceFilter version="1.0">

<filter root="/apps/brightcove">
<exclude pattern="/apps/brightcove/install/(.*).jar"/>
</filter>
<filter root="/apps/brightcove" />
<!-- <exclude pattern="/apps/brightcove/install/(.*).jar"/>
</filter> -->

<filter root="/apps/cq/core/content/nav/brightcove"/>

Expand All @@ -28,7 +28,6 @@
<exclude pattern="/etc/designs/cs/brightcove/jcr:content.*"/>
</filter>

<filter root="/libs/cq/gui/content/common/links/brightcove"/>
<filter root="/conf/global/settings/dam/adminui-extension/metadataschema/brightcove"/>

<filter root="/etc/replication/agents.author/brightcove"/>
Expand Down

0 comments on commit 85e847f

Please sign in to comment.