Beispiel #1
0
function pieform_element_wysiwyg_get_headdata()
{
    global $_PIEFORM_WYSIWYGS;
    if (is_html_editor_enabled() && !empty($_PIEFORM_WYSIWYGS)) {
        $result = '<script type="application/javascript">' . "\nvar editor_to_focus;" . "\nPieformManager.connect('onsubmit', null, tinyMCE.triggerSave);" . "\nPieformManager.connect('onload', null, function() {\n";
        foreach ($_PIEFORM_WYSIWYGS as $editor) {
            $result .= "    tinyMCE.execCommand('mceAddEditor', false, '{$editor}');\n";
            $result .= "    \$('{$editor}').focus = function() {\n";
            $result .= "        editor_to_focus = '{$editor}';\n";
            $result .= "    };\n";
        }
        $result .= "});\nPieformManager.connect('onreply', null, function() {\n";
        foreach ($_PIEFORM_WYSIWYGS as $editor) {
            $result .= "    tinyMCE.execCommand('mceRemoveEditor', false, '{$editor}');\n";
        }
        $result .= "});</script>";
        safe_require('artefact', 'file');
        $strings = PluginArtefactFile::jsstrings('filebrowser');
        $jsstrings = '';
        foreach ($strings as $section => $sectionstrings) {
            foreach ($sectionstrings as $s) {
                $jsstrings .= "strings.{$s}=" . json_encode(get_raw_string($s, $section)) . ';';
            }
        }
        $headdata = '<script type="application/javascript">' . $jsstrings . '</script>';
        return array('tinymce', $result, $headdata);
    }
    return array();
}
Beispiel #2
0
/**
 * When the element exists in a form that's present when the page is
 * first generated the following function gets called and the js file
 * below will be inserted into the head data.  Unfortunately, when
 * this element is present in a form that gets called in an ajax
 * request (currently on the view layout page), the .js file is not
 * loaded and so it's added explicitly to the smarty() call.
 */
function pieform_element_filebrowser_get_headdata($element)
{
    global $THEME;
    $headdata = array('<script type="application/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filebrowser.js"></script>');
    if ($element['config']['upload']) {
        // only add dropzone if filebrowser is allowed to upload
        $headdata[] = '<script type="application/javascript" src="' . get_config('wwwroot') . 'js/dropzone/dropzone.min.js"></script>';
        $headdata[] = '<link href="' . get_config('wwwroot') . 'js/dropzone/css/dropzone.css" type="text/css" rel="stylesheet">';
        $headdata[] = '<script type="application/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filedropzone.js"></script>';
    }
    if ($element['config']['edit']) {
        // Add switchbox css if filebrowser is allowed to edit
        require_once get_config('docroot') . 'lib/form/elements/switchbox.php';
        $headdata[] = join(' ', pieform_element_switchbox_get_headdata($element));
    }
    $strings = PluginArtefactFile::jsstrings('filebrowser');
    $jsstrings = '';
    foreach ($strings as $section => $sectionstrings) {
        foreach ($sectionstrings as $s) {
            $jsstrings .= "strings.{$s}=" . json_encode(get_raw_string($s, $section)) . ';';
        }
    }
    $headdata[] = '<script type="application/javascript">' . $jsstrings . '</script>';
    $pluginsheets = $THEME->get_url('style/style.css', true, 'artefact/file');
    foreach (array_reverse($pluginsheets) as $sheet) {
        $headdata[] = '<link rel="stylesheet" type="text/css" href="' . $sheet . '">';
    }
    return $headdata;
}
/**
 * When the element exists in a form that's present when the page is
 * first generated the following function gets called and the js file
 * below will be inserted into the head data.  Unfortunately, when
 * this element is present in a form that gets called in an ajax
 * request (currently on the view layout page), the .js file is not
 * loaded and so it's added explicitly to the smarty() call.
 */
function pieform_element_filebrowser_get_headdata($element)
{
    global $THEME;
    $headdata = array('<script type="text/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filebrowser.js"></script>');
    $strings = PluginArtefactFile::jsstrings('filebrowser');
    $jsstrings = '';
    foreach ($strings as $section => $sectionstrings) {
        foreach ($sectionstrings as $s) {
            $jsstrings .= "strings.{$s}=" . json_encode(get_raw_string($s, $section)) . ';';
        }
    }
    $headdata[] = '<script type="text/javascript">' . $jsstrings . '</script>';
    $pluginsheets = $THEME->get_url('style/style.css', true, 'artefact/file');
    foreach (array_reverse($pluginsheets) as $sheet) {
        $headdata[] = '<link rel="stylesheet" type="text/css" href="' . $sheet . '">';
    }
    return $headdata;
}
Beispiel #4
0
/**
 * When the element exists in a form that's present when the page is
 * first generated the following function gets called and the js file
 * below will be inserted into the head data.  Unfortunately, when
 * this element is present in a form that gets called in an ajax
 * request (currently on the view layout page), the .js file is not
 * loaded and so it's added explicitly to the smarty() call.
 */
function pieform_element_filebrowser_get_headdata($element)
{
    $headdata = array('<script type="text/javascript" src="' . get_config('wwwroot') . 'artefact/file/js/filebrowser.js"></script>');
    $strings = PluginArtefactFile::jsstrings('filebrowser');
    $jsstrings = '';
    foreach ($strings as $section => $sectionstrings) {
        foreach ($sectionstrings as $s) {
            $jsstrings .= "strings.{$s}=" . json_encode(get_raw_string($s, $section)) . ';';
        }
    }
    $headdata[] = '<script type="text/javascript">' . $jsstrings . '</script>';
    return $headdata;
}