* field: '#images', * preview: '#preview' * }); * * This helper stores the list of images in the following format * in the input field, so you can easily split them into an array: * * /files/file1.jpg|/files/file2.jpg|/files/file3.png * * Options: * * - field: The selector of an input field to update with the list. * - preview: The selector of an element to use to contain the list preview. */ echo $this->run ('filemanager/util/browser'); $page->add_style ('/apps/filemanager/css/multi-image.css'); $page->add_script ( sprintf ( '<script>var filemanager_path = "%s";</script>', conf('Paths','filemanager_path') ) ); $page->add_script ('/js/jquery-ui/jquery-ui.min.js'); $page->add_script ('/apps/filemanager/js/jquery.multi-image.js'); $page->add_script (I18n::export ( 'Click to remove, drag to re-order', 'Browse images' ));
* * $.filebrowser ({ * allowed: ['jpg', 'jpeg', 'png', 'gif'], * set_value: '#field-id', * title: 'Choose an image', * thumbs: true, * callback: function (file) { * console.log ('You chose: ' + file); * } * }); * * Options: * * - `allowed` - An array of allowed file extensions. * - `callback` - A function to call with the chosen file link. * - `set_value` - The selector of an input field to update with the * chosen file link. * - `thumbs` - Whether to show thumbnails instead of file names. * Note: also automatically sets allowed list to jpeg, png, and * gif formats so you don't have to set allowed explicitly. * - `title` - A custom title for the dialog window. */ echo $this->run('admin/util/modal'); $page->add_style('/apps/filemanager/css/filebrowser.css'); $page->add_script(sprintf('<script>var filemanager_path = "%s", filemanager_upload = %d;</script>', conf('Paths', 'filemanager_path'), (int) User::require_acl('admin', 'filemanager'))); $page->add_script('/apps/filemanager/js/jquery.filedrop.js'); $page->add_script('/apps/filemanager/js/filemanager.js'); $page->add_script('/apps/filemanager/js/jquery.filebrowser.js'); $page->add_script(sprintf('<script>var filebrowser_max_filesize = %s;</script>', (int) ini_get('upload_max_filesize'))); $page->add_script(I18n::export(array('Choose a file', 'New file', 'Please upload one of the following file types', 'Your browser does not support drag and drop file uploads.', 'Please upload fewer files at a time.', 'The following file is too large to upload', 'Uploading...', 'Select')));
$o->parts = array(); $o->lastpath = ''; foreach ($tmp as $part) { $joined .= $sep . $part; $sep = '/'; $o->parts[$part] = $joined; $o->lastpath = $part; } $page->window_title = __('Files') . '/' . $o->path; } else { $o->path = ''; $o->fullpath = $root; $o->parts = array(); $o->lastpath = ''; $page->window_title = __('Files'); } if ($appconf['General']['aviary_key']) { $page->add_script('https://dme0ih8comzn4.cloudfront.net/imaging/v1/editor.js'); $o->aviary_key = $appconf['General']['aviary_key']; } else { $o->aviary_key = false; } $page->add_style('/apps/filemanager/css/filemanager.css'); $page->add_script(sprintf('<script>var conf_root = "%s";</script>', conf('Paths', 'filemanager_path'))); $page->add_script('/js/jquery-ui/jquery-ui.min.js'); $page->add_script('/js/urlify.js'); $page->add_script('/apps/filemanager/js/jquery.filedrop.js'); $page->add_script('/apps/filemanager/js/jquery.tmpl.beta1.min.js'); $page->add_script('/apps/filemanager/js/jquery.filemanager.js'); $page->add_script(I18n::export('New folder name:', 'Rename:', 'Are you sure you want to delete this file?', 'Are you sure you want to delete this folder and all of its contents?', 'Your browser does not support drag and drop file uploads.', 'Please upload fewer files at a time.', 'The following file is too large to upload')); echo $tpl->render('filemanager/index', $o);
* * {! admin/util/dynamicobjects !} * * ### 2. Use the `$.dynamicobjects()` function to open the dialog window: * * $.dynamicobjects ({ * set_value: '#field-id', * callback: function (embed_code, handler, params, label) { * console.log (embed_code); * console.log (handler); * console.log (params); * console.log (label); * } * }); * * Options: * * - `callback` - A function to call with the resulting embed code. * - `set_value` - The selector of an input field to update with the * resulting embed code. * - `current` - Current embed code, for updating existing values. */ $this->run('admin/util/fontawesome'); $this->run('admin/util/modal'); $this->run('filemanager/util/browser'); $page->add_style('/apps/admin/css/dynamicobjects.css'); $page->add_script('/js/jquery.verify_values.js'); $page->add_script('/js/jquery.quickpager.js'); $page->add_script('/apps/admin/js/jquery.dynamicobjects.js'); $page->add_script(I18n::export('Dynamic Objects', 'Unable to load the dynamic object list. Please try again in a few seconds.', 'Embed', 'Back'));
* ### 2. User the `$.userchooser()` function to open the dialog window: * * $.userchooser ({ * set_id_value: '#field-id', * set_name_value: '#display-name', * callback: function (id, name, email) { * console.log (id); * console.log (name); * console.log (email); * } * }); * * Options: * * - `callback` - A function to call with the user id, name, and email. * - `chosen` - A list of users that shouldn't be selectable. * - `chosen_visible` - Whether to display the disabled chosen users or hide them. * - `set_id_value` - The selector of an input or element to update with the user id. * - `set_name_value` - The selector of an input or element to update with the user name. * - `set_email_value` - The selector of an input or element to update with the user email. * - `set_mailto` - The selector of a link to set the mailto: value for. */ $this->run('admin/util/fontawesome'); $this->run('admin/util/modal'); $page->add_style('/apps/user/css/userchooser.css'); $page->add_script('/js/jquery.quickpager.js'); $page->add_script('/js/jquery.verify_values.js'); $page->add_script('/apps/user/js/jquery.adduser.js'); $page->add_script('/apps/user/js/jquery.userchooser.js'); $page->add_script(I18n::export('Add Member', 'Choose a Member', 'Search', 'Unable to load the member list. Please try again in a few seconds.'));
<?php /** * Outputs the admin toolbar if the user is an admin, * otherwise simply loads jQuery for other scripts that * may rely on it. */ if ($appconf['Scripts']['jquery_source'] === 'local') { $page->add_script('/js/jquery-1.8.3.min.js'); } elseif ($appconf['Scripts']['jquery_source'] === 'google') { $page->add_script('<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>'); } else { $page->add_script('<script src="' . $appconf['Scripts']['jquery_source'] . '"></script>'); } if (User::require_admin() && $page->preview == false) { $page->add_style('/apps/admin/css/jquery.jgrowl.css'); $page->add_style('/apps/admin/css/modal.css'); $page->add_style(Product::toolbar_stylesheet()); $page->add_script("<script>\$(function(){\$.elefant_version='" . ELEFANT_VERSION . "';});</script>\n"); $page->add_script("<script>\$(function(){\$.elefant_updates=" . (int) conf('General', 'check_for_updates') . ";});</script>\n"); $page->add_script('/apps/admin/js/modal.js'); $page->add_script('/apps/admin/js/jquery.jgrowl.min.js'); $page->add_script('/apps/admin/js/jquery.triggers.js'); $page->add_script('/js/jquery.cookie.js'); $page->add_script('/apps/admin/js/jquery.i18n.js'); $page->add_script('/apps/admin/js/top-bar.js'); $page->add_script(I18n::export('List keyboard shortcuts', 'Keyboard shortcuts')); }
* preview: '#preview' * }); * * This helper stores the list of files in the following format * in the input field, so you can easily split them into an array: * * /files/file1.txt|/files/file2.doc|/files/file3.txt * * Options: * * - field: The selector of an input field to update with the list. * - preview: The selector of an element to use to contain the list preview. */ echo $this->run ('filemanager/util/browser'); echo $this->run ('admin/util/fontawesome'); $page->add_style ('/apps/filemanager/css/multi-file.css'); $page->add_script ( sprintf ( '<script>var filemanager_path = "%s";</script>', conf('Paths','filemanager_path') ) ); $page->add_script ('/js/jquery-ui/jquery-ui.min.js'); $page->add_script ('/apps/filemanager/js/jquery.multi-file.js'); $page->add_script (I18n::export ( 'Click to remove', 'Browse files' ));
* * if ($_POST['type'] === 'select') { * echo Template::sanitize ($_POST['label']); * return; * } * echo Template::sanitize ($_POST['value']); * * To send an error message, use the following code: * * $this->add_notification (__ ('Unable to save changes.')); * echo $this->error (500, 'Error message'); * return; * * To add a notification upon successful requests, you can also use the * [[Controller]]'s `add_notification()` method: * * $this->add_notification (__ ('Changes saved.')); * echo Template::sanitize ($_POST['value']); */ $this->run('admin/util/i18n'); $page->add_style('/apps/admin/css/editable.css'); $page->add_script('/apps/admin/js/jquery.autogrow.min.js'); $page->add_script('/apps/admin/js/jquery.jeditable.min.js'); $page->add_script('/apps/admin/js/jquery.jeditable.autogrow.js'); $page->add_script('/apps/admin/js/editable.js'); $page->add_script('/apps/admin/js/jquery.jeditable.deletable.js'); if (isset($data['url'])) { $page->add_script('<script>var editable_default_url = \'' . $data['url'] . '\';</script>'); } $page->add_script(I18n::export('Saving...', 'Cancel', 'Save', 'Delete', 'Click to edit', 'Unable to save changes.', 'Are you sure you want to delete this item?'));
function test_export() { $expected = "<script>\$(function(){\$.i18n_append({\n\t'One': 'One',\n\t'Don\\'t': 'Don\\'t'\n});});</script>\n"; $this->assertEquals($expected, I18n::export(array('One', 'Don\'t'))); $this->assertEquals($expected, I18n::export('One', 'Don\'t')); }