summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/views/welcome.html.php11
-rw-r--r--modules/rearrange/controllers/rearrange.php6
-rw-r--r--modules/rearrange/css/jquery.simple.tree.css179
-rw-r--r--modules/rearrange/helpers/rearrange.php33
-rw-r--r--modules/rearrange/helpers/rearrange_block.php30
-rw-r--r--modules/rearrange/js/rearrange_tree.js0
-rw-r--r--modules/rearrange/views/rearrange.html.php44
7 files changed, 296 insertions, 7 deletions
diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php
index 16b4659a..5e683690 100644
--- a/core/views/welcome.html.php
+++ b/core/views/welcome.html.php
@@ -129,9 +129,10 @@
text-decoration: underline;
}
</style>
- <script type="text/javascript" src="<?= url::file("lib/jquery.js") ?>"></script>
- <script type="text/javascript" src="<?= url::file("lib/jquery.cookie.js") ?>"></script>
- <script type="text/javascript" src="<?= url::file("lib/jquery.MultiFile.js") ?>"></script>
+ <?= html::script("lib/jquery.js") ?>
+ <?= html::script("lib/jquery.cookie.js") ?>
+ <?= html::script("lib/jquery.MultiFile.js") ?>
+ <?= rearrange_block::head(null) ?>
</head>
<body>
<div class="outer">
@@ -248,6 +249,10 @@
<input type="hidden" name="type" value="album"/>
</form>
</fieldset>
+ <fieldset>
+ <legend>Rearrange</legend>
+ <?= rearrange::get_html()->render() ?>
+ </fieldset>
</div>
<div id="access" class="activity">
diff --git a/modules/rearrange/controllers/rearrange.php b/modules/rearrange/controllers/rearrange.php
index d5cebd4a..a04cc158 100644
--- a/modules/rearrange/controllers/rearrange.php
+++ b/modules/rearrange/controllers/rearrange.php
@@ -21,13 +21,11 @@ class Rearrange_Controller extends REST_Controller {
protected $resource_type = "item";
public function _show($item) {
- throw new Exception("@todo Rearrange_Controller::_show NOT IMPLEMENTED");
+ print rearrange::get_html($item)->render();
}
public function _index() {
- // @todo: represent this in different formats
- $root = ORM::factory("item", 1);
- $this->_show($root);
+ print rearrange::get_html()->render();
}
public function _form_add($item_id) {
diff --git a/modules/rearrange/css/jquery.simple.tree.css b/modules/rearrange/css/jquery.simple.tree.css
new file mode 100644
index 00000000..a874c53b
--- /dev/null
+++ b/modules/rearrange/css/jquery.simple.tree.css
@@ -0,0 +1,179 @@
+@CHARSET "UTF-8";
+
+.simpleTree {
+ font: normal 12px arial, tahoma, helvetica, sans-serif;
+ margin:0;
+ padding:20px;
+ margin:0;
+ padding:0;
+ /*
+ overflow:auto;
+ width: 250px;
+ height:350px;
+ overflow:auto;
+ border: 1px solid #444444;
+ */
+}
+
+.simpleTree li {
+ list-style: none;
+ margin:0;
+ padding:0 0 0 34px;
+ line-height: 14px;
+}
+.simpleTree li span {
+ display:inline;
+ clear: left;
+ white-space: nowrap;
+}
+
+.simpleTree ul {
+ margin:0;
+ padding:0;
+}
+.simpleTree .root {
+ margin-left:-16px;
+ background: url(../images/root.gif) no-repeat 16px 0 #ffffff;
+}
+
+.simpleTree .line {
+ margin:0 0 0 -16px;
+ padding:0;
+ line-height: 3px;
+ height:3px;
+ font-size:3px;
+ background: url(../images/line_bg.gif) 0 0 no-repeat transparent;
+}
+
+.simpleTree .line-last {
+ margin:0 0 0 -16px;
+ padding:0;
+ line-height: 3px;
+ height:3px;
+ font-size:3px;
+ background: url(../images/spacer.gif) 0 0 no-repeat transparent;
+}
+
+.simpleTree .line-over {
+ margin:0 0 0 -16px;
+ padding:0;
+ line-height: 3px;
+ height:3px;
+ font-size:3px;
+ background: url(../images/line_bg_over.gif) 0 0 no-repeat transparent;
+}
+
+.simpleTree .line-over-last {
+ margin:0 0 0 -16px;
+ padding:0;
+ line-height: 3px;
+ height:3px;
+ font-size:3px;
+ background: url(../images/line_bg_over_last.gif) 0 0 no-repeat transparent;
+}
+
+.simpleTree .folder-open {
+ margin-left:-16px;
+ background: url(../images/collapsable.gif) 0 -2px no-repeat #fff;
+}
+
+.simpleTree .folder-open-last {
+ margin-left:-16px;
+ background: url(../images/collapsable-last.gif) 0 -2px no-repeat #fff;
+}
+
+.simpleTree .folder-close {
+ margin-left:-16px;
+ background: url(../images/expandable.gif) 0 -2px no-repeat #fff;
+}
+
+.simpleTree .folder-close-last {
+ margin-left:-16px;
+ background: url(../images/expandable-last.gif) 0 -2px no-repeat #fff;
+}
+
+.simpleTree .doc {
+ margin-left:-16px;
+ background: url(../images/leaf.gif) 0 -1px no-repeat #fff;
+}
+
+.simpleTree .doc-last {
+ margin-left:-16px;
+ background: url(../images/leaf-last.gif) 0 -1px no-repeat #fff;
+}
+
+.simpleTree .ajax {
+ background: url(../images/spinner.gif) no-repeat 0 0 #ffffff;
+ height: 16px;
+ display:none;
+}
+
+.simpleTree .ajax li {
+ display:none;
+ margin:0;
+ padding:0;
+}
+
+.simpleTree .trigger {
+ display:inline;
+ margin-left:-32px;
+ width: 28px;
+ height: 11px;
+ cursor:pointer;
+}
+
+.simpleTree .text {
+ cursor: default;
+}
+
+.simpleTree .active {
+ cursor: default;
+ background-color:#F7BE77;
+ padding:0px 2px;
+ border: 1px dashed #444;
+}
+
+#drag_container {
+ background:#ffffff;
+ color:#000;
+ font: normal 11px arial, tahoma, helvetica, sans-serif;
+ border: 1px dashed #767676;
+}
+
+#drag_container ul {
+ list-style: none;
+ padding:0;
+ margin:0;
+}
+
+
+#drag_container li {
+ list-style: none;
+ background-color:#ffffff;
+ line-height:18px;
+ white-space: nowrap;
+ padding:1px 1px 0px 16px;
+ margin:0;
+}
+
+#drag_container li span {
+ padding:0;
+}
+
+
+#drag_container li.doc, #drag_container li.doc-last {
+ background: url(../images/leaf.gif) no-repeat -17px 0 #ffffff;
+}
+
+#drag_container .folder-close, #drag_container .folder-close-last {
+ background: url(../images/expandable.gif) no-repeat -17px 0 #ffffff;
+}
+
+
+#drag_container .folder-open, #drag_container .folder-open-last {
+ background: url(../images/collapsable.gif) no-repeat -17px 0 #ffffff;
+}
+
+.contextMenu {
+ display:none;
+}
diff --git a/modules/rearrange/helpers/rearrange.php b/modules/rearrange/helpers/rearrange.php
new file mode 100644
index 00000000..815014bc
--- /dev/null
+++ b/modules/rearrange/helpers/rearrange.php
@@ -0,0 +1,33 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2008 Bharat Mediratta
+ *
+ * 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; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class rearrange_Core {
+ public static function get_html($item=null) {
+ $view = new View("rearrange.html");
+
+ $view->root = null;
+ if (empty($item)) {
+ $item = ORM::factory("item", 1);
+ $view->root = $item;
+ }
+
+ $view->children = $item->children();
+ return $view;
+ }
+}
diff --git a/modules/rearrange/helpers/rearrange_block.php b/modules/rearrange/helpers/rearrange_block.php
new file mode 100644
index 00000000..24dead6b
--- /dev/null
+++ b/modules/rearrange/helpers/rearrange_block.php
@@ -0,0 +1,30 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2008 Bharat Mediratta
+ *
+ * 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; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class rearrange_block_Core {
+ public static function head($theme) {
+ $head[] = html::script("modules/rearrange/js/jquery.simple.tree.js");
+
+ $url = url::file("modules/rearrange/css/jquery.simple.tree.css");
+ $head[] = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" " .
+ "media=\"screen,print,projection\" />";
+
+ return implode("\n", $head);
+ }
+}
diff --git a/modules/rearrange/js/rearrange_tree.js b/modules/rearrange/js/rearrange_tree.js
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/modules/rearrange/js/rearrange_tree.js
diff --git a/modules/rearrange/views/rearrange.html.php b/modules/rearrange/views/rearrange.html.php
new file mode 100644
index 00000000..64b711ff
--- /dev/null
+++ b/modules/rearrange/views/rearrange.html.php
@@ -0,0 +1,44 @@
+<?php defined("SYSPATH") or die("No direct script access."); ?>
+
+<? if ($root): ?>
+ <script>
+ var simpleTree_Rearrange;
+ $(document).ready(function() {
+ simpleTree_Rearrange = $(".simpleTree").simpleTree({
+ autoclose: false,
+ animate: true,
+ afterClick:function(node) {
+ alert("text-"+$('span:first', node).text());
+ },
+ afterDblClick:function(node) {
+ alert("text-"+$('span:first', node).text());
+ },
+ afterMove:function(destination, source, pos) {
+ alert("destination: "+destination.attr('id') + "\n" +
+ "source: "+source.attr('id') + "\n" +
+ "pos: " + pos);
+ },
+ afterAjax:function() {
+ }
+ });
+ });
+ </script>
+ <ul class="simpleTree">
+ <li class="root" id="<?= $root->id?>"><span><?= $root->title?></span>
+<? endif; ?>
+<ul>
+ <? foreach ($children as $child): ?>
+ <li id="<?= $child->id?>"><span class="text"><?= $child->title?></span>
+ <? if ($child->type == "album"): ?>
+ <ul class="ajax">
+ <li><?= url::site("rearrange/$child->id") ?></li>
+ </ul>
+ <? endif; ?>
+ </li>
+ <? endforeach;?>
+</ul>
+<? if ($root): ?>
+ </li>
+ </ul>
+<? endif; ?>
+