mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
intial version of user setting for texlive imageName
This commit is contained in:
parent
d7a341f59b
commit
19dfe5fc8b
7 changed files with 55 additions and 1 deletions
|
@ -163,6 +163,13 @@ module.exports = EditorController =
|
||||||
EditorRealTimeController.emitToRoom project_id, 'compilerUpdated', compiler
|
EditorRealTimeController.emitToRoom project_id, 'compilerUpdated', compiler
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
|
setImageName : (project_id, imageName, callback = (err) ->) ->
|
||||||
|
ProjectOptionsHandler.setImageName project_id, imageName, (err) ->
|
||||||
|
return callback(err) if err?
|
||||||
|
logger.log imageName:imageName, project_id:project_id, "setting imageName"
|
||||||
|
EditorRealTimeController.emitToRoom project_id, 'imageNameUpdated', imageName
|
||||||
|
callback()
|
||||||
|
|
||||||
setSpellCheckLanguage : (project_id, languageCode, callback = (err) ->) ->
|
setSpellCheckLanguage : (project_id, languageCode, callback = (err) ->) ->
|
||||||
ProjectOptionsHandler.setSpellCheckLanguage project_id, languageCode, (err) ->
|
ProjectOptionsHandler.setSpellCheckLanguage project_id, languageCode, (err) ->
|
||||||
return callback(err) if err?
|
return callback(err) if err?
|
||||||
|
|
|
@ -49,6 +49,10 @@ module.exports = ProjectController =
|
||||||
jobs.push (callback) ->
|
jobs.push (callback) ->
|
||||||
editorController.setCompiler project_id, req.body.compiler, callback
|
editorController.setCompiler project_id, req.body.compiler, callback
|
||||||
|
|
||||||
|
if req.body.imageName?
|
||||||
|
jobs.push (callback) ->
|
||||||
|
editorController.setImageName project_id, req.body.imageName, callback
|
||||||
|
|
||||||
if req.body.name?
|
if req.body.name?
|
||||||
jobs.push (callback) ->
|
jobs.push (callback) ->
|
||||||
editorController.renameProject project_id, req.body.name, callback
|
editorController.renameProject project_id, req.body.name, callback
|
||||||
|
@ -347,6 +351,7 @@ module.exports = ProjectController =
|
||||||
useV2History: !!project.overleaf?.history?.display
|
useV2History: !!project.overleaf?.history?.display
|
||||||
richTextEnabled: Features.hasFeature('rich-text')
|
richTextEnabled: Features.hasFeature('rich-text')
|
||||||
showTestControls: req.query?.tc == 'true' || user.isAdmin
|
showTestControls: req.query?.tc == 'true' || user.isAdmin
|
||||||
|
allowedImageNames: Settings.allowedImageNames || []
|
||||||
timer.done()
|
timer.done()
|
||||||
|
|
||||||
_buildProjectList: (allProjects, v1Projects = [])->
|
_buildProjectList: (allProjects, v1Projects = [])->
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
_ = require("underscore")
|
_ = require("underscore")
|
||||||
|
Path = require 'path'
|
||||||
|
|
||||||
module.exports = ProjectEditorHandler =
|
module.exports = ProjectEditorHandler =
|
||||||
trackChangesAvailable: false
|
trackChangesAvailable: false
|
||||||
|
@ -20,6 +20,7 @@ module.exports = ProjectEditorHandler =
|
||||||
members: []
|
members: []
|
||||||
invites: invites
|
invites: invites
|
||||||
tokens: project.tokens
|
tokens: project.tokens
|
||||||
|
imageName: if project.imageName? then Path.basename(project.imageName) else undefined
|
||||||
|
|
||||||
if !result.invites?
|
if !result.invites?
|
||||||
result.invites = []
|
result.invites = []
|
||||||
|
|
|
@ -17,6 +17,16 @@ module.exports =
|
||||||
if callback?
|
if callback?
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
|
setImageName : (project_id, imageName, callback = ()->)->
|
||||||
|
logger.log project_id:project_id, imageName:imageName, "setting the imageName"
|
||||||
|
imageName = imageName.toLowerCase()
|
||||||
|
if ! _.some(settings.allowedImageNames, (allowed) -> imageName is allowed.imageName)
|
||||||
|
return callback()
|
||||||
|
conditions = {_id:project_id}
|
||||||
|
update = {imageName: settings.imageRoot + '/' + imageName}
|
||||||
|
Project.update conditions, update, {}, (err)->
|
||||||
|
if callback?
|
||||||
|
callback()
|
||||||
|
|
||||||
setSpellCheckLanguage: (project_id, languageCode, callback = ()->)->
|
setSpellCheckLanguage: (project_id, languageCode, callback = ()->)->
|
||||||
logger.log project_id:project_id, languageCode:languageCode, "setting the spell check language"
|
logger.log project_id:project_id, languageCode:languageCode, "setting the spell check language"
|
||||||
|
|
|
@ -188,6 +188,15 @@ aside#left-menu.full-size(
|
||||||
option(value="pdfjs") #{translate("built_in")}
|
option(value="pdfjs") #{translate("built_in")}
|
||||||
option(value="native") #{translate("native")}
|
option(value="native") #{translate("native")}
|
||||||
|
|
||||||
|
if (getSessionUser() && getSessionUser().isAdmin && typeof(allowedImageNames) !== 'undefined' && allowedImageNames.length > 0)
|
||||||
|
.form-controls(ng-show="permissions.write")
|
||||||
|
label(for="imageName") #{translate("TeXLive")}
|
||||||
|
select(
|
||||||
|
name="imageName"
|
||||||
|
ng-model="project.imageName"
|
||||||
|
)
|
||||||
|
each image in allowedImageNames
|
||||||
|
option(value=image.imageName) #{image.imageDesc}
|
||||||
|
|
||||||
h4 #{translate("hotkeys")}
|
h4 #{translate("hotkeys")}
|
||||||
ul.list-unstyled.nav
|
ul.list-unstyled.nav
|
||||||
|
|
|
@ -472,3 +472,14 @@ module.exports = settings =
|
||||||
autoCompile:
|
autoCompile:
|
||||||
everyone: 100
|
everyone: 100
|
||||||
standard: 25
|
standard: 25
|
||||||
|
|
||||||
|
# currentImage: "texlive-full:2017.1"
|
||||||
|
# imageRoot: "<DOCKER REPOSITORY ROOT>" # without any trailing slash
|
||||||
|
|
||||||
|
# allowedImageNames: [
|
||||||
|
# {imageName: 'texlive-full:2017.1', imageDesc: 'TeXLive 2017'}
|
||||||
|
# {imageName: 'wl_texlive:2018.1', imageDesc: 'Legacy OL TeXLive 2015'}
|
||||||
|
# {imageName: 'texlive-full:2016.1', imageDesc: 'Legacy SL TeXLive 2016'}
|
||||||
|
# {imageName: 'texlive-full:2015.1', imageDesc: 'Legacy SL TeXLive 2015'}
|
||||||
|
# {imageName: 'texlive-full:2014.2', imageDesc: 'Legacy SL TeXLive 2014.2'}
|
||||||
|
# ]
|
|
@ -67,6 +67,11 @@ define [
|
||||||
if oldCompiler? and compiler != oldCompiler
|
if oldCompiler? and compiler != oldCompiler
|
||||||
settings.saveProjectSettings({compiler: compiler})
|
settings.saveProjectSettings({compiler: compiler})
|
||||||
|
|
||||||
|
$scope.$watch "project.imageName", (imageName, oldImageName) =>
|
||||||
|
return if @ignoreUpdates
|
||||||
|
if oldImageName? and imageName != oldImageName
|
||||||
|
settings.saveProjectSettings({imageName: imageName})
|
||||||
|
|
||||||
$scope.$watch "project.rootDoc_id", (rootDoc_id, oldRootDoc_id) =>
|
$scope.$watch "project.rootDoc_id", (rootDoc_id, oldRootDoc_id) =>
|
||||||
return if @ignoreUpdates
|
return if @ignoreUpdates
|
||||||
# don't save on initialisation, Angular passes oldRootDoc_id as
|
# don't save on initialisation, Angular passes oldRootDoc_id as
|
||||||
|
@ -83,6 +88,12 @@ define [
|
||||||
$scope.project.compiler = compiler
|
$scope.project.compiler = compiler
|
||||||
delete @ignoreUpdates
|
delete @ignoreUpdates
|
||||||
|
|
||||||
|
ide.socket.on "imageNameUpdated", (imageName) =>
|
||||||
|
@ignoreUpdates = true
|
||||||
|
$scope.$apply () =>
|
||||||
|
$scope.project.imageName = imageName
|
||||||
|
delete @ignoreUpdates
|
||||||
|
|
||||||
ide.socket.on "spellCheckLanguageUpdated", (languageCode) =>
|
ide.socket.on "spellCheckLanguageUpdated", (languageCode) =>
|
||||||
@ignoreUpdates = true
|
@ignoreUpdates = true
|
||||||
$scope.$apply () =>
|
$scope.$apply () =>
|
||||||
|
|
Loading…
Reference in a new issue