github.com/cs3org/reva/v2@v2.27.7/pkg/siteacc/html/provider.go (about) 1 // Copyright 2018-2020 CERN 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 // In applying this license, CERN does not waive the privileges and immunities 16 // granted to it by virtue of its status as an Intergovernmental Organization 17 // or submit itself to any jurisdiction. 18 19 package html 20 21 import ( 22 "net/http" 23 ) 24 25 const ( 26 // ContinueExecution causes the execution of a panel to continue. 27 ContinueExecution = true 28 // AbortExecution causes the execution of a panel to be aborted. 29 AbortExecution = false 30 ) 31 32 // ExecutionResult is the type returned by the PreExecute function of PanelProvider. 33 type ExecutionResult = bool 34 35 // PanelProvider handles general panel tasks. 36 type PanelProvider interface { 37 // GetActiveTemplate returns the name of the active template. 38 GetActiveTemplate(*Session, string) string 39 40 // PreExecute is called before the actual template is being executed. 41 PreExecute(*Session, string, http.ResponseWriter, *http.Request) (ExecutionResult, error) 42 } 43 44 // PanelDataProvider is the function signature for panel data providers. 45 type PanelDataProvider = func(*Session) interface{} 46 47 // ContentProvider defines various methods for HTML content providers. 48 type ContentProvider interface { 49 // GetTitle returns the title of the panel. 50 GetTitle() string 51 // GetCaption returns the caption which is displayed on the panel. 52 GetCaption() string 53 54 // GetContentJavaScript delivers additional JavaScript code. 55 GetContentJavaScript() string 56 // GetContentStyleSheet delivers additional stylesheet code. 57 GetContentStyleSheet() string 58 // GetContentBody delivers the actual body content. 59 GetContentBody() string 60 }