Commit 874695011a0ce91c62f65512313fe0378655ed25

Authored by bryndivey
1 parent c28f0fb1

Some mods to dashboard, fixed bulk action no-having-the-template-in-source-control problem


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6048 c91229c3-7414-0410-bfa2-8a42b809f60b
config/siteMap.inc
... ... @@ -34,7 +34,7 @@ $default->siteMap = new SiteMap(false);
34 34 $default->siteMap->addPage("login", "/login.php", "General", None, "");
35 35  
36 36 // dashboard
37   -$default->siteMap->addPage("ajaxdashboard", "/dashboard2.php", "General", Guest, "dashboard2");
  37 +$default->siteMap->addPage("ajaxdashboard", "/dashboard2.php", "General", Guest, "ajaxdashboard");
38 38  
39 39 // old dashboard
40 40 $default->siteMap->addPage("dashboard", "/dashboard.php", "General", Guest, "dashboard");
... ...
dashboard2.php
... ... @@ -52,7 +52,7 @@ class DashboardDispatcher extends KTStandardDispatcher {
52 52  
53 53 function DashboardDispatcher() {
54 54 $this->aBreadcrumbs = array(
55   - array('action' => 'dashboard', 'name' => _kt('Dashboard')),
  55 + array('action' => 'ajaxdashboard', 'name' => _kt('Dashboard')),
56 56 );
57 57 return parent::KTStandardDispatcher();
58 58 }
... ...
plugins/ktcore/KTBulkActions.php
... ... @@ -72,7 +72,7 @@ class KTBulkDeleteAction extends KTBulkAction {
72 72 $this->store_lists();
73 73 $this->get_lists();
74 74 $oTemplating =& KTTemplating::getSingleton();
75   - $oTemplate = $oTemplating->loadTemplate('ktcore/move_bulk_action_info');
  75 + $oTemplate = $oTemplating->loadTemplate('ktcore/bulk_action_info');
76 76 return $oTemplate->render(array('context' => $this,
77 77 'form' => $this->form_collectinfo()));
78 78 }
... ... @@ -194,7 +194,7 @@ class KTBulkMoveAction extends KTBulkAction {
194 194 $this->store_lists();
195 195 $this->get_lists();
196 196 $oTemplating =& KTTemplating::getSingleton();
197   - $oTemplate = $oTemplating->loadTemplate('ktcore/move_bulk_action_info');
  197 + $oTemplate = $oTemplating->loadTemplate('ktcore/bulk_action_info');
198 198 return $oTemplate->render(array('context' => $this,
199 199 'form' => $this->form_collectinfo()));
200 200 }
... ...
resources/css/kt-framing.css
... ... @@ -1192,6 +1192,7 @@ hr {
1192 1192  
1193 1193 .dashboard_block_handle
1194 1194 {
  1195 + cursor: pointer;
1195 1196 }
1196 1197  
1197 1198 .dashboard_block.rolled-up .dashboard_block_body
... ...
resources/js/dashboard.js
... ... @@ -54,6 +54,8 @@ KTDashboard.CLOSED = 2;
54 54  
55 55 KTDashboard.prototype = {
56 56 'initialize' : function(dashboard) {
  57 + this.element = dashboard;
  58 +
57 59 var dashOpts = {
58 60 'tag':'div',
59 61 'dropOnEmpty':true,
... ... @@ -62,8 +64,7 @@ KTDashboard.prototype = {
62 64 'only' : ['dashboard_block'],
63 65 'handle' : 'dashboard_block_handle'
64 66 };
65   -
66   - MochiKit.Sortable.Sortable.create(dashboard, dashOpts);
  67 + MochiKit.Sortable.Sortable.create(this.element, dashOpts);
67 68  
68 69 var self = this;
69 70 map(function(e) {
... ... @@ -73,14 +74,10 @@ KTDashboard.prototype = {
73 74 var d = new KTDashlet();
74 75 d.initialize(e, self);
75 76 self.dashlets[e.id] = { 'object' : d, 'state' : KTDashboard.OPEN };
76   - }, getElementsByTagAndClassName('*', 'dashboard_block', dashboard));
  77 + }, getElementsByTagAndClassName('*', 'dashboard_block', this.element));
77 78  
78 79 this.addButton = $('add_dashlet');
79 80 connect(this.addButton, 'onclick', this, 'onclickAdd');
80   - //hideElement(this.addButton);
81   -
82   - // alert(keys(this.dashlets));
83   - // alert(values(this.dashlets));
84 81 },
85 82  
86 83 'statusChange' : function(status) {
... ... @@ -152,7 +149,28 @@ KTDashboard.prototype = {
152 149 appendChildNodes(addDialog, closeLink);
153 150 appendChildNodes(addDialogScreen, addDialog);
154 151 appendChildNodes(document.body, addDialogScreen);
  152 + },
  153 +
  154 + 'serialize' : function() {
  155 + var self = this;
  156 + var cols = Set('left', 'right');
  157 + var ret = {};
  158 +
  159 + for(var col in cols) {
  160 + ret[col] = [];
  161 + var container = $('dashboard-container-' + col);
  162 + forEach(getElementsByTagAndClassName('*', 'dashboard_block', container), function(e) {
  163 + if(e.id != '') {
  164 + ret[col].push({'id':e.id, 'state':self.dashlets[e.id]['state']});
  165 + }
  166 + });
  167 + }
  168 +
  169 + alert(ret);
  170 +
155 171 }
  172 +
  173 +
156 174 }
157 175  
158 176  
... ... @@ -167,6 +185,7 @@ addLoadEvent(
167 185 } else {
168 186 var dashboard = new KTDashboard();
169 187 dashboard.initialize($('content'));
  188 + dashboard.serialize();
170 189 }
171 190 });
172 191  
... ...
resources/js/kt-utility.js
... ... @@ -100,3 +100,10 @@ function checkKTError(res) {
100 100 }
101 101 return res;
102 102 }
  103 +
  104 +// Sets
  105 +function Set() {
  106 + var set = {};
  107 + forEach(arguments, function(k) { set[k] = 1; });
  108 + return set;
  109 +}
... ...
templates/ktcore/bulk_action_info.smarty 0 → 100644
  1 +<h2>{$context->getDisplayName()}</h2>
  2 +
  3 +{$form->render()}
... ...