Commit dd5c442d authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

partial commit

parent bdd8caa1
......@@ -201,6 +201,7 @@ function template_render($template, $mode, $data=array()) {
$td = $template['cacheddata'];
}
$droplist = array();
$html = '';
foreach ($td as $t) {
......@@ -209,15 +210,68 @@ function template_render($template, $mode, $data=array()) {
}
else {
if ($mode == TEMPLATE_RENDER_READONLY) {
$html .= '<pre>' . print_r($t, true) . '</pre>';
$html .= 'READONLY';
}
else {
$html .= 'EDITBLOCK HERE';
$t = $t['data'];
if ( isset($t['format']) && $t['format'] == 'label' ) {
$html .= '<input type="hidden" id=>';
}
else {
log_debug($t);
$classes = array('block');
#if ( $t['format'] == '
$droplist[$t['id']] = array('render_full');
// build opening div tag
if (isset($t['width']) && isset($t['height'])) {
$html .= '<div style="width: ' . $t['width'] . 'px;height: ' . $t['height'] . 'px;"';
}
else {
$html .= '<div';
}
$html .= ' id="' . $t['id'] . '"';
$html .= ' class="' . join(' ',$classes) . '"';
$html .= '>';
$html .= '<i>' . get_string('empty_block', 'view') . '</i>';
$html .= '</div>';
}
}
}
}
return $html;
$droplist = json_encode($droplist);
$spinner_url = json_encode(theme_get_image_path('loading.gif'));
$wwwroot = get_config('wwwroot');
$javascript = <<<EOF
<script type="text/javascript">
var droplist = $droplist;
function blockdrop(element, target) {
replaceChildNodes(target, IMG({ src: {$spinner_url} }));
var d = loadJSONDoc({$wwwroot});
}
addLoadEvent(function () {
for ( id in droplist ) {
new Droppable(id, {
accept: droplist[id],
ondrop: blockdrop,
hoverclass: 'block_targetted',
activeclass: 'block_potential'
});
}
});
</script>
EOF;
return $javascript . $html;
}
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment