[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/files/ -> renderer.php (summary)

Rendering of files viewer related widgets.

Copyright: 2010 Dongsheng Cai
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1148 lines (53 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

core_files_renderer:: (26 methods):
  files_tree_viewer()
  render_files_tree_viewer()
  render_form_filemanager()
  fm_print_generallayout()
  fm_js_template_iconfilename()
  fm_js_template_listfilename()
  fm_js_template_mkdir()
  fm_js_template_message()
  fm_js_template_fileselectlayout()
  fm_js_template_confirmdialog()
  filemanager_js_templates()
  fm_print_restrictions()
  fp_js_template_generallayout()
  fp_js_template_iconfilename()
  fp_js_template_listfilename()
  fp_js_template_nextpage()
  fp_js_template_selectlayout()
  fp_js_template_uploadform()
  fp_js_template_loading()
  fp_js_template_error()
  fp_js_template_message()
  fp_js_template_processexistingfile()
  fp_js_template_processexistingfilemultiple()
  fp_js_template_loginform()
  filepicker_js_templates()
  repository_default_searchform()

files_tree_viewer:: (1 method):
  __construct()


Class: core_files_renderer  - X-Ref

File browser render

files_tree_viewer(file_info $file_info, array $options = null)   X-Ref
No description

render_files_tree_viewer(files_tree_viewer $tree)   X-Ref
No description

render_form_filemanager($fm)   X-Ref
Prints the file manager and initializes all necessary libraries

<pre>
$fm = new form_filemanager($options);
$output = get_renderer('core', 'files');
echo $output->render($fm);
</pre>

param: form_filemanager $fm File manager to render
return: string HTML fragment

fm_print_generallayout($fm)   X-Ref
Returns html for displaying one file manager

The main element in HTML must have id="filemanager-{$client_id}" and
class="filemanager fm-loading";
After all necessary code on the page (both html and javascript) is loaded,
the class fm-loading will be removed and added class fm-loaded;
The main element (class=filemanager) will be assigned the following classes:
'fm-maxfiles' - when filemanager has maximum allowed number of files;
'fm-nofiles' - when filemanager has no files at all (although there might be folders);
'fm-noitems' - when current view (folder) has no items - neither files nor folders;
'fm-updating' - when current view is being updated (usually means that loading icon is to be displayed);
'fm-nomkdir' - when 'Make folder' action is unavailable (empty($fm->options->subdirs) == true)

Element with class 'filemanager-container' will be holding evens for dnd upload (dragover, etc.).
It will have class:
'dndupload-ready' - when a file is being dragged over the browser
'dndupload-over' - when file is being dragged over this filepicker (additional to 'dndupload-ready')
'dndupload-uploading' - during the upload process (note that after dnd upload process is
over, the file manager will refresh the files list and therefore will have for a while class
fm-updating. Both waiting processes should look similar so the images don't jump for user)

If browser supports Drag-and-drop, the body element will have class 'dndsupported',
otherwise - 'dndnotsupported';

Element with class 'fp-content' will be populated with files list;
Element with class 'fp-btn-add' will hold onclick event for adding a file (opening filepicker);
Element with class 'fp-btn-mkdir' will hold onclick event for adding new folder;
Element with class 'fp-btn-download' will hold onclick event for download action;

Element with class 'fp-path-folder' is a template for one folder in path toolbar.
It will hold mouse click event and will be assigned classes first/last/even/odd respectfully.
Parent element will receive class 'empty' when there are no folders to be displayed;
The content of subelement with class 'fp-path-folder-name' will be substituted with folder name;

Element with class 'fp-viewbar' will have the class 'enabled' or 'disabled' when view mode
can be changed or not;
Inside element with class 'fp-viewbar' there are expected elements with classes
'fp-vb-icons', 'fp-vb-tree' and 'fp-vb-details'. They will handle onclick events to switch
between the view modes, the last clicked element will have the class 'checked';

param: form_filemanager $fm
return: string

fm_js_template_iconfilename()   X-Ref
FileManager JS template for displaying one file in 'icon view' mode.

Except for elements described in fp_js_template_iconfilename, this template may also
contain element with class 'fp-contextmenu'. If context menu is available for this
file, the top element will receive the additional class 'fp-hascontextmenu' and
the element with class 'fp-contextmenu' will hold onclick event for displaying
the context menu.

return: string

fm_js_template_listfilename()   X-Ref
FileManager JS template for displaying file name in 'table view' and 'tree view' modes.

Except for elements described in fp_js_template_listfilename, this template may also
contain element with class 'fp-contextmenu'. If context menu is available for this
file, the top element will receive the additional class 'fp-hascontextmenu' and
the element with class 'fp-contextmenu' will hold onclick event for displaying
the context menu.

return: string

fm_js_template_mkdir()   X-Ref
FileManager JS template for displaying 'Make new folder' dialog.

Must be wrapped in an element, CSS for this element must define width and height of the window;

Must have one input element with type="text" (for users to enter the new folder name);

content of element with class 'fp-dlg-curpath' will be replaced with current path where
new folder is about to be created;
elements with classes 'fp-dlg-butcreate' and 'fp-dlg-butcancel' will hold onclick events;

return: string

fm_js_template_message()   X-Ref
FileManager JS template for error/info message displayed as a separate popup window.

return: string

fm_js_template_fileselectlayout()   X-Ref
FileManager JS template for window with file information/actions.

All content must be enclosed in one element, CSS for this class must define width and
height of the window;

Thumbnail image will be added as content to the element with class 'fp-thumbnail';

Inside the window the elements with the following classnames must be present:
'fp-saveas', 'fp-author', 'fp-license', 'fp-path'. Inside each of them must be
one input element (or select in case of fp-license and fp-path). They may also have labels.
The elements will be assign with class 'uneditable' and input/select element will become
disabled if they are not applicable for the particular file;

There may be present elements with classes 'fp-original', 'fp-datemodified', 'fp-datecreated',
'fp-size', 'fp-dimensions', 'fp-reflist'. They will receive additional class 'fp-unknown' if
information is unavailable. If there is information available, the content of embedded
element with class 'fp-value' will be substituted with the value;

The value of Original ('fp-original') is loaded in separate request. When it is applicable
but not yet loaded the 'fp-original' element receives additional class 'fp-loading';

The value of 'Aliases/Shortcuts' ('fp-reflist') is also loaded in separate request. When it
is applicable but not yet loaded the 'fp-original' element receives additional class
'fp-loading'. The string explaining that XX references exist will replace content of element
'fp-refcount'. Inside '.fp-reflist .fp-value' each reference will be enclosed in <li>;

Elements with classes 'fp-file-update', 'fp-file-download', 'fp-file-delete', 'fp-file-zip',
'fp-file-unzip', 'fp-file-setmain' and 'fp-file-cancel' will hold corresponding onclick
events (there may be several elements with class 'fp-file-cancel');

When confirm button is pressed and file is being selected, the top element receives
additional class 'loading'. It is removed when response from server is received.

When any of the input fields is changed, the top element receives class 'fp-changed';
When current file can be set as main - top element receives class 'fp-cansetmain';
When current file is folder/zip/file - top element receives respectfully class
'fp-folder'/'fp-zip'/'fp-file';

return: string

fm_js_template_confirmdialog()   X-Ref
FileManager JS template for popup confirm dialogue window.

Must have one top element, CSS for this element must define width and height of the window;

content of element with class 'fp-dlg-text' will be replaced with dialog text;
elements with classes 'fp-dlg-butconfirm' and 'fp-dlg-butcancel' will
hold onclick events;

return: string

filemanager_js_templates()   X-Ref
Returns all FileManager JavaScript templates as an array.

return: array

fm_print_restrictions($fm)   X-Ref
Displays restrictions for the file manager

param: form_filemanager $fm
return: string

fp_js_template_generallayout()   X-Ref
Template for FilePicker with general layout (not QuickUpload).

Must have one top element containing everything else (recommended <div class="file-picker">),
CSS for this element must define width and height of the filepicker window. Or CSS must
define min-width, max-width, min-height and max-height and in this case the filepicker
window will be resizeable;

Element with class 'fp-viewbar' will have the class 'enabled' or 'disabled' when view mode
can be changed or not;
Inside element with class 'fp-viewbar' there are expected elements with classes
'fp-vb-icons', 'fp-vb-tree' and 'fp-vb-details'. They will handle onclick events to switch
between the view modes, the last clicked element will have the class 'checked';

Element with class 'fp-repo' is a template for displaying one repository. Other repositories
will be attached as siblings (classes first/last/even/odd will be added respectfully).
The currently selected repostory will have class 'active'. Contents of element with class
'fp-repo-name' will be replaced with repository name, source of image with class
'fp-repo-icon' will be replaced with repository icon;

Element with class 'fp-content' is obligatory and will hold the current contents;

Element with class 'fp-paging' will contain page navigation (will be deprecated soon);

Element with class 'fp-path-folder' is a template for one folder in path toolbar.
It will hold mouse click event and will be assigned classes first/last/even/odd respectfully.
Parent element will receive class 'empty' when there are no folders to be displayed;
The content of subelement with class 'fp-path-folder-name' will be substituted with folder name;

Element with class 'fp-toolbar' will have class 'empty' if all 'Back', 'Search', 'Refresh',
'Logout', 'Manage' and 'Help' are unavailable for this repo;

Inside fp-toolbar there are expected elements with classes fp-tb-back, fp-tb-search,
fp-tb-refresh, fp-tb-logout, fp-tb-manage and fp-tb-help. Each of them will have
class 'enabled' or 'disabled' if particular repository has this functionality.
Element with class 'fp-tb-search' must contain empty form inside, it's contents will
be substituted with the search form returned by repository (in the most cases it
is generated with template core_repository_renderer::repository_default_searchform);
Other elements must have either <a> or <button> element inside, it will hold onclick
event for corresponding action; labels for fp-tb-back and fp-tb-logout may be
replaced with those specified by repository;

return: string

fp_js_template_iconfilename()   X-Ref
FilePicker JS template for displaying one file in 'icon view' mode.

the element with class 'fp-thumbnail' will be resized to the repository thumbnail size
(both width and height, unless min-width and/or min-height is set in CSS) and the content of
an element will be replaced with an appropriate img;

the width of element with class 'fp-filename' will be set to the repository thumbnail width
(unless min-width is set in css) and the content of an element will be replaced with filename
supplied by repository;

top element(s) will have class fp-folder if the element is a folder;

List of files will have parent <div> element with class 'fp-iconview'

return: string

fp_js_template_listfilename()   X-Ref
FilePicker JS template for displaying file name in 'table view' and 'tree view' modes.

content of the element with class 'fp-icon' will be replaced with an appropriate img;

content of element with class 'fp-filename' will be replaced with filename supplied by
repository;

top element(s) will have class fp-folder if the element is a folder;

Note that tree view and table view are the YUI widgets and therefore there are no
other templates. The widgets will be wrapped in <div> with class fp-treeview or
fp-tableview (respectfully).

return: string

fp_js_template_nextpage()   X-Ref
FilePicker JS template for displaying link/loading progress for fetching of the next page

This text is added to .fp-content AFTER .fp-iconview/.fp-treeview/.fp-tableview

Must have one parent element with class 'fp-nextpage'. It will be assigned additional
class 'loading' during loading of the next page (it is recommended that in this case the link
becomes unavailable). Also must contain one element <a> or <button> that will hold
onclick event for displaying of the next page. The event will be triggered automatically
when user scrolls to this link.

return: string

fp_js_template_selectlayout()   X-Ref
FilePicker JS template for window appearing to select a file.

All content must be enclosed in one element, CSS for this class must define width and
height of the window;

Thumbnail image will be added as content to the element with class 'fp-thumbnail';

Inside the window the elements with the following classnames must be present:
'fp-saveas', 'fp-linktype-2', 'fp-linktype-1', 'fp-linktype-4', 'fp-setauthor',
'fp-setlicense'. Inside each of them must have one input element (or select in case of
fp-setlicense). They may also have labels.
The elements will be assign with class 'uneditable' and input/select element will become
disabled if they are not applicable for the particular file;

There may be present elements with classes 'fp-datemodified', 'fp-datecreated', 'fp-size',
'fp-license', 'fp-author', 'fp-dimensions'. They will receive additional class 'fp-unknown'
if information is unavailable. If there is information available, the content of embedded
element with class 'fp-value' will be substituted with the value;

Elements with classes 'fp-select-confirm' and 'fp-select-cancel' will hold corresponding
onclick events;

When confirm button is pressed and file is being selected, the top element receives
additional class 'loading'. It is removed when response from server is received.

return: string

fp_js_template_uploadform()   X-Ref
FilePicker JS template for 'Upload file' repository

Content to display when user chooses 'Upload file' repository (will be nested inside
element with class 'fp-content').

Must contain form (enctype="multipart/form-data" method="POST")

The elements with the following classnames must be present:
'fp-file', 'fp-saveas', 'fp-setauthor', 'fp-setlicense'. Inside each of them must have
one input element (or select in case of fp-setlicense). They may also have labels.

Element with class 'fp-upload-btn' will hold onclick event for uploading the file;

Please note that some fields may be hidden using CSS if this is part of quickupload form

return: string

fp_js_template_loading()   X-Ref
FilePicker JS template to display during loading process (inside element with class 'fp-content').

return: string

fp_js_template_error()   X-Ref
FilePicker JS template for error (inside element with class 'fp-content').

must have element with class 'fp-error', its content will be replaced with error text
and the error code will be assigned as additional class to this element
used errors: invalidjson, nofilesavailable, norepositoriesavailable

return: string

fp_js_template_message()   X-Ref
FilePicker JS template for error/info message displayed as a separate popup window.

Must be wrapped in one element, CSS for this element must define
width and height of the window. It will be assigned with an additional class 'fp-msg-error'
or 'fp-msg-info' depending on message type;

content of element with class 'fp-msg-text' will be replaced with error/info text;

element with class 'fp-msg-butok' will hold onclick event

return: string

fp_js_template_processexistingfile()   X-Ref
FilePicker JS template for popup dialogue window asking for action when file with the same name already exists.

Must have one top element, CSS for this element must define width and height of the window;

content of element with class 'fp-dlg-text' will be replaced with dialog text;
elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename',
'fp-dlg-butoverwriteall', 'fp-dlg-butrenameall' and 'fp-dlg-butcancel' will
hold onclick events;

content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
(Note that it may have long text)

return: string

fp_js_template_processexistingfilemultiple()   X-Ref
FilePicker JS template for popup dialogue window asking for action when file with the same name already exists (multiple-file version).

Must have one top element, CSS for this element must define width and height of the window;

content of element with class 'fp-dlg-text' will be replaced with dialog text;
elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename' and 'fp-dlg-butcancel' will
hold onclick events;

content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
(Note that it may have long text)

return: string

fp_js_template_loginform()   X-Ref
FilePicker JS template for repository login form including templates for each element type

Must contain one <form> element with templates for different input types inside:
Elements with classes 'fp-login-popup', 'fp-login-textarea', 'fp-login-select' and
'fp-login-input' are templates for displaying respective login form elements. Inside
there must be exactly one element with type <button>, <textarea>, <select> or <input>
(i.e. fp-login-popup should have <button>, fp-login-textarea should have <textarea>, etc.);
They may also contain the <label> element and it's content will be substituted with
label;

You can also define elements with classes 'fp-login-checkbox', 'fp-login-text'
but if they are not found, 'fp-login-input' will be used;

Element with class 'fp-login-radiogroup' will be used for group of radio inputs. Inside
it should hava a template for one radio input (with class 'fp-login-radio');

Element with class 'fp-login-submit' will hold on click mouse event (form submission). It
will be removed if at least one popup element is present;

return: string

filepicker_js_templates()   X-Ref
Returns all FilePicker JavaScript templates as an array.

return: array

repository_default_searchform()   X-Ref
Returns HTML for default repository searchform to be passed to Filepicker

This will be used as contents for search form defined in generallayout template
(form with id {TOOLSEARCHID}).
Default contents is one text input field with name="s"

Class: files_tree_viewer  - X-Ref

Data structure representing a general moodle file tree viewer

__construct(file_info $file_info, array $options = null)   X-Ref
Constructor of moodle_file_tree_viewer class

param: file_info $file_info
param: array $options



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1