mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 03:19:13 -04:00
Merge branch 'master' of git://github.com/gallery/gallery3
This commit is contained in:
@@ -3,4 +3,4 @@
|
||||
; process. You don't need to edit it. In fact..
|
||||
;
|
||||
; DO NOT EDIT THIS FILE BY HAND!
|
||||
build_number=99
|
||||
build_number=103
|
||||
|
||||
@@ -94,6 +94,18 @@ class Admin_g2_import_Controller extends Admin_Controller {
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function autocomplete() {
|
||||
$directories = array();
|
||||
$path_prefix = Input::instance()->get("q");
|
||||
foreach (glob("{$path_prefix}*") as $file) {
|
||||
if (is_dir($file) && !is_link($file)) {
|
||||
$directories[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
print implode("\n", $directories);
|
||||
}
|
||||
|
||||
private function _get_import_form() {
|
||||
$embed_path = module::get_var("g2_import", "embed_path", "");
|
||||
$form = new Forge(
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?= $theme->css("jquery.autocomplete.css") ?>
|
||||
<?= $theme->script("jquery.autocomplete.js") ?>
|
||||
<script type="text/javascript">
|
||||
$("document").ready(function() {
|
||||
$("form input[name=embed_path]").autocomplete(
|
||||
"<?= url::site("__ARGS__") ?>".replace("__ARGS__", "admin/g2_import/autocomplete"),
|
||||
{
|
||||
max: 256,
|
||||
loadingClass: "g-loading-small",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="g-admin-g2-import" class="g-block">
|
||||
<h1> <?= t("Gallery 2 import") ?> </h1>
|
||||
<p>
|
||||
|
||||
@@ -136,6 +136,9 @@ class Gallery_View_Core extends View {
|
||||
}
|
||||
|
||||
unset($this->combine_queue[$type][$group]);
|
||||
if (empty($this->combine_queue[$type])) {
|
||||
unset($this->combine_queue[$type]);
|
||||
}
|
||||
|
||||
if ($type == "css") {
|
||||
return html::stylesheet("combined/css/$key", "screen,print,projection", true);
|
||||
|
||||
@@ -38,6 +38,7 @@ class Theme_View_Core extends Gallery_View {
|
||||
$this->item = null;
|
||||
$this->tag = null;
|
||||
$this->set_global(array("theme" => $this,
|
||||
"theme_info" => theme::get_info($this->theme_name),
|
||||
"user" => identity::active_user(),
|
||||
"page_type" => $page_type,
|
||||
"page_subtype" => $page_subtype,
|
||||
|
||||
@@ -24,20 +24,4 @@ class server_add_theme_Core {
|
||||
. $theme->script("server_add.js");
|
||||
}
|
||||
}
|
||||
|
||||
static function admin_head($theme) {
|
||||
$buf = "";
|
||||
if (strpos(Router::$current_uri, "admin/server_add") !== false) {
|
||||
$buf .= $theme->css("server_add.css")
|
||||
. $theme->css("jquery.autocomplete.css");
|
||||
$base = url::site("__ARGS__");
|
||||
$csrf = access::csrf_token();
|
||||
$buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
|
||||
|
||||
$buf .= $theme->script("jquery.autocomplete.js")
|
||||
. $theme->script("admin.js");
|
||||
}
|
||||
|
||||
return $buf;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Set up autocomplete on the server path list
|
||||
*
|
||||
*/
|
||||
$("document").ready(function() {
|
||||
$("#g-path").autocomplete(
|
||||
base_url.replace("__ARGS__", "admin/server_add/autocomplete"), {max: 256});
|
||||
});
|
||||
@@ -1,125 +0,0 @@
|
||||
(function($) {
|
||||
$.widget("ui.gallery_server_add", {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
$("#g-server-add-add-button", this.element).click(function(event) {
|
||||
event.preventDefault();
|
||||
$(".g-progress-bar", this.element).
|
||||
progressbar().
|
||||
progressbar("value", 0);
|
||||
$("#g-server-add-progress", this.element).slideDown("fast", function() { self.start_add(); });
|
||||
});
|
||||
$("#g-server-add-pause-button", this.element).click(function(event) {
|
||||
self.pause = true;
|
||||
$("#g-server-add-pause-button", this.element).hide();
|
||||
$("#g-server-add-continue-button", this.element).show();
|
||||
});
|
||||
$("#g-server-add-continue-button", this.element).click(function(event) {
|
||||
self.pause = false;
|
||||
$("#g-server-add-pause-button", this.element).show();
|
||||
$("#g-server-add-continue-button", this.element).hide();
|
||||
self.run_add();
|
||||
});
|
||||
$("#g-server-add-close-button", this.element).click(function(event) {
|
||||
$("#g-dialog").dialog("close");
|
||||
window.location.reload();
|
||||
});
|
||||
$("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
|
||||
self.select_file(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-dialog").bind("dialogclose", function(event, ui) {
|
||||
window.location.reload();
|
||||
});
|
||||
},
|
||||
|
||||
taskURL: null,
|
||||
pause: false,
|
||||
|
||||
start_add: function() {
|
||||
var self = this;
|
||||
var paths = [];
|
||||
$.each($("span.selected", self.element), function () {
|
||||
paths.push($(this).attr("ref"));
|
||||
});
|
||||
|
||||
$("#g-server-add-add-button", this.element).hide();
|
||||
$("#g-server-add-pause-button", this.element).show();
|
||||
|
||||
$.ajax({
|
||||
url: START_URL,
|
||||
type: "POST",
|
||||
async: false,
|
||||
data: { "paths[]": paths },
|
||||
dataType: "json",
|
||||
success: function(data, textStatus) {
|
||||
$("#g-status").html(data.status);
|
||||
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
||||
self.taskURL = data.url;
|
||||
setTimeout(function() { self.run_add(); }, 25);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
|
||||
run_add: function () {
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: self.taskURL,
|
||||
async: false,
|
||||
dataType: "json",
|
||||
success: function(data, textStatus) {
|
||||
$("#g-status").html(data.status);
|
||||
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
||||
if (data.done) {
|
||||
$("#g-server-add-progress", this.element).slideUp();
|
||||
$("#g-server-add-add-button", this.element).show();
|
||||
$("#g-server-add-pause-button", this.element).hide();
|
||||
$("#g-server-add-continue-button", this.element).hide();
|
||||
} else {
|
||||
if (!self.pause) {
|
||||
setTimeout(function() { self.run_add(); }, 25);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Load a new directory
|
||||
*/
|
||||
open_dir: function(event) {
|
||||
var self = this;
|
||||
var path = $(event.target).attr("ref");
|
||||
$.ajax({
|
||||
url: GET_CHILDREN_URL.replace("__PATH__", path),
|
||||
success: function(data, textStatus) {
|
||||
$("#g-server-add-tree", self.element).html(data);
|
||||
$("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
|
||||
self.select_file(event);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Manage file selection state.
|
||||
*/
|
||||
select_file: function (event) {
|
||||
$(event.target).toggleClass("selected");
|
||||
if ($("#g-server-add span.selected").length) {
|
||||
$("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled");
|
||||
} else {
|
||||
$("#g-server-add-add-button").enable(false).addClass("ui-state-disabled");
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -1,4 +1,18 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?= $theme->css("server_add.css") ?>
|
||||
<?= $theme->css("jquery.autocomplete.css") ?>
|
||||
<?= $theme->script("jquery.autocomplete.js") ?>
|
||||
<script type="text/javascript">
|
||||
$("document").ready(function() {
|
||||
$("#g-path").autocomplete(
|
||||
"<?= url::site("__ARGS__") ?>".replace("__ARGS__", "admin/server_add/autocomplete"),
|
||||
{
|
||||
max: 256,
|
||||
loadingClass: "g-loading-small",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="g-block">
|
||||
<h1> <?= t("Add from server administration") ?> </h1>
|
||||
<div class="g-block-content">
|
||||
@@ -8,12 +22,17 @@
|
||||
<? if (empty($paths)): ?>
|
||||
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
|
||||
<? endif ?>
|
||||
|
||||
<? foreach ($paths as $id => $path): ?>
|
||||
<li>
|
||||
<?= html::clean($path) ?>
|
||||
<a href="<?= url::site("admin/server_add/remove_path?path=" . urlencode($path) . "&csrf=$csrf") ?>"
|
||||
<a href="<?= url::site("admin/server_add/remove_path?path=" . urlencode($path) . "&csrf=<?= access::csrf_token() ?>") ?>"
|
||||
id="icon_<?= $id ?>"
|
||||
class="g-remove-dir g-button"><span class="ui-icon ui-icon-trash"><?= t("delete") ?></span></a>
|
||||
class="g-remove-dir g-button">
|
||||
<span class="ui-icon ui-icon-trash">
|
||||
<?= t("delete") ?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user