Namespace: OC

OC

Classes

EventSource

Namespaces

AppConfig
Breadcrumb
dialogs
Encryption
Files
L10N
localStorage
Login
MimeType
MountConfig
msg
Notification
Plugins
search
Share
SystemTags
Upload
Util

Members

(static) currentUser :String

Currently logged in user or null if none
Type:
  • String
Deprecated:
Source:

(static) Encryption

Copyright (c) 2013, Sam Tuke This file is licensed under the Affero General Public License version 3 or later. See the COPYING-README file.
Source:

(static) MimeTypeList

This file is automatically generated DO NOT EDIT MANUALLY! You can update the list of MimeType Aliases in config/mimetypealiases.json The list of files is fetched from core/img/filetypes To regenerate this file run ./occ maintenance:mimetypesjs
Source:

(static) webroot :string

Relative path to ownCloud root. For example: "/owncloud"
Type:
Deprecated:
  • since 8.2, use OC.getRootPath() instead
Source:
See:
  • OC#getRootPath

Methods

(static) _processAjaxError()

Process ajax error, redirects to main page if an error/auth error status was returned.
Source:

(static) addScript(app, script, ready)

Load a script for the server and load it. If the script is already loaded, the event handler will be called directly
Parameters:
Name Type Description
app string the app id to which the script belongs
script string the filename of the script
ready event handler to be called when the script is loaded
Source:

(static) addStyle(app, style)

Loads a CSS file
Parameters:
Name Type Description
app string the app id to which the css style belongs
style string the filename of the css file
Source:

(static) addTranslations(app, callback) → {Promise}

Loads translations for the given app asynchronously.
Parameters:
Name Type Description
app String app name
callback function callback to call after loading
Source:
Returns:
Type
Promise

(static) appSettings(appid, loadJS, cacheopt, scriptNameopt)

Opens a popup with the setting for an app.
Parameters:
Name Type Attributes Description
appid string The ID of the app e.g. 'calendar', 'contacts' or 'files'.
loadJS boolean | string If true 'js/settings.js' is loaded. If it's a string it will attempt to load a script by that name in the 'js' directory.
cache boolean <optional>
If true the javascript file won't be forced refreshed. Defaults to true.
scriptName string <optional>
The name of the PHP file to load. Defaults to 'settings.php' in the root of the app directory hierarchy.
Source:

(static) basename(path) → {String}

Returns the base name of the given path. For example for "/abc/somefile.txt" it will return "somefile.txt"
Parameters:
Name Type Description
path String
Source:
Returns:
base name
Type
String

(static) buildQueryString(params) → {string}

Builds a URL query from a JS map.
Parameters:
Name Type Description
params Object.<string, string> map containing key/values matching the URL parameters
Source:
Returns:
String containing a URL query (without question) mark
Type
string

(static) dirname(path) → {String}

Returns the dir name of the given path. For example for "/abc/somefile.txt" it will return "/abc"
Parameters:
Name Type Description
path String
Source:
Returns:
dir name
Type
String

(static) encodePath(path)

URI-Encodes a file path but keep the path slashes.
Parameters:
Name Type Description
path path
Source:
Returns:
encoded path

(static) filePath(app, type, file) → {string}

Get the absolute url for a file in an app
Parameters:
Name Type Description
app string the id of the app
type string the type of the file to link to (e.g. css,img,ajax.template)
file string the filename
Source:
Returns:
Absolute URL for a file in an app
Type
string

(static) generateUrl(url, paramsopt, optionsopt) → {string}

Generates the absolute url for the given relative url, which can contain parameters. Parameters will be URL encoded automatically.
Parameters:
Name Type Attributes Description
url string
params <optional>
params
options <optional>
options
Properties
Name Type Attributes Default Description
escape bool <optional>
true enable/disable auto escape of placeholders (by default enabled)
Source:
Returns:
Absolute URL for the given relative URL
Type
string

(static) get(name) → {*}

Get a variable by name
Parameters:
Name Type Description
name string
Source:
Returns:
Type
*

(static) getCurrentUser() → {OC.CurrentUser}

Returns the currently logged in user or null if there is no logged in user (public page mode)
Since:
  • 9.0.0
Source:
Returns:
user spec
Type
OC.CurrentUser

(static) getHost() → {string}

