From 0d730e1abb04da330fa72ce849d74d13558c666b Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Thu, 6 Apr 2006 14:00:02 +0000 Subject: [PATCH] Added directory tree view widget (JS) to the Media Selector --- bundled-libs/YahooUI/treeview/YAHOO.js | 63 + bundled-libs/YahooUI/treeview/license.txt | 35 + bundled-libs/YahooUI/treeview/treeview.js | 1490 +++++++++++++++++++++ deployment/serendipity_editor.js | 18 +- docs/NEWS | 3 + include/admin/images.inc.php | 74 +- include/functions.inc.php | 24 + include/functions_images.inc.php | 28 +- serendipity_admin_image_selector.php | 147 +- serendipity_editor.js | 18 +- templates/default/treeview/lm.gif | Bin 0 -> 94 bytes templates/default/treeview/lmh.gif | Bin 0 -> 106 bytes templates/default/treeview/ln.gif | Bin 0 -> 142 bytes templates/default/treeview/loading.gif | Bin 0 -> 2673 bytes templates/default/treeview/lp.gif | Bin 0 -> 130 bytes templates/default/treeview/lph.gif | Bin 0 -> 111 bytes templates/default/treeview/screen.css | 1 + templates/default/treeview/tm.gif | Bin 0 -> 545 bytes templates/default/treeview/tmh.gif | Bin 0 -> 563 bytes templates/default/treeview/tn.gif | Bin 0 -> 504 bytes templates/default/treeview/tp.gif | Bin 0 -> 539 bytes templates/default/treeview/tph.gif | Bin 0 -> 568 bytes templates/default/treeview/tree.css | 115 ++ templates/default/treeview/vline.gif | Bin 0 -> 503 bytes 24 files changed, 1938 insertions(+), 78 deletions(-) create mode 100644 bundled-libs/YahooUI/treeview/YAHOO.js create mode 100644 bundled-libs/YahooUI/treeview/license.txt create mode 100644 bundled-libs/YahooUI/treeview/treeview.js create mode 100644 templates/default/treeview/lm.gif create mode 100644 templates/default/treeview/lmh.gif create mode 100644 templates/default/treeview/ln.gif create mode 100644 templates/default/treeview/loading.gif create mode 100644 templates/default/treeview/lp.gif create mode 100644 templates/default/treeview/lph.gif create mode 100644 templates/default/treeview/screen.css create mode 100644 templates/default/treeview/tm.gif create mode 100644 templates/default/treeview/tmh.gif create mode 100644 templates/default/treeview/tn.gif create mode 100644 templates/default/treeview/tp.gif create mode 100644 templates/default/treeview/tph.gif create mode 100644 templates/default/treeview/tree.css create mode 100644 templates/default/treeview/vline.gif diff --git a/bundled-libs/YahooUI/treeview/YAHOO.js b/bundled-libs/YahooUI/treeview/YAHOO.js new file mode 100644 index 0000000..33e3ff4 --- /dev/null +++ b/bundled-libs/YahooUI/treeview/YAHOO.js @@ -0,0 +1,63 @@ +/* +Copyright (c) 2006 Yahoo! Inc. All rights reserved. +version 0.9.0 +*/ + +/** + * @class The Yahoo global namespace + */ +var YAHOO = function() { + + return { + + /** + * Yahoo presentation platform utils namespace + */ + util: {}, + + /** + * Yahoo presentation platform widgets namespace + */ + widget: {}, + + /** + * Yahoo presentation platform examples namespace + */ + example: {}, + + /** + * Returns the namespace specified and creates it if it doesn't exist + * + * YAHOO.namespace("property.package"); + * YAHOO.namespace("YAHOO.property.package"); + * + * Either of the above would create YAHOO.property, then + * YAHOO.property.package + * + * @param {String} sNameSpace String representation of the desired + * namespace + * @return {Object} A reference to the namespace object + */ + namespace: function( sNameSpace ) { + + if (!sNameSpace || !sNameSpace.length) { + return null; + } + + var levels = sNameSpace.split("."); + + var currentNS = YAHOO; + + // YAHOO is implied, so it is ignored if it is included + for (var i=(levels[0] == "YAHOO") ? 1 : 0; i '; + } + + var f = document.createElement("div"); + var s = f.style; + s.position = "absolute"; + s.top = "-1000px"; + s.left = "-1000px"; + f.innerHTML = sb.join(""); + + document.body.appendChild(f); +}; + +YAHOO.widget.TreeView.addHandler(window, + "load", YAHOO.widget.TreeView.preload); + +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/** + * @class Abstract node class + * @constructor + * @param oData {object} a string or object containing the data that will + * be used to render this node + * @param oParent {YAHOO.widget.Node} this node's parent node + * @param expanded {boolean} the initial expanded/collapsed state + */ +YAHOO.widget.Node = function(oData, oParent, expanded) { + if (oParent) { this.init(oData, oParent, expanded); } +}; + +YAHOO.widget.Node.prototype = { + + /** + * The index for this instance obtained from global counter in YAHOO.widget.TreeView. + * + * @type int + */ + index: 0, + + /** + * This node's child node collection. + * + * @type YAHOO.widget.Node[] + */ + children: null, + + /** + * Tree instance this node is part of + * + * @type YAHOO.widget.TreeView + */ + tree: null, + + /** + * The data linked to this node. This can be any object or primitive + * value, and the data can be used in getNodeHtml(). + * + * @type object + */ + data: null, + + /** + * Parent node + * + * @type YAHOO.widget.Node + */ + parent: null, + + /** + * The depth of this node. We start at -1 for the root node. + * + * @type int + */ + depth: -1, + + /** + * The href for the node's label. If one is not specified, the href will + * be set so that it toggles the node. + * + * @type string + */ + href: null, + + /** + * The label href target, defaults to current window + * + * @type string + */ + target: "_self", + + /** + * The node's expanded/collapsed state + * + * @type boolean + */ + expanded: false, + + /** + * Can multiple children be expanded at once? + * + * @type boolean + */ + multiExpand: true, + + /** + * Should we render children for a collapsed node? It is possible that the + * implementer will want to render the hidden data... @todo verify that we + * need this, and implement it if we do. + * + * @type boolean + */ + renderHidden: false, + + /** + * Flag that is set to true the first time this node's children are rendered. + * + * @type boolean + */ + childrenRendered: false, + + /** + * This node's previous sibling + * + * @type YAHOO.widget.Node + */ + previousSibling: null, + + /** + * This node's next sibling + * + * @type YAHOO.widget.Node + */ + nextSibling: null, + + /** + * We can set the node up to call an external method to get the child + * data dynamically. + * + * @type boolean + * @private + */ + _dynLoad: false, + + /** + * Function to execute when we need to get this node's child data. + * + * @type function + */ + dataLoader: null, + + /** + * This is true for dynamically loading nodes while waiting for the + * callback to return. + * + * @type boolean + */ + isLoading: false, + + /** + * The toggle/branch icon will not show if this is set to false. This + * could be useful if the implementer wants to have the child contain + * extra info about the parent, rather than an actual node. + * + * @type boolean + */ + hasIcon: true, + + /** + * Initializes this node, gets some of the properties from the parent + * + * @param oData {object} a string or object containing the data that will + * be used to render this node + * @param oParent {YAHOO.widget.Node} this node's parent node + * @param expanded {boolean} the initial expanded/collapsed state + */ + init: function(oData, oParent, expanded) { + this.data = oData; + this.children = []; + this.index = YAHOO.widget.TreeView.nodeCount; + ++YAHOO.widget.TreeView.nodeCount; + this.expanded = expanded; + + // oParent should never be null except when we create the root node. + if (oParent) { + this.tree = oParent.tree; + this.parent = oParent; + this.href = "javascript:" + this.getToggleLink(); + this.depth = oParent.depth + 1; + this.multiExpand = oParent.multiExpand; + + oParent.appendChild(this); + } + }, + + /** + * Appends a node to the child collection. + * + * @param node {YAHOO.widget.Node} the new node + * @return {YAHOO.widget.Node} the child node + * @private + */ + appendChild: function(node) { + if (this.hasChildren()) { + var sib = this.children[this.children.length - 1]; + sib.nextSibling = node; + node.previousSibling = sib; + } + + this.tree.regNode(node); + this.children[this.children.length] = node; + return node; + + }, + + /** + * Returns a node array of this node's siblings, null if none. + * + * @return YAHOO.widget.Node[] + */ + getSiblings: function() { + return this.parent.children; + }, + + /** + * Shows this node's children + */ + showChildren: function() { + if (!this.tree.animateExpand(this.getChildrenEl())) { + if (this.hasChildren()) { + this.getChildrenEl().style.display = ""; + } + } + }, + + /** + * Hides this node's children + */ + hideChildren: function() { + + if (!this.tree.animateCollapse(this.getChildrenEl())) { + this.getChildrenEl().style.display = "none"; + } + }, + + /** + * Returns the id for this node's container div + * + * @return {string} the element id + */ + getElId: function() { + return "ygtv" + this.index; + }, + + /** + * Returns the id for this node's children div + * + * @return {string} the element id for this node's children div + */ + getChildrenElId: function() { + return "ygtvc" + this.index; + }, + + /** + * Returns the id for this node's toggle element + * + * @return {string} the toggel element id + */ + getToggleElId: function() { + return "ygtvt" + this.index; + }, + + /** + * Returns this node's container html element + * + * @return {Object} the container html element + */ + getEl: function() { + return document.getElementById(this.getElId()); + }, + + /** + * Returns the div that was generated for this node's children + * + * @return {Object} this node's children div + */ + getChildrenEl: function() { + return document.getElementById(this.getChildrenElId()); + }, + + /** + * Returns the element that is being used for this node's toggle. + * + * @return {Object} this node's toggel html element + */ + getToggleEl: function() { + return document.getElementById(this.getToggleElId()); + }, + + /** + * Generates the link that will invoke this node's toggle method + * + * @return {string} the javascript url for toggling this node + */ + getToggleLink: function() { + return "YAHOO.widget.TreeView.getNode(\'" + this.tree.id + "\'," + + this.index + ").toggle()"; + }, + + /** + * Hides this nodes children (creating them if necessary), changes the + * toggle style. + */ + collapse: function() { + // Only collapse if currently expanded + if (!this.expanded) { return; } + + if (!this.getEl()) { + this.expanded = false; + return; + } + + // hide the child div + this.hideChildren(); + this.expanded = false; + + if (this.hasIcon) { + this.getToggleEl().className = this.getStyle(); + } + + // fire the collapse event handler + this.tree.onCollapse(this); + }, + + /** + * Shows this nodes children (creating them if necessary), changes the + * toggle style, and collapses its siblings if multiExpand is not set. + */ + expand: function() { + // Only expand if currently collapsed. + if (this.expanded) { return; } + + if (!this.getEl()) { + this.expanded = true; + return; + } + + if (! this.childrenRendered) { + this.getChildrenEl().innerHTML = this.renderChildren(); + } + + this.expanded = true; + if (this.hasIcon) { + this.getToggleEl().className = this.getStyle(); + } + + // We do an extra check for children here because the lazy + // load feature can expose nodes that have no children. + + // if (!this.hasChildren()) { + if (this.isLoading) { + this.expanded = false; + return; + } + + if (! this.multiExpand) { + var sibs = this.getSiblings(); + for (var i=0; i 0 || + (checkForLazyLoad && this.isDynamic() && !this.childrenRendered) ); + }, + + /** + * Expands if node is collapsed, collapses otherwise. + */ + toggle: function() { + if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) { + if (this.expanded) { this.collapse(); } else { this.expand(); } + } + }, + + /** + * Returns the markup for this node and its children. + * + * @return {string} the markup for this node and its expanded children. + */ + getHtml: function() { + var sb = []; + sb[sb.length] = '
'; + sb[sb.length] = this.getNodeHtml(); + sb[sb.length] = this.getChildrenHtml(); + sb[sb.length] = '
'; + return sb.join(""); + }, + + /** + * Called when first rendering the tree. We always build the div that will + * contain this nodes children, but we don't render the children themselves + * unless this node is expanded. + * + * @return {string} the children container div html and any expanded children + * @private + */ + getChildrenHtml: function() { + var sb = []; + sb[sb.length] = '
= this.depth || depth < 0) { + return null; + } + + var p = this.parent; + + while (p.depth > depth) { + p = p.parent; + } + + return p; + }, + + /** + * Returns the css class for the spacer at the specified depth for + * this node. If this node's ancestor at the specified depth + * has a next sibling the presentation is different than if it + * does not have a next sibling + * + * @param {int} depth the depth of the ancestor. + * @return {string} the css class for the spacer + */ + getDepthStyle: function(depth) { + return (this.getAncestor(depth).nextSibling) ? + "ygtvdepthcell" : "ygtvblankdepthcell"; + }, + + /** + * Get the markup for the node. This is designed to be overrided so that we can + * support different types of nodes. + * + * @return {string} the html for this node + */ + getNodeHtml: function() { + return ""; + } + +}; + +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/** + * @class A custom YAHOO.widget.Node that handles the unique nature of + * the virtual, presentationless root node. + * + * @extends YAHOO.widget.Node + * @constructor + */ +YAHOO.widget.RootNode = function(oTree) { + // Initialize the node with null params. The root node is a + // special case where the node has no presentation. So we have + // to alter the standard properties a bit. + this.init(null, null, true); + + /** + * For the root node, we get the tree reference from as a param + * to the constructor instead of from the parent element. + * + * @type YAHOO.widget.TreeView + */ + this.tree = oTree; +}; +YAHOO.widget.RootNode.prototype = new YAHOO.widget.Node(); + +// overrides YAHOO.widget.Node +YAHOO.widget.RootNode.prototype.getNodeHtml = function() { + return ""; +}; + +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/** + * @class The default node presentation. The first parameter should be + * either a string that will be used as the node's label, or an object + * that has a string propery called label. By default, the clicking the + * label will toggle the expanded/collapsed state of the node. By + * changing the href property of the instance, this behavior can be + * changed so that the label will go to the specified href. + * + * @extends YAHOO.widget.Node + * @constructor + * @param oData {object} a string or object containing the data that will + * be used to render this node + * @param oParent {YAHOO.widget.Node} this node's parent node + * @param expanded {boolean} the initial expanded/collapsed state + */ +YAHOO.widget.TextNode = function(oData, oParent, expanded) { + if (oParent) { + this.init(oData, oParent, expanded); + this.setUpLabel(oData); + } +}; + +YAHOO.widget.TextNode.prototype = new YAHOO.widget.Node(); + +/** + * The CSS class for the label href. Defaults to ygtvlabel, but can be + * overridden to provide a custom presentation for a specific node. + * + * @type string + */ +YAHOO.widget.TextNode.prototype.labelStyle = "ygtvlabel"; + +/** + * The derived element id of the label for this node + * + * @type string + */ +YAHOO.widget.TextNode.prototype.labelElId = null; + +/** + * The text for the label. It is assumed that the oData parameter will + * either be a string that will be used as the label, or an object that + * has a property called "label" that we will use. + * + * @type string + */ +YAHOO.widget.TextNode.prototype.label = null; + +/** + * Sets up the node label + * + * @param oData string containing the label, or an object with a label property + */ +YAHOO.widget.TextNode.prototype.setUpLabel = function(oData) { + if (typeof oData == "string") { + oData = { label: oData }; + } + this.label = oData.label; + + // update the link + if (oData.href) { + this.href = oData.href; + } + + // set the target + if (oData.target) { + this.target = oData.target; + } + + this.labelElId = "ygtvlabelel" + this.index; +}; + +/** + * Returns the label element + * + * @return {object} the element + */ +YAHOO.widget.TextNode.prototype.getLabelEl = function() { + return document.getElementById(this.labelElId); +}; + +// overrides YAHOO.widget.Node +YAHOO.widget.TextNode.prototype.getNodeHtml = function() { + var sb = new Array(); + + sb[sb.length] = ''; + sb[sb.length] = ''; + + for (i=0;i '; + } + + var getNode = 'YAHOO.widget.TreeView.getNode(\'' + + this.tree.id + '\',' + this.index + ')'; + + sb[sb.length] = ' '; + sb[sb.length] = ''; + sb[sb.length] = ''; + } + + if (this.hasIcon) { + sb[sb.length] = ' '; + if (this.hasChildren(true)) { + sb[sb.length] = ' onmouseover="this.className='; + sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\''; + sb[sb.length] = this.tree.id + '\',' + this.index + ').getHoverStyle()"'; + sb[sb.length] = ' onmouseout="this.className='; + sb[sb.length] = 'YAHOO.widget.TreeView.getNode(\''; + sb[sb.length] = this.tree.id + '\',' + this.index + ').getStyle()"'; + } + sb[sb.length] = ''; + } + + sb[sb.length] = ' diff --git a/docs/NEWS b/docs/NEWS index 4fc4d47..cb9add9 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 1.1-alpha1() ------------------------------------------------------------------------ + * Added directory tree view widget (JS) to the Media Selector + (garvinhicking) + * Create a new index on the plugin DB table, optimize fetching config values for plugins. Load language file when permissions could not allow reading the config file. (garvinhicking) diff --git a/include/admin/images.inc.php b/include/admin/images.inc.php index 23efa34..0d14c9c 100644 --- a/include/admin/images.inc.php +++ b/include/admin/images.inc.php @@ -91,7 +91,7 @@ switch ($serendipity['GET']['adminAction']) { 'thumb' => $serendipity['thumbSuffix'], 'fthumb' => $file['thumbnail_name'] )); - + serendipity_plugin_api::hook_event('backend_media_rename', $renameValues); // Rename file @@ -191,7 +191,7 @@ switch ($serendipity['GET']['adminAction']) { $fp = fopen($tempfile, 'w'); fwrite($fp, $fContent); fclose($fp); - + $image_id = @serendipity_insertHotlinkedImageInDatabase($tfile, $serendipity['POST']['imageurl'], $authorid, null, $tempfile); printf(HOTLINK_DONE. '
', $serendipity['POST']['imageurl'], $tfile); serendipity_plugin_api::hook_event('backend_image_addHotlink', $tempfile); @@ -207,7 +207,7 @@ switch ($serendipity['GET']['adminAction']) { 'thumb' => $serendipity['thumbSuffix'] )); serendipity_plugin_api::hook_event('backend_media_makethumb', $thumbs); - + foreach($thumbs as $thumb) { // Create thumbnail if ( $created_thumbnail = serendipity_makeThumbnail($tfile, $serendipity['POST']['target_directory'][$tindex], $thumb['thumbSize'], $thumb['thumb']) ) { @@ -226,7 +226,7 @@ switch ($serendipity['GET']['adminAction']) { if (!is_array($serendipity['POST']['target_filename'])) { break; } - + foreach($serendipity['POST']['target_filename'] AS $idx => $target_filename) { $uploadfile = &$_FILES['serendipity']['name']['userfile'][$idx]; $uploadtmp = &$_FILES['serendipity']['tmp_name']['userfile'][$idx]; @@ -238,7 +238,7 @@ switch ($serendipity['GET']['adminAction']) { // skip empty array continue; } - + $tfile = serendipity_uploadSecure(basename($tfile)); if (serendipity_isActiveFile($tfile)) { @@ -246,10 +246,10 @@ switch ($serendipity['GET']['adminAction']) { echo '
'; continue; } - + $serendipity['POST']['target_directory'][$idx] = serendipity_uploadSecure($serendipity['POST']['target_directory'][$idx], true, true); $target = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $serendipity['POST']['target_directory'][$idx] . $tfile; - + if (file_exists($target)) { echo '(' . $target . ') ' . ERROR_FILE_EXISTS_ALREADY; echo '
'; @@ -259,13 +259,13 @@ switch ($serendipity['GET']['adminAction']) { printf(FILE_UPLOADED . '
', $uploadfile, $target); @umask(0000); @chmod($target, 0664); - + $thumbs = array(array( 'thumbSize' => $serendipity['thumbSize'], 'thumb' => $serendipity['thumbSuffix'] )); serendipity_plugin_api::hook_event('backend_media_makethumb', $thumbs); - + foreach($thumbs as $thumb) { // Create thumbnail if ( $created_thumbnail = serendipity_makeThumbnail($tfile, $serendipity['POST']['target_directory'][$idx], $thumb['thumbSize'], $thumb['thumb']) ) { @@ -315,11 +315,11 @@ switch ($serendipity['GET']['adminAction']) { 'relpath' => $use_dir ) ); - + if (!serendipity_directoryACL($checkpath, 'write')) { return; } - + if (!empty($serendipity['POST']['save'])) { serendipity_ACLGrant(0, 'directory', 'read', $serendipity['POST']['read_authors'], $use_dir); serendipity_ACLGrant(0, 'directory', 'write', $serendipity['POST']['write_authors'], $use_dir); @@ -334,7 +334,7 @@ switch ($serendipity['GET']['adminAction']) {

- +
'; + sb[sb.length] = ' 
@@ -354,7 +354,7 @@ switch ($serendipity['GET']['adminAction']) { - +
@@ -390,7 +390,7 @@ switch ($serendipity['GET']['adminAction']) {

- + @@ -424,6 +424,8 @@ switch ($serendipity['GET']['adminAction']) { printf(DIRECTORY_CREATED, $serendipity['POST']['name']); @umask(0000); @chmod($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $new_dir, 0777); + serendipity_ACLGrant(0, 'directory', 'read', array(0), $new_dir . '/'); + serendipity_ACLGrant(0, 'directory', 'write', array(0), $new_dir . '/'); } else { printf(DIRECTORY_WRITE_ERROR, $new_dir); } @@ -450,7 +452,7 @@ switch ($serendipity['GET']['adminAction']) {

- +
@@ -608,10 +610,10 @@ switch ($serendipity['GET']['adminAction']) { columncount = fields.childNodes[3].childNodes[0]; } else if (fields.childNodes[1].childNodes[1].childNodes[0].childNodes[3] == null) { // This is Safari. - userfile = fields.childNodes[1].childNodes[1].childNodes[0].childNodes[1].childNodes[0]; + userfile = fields.childNodes[1].childNodes[1].childNodes[0].childNodes[1].childNodes[0]; targetfilename = fields.childNodes[1].childNodes[1].childNodes[2].childNodes[1].childNodes[0]; targetdir = fields.childNodes[1].childNodes[1].childNodes[3].childNodes[1].childNodes[0]; - columncount = fields.childNodes[3].childNodes[0]; + columncount = fields.childNodes[3].childNodes[0]; } else { // This is Mozilla. userfile = fields.childNodes[1].childNodes[1].childNodes[0].childNodes[3].childNodes[0]; @@ -620,16 +622,16 @@ switch ($serendipity['GET']['adminAction']) { columncount = fields.childNodes[3].childNodes[0]; } } - + userfile.id = 'userfile_' + fieldcount; userfile.name = 'serendipity[userfile][' + fieldcount + ']'; - + targetfilename.id = 'target_filename_' + fieldcount; targetfilename.name = 'serendipity[target_filename][' + fieldcount + ']'; - + targetdir.id = 'target_directory_' + fieldcount; targetdir.name = 'serendipity[target_directory][' + fieldcount + ']'; - + columncount.id = 'column_count_' + fieldcount; columncount.name = 'serendipity[column_count][' + fieldcount + ']'; @@ -638,7 +640,7 @@ switch ($serendipity['GET']['adminAction']) { document.getElementById(targetdir.id).selectedIndex = document.getElementById('target_directory_' + (fieldcount - 1)).selectedIndex; } - + var inputStorage = new Array(); function checkInputs() { for (i = 1; i <= fieldcount; i++) { @@ -650,14 +652,14 @@ switch ($serendipity['GET']['adminAction']) { } } - + function debugFields() { for (i = 1; i <= fieldcount; i++) { debugField('target_filename_' + i); debugField('userfile_' + i); } } - + function rememberOptions() { td = document.getElementById('target_directory_2'); td_val = td.options[td.selectedIndex].value; @@ -677,7 +679,7 @@ switch ($serendipity['GET']['adminAction']) { useDuplicate = true; } else { sourceval = getfilename(document.getElementById('userfile_' + source).value); - } + } if (sourceval.length > 0) { document.getElementById('target_filename_' + target).value = sourceval; @@ -687,7 +689,7 @@ switch ($serendipity['GET']['adminAction']) { // Display filename in duplicate form as well! if (useDuplicate) { tkey = target + 1; - + if (!inputStorage[tkey] || inputStorage[tkey] == document.getElementById('target_filename_' + tkey).value) { document.getElementById('target_filename_' + (target+1)).value = sourceval; inputStorage[target + 1] = '~~~'; @@ -698,7 +700,7 @@ switch ($serendipity['GET']['adminAction']) {
- + @@ -713,9 +715,9 @@ switch ($serendipity['GET']['adminAction']) {
- @@ -738,8 +740,8 @@ switch ($serendipity['GET']['adminAction']) {
- @@ -765,7 +767,7 @@ switch ($serendipity['GET']['adminAction']) {
- +
@@ -774,14 +776,14 @@ switch ($serendipity['GET']['adminAction']) { document.write('<' + '/span>'); addField(); - +
- +
@@ -888,7 +890,7 @@ switch ($serendipity['GET']['adminAction']) {
- + " /> diff --git a/include/functions.inc.php b/include/functions.inc.php index eb9382d..c76a073 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1034,5 +1034,29 @@ if (!function_exists('microtime_float')) { } } +/** + * Converts Array data to be used as a GET string + */ +function serendipity_build_query(&$array, $array_prefix = null, $comb_char = '&') { + $ret = array(); + if (!is_array($array)) { + return ''; + } + + foreach ($array as $k => $v) { + $newkey = urlencode($k); + if ($array_prefix) { + $newkey = $array_prefix . '[' . $newkey . ']'; + } + if (is_array($v)) { + $ret[] = serendipity_build_query($v, $newkey, $comb_char); + } else { + $ret[] = $newkey . '=' . urlencode($v); + } + } + + return implode($comb_char, $ret); +} + define("serendipity_FUNCTIONS_LOADED", true); /* vim: set sts=4 ts=4 expandtab : */ diff --git a/include/functions_images.inc.php b/include/functions_images.inc.php index 9b24023..5e85b98 100644 --- a/include/functions_images.inc.php +++ b/include/functions_images.inc.php @@ -248,21 +248,27 @@ function serendipity_fetchImages($group = false, $start = 0, $end = 20, $images if ($dir = @opendir($basedir . $odir)) { $aTempArray = array(); while (($file = @readdir($dir)) !== false) { + if ($file == '.svn' || $file == 'CVS' || $file == '.' || $file == '..') { + continue; + } array_push($aTempArray, $file); } @closedir($dir); sort($aTempArray); foreach($aTempArray as $f) { - if ($f != '.' && $f != '..' && strpos($f, $serendipity['thumbSuffix']) === false) { - $cdir = ($odir != '' ? $odir . '/' : ''); - if (is_dir($basedir . $odir . '/' . $f)) { - $temp = serendipity_fetchImages($group, $start, $end, $images, $cdir . $f); - foreach($temp AS $tkey => $tval) { - array_push($images, $tval); - } - } else { - array_push($images, $cdir . $f); + if (strpos($f, $serendipity['thumbSuffix']) !== false) { + // This is a s9y thumbnail, skip it. + continue; + } + + $cdir = ($odir != '' ? $odir . '/' : ''); + if (is_dir($basedir . $odir . '/' . $f)) { + $temp = serendipity_fetchImages($group, $start, $end, $images, $cdir . $f); + foreach($temp AS $tkey => $tval) { + array_push($images, $tval); } + } else { + array_push($images, $cdir . $f); } } } @@ -1193,7 +1199,7 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa } unset($aResultSet[$sKey]); } - sort($paths); + //sort($paths); if ($debug) echo "

Got files:

" . print_r($aFilesOnDisk, true) . "

"; $serendipity['current_image_hash'] = md5(serialize($aFilesOnDisk)); @@ -1361,7 +1367,7 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa - + diff --git a/serendipity_admin_image_selector.php b/serendipity_admin_image_selector.php index 095a134..c5a2ed4 100644 --- a/serendipity_admin_image_selector.php +++ b/serendipity_admin_image_selector.php @@ -24,12 +24,12 @@ if (!isset($serendipity['GET']['step'])) { function ifRemember($name, $value, $isDefault = false, $att = 'checked') { global $serendipity; - + if (!is_array($serendipity['COOKIE']) && !$isDefault) { return false; } - - if ((!is_array($serendipity['COOKIE']) && $isDefault) || + + if ((!is_array($serendipity['COOKIE']) && $isDefault) || (!isset($serendipity['COOKIE']['serendipity_' . $name]) && $isDefault) || (isset($serendipity['COOKIE']['serendipity_' . $name]) && $serendipity['COOKIE']['serendipity_' . $name] == $value)) { @@ -42,9 +42,24 @@ function ifRemember($name, $value, $isDefault = false, $att = 'checked') { <?php echo SELECT_FILE; ?> + + + - + + + + + + + +
+ " />
$serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] .'.'. $file['extension']); - serendipity_plugin_api::hook_event('frontend_image_selector_link_url', $aArray); + serendipity_plugin_api::hook_event('frontend_image_selector_link_url', $aArray); ?>
@@ -233,8 +267,8 @@ switch ($serendipity['GET']['step']) { ?> block = ''; - if (self.opener.editorref) { - self.opener.editorref.surroundHTML(block, ''); + if (parent.self.opener.editorref) { + parent.self.opener.editorref.surroundHTML(block, ''); } else { - self.opener.serendipity_imageSelector_addToBody(block, ''); + parent.self.opener.serendipity_imageSelector_addToBody(block, ''); } - self.close(); + parent.self.close(); true, ".svn" => true); + serendipity_plugin_api::hook_event('backend_media_path_exclude_directories', $aExclude); + $paths = array(); + + $aResultSet = serendipity_traversePath( + $serendipity['serendipityPath'] . $serendipity['uploadPath'], + '', + false, + NULL, + 1, + NULL, + FALSE, + $aExclude + ); + + foreach ($aResultSet AS $sKey => $sFile) { + if ($sFile['directory']) { + array_push($paths, $sFile); + } + unset($aResultSet[$sKey]); + } + serendipity_directoryACL($paths, 'read'); +?> + + +
+ +
+
+ +
+
+
+ +
+ +
+ +
+ + + +


@@ -282,7 +404,6 @@ switch ($serendipity['GET']['step']) { ); } ?> -
diff --git a/serendipity_editor.js b/serendipity_editor.js index c754971..fa927da 100644 --- a/serendipity_editor.js +++ b/serendipity_editor.js @@ -72,7 +72,7 @@ function wrapSelectionWithLink(txtarea) { document.getElementById && getMozSelection(txtarea) == "") { var my_desc = prompt("Enter Description", ''); } - + var my_title = prompt("Enter title/tooltip:", ""); html_title = ""; @@ -142,7 +142,7 @@ function serendipity_insLink (area) { area.focus(); return; } - + html_title = ""; if (my_title != "") { html_title = ' title="' + my_title + '"'; @@ -194,8 +194,8 @@ function serendipity_imageSelector_done(textarea) } if (f['serendipity[filename_only]'] && f['serendipity[filename_only]'].value == 'true') { - self.opener.serendipity_imageSelector_addToElement(img, f['serendipity[htmltarget]'].value); - self.close(); + parent.self.opener.serendipity_imageSelector_addToElement(img, f['serendipity[htmltarget]'].value); + parent.self.close(); return true; } @@ -232,14 +232,14 @@ function serendipity_imageSelector_done(textarea) block = insert; } - if (self.opener.editorref) { - self.opener.editorref.surroundHTML(block, ''); + if (parent.self.opener.editorref) { + parent.self.opener.editorref.surroundHTML(block, ''); } else { - - self.opener.serendipity_imageSelector_addToBody(block, textarea); + + parent.self.opener.serendipity_imageSelector_addToBody(block, textarea); } - self.close(); + parent.self.close(); } // --> diff --git a/templates/default/treeview/lm.gif b/templates/default/treeview/lm.gif new file mode 100644 index 0000000000000000000000000000000000000000..e7d0a3ce92eb825a95ca188133567cd4f8f31499 GIT binary patch literal 94 zcmZ?wbhEHb6krfzn8?8J|NsAnh6V;OL-8jIs|W)#gAS0(0Fq~5(x216Qtb79sX3ZA us+DiZoVZmeFVu3oV#=XiRnDKMs-2p#PO1G%cj6U(9b}?;FOZ literal 0 HcmV?d00001 diff --git a/templates/default/treeview/ln.gif b/templates/default/treeview/ln.gif new file mode 100644 index 0000000000000000000000000000000000000000..b7b3e55cd044af047e571b8e46d99dd4b801ee60 GIT binary patch literal 142 zcmZ?wbhEHb6krfz*v!Dt(9rPz|9=MJ08pjkPZmZ727U&`e=?ytsfj5H?w)Q6!MTY= zCBcbhsYME5Ky0LEz@P&%5oCu0i}Z(+o~!p-ygs}8e}YEQf$*yI>683lZcElVAIHLA F4FFl;B{Tp4 literal 0 HcmV?d00001 diff --git a/templates/default/treeview/loading.gif b/templates/default/treeview/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..0bbf3bc0c0e5e635553e8d1bf9ceddefbc402396 GIT binary patch literal 2673 zcmchY_gj;P7RTSb83YJ1>=8y5ONL=ZcEgk+C?FydumNNz8c=c6`n&|fmMu_HHG%^w zNLVjHyfy)hAgHK_Kxkz+0Ktm5M|X*?y?g!o_3yv`{_^F^wY9YuFJ3GxEUd1s-nnz<)vH(c?%i8n zUVirM+2rIT007UQKY#e};oRKZty{MqJa}MhYina;bNBAu-+udTYHDhBcJ|n@WA*j* z-+lL;iHS*OX6D|#dm|zu!o$ON?b=mbT)bh!26uP&kdP1u2Zx!N8486$B9X?&$DclZ zdgI28>FMdk#l`#g@Bj4EPc=0)2M!!4EG!%z9?s6rzI5r**|TSdhK8)HtXf)HHgDc+ zZEek9Fk)k4xm@nHZQC3j9o^jACMG6~jg9m3^EYnX2*Yq^XJ>6~?X_#y4jnqQbLUQp zM6z$+zMp^o*}}p?p-?n8H=jOzx~Zv&N~Km+RkgLX9X@>c=FOXxm6dsUd1NvZ zX=yul?BMZua=F~p)O7py?EwJ+w{PD*dGh2hzx?v((WCP6au$mb!vmnqSpF6-9Ona(JQT#e>!KODwxYzG5#S|?M#v6eD#mgO^`=~9EL;yL&>*dd5*+XG=_`^3=CG25PbLa+LJ%N(PW_s z=_-TaM{SB!w(n7k+dMDN2G6VPqUA$u7F4m@ABAZ1D`*UMfe}E6csJU}J1Trmp#~7hZ5QSGpNvd1Uz$!Rf3q28pgSj9o zx?zwoWa8GYK@TOz^)mp#V2_VR5WfJ0W9BSSbn+cKb z7B9l9)K#s!?PSt;g%c8u;y7rd?hkP%>vq5BY=N>c=98V=+T&RSPgSu|E(FAK>B?vNN1 zPszwcbxJ?Oh|1pGd!9?gxzSWOR8o=x5!rGh+6r3hBL-14aTaAQxvJ|Y-S_m4niV2S zK@?}-9Dkhg<+w{Ny!vjyp-QmjyGmIW1DFB{k>P2=8cm~9M^_P#8?JFDumGEPaqJvf zZ{f;B#CG;H7q8a_hQ$pR6%%6So8vKM+W+cNPE_TI46^dn9q@qBr@1bUgxcPGB*b-i z3Hx_0(Esy5KKx^Y0yfgB6~}t>@!ctk>J|!vgVRhE2CPQ;AOKY2y%5nM@YF^ZMS~q}%L-n>Lpor#4w48UHYViOt={{43LMRvkIp+rkbs*s; z14}4q0y6`s8DL?uo-~*R@5tnFsC1DR#BGxT8fA20u_o?`0iDNI6lf;^$@AkR1dPTz z>XF1ZAqNjU95c@Vn59Wo;Z6b(YG+L$xy3(?j2I*vQ>PmzMEdh`yw3=)E}JYMDG|*x mDkGVJ;D)fXhxDI?kcM(ish)oPv+$)O9m7&lFF%`-bKA@>z>*#XDKFr20=RDO%adz+epk!mc6H literal 0 HcmV?d00001 diff --git a/templates/default/treeview/lph.gif b/templates/default/treeview/lph.gif new file mode 100644 index 0000000000000000000000000000000000000000..e3478d8e37dadeba8c9d68c84ad29c3b2843a69b GIT binary patch literal 111 zcmZ?wbhEHb6krfzSj586(9qzWyyp6yrwj}X|Ns97k`SQylZBCifrUW_#09BkU^emC zb!Xj!lRuUA>b}?;FOZcNk%w1VGsZy1Cav&|Ns90004l1fdBvhA^8LW00093EC2ui01yBm0{{a5 zoR6s{>%SVDN!WWM*c`~(aUUXt+jx}0x_U$Nl_tuVt|Eu@i(%By01AUc;I0@!{*Fpg zbHaSSq>t#++QcfgNN&+P1PjGRs)M{VC)E{p+ns{PY55GCCfKT zdutnudlj5Dyj9$F{FNNGJl0(HoBNy=EnH1}ZJdp~t=!H0?Hmr>3p`F;E`5$S&AzVp z{?`tlZe5Rkubt1m@7)jnPh3E9yb6{Yh|XXugzgy9Q&`KPym)~q60+C`qA!W^6**q? znDL-Sb09BaG+A=fNOdVgwOqB*UQB#5_0{Be(_c=2I|cS6C^G26p9zIVB-#+^L!%p& zPJB7bX-BCasfHZNl%!RZTUBOd+0|uOm|tamHq3)NWI} zN%=0-tJUw*u~7w2HCz?()w_VfD(3pwYh$yM(N< zs&K4`v9z;VwY#}pyCWrW*|_c0@z(R$uJ^F-()E4(hW?AL_0z|Vpf`iy5Q;dvYwa^J{*Cj$a(RI*^pgD(@tTsX5~&4)K5=A5{*V$X{pgJ%4> zk!VMwABPGRiIn70lTA@ZRhg3IQW>=eEafa17mSEp06Pc% BB!B<_ literal 0 HcmV?d00001 diff --git a/templates/default/treeview/tn.gif b/templates/default/treeview/tn.gif new file mode 100644 index 0000000000000000000000000000000000000000..4a280397de0ae7564f625d9356204a1cb6a1f399 GIT binary patch literal 504 zcmVi2fsz(rj1Z(I%uk_Z1$dUHLJCFC+@t*{rh7DQ$tg6bPOd)Ib9R>WJIOY zC1?7iG(~*cW?M%k^nH`*-V=i`xtK z>l-Y#TUe}i?3nDfEc#3uZ90uwt$NLx?Ya%yEz9_=8%|Cu4t!3WF5E0v&bw~>jvTK% z&s^_(54|tlPyNqYKx_lG736l%TS9Q=7LIEO5uQVI6V+8@m(N{9de0Z-ZN%5n-ba2T z{gniGQeaAgD-E_p_)=j^h7xB!tcjDOO^Q1$_QV)c-%pP@K@JsJlw?wqOHnpe`IKc; zms4R@m3ft>&a5}LdNsJN672wB*X9FPF}IdUNW|t3S66 u{d%%SVDDcF0XR#Je|A>GGlz1le|i8=~as(Px~3Y#jsDi#ZROFE0Y zt6NK!%i1gaYZh!fj9iR%44mw|tk!J&OdZWO&0MX0?UpUQ4c-m+jU8@2E_d#|PTsDb zepk*OpEvJbzjqJ+%A4QU&sRWV1CsGaU6>nC( zTlseN`xS6l!D9)RHGCFv+PjSNHs1TVZ{)v|16Lk=xp3ygn-h0l>^L-J(UM71HfVqJ9X~WyIc2u{X2H>*|v-0Hm(~vZ{@z319vVQI`QMwlUHAU dy?OTM+oN}%ZaqA9@!H9AH}4%ic+3R=06S)30ObGx literal 0 HcmV?d00001 diff --git a/templates/default/treeview/tph.gif b/templates/default/treeview/tph.gif new file mode 100644 index 0000000000000000000000000000000000000000..e4d7d991e44f0ebbe5f05ec261eb831d96332a4e GIT binary patch literal 568 zcmV-80>}MFNk%w1VGsZy1EK@~*WBexW2^uG0Dypi|Ns900000000000A^8LW000C4 zEC2ui01yBm0{{d6NV?pvH@CVug*84wib4m7AKKl%9&5pQE9md6;~nrKG2-t)^qB zU9PdTVX}#@thKPWwqLl8yS}}^zh=j1$!g1N&2GDcSq!^Z7?+4Av#^Y-0ZW&C?{%!M{?3ielPvS1UOS*O@cQK=0vztVNZrX9j4qE zv|`bVM^CC8$};Ikrz4@36gjo!C6iB?!qh60D^0I9!QvFFlPpiOKG6bID|D$_qHK-E zMLJh0+_z2ZX2rXeZ&$xx0f!YlmT+0aXA!4Wyq0m>yO8rbmOGhlWxJ9i_tpHDb70Sd zK^GQ%m~>*(i%~aL{W!Dh&96Jh{yaN$?a{YO=RUnVb??=`Tf-hMn>cObwvppjuA4b; z=f0r>moB`x_2bu*XJ5X(dH3hvqlce9zB=~v+R<}Y@0~q(_u}D`mv273{q^_T=YMZI G0RTJi9wSr$ literal 0 HcmV?d00001 diff --git a/templates/default/treeview/tree.css b/templates/default/treeview/tree.css new file mode 100644 index 0000000..835742b --- /dev/null +++ b/templates/default/treeview/tree.css @@ -0,0 +1,115 @@ +#expandcontractdiv { + font-size: xx-small; + margin-bottom: 5px; + text-align: center; +} + +#serendipityAdminBodyImageSelectorTree { + background-color: #EEE; + background-image: none; + border-right: 1px dotted black; + height: 100%; +} + +#media_frame_tree { + background-color: #EEE; +} + + +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/* first or middle sibling, no children */ +.ygtvtn { + width:16px; height:22px; + background: url(tn.gif) 0 0 no-repeat; +} + +/* first or middle sibling, collapsable */ +.ygtvtm { + width:16px; height:22px; + cursor:pointer ; + background: url(tm.gif) 0 0 no-repeat; +} + +/* first or middle sibling, collapsable, hover */ +.ygtvtmh { + width:16px; height:22px; + cursor:pointer ; + background: url(tmh.gif) 0 0 no-repeat; +} + +/* first or middle sibling, expandable */ +.ygtvtp { + width:16px; height:22px; + cursor:pointer ; + background: url(tp.gif) 0 0 no-repeat; +} + +/* first or middle sibling, expandable, hover */ +.ygtvtph { + width:16px; height:22px; + cursor:pointer ; + background: url(tph.gif) 0 0 no-repeat; +} + +/* last sibling, no children */ +.ygtvln { + width:16px; height:22px; + background: url(ln.gif) 0 0 no-repeat; +} + +/* Last sibling, collapsable */ +.ygtvlm { + width:16px; height:22px; + cursor:pointer ; + background: url(lm.gif) 0 0 no-repeat; +} + +/* Last sibling, collapsable, hover */ +.ygtvlmh { + width:16px; height:22px; + cursor:pointer ; + background: url(lmh.gif) 0 0 no-repeat; +} + +/* Last sibling, expandable */ +.ygtvlp { + width:16px; height:22px; + cursor:pointer ; + background: url(lp.gif) 0 0 no-repeat; +} + +/* Last sibling, expandable, hover */ +.ygtvlph { + width:17px; height:22px; cursor:pointer ; + background: url(lph.gif) 0 0 no-repeat; +} + +/* Loading icon */ +.ygtvloading { + width:16px; height:22px; + background: url(loading.gif) 0 0 no-repeat; +} + +/* the style for the empty cells that are used for rendering the depth + * of the node */ +.ygtvdepthcell { + width:16px; height:22px; + background: url(vline.gif) 0 0 no-repeat; +} + +.ygtvblankdepthcell { width:16px; height:22px; } + +/* the style of the div around each node */ +.ygtvitem { } + +/* the style of the div around each node's collection of children */ +.ygtvchildren { } +* html .ygtvchildren { height:2%; } + +/* the style of the text label in ygTextNode */ +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + margin-left:2px; + text-decoration: none; +} + diff --git a/templates/default/treeview/vline.gif b/templates/default/treeview/vline.gif new file mode 100644 index 0000000000000000000000000000000000000000..1fb0de8bb2911a51ff29f91fe7d231c0a5529091 GIT binary patch literal 503 zcmV^fYPpKps`<(p>p2TrD|$=1D3^=ctGbK# zdo|2eJQh57td{J!4A)HgY!_`h&36sRSk21q>J1AnD^5#pYmSSqyUot4?)whhE*wu> zZ+wqDubj`k@7xdCKWPD}4YXDeTS9H_4t8_+4PrQn<0zK1cn)Jajn3;DdZfn@UPyT# z`Hi%95?@MvB>}GV*OK5%fiV%zG+6Ut&WJlF_N@5xV$h63Hx}&(@~B9qB$GNd$rNQ& zl~Y+hby*eWRhe07ZnfDJ=U1I$d6xBg7HC?bYl*fs`W7kFxJ&6aor@Q%U8#Gi_O+Uq z>tC&b!4CFXm~3LRi_tb#`$+IcfwtO2i=-iumcis&gwQteGNf$RAoON>7%V9T{{hW3I06UMq^ke`4 literal 0 HcmV?d00001 -- 2.39.5