WebDAV CGI - The Simple View Documentation
Content of this topic:
Back to the WebDAV Documentation page.
- About: The Simple View
- Template Hooks: Add Your Own Sidebar Entries
- Template Overlay: Modify Templates
- Templates: The Features
- Styles: Modify CSS Styles
- Extensions
- Troubleshooting
Back to the WebDAV Documentation page.
About: The Simple View
This is the new default view for the WebDAV CGI web interface. The Simple view uses jQuery and a lot of jQuery plugins for a more convenience user interface. It supports some new interesting features:- Drag&Drop support: drag and drop files from a window manager to the web interface or files and folders inside the file list.
- AJAX based file actions and folder navigation.
- Simplifies customization of menus and templates.
- Fast client site file list sorting.
- Extension support
Template Hooks: Add Your Own Sidebar Entries
You can add your own menu entries in the sidebar menu if you create some custom template files. Look for include statements in the page template (templates/simple/page.tmpl
), e.g.: $INCLUDE(apps)
- Create a custom template
templates/simple/apps.custom.tmpl
to add a new menu entry - and add a list item to the custom template (see
page.tmpl
for examples):<li accesskey="1" tabindex="0" class="home-button action changeuri" data-uri="/afs/.cms.hu-berlin.de/user/$eval@substr($REMOTE_USER,0,1)@/$USER/"> <div class="label">Home</div> </li>
templates/simple/[hook name].custom.tmpl
):
htmlhead
- included in the HTML head tag (for your own script or CSS tags)header
- included in the page headerapps
- included after the Files/Folders menu itemnav
- included between application and preferences menupref
- included before views option menu itemshelp
- included before about menu item
Example 1: Add a home button
- Create a custom template:
vi templates/simple/apps.custom.tmpl
- Add HTML code to the new template (change href value to your preferred URL):
<li accesskey="1" tabindex="0" class="home-button action changeuri" data-uri="/.cms.hu-berlin.de/user/$eval@substr($REMOTE_USER,0,1)@/$USER/"> <div class="label">Home</div> </li>
Example 2: Add a logout button, a contact button, a external link button, and a help button
- Create a custom template:
vi templates/simple/help.custom.tmpl
- Add HTML code to the new template (change href values to your preferred URLs):
<li class="logout-button" data-href="/logout" role="button" aria-label="$tl(logout)"> <div class="label">$tl(logout)</div> </li> <li class="contact-button" accesskey="9" data-href="mailto:contact@mydomain.org?subject=WebDAV%20CGI" role="button" "aria-label="$(contact)"> <div class="label">$tl(contact)</div> </li> <li class="link-button" data-href="https://google.com/" data-target="_blank" role="button" aria-label="Google"> <div class="label">Google</div> </li> <li class="help-button" accesskey="6" data-target="_blank" data-href="link_to_my_help" role="button" aria-label="$tl(help)"> <div class="label">$tl(help)</div> </li>
Template Overlay: Modify Templates
You should not modify an existing view template to simplify version upgrades of WebDAV CGI. It is possible to overlay an existing template file by adding a custom template file.- Copy the template file, e.g.
cp templates/simple/page.tmpl templates/simple/page.custom.tmpl
- Modify the new template file, e.g.
vi templates/simple/page.custom.tmpl
Styles: Modify CSS Styles
The preferred way to change CSS styles:- Create the custom template
header
:templates/simple/header.custom.tmpl
- Add a style tag to the custom template:
<style></style>
- Add your style changes ...
Templates: The Features
Take a look at the Simple view templates for examples (templates/simple/*.tmpl
).
- Include other templates:
$INCLUDE([template name])
(replace[template name]
with the template name without .custom or .tmpl suffixes) - Functions:
$config([param])
- include the value of the WebDAV CGI configuration parameter$eval[sep][Perl code][sep]
- replaced by the return value of the executed Perl code$cgiparam([param])
- replaced by CGI query parameter values$env([variable])
- replaced by environment variable value$each[sep][hash|array variable][sep][template (file)][sep][filter][sep]
- iterates over the given hash/array elements and renders the template for each element ($v, $k can be used in the template for hash keys and hash values)- ... take a look at the template files for all others.
- Variables:
- ... take a look at the template files for variables or into the
renderTemplate
subroutine of the Renderer module (lib/perl/WebInterface/View/simple/Renderer.pm
)
- ... take a look at the template files for variables or into the
- IF statement:
<!--IF([Perl expression])--> [HTML] <!--ELSE--> [HTML] <!--ENDIF-->
- IF statements inside IF statements:
<!--IF#[level]([Perl expression])--> [HTML] <--ELSE#[level]--> [HTML] <--ENDIF#[level]-->
(replace[level]
by a unique number)
Troubleshooting
- Take a look at your Apache error log.
- Open the Web console and/or the error console of your Web browser.
- Use the W3C® Markup Validation Service to check the HTML output.
- Use the W3C® CSS Validation Service to check your CSS styles.
- Ask the author
© ZE CMS, Humboldt-Universität zu Berlin | Written 2011-2015 by Daniel Rohde