Skip to content

Commit

Permalink
Merge pull request #3140 from PenghaiZhang/feature/support-kaltura-cs…
Browse files Browse the repository at this point in the history
…s-in-new-ui

chore: include Kaltura Upload control CSS in new UI
  • Loading branch information
PenghaiZhang committed Jun 25, 2021
1 parent 3000bbd commit 4653205
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ public void ensureActivated(PluginDescriptor plugin) {
}
}

public boolean isActivated(String pluginId) {
return pluginManager.getRegistry().isPluginDescriptorAvailable(pluginId);
}

@SuppressWarnings("nls")
@Override
public ExtensionPoint getExtensionPoint(String pluginId, String pointId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ public interface PluginService {

void ensureActivated(PluginDescriptor plugin);

/**
* Check if a plugin is activated.
*
* @param pluginId The ID of plugin
* @return `true` if plugin available otherwise false
*/
default boolean isActivated(String pluginId) {
throw new UnsupportedOperationException();
}

void registerExtensionListener(
String pluginId, String extensionId, RegistryChangeListener listener);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
package com.tle.web.template

import java.util.concurrent.ConcurrentHashMap

import com.tle.common.i18n.{CurrentLocale, LocaleUtils}
import com.tle.common.settings.standard.QuickContributeAndVersionSettings
import com.tle.core.db.RunWithDB
import com.tle.core.i18n.LocaleLookup
import com.tle.core.plugins.AbstractPluginService
import com.tle.legacy.LegacyGuice
import com.tle.web.DebugSettings
import com.tle.web.freemarker.FreemarkerFactory
import com.tle.web.resources.ResourcesService
import com.tle.web.resources.{ResourcesService}
import com.tle.web.sections._
import com.tle.web.sections.equella.ScalaSectionRenderable
import com.tle.web.sections.events._
Expand All @@ -37,6 +37,7 @@ import com.tle.web.sections.js.generic.function.IncludeFile
import com.tle.web.sections.render._
import com.tle.web.selection.section.RootSelectionSection
import com.tle.web.integration.IntegrationSection
import com.tle.web.sections.render.CssInclude.{Priority, include}
import com.tle.web.selection.section.RootSelectionSection.Layout
import com.tle.web.settings.UISettings
import javax.servlet.http.HttpServletRequest
Expand Down Expand Up @@ -83,11 +84,24 @@ object RenderNewTemplate {
supportIEPolyFills(info)
info.preRender(bundleJs)
links.foreach(l => info.addCss(r.url(l.attr("href"))))
addKalturaCss(info)
info.addCss(RenderTemplate.CUSTOMER_CSS)
}
(prerender, htmlDoc)
}

def addKalturaCss(info: PreRenderContext): Unit = {
val kalturaPluginId = "com.tle.web.wizard.controls.kaltura"
val pluginService = AbstractPluginService.get()
if (pluginService.isActivated(kalturaPluginId)) {
info.addCss(
include(
ResourcesService
.getResourceHelper(kalturaPluginId)
.url("js/UploadControlEntry.css")).priority(Priority.LOWEST).make())
}
}

val NewLayoutKey = "NEW_LAYOUT"

// Check if new UI is enabled.
Expand Down

0 comments on commit 4653205

Please sign in to comment.