Update Script for renaming com.arsdigita.cms.Workspace to com.arsdigita.cms.ContentCenter.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2123 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-04-12 08:51:54 +00:00
parent 0f1a13c876
commit a176171d1d
6 changed files with 157 additions and 80 deletions

View File

@ -0,0 +1,30 @@
--
-- Copyright (C) 2013 Jens Pelzetter All Rights Reserved.
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public License
-- as published by the Free Software Foundation; either version 2.1 of
-- the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $Id$
-- rename com.arsdigita.cms.Workspace to com.arsdigita.cms.ContentCenter
-- adjust various system tables to the new name of application
UPDATE application_types
SET object_type = 'com.arsdigita.cms.ContentCenter'
WHERE object_type = 'com.arsdigita.cms.Workspace';
UPDATE acs_objects
SET object_type = 'com.arsdigita.cms.ContentCenter',
default_domain_class = 'com.arsdigita.cms.ContentCenter'
WHERE object_type = 'com.arsdigita.cms.Workspace';

View File

@ -0,0 +1,23 @@
--
-- Copyright (C) 2013 Jens Pelzetter All Rights Reserved.
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public License
-- as published by the Free Software Foundation; either version 2.1 of
-- the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $Id$
-- Update: Rename com.arsdigta.cms.Workspace to com.arsdigita.cms.ContentCenter
PROMPT Red Hat Enterprise CMS 6.6.7 -> 6.6.8 Upgrade Script (Oracle)
@@ ../default/upgrade/6.6.7-6.6.8/rename_workspace_to_contentcenter.sql

View File

@ -0,0 +1,28 @@
--
-- Copyright (C) 2013 Jens Pelzetter All Rights Reserved.
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public License
-- as published by the Free Software Foundation; either version 2.1 of
-- the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $DateTime$
-- $Id$
-- Update: Rename com.arsdigta.cms.Workspace to com.arsdigita.cms.ContentCenter
\echo Red Hat Enterprise CMS 6.6.7 -> 6.6.8 Upgrade Script (PostgreSQL)
begin;
\i ../default/upgrade/6.6.7-6.6.8/rename_workspace_to_contentcenter.sql
commit;

View File

@ -62,4 +62,8 @@
<!-- CMS Workspace&Service now loaded as legacy free application --> <!-- CMS Workspace&Service now loaded as legacy free application -->
<script sql="ccm-cms/upgrade/::database::-6.6.6-6.6.7.sql"/> <script sql="ccm-cms/upgrade/::database::-6.6.6-6.6.7.sql"/>
</version> </version>
<version from="6.6.7" to="6.6.8">
<!-- Rename com.arsdigita.cms.Workspace to com.arsdigita.cms.ContentCenter -->
<script sql="ccm-cms/upgrade/::database::-6.6.7-6.6.8.sql"/>
</version>
</upgrade> </upgrade>

View File

