From 874695011a0ce91c62f65512313fe0378655ed25 Mon Sep 17 00:00:00 2001 From: bryndivey Date: Thu, 9 Nov 2006 08:40:22 +0000 Subject: [PATCH] Some mods to dashboard, fixed bulk action no-having-the-template-in-source-control problem --- config/siteMap.inc | 2 +- dashboard2.php | 2 +- plugins/ktcore/KTBulkActions.php | 4 ++-- resources/css/kt-framing.css | 1 + resources/js/dashboard.js | 33 ++++++++++++++++++++++++++------- resources/js/kt-utility.js | 7 +++++++ templates/ktcore/bulk_action_info.smarty | 3 +++ 7 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 templates/ktcore/bulk_action_info.smarty diff --git a/config/siteMap.inc b/config/siteMap.inc index 1112103..c4b1d7c 100644 --- a/config/siteMap.inc +++ b/config/siteMap.inc @@ -34,7 +34,7 @@ $default->siteMap = new SiteMap(false); $default->siteMap->addPage("login", "/login.php", "General", None, ""); // dashboard -$default->siteMap->addPage("ajaxdashboard", "/dashboard2.php", "General", Guest, "dashboard2"); +$default->siteMap->addPage("ajaxdashboard", "/dashboard2.php", "General", Guest, "ajaxdashboard"); // old dashboard $default->siteMap->addPage("dashboard", "/dashboard.php", "General", Guest, "dashboard"); diff --git a/dashboard2.php b/dashboard2.php index b33cdc0..f67117b 100644 --- a/dashboard2.php +++ b/dashboard2.php @@ -52,7 +52,7 @@ class DashboardDispatcher extends KTStandardDispatcher { function DashboardDispatcher() { $this->aBreadcrumbs = array( - array('action' => 'dashboard', 'name' => _kt('Dashboard')), + array('action' => 'ajaxdashboard', 'name' => _kt('Dashboard')), ); return parent::KTStandardDispatcher(); } diff --git a/plugins/ktcore/KTBulkActions.php b/plugins/ktcore/KTBulkActions.php index 82b5118..2838c8f 100644 --- a/plugins/ktcore/KTBulkActions.php +++ b/plugins/ktcore/KTBulkActions.php @@ -72,7 +72,7 @@ class KTBulkDeleteAction extends KTBulkAction { $this->store_lists(); $this->get_lists(); $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('ktcore/move_bulk_action_info'); + $oTemplate = $oTemplating->loadTemplate('ktcore/bulk_action_info'); return $oTemplate->render(array('context' => $this, 'form' => $this->form_collectinfo())); } @@ -194,7 +194,7 @@ class KTBulkMoveAction extends KTBulkAction { $this->store_lists(); $this->get_lists(); $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('ktcore/move_bulk_action_info'); + $oTemplate = $oTemplating->loadTemplate('ktcore/bulk_action_info'); return $oTemplate->render(array('context' => $this, 'form' => $this->form_collectinfo())); } diff --git a/resources/css/kt-framing.css b/resources/css/kt-framing.css index f6480dd..4707418 100644 --- a/resources/css/kt-framing.css +++ b/resources/css/kt-framing.css @@ -1192,6 +1192,7 @@ hr { .dashboard_block_handle { + cursor: pointer; } .dashboard_block.rolled-up .dashboard_block_body diff --git a/resources/js/dashboard.js b/resources/js/dashboard.js index 225cb72..61d93ae 100644 --- a/resources/js/dashboard.js +++ b/resources/js/dashboard.js @@ -54,6 +54,8 @@ KTDashboard.CLOSED = 2; KTDashboard.prototype = { 'initialize' : function(dashboard) { + this.element = dashboard; + var dashOpts = { 'tag':'div', 'dropOnEmpty':true, @@ -62,8 +64,7 @@ KTDashboard.prototype = { 'only' : ['dashboard_block'], 'handle' : 'dashboard_block_handle' }; - - MochiKit.Sortable.Sortable.create(dashboard, dashOpts); + MochiKit.Sortable.Sortable.create(this.element, dashOpts); var self = this; map(function(e) { @@ -73,14 +74,10 @@ KTDashboard.prototype = { var d = new KTDashlet(); d.initialize(e, self); self.dashlets[e.id] = { 'object' : d, 'state' : KTDashboard.OPEN }; - }, getElementsByTagAndClassName('*', 'dashboard_block', dashboard)); + }, getElementsByTagAndClassName('*', 'dashboard_block', this.element)); this.addButton = $('add_dashlet'); connect(this.addButton, 'onclick', this, 'onclickAdd'); - //hideElement(this.addButton); - - // alert(keys(this.dashlets)); - // alert(values(this.dashlets)); }, 'statusChange' : function(status) { @@ -152,7 +149,28 @@ KTDashboard.prototype = { appendChildNodes(addDialog, closeLink); appendChildNodes(addDialogScreen, addDialog); appendChildNodes(document.body, addDialogScreen); + }, + + 'serialize' : function() { + var self = this; + var cols = Set('left', 'right'); + var ret = {}; + + for(var col in cols) { + ret[col] = []; + var container = $('dashboard-container-' + col); + forEach(getElementsByTagAndClassName('*', 'dashboard_block', container), function(e) { + if(e.id != '') { + ret[col].push({'id':e.id, 'state':self.dashlets[e.id]['state']}); + } + }); + } + + alert(ret); + } + + } @@ -167,6 +185,7 @@ addLoadEvent( } else { var dashboard = new KTDashboard(); dashboard.initialize($('content')); + dashboard.serialize(); } }); diff --git a/resources/js/kt-utility.js b/resources/js/kt-utility.js index d297716..212a831 100644 --- a/resources/js/kt-utility.js +++ b/resources/js/kt-utility.js @@ -100,3 +100,10 @@ function checkKTError(res) { } return res; } + +// Sets +function Set() { + var set = {}; + forEach(arguments, function(k) { set[k] = 1; }); + return set; +} diff --git a/templates/ktcore/bulk_action_info.smarty b/templates/ktcore/bulk_action_info.smarty new file mode 100644 index 0000000..d61363c --- /dev/null +++ b/templates/ktcore/bulk_action_info.smarty @@ -0,0 +1,3 @@ +

{$context->getDisplayName()}

+ +{$form->render()} -- libgit2 0.21.4