function theme_cmis_browser_browse_children in CMIS API 7.2
Same name and namespace in other branches
- 6.4 cmis_browser/cmis_browser.theme.inc \theme_cmis_browser_browse_children()
- 6.2 cmis_browser/cmis_browser.theme.inc \theme_cmis_browser_browse_children()
- 6.3 cmis_browser/cmis_browser.theme.inc \theme_cmis_browser_browse_children()
- 7 cmis_browser/cmis_browser.theme.inc \theme_cmis_browser_browse_children()
Custom theme for cmis_browser_browse action
Parameters
$children:
3 theme calls to theme_cmis_browser_browse_children()
- cmis_browser_preprocess_cmis_browser_popup in cmis_browser/
cmis_browser.theme.inc - theme_cmis_browser in cmis_browser/
cmis_browser.theme.inc - theme_cmis_query_results in cmis_query/
cmis_query.module - Theme function for CMIS query search results
File
- cmis_browser/
cmis_browser.theme.inc, line 35
Code
function theme_cmis_browser_browse_children($variables) {
$header = array(
t('name'),
t('type'),
t('size'),
t('author'),
t('last modified'),
'',
);
$rows = array();
$folder_img = theme('image', array(
'path' => drupal_get_path('module', 'cmis_browser') . '/images/space.gif',
));
$document_img = theme('image', array(
'path' => drupal_get_path('module', 'cmis_browser') . '/images/file.png',
));
foreach ($variables['context'] as $child) {
$author = $child->properties['cmis:createdBy'];
$updated = date_format(date_create($child->properties['cmis:lastModificationDate']), 'n/j/Y g:i A');
$actions = array();
//print_r($child->properties);
if (!empty($_GET['type']) && $_GET['type'] == 'popup') {
if ($_GET['caller'] == 'settings') {
if (!empty($child->properties['cmis:path'])) {
$actions = array(
l('Choose', $child->properties['cmis:path'], array(
'attributes' => array(
'class' => 'cmis-field-insert',
'id' => $child->id,
'name' => $child->properties['cmis:name'],
),
)),
);
}
}
else {
if (empty($child->properties['cmis:path'])) {
$actions = array(
l('Choose', '', array(
'attributes' => array(
'class' => 'cmis-field-insert',
'id' => $child->id,
'name' => $child->properties['cmis:name'],
),
)),
);
}
}
}
else {
$actions = array(
l(t('properties'), 'cmis/properties', array(
'attributes' => array(
'class' => 'action properties',
),
'query' => array(
'id' => $child->id,
),
)),
l(t('delete'), 'cmis/delete', array(
'query' => array(
'id' => $child->id,
'return_url' => $_GET['q'],
),
)),
);
}
switch ($child->properties['cmis:baseTypeId']) {
case 'cmis:folder':
$icon = $folder_img;
if (!empty($_GET['type']) && $_GET['type'] == 'popup') {
$link = l($child->properties['cmis:name'], 'cmis/browser' . $child->properties['cmis:path'], array(
'query' => array(
'type' => 'popup',
'caller' => $_GET['caller'],
),
));
}
else {
$link = l($child->properties['cmis:name'], 'cmis/browser' . $child->properties['cmis:path']);
}
$mimetype = 'Space';
$size = '';
break;
default:
$icon = $document_img;
if (!empty($_GET['type']) && $_GET['type'] == 'popup') {
$link = l($child->properties['cmis:name'], 'cmis/browser', array(
'query' => array(
'id' => $child->id,
'type' => 'popup',
'caller' => $_GET['caller'],
),
));
}
else {
$link = l($child->properties['cmis:name'], 'cmis/browser', array(
'query' => array(
'id' => $child->id,
),
));
}
$mimetype = $child->properties['cmis:contentStreamMimeType'];
$size = number_format($child->properties['cmis:contentStreamLength'] / 1000, 2, '.', ',') . ' K';
}
$rows[] = array(
$icon . ' ' . $link,
$mimetype,
$size,
$author,
$updated,
theme('item_list', array(
'items' => $actions,
'title' => NULL,
'type' => 'ul',
'attributes' => array(
'class' => 'actions',
),
)),
);
}
/*
drupal_add_js('
$(document).ready(function() {
$("A.action.properties").each(function() {
$(this).click(function() {
$(this).parents("LI:first").toggleClass("expanded").toggleClass("collapsed");
if ($(this).parents("TR:first").next().filter("TR.details").toggle().length == 0) {
$("<td colspan=\"6\"><span class=\"load_indicator\">'. t('Loading'). '...</span></td>")
.load(this.href+"&no_layout")
.insertAfter($(this).parents("TR:first"))
.wrapAll("<tr class=\"details\"></tr>")
.before("<td></td>");
}
return false;
}).parents("LI:first").toggleClass("collapsed");
});
});', 'inline');
*/
return theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'class' => array(
'cmis_browser_browse_children',
),
),
));
}