2010-04-23 13:07:12 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* ScribeEngine - Open Source Blog Software *
|
|
|
|
* ------------------------------------------------------------------------- *
|
|
|
|
* Copyright (c) 2010 Raoul Snyman *
|
|
|
|
* ------------------------------------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; version 2 of the License. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, but *
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
|
|
|
|
* Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License along *
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
ScribeEngine.Namespace.create("ScribeEngine.Media", {
|
2010-06-03 13:32:07 +00:00
|
|
|
newDirectory: function ()
|
2010-04-23 13:07:12 +00:00
|
|
|
{
|
|
|
|
var dirname = prompt("New Directory:", "directory");
|
|
|
|
},
|
2010-06-03 13:32:07 +00:00
|
|
|
getFiles: function (event)
|
2010-04-23 13:07:12 +00:00
|
|
|
{
|
2010-06-03 13:32:07 +00:00
|
|
|
var tree = jQuery.jstree._focused();
|
|
|
|
var path = tree.get_path(ScribeEngine.Events.getElement(event));
|
|
|
|
$.getJSON(
|
|
|
|
'/media/get-files',
|
|
|
|
{"path": path.toString()},
|
|
|
|
function (data, textStatus) {
|
|
|
|
$("#file-list > ul").html("");
|
|
|
|
$.each(data, function () {
|
|
|
|
var filename = this;
|
|
|
|
if (filename.length > 15)
|
|
|
|
{
|
|
|
|
filename = filename.substr(0, 12) + "...";
|
|
|
|
}
|
|
|
|
$("#file-list > ul").append(
|
|
|
|
$("<li>")
|
|
|
|
.append($("<div>").attr("class", "file").html(" "))
|
|
|
|
.append($("<div>").attr("class", "caption").attr("title", filename).text(filename))
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|
2010-04-23 13:07:12 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
ScribeEngine.Events.load(function () {
|
2010-06-03 13:32:07 +00:00
|
|
|
ScribeEngine.Events.click("#new-directory", ScribeEngine.Media.newDirectory);
|
2010-04-23 13:07:12 +00:00
|
|
|
ScribeEngine.Events.click("#file-select", window.close);
|
|
|
|
});
|