function welcome_render_page_late($args) { global $page_has_object; if (!$args['edit'] || $page_has_object) { return false; } // we only display the information when there are no other pages in the // content directory except the current one load_modules('glue'); $pns = pagenames(array()); $pns = $pns['#data']; if (1 < count($pns)) { return false; } html_add_css(base_url() . 'modules/welcome/welcome-edit.css'); html_add_js(base_url() . 'modules/welcome/welcome.js'); body_append('<div id="welcome-msg">' . nl()); body_append(tab() . '<span id="welcome-first">Welcome to HOTGLUE!</span><br>' . nl()); body_append(tab() . 'Your Content Manipulation System is ready to go!' . nl()); body_append(tab() . '<p>A short intro before you start:<br>' . nl()); body_append(tab() . '¤ To get back to editing mode in the future, add "' . (SHORT_URLS ? '' : '?') . 'edit" to the address in the address bar (i.e.: ' . base_url() . '<b>' . (SHORT_URLS ? '' : '?') . 'edit</b>)<br>' . nl()); body_append(tab() . '¤ In editing mode, you can use single and double click to access the menus.<br>' . nl()); body_append(tab() . '¤ Click the page\'s background once to open a menu that lets you create new objects, upload files and embed videos (YouTube and Vimeo).<br>' . nl()); body_append(tab() . '¤ Double-click to open a menu that allows you to change preferences, show a grid, make new pages and more.<br>' . nl()); body_append(tab() . '¤ Remove "' . (SHORT_URLS ? '' : '?') . 'edit" from the address in the address bar to go to the viewing-only mode of this page.</p>' . nl()); body_append(tab() . '<p>You can find more ideas on how to use HOTGLUE at the <a href="http://hotglue.me/how_basic" target="_blank">"How-to" section of our website</a>!' . nl()); body_append(tab() . '<p>Enjoy!<br>' . nl()); body_append(tab() . '<span id="welcome-light">[This message goes away when you click it]</span></p>' . nl()); body_append('</div>' . nl()); return true; }
function welcome_render_page_late($args) { global $page_has_object; if (!$args['edit'] || $page_has_object) { return false; } // we only display the information when there are no other pages in the // content directory except the current one load_modules('glue'); $pns = pagenames(array()); $pns = $pns['#data']; if (1 < count($pns)) { return false; } html_add_css(base_url() . 'modules/welcome/welcome-edit.css'); html_add_js(base_url() . 'modules/welcome/welcome.js'); body_append('<div id="welcome-msg">' . nl()); body_append(tab() . '<span id="welcome-first"><img style="float:left; margin:5px 10px 0 5px" src="' . base_url() . 'modules/welcome/gun32.gif">Welcome to HOTGLUE!</span><br>' . nl()); body_append(tab() . 'Your Content Manipulation System is ready to go!' . nl()); body_append(tab() . '<p>A short intro before you start:</p>' . nl()); body_append(tab() . '<span id="cont"><span id="text"><b>1.</b> Right now you are in <u>editing mode</u>. You can use single and double click to access the menus - they will appear next to the mouse pointer.</span>' . nl()); body_append(tab() . '<span id="text"><b>2.</b> Click on the canvas (white background of the page) to open a menu which will let you create new objects, upload files and embed YouTube and Vimeo videos! Once you made an object click on it to activate its contextual menu.</span>' . nl()); body_append(tab() . '<span id="text"><b>3.</b> Double-click on the canvas will give you a menu of options to change preferences, show a grid, make new pages, set background picture and more!</span>' . nl()); body_append(tab() . '<span id="text"><b>4.</b> Remove "' . (SHORT_URLS ? '' : '?') . 'edit" from the address of the page (the URL) to see the "view-only" version. That\'s how your page will look to everyone else!</span>' . nl()); body_append(tab() . '<span id="text"><b>5.</b> To get back to editing mode add "' . (SHORT_URLS ? '' : '?') . 'edit" to the URL of the page.<br>(for example: ' . base_url() . '<b>' . (SHORT_URLS ? '' : '?') . 'edit</b>)</span></span>' . nl()); body_append(tab() . '<p>We recommend you to use <a href="http://firefox.com" target="_blank">Mozilla Firefox</a> browser when editing in HOTGLUE. Firefox is a very reliable and modern web-browser, it is our favorite!' . nl()); body_append(tab() . '<p>You can find more information on how to work with HOTGLUE on our <a href="http://hotglue.me" target="_blank">web-site</a>. Make sure to check out "<a href="http://hotglue.me/what" target="_blank">What is HOTGLUE?</a>" and "<a href="http://hotglue.me/how" target="_blank">How to HOTGLUE?</a>" pages!' . nl()); body_append(tab() . '<p>Enjoy! <span id="welcome-light">[click this message to make it go away]</span></p>' . nl()); body_append('</div>' . nl()); return true; }
function page_browser_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/page_browser/page_browser-edit.min.js'); } else { html_add_js(base_url() . 'modules/page_browser/page_browser-edit.js'); } } }
/** * controller that shows a textarea for editing either a page's or the global * user-defined css file */ function controller_user_css_stylesheet($args) { if ($args[0][1] == 'stylesheet') { // changing page stylesheet $page = $args[0][0]; page_canonical($page); if (!page_exists($page)) { hotglue_error(404); } } else { // changing global stylesheet $page = false; } default_html(true); html_add_js_var('$.glue.page', $page); html_add_css(base_url() . 'modules/user_css/user_css.css'); if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/user_css/user_css.min.js'); } else { html_add_js(base_url() . 'modules/user_css/user_css.js'); } $bdy =& body(); elem_attr($bdy, 'id', 'user_css'); if ($page === false) { body_append('<h1>Global stylesheet</h1>' . nl()); // try to load css $css = @file_get_contents(CONTENT_DIR . '/usercss'); if ($css === false) { $css = ''; } } else { body_append('<h1>' . htmlspecialchars($page, ENT_NOQUOTES, 'UTF-8') . ' stylesheet</h1>' . nl()); load_modules('glue'); $obj = load_object(array('name' => $page . '.usercss')); if ($obj['#error']) { $css = ''; } else { $css = $obj['#data']['content']; } } // encoding to html must come before the replacement below $css = htmlspecialchars($css, ENT_NOQUOTES, 'UTF-8'); // replace newline characters by an entity to prevent render_object() // from adding some indentation $css = str_replace("\r\n", ' ', $css); $css = str_replace("\n", ' ', $css); // why not replace tabs as well why we are at it $css = str_replace("\t", '	', $css); body_append('<textarea id="user_css_text" placeholder="enter css code here">' . $css . '</textarea>' . nl()); body_append('<br>' . nl()); body_append('<input id="user_css_save" type="button" value="save">' . nl()); echo html_finalize(); }
function lock_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/lock/lock.min.js'); } else { html_add_js(base_url() . 'modules/lock/lock.js'); } return true; } else { return false; } }
function transform_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/transform/transform.min.js'); } else { html_add_js(base_url() . 'modules/transform/transform.js'); } // html_add_css(base_url().'modules/transform/transform.css'); // html_add_js(base_url().'modules/transform/jquery.transform-0.9.3.min.js'); return true; } else { return false; } }
function iframe_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/iframe/iframe-edit.min.js'); } else { html_add_js(base_url() . 'modules/iframe/iframe-edit.js'); } html_add_css(base_url() . 'modules/iframe/iframe-edit.css'); } }
?> <!DOCTYPE html> <html> <head> <title>Photo Viewer</title> <?php js_add_jquery(); // adding jquery library js_add_jquery_ui(); // adding jquery ui library html_add_link_css(SLIDESHOW_PATH . DS . 'css/supersized.css', 'media="screen"'); html_add_link_css(SLIDESHOW_PATH . DS . 'theme/supersized.shutter.css', 'media="screen"'); html_add_js('https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'); html_add_js(SLIDESHOW_PATH . DS . 'js/jquery.easing.min.js'); html_add_js(SLIDESHOW_PATH . DS . 'js/supersized.3.2.7.min.js'); html_add_js(SLIDESHOW_PATH . DS . 'theme/supersized.shutter.min.js'); $cache_path = PLATFORM_SANDBOX_SYSTEM_CACHES_PATH . DS . 'photo'; $photo_files = find_filetype('jpg', PLATFORM_SANDBOX_WORKSPACE_PATH); $c = 0; ?> <script type="text/javascript"> jQuery(function($){ $.supersized({ // Functionality slide_interval : 3000, // Length between transitions transition : 3, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left transition_speed : 700, // Speed of transition
function user_code_render_page_early($args) { // include the global usercode if it exists foreach (array('head', 'body') as $x) { if (@is_file(CONTENT_DIR . '/user' . $x)) { $func = 'html_add_' . $x . '_inline'; $func(@file_get_contents(CONTENT_DIR . '/user' . $x), 5); } } if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/user_code/user_code-edit.min.js'); } else { html_add_js(base_url() . 'modules/user_code/user_code-edit.js'); } } }
function page_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/page/page-edit.min.js'); } else { html_add_js(base_url() . 'modules/page/page-edit.js'); } html_add_css(base_url() . 'modules/page/page-edit.css'); // set default grid $grid = page_get_grid(array()); $grid = $grid['#data']; html_add_js_var('$.glue.conf.page.default_grid_x', $grid['x']); html_add_js_var('$.glue.conf.page.default_grid_y', $grid['y']); // set guides $guide = expl(' ', PAGE_GUIDES_X); for ($i = 0; $i < count($guide); $i++) { $guide[$i] = intval(trim($guide[$i])); } html_add_js_var('$.glue.conf.page.guides_x', $guide); $guide = expl(' ', PAGE_GUIDES_Y); for ($i = 0; $i < count($guide); $i++) { $guide[$i] = intval(trim($guide[$i])); } html_add_js_var('$.glue.conf.page.guides_y', $guide); } // set the html title to the page name by default html_title(page_short($args['page'])); }
function object_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/object/object-edit.min.js'); } else { html_add_js(base_url() . 'modules/object/object-edit.js'); } // add default colors html_add_js_var('$.glue.conf.object.default_colors', expl(' ', OBJECT_DEFAULT_COLORS)); } }
function text_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/text/text-edit.min.js'); } else { html_add_js(base_url() . 'modules/text/text-edit.js'); } html_add_css(base_url() . 'modules/text/text-edit.css'); html_add_js_var('$.glue.conf.text.auto_br', TEXT_AUTO_BR); if (TEXT_USE_WOFF_FONTS) { $woff_fonts = _woff_fonts(); foreach ($woff_fonts as $font => $styles) { _include_woff_font($font); // TODO (later): check css encoding $rule = '.glue-font-woff-' . $font . ' {' . nl(); // we use single quotes as they don't clash with inline styles $rule .= tab() . 'font-family: \'' . $font . '\';' . nl(); $rule .= '}'; html_add_css_inline($rule, 6); } } } }
/** * show a site to edit pages */ function controller_edit($args) { handle_updates(); // this is a good spot to log the server's php version as well log_msg('debug', 'controller_edit: running on php version ' . phpversion()); // most of these checks are only necessary if the client calls // page/edit directly page_canonical($args[0][0]); $page = $args[0][0]; if (!page_exists($page)) { log_msg('debug', 'controller_edit: page ' . quot($page) . ' does not exist, invoking controller_create_page'); controller_create_page($args); return; } // create page on the fly load_modules('glue'); default_html(true); html_add_js_var('$.glue.page', $page); html_add_css(base_url() . 'css/farbtastic.css', 2); html_add_css(base_url() . 'css/edit.css', 5); if (USE_MIN_FILES) { html_add_js(base_url() . 'js/jquery-ui-1.8.6.custom.min.js', 2); } else { html_add_js(base_url() . 'js/jquery-ui-1.8.6.custom.js', 2); } if (USE_MIN_FILES) { html_add_js(base_url() . 'js/farbtastic.min.js', 2); } else { html_add_js(base_url() . 'js/farbtastic.js', 2); } if (USE_MIN_FILES) { html_add_js(base_url() . 'js/jquery.xcolor-1.2.1.min.js', 2); } else { html_add_js(base_url() . 'js/jquery.xcolor-1.2.1.js', 2); } if (USE_MIN_FILES) { html_add_js(base_url() . 'js/edit.min.js', 4); } else { html_add_js(base_url() . 'js/edit.js', 4); } render_page(array('page' => $page, 'edit' => true)); echo html_finalize(); log_msg('debug', 'controller_edit: invoking check_auto_snapshot'); check_auto_snapshot(array('page' => $page)); }
/** * implements render_page_early */ function image_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/image/image-edit.min.js'); } else { html_add_js(base_url() . 'modules/image/image-edit.js'); } if (!_gd_available()) { html_add_js_var('$.glue.conf.image.resizing', false); log_msg('debug', 'image: disabling image resizing as gd is not available'); } else { html_add_js_var('$.glue.conf.image.resizing', IMAGE_RESIZING); } html_add_js_var('$.glue.conf.image.upload_resize_larger', IMAGE_UPLOAD_RESIZE_LARGER); html_add_js_var('$.glue.conf.image.upload_resize_to', IMAGE_UPLOAD_RESIZE_TO); } }
/** * setup a default html page * * see html.inc.php. * @param bool $add_glue true for adding the glue code */ function default_html($add_glue) { html_title(SITE_NAME); $favicon = FAVICON; if (!empty($favicon)) { if (is_url($favicon)) { html_favicon($favicon); } else { html_favicon(base_url() . $favicon); } } if (USE_MIN_FILES) { html_add_css(base_url() . 'css/reset.min.css', 1); } else { html_add_css(base_url() . 'css/reset.css', 1); } // 2 can be used for third-party components html_add_css(base_url() . 'css/main.css', 3); if ($add_glue) { html_add_css(base_url() . 'css/glue.css', 4); } if ($add_glue) { $jquery = JQUERY; if (is_url($jquery)) { html_add_js($jquery, 1); } else { html_add_js(base_url() . $jquery, 1); } // 2 can be used for third-party components if (USE_MIN_FILES) { html_add_js(base_url() . 'js/glue.min.js', 3); } else { html_add_js(base_url() . 'js/glue.js', 3); } html_add_js_var('$.glue.base_url', base_url()); html_add_js_var('$.glue.conf.show_frontend_errors', SHOW_FRONTEND_ERRORS); html_add_js_var('$.glue.version', glue_version()); } }
function download_render_page_early($args) { if ($args['edit']) { if (USE_MIN_FILES) { html_add_js(base_url() . 'modules/download/download-edit.min.js'); } else { html_add_js(base_url() . 'modules/download/download-edit.js'); } html_add_css(base_url() . 'modules/download/download.css'); } }