source: branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Demos/tinymce.php @ 1302

Last change on this file since 1302 was 1302, checked in by gogo, 8 years ago

Updates to http://www.github.com/sleemanj/mootools-filemanager from GerHoblett?

http://www.github.com/GerHoblett/

Changes to said updates by gogo (sleemanj @ github)

Modifications to MootoolsFileManager? to work with those updates, some courtesy of GerHoblett?, some sleemanj

GerHoblett? provided a large diff which accomplished the goal in a quite different way. It has merit, however I have opted for a less-affecting path in so far as Xinha's "way" is concerned, namely, not splitting the config for a single plugin into several calls to backend config passing functions which seemed a little cumbersome.

Instead I take the option of using POST to send backend data around, at the minor expense of an extra round trip when displaying thumbnails (for each one). This could be reduced by checking for thumbnail existence and returning the thumbnail name directly in "onView" rather than the backend request to generate said thumbnail.

Still to do, is to make the preview pane thumbnail also work.


File size: 4.7 KB
Line 
1<?php
2
3/*
4As AJAX calls cannot set cookies, we set up the session for the authentication demonstration right here; that way, the session cookie
5will travel with every request.
6*/
7if (!session_start()) die('session_start() failed');
8
9/*
10set a 'secret' value to doublecheck the legality of the session: did it originate from here?
11*/
12$_SESSION['FileManager'] = 'DemoMagick';
13
14/*
15Note that for the sake of the demo, we simulate an UNauthorized user in the session.
16*/
17$_SESSION['UploadAuth'] = 'NO';
18
19
20/* the remainder of the code does not need access to the session data. */
21session_write_close();
22
23?>
24<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
25"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
26<html xmlns="http://www.w3.org/1999/xhtml">
27<head>
28        <title>MooTools FileManager TinyMCE example</title>
29        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
30        <link rel="shortcut icon" href="http://og5.net/christoph/favicon.png" />
31        <style type="text/css">
32        body {
33                font-size: 11px;
34                font-family: Tahoma, sans-serif;
35        }
36
37        h1 {
38                margin: 0 0 10px 0;
39                padding: 0;
40
41                color: #666;
42                font-weight: normal;
43                font-size: 24px;
44                letter-spacing: 1px;
45                word-spacing: 2px;
46                line-height: 22px;
47                min-height: 25px;
48        }
49
50        h1 span {
51                font-size: 11px;
52                letter-spacing: 0;
53                word-spacing: 0;
54                text-shadow: none;
55        }
56
57        .blue { color: #1f52b0; }
58
59        div.content {
60                min-height: 200px;
61                margin: 23px 34px;
62                padding: 10px 17px;
63                border: 1px solid #b2b2b2;
64                background: #fff;
65                box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 2px;
66                -moz-box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 2px;
67                -webkit-box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 2px;
68        }
69
70        div.content div {
71                margin: 10px 0;
72        }
73        </style>
74
75        <link rel="stylesheet" media="all" type="text/css" href="../Assets/js/milkbox/css/milkbox.css" />
76        <link rel="stylesheet" media="all" type="text/css" href="../Assets/Css/FileManager.css" />
77        <link rel="stylesheet" media="all" type="text/css" href="../Assets/Css/Additions.css" />
78
79        <script type="text/javascript" src="../../../../../lib/includes/js/tiny_mce/jscripts/tiny_mce/tiny_mce_src.js"></script>
80
81        <script type="text/javascript" src="mootools-core.js"></script>
82        <script type="text/javascript" src="mootools-more.js"></script>
83
84        <script type="text/javascript" src="../Source/FileManager.js"></script>
85        <script type="text/javascript" src="../Source/Uploader/Fx.ProgressBar.js"></script>
86        <script type="text/javascript" src="../Source/Uploader/Swiff.Uploader.js"></script>
87        <script type="text/javascript" src="../Source/Uploader.js"></script>
88        <script type="text/javascript" src="../Language/Language.en.js"></script>
89        <script type="text/javascript" src="../Language/Language.de.js"></script>
90
91        <script type="text/javascript" src="../Source/FileManager.TinyMCE.js"></script>
92
93        <script type="text/javascript">
94                tinyMCE.init({
95                        mode: 'textareas',
96                        language: 'en',
97                        theme: 'advanced',
98                        skin: 'o2k7',
99                        skin_variant: 'silver',
100                        plugins: 'advimage,advlink,inlinepopups',
101                        theme_advanced_toolbar_location: 'top',
102                        theme_advanced_buttons1: 'link,unlink,image,forecolor,backcolor,|,sub,sup,|,hr,charmap,|,undo,redo,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent,blockquote,bullist,numlist',
103                        theme_advanced_buttons2: '',
104                        theme_advanced_buttons3: '',
105
106                        width: '100%',
107                        height: '300px',
108
109                        document_base_url: '',  // not /c/ !
110
111                        /* Here goes the Magic */
112                        file_browser_callback: FileManager.TinyMCE(function(type){
113                                return {
114                                        url: 'manager.php?exhibit=A', // 'manager.php', but with a bogus query parameter included: latest FM can cope with such an URI
115                                        assetBasePath: '../Assets', // '/c/lib/includes/js/mootools-filemanager/Assets',
116                                        language: 'en',
117                                        selectable: true,
118                                        destroy: true,
119                                        upload: true,
120                                        rename: true,
121                                        download: true,
122                                        createFolders: true,
123                                        hideClose: false,
124                                        hideOverlay: false,
125                                        uploadAuthData: {
126                                                session: 'MySessionData'
127                                        },
128                                        // and a couple of extra user defined parameters sent with EVERY request:
129                                        propagateData: {
130                                                editor_reqtype: type,
131                                                origin: 'demo-tinyMCE'
132                                        }
133                                };
134                        })
135                });
136
137                window.addEvent('domready', function(){
138                        $('getEditorText').addEvent('click', function(e){
139                                e.stop();
140                                $('editorContent').set('html', tinyMCE.activeEditor.getContent());
141                        });
142                });
143        </script>
144</head>
145<body>
146<div id="content" class="content">
147        <h1>FileManager Demo</h1>
148        <div style="float: right;"><a href="index.php">Go to the examples' overview</a></div>
149
150        <div style="clear: both;">
151                <textarea>Add an image or a link to a file!</textarea>
152                <button id="getEditorText" name="getEditorTextButton">Get editor content</button>
153        </div>
154        <div id="editorContent"></div>
155</div>
156</body>
157</html>
Note: See TracBrowser for help on using the repository browser.