@ -58,3 +58,4 @@ cms.ui.contentcenter.section=Section
cms.ui.set_home_folder=Set as home folder cms.ui.set_home_folder=Set as home folder
cms.ui.go_to_home_folder=Go to home folder cms.ui.go_to_home_folder=Go to home folder
cms.ui.no_home_folder_selected=No home folder selected cms.ui.no_home_folder_selected=No home folder selected
cms.ui.contentcenter.action=Action

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui.contentcenter; package com.arsdigita.cms.ui.contentcenter;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
@ -34,6 +33,7 @@ import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.Hidden; import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.table.DefaultTableCellRenderer;
import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
@ -77,7 +77,6 @@ public class ContentSectionContainer extends CMSContainer {
private ContentSectionTable m_table; private ContentSectionTable m_table;
private FormContainer m_formContainer; private FormContainer m_formContainer;
private SingleSelectionModel m_typeSel; private SingleSelectionModel m_typeSel;
private SingleSelectionModel m_sectionSel; private SingleSelectionModel m_sectionSel;
@ -102,8 +101,8 @@ public class ContentSectionContainer extends CMSContainer {
m_typeSel = typeSel; m_typeSel = typeSel;
m_sectionSel = sectionSel; m_sectionSel = sectionSel;
m_formContainer = new FormContainer(); m_formContainer = new FormContainer();
add(m_formContainer); add(m_formContainer);
m_table = new ContentSectionTable(); m_table = new ContentSectionTable();
add(m_table); add(m_table);
} }
@ -111,7 +110,7 @@ public class ContentSectionContainer extends CMSContainer {
@Override @Override
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
p.setVisibleDefault(m_formContainer, false); p.setVisibleDefault(m_formContainer, false);
} }
/** /**
@ -128,33 +127,34 @@ public class ContentSectionContainer extends CMSContainer {
m_form = new StaticNewItemForm(m_sectionIdParam); m_form = new StaticNewItemForm(m_sectionIdParam);
m_form.addSubmissionListener(new FormSubmissionListener() { m_form.addSubmissionListener(new FormSubmissionListener() {
/** /**
* Cancels the form if the user lacks the "create new items" privilege. * Cancels the form if the user lacks the "create new items" privilege.
*/ */
public void submitted(FormSectionEvent event) public void submitted(FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
PageState state = event.getPageState(); PageState state = event.getPageState();
StaticNewItemForm form = (StaticNewItemForm) event.getSource(); StaticNewItemForm form = (StaticNewItemForm) event.getSource();
ContentSection section = form.getContentSection(state); ContentSection section = form.getContentSection(state);
SecurityManager sm = new SecurityManager(section); SecurityManager sm = new SecurityManager(section);
Folder folder = null; Folder folder = null;
User user = Web.getContext().getUser(); User user = Web.getContext().getUser();
if ( user != null ) { if (user != null) {
folder = Folder.getUserHomeFolder(user,section); folder = Folder.getUserHomeFolder(user, section);
}
if ( folder == null ) {
folder = section.getRootFolder();
}
if (! sm.canAccess(state.getRequest(),
SecurityManager.NEW_ITEM, folder)) {
throw new FormProcessException(
(String) GlobalizationUtil.globalize(
"cms.ui.insufficient_privileges").localize());
}
} }
}); if (folder == null) {
folder = section.getRootFolder();
}
if (!sm.canAccess(state.getRequest(),
SecurityManager.NEW_ITEM, folder)) {
throw new FormProcessException(
(String) GlobalizationUtil.globalize(
"cms.ui.insufficient_privileges").localize());
}
}
});
m_form.addProcessListener(new FormProcessListener() { m_form.addProcessListener(new FormProcessListener() {
/** /**
@ -165,12 +165,13 @@ public class ContentSectionContainer extends CMSContainer {
PageState state = e.getPageState(); PageState state = e.getPageState();
BigDecimal typeId = form.getTypeID(state); BigDecimal typeId = form.getTypeID(state);
if( typeId != null ) { if (typeId != null) {
BigDecimal sectionId = form.getContentSectionID(state); BigDecimal sectionId = form.getContentSectionID(state);
m_sectionSel.setSelectedKey(state, sectionId); m_sectionSel.setSelectedKey(state, sectionId);
m_typeSel.setSelectedKey(state, typeId); m_typeSel.setSelectedKey(state, typeId);
} }
} }
}); });
add(m_form); add(m_form);
@ -185,6 +186,7 @@ public class ContentSectionContainer extends CMSContainer {
public StaticNewItemForm getNewItemForm() { public StaticNewItemForm getNewItemForm() {
return m_form; return m_form;
} }
} }
private static class StaticNewItemForm extends NewItemForm { private static class StaticNewItemForm extends NewItemForm {
@ -198,7 +200,6 @@ public class ContentSectionContainer extends CMSContainer {
setProcessInvisible(true); setProcessInvisible(true);
} }
/** /**
* Sets the id of the content section in this form. This ID is * Sets the id of the content section in this form. This ID is
* used to generate a list of available content types in the * used to generate a list of available content types in the
@ -215,7 +216,6 @@ public class ContentSectionContainer extends CMSContainer {
m_sectionIDParamWidget.setValue(state, id); m_sectionIDParamWidget.setValue(state, id);
} }
/** /**
* Retrieves the content section for this form given the specified * Retrieves the content section for this form given the specified
* page state. This method will return null if there is no content * page state. This method will return null if there is no content
@ -239,7 +239,6 @@ public class ContentSectionContainer extends CMSContainer {
return section; return section;
} }
/** /**
* Retrieves the ID of the content section for this form given the * Retrieves the ID of the content section for this form given the
* specified page state. This method will return null if no * specified page state. This method will return null if no
@ -257,7 +256,6 @@ public class ContentSectionContainer extends CMSContainer {
} }
/** /**
* A table that displays all content sections, with links to their * A table that displays all content sections, with links to their
* locations and admin pages and a {@link NewItemForm} next to each * locations and admin pages and a {@link NewItemForm} next to each
@ -281,8 +279,7 @@ public class ContentSectionContainer extends CMSContainer {
Integer colNo = 0; Integer colNo = 0;
Label emptyView = new Label Label emptyView = new Label("There are currently no content sections installed.");
("There are currently no content sections installed.");
emptyView.setFontWeight(Label.ITALIC); emptyView.setFontWeight(Label.ITALIC);
setEmptyView(emptyView); setEmptyView(emptyView);
@ -294,13 +291,13 @@ public class ContentSectionContainer extends CMSContainer {
//TableColumn contentSectionColumn = new TableColumn(colNo, COLUMN_SECTION); //TableColumn contentSectionColumn = new TableColumn(colNo, COLUMN_SECTION);
TableColumn contentSectionColumn = new TableColumn( TableColumn contentSectionColumn = new TableColumn(
colNo, colNo,
(String)GlobalizationUtil.globalize("cms.ui.contentcenter.section").localize(), (String) GlobalizationUtil.globalize("cms.ui.contentcenter.section").localize(),
COLUMN_SECTION); COLUMN_SECTION);
contentSectionColumn.setCellRenderer(new AdminURLTableCellRenderer()); contentSectionColumn.setCellRenderer(new AdminURLTableCellRenderer());
columnModel.add(contentSectionColumn); columnModel.add(contentSectionColumn);
if( !ContentSection.getConfig().getHideLegacyPublicSiteLink() ) { if (!ContentSection.getConfig().getHideLegacyPublicSiteLink()) {
TableColumn locationColumn = new TableColumn(colNo ++, TableColumn locationColumn = new TableColumn(colNo++,
COLUMN_LOCATION); COLUMN_LOCATION);
locationColumn.setCellRenderer(new URLTableCellRenderer()); locationColumn.setCellRenderer(new URLTableCellRenderer());
columnModel.add(locationColumn); columnModel.add(locationColumn);
@ -308,7 +305,7 @@ public class ContentSectionContainer extends CMSContainer {
TableColumn actionColumn = new TableColumn( TableColumn actionColumn = new TableColumn(
colNo++, colNo++,
(String)GlobalizationUtil.globalize("cms.ui.contentcenter.action").localize(), (String) GlobalizationUtil.globalize("cms.ui.contentcenter.action").localize(),
COLUMN_ACTION); COLUMN_ACTION);
actionColumn.setCellRenderer(new ActionTableCellRenderer()); actionColumn.setCellRenderer(new ActionTableCellRenderer());
columnModel.add(actionColumn); columnModel.add(actionColumn);
@ -316,21 +313,20 @@ public class ContentSectionContainer extends CMSContainer {
setModelBuilder(new ContentSectionTableModelBuilder()); setModelBuilder(new ContentSectionTableModelBuilder());
} }
/** /**
* An ContentSections table model builder * An ContentSections table model builder
* *
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
**/ **/
private class ContentSectionTableModelBuilder extends LockableImpl private class ContentSectionTableModelBuilder extends LockableImpl
implements TableModelBuilder { implements TableModelBuilder {
public TableModel makeModel(Table table, PageState state) { public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
return new ContentSectionTableModel((ContentSectionTable) table, state); return new ContentSectionTableModel((ContentSectionTable) table, state);
} }
}
}
/** /**
* An ContentSections table model * An ContentSections table model
@ -342,7 +338,6 @@ public class ContentSectionContainer extends CMSContainer {
private ContentSectionTable m_table; private ContentSectionTable m_table;
private TableColumnModel m_columnModel; private TableColumnModel m_columnModel;
private PageState m_state; private PageState m_state;
private ContentSectionCollection m_contentSections; private ContentSectionCollection m_contentSections;
private ContentSection m_section; private ContentSection m_section;
@ -359,7 +354,6 @@ public class ContentSectionContainer extends CMSContainer {
Kernel.getContext().getParty().getOID()); Kernel.getContext().getParty().getOID());
} }
/** /**
* Returns a collection of ContentSections to display in this * Returns a collection of ContentSections to display in this
* table. This implementation orders the content sections by * table. This implementation orders the content sections by
@ -391,7 +385,7 @@ public class ContentSectionContainer extends CMSContainer {
* @param columnIndex The index of the current column * @param columnIndex The index of the current column
**/ **/
public Object getElementAt(int columnIndex) { public Object getElementAt(int columnIndex) {
if(m_columnModel == null || m_section == null) { if (m_columnModel == null || m_section == null) {
return null; return null;
} }
@ -399,9 +393,8 @@ public class ContentSectionContainer extends CMSContainer {
String columnName = (String) tc.getHeaderValue(); String columnName = (String) tc.getHeaderValue();
Object result = m_section; Object result = m_section;
if (columnName.equals(COLUMN_SECTION) || if (columnName.equals(COLUMN_SECTION) || columnName.equals(COLUMN_LOCATION) || columnName.equals(
columnName.equals(COLUMN_LOCATION) || COLUMN_ACTION)) {
columnName.equals(COLUMN_ACTION)) {
result = m_section; result = m_section;
} }
return result; return result;
@ -424,8 +417,8 @@ public class ContentSectionContainer extends CMSContainer {
protected PageState getPageState() { protected PageState getPageState() {
return m_state; return m_state;
} }
}
}
/** /**
* Sets the hidden parameter in the form containers form to * Sets the hidden parameter in the form containers form to
@ -436,29 +429,29 @@ public class ContentSectionContainer extends CMSContainer {
* @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a> * @author <a href="mailto:mbryzek@arsdigita.com">Michael Bryzek</a>
**/ **/
private class ActionTableCellRenderer implements TableCellRenderer { private class ActionTableCellRenderer implements TableCellRenderer {
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {
ContentSection section = (ContentSection) value; ContentSection section = (ContentSection) value;
Folder folder = null; Folder folder = null;
User user = Web.getContext().getUser(); User user = Web.getContext().getUser();
if ( user != null ) { if (user != null) {
folder = Folder.getUserHomeFolder(user,section); folder = Folder.getUserHomeFolder(user, section);
} }
if ( folder == null ) { if (folder == null) {
folder = section.getRootFolder(); folder = section.getRootFolder();
} }
// If the user has no access, return an empty Label // If the user has no access, return an empty Label
SecurityManager sm = new SecurityManager(section); SecurityManager sm = new SecurityManager(section);
if (! sm.canAccess(state.getRequest(), SecurityManager.NEW_ITEM, folder) if (!sm.canAccess(state.getRequest(), SecurityManager.NEW_ITEM, folder)
|| !ContentSection.getConfig().getAllowContentCreateInSectionListing() || !ContentSection.getConfig().getAllowContentCreateInSectionListing()) {
) { return new Label("&nbsp;&nbsp;&nbsp;-&nbsp;-&nbsp;&nbsp;&nbsp;"
return new Label("&nbsp;&nbsp;&nbsp;-&nbsp;-&nbsp;&nbsp;&nbsp;"+ + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
false); false);
} else { } else {
// set the value of the sectionIdParameter in the form // set the value of the sectionIdParameter in the form
@ -467,10 +460,10 @@ public class ContentSectionContainer extends CMSContainer {
return m_formContainer.getNewItemForm(); return m_formContainer.getNewItemForm();
} }
} }
} }
} }
/** /**
* Generates the correct URL to the public pages for a content * Generates the correct URL to the public pages for a content
* section. * section.
@ -500,25 +493,23 @@ public class ContentSectionContainer extends CMSContainer {
/* cast to ContentSection for further processing */ /* cast to ContentSection for further processing */
ContentSection section = (ContentSection) value; ContentSection section = (ContentSection) value;
String name = section.getName(); String name = section.getName();
String path = section.getPath() ; // from Application String path = section.getPath(); // from Application
// If the user has no access, return a Label instead of a Link // If the user has no access, return a Label instead of a Link
SecurityManager sm = new SecurityManager(section); SecurityManager sm = new SecurityManager(section);
if (sm.canAccess(state.getRequest(), SecurityManager.PUBLIC_PAGES) if (sm.canAccess(state.getRequest(), SecurityManager.PUBLIC_PAGES)
&& !ContentSection.getConfig().getHideLegacyPublicSiteLink() && !ContentSection.getConfig().getHideLegacyPublicSiteLink()) {
) {
return new Link("/"+name+"/", path+"/"); return new Link("/" + name + "/", path + "/");
} else { } else {
return new Label("/"+name+"/", false); return new Label("/" + name + "/", false);
} }
} }
} }
/** /**
* Generates the correct URL to the admin pages for a content * Generates the correct URL to the admin pages for a content
* section. * section.
@ -556,6 +547,6 @@ public class ContentSectionContainer extends CMSContainer {
protected String generateURL(String prefix) { protected String generateURL(String prefix) {
return prefix + PageLocations.SECTION_PAGE; return prefix + PageLocations.SECTION_PAGE;
} }
}
}
} }