function renderUI($prefix = false) { $out = ''; $out .= sprintf('<input type="text" value="%s" name="%s", size="64">', $this->getHtmlSafe(), $this->getName()); require_once ROOT . '/class/url.class.php'; $url = new url(); $url->set('class', 'file'); $url->set('mode', 'field'); $url->set('field', $this->getName()); $out .= ' <a class="action_button" href="' . $url->render('browser.php') . '" target="_blank" onClick="popup(\'' . $url->render('browser.php') . '\');return false">' . translate('browse_button') . '</a>'; if ($filesystem = $this->getFilesystem()) { $out .= '<div>'; $out .= '<img src="' . $filesystem->getIcon(50) . '"/> '; $out .= '</div>'; } return $out; }
function render() { $out = ''; if ($this->node->getChildren(true)) { foreach ($this->node->getChildren(true) as $child) { $content = $child->getContent(); $content->load(); $url = new url(); $url->set('node_id', $child->getId()); $out .= '<a href="' . $url->render() . '">' . $content->getTitle() . '</a> <br/>'; } return $out; } else { return false; } }
function render() { $out = ''; if ($siblings = $this->node->getSibling(true)) { foreach ($siblings as $child) { $content = $child->getContent(); if ($content->isUsedIn('navigation')) { $content->load(); $url = new url(); $url->set('node_id', $child->getId()); $out .= '<a href="' . $url->render() . '">' . $content->getTitle() . '</a> <br/>'; } } return $out; } else { return false; } }
function getMainMenu() { $out = ''; global $thinkedit; $node = $thinkedit->newNode(); $node->loadRootNode(); if ($node->getChildren()) { foreach ($node->getChildren() as $child) { $content = $child->getContent(); $content->load(); $url = new url(); $url->set('node_id', $child->getId()); $out[] = '<a href="' . $url->render() . '">' . $content->getTitle() . '</a>'; } return $out; } else { return false; } }
function te_admin_toolbox() { global $thinkedit; if ($thinkedit->user->isAdmin()) { $out = ''; // todo move style sheet somewhere, but this one is common to all designs, and designs author can what they want $out .= ' <style> .admin_toolbox { position: absolute; position: fixed; top: 1em; right: 1em; width: 8em; background-color : white; padding: 1em; } .admin_toolbox_button { background-color : #0080ff; /*margin: 5px;*/ padding: 5px; display: block; text-decoration: none; color: white; } </style> '; $out .= '<div class="admin_toolbox">'; $url = new url(); $url->keep('node_id'); $url->set('refresh', 1); $out .= '<br/>'; $out .= '<a href="' . $url->render() . '" class="admin_toolbox_button">' . te_translate('refresh') . '</a>'; $url = new url(); $url->keep('node_id'); $url->set('clear_cache', 1); $out .= '<br/>'; $out .= '<a href="' . $url->render() . '" class="admin_toolbox_button">' . te_translate('clear_cache') . '</a>'; $url = new url(); $url->keep('node_id'); $out .= '<br/>'; $out .= '<a href="' . $url->render('./edit/structure.php') . '" target="_blank" class="admin_toolbox_button">' . te_translate('edit') . '</a>'; $out .= '</div>'; $out .= 'Total Queries : ' . $thinkedit->db->getTotalQueries(); $out .= '<br/>'; $out .= 'Total time : ' . $thinkedit->timer->render(); global $db_debug; if (isset($db_debug)) { if (!$thinkedit->isInProduction()) { foreach ($db_debug as $sql) { $out .= "<li>{$sql}</li>"; } } else { $out .= "<li>SQL not shown in production mode</li>"; } } return $out; } else { return false; } }
<div id="sidebar"> <!-- Cover --> <?php if (isset($sidebar_image)) { ?> <div id="cover"> <img src="<?php echo $sidebar_image->getThumbnail(array('w' => 170)); ?> "/> <?php // fabrication lien vers ecard $url = new url(); $url->set('image', $sidebar_image->getPath()); $url->set('template', '/ecards/' . te_get_section_name($node) . '.png'); $ecard_url = $url->render(ROOT_URL . '/plugin/ecards/'); ?> <a onclick="popup(this.href, 'ecard'); return false;" target="_blank" class="<?php echo te_get_section_name($node); ?> _sub" href="<?php echo $ecard_url; ?> "> <img src="<?php echo te_design(); ?> /sources/fleche.gif">
foreach ($allowed_items as $allowed_item) { if ($allowed_item['class'] == 'record') { $table = $thinkedit->newTable($allowed_item['type']); $item['title'] = $table->getTitle(); $url = new url(); $url->set('mode', 'new_node'); $url->set('node_id', $current_node->getId()); $url->addObject($table); $item['action'] = $url->render('edit.php'); $out['allowed_items'][] = $item; } } } /******************** Global paste ****************************/ /* $url = new url(); $url->set('source_node', $current_node->getId()); $url->set('action', 'cut'); $out['clipboard']['cut_link'] = $url->render('clipboard.php'); */ if ($session->get('clipboard_source_node')) { $url = new url(); $url->set('target_node', $current_node->getId()); $url->set('action', 'paste'); $out['clipboard']['paste_link'] = $url->render('clipboard.php'); } debug($out, 'OUT'); // include template : include 'header.template.php'; include 'structure.template.php'; include 'footer.template.php';
$relation->unrelate($source, $target); } $relations = $relation->getRelations($source); if ($relations) { foreach ($relations as $relation_object) { $relation_object->load(); $item['title'] = te_short($relation_object->getTitle(), 50); $item['icon'] = $relation_object->getIcon(); $url->set('action', 'unrelate'); $url->addObject($relation_object, 'target_'); $item['remove_url'] = $url->render(); $out['relation']['data'][] = $item; } } $url = new url(); $url->set('mode', 'relation'); $out['browse_url'] = $url->render('browser.php'); debug($out, 'OUT'); debug($relations); $out['title'] = 'Relations'; // include template file include 'relation.template.php'; die; //$debug=true; // check/validate if we have enough input // check module name // todo : need validation (from config file)! if (!$_REQUEST['module']) { error(translate('please_choose_a_module')); } $module = $_REQUEST['module'];
$url = new url(); $url->keep('path'); $url->set('file_to_delete', $child->getPath()); $url->set('action', 'delete'); $file['delete_url'] = $url->render(); $out['files'][] = $file; } } // handle add folder // handle remove folder // handle sync with folder // define action buttons urls $url = new url(); $url->keep('path'); $url->set('action', 'add_folder'); $out['add_folder_url'] = $url->render(); $url = new url(); $url->keep('path'); $url->set('action', 'upload_file'); $out['upload_file_url'] = $url->render(); // add breadcrumb $url = new url(); $out['breadcrumb'][1]['title'] = translate('filemanager_title'); $out['breadcrumb'][1]['url'] = $url->render(); debug($out, 'OUT'); //print_a($out); // include template : include 'header.template.php'; include 'file_manager.template.php'; //include('list.template.php'); include 'footer.template.php';
$url->set('source_node', $node_item->getId()); $url->set('action', 'cut'); $node_info['clipboard']['cut_link'] = $url->render('clipboard.php'); $url = new url(); $url->set('source_node', $node_item->getId()); $url->set('action', 'copy'); $node_info['clipboard']['copy_link'] = $url->render('clipboard.php'); $url = new url(); $url->set('target_node', $node_item->getId()); $url->set('action', 'paste'); $node_info['clipboard']['paste_link'] = $url->render('clipboard.php'); /******* locales links ****/ if ($content->isMultilingual()) { $locales = $thinkedit->configuration->getLocaleList(); foreach ($locales as $locale) { $url = new url(); $url->set('node_id', $node_item->getId()); $content->setLocale($locale); $url->addObject($content); $url->set('mode', 'edit_node'); $node_info['locale'][$locale]['edit_url'] = $url->render('edit.php'); $node_info['locale'][$locale]['locale'] = $locale; } } /******* append this node info to out nodes list ****/ $out['nodes'][] = $node_info; $i++; } } require 'node.template.php'; //print_r ($out);
// if we are in root if ($we_are_root) { $nodes[] = $current_node; } else { if ($current_node->hasChildren()) { $nodes = $current_node->getChildren(); } } if (isset($nodes) && is_array($nodes)) { $i = 0; foreach ($nodes as $node_item) { $content = $node_item->getContent(); $content->load(); $item['title'] = te_short($content->getTitle(), 40); $item['icon'] = $content->getIcon(); $url = new url(); $url->keep('class'); $url->keep('mode'); $url->set('node_id', $node_item->getId()); $item['visit_url'] = $url->render(); if ($mode == 'relation') { $url->addObject($node_item, 'target_'); $url->set('action', 'relate'); $item['url'] = $url->render('relation.php'); } $out['items'][] = $item; } } } debug($out, 'OUT'); include 'browser.template.php';
function te_admin_toolbox() { global $te_admin_toolbox_written; if (!isset($te_admin_toolbox_written)) { $te_admin_toolbox_written = true; global $thinkedit; if ($thinkedit->user->isAdmin()) { $out = ''; // add jquery code $out = te_jquery(); // todo move style sheet somewhere, but this one is common to all designs, and designs author can do what they want with it // done, file is in /edit/toolbar.css $out .= '<link type="text/css" href="' . ROOT_URL . '/edit/ressource/css/toolbar.css" rel="stylesheet" media="screen"/>'; $out .= '<div class="te_tools">'; $out .= '<div class="te_toolbar">'; $out .= '<div class="te_toolbar_logo">'; $out .= '<b>ThinkEDIT</b>'; // todo add version number automagically $out .= '</div>'; // logout $url = $thinkedit->newUrl(); $out .= '<a href="' . ROOT_URL . '/edit/logout.php" class="te_toolbar_button">' . translate('logout') . '</a>'; // refresh page link $url = new url(); $url->keep('node_id'); $url->set('refresh', 1); $out .= '<a href="' . $url->render() . '" class="te_toolbar_button">' . translate('refresh_page') . '</a>'; // refresh site link $url = new url(); $url->keep('node_id'); $url->set('clear_cache', 1); $out .= '<a href="' . $url->render() . '" class="te_toolbar_button">' . translate('refresh_site') . '</a>'; // edit page link $url = new url(); $url->keep('node_id'); $out .= '<a href="' . $url->render('./edit/structure.php') . '" target="_blank" class="te_toolbar_button">' . translate('edit') . '</a>'; // show hide profiling $out .= '<a class="te_toolbar_button" onclick="$(\'.te_profiling\').toggle()">' . translate('toggle_profiling') . '</a>'; // show hide errors if (isset($thinkedit->errors)) { $out .= '<a class="te_toolbar_button te_toolbar_error_button" onclick="$(\'.te_error_log\').toggle()">' . translate('toggle_errors') . '</a>'; } $out .= '</div>'; // end of toolbar $out .= '<div class="te_profiling te_console" style="display: none">'; $out .= 'Total Queries : ' . $thinkedit->db->getTotalQueries(); $out .= '<br/>'; $out .= 'Total time : ' . $thinkedit->timer->render(); global $db_debug; if (isset($db_debug)) { if (!$thinkedit->isInProduction()) { foreach ($db_debug as $sql) { $out .= "<li>{$sql}</li>"; } } else { $out .= "<li>SQL not shown in production mode</li>"; } } $out .= '</div>'; // end of profiling // include error log $out .= te_error_log(); $out .= '</div>'; // end of tools return $out; } else { return false; } } }
$content = $current_node->getContent(); $content->load(); $out['structure_breadcrumb'][$i]['title'] = $content->getTitle(); $url = new url(); $url->set('node_id', $current_node->getId()); //$url->addObject($current_node, 'current_'); $out['structure_breadcrumb'][$i]['url'] = $url->render(); /************************ Allowed items ************************/ $allowed_items = $current_node->getAllowedItems(); if (is_array($allowed_items)) { foreach ($allowed_items as $allowed_item) { if ($allowed_item['class'] == 'record') { $table = $thinkedit->newTable($allowed_item['type']); $item['title'] = $table->getTitle(); $url = new url(); $url->set('mode', 'new_node'); $url->set('node_id', $current_node->getId()); $url->addObject($table); $item['action'] = $url->render('edit.php'); $out['allowed_items'][] = $item; } } } /* // first allow anything : $config_tool = $thinkedit->newConfig(); $tables = $config_tool->getTableList(); // generating the table list from the config array foreach($tables as $table_id)
} $i++; } // ----------------------------- //handle pagination // ----------------------------- if ($record_count > 25) { // find number of pages $number_of_pages = intval($record_count / 25) + 1; for ($i = 0; $i < $number_of_pages; $i++) { $out['pagination'][$i]['title'] = $i + 1; $url = new url(); $url->keep('class'); $url->keep('type'); $url->keep('sort'); $url->set('page', $i); $out['pagination'][$i]['url'] = $url->render(); $url = new url(); if ($url->get('page') == $i) { $out['pagination'][$i]['current'] = true; } } //echo $number_of_pages; // create pages array } /* echo '<pre>'; print_r($out['pagination']); */ // ----------------------------- //handle global actions
} } /****************** Relations ******************/ $url = new url(); $url->addObject($record, 'source_'); $out['relation']['url'] = $url->render('relation.php'); // clean url $url = new url(); // generates the breadcrumb data //$out['breadcrumb'][0]['title'] = translate('home_link'); //$out['breadcrumb'][0]['url'] = 'main.php'; // if we are from a node form if ($url->get('mode') == 'edit_node' or $url->get('mode') == 'new_node') { $out['breadcrumb'][1]['title'] = translate('structure'); if ($parent = $node->getParent()) { $url->set('node_id', $parent->getId()); } else { $url->set('node_id', $node->getId()); // $url->keep('node_id'); } $out['breadcrumb'][1]['url'] = $url->render('structure.php'); } else { $out['breadcrumb'][1]['title'] = $table_object->getTitle(); $out['breadcrumb'][1]['url'] = $url->linkTo($table_object, 'list.php'); } $out['breadcrumb'][2]['title'] = translate('editing_link'); $out['breadcrumb'][2]['url'] = ''; // describes the banner : $out['banner']['needed'] = true; $out['banner']['title'] = $table_object->getTitle(); $out['banner']['message'] = $table_object->getHelp();