From 7ae004f76fafa3f0d31b39c45505e66d9be9b8cf Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sat, 29 Nov 2008 20:02:30 +0000 Subject: The gui part of rearranging albums and photos on the welcome page. Haven't finished the ajax back end to actually do the move, but thought i'd put the gui up so people can play --- modules/rearrange/controllers/rearrange.php | 6 +- modules/rearrange/css/jquery.simple.tree.css | 179 ++++++++++++++++++++++++++ modules/rearrange/helpers/rearrange.php | 33 +++++ modules/rearrange/helpers/rearrange_block.php | 30 +++++ modules/rearrange/js/rearrange_tree.js | 0 modules/rearrange/views/rearrange.html.php | 44 +++++++ 6 files changed, 288 insertions(+), 4 deletions(-) create mode 100644 modules/rearrange/css/jquery.simple.tree.css create mode 100644 modules/rearrange/helpers/rearrange.php create mode 100644 modules/rearrange/helpers/rearrange_block.php create mode 100644 modules/rearrange/js/rearrange_tree.js create mode 100644 modules/rearrange/views/rearrange.html.php (limited to 'modules') 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 @@ +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 @@ +"; + + 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 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 @@ + + + + + + + -- cgit v1.2.3