Class CKFinder.dialog
Constructor Attributes | Constructor Name and Description |
---|---|
CKFinder.dialog(app, dialogName)
This is the base class for runtime dialog objects.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
CKFinder.dialog.cancelButton
The default cancel button for dialogs.
|
<static> |
CKFinder.dialog.okButton
The default OK button for dialogs.
|
Resets all input values in the dialog.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
CKFinder.dialog.add(name, dialogDefinition)
Registers a dialog.
|
<static> |
CKFinder.dialog.addUIElement(typeName, builder)
Registers a dialog UI element.
|
<static> |
CKFinder.dialog.exists(name)
|
<static> |
CKFinder.dialog.getCurrent()
|
<inner> |
changeFocus(forward)
|
<inner> |
focusKeydownHandler(evt)
|
<inner> |
focusKeyPressHandler(evt)
|
<inner> |
iterContents(func)
|
addPage(contents)
Adds a tabbed page into the dialog.
|
|
click(id)
Simulates a click to a dialog button in the dialog's button row.
|
|
disableButton(id)
Disables a dialog button.
|
|
enableButton(id)
Enables a dialog button.
|
|
getButton(id)
Gets the UI element of a button in the dialog's button row.
|
|
getContentElement(pageId, elementId)
Gets a dialog UI element object from a dialog page.
|
|
Gets the root DOM element of the dialog.
|
|
getName()
Gets the name of the dialog.
|
|
Gets the number of pages in the dialog.
|
|
Gets the api instance of CKFinder which opened this dialog.
|
|
Gets the dialog's position in the window.
|
|
Gets the element that was selected when opening the dialog, if any.
|
|
getSize()
Gets the current size of the dialog in pixels.
|
|
getValueOf(pageId, elementId)
Gets the value of a dialog UI element.
|
|
hide()
Hides the dialog box.
|
|
hidePage(id)
Hides a page's tab away from the dialog.
|
|
layout()
Rearrange the dialog to its previous position or the middle of the window.
|
|
move(x, y, save)
Moves the dialog to an (x, y) coordinate relative to the window.
|
|
resize(width, height)
Resizes the dialog.
|
|
selectPage(id)
Activates a tab page in the dialog by its id.
|
|
setTitle(newName)
Sets dialog title.
|
|
setValueOf(pageId, elementId, value)
Sets the value of a dialog UI element.
|
|
show()
Shows the dialog box.
|
|
showPage(id)
Unhides a page's tab.
|
Class Detail
CKFinder.dialog(app, dialogName)
Since:
2.0
This is the base class for runtime dialog objects. An instance of this
class represents a single named dialog for a single app instance.
Note: do not create objects of this class directly. To create and open a dialog use:
- Parameters:
- {Object} app
- The app which created the dialog.
- {String} dialogName
- The dialog's registered name.
Field Detail
<static>
{Function}
CKFinder.dialog.cancelButton
Since:
2.0
The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed.
<static>
{Function}
CKFinder.dialog.okButton
Since:
2.0
The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds.
{CKFinder.dialog}
reset
Since:
2.0
Resets all input values in the dialog.
dialogObj.reset();
Method Detail
<static>
{Undefined}
CKFinder.dialog.add(name, dialogDefinition)
Since:
2.0
Registers a dialog.
var finder = new CKFinder(); finder.basePath = '/ckfinder/'; finder.callback = function( api ) { CKFinder.dialog.add( 'mydialog', function( api ) { // CKFinder.dialog.definition var dialogDefinition = { title : 'Sample dialog', minWidth : 390, minHeight : 130, onOk : function() { // "this" is now a CKFinder.dialog object. // Accessing dialog elements: var textareaObj = this.getContentElement( 'tab1', 'textareaId' ); alert( "You have entered: " + textareaObj.getValue() ); // A shorter version: // alert( "You have entered: " + this.getValueOf( 'tab1', 'textareaId' ) ); }, contents : [ { id : 'tab1', label : '', title : '', expand : true, padding : 0, elements : [ { type : 'html', html : '<h3>This is some sample HTML content.</h3>' }, { type : 'textarea', id : 'textareaId', rows : 4, cols : 40 } ] } ], buttons : [ CKFinder.dialog.cancelButton, CKFinder.dialog.okButton ] }; return dialogDefinition; } ); api.addFileContextMenuOption( { label : "Open dialog", command : "test" } , function( api, file ) { api.openDialog('mydialog'); }); }; finder.create();
- Parameters:
- {String} name
- The dialog's name.
- {Function|String} dialogDefinition
- A function returning the dialog's definition, or the URL to the .js file holding the function. The function should accept an argument "api" which is the current CKFinderAPI instance, and return an object conforming to CKFinder.dialog.dialogDefinition.
<static>
{Undefined}
CKFinder.dialog.addUIElement(typeName, builder)
Since:
2.0
Registers a dialog UI element.
- Parameters:
- {String} typeName
- The name of the UI element.
- {Function} builder
- The function to build the UI element.
<static>
{Undefined}
CKFinder.dialog.exists(name)
Since:
2.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} name
<static>
{Undefined}
CKFinder.dialog.getCurrent()
Since:
2.0
NO EXAMPLE AVAILABLE
<inner>
{Undefined}
changeFocus(forward)
Since:
2.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} forward
<inner>
{Undefined}
focusKeydownHandler(evt)
Since:
2.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} evt
<inner>
{Undefined}
focusKeyPressHandler(evt)
Since:
2.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} evt
<inner>
{Undefined}
iterContents(func)
Since:
2.0
NO EXAMPLE AVAILABLE
- Parameters:
- {Undefined} func
{Undefined}
addPage(contents)
Since:
2.0
Adds a tabbed page into the dialog.
- Parameters:
- {Object} contents
- Content definition.
{Undefined}
click(id)
Since:
2.0
Simulates a click to a dialog button in the dialog's button row.
- Parameters:
- {String} id
- The id of the button.
- Returns:
- {Undefined} The return value of the dialog's "click" event.
{Undefined}
disableButton(id)
Since:
2.0
Disables a dialog button.
- Parameters:
- {String} id
- The id of the button.
{Undefined}
enableButton(id)
Since:
2.0
Enables a dialog button.
- Parameters:
- {String} id
- The id of the button.
{CKFinder.ui.dialog.button}
getButton(id)
Since:
2.0
Gets the UI element of a button in the dialog's button row.
- Parameters:
- {String} id
- The id of the button.
- Returns:
- {CKFinder.ui.dialog.button} The button object.
{CKFinder.ui.dialog.uiElement}
getContentElement(pageId, elementId)
Since:
2.0
Gets a dialog UI element object from a dialog page.
dialogObj.getContentElement( 'tabId', 'elementId' )
- Parameters:
- {String} pageId
- id of dialog page.
- {String} elementId
- id of UI element.
- Returns:
- {CKFinder.ui.dialog.uiElement} The dialog UI element (the class that extends the uiElement, depending on the element definition, for example: CKFinder.ui.dialog.textInput, CKFinder.ui.dialog.select, etc.)).
- See:
- CKFinder.dialog.add
{CKFinder.dom.element}
getElement()
Since:
2.0
Gets the root DOM element of the dialog.
var dialogElement = dialogObj.getElement().getFirst(); dialogElement.setStyle( 'padding', '5px' );
- Returns:
- {CKFinder.dom.element} The <span> element containing this dialog.
{String}
getName()
Since:
2.0
Gets the name of the dialog.
var dialogName = dialogObj.getName();
- Returns:
- {String} The name of this dialog.
{Number}
getPageCount()
Since:
2.0
Gets the number of pages in the dialog.
NO EXAMPLE AVAILABLE
- Returns:
- {Number} Page count.
{CKFinderAPI}
getParentApi()
Since:
2.0
Gets the api instance of CKFinder which opened this dialog.
NO EXAMPLE AVAILABLE
- Returns:
- {CKFinderAPI} Parent api instance.
{Object}
getPosition()
Since:
2.0
Gets the dialog's position in the window.
var dialogX = dialogObj.getPosition().x;
- Returns:
- {Object} An object with "x" and "y" properties.
{CKFinder.dom.element}
getSelectedElement()
Since:
2.0
Gets the element that was selected when opening the dialog, if any.
NO EXAMPLE AVAILABLE
- Returns:
- {CKFinder.dom.element} The element that was selected, or null.
{Object}
getSize()
Since:
2.0
Gets the current size of the dialog in pixels.
var width = dialogObj.getSize().width;
- Returns:
- {Object} An object with "width" and "height" properties.
{Object}
getValueOf(pageId, elementId)
Since:
2.0
Gets the value of a dialog UI element.
- Parameters:
- {String} pageId
- id of dialog page.
- {String} elementId
- id of UI element.
- Returns:
- {Object} The value of the UI element.
{Undefined}
hide()
Since:
2.0
Hides the dialog box.
dialogObj.hide();
{Undefined}
hidePage(id)
Since:
2.0
Hides a page's tab away from the dialog.
dialog.hidePage( 'tab_3' );
- Parameters:
- {String} id
- The page's Id.
{Undefined}
layout()
Since:
3.5
Rearrange the dialog to its previous position or the middle of the window.
NO EXAMPLE AVAILABLE
{Undefined}
move(x, y, save)
Since:
2.0
Moves the dialog to an (x, y) coordinate relative to the window.
dialogObj.move( 10, 40 );
- Parameters:
- {Number} x
- The target x-coordinate.
- {Number} y
- The target y-coordinate.
- {Boolean} save
- Flag indicate whether the dialog position should be remembered on next open up.
{Undefined}
resize(width, height)
Since:
2.0
Resizes the dialog.
dialogObj.resize( 800, 640 );
- Parameters:
- {Number} width
- The width of the dialog in pixels.
- {Number} height
- The height of the dialog in pixels.
{Undefined}
selectPage(id)
Since:
2.0
Activates a tab page in the dialog by its id.
dialogObj.selectPage( 'tab_1' );
- Parameters:
- {String} id
- The id of the dialog tab to be activated.
{Undefined}
setTitle(newName)
Since:
2.0
Sets dialog title.
// this = dialog this.setTitle( file.name );
- Parameters:
- {String} newName
- New title.
- Returns:
- {Undefined}
{Undefined}
setValueOf(pageId, elementId, value)
Since:
2.0
Sets the value of a dialog UI element.
- Parameters:
- {String} pageId
- id of the dialog page.
- {String} elementId
- id of the UI element.
- {Object} value
- The new value of the UI element.
{Undefined}
show()
Since:
2.0
Shows the dialog box.
dialogObj.show();
{Undefined}
showPage(id)
Since:
2.0
Unhides a page's tab.
dialog.showPage( 'tab_2' );
- Parameters:
- {String} id
- The page's Id.