26 | {% endif %}
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010, Patrick Kranzlmueller (vonautomatisch werkstaetten),
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice,
8 | this list of conditions and the following disclaimer.
9 | 2. Redistributions in binary form must reproduce the above copyright notice,
10 | this list of conditions and the following disclaimer in the documentation and/or
11 | other materials provided with the distribution.
12 | 3. Neither the name of FileBrowser nor the names of its contributors may be used
13 | to endorse or promote products derived from this software without specific prior
14 | written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
17 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19 | THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/filebrowser/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010, Patrick Kranzlmueller (vonautomatisch werkstaetten),
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice,
8 | this list of conditions and the following disclaimer.
9 | 2. Redistributions in binary form must reproduce the above copyright notice,
10 | this list of conditions and the following disclaimer in the documentation and/or
11 | other materials provided with the distribution.
12 | 3. Neither the name of FileBrowser nor the names of its contributors may be used
13 | to endorse or promote products derived from this software without specific prior
14 | written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
17 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19 | THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/check.php:
--------------------------------------------------------------------------------
1 | $value) {
28 | if ($key != 'folder') {
29 | if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
30 | $fileArray[$key] = $value;
31 | }
32 | }
33 | }
34 | echo json_encode($fileArray);
35 | ?>
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/example/scripts/check.php:
--------------------------------------------------------------------------------
1 | $value) {
28 | if ($key != 'folder') {
29 | if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
30 | $fileArray[$key] = $value;
31 | }
32 | }
33 | }
34 | echo json_encode($fileArray);
35 | ?>
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/js/AddFileBrowser.js:
--------------------------------------------------------------------------------
1 | var FileBrowser = {
2 | // this is set automatically
3 | admin_media_prefix: '',
4 | // change this
5 | thumb_prefix: 'thumb_',
6 | no_thumb: 'filebrowser/img/no_thumb.gif',
7 |
8 | init: function() {
9 | // Deduce admin_media_prefix by looking at the
26 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/uploadify.css:
--------------------------------------------------------------------------------
1 | /*
2 | Uploadify v2.1.0
3 | Release Date: August 24, 2009
4 |
5 | Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
24 | */
25 | .uploadifyQueueItem {
26 | font: 11px Verdana, Geneva, sans-serif;
27 | border: 2px solid #E5E5E5;
28 | background-color: #F5F5F5;
29 | margin-top: 5px;
30 | padding: 10px;
31 | width: 350px;
32 | }
33 | .uploadifyError {
34 | border: 2px solid #FBCBBC !important;
35 | background-color: #FDE5DD !important;
36 | }
37 | .uploadifyQueueItem .cancel {
38 | float: right;
39 | }
40 | .uploadifyProgress {
41 | background-color: #FFFFFF;
42 | border-top: 1px solid #808080;
43 | border-left: 1px solid #808080;
44 | border-right: 1px solid #C5C5C5;
45 | border-bottom: 1px solid #C5C5C5;
46 | margin-top: 10px;
47 | width: 100%;
48 | }
49 | .uploadifyProgressBar {
50 | background-color: #0099FF;
51 | width: 1px;
52 | height: 3px;
53 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/example/css/uploadify.css:
--------------------------------------------------------------------------------
1 | /*
2 | Uploadify v2.1.0
3 | Release Date: August 24, 2009
4 |
5 | Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
24 | */
25 | .uploadifyQueueItem {
26 | font: 11px Verdana, Geneva, sans-serif;
27 | border: 2px solid #E5E5E5;
28 | background-color: #F5F5F5;
29 | margin-top: 5px;
30 | padding: 10px;
31 | width: 350px;
32 | }
33 | .uploadifyError {
34 | border: 2px solid #FBCBBC !important;
35 | background-color: #FDE5DD !important;
36 | }
37 | .uploadifyQueueItem .cancel {
38 | float: right;
39 | }
40 | .uploadifyProgress {
41 | background-color: #FFFFFF;
42 | border-top: 1px solid #808080;
43 | border-left: 1px solid #808080;
44 | border-right: 1px solid #C5C5C5;
45 | border-bottom: 1px solid #C5C5C5;
46 | margin-top: 10px;
47 | width: 100%;
48 | }
49 | .uploadifyProgressBar {
50 | background-color: #0099FF;
51 | width: 1px;
52 | height: 3px;
53 | }
--------------------------------------------------------------------------------
/filebrowser/templatetags/fb_pagination.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | from django.utils.html import escape
4 | from django.utils.safestring import mark_safe
5 | from django.template import Library
6 |
7 | register = Library()
8 |
9 | DOT = '.'
10 |
11 | @register.inclusion_tag('filebrowser/include/paginator.html', takes_context=True)
12 | def pagination(context):
13 | page_num = context['page'].number-1
14 | paginator = context['p']
15 |
16 | if not paginator.num_pages or paginator.num_pages == 1:
17 | page_range = []
18 | else:
19 | ON_EACH_SIDE = 3
20 | ON_ENDS = 2
21 |
22 | # If there are 10 or fewer pages, display links to every page.
23 | # Otherwise, do some fancy
24 | if paginator.num_pages <= 10:
25 | page_range = range(paginator.num_pages)
26 | else:
27 | # Insert "smart" pagination links, so that there are always ON_ENDS
28 | # links at either end of the list of pages, and there are always
29 | # ON_EACH_SIDE links at either end of the "current page" link.
30 | page_range = []
31 | if page_num > (ON_EACH_SIDE + ON_ENDS):
32 | page_range.extend(range(0, ON_EACH_SIDE - 1))
33 | page_range.append(DOT)
34 | page_range.extend(range(page_num - ON_EACH_SIDE, page_num + 1))
35 | else:
36 | page_range.extend(range(0, page_num + 1))
37 | if page_num < (paginator.num_pages - ON_EACH_SIDE - ON_ENDS - 1):
38 | page_range.extend(range(page_num + 1, page_num + ON_EACH_SIDE + 1))
39 | page_range.append(DOT)
40 | page_range.extend(range(paginator.num_pages - ON_ENDS, paginator.num_pages))
41 | else:
42 | page_range.extend(range(page_num + 1, paginator.num_pages))
43 |
44 | return {
45 | 'page_range': page_range,
46 | 'page_num': page_num,
47 | 'results_var': context['results_var'],
48 | 'query': context['query'],
49 | }
50 |
51 |
52 |
--------------------------------------------------------------------------------
/filebrowser/management/commands/version_generator.py:
--------------------------------------------------------------------------------
1 | from django.core.management.base import NoArgsCommand
2 |
3 | class Command(NoArgsCommand):
4 | help = "(Re)Generate versions of Images"
5 |
6 | def handle_noargs(self, **options):
7 | import os, re
8 | from filebrowser.settings import EXTENSION_LIST, EXCLUDE, VERSIONS, EXTENSIONS
9 | from filebrowser.conf import fb_settings
10 |
11 | # Precompile regular expressions
12 | filter_re = []
13 | for exp in EXCLUDE:
14 | filter_re.append(re.compile(exp))
15 | for k,v in VERSIONS.iteritems():
16 | exp = (r'_%s.(%s)') % (k, '|'.join(EXTENSION_LIST))
17 | filter_re.append(re.compile(exp))
18 |
19 | path = os.path.join(fb_settings.MEDIA_ROOT, fb_settings.DIRECTORY)
20 |
21 | # walkt throu the filebrowser directory
22 | # for all/new files (except file versions itself and excludes)
23 | for dirpath,dirnames,filenames in os.walk(path):
24 | for filename in filenames:
25 | filtered = False
26 | # no "hidden" files (stating with ".")
27 | if filename.startswith('.'):
28 | continue
29 | # check the exclude list
30 | for re_prefix in filter_re:
31 | if re_prefix.search(filename):
32 | filtered = True
33 | if filtered:
34 | continue
35 | (tmp, extension) = os.path.splitext(filename)
36 | if extension in EXTENSIONS["Image"]:
37 | self.createVersions(os.path.join(dirpath, filename))
38 |
39 | def createVersions(self, path):
40 | print "generating versions for: ", path
41 | from filebrowser.settings import VERSIONS
42 | from filebrowser.functions import version_generator
43 | for version in VERSIONS:
44 | #print " ", version
45 | version_generator(path, version, True)
46 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/webapis/ServiceBase.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 |
34 | package com.adobe.webapis
35 | {
36 | import flash.events.EventDispatcher;
37 |
38 | /**
39 | * Base class for remote service classes.
40 | */
41 | public class ServiceBase extends EventDispatcher
42 | {
43 | public function ServiceBase()
44 | {
45 | }
46 |
47 | }
48 | }
--------------------------------------------------------------------------------
/filebrowser/templates/filebrowser/makedir.html:
--------------------------------------------------------------------------------
1 | {% extends "admin/base_site.html" %}
2 |
3 |
4 | {% load i18n fb_tags fb_csrf %}
5 |
6 |
7 | {% block extrastyle %}
8 | {{ block.super }}
9 |
10 |
11 | {% endblock %}
12 |
13 |
14 | {% block bodyclass %}change-form filebrowser{% if query.pop %} popup{% endif %}{% endblock %}
15 | {% block content-class %}content-flexible{% endblock %}
16 |
17 |
18 | {% block breadcrumbs %}{% include "filebrowser/include/breadcrumbs.html" %}{% endblock %}
19 |
20 |
21 | {% block content %}
22 |
23 |
42 |
43 | {% endblock %}
44 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/fileformats/vcard/Address.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.fileformats.vcard
33 | {
34 | public class Address
35 | {
36 | public var type:String;
37 | public var street:String;
38 | public var city:String;
39 | public var state:String;
40 | public var postalCode:String;
41 |
42 | public function toString():String
43 | {
44 | return (street + " " + city + ", " + state + " " + postalCode);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/uploadify.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/example/scripts/uploadify.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/fileformats/vcard/VCard.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.fileformats.vcard
33 | {
34 | import flash.utils.ByteArray;
35 |
36 | public class VCard
37 | {
38 | public var fullName:String;
39 | public var orgs:Array;
40 | public var title:String;
41 | public var image:ByteArray;
42 | public var phones:Array;
43 | public var emails:Array;
44 | public var addresses:Array;
45 |
46 | public function VCard()
47 | {
48 | orgs = new Array();
49 | phones = new Array();
50 | emails = new Array();
51 | addresses = new Array();
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/filebrowser/templates/filebrowser/include/filter.html:
--------------------------------------------------------------------------------
1 | {% load i18n fb_tags %}
2 |
3 |
35 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/net/DynamicURLLoader.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.net
34 | {
35 | import flash.net.URLLoader;
36 |
37 | /**
38 | * Class that provides a dynamic implimentation of the URLLoader class.
39 | *
40 | * This class provides no API implimentations. However, since the class is
41 | * declared as dynamic, it can be used in place of URLLoader, and allow
42 | * you to dynamically attach properties to it (which URLLoader does not allow).
43 | *
44 | * @langversion ActionScript 3.0
45 | * @playerversion Flash 9.0
46 | * @tiptext
47 | */
48 | public dynamic class DynamicURLLoader extends URLLoader
49 | {
50 | public function DynamicURLLoader()
51 | {
52 | super();
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/filebrowser/templates/filebrowser/include/search.html:
--------------------------------------------------------------------------------
1 | {% load i18n fb_tags %}
2 |
28 |
29 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/errors/IllegalStateError.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.errors
34 | {
35 | /**
36 | * This class represents an Error that is thrown when a method is called when
37 | * the receiving instance is in an invalid state.
38 | *
39 | * For example, this may occur if a method has been called, and other properties
40 | * in the instance have not been initialized properly.
41 | *
42 | * @langversion ActionScript 3.0
43 | * @playerversion Flash 9.0
44 | * @tiptext
45 | *
46 | */
47 | public class IllegalStateError extends Error
48 | {
49 | /**
50 | * Constructor
51 | *
52 | * @param message A message describing the error in detail.
53 | *
54 | * @langversion ActionScript 3.0
55 | * @playerversion Flash 9.0
56 | * @tiptext
57 | */
58 | public function IllegalStateError(message:String)
59 | {
60 | super(message);
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/serialization/json/JSONTokenType.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json {
34 |
35 | /**
36 | * Class containing constant values for the different types
37 | * of tokens in a JSON encoded string.
38 | */
39 | public class JSONTokenType {
40 |
41 | public static const UNKNOWN:int = -1;
42 |
43 | public static const COMMA:int = 0;
44 |
45 | public static const LEFT_BRACE:int = 1;
46 |
47 | public static const RIGHT_BRACE:int = 2;
48 |
49 | public static const LEFT_BRACKET:int = 3;
50 |
51 | public static const RIGHT_BRACKET:int = 4;
52 |
53 | public static const COLON:int = 6;
54 |
55 | public static const TRUE:int = 7;
56 |
57 | public static const FALSE:int = 8;
58 |
59 | public static const NULL:int = 9;
60 |
61 | public static const STRING:int = 10;
62 |
63 | public static const NUMBER:int = 11;
64 |
65 | }
66 |
67 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/utils/NumberFormatter.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 |
36 | /**
37 | * Class that contains static utility methods for formatting Numbers
38 | *
39 | * @langversion ActionScript 3.0
40 | * @playerversion Flash 9.0
41 | * @tiptext
42 | *
43 | * @see #mx.formatters.NumberFormatter
44 | */
45 | public class NumberFormatter
46 | {
47 |
48 | /**
49 | * Formats a number to include a leading zero if it is a single digit
50 | * between -1 and 10.
51 | *
52 | * @param n The number that will be formatted
53 | *
54 | * @return A string with single digits between -1 and 10 padded with a
55 | * leading zero.
56 | *
57 | * @langversion ActionScript 3.0
58 | * @playerversion Flash 9.0
59 | * @tiptext
60 | */
61 | public static function addLeadingZero(n:Number):String
62 | {
63 | var out:String = String(n);
64 |
65 | if(n < 10 && n > -1)
66 | {
67 | out = "0" + out;
68 | }
69 |
70 | return out;
71 | }
72 |
73 | }
74 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/webapis/events/ServiceEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 |
34 | package com.adobe.webapis.events
35 | {
36 |
37 | import flash.events.Event;
38 |
39 | /**
40 | * Event class that contains data loaded from remote services.
41 | *
42 | * @author Mike Chambers
43 | */
44 | public class ServiceEvent extends Event
45 | {
46 | private var _data:Object = new Object();;
47 |
48 | /**
49 | * Constructor for ServiceEvent class.
50 | *
51 | * @param type The type of event that the instance represents.
52 | */
53 | public function ServiceEvent(type:String, bubbles:Boolean = false,
54 | cancelable:Boolean=false)
55 | {
56 | super(type, bubbles, cancelable);
57 | }
58 |
59 | /**
60 | * This object contains data loaded in response
61 | * to remote service calls, and properties associated with that call.
62 | */
63 | public function get data():Object
64 | {
65 | return _data;
66 | }
67 |
68 | public function set data(d:Object):void
69 | {
70 | _data = d;
71 | }
72 |
73 |
74 | }
75 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/js/TinyMCEAdmin.js:
--------------------------------------------------------------------------------
1 | function CustomFileBrowser(field_name, url, type, win) {
2 |
3 | var cmsURL = "/admin/filebrowser/browse/?pop=2";
4 | cmsURL = cmsURL + "&type=" + type;
5 |
6 | tinyMCE.activeEditor.windowManager.open({
7 | file: cmsURL,
8 | width: 820, // Your dimensions may differ - toy around with them!
9 | height: 500,
10 | resizable: "yes",
11 | scrollbars: "yes",
12 | inline: "no", // This parameter only has an effect if you use the inlinepopups plugin!
13 | close_previous: "no"
14 | }, {
15 | window: win,
16 | input: field_name,
17 | editor_id: tinyMCE.selectedInstance.editorId
18 | });
19 | return false;
20 | }
21 |
22 |
23 | tinyMCE.init({
24 | mode: "textareas",
25 | theme: "advanced",
26 | language: "en",
27 | skin: "o2k7",
28 | browsers: "gecko",
29 | dialog_type: "modal",
30 | object_resizing: true,
31 | cleanup_on_startup: true,
32 | forced_root_block: "p",
33 | remove_trailing_nbsp: true,
34 | theme_advanced_toolbar_location: "top",
35 | theme_advanced_toolbar_align: "left",
36 | theme_advanced_statusbar_location: "none",
37 | theme_advanced_buttons1: "formatselect,bold,italic,underline,bullist,numlist,undo,redo,link,unlink,image,code,fullscreen,pasteword,media,charmap",
38 | theme_advanced_buttons2: "",
39 | theme_advanced_buttons3: "",
40 | theme_advanced_path: false,
41 | theme_advanced_blockformats: "p,h2,h3,h4,h5,h6",
42 | width: '700',
43 | height: '200',
44 | plugins: "advimage,advlink,fullscreen,visualchars,paste,media,template,searchreplace",
45 | advimage_styles: "Linksbündig neben Text=img_left;Rechtsbündig neben Text=img_right;Eigener Block=img_block",
46 | advlink_styles: "internal (sehmaschine.net)=internal;external (link to an external site)=external",
47 | advimage_update_dimensions_onchange: true,
48 | file_browser_callback: "CustomFileBrowser",
49 | relative_urls: false,
50 | valid_elements : "" +
51 | "-p," +
52 | "a[href|target=_blank|class]," +
53 | "-strong/-b," +
54 | "-em/-i," +
55 | "-u," +
56 | "-ol," +
57 | "-ul," +
58 | "-li," +
59 | "br," +
60 | "img[class|src|alt=|width|height]," +
61 | "-h2,-h3,-h4," +
62 | "-pre," +
63 | "-code," +
64 | "-div",
65 | extended_valid_elements: "" +
66 | "a[name|class|href|target|title|onclick]," +
67 | "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]," +
68 | "br[clearfix]," +
69 | "-p[class
40 | * // create a JSON string from an internal object
41 | * JSON.encode( myObject );
42 | *
43 | * // read a JSON string into an internal object
44 | * var myObject:Object = JSON.decode( jsonString );
45 | *
46 | */
47 | public class JSON {
48 |
49 |
50 | /**
51 | * Encodes a object into a JSON string.
52 | *
53 | * @param o The object to create a JSON string for
54 | * @return the JSON string representing o
55 | * @langversion ActionScript 3.0
56 | * @playerversion Flash 9.0
57 | * @tiptext
58 | */
59 | public static function encode( o:Object ):String {
60 |
61 | var encoder:JSONEncoder = new JSONEncoder( o );
62 | return encoder.getString();
63 |
64 | }
65 |
66 | /**
67 | * Decodes a JSON string into a native object.
68 | *
69 | * @param s The JSON string representing the object
70 | * @return A native object as specified by s
71 | * @throw JSONParseError
72 | * @langversion ActionScript 3.0
73 | * @playerversion Flash 9.0
74 | * @tiptext
75 | */
76 | public static function decode( s:String ):* {
77 |
78 | var decoder:JSONDecoder = new JSONDecoder( s )
79 | return decoder.getValue();
80 |
81 | }
82 |
83 | }
84 |
85 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/serialization/json/JSONParseError.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json {
34 |
35 | /**
36 | *
37 | *
38 | */
39 | public class JSONParseError extends Error {
40 |
41 | /** The location in the string where the error occurred */
42 | private var _location:int;
43 |
44 | /** The string in which the parse error occurred */
45 | private var _text:String;
46 |
47 | /**
48 | * Constructs a new JSONParseError.
49 | *
50 | * @param message The error message that occured during parsing
51 | * @langversion ActionScript 3.0
52 | * @playerversion Flash 9.0
53 | * @tiptext
54 | */
55 | public function JSONParseError( message:String = "", location:int = 0, text:String = "") {
56 | super( message );
57 | name = "JSONParseError";
58 | _location = location;
59 | _text = text;
60 | }
61 |
62 | /**
63 | * Provides read-only access to the location variable.
64 | *
65 | * @return The location in the string where the error occurred
66 | * @langversion ActionScript 3.0
67 | * @playerversion Flash 9.0
68 | * @tiptext
69 | */
70 | public function get location():int {
71 | return _location;
72 | }
73 |
74 | /**
75 | * Provides read-only access to the text variable.
76 | *
77 | * @return The string in which the error occurred
78 | * @langversion ActionScript 3.0
79 | * @playerversion Flash 9.0
80 | * @tiptext
81 | */
82 | public function get text():String {
83 | return _text;
84 | }
85 | }
86 |
87 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/net/IURIResolver.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.net
34 | {
35 | /**
36 | * The URI class cannot know about DNS aliases, virtual hosts, or
37 | * symbolic links that may be involved. The application can provide
38 | * an implementation of this interface to resolve the URI before the
39 | * URI class makes any comparisons. For example, a web host has
40 | * two aliases:
41 | *
42 | *
The application can provide an implementation that automatically
48 | * resolves site.net to site.com before URI compares two URI objects.
49 | * Only the application can know and understand the context in which
50 | * the URI's are being used.
51 | *
52 | *
Use the URI.resolver accessor to assign a custom resolver to
53 | * the URI class. Any resolver specified is global to all instances
54 | * of URI.
53 | {% include "filebrowser/include/toolbar.html" %}
54 |
55 |
56 | {% if results_var.results_current %}
57 |
58 |
59 | {% include "filebrowser/include/tableheader.html" %}
60 |
61 | {% include "filebrowser/include/filelisting.html" %}
62 |
63 |
64 |
65 | {% endif %}
66 | {% pagination %}
67 |
68 |
69 |
70 | {% include "filebrowser/include/filter.html" %}
71 |
72 |
73 |
74 | {% endblock %}
75 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/air/logging/FileTarget.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.logging
34 | {
35 | import mx.logging.AbstractTarget;
36 | import flash.filesystem.File;
37 | import flash.filesystem.FileStream;
38 | import flash.filesystem.FileMode;
39 | import mx.logging.LogEvent;
40 | import flash.system.System;
41 | import flash.system.Capabilities;
42 | import mx.logging.targets.LineFormattedTarget;
43 | import mx.core.mx_internal;
44 |
45 | use namespace mx_internal;
46 |
47 | /**
48 | * An Adobe AIR only class that provides a log target for the Flex logging
49 | * framework, that logs files to a file on the user's system.
50 | *
51 | * This class will only work when running within Adobe AIR>
52 | */
53 | public class FileTarget extends LineFormattedTarget
54 | {
55 | private const DEFAULT_LOG_PATH:String = "app-storage:/application.log";
56 |
57 | private var log:File;
58 |
59 | public function FileTarget(logFile:File = null)
60 | {
61 | if(logFile != null)
62 | {
63 | log = logFile;
64 | }
65 | else
66 | {
67 | log = new File(DEFAULT_LOG_PATH);
68 | }
69 | }
70 |
71 | public function get logURI():String
72 | {
73 | return log.url;
74 | }
75 |
76 | mx_internal override function internalLog(message:String):void
77 | {
78 | write(message);
79 | }
80 |
81 | private function write(msg:String):void
82 | {
83 | var fs:FileStream = new FileStream();
84 | fs.open(log, FileMode.APPEND);
85 | fs.writeUTFBytes(msg + "\n");
86 | fs.close();
87 | }
88 |
89 | public function clear():void
90 | {
91 | var fs:FileStream = new FileStream();
92 | fs.open(log, FileMode.WRITE);
93 | fs.writeUTFBytes("");
94 | fs.close();
95 | }
96 |
97 | }
98 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/serialization/json/JSONToken.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json {
34 |
35 | public class JSONToken {
36 |
37 | private var _type:int;
38 | private var _value:Object;
39 |
40 | /**
41 | * Creates a new JSONToken with a specific token type and value.
42 | *
43 | * @param type The JSONTokenType of the token
44 | * @param value The value of the token
45 | * @langversion ActionScript 3.0
46 | * @playerversion Flash 9.0
47 | * @tiptext
48 | */
49 | public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
50 | _type = type;
51 | _value = value;
52 | }
53 |
54 | /**
55 | * Returns the type of the token.
56 | *
57 | * @see com.adobe.serialization.json.JSONTokenType
58 | * @langversion ActionScript 3.0
59 | * @playerversion Flash 9.0
60 | * @tiptext
61 | */
62 | public function get type():int {
63 | return _type;
64 | }
65 |
66 | /**
67 | * Sets the type of the token.
68 | *
69 | * @see com.adobe.serialization.json.JSONTokenType
70 | * @langversion ActionScript 3.0
71 | * @playerversion Flash 9.0
72 | * @tiptext
73 | */
74 | public function set type( value:int ):void {
75 | _type = value;
76 | }
77 |
78 | /**
79 | * Gets the value of the token
80 | *
81 | * @see com.adobe.serialization.json.JSONTokenType
82 | * @langversion ActionScript 3.0
83 | * @playerversion Flash 9.0
84 | * @tiptext
85 | */
86 | public function get value():Object {
87 | return _value;
88 | }
89 |
90 | /**
91 | * Sets the value of the token
92 | *
93 | * @see com.adobe.serialization.json.JSONTokenType
94 | * @langversion ActionScript 3.0
95 | * @playerversion Flash 9.0
96 | * @tiptext
97 | */
98 | public function set value ( v:Object ):void {
99 | _value = v;
100 | }
101 |
102 | }
103 |
104 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/utils/IntUtil.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.utils {
33 |
34 | import flash.utils.Endian;
35 |
36 | /**
37 | * Contains reusable methods for operations pertaining
38 | * to int values.
39 | */
40 | public class IntUtil {
41 |
42 | /**
43 | * Rotates x left n bits
44 | *
45 | * @langversion ActionScript 3.0
46 | * @playerversion Flash 9.0
47 | * @tiptext
48 | */
49 | public static function rol ( x:int, n:int ):int {
50 | return ( x << n ) | ( x >>> ( 32 - n ) );
51 | }
52 |
53 | /**
54 | * Rotates x right n bits
55 | *
56 | * @langversion ActionScript 3.0
57 | * @playerversion Flash 9.0
58 | * @tiptext
59 | */
60 | public static function ror ( x:int, n:int ):uint {
61 | var nn:int = 32 - n;
62 | return ( x << nn ) | ( x >>> ( 32 - nn ) );
63 | }
64 |
65 | /** String for quick lookup of a hex character based on index */
66 | private static var hexChars:String = "0123456789abcdef";
67 |
68 | /**
69 | * Outputs the hex value of a int, allowing the developer to specify
70 | * the endinaness in the process. Hex output is lowercase.
71 | *
72 | * @param n The int value to output as hex
73 | * @param bigEndian Flag to output the int as big or little endian
74 | * @return A string of length 8 corresponding to the
75 | * hex representation of n ( minus the leading "0x" )
76 | * @langversion ActionScript 3.0
77 | * @playerversion Flash 9.0
78 | * @tiptext
79 | */
80 | public static function toHex( n:int, bigEndian:Boolean = false ):String {
81 | var s:String = "";
82 |
83 | if ( bigEndian ) {
84 | for ( var i:int = 0; i < 4; i++ ) {
85 | s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF )
86 | + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF );
87 | }
88 | } else {
89 | for ( var x:int = 0; x < 4; x++ ) {
90 | s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF )
91 | + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF );
92 | }
93 | }
94 |
95 | return s;
96 | }
97 | }
98 |
99 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/webapis/URLLoaderBase.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.webapis
34 | {
35 | import flash.events.IOErrorEvent;
36 | import flash.events.SecurityErrorEvent;
37 | import flash.events.ProgressEvent;
38 |
39 | import com.adobe.net.DynamicURLLoader;
40 |
41 | /**
42 | * Dispatched when data is
43 | * received as the download operation progresses.
44 | *
45 | * @eventType flash.events.ProgressEvent.PROGRESS
46 | *
47 | * @langversion ActionScript 3.0
48 | * @playerversion Flash 9.0
49 | */
50 | [Event(name="progress", type="flash.events.ProgressEvent")]
51 |
52 | /**
53 | * Dispatched if a call to the server results in a fatal
54 | * error that terminates the download.
55 | *
56 | * @eventType flash.events.IOErrorEvent.IO_ERROR
57 | *
58 | * @langversion ActionScript 3.0
59 | * @playerversion Flash 9.0
60 | */
61 | [Event(name="ioError", type="flash.events.IOErrorEvent")]
62 |
63 | /**
64 | * A securityError event occurs if a call attempts to
65 | * load data from a server outside the security sandbox.
66 | *
67 | * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR
68 | *
69 | * @langversion ActionScript 3.0
70 | * @playerversion Flash 9.0
71 | */
72 | [Event(name="securityError", type="flash.events.SecurityErrorEvent")]
73 |
74 | /**
75 | * Base class for services that utilize URLLoader
76 | * to communicate with remote APIs / Services.
77 | *
78 | * @langversion ActionScript 3.0
79 | * @playerversion Flash 9.0
80 | */
81 | public class URLLoaderBase extends ServiceBase
82 | {
83 | protected function getURLLoader():DynamicURLLoader
84 | {
85 | var loader:DynamicURLLoader = new DynamicURLLoader();
86 | loader.addEventListener("progress", onProgress);
87 | loader.addEventListener("ioError", onIOError);
88 | loader.addEventListener("securityError", onSecurityError);
89 |
90 | return loader;
91 | }
92 |
93 | private function onIOError(event:IOErrorEvent):void
94 | {
95 | dispatchEvent(event);
96 | }
97 |
98 | private function onSecurityError(event:SecurityErrorEvent):void
99 | {
100 | dispatchEvent(event);
101 | }
102 |
103 | private function onProgress(event:ProgressEvent):void
104 | {
105 | dispatchEvent(event);
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/crypto/WSSEUsernameToken.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 | import mx.formatters.DateFormatter;
36 | import mx.utils.Base64Encoder;
37 |
38 | /**
39 | * Web Services Security Username Token
40 | *
41 | * Implementation based on algorithm description at
42 | * http://www.oasis-open.org/committees/wss/documents/WSS-Username-02-0223-merged.pdf
43 | */
44 | public class WSSEUsernameToken
45 | {
46 | /**
47 | * Generates a WSSE Username Token.
48 | *
49 | * @param username The username
50 | * @param password The password
51 | * @param nonce A cryptographically random nonce (if null, the nonce
52 | * will be generated)
53 | * @param timestamp The time at which the token is generated (if null,
54 | * the time will be set to the moment of execution)
55 | * @return The generated token
56 | * @langversion ActionScript 3.0
57 | * @playerversion Flash 9.0
58 | * @tiptext
59 | */
60 | public static function getUsernameToken(username:String, password:String, nonce:String=null, timestamp:Date=null):String
61 | {
62 | if (nonce == null)
63 | {
64 | nonce = generateNonce();
65 | }
66 | nonce = base64Encode(nonce);
67 |
68 | var created:String = generateTimestamp(timestamp);
69 |
70 | var password64:String = getBase64Digest(nonce,
71 | created,
72 | password);
73 |
74 | var token:String = new String("UsernameToken Username=\"");
75 | token += username + "\", " +
76 | "PasswordDigest=\"" + password64 + "\", " +
77 | "Nonce=\"" + nonce + "\", " +
78 | "Created=\"" + created + "\"";
79 | return token;
80 | }
81 |
82 | private static function generateNonce():String
83 | {
84 | // Math.random returns a Number between 0 and 1. We don't want our
85 | // nonce to contain invalid characters (e.g. the period) so we
86 | // strip them out before returning the result.
87 | var s:String = Math.random().toString();
88 | return s.replace(".", "");
89 | }
90 |
91 | internal static function base64Encode(s:String):String
92 | {
93 | var encoder:Base64Encoder = new Base64Encoder();
94 | encoder.encode(s);
95 | return encoder.flush();
96 | }
97 |
98 | internal static function generateTimestamp(timestamp:Date):String
99 | {
100 | if (timestamp == null)
101 | {
102 | timestamp = new Date();
103 | }
104 | var dateFormatter:DateFormatter = new DateFormatter();
105 | dateFormatter.formatString = "YYYY-MM-DDTJJ:NN:SS"
106 | return dateFormatter.format(timestamp) + "Z";
107 | }
108 |
109 | internal static function getBase64Digest(nonce:String, created:String, password:String):String
110 | {
111 | return SHA1.hashToBase64(nonce + created + password);
112 | }
113 | }
114 | }
--------------------------------------------------------------------------------
/filebrowser/templatetags/fb_tags.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | # django imports
4 | from django import template
5 | from django.utils.http import urlquote
6 |
7 | # filebrowser imports
8 | from filebrowser.settings import SELECT_FORMATS
9 |
10 | register = template.Library()
11 |
12 |
13 |
14 |
15 | @register.inclusion_tag('filebrowser/include/_response.html', takes_context=True)
16 | def query_string(context, add=None, remove=None):
17 | """
18 | Allows the addition and removal of query string parameters.
19 |
20 | _response.html is just {{ response }}
21 |
22 | Usage:
23 | http://www.url.com/{% query_string "param_to_add=value, param_to_add=value" "param_to_remove, params_to_remove" %}
24 | http://www.url.com/{% query_string "" "filter" %}filter={{new_filter}}
25 | http://www.url.com/{% query_string "sort=value" "sort" %}
26 | """
27 |
28 | # Written as an inclusion tag to simplify getting the context.
29 | add = string_to_dict(add)
30 | remove = string_to_list(remove)
31 | params = context['query'].copy()
32 | response = get_query_string(params, add, remove)
33 | return {'response': response }
34 |
35 |
36 | def query_helper(query, add=None, remove=None):
37 | """
38 | Helper Function for use within views.
39 | """
40 |
41 | add = string_to_dict(add)
42 | remove = string_to_list(remove)
43 | params = query.copy()
44 | return get_query_string(params, add, remove)
45 |
46 |
47 | def get_query_string(p, new_params=None, remove=None):
48 | """
49 | Add and remove query parameters. From `django.contrib.admin`.
50 | """
51 |
52 | if new_params is None: new_params = {}
53 | if remove is None: remove = []
54 | for r in remove:
55 | for k in p.keys():
56 | #if k.startswith(r):
57 | if k == r:
58 | del p[k]
59 | for k, v in new_params.items():
60 | if k in p and v is None:
61 | del p[k]
62 | elif v is not None:
63 | p[k] = v
64 | return '?' + '&'.join([u'%s=%s' % (urlquote(k), urlquote(v)) for k, v in p.items()])
65 |
66 |
67 | def string_to_dict(string):
68 | """
69 | Usage:
70 | {{ url|thumbnail:"width=10,height=20" }}
71 | {{ url|thumbnail:"width=10" }}
72 | {{ url|thumbnail:"height=20" }}
73 | """
74 |
75 | kwargs = {}
76 | if string:
77 | string = str(string)
78 | if ',' not in string:
79 | # ensure at least one ','
80 | string += ','
81 | for arg in string.split(','):
82 | arg = arg.strip()
83 | if arg == '': continue
84 | kw, val = arg.split('=', 1)
85 | kwargs[kw] = val
86 | return kwargs
87 |
88 |
89 | def string_to_list(string):
90 | """
91 | Usage:
92 | {{ url|thumbnail:"width,height" }}
93 | """
94 |
95 | args = []
96 | if string:
97 | string = str(string)
98 | if ',' not in string:
99 | # ensure at least one ','
100 | string += ','
101 | for arg in string.split(','):
102 | arg = arg.strip()
103 | if arg == '': continue
104 | args.append(arg)
105 | return args
106 |
107 |
108 | class SelectableNode(template.Node):
109 | def __init__(self, filetype, format):
110 | self.filetype = template.Variable(filetype)
111 | self.format = template.Variable(format)
112 |
113 | def render(self, context):
114 | try:
115 | filetype = self.filetype.resolve(context)
116 | except template.VariableDoesNotExist:
117 | filetype = ''
118 | try:
119 | format = self.format.resolve(context)
120 | except template.VariableDoesNotExist:
121 | format = ''
122 | if filetype and format and filetype in SELECT_FORMATS[format]:
123 | selectable = True
124 | elif filetype and format and filetype not in SELECT_FORMATS[format]:
125 | selectable = False
126 | else:
127 | selectable = True
128 | context['selectable'] = selectable
129 | return ''
130 |
131 |
132 | def selectable(parser, token):
133 |
134 | try:
135 | tag, filetype, format = token.split_contents()
136 | except:
137 | raise template.TemplateSyntaxError, "%s tag requires 2 arguments" % token.contents.split()[0]
138 |
139 | return SelectableNode(filetype, format)
140 |
141 | register.tag(selectable)
142 |
143 | @register.simple_tag
144 | def custom_admin_media_prefix():
145 | import django
146 |
147 | from django.conf import settings
148 | return "".join([settings.STATIC_URL,"admin/"])
149 |
150 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/crypto/HMAC.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto {
34 | import flash.utils.ByteArray;
35 | import flash.utils.Endian;
36 | import flash.utils.describeType;
37 | /**
38 | * Keyed-Hashing for Message Authentication
39 | * Implementation based on algorithm description at
40 | * http://www.faqs.org/rfcs/rfc2104.html
41 | */
42 | public class HMAC
43 | {
44 | /**
45 | * Performs the HMAC hash algorithm using byte arrays.
46 | *
47 | * @param secret The secret key
48 | * @param message The message to hash
49 | * @param algorithm Hash object to use
50 | * @return A string containing the hash value of message
51 | * @langversion ActionScript 3.0
52 | * @playerversion Flash 8.5
53 | * @tiptext
54 | */
55 | public static function hash( secret:String, message:String, algorithm:Object = null ):String
56 | {
57 | var text:ByteArray = new ByteArray();
58 | var k_secret:ByteArray = new ByteArray();
59 |
60 | text.writeUTFBytes(message);
61 | k_secret.writeUTFBytes(secret);
62 |
63 | return hashBytes(k_secret, text, algorithm);
64 | }
65 |
66 | /**
67 | * Performs the HMAC hash algorithm using string.
68 | *
69 | * @param secret The secret key
70 | * @param message The message to hash
71 | * @param algorithm Hash object to use
72 | * @return A string containing the hash value of message
73 | * @langversion ActionScript 3.0
74 | * @playerversion Flash 8.5
75 | * @tiptext
76 | */
77 | public static function hashBytes( secret:ByteArray, message:ByteArray, algorithm:Object = null ):String
78 | {
79 | var ipad:ByteArray = new ByteArray();
80 | var opad:ByteArray = new ByteArray();
81 | var endian:String = Endian.BIG_ENDIAN;
82 |
83 | if(algorithm == null){
84 | algorithm = MD5;
85 | }
86 |
87 | if ( describeType(algorithm).@name.toString() == "com.adobe.crypto::MD5" ) {
88 | endian = Endian.LITTLE_ENDIAN;
89 | }
90 |
91 | if ( secret.length > 64 ) {
92 | algorithm.hashBytes(secret);
93 | secret = new ByteArray();
94 | secret.endian = endian;
95 |
96 | while ( algorithm.digest.bytesAvailable != 0 ) {
97 | secret.writeInt(algorithm.digest.readInt());
98 | }
99 | }
100 |
101 | secret.length = 64
102 | secret.position = 0;
103 | for ( var x:int = 0; x < 64; x++ ) {
104 | var byte:int = secret.readByte();
105 | ipad.writeByte(0x36 ^ byte);
106 | opad.writeByte(0x5c ^ byte);
107 | }
108 |
109 | ipad.writeBytes(message);
110 | algorithm.hashBytes(ipad);
111 | var tmp:ByteArray = new ByteArray();
112 | tmp.endian = endian;
113 |
114 | while ( algorithm.digest.bytesAvailable != 0 ) {
115 | tmp.writeInt(algorithm.digest.readInt());
116 | }
117 | tmp.position = 0;
118 |
119 | while ( tmp.bytesAvailable != 0 ) {
120 | opad.writeByte(tmp.readUnsignedByte());
121 | }
122 | return algorithm.hashBytes( opad );
123 | }
124 |
125 | }
126 |
127 | }
128 |
--------------------------------------------------------------------------------
/filebrowser/fields.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | # imports
4 | import os
5 |
6 | # django imports
7 | from django.db import models
8 | from django import forms
9 | from django.forms.widgets import Input
10 | from django.db.models.fields import Field, CharField
11 | from django.utils.encoding import force_unicode
12 | from django.template.loader import render_to_string
13 | from django.utils.translation import ugettext_lazy as _
14 |
15 | # filebrowser imports
16 | from filebrowser.settings import *
17 | from filebrowser.base import FileObject
18 | from filebrowser.functions import url_to_path
19 |
20 |
21 | class FileBrowseWidget(Input):
22 | input_type = 'text'
23 |
24 | class Media:
25 | js = (os.path.join(URL_FILEBROWSER_MEDIA, 'js/AddFileBrowser.js'), )
26 |
27 | def __init__(self, attrs=None):
28 | self.directory = attrs.get('directory', '')
29 | self.extensions = attrs.get('extensions', '')
30 | self.format = attrs.get('format', '')
31 | if attrs is not None:
32 | self.attrs = attrs.copy()
33 | else:
34 | self.attrs = {}
35 |
36 | def render(self, name, value, attrs=None):
37 | if value is None:
38 | value = ""
39 | final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
40 | final_attrs['search_icon'] = URL_FILEBROWSER_MEDIA + 'img/filebrowser_icon_show.gif'
41 | final_attrs['directory'] = self.directory
42 | final_attrs['extensions'] = self.extensions
43 | final_attrs['format'] = self.format
44 | final_attrs['ADMIN_THUMBNAIL'] = ADMIN_THUMBNAIL
45 | final_attrs['DEBUG'] = DEBUG
46 | if value != "":
47 | try:
48 | final_attrs['directory'] = os.path.split(value.path_relative_directory)[0]
49 | except:
50 | pass
51 | return render_to_string("filebrowser/custom_field.html", locals())
52 |
53 |
54 | class FileBrowseFormField(forms.CharField):
55 | widget = FileBrowseWidget
56 |
57 | default_error_messages = {
58 | 'extension': _(u'Extension %(ext)s is not allowed. Only %(allowed)s is allowed.'),
59 | }
60 |
61 | def __init__(self, max_length=None, min_length=None,
62 | directory=None, extensions=None, format=None,
63 | *args, **kwargs):
64 | self.max_length, self.min_length = max_length, min_length
65 | self.directory = directory
66 | self.extensions = extensions
67 | if format:
68 | self.format = format or ''
69 | self.extensions = extensions or EXTENSIONS.get(format)
70 | super(FileBrowseFormField, self).__init__(*args, **kwargs)
71 |
72 | def clean(self, value):
73 | value = super(FileBrowseFormField, self).clean(value)
74 | if value == '':
75 | return value
76 | file_extension = os.path.splitext(value)[1].lower()
77 | if self.extensions and not file_extension in self.extensions:
78 | raise forms.ValidationError(self.error_messages['extension'] % {'ext': file_extension, 'allowed': ", ".join(self.extensions)})
79 | return value
80 |
81 |
82 | class FileBrowseField(Field):
83 | __metaclass__ = models.SubfieldBase
84 |
85 | def __init__(self, *args, **kwargs):
86 | self.directory = kwargs.pop('directory', '')
87 | self.extensions = kwargs.pop('extensions', '')
88 | self.format = kwargs.pop('format', '')
89 | return super(FileBrowseField, self).__init__(*args, **kwargs)
90 |
91 | def to_python(self, value):
92 | if not value or isinstance(value, FileObject):
93 | return value
94 | return FileObject(url_to_path(value))
95 |
96 | def get_db_prep_value(self, value, connection, prepared=False):
97 | if value is None:
98 | return None
99 | return unicode(value)
100 |
101 |
102 | def get_manipulator_field_objs(self):
103 | return [oldforms.TextField]
104 |
105 | def get_internal_type(self):
106 | return "CharField"
107 |
108 | def formfield(self, **kwargs):
109 | attrs = {}
110 | attrs["directory"] = self.directory
111 | attrs["extensions"] = self.extensions
112 | attrs["format"] = self.format
113 | defaults = {
114 | 'form_class': FileBrowseFormField,
115 | 'widget': FileBrowseWidget(attrs=attrs),
116 | 'directory': self.directory,
117 | 'extensions': self.extensions,
118 | 'format': self.format
119 | }
120 | defaults.update(kwargs)
121 | return super(FileBrowseField, self).formfield(**defaults)
122 |
123 | try:
124 | from south.modelsinspector import add_introspection_rules
125 | add_introspection_rules([], ["^filebrowser\.fields\.FileBrowseField"])
126 | except:
127 | pass
128 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/net/URIEncodingBitmap.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.net
34 | {
35 | import flash.utils.ByteArray;
36 |
37 | /**
38 | * This class implements an efficient lookup table for URI
39 | * character escaping. This class is only needed if you
40 | * create a derived class of URI to handle custom URI
41 | * syntax. This class is used internally by URI.
42 | *
43 | * @langversion ActionScript 3.0
44 | * @playerversion Flash 9.0*
45 | */
46 | public class URIEncodingBitmap extends ByteArray
47 | {
48 | /**
49 | * Constructor. Creates an encoding bitmap using the given
50 | * string of characters as the set of characters that need
51 | * to be URI escaped.
52 | *
53 | * @langversion ActionScript 3.0
54 | * @playerversion Flash 9.0
55 | */
56 | public function URIEncodingBitmap(charsToEscape:String) : void
57 | {
58 | var i:int;
59 | var data:ByteArray = new ByteArray();
60 |
61 | // Initialize our 128 bits (16 bytes) to zero
62 | for (i = 0; i < 16; i++)
63 | this.writeByte(0);
64 |
65 | data.writeUTFBytes(charsToEscape);
66 | data.position = 0;
67 |
68 | while (data.bytesAvailable)
69 | {
70 | var c:int = data.readByte();
71 |
72 | if (c > 0x7f)
73 | continue; // only escape low bytes
74 |
75 | var enc:int;
76 | this.position = (c >> 3);
77 | enc = this.readByte();
78 | enc |= 1 << (c & 0x7);
79 | this.position = (c >> 3);
80 | this.writeByte(enc);
81 | }
82 | }
83 |
84 | /**
85 | * Based on the data table contained in this object, check
86 | * if the given character should be escaped.
87 | *
88 | * @param char the character to be escaped. Only the first
89 | * character in the string is used. Any other characters
90 | * are ignored.
91 | *
92 | * @return the integer value of the raw UTF8 character. For
93 | * example, if '%' is given, the return value is 37 (0x25).
94 | * If the character given does not need to be escaped, the
95 | * return value is zero.
96 | *
97 | * @langversion ActionScript 3.0
98 | * @playerversion Flash 9.0
99 | */
100 | public function ShouldEscape(char:String) : int
101 | {
102 | var data:ByteArray = new ByteArray();
103 | var c:int, mask:int;
104 |
105 | // write the character into a ByteArray so
106 | // we can pull it out as a raw byte value.
107 | data.writeUTFBytes(char);
108 | data.position = 0;
109 | c = data.readByte();
110 |
111 | if (c & 0x80)
112 | {
113 | // don't escape high byte characters. It can make international
114 | // URI's unreadable. We just want to escape characters that would
115 | // make URI syntax ambiguous.
116 | return 0;
117 | }
118 | else if ((c < 0x1f) || (c == 0x7f))
119 | {
120 | // control characters must be escaped.
121 | return c;
122 | }
123 |
124 | this.position = (c >> 3);
125 | mask = this.readByte();
126 |
127 | if (mask & (1 << (c & 0x7)))
128 | {
129 | // we need to escape this, return the numeric value
130 | // of the character
131 | return c;
132 | }
133 | else
134 | {
135 | return 0;
136 | }
137 | }
138 | }
139 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/utils/XMLUtil.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 |
36 | public class XMLUtil
37 | {
38 | /**
39 | * Constant representing a text node type returned from XML.nodeKind.
40 | *
41 | * @see XML.nodeKind()
42 | *
43 | * @langversion ActionScript 3.0
44 | * @playerversion Flash 9.0
45 | */
46 | public static const TEXT:String = "text";
47 |
48 | /**
49 | * Constant representing a comment node type returned from XML.nodeKind.
50 | *
51 | * @see XML.nodeKind()
52 | *
53 | * @langversion ActionScript 3.0
54 | * @playerversion Flash 9.0
55 | */
56 | public static const COMMENT:String = "comment";
57 |
58 | /**
59 | * Constant representing a processing instruction type returned from XML.nodeKind.
60 | *
61 | * @see XML.nodeKind()
62 | *
63 | * @langversion ActionScript 3.0
64 | * @playerversion Flash 9.0
65 | */
66 | public static const PROCESSING_INSTRUCTION:String = "processing-instruction";
67 |
68 | /**
69 | * Constant representing an attribute type returned from XML.nodeKind.
70 | *
71 | * @see XML.nodeKind()
72 | *
73 | * @langversion ActionScript 3.0
74 | * @playerversion Flash 9.0
75 | */
76 | public static const ATTRIBUTE:String = "attribute";
77 |
78 | /**
79 | * Constant representing a element type returned from XML.nodeKind.
80 | *
81 | * @see XML.nodeKind()
82 | *
83 | * @langversion ActionScript 3.0
84 | * @playerversion Flash 9.0
85 | */
86 | public static const ELEMENT:String = "element";
87 |
88 | /**
89 | * Checks whether the specified string is valid and well formed XML.
90 | *
91 | * @param data The string that is being checked to see if it is valid XML.
92 | *
93 | * @return A Boolean value indicating whether the specified string is
94 | * valid XML.
95 | *
96 | * @langversion ActionScript 3.0
97 | * @playerversion Flash 9.0
98 | */
99 | public static function isValidXML(data:String):Boolean
100 | {
101 | var xml:XML;
102 |
103 | try
104 | {
105 | xml = new XML(data);
106 | }
107 | catch(e:Error)
108 | {
109 | return false;
110 | }
111 |
112 | if(xml.nodeKind() != XMLUtil.ELEMENT)
113 | {
114 | return false;
115 | }
116 |
117 | return true;
118 | }
119 |
120 | /**
121 | * Returns the next sibling of the specified node relative to the node's parent.
122 | *
123 | * @param x The node whose next sibling will be returned.
124 | *
125 | * @return The next sibling of the node. null if the node does not have
126 | * a sibling after it, or if the node has no parent.
127 | *
128 | * @langversion ActionScript 3.0
129 | * @playerversion Flash 9.0
130 | */
131 | public static function getNextSibling(x:XML):XML
132 | {
133 | return XMLUtil.getSiblingByIndex(x, 1);
134 | }
135 |
136 | /**
137 | * Returns the sibling before the specified node relative to the node's parent.
138 | *
139 | * @param x The node whose sibling before it will be returned.
140 | *
141 | * @return The sibling before the node. null if the node does not have
142 | * a sibling before it, or if the node has no parent.
143 | *
144 | * @langversion ActionScript 3.0
145 | * @playerversion Flash 9.0
146 | */
147 | public static function getPreviousSibling(x:XML):XML
148 | {
149 | return XMLUtil.getSiblingByIndex(x, -1);
150 | }
151 |
152 | protected static function getSiblingByIndex(x:XML, count:int):XML
153 | {
154 | var out:XML;
155 |
156 | try
157 | {
158 | out = x.parent().children()[x.childIndex() + count];
159 | }
160 | catch(e:Error)
161 | {
162 | return null;
163 | }
164 |
165 | return out;
166 | }
167 | }
168 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/images/PNGEncoder.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.images
33 | {
34 | import flash.geom.*;
35 | import flash.display.Bitmap;
36 | import flash.display.BitmapData;
37 | import flash.utils.ByteArray;
38 |
39 | /**
40 | * Class that converts BitmapData into a valid PNG
41 | */
42 | public class PNGEncoder
43 | {
44 | /**
45 | * Created a PNG image from the specified BitmapData
46 | *
47 | * @param image The BitmapData that will be converted into the PNG format.
48 | * @return a ByteArray representing the PNG encoded image data.
49 | * @langversion ActionScript 3.0
50 | * @playerversion Flash 9.0
51 | * @tiptext
52 | */
53 | public static function encode(img:BitmapData):ByteArray {
54 | // Create output byte array
55 | var png:ByteArray = new ByteArray();
56 | // Write PNG signature
57 | png.writeUnsignedInt(0x89504e47);
58 | png.writeUnsignedInt(0x0D0A1A0A);
59 | // Build IHDR chunk
60 | var IHDR:ByteArray = new ByteArray();
61 | IHDR.writeInt(img.width);
62 | IHDR.writeInt(img.height);
63 | IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA
64 | IHDR.writeByte(0);
65 | writeChunk(png,0x49484452,IHDR);
66 | // Build IDAT chunk
67 | var IDAT:ByteArray= new ByteArray();
68 | for(var i:int=0;i < img.height;i++) {
69 | // no filter
70 | IDAT.writeByte(0);
71 | var p:uint;
72 | var j:int;
73 | if ( !img.transparent ) {
74 | for(j=0;j < img.width;j++) {
75 | p = img.getPixel(j,i);
76 | IDAT.writeUnsignedInt(
77 | uint(((p&0xFFFFFF) << 8)|0xFF));
78 | }
79 | } else {
80 | for(j=0;j < img.width;j++) {
81 | p = img.getPixel32(j,i);
82 | IDAT.writeUnsignedInt(
83 | uint(((p&0xFFFFFF) << 8)|
84 | (p>>>24)));
85 | }
86 | }
87 | }
88 | IDAT.compress();
89 | writeChunk(png,0x49444154,IDAT);
90 | // Build IEND chunk
91 | writeChunk(png,0x49454E44,null);
92 | // return PNG
93 | return png;
94 | }
95 |
96 | private static var crcTable:Array;
97 | private static var crcTableComputed:Boolean = false;
98 |
99 | private static function writeChunk(png:ByteArray,
100 | type:uint, data:ByteArray):void {
101 | if (!crcTableComputed) {
102 | crcTableComputed = true;
103 | crcTable = [];
104 | var c:uint;
105 | for (var n:uint = 0; n < 256; n++) {
106 | c = n;
107 | for (var k:uint = 0; k < 8; k++) {
108 | if (c & 1) {
109 | c = uint(uint(0xedb88320) ^
110 | uint(c >>> 1));
111 | } else {
112 | c = uint(c >>> 1);
113 | }
114 | }
115 | crcTable[n] = c;
116 | }
117 | }
118 | var len:uint = 0;
119 | if (data != null) {
120 | len = data.length;
121 | }
122 | png.writeUnsignedInt(len);
123 | var p:uint = png.position;
124 | png.writeUnsignedInt(type);
125 | if ( data != null ) {
126 | png.writeBytes(data);
127 | }
128 | var e:uint = png.position;
129 | png.position = p;
130 | c = 0xffffffff;
131 | for (var i:int = 0; i < (e-p); i++) {
132 | c = uint(crcTable[
133 | (c ^ png.readUnsignedByte()) &
134 | uint(0xff)] ^ uint(c >>> 8));
135 | }
136 | c = uint(c^uint(0xffffffff));
137 | png.position = e;
138 | png.writeUnsignedInt(c);
139 | }
140 | }
141 | }
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/uploadify/com/adobe/utils/ArrayUtil.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 |
36 | /**
37 | * Class that contains static utility methods for manipulating and working
38 | * with Arrays.
39 | *
40 | * Note that all APIs assume that they are working with well formed arrays.
41 | * i.e. they will only manipulate indexed values.
42 | *
43 | * @langversion ActionScript 3.0
44 | * @playerversion Flash 9.0
45 | * @tiptext
46 | */
47 | public class ArrayUtil
48 | {
49 |
50 | /**
51 | * Determines whether the specified array contains the specified value.
52 | *
53 | * @param arr The array that will be checked for the specified value.
54 | *
55 | * @param value The object which will be searched for within the array
56 | *
57 | * @return True if the array contains the value, False if it does not.
58 | *
59 | * @langversion ActionScript 3.0
60 | * @playerversion Flash 9.0
61 | * @tiptext
62 | */
63 | public static function arrayContainsValue(arr:Array, value:Object):Boolean
64 | {
65 | return (arr.indexOf(value) != -1);
66 | }
67 |
68 | /**
69 | * Remove all instances of the specified value from the array,
70 | *
71 | * @param arr The array from which the value will be removed
72 | *
73 | * @param value The object that will be removed from the array.
74 | *
75 | * @langversion ActionScript 3.0
76 | * @playerversion Flash 9.0
77 | * @tiptext
78 | */
79 | public static function removeValueFromArray(arr:Array, value:Object):void
80 | {
81 | var len:uint = arr.length;
82 |
83 | for(var i:Number = len; i > -1; i--)
84 | {
85 | if(arr[i] === value)
86 | {
87 | arr.splice(i, 1);
88 | }
89 | }
90 | }
91 |
92 | /**
93 | * Create a new array that only contains unique instances of objects
94 | * in the specified array.
95 | *
96 | * Basically, this can be used to remove duplication object instances
97 | * from an array
98 | *
99 | * @param arr The array which contains the values that will be used to
100 | * create the new array that contains no duplicate values.
101 | *
102 | * @return A new array which only contains unique items from the specified
103 | * array.
104 | *
105 | * @langversion ActionScript 3.0
106 | * @playerversion Flash 9.0
107 | * @tiptext
108 | */
109 | public static function createUniqueCopy(a:Array):Array
110 | {
111 | var newArray:Array = new Array();
112 |
113 | var len:Number = a.length;
114 | var item:Object;
115 |
116 | for (var i:uint = 0; i < len; ++i)
117 | {
118 | item = a[i];
119 |
120 | if(ArrayUtil.arrayContainsValue(newArray, item))
121 | {
122 | continue;
123 | }
124 |
125 | newArray.push(item);
126 | }
127 |
128 | return newArray;
129 | }
130 |
131 | /**
132 | * Creates a copy of the specified array.
133 | *
134 | * Note that the array returned is a new array but the items within the
135 | * array are not copies of the items in the original array (but rather
136 | * references to the same items)
137 | *
138 | * @param arr The array that will be copies
139 | *
140 | * @return A new array which contains the same items as the array passed
141 | * in.
142 | *
143 | * @langversion ActionScript 3.0
144 | * @playerversion Flash 9.0
145 | * @tiptext
146 | */
147 | public static function copyArray(arr:Array):Array
148 | {
149 | return arr.slice();
150 | }
151 |
152 | /**
153 | * Compares two arrays and returns a boolean indicating whether the arrays
154 | * contain the same values at the same indexes.
155 | *
156 | * @param arr1 The first array that will be compared to the second.
157 | *
158 | * @param arr2 The second array that will be compared to the first.
159 | *
160 | * @return True if the arrays contains the same values at the same indexes.
161 | False if they do not.
162 | *
163 | * @langversion ActionScript 3.0
164 | * @playerversion Flash 9.0
165 | * @tiptext
166 | */
167 | public static function arraysAreEqual(arr1:Array, arr2:Array):Boolean
168 | {
169 | if(arr1.length != arr2.length)
170 | {
171 | return false;
172 | }
173 |
174 | var len:Number = arr1.length;
175 |
176 | for(var i:Number = 0; i < len; i++)
177 | {
178 | if(arr1[i] !== arr2[i])
179 | {
180 | return false;
181 | }
182 | }
183 |
184 | return true;
185 | }
186 | }
187 | }
188 |
--------------------------------------------------------------------------------
/filebrowser/static/filebrowser/css/filebrowser.css:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | /* Filebrowser Table
5 | ------------------------------------------------------------------------------------------------------ */
6 |
7 | .filebrowser table td {
8 | font-size: 10px;
9 | }
10 | .filebrowser table a {
11 | font-size: 11px;
12 | }
13 | .filebrowser thead th.sorted a {
14 | padding-right: 13px;
15 | }
16 | .filebrowser thead th.filename {
17 | min-width: 160px;
18 | }
19 | .filebrowser td {
20 | padding: 9px 10px 6px 10px !important;
21 | }
22 | /*.filebrowser tr.fb_folder {
23 | background: #e8e8e8;
24 | background: -moz-linear-gradient(top, #ededed, #e8e8e8);
25 | background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#e8e8e8));
26 | }
27 | .filebrowser tr.fb_folder td {
28 | border-top-color: #fff !important;
29 | background: transparent !important;
30 | }*/
31 | .filebrowser td.fb_thumbnail {
32 | line-height: 11px;
33 | padding-bottom: 0 !important;
34 | }
35 |
36 |
37 |
38 | /* Filebrowser Buttons & Links
39 | ------------------------------------------------------------------------------------------------------ */
40 |
41 | span.fb_type {
42 | display: inline-block;
43 | margin: 0 0;
44 | padding: 1px 0;
45 | color: #999;
46 | font-size: 11px;
47 | font-weight: bold;
48 | font-style: italic;
49 | border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;
50 | }
51 | span.fb_type.folder {
52 | color: #666;
53 | font-weight: bold;
54 | }
55 |
56 |
57 | /* Filebrowser Show-Preview-Link & Show-Versions-Link (uses Grappellis a.internal) ......................................... */
58 |
59 | .filebrowser a.fb_showpreview,
60 | .filebrowser a.fb_showversions {
61 | display: block;
62 | margin-top: 8px;
63 | padding-left: 8px;
64 | line-height: 20px;
65 | white-space: nowrap;
66 | background-position: 0 50%;
67 | }
68 | .filebrowser a.fb_showpreview {
69 | float: left;
70 | }
71 | .filebrowser a.fb_showversions {
72 | float: left; // This is left because we arent using previews right now
73 | }
74 | .filebrowser a.fb_showversions {
75 | padding-left: 25px;
76 |
77 | background: 0 50% no-repeat scroll;
78 | }
79 | a.fb_showversions:link, a.fb_showversions:visited {
80 | background-image: url('../img/filebrowser_icon_showversions.gif');
81 | }
82 | a.fb_showversions:hover, a.fb_showversions:active {
83 | background-image: url('../img/filebrowser_icon_showversions_hover.gif');
84 | }
85 | .filebrowser a.fb_showpreview {
86 | padding-left: 16px;
87 | background: 0 50% no-repeat scroll;
88 | }
89 | a.fb_showpreview:link, a.fb_showpreview:visited {
90 | background-image: url('../img/icon-fb-preview.png');
91 | }
92 | a.fb_showpreview:hover, a.fb_showpreview:active {
93 | background-image: url('../img/icon-fb-preview-hover.png');
94 | }
95 |
96 |
97 | /* Filebrowser View-Link (contains thumbnail) & Select-Link......................................... */
98 |
99 | a.fb_viewlink,
100 | button.fb_selectlink {
101 | position: relative;
102 | top: -4px !important;
103 | margin-bottom: -5px !important;
104 | }
105 | button.fb_selectlink {
106 | padding-top: 3px;
107 | padding-bottom: 4px;
108 | height: 24px;
109 | font-size: 11px;
110 | }
111 | @media screen and (-webkit-min-device-pixel-ratio:0) {
112 | button.fb_selectlink {
113 | padding-top: 4px;
114 | }
115 | }
116 |
117 |
118 | /* Filebrowser Image Preview ......................................... */
119 |
120 | .filebrowser .fb_preview_container {
121 | display: none;
122 | position: absolute;
123 | z-index: 1000;
124 | margin-top: 25px;
125 | padding: 5px 5px 1px;
126 | border: 1px solid #bdbdbd;
127 | border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
128 | background: #fff;
129 | box-shadow: 0 10px 50px #333; -moz-box-shadow: 0 10px 50px #333; -webkit-box-shadow: 0 10px 50px #333;
130 | }
131 | /*.filebrowser img.fb_preview {
132 | max-width: 400px;
133 | max-height: 400px;
134 | }*/
135 |
136 | a.fb_view_image span {
137 | display: none;
138 | position: absolute;
139 | top: 1px;
140 | right: 0;
141 | padding: 5px 10px 5px 20px;
142 | width: auto;
143 | line-height: 11px;
144 | font-weight: bold;
145 | border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
146 | }
147 | a.fb_view_image:hover span {
148 | display: block;
149 | color: #83c3d9;
150 | background: #fff url('../img/icon-fb-view-image-hover.png') 8px 7px no-repeat scroll;
151 | }
152 |
153 |
154 |
155 | /* Filebrowser Pulldown Actions
156 | ------------------------------------------------------------------------------------------------------ */
157 |
158 | .pulldown-actions-container {
159 | position: relative;
160 | }
161 | .pulldown-actions-handler {
162 | display: block;
163 | width: 27px;
164 | height: 17px;
165 | background: transparent 50% 50% no-repeat scroll;
166 | }
167 | .pulldown-actions-handler:link, .pulldown-actions-handler:visited {
168 | background-image: url('../img/icon-pulldown-actions.png');
169 | }
170 | .pulldown-actions-handler:hover, .pulldown-actions-handler:active {
171 | background-image: url('../img/icon-pulldown-actions-hover.png');
172 | }
173 | .open .pulldown-actions-handler {
174 | background-image: url('../img/icon-pulldown-actions-active.png');
175 | }
176 | ul.pulldown-actions {
177 | display: none;
178 | }
179 | .open ul.pulldown-actions {
180 | display: block;
181 | position: absolute;
182 | right: 0;
183 | z-index: 1000;
184 | margin: 3px 0 0;
185 | padding: 0;
186 | border: 1px solid #ccc;
187 | border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
188 | background: #eee;
189 | box-shadow: 0 0 50px #333; -moz-box-shadow: 0 0 50px #333; -webkit-box-shadow: 0 0 50px #333;
190 | }
191 | ul.pulldown-actions li {
192 | border-top: 1px solid #fff;
193 | border-bottom: 1px solid #d4d4d4;
194 | }
195 | ul.pulldown-actions li:first-child {
196 | border-top: 0;
197 | }
198 | ul.pulldown-actions li:last-child {
199 | border-bottom: 0;
200 | }
201 | ul.pulldown-actions a {
202 | display: block;
203 | padding: 5px 30px 5px 10px;
204 | font-weight: bold;
205 | white-space: nowrap;
206 | }
--------------------------------------------------------------------------------
/filebrowser/templates/filebrowser/upload.html:
--------------------------------------------------------------------------------
1 | {% extends "admin/base_site.html" %}
2 |
3 |
4 | {% load i18n fb_tags %}
5 |
6 |
7 | {% block extrastyle %}
8 | {{ block.super }}
9 |
10 |
11 |
12 | {% endblock %}
13 |
14 |
15 | {% block extrahead %}
16 | {{ block.super }}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
67 | {% endblock %}
68 |
69 |
70 | {% block bodyclass %}change-form filebrowser{% if query.pop %} popup{% endif %}{% endblock %}
71 | {% block content-class %}content-flexible{% endblock %}
72 |
73 |
74 | {% block breadcrumbs %}{% include "filebrowser/include/breadcrumbs.html" %}{% endblock %}
75 |
76 |
77 | {% block content %}
78 |
79 |
116 |
117 | {% endblock %}
118 |
--------------------------------------------------------------------------------
/filebrowser/settings.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | # imports
4 | import os
5 |
6 | # django imports
7 | from django.conf import settings
8 | from django.utils.translation import ugettext_lazy as _
9 |
10 | # settings for django-tinymce
11 | try:
12 | import tinymce.settings
13 | DEFAULT_URL_TINYMCE = tinymce.settings.JS_BASE_URL + '/'
14 | DEFAULT_PATH_TINYMCE = tinymce.settings.JS_ROOT + '/'
15 | except ImportError:
16 | import posixpath
17 | DEFAULT_URL_TINYMCE = getattr(settings, 'ADMIN_MEDIA_PREFIX',
18 | posixpath.join(settings.STATIC_URL, 'admin/')) + "tinymce/jscripts/tiny_mce/"
19 | DEFAULT_PATH_TINYMCE = os.path.join(settings.MEDIA_ROOT, 'admin/tinymce/jscripts/tiny_mce/')
20 |
21 | # Set to True in order to see the FileObject when Browsing.
22 | DEBUG = getattr(settings, "FILEBROWSER_DEBUG", False)
23 |
24 | # Main Media Settings
25 | MEDIA_ROOT = getattr(settings, "FILEBROWSER_MEDIA_ROOT", settings.MEDIA_ROOT)
26 | MEDIA_URL = getattr(settings, "FILEBROWSER_MEDIA_URL", settings.MEDIA_URL)
27 |
28 | # Main FileBrowser Directory. This has to be a directory within MEDIA_ROOT.
29 | # Leave empty in order to browse all files under MEDIA_ROOT.
30 | # DO NOT USE A SLASH AT THE BEGINNING, DO NOT FORGET THE TRAILING SLASH AT THE END.
31 | DIRECTORY = getattr(settings, "FILEBROWSER_DIRECTORY", 'uploads/')
32 |
33 | # The URL/PATH to your filebrowser media-files.
34 | URL_FILEBROWSER_MEDIA = getattr(settings, "FILEBROWSER_URL_FILEBROWSER_MEDIA", os.path.join(settings.STATIC_URL, 'filebrowser/'))
35 | PATH_FILEBROWSER_MEDIA = getattr(settings, "FILEBROWSER_PATH_FILEBROWSER_MEDIA", os.path.join(settings.STATIC_ROOT, 'filebrowser/'))
36 |
37 | # The URL/PATH to your TinyMCE Installation.
38 | URL_TINYMCE = getattr(settings, "FILEBROWSER_URL_TINYMCE", DEFAULT_URL_TINYMCE)
39 | PATH_TINYMCE = getattr(settings, "FILEBROWSER_PATH_TINYMCE", DEFAULT_PATH_TINYMCE)
40 |
41 | # Allowed Extensions for File Upload. Lower case is important.
42 | # Please be aware that there are Icons for the default extension settings.
43 | # Therefore, if you add a category (e.g. "Misc"), you won't get an icon.
44 | EXTENSIONS = getattr(settings, "FILEBROWSER_EXTENSIONS", {
45 | 'Folder': [''],
46 | 'Image': ['.jpg','.jpeg','.gif','.png','.tif','.tiff'],
47 | 'Video': ['.mov','.wmv','.mpeg','.mpg','.avi','.rm'],
48 | 'Document': ['.pdf','.doc','.rtf','.txt','.xls','.csv'],
49 | 'Audio': ['.mp3','.mp4','.wav','.aiff','.midi','.m4p'],
50 | 'Code': ['.html','.py','.js','.css']
51 | })
52 |
53 | # Define different formats for allowed selections.
54 | # This has to be a subset of EXTENSIONS.
55 | SELECT_FORMATS = getattr(settings, "FILEBROWSER_SELECT_FORMATS", {
56 | 'File': ['Folder','Document',],
57 | 'Image': ['Image'],
58 | 'Media': ['Video','Sound'],
59 | 'Document': ['Document'],
60 | # for TinyMCE we can also define lower-case items
61 | 'image': ['Image'],
62 | 'file': ['Folder','Image','Document',],
63 | 'media': ['Video','Sound'],
64 | })
65 |
66 | # Directory to Save Image Versions (and Thumbnails). Relative to MEDIA_ROOT.
67 | # If no directory is given, versions are stored within the Image directory.
68 | # VERSION URL: VERSIONS_BASEDIR/original_path/originalfilename_versionsuffix.extension
69 | VERSIONS_BASEDIR = getattr(settings, 'FILEBROWSER_VERSIONS_BASEDIR', '')
70 | # Versions Format. Available Attributes: verbose_name, width, height, opts
71 | VERSIONS = getattr(settings, "FILEBROWSER_VERSIONS", {
72 | 'fb_thumb': {'verbose_name': 'Admin Thumbnail', 'width': 60, 'height': 60, 'opts': 'crop upscale'},
73 | 'thumbnail': {'verbose_name': 'Thumbnail (140px)', 'width': 140, 'height': '', 'opts': ''},
74 | 'small': {'verbose_name': 'Small (300px)', 'width': 300, 'height': '', 'opts': ''},
75 | 'medium': {'verbose_name': 'Medium (460px)', 'width': 460, 'height': '', 'opts': ''},
76 | 'big': {'verbose_name': 'Big (620px)', 'width': 620, 'height': '', 'opts': ''},
77 | 'cropped': {'verbose_name': 'Cropped (60x60px)', 'width': 60, 'height': 60, 'opts': 'crop'},
78 | 'croppedthumbnail': {'verbose_name': 'Cropped Thumbnail (140x140px)', 'width': 140, 'height': 140, 'opts': 'crop'},
79 | })
80 | # Versions available within the Admin-Interface.
81 | ADMIN_VERSIONS = getattr(settings, 'FILEBROWSER_ADMIN_VERSIONS', ['thumbnail','small', 'medium','big'])
82 | # Which Version should be used as Admin-thumbnail.
83 | ADMIN_THUMBNAIL = getattr(settings, 'FILEBROWSER_ADMIN_THUMBNAIL', 'fb_thumb')
84 | # Preview Version
85 | PREVIEW_VERSION = getattr(settings, 'FILEBROWSER_PREVIEW_VERSION', 'small')
86 |
87 | # EXTRA SETTINGS
88 | # True to save the URL including MEDIA_URL to your model fields
89 | # or False (default) to save path relative to MEDIA_URL.
90 | # Note: Full URL does not necessarily means absolute URL.
91 | SAVE_FULL_URL = getattr(settings, "FILEBROWSER_SAVE_FULL_URL", True)
92 | # If set to True, the FileBrowser will not try to import a mis-installed PIL.
93 | STRICT_PIL = getattr(settings, 'FILEBROWSER_STRICT_PIL', False)
94 | # PIL's Error "Suspension not allowed here" work around:
95 | # s. http://mail.python.org/pipermail/image-sig/1999-August/000816.html
96 | IMAGE_MAXBLOCK = getattr(settings, 'FILEBROWSER_IMAGE_MAXBLOCK', 1024*1024)
97 | # Exclude files matching any of the following regular expressions
98 | # Default is to exclude 'thumbnail' style naming of image-thumbnails.
99 | EXTENSION_LIST = []
100 | for exts in EXTENSIONS.values():
101 | EXTENSION_LIST += exts
102 | EXCLUDE = getattr(settings, 'FILEBROWSER_EXCLUDE', (r'_(%(exts)s)_.*_q\d{1,3}\.(%(exts)s)' % {'exts': ('|'.join(EXTENSION_LIST))},))
103 | # Max. Upload Size in Bytes.
104 | MAX_UPLOAD_SIZE = getattr(settings, "FILEBROWSER_MAX_UPLOAD_SIZE", 10485760)
105 | # Convert Filename (replace spaces and convert to lowercase)
106 | CONVERT_FILENAME = getattr(settings, "FILEBROWSER_CONVERT_FILENAME", True)
107 | # Max. Entries per Page
108 | # Loading a Sever-Directory with lots of files might take a while
109 | # Use this setting to limit the items shown
110 | LIST_PER_PAGE = getattr(settings, "FILEBROWSER_LIST_PER_PAGE", 50)
111 | # Default Sorting
112 | # Options: date, filesize, filename_lower, filetype_checked
113 | DEFAULT_SORTING_BY = getattr(settings, "FILEBROWSER_DEFAULT_SORTING_BY", "date")
114 | # Sorting Order: asc, desc
115 | DEFAULT_SORTING_ORDER = getattr(settings, "FILEBROWSER_DEFAULT_SORTING_ORDER", "desc")
116 |
117 | # regex to clean dir names before creation (no use!)
118 | # SECURITY re for test name new dirs or file name
119 | # FILE_AND_DIRS_NAME_REGEXP
120 | FOLDER_REGEX = getattr(settings, "FILEBROWSER_FOLDER_REGEX", r'^[ \w-][ \w.-]*$')
121 |
122 | # EXTRA TRANSLATION STRINGS
123 | # The following strings are not availabe within views or templates
124 | _('Folder')
125 | _('Image')
126 | _('Video')
127 | _('Document')
128 | _('Audio')
129 | _('Code')
130 |
131 |
132 |
--------------------------------------------------------------------------------
/filebrowser/base.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | # imports
4 | import os, re, datetime
5 | from time import gmtime, strftime
6 |
7 | # django imports
8 | from django.conf import settings
9 |
10 | # filebrowser imports
11 | from filebrowser.settings import *
12 | from filebrowser.conf import fb_settings
13 | from filebrowser.functions import get_file_type, url_join, is_selectable, get_version_path
14 | from django.utils.encoding import force_unicode
15 |
16 | # PIL import
17 | if STRICT_PIL:
18 | from PIL import Image
19 | else:
20 | try:
21 | from PIL import Image
22 | except ImportError:
23 | import Image
24 |
25 |
26 | class FileObject(object):
27 | """
28 | The FileObject represents a File on the Server.
29 |
30 | PATH has to be relative to MEDIA_ROOT.
31 | """
32 |
33 | def __init__(self, path):
34 | '''
35 | `os.path.split` Split the pathname path into a pair, (head, tail) where tail is the last pathname component and head is everything leading up to that. The tail part will never contain a slash; if path ends in a slash, tail will be empty. If there is no slash in path, head will be empty. If path is empty, both head and tail are empty.
36 | '''
37 | self.path = path
38 | self.url_rel = path.replace("\\","/")
39 | self.head, self.filename = os.path.split(path)
40 | self.filename_lower = self.filename.lower() # important for sorting
41 | self.filetype = get_file_type(self.filename) # strange if file no extension then this folder
42 |
43 | def _filesize(self):
44 | """
45 | Filesize.
46 | """
47 | path = force_unicode(self.path)
48 | if os.path.isfile(os.path.join(fb_settings.MEDIA_ROOT, path)) or os.path.isdir(os.path.join(fb_settings.MEDIA_ROOT, path)):
49 | return os.path.getsize(os.path.join(fb_settings.MEDIA_ROOT, path))
50 | return ""
51 | filesize = property(_filesize)
52 |
53 | def _date(self):
54 | """
55 | Date.
56 | """
57 | if os.path.isfile(os.path.join(fb_settings.MEDIA_ROOT, self.path)) or os.path.isdir(os.path.join(fb_settings.MEDIA_ROOT, self.path)):
58 | return os.path.getmtime(os.path.join(fb_settings.MEDIA_ROOT, self.path))
59 | return ""
60 | date = property(_date)
61 |
62 | def _datetime(self):
63 | """
64 | Datetime Object.
65 | """
66 | return datetime.datetime.fromtimestamp(self.date)
67 | datetime = property(_datetime)
68 |
69 | def _extension(self):
70 | """
71 | Extension.
72 | """
73 | return u"%s" % os.path.splitext(self.filename)[1]
74 | extension = property(_extension)
75 |
76 | def _filetype_checked(self):
77 | if self.filetype == "Folder" and os.path.isdir(self.path_full):
78 | return self.filetype
79 | elif self.filetype != "Folder" and os.path.isfile(self.path_full):
80 | return self.filetype
81 | else:
82 | return ""
83 | filetype_checked = property(_filetype_checked)
84 |
85 | def _path_full(self):
86 | """
87 | Full server PATH including MEDIA_ROOT.
88 | """
89 | return os.path.join(fb_settings.MEDIA_ROOT, self.path)
90 | path_full = property(_path_full)
91 |
92 | def _path_relative(self):
93 | return self.path
94 | path_relative = property(_path_relative)
95 |
96 | def _path_relative_directory(self):
97 | """
98 | Path relative to initial directory.
99 | """
100 | directory_re = re.compile(r'^(%s)' % (fb_settings.DIRECTORY))
101 | value = directory_re.sub('', self.path)
102 | return u"%s" % value
103 | path_relative_directory = property(_path_relative_directory)
104 |
105 | def _url_relative(self):
106 | return self.url_rel
107 | url_relative = property(_url_relative)
108 |
109 | def _url_full(self):
110 | """
111 | Full URL including MEDIA_URL.
112 | """
113 | return force_unicode(url_join(fb_settings.MEDIA_URL, self.url_rel))
114 | url_full = property(_url_full)
115 |
116 | def _url_save(self):
117 | """
118 | URL used for the filebrowsefield.
119 | """
120 | if SAVE_FULL_URL:
121 | return self.url_full
122 | else:
123 | return self.url_rel
124 | url_save = property(_url_save)
125 |
126 | def _url_thumbnail(self):
127 | """
128 | Thumbnail URL.
129 | """
130 | if self.filetype == "Image":
131 | return u"%s" % url_join(fb_settings.MEDIA_URL, get_version_path(self.path, ADMIN_THUMBNAIL))
132 | else:
133 | return ""
134 | url_thumbnail = property(_url_thumbnail)
135 |
136 | def url_admin(self):
137 | if self.filetype_checked == "Folder":
138 | directory_re = re.compile(r'^(%s)' % (fb_settings.DIRECTORY))
139 | value = directory_re.sub('', self.path)
140 | return u"%s" % value
141 | else:
142 | return u"%s" % url_join(fb_settings.MEDIA_URL, self.path)
143 |
144 | def _dimensions(self):
145 | """
146 | Image Dimensions.
147 | """
148 | if self.filetype == 'Image':
149 | try:
150 | im = Image.open(os.path.join(fb_settings.MEDIA_ROOT, self.path))
151 | return im.size
152 | except:
153 | pass
154 | else:
155 | return False
156 | dimensions = property(_dimensions)
157 |
158 | def _width(self):
159 | """
160 | Image Width.
161 | """
162 | return self.dimensions[0]
163 | width = property(_width)
164 |
165 | def _height(self):
166 | """
167 | Image Height.
168 | """
169 | return self.dimensions[1]
170 | height = property(_height)
171 |
172 | def _orientation(self):
173 | """
174 | Image Orientation.
175 | """
176 | if self.dimensions:
177 | if self.dimensions[0] >= self.dimensions[1]:
178 | return "Landscape"
179 | else:
180 | return "Portrait"
181 | else:
182 | return None
183 | orientation = property(_orientation)
184 |
185 | def _is_empty(self):
186 | """
187 | True if Folder is empty, False if not.
188 | """
189 | if os.path.isdir(self.path_full):
190 | if not os.listdir(self.path_full):
191 | return True
192 | else:
193 | return False
194 | else:
195 | return None
196 | is_empty = property(_is_empty)
197 |
198 | def __repr__(self):
199 | return force_unicode(self.url_save)
200 |
201 | def __str__(self):
202 | return force_unicode(self.url_save)
203 |
204 | def __unicode__(self):
205 | return force_unicode(self.url_save)
206 |
207 |
208 |
--------------------------------------------------------------------------------
/filebrowser/templates/filebrowser/include/filelisting.html:
--------------------------------------------------------------------------------
1 | {% load i18n fb_tags fb_versions %}
2 |
3 | {% for file in page.object_list %}
4 |
5 |
6 |
7 | {% if query.pop == "1" and results_var.select_total %}
8 |