diff --git a/admin/code/CMSBatchAction.php b/admin/code/CMSBatchAction.php index 1e190ca6d..25d04229f 100644 --- a/admin/code/CMSBatchAction.php +++ b/admin/code/CMSBatchAction.php @@ -27,7 +27,38 @@ abstract class CMSBatchAction extends Object { * Return a set of status-updated JavaScript to return to the CMS. */ abstract function run(SS_List $objs); - + + /** + * Helper method for responding to a back action request + * @param $successMessage string - The message to return as a notification. + * Can have up to two %d's in it. The first will be replaced by the number of successful + * changes, the second by the number of failures + * @param $status array - A status array like batchactions builds. Should be + * key => value pairs, the key can be any string: "error" indicates errors, anything + * else indicates a type of success. The value is an array. We don't care what's in it, + * we just use count($value) to find the number of items that succeeded or failed + */ + public function response($successMessage, $status) { + $count = 0; + $errors = 0; + + foreach($status as $k => $v) { + if ($k == 'errors') $errors = count($v); + else $count += count($v); + } + + $response = Controller::curr()->getResponse(); + + if($response) { + $response->setStatusCode( + 200, + sprintf($successMessage, $count, $errors) + ); + } + + return Convert::raw2json($status); + } + /** * Helper method for processing batch actions. * Returns a set of status-updating JavaScript to return to the CMS. @@ -67,15 +98,7 @@ abstract class CMSBatchAction extends Object { unset($obj); } - $response = Controller::curr()->getResponse(); - if($response) { - $response->setStatusCode( - 200, - sprintf($successMessage, $objs->Count(), count($status['error'])) - ); - } - - return Convert::raw2json($status); + return $this->response($successMessage, $status); } diff --git a/admin/css/screen.css b/admin/css/screen.css index 9e4992e1f..afb983def 100644 --- a/admin/css/screen.css +++ b/admin/css/screen.css @@ -545,10 +545,14 @@ body.cms-dialog { overflow: auto; background: url("../images/textures/bg_cms_mai /** -------------------------------------------- "Insert X" forms -------------------------------------------- */ .htmleditorfield-dialog.ui-dialog-content { padding: 0; position: relative; } .htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb .CompositeField { overflow: hidden; *zoom: 1; } -.htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb #RemoteURL { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; width: 55%; float: left; } +.htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb #RemoteURL { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; width: 55%; float: left; position: relative; } +.htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb #RemoteURL label { position: absolute; left: 8px; top: 0px; font-weight: normal; color: #888; } +.htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb #RemoteURL .middleColumn { margin-left: 0; } +.htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb #RemoteURL input.remoteurl { padding-left: 40px; } .htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb button.add-url { padding-top: 15px; overflow: hidden; *zoom: 1; border: none; background: none; opacity: 0.8; cursor: hand; } .htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb button.add-url .btn-icon-addMedia { width: 20px; height: 20px; } .htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb button.add-url:hover, .htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb button.add-url:active { border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; opacity: 1; } +.htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb button.add-url.ui-state-disabled, .htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb button.add-url.ui-state-disabled:hover, .htmleditorfield-dialog #MediaFormInsertMediaTabs_Fromtheweb button.add-url.ui-state-disabled:active { opacity: 0.35; filter: Alpha(Opacity=35); } .htmleditorfield-dialog .cms-content-header { padding: 0; width: 100%; height: 40px; } .htmleditorfield-dialog .cms-content-header h3 { padding: 0 8px; margin: 10px; } .htmleditorfield-dialog .ui-tabs { position: static; } diff --git a/admin/javascript/LeftAndMain.Tree.js b/admin/javascript/LeftAndMain.Tree.js index bf23fd084..f9ffdde84 100644 --- a/admin/javascript/LeftAndMain.Tree.js +++ b/admin/javascript/LeftAndMain.Tree.js @@ -102,7 +102,7 @@ }); }) // Make some jstree events delegatable - .bind('select_node.jstree check_node.jstree', function(e, data) { + .bind('select_node.jstree check_node.jstree uncheck_node.jstree', function(e, data) { $(document).triggerHandler(e, data); }) }, diff --git a/admin/scss/_style.scss b/admin/scss/_style.scss index 4e37fcaed..8db3ff5d9 100644 --- a/admin/scss/_style.scss +++ b/admin/scss/_style.scss @@ -1449,6 +1449,22 @@ body.cms-dialog { @include box-shadow-none; width:55%; float:left; + position: relative; + + label { + position: absolute; + left: 8px; + top: 0px; + font-weight: normal; color: #888; + } + + .middleColumn { + margin-left: 0; + } + + input.remoteurl { + padding-left: 40px; + } } button.add-url{ padding-top:15px; @@ -1466,6 +1482,12 @@ body.cms-dialog { @include box-shadow-none; opacity:1; } + &.ui-state-disabled { + &, &:hover, &:active { + opacity: 0.35; + filter: Alpha(Opacity=35); + } + } } } diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index cc7a1778f..90be1f668 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -392,7 +392,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { $fromWeb = new CompositeField( new LiteralField('headerURL', '