Returns the host used to access this ownCloud instance Host is sometimes the same as the hostname but now always. Examples: http://example.com => example.com https://example.com => exmaple.com http://example.com:8080 => example.com:8080
Since:
  • 8.2
Source:
Returns:
host
Type
string

(static) getHostName() → {string}

Returns the hostname used to access this ownCloud instance The hostname is always stripped of the port
Since:
  • 9.0
Source:
Returns:
hostname
Type
string

(static) getLocale() → {String}

Returns the user's locale
Source:
Returns:
locale string
Type
String

(static) getPort() → {int}

Returns the port number used to access this ownCloud instance
Since:
  • 8.2
Source:
Returns:
port number
Type
int

(static) getProtocol() → {string}

Protocol that is used to access this ownCloud instance
Source:
Returns:
Used protocol
Type
string

(static) getRootPath() → {string}

Returns the web root path where this ownCloud instance is accessible, with a leading slash. For example "/owncloud".
Since:
  • 8.2
Source:
Returns:
web root path
Type
string

(static) hideMenus(complete)

Hides any open menus
Parameters:
Name Type Description
complete function callback when the hiding animation is done
Source:

(static) imagePath(app, file) → {string}

get the absolute path to an image file if no extension is given for the image, it will automatically decide between .png and .svg based on what the browser supports
Parameters:
Name Type Description
app string the app id to which the image belongs
file string the name of the image file
Source:
Returns:
Type
string

(static) isUserAdmin() → {bool}

Returns whether the current user is an administrator
Since:
  • 9.0.0
Source:
Returns:
true if the user is an admin, false otherwise
Type
bool

(static) joinPaths(…path) → {String}

Join path sections
Parameters:
Name Type Attributes Description
path String <repeatable>
sections
Since:
  • 8.2
Source:
Returns:
joined path, any leading or trailing slash will be kept
Type
String

(static) linkTo(app, file) → {string}

Get an absolute url to a file in an app
Parameters:
Name Type Description
app string the id of the app the file belongs to
file string the file path relative to the app folder
Source:
Returns:
Absolute URL to a file
Type
string

(static) linkToOCS(service, version) → {string}

Gets the base path for the given OCS API service.
Parameters:
Name Type Description
service string name
version int OCS API version
Source:
Returns:
OCS API base path
Type
string

(static) linkToRemote(service) → {string}

Parameters:
Name Type Description
service string id
Source:
Returns:
the url
Type
string

(static) linkToRemoteBase(service) → {string}

Creates a relative url for remote use
Parameters:
Name Type Description
service string id
Source:
Returns:
the url
Type
string

(static) parseQueryString(queryString) → {Object.<string, string>}

Parses a URL query string into a JS map
Parameters:
Name Type Description
queryString string query string in the format param1=1234¶m2=abcde¶m3=xyz
Source:
Returns:
map containing key/values matching the URL parameters
Type
Object.<string, string>

(static) redirect(targetURL)

Redirect to the target URL, can also be used for downloads.
Parameters:
Name Type Description
targetURL string URL to redirect to
Source:

(static) registerMenu()

For menu toggling
Source:
To Do:
  • Write documentation

(static) registerXHRForErrorProcessing(xhr)

Registers XmlHttpRequest object for global error processing. This means that if this XHR object returns 401 or session timeout errors, the current page will automatically be reloaded.
Parameters:
Name Type Description
xhr XMLHttpRequest
Source:

(static) reload()

Reloads the current page
Source:

(static) search(query)

Do a search query and display the results
Parameters:
Name Type Description
query string the search query
Source:

(static) set(name, value)

Set a variable by name
Parameters:
Name Type Description
name string
value *
Source:

(static) showMenu($toggleopt, $menuEl, complete)

Shows a given element as menu
Parameters:
Name Type Attributes Default Description
$toggle Object <optional>
null menu toggle
$menuEl Object menu element
complete function callback when the showing animation is done
Source:

(static) unregisterMenu()

Source:
To Do:
  • Write documentation

Type Definitions

CurrentUser

Current user attributes
Type:
Properties:
Name Type Description
uid String user id
displayName String display name
Source:

Plugin

Plugin
Type:
Properties:
Name Type Attributes Description
name String plugin name
attach function function that will be called when the plugin is attached
detach function <optional>
function that will be called when the plugin is detached
Source:
To Do:
  • make this a real class in the future