Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 3.0 (one-off)
This is a one-off merge in the direction master->3.0,
to ensure all bugfixes since we branched off find
their way into the next micro/minor release.
From now on, we'll commit to the latest release branch,
and merge back to master. API changes should go into
the master branch (not merged into a release branch).
  • Loading branch information
chillu committed Jul 5, 2012
2 parents 9ce0c9a + 64357a4 commit b691475
Show file tree
Hide file tree
Showing 204 changed files with 3,516 additions and 2,915 deletions.
2 changes: 1 addition & 1 deletion admin/code/LeftAndMain.php
Expand Up @@ -1170,7 +1170,7 @@ function getSilverStripeNavigator() {
* @return int
*/
public function currentPageID() {
if($this->request->requestVar('ID')) {
if($this->request->requestVar('ID') && is_numeric($this->request->requestVar('ID'))) {
return $this->request->requestVar('ID');
} elseif (isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID'])) {
return $this->urlParams['ID'];
Expand Down
32 changes: 24 additions & 8 deletions admin/code/ModelAdmin.php
Expand Up @@ -103,7 +103,7 @@ public function init() {
$models = $this->getManagedModels();

if($this->request->param('ModelClass')) {
$this->modelClass = $this->request->param('ModelClass');
$this->modelClass = $this->unsanitiseClassName($this->request->param('ModelClass'));
} else {
reset($models);
$this->modelClass = key($models);
Expand All @@ -118,7 +118,7 @@ public function init() {
}

public function Link($action = null) {
if(!$action) $action = $this->modelClass;
if(!$action) $action = $this->sanitiseClassName($this->modelClass);
return parent::Link($action);
}

Expand All @@ -127,7 +127,7 @@ function getEditForm($id = null, $fields = null) {
$exportButton = new GridFieldExportButton('before');
$exportButton->setExportColumns($this->getExportFields());
$listField = GridField::create(
$this->modelClass,
$this->sanitiseClassName($this->modelClass),
false,
$list,
$fieldConfig = GridFieldConfig_RecordEditor::create($this->stat('page_length'))
Expand All @@ -150,7 +150,7 @@ function getEditForm($id = null, $fields = null) {
);
$form->addExtraClass('cms-edit-form cms-panel-padded center');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->setFormAction(Controller::join_links($this->Link($this->modelClass), 'EditForm'));
$form->setFormAction(Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'EditForm'));
$form->setAttribute('data-pjax-fragment', 'CurrentForm');

$this->extend('updateEditForm', $form);
Expand Down Expand Up @@ -199,7 +199,7 @@ public function SearchForm() {
new RequiredFields()
);
$form->setFormMethod('get');
$form->setFormAction($this->Link($this->modelClass));
$form->setFormAction($this->Link($this->sanitiseClassName($this->modelClass)));
$form->addExtraClass('cms-search-form');
$form->disableSecurityToken();
$form->loadDataFrom($this->request->getVars());
Expand Down Expand Up @@ -234,13 +234,29 @@ protected function getManagedModelTabs() {
$forms->push(new ArrayData(array (
'Title' => $options['title'],
'ClassName' => $class,
'Link' => $this->Link($class),
'Link' => $this->Link($this->sanitiseClassName($class)),
'LinkOrCurrent' => ($class == $this->modelClass) ? 'current' : 'link'
)));
}

return $forms;
}

/**
* Sanitise a model class' name for inclusion in a link
* @return string
*/
protected function sanitiseClassName($class) {
return str_replace('\\', '-', $class);
}

/**
* Unsanitise a model class' name from a URL param
* @return string
*/
protected function unsanitiseClassName($class) {
return str_replace('-', '\\', $class);
}

/**
* @return array Map of class name to an array of 'title' (see {@link $managed_models})
Expand Down Expand Up @@ -350,7 +366,7 @@ public function ImportForm() {
$fields,
$actions
);
$form->setFormAction(Controller::join_links($this->Link($this->modelClass), 'ImportForm'));
$form->setFormAction(Controller::join_links($this->Link($this->sanitiseClassName($this->modelClass)), 'ImportForm'));

$this->extend('updateImportForm', $form);

Expand Down Expand Up @@ -419,7 +435,7 @@ public function Breadcrumbs($unlinked = false) {
// Show the class name rather than ModelAdmin title as root node
$models = $this->getManagedModels();
$items[0]->Title = $models[$this->modelClass]['title'];
$items[0]->Link = $this->Link($this->modelClass);
$items[0]->Link = $this->Link($this->sanitiseClassName($this->modelClass));

return $items;
}
Expand Down
16 changes: 10 additions & 6 deletions admin/css/screen.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion admin/javascript/LeftAndMain.js
Expand Up @@ -670,7 +670,7 @@ jQuery.noConflict();
showDetailView: function(url) {
// Include any GET parameters from the current URL, as the view state might depend on it.
// For example, a list prefiltered through external search criteria might be passed to GridField.
if(window.location.search) url += window.location.search;
url = $.path.addSearchParams(url, window.location.search.replace(/^\?/, ''));
$('.cms-container').loadPanel(url);
}
});
Expand Down
4 changes: 4 additions & 0 deletions admin/scss/_forms.scss
Expand Up @@ -241,6 +241,10 @@ form.small .field, .field.small {
max-width: ($grid-x * 12);
}

input.month, input.day, input.year {
width: ($grid-x * 7);
}

input.time {
width: ($grid-x * 8); // smaller time field, since input is restricted
}
Expand Down
37 changes: 20 additions & 17 deletions admin/scss/_menu.scss
Expand Up @@ -10,7 +10,7 @@
.cms-logo-header {
background-color: darken($color-dark-bg, 10%);
position: relative;
padding: $grid-y + 1 8px 0 4px;
padding: 0 8px 0 4px;
line-height: 24px;

@include background-image(
Expand All @@ -19,8 +19,6 @@

span {
color: $color-text-light;
white-space: nowrap;
text-overflow: ellipsis;
display: block;

a {
Expand All @@ -32,9 +30,9 @@

.cms-logo {
border-bottom: 1px solid darken($color-dark-separator, 20%);
height: 31px;
overflow: hidden;
padding: 0 0 0 4px;
padding: $grid-y 0;
position: relative;
vertical-align: middle;
font-size: $font-base-size;

Expand All @@ -43,12 +41,13 @@
}

a {
display: inline-block;
height: 24px;
position: absolute;
top: $grid-y;
bottom: $grid-y;
left: 4px;
display: block;
width: 24px;
float: left;
margin-right: 8px;
background: $application-logo-small no-repeat;
background: $application-logo-small no-repeat left center;
text-indent: -9999em;
padding-right: 7px;
border-right: 1px solid $color-dark-separator;
Expand All @@ -57,8 +56,9 @@
span {
font-weight: bold;
font-size: 14px;
@include hide-text-overflow();
padding-top:1px;
line-height: 20px;
padding: 2px 0;
margin-left: 44px;
}
}

Expand Down Expand Up @@ -112,12 +112,15 @@
.cms-menu-list {
overflow-x: hidden;
overflow-y: auto;

li span.text {
display: none;
}
li ul {
li{
width: 100%;
float: left;
span.text {
display: none;
}
ul {
display: none;
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions admin/scss/_style.scss
Expand Up @@ -1280,8 +1280,14 @@ form.member-profile-form {
background-image: none;
}

.cms .ui-dialog .ss-ui-dialog.ui-dialog-content {
padding-top: 0px; //removes padding so that tabs are flush with header
.cms .ui-dialog{
min-width:570px;
.htmleditorfield-dialog{
min-width:570px;
}
.ss-ui-dialog.ui-dialog-content {
padding-top: 0px; //removes padding so that tabs are flush with header
}
}

// Elements with this class can either frame inline markup or an iframe,
Expand Down Expand Up @@ -1544,7 +1550,7 @@ body.cms-dialog {
padding:0;
}
}
.ss-insert-media, .Actions{
.ss-insert-media, .Actions, .ss-insert-link{
padding:$grid-y $grid-x*2 ;
}
.details{
Expand Down
2 changes: 1 addition & 1 deletion admin/scss/ie7.scss
Expand Up @@ -211,7 +211,7 @@ table.ss-gridfield-table {
right: 0;
}
}


.ss-ui-button{
&.ss-gridfield-button-filter{
Expand Down
27 changes: 26 additions & 1 deletion api/RSSFeed.php
Expand Up @@ -8,6 +8,7 @@
* @subpackage integration
*/
class RSSFeed extends ViewableData {

/**
* Casting information for this object's methods.
* Let's us use $Title.XML in templates
Expand Down Expand Up @@ -80,6 +81,11 @@ class RSSFeed extends ViewableData {
*/
protected $etag;

/**
* @var string
*/
protected $template = 'RSSFeed';

/**
* Constructor
*
Expand Down Expand Up @@ -203,10 +209,29 @@ function outputToBrowser() {
function feedContent() {
$prevState = SSViewer::get_source_file_comments();
SSViewer::set_source_file_comments(false);
$content = str_replace(' ', ' ', $this->renderWith('RSSFeed'));
$content = str_replace(' ', ' ', $this->renderWith($this->getTemplate()));
SSViewer::set_source_file_comments($prevState);
return $content;
}

/**
* Set the name of the template to use. Actual template will be resolved
* via the standard template inclusion process.
*
* @param string
*/
public function setTemplate($template) {
$this->template = $template;
}

/**
* Returns the name of the template to use.
*
* @return string
*/
public function getTemplate() {
return $this->template;
}
}

/**
Expand Down
24 changes: 22 additions & 2 deletions control/HTTPRequest.php
Expand Up @@ -228,10 +228,30 @@ function removeHeader($header) {
}

/**
* Returns the URL used to generate the page
*
* @param bool $includeGetVars whether or not to include the get parameters\
*
* @return string
*/
function getURL() {
return ($this->getExtension()) ? $this->url . '.' . $this->getExtension() : $this->url;
function getURL($includeGetVars = false) {
$url = ($this->getExtension()) ? $this->url . '.' . $this->getExtension() : $this->url;

if ($includeGetVars) {
// if we don't unset $vars['url'] we end up with /my/url?url=my/url&foo=bar etc

$vars = $this->getVars();
unset($vars['url']);

if (count($vars)) {
$url .= '?' . http_build_query($vars);
}
}
else if(strpos($url, "?") !== false) {
$url = substr($url, 0, strpos($url, "?"));
}

return $url;
}

/**
Expand Down

0 comments on commit b691475

Please sign in to comment.