You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(48) |
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(22) |
Feb
(68) |
Mar
(185) |
Apr
(11) |
May
(21) |
Jun
(23) |
Jul
(46) |
Aug
(69) |
Sep
(211) |
Oct
(26) |
Nov
(51) |
Dec
(52) |
2006 |
Jan
(13) |
Feb
(13) |
Mar
(8) |
Apr
(21) |
May
(17) |
Jun
(100) |
Jul
(34) |
Aug
(23) |
Sep
(26) |
Oct
(16) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(66) |
Oct
(10) |
Nov
(1) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
(8) |
Jun
(5) |
Jul
(31) |
Aug
(8) |
Sep
(11) |
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
(13) |
Feb
(2) |
Mar
(9) |
Apr
(6) |
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(120) |
2013 |
Jan
(6) |
Feb
(35) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Author: sskracic Date: 2005-11-10 19:22:03 +0100 (Thu, 10 Nov 2005) New Revision: 991 Added: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/WhiteListFilenameFilter.java Modified: trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/dispatcher/ThemeDownloadServlet.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/ApproveThemeActionListener.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeDevelopmentFileManager.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java Log: Completing most of theme enhancements work. Downloading and publishing operations will skip files not in the whitelist. 'is_deleted' flag is now copied from draft to live files on every 'publish' operation. Modified: trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl =================================================================== --- trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl 2005-11-10 18:22:03 UTC (rev 991) @@ -45,3 +45,20 @@ ThemeFile[0..n] themeFiles = join theme_themes.theme_id to theme_files.theme_id; } +data operation bulkFileUpdate { + do { + update theme_files set + is_deleted = (select t2.is_deleted from theme_files t2 + where t2.theme_id = :themeID + and t2.file_path = theme_files.file_path + and t2.version = 'draft'), + last_modified_date = :timestamp + where + theme_id = :themeID + and version = 'live' + and file_path in (select t3.file_path from theme_files t3 + where t3.theme_id = :themeID + and t3.version = 'draft') + } +} + Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/dispatcher/ThemeDownloadServlet.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/dispatcher/ThemeDownloadServlet.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/dispatcher/ThemeDownloadServlet.java 2005-11-10 18:22:03 UTC (rev 991) @@ -5,12 +5,12 @@ * 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 @@ -19,51 +19,43 @@ package com.arsdigita.london.theme.dispatcher; -import com.arsdigita.london.theme.Theme; -import com.arsdigita.london.theme.ThemeConstants; -import com.arsdigita.london.theme.util.ManifestReader; -import com.arsdigita.util.IO; -import com.arsdigita.util.Files; -import com.arsdigita.xml.Document; -import com.arsdigita.xml.Element; -import com.arsdigita.web.BaseServlet; +import com.arsdigita.cms.ContentType; +import com.arsdigita.dispatcher.AccessDeniedException; import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.kernel.Party; import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.Party; import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PrivilegeDescriptor; -import com.arsdigita.dispatcher.AccessDeniedException; +import com.arsdigita.kernel.permissions.UniversalPermissionDescriptor; +import com.arsdigita.london.theme.Theme; +import com.arsdigita.london.theme.ThemeConstants; +import com.arsdigita.london.theme.util.ManifestReader; +import com.arsdigita.london.theme.util.WhiteListFilenameFilter; +import com.arsdigita.packaging.RegistryConfig; +import com.arsdigita.util.Files; +import com.arsdigita.util.IO; +import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.web.BaseServlet; import com.arsdigita.web.LoginSignal; -import com.arsdigita.cms.ContentType; - -import javax.servlet.ServletException; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import java.io.IOException; -import java.io.InputStream; +import com.arsdigita.web.Web; +import com.arsdigita.xml.Document; +import com.arsdigita.xml.Element; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FilenameFilter; -import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; import java.net.URL; import java.util.Iterator; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; - -import javax.xml.parsers.ParserConfigurationException; - -import java.math.BigDecimal; -import java.util.Iterator; -import com.arsdigita.web.Web; -import com.arsdigita.util.UncheckedWrapperException; -import com.arsdigita.kernel.permissions.UniversalPermissionDescriptor; -import com.arsdigita.kernel.permissions.PermissionService; -import com.arsdigita.kernel.permissions.PrivilegeDescriptor; -import com.arsdigita.packaging.RegistryConfig; -import com.arsdigita.web.LoginSignal; import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.parsers.ParserConfigurationException; import org.apache.log4j.Logger; @@ -72,8 +64,8 @@ * against content types into one. */ public class ThemeDownloadServlet extends BaseServlet implements ThemeConstants { - - private static final Logger s_log = + + private static final Logger s_log = Logger.getLogger(ThemeDownloadServlet.class); public static final String THEME_ID = "themeID"; @@ -87,12 +79,12 @@ } UniversalPermissionDescriptor universalPermission = - new UniversalPermissionDescriptor(PrivilegeDescriptor.ADMIN, + new UniversalPermissionDescriptor(PrivilegeDescriptor.ADMIN, party.getOID()); if (! PermissionService.checkPermission(universalPermission)) { throw new AccessDeniedException( - "user " + party.getOID() + " doesn't have the " + + "user " + party.getOID() + " doesn't have the " + PrivilegeDescriptor.ADMIN.getName() + " admin privileges"); } } @@ -112,7 +104,7 @@ sreq.getParameter(THEME_ID), e); throw new UncheckedWrapperException ("Unable to convert the themeID in to a BigDecimal " + - sreq.getParameter(THEME_ID), e); + sreq.getParameter(THEME_ID), e); } } Theme theme = null; @@ -136,12 +128,12 @@ File currentRoot = new File(Web.getServletContext().getRealPath("/")); File webapps = currentRoot.getParentFile(); - // if we have a Theme, we send back either prod or dev, depending on + // if we have a Theme, we send back either prod or dev, depending on // the url. If we don't have a theme, then we return everything. if (theme != null) { File downloadFiles = null; String prefix = null; - // If "themes-prod" is ever moved to a different directory, + // If "themes-prod" is ever moved to a different directory, // we could then get rid of the "type" argument (see below in // DirectoryFilter) String type = null; @@ -155,12 +147,12 @@ type = DEV_DIR_STUB; } sresp.setHeader("Content-Disposition", - "attachment; filename=\"" + prefix + theme.getURL() + + "attachment; filename=\"" + prefix + theme.getURL() + ".zip\""); Files.writeZipFile - (sresp.getOutputStream(), - Files.listFilesInTree(downloadFiles, + (sresp.getOutputStream(), + Files.listFilesInTree(downloadFiles, new DirectoryFilter(theme.getURL(), type)), downloadFiles); } else if (theme == null) { @@ -172,16 +164,16 @@ ClassLoader loader = Thread.currentThread().getContextClassLoader(); sresp.setHeader("Content-Disposition", - "attachment; filename=\"" + ALL_STYLES_ZIP_NAME + - "\""); + "attachment; filename=\"" + ALL_STYLES_ZIP_NAME + + "\""); ZipOutputStream out = new ZipOutputStream(sresp.getOutputStream()); for (int i = 0; i < packages.length; i++) { String current = packages[i] + ".web.mf"; InputStream is = loader.getResourceAsStream(current); if (is != null) { - ZipWriterManifestReader reader = - new ZipWriterManifestReader(is, out, current, + ZipWriterManifestReader reader = + new ZipWriterManifestReader(is, out, current, packages[i]); reader.setFileName(packages[i]); reader.processFile(); @@ -189,18 +181,18 @@ s_log.warn("Unable to open up resource " + current); } } - + // Special case add the auto-generated XSL fiel for content types Iterator paths = ContentType.getXSLFileURLs(); out.putNextEntry(new ZipEntry("waf-xsl/__ccm__/servlet/content-type/index.xsl")); IO.copy(multiplexXSLFiles(paths), out); - - + + out.close(); - } - } - + } + } + // XXX copy+paste of Templating.multiplexXSLFiles but with some // URL munging. Should be reconciled later public static InputStream multiplexXSLFiles(Iterator paths) { @@ -229,19 +221,19 @@ } /** - * This provides a filter so that only files in a given directory + * This provides a filter so that only files in a given directory * are used. This is necessary so that we can be efficient when * creating our zip. Without this, we would have to iterate through - * the file list an extra time. If the + * the file list an extra time. If the */ - private class DirectoryFilter implements FilenameFilter { + private class DirectoryFilter extends WhiteListFilenameFilter implements FilenameFilter { // there has to be a better way to do this...I have a hard // time believing that this filter is actually necessary...can we // do this by adding some magic to the Files.createZipFile class? // we could always iterate through the results ot listFilesInTree // but that seems like a worse solution than this. private String m_directoryName; - // If "themes-prod" is ever moved to a different directory, + // If "themes-prod" is ever moved to a different directory, // we could then get rid of the "type" argument private String m_type; DirectoryFilter(String directoryName, String type) { @@ -250,9 +242,10 @@ } public boolean accept(File dir, String name) { - return dir.getAbsolutePath().indexOf("/" + m_type + "/" + m_directoryName) > -1 - || (m_directoryName.equals(name) && dir.getAbsolutePath().endsWith("/" + m_type)); - + return super.accept(dir, name) && + (dir.getAbsolutePath().indexOf("/" + m_type + "/" + m_directoryName) > -1 + || (m_directoryName.equals(name) && dir.getAbsolutePath().endsWith("/" + m_type))); + } } @@ -260,7 +253,7 @@ private class ZipWriterManifestReader extends ManifestReader { private ZipOutputStream m_out; - ZipWriterManifestReader(InputStream stream, + ZipWriterManifestReader(InputStream stream, ZipOutputStream out, String fileName, String possibleServletContext) { @@ -277,7 +270,7 @@ try { ServletContext actualContext = getActualContext(filePath); - + if (actualContext != null) { String realPath = actualContext.getRealPath("/"); String packageName = getFileName(); @@ -315,7 +308,7 @@ } catch (IOException e) { throw new UncheckedWrapperException("Error reading from " + filePath + " or writing to the zip file"); } - } + } } } - + Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java 2005-11-10 18:22:03 UTC (rev 991) @@ -28,7 +28,7 @@ import com.arsdigita.london.theme.ThemeFileCollection; import com.arsdigita.london.theme.ui.listeners.FileRemovalRequestListener; import com.arsdigita.london.theme.util.GlobalizationUtil; -import com.arsdigita.london.theme.util.ThemeFileUtil; +import com.arsdigita.london.theme.util.WhiteListFilenameFilter; import com.arsdigita.toolbox.ui.FormatStandards; import com.arsdigita.util.Files; import com.arsdigita.web.Web; @@ -108,7 +108,7 @@ } else { childElement = folderElement.newChildElement(XML_FILE, XML_NS); childElement.addAttribute("inWhiteList", - String.valueOf(ThemeFileUtil.inWhiteList(tempFile))); + String.valueOf(WhiteListFilenameFilter.inWhiteList(list[i]))); ThemeFile dbtFile = (ThemeFile) themeFiles.get(tempFile.getAbsolutePath()); childElement.addAttribute("inDatabase", String.valueOf(dbtFile != null)); if (dbtFile != null) { Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/ApproveThemeActionListener.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/ApproveThemeActionListener.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/ApproveThemeActionListener.java 2005-11-10 18:22:03 UTC (rev 991) @@ -5,12 +5,12 @@ * 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 @@ -18,35 +18,41 @@ package com.arsdigita.london.theme.ui.listeners; -import com.arsdigita.london.theme.ui.ThemeSelectionModel; -import com.arsdigita.london.theme.ThemeConstants; -import com.arsdigita.london.theme.ThemeFile; -import com.arsdigita.london.theme.util.ThemeFileUtil; import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.london.subsite.Subsite; import com.arsdigita.london.theme.Theme; +import com.arsdigita.london.theme.ThemeConstants; +import com.arsdigita.london.theme.ThemeFile; import com.arsdigita.london.theme.ThemeObserver; +import com.arsdigita.london.theme.ui.ThemeSelectionModel; +import com.arsdigita.london.theme.util.ThemeFileUtil; +import com.arsdigita.london.theme.util.WhiteListFilenameFilter; +import com.arsdigita.persistence.DataOperation; +import com.arsdigita.persistence.SessionManager; import com.arsdigita.util.Files; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.web.Web; -import com.arsdigita.kernel.Kernel; -import com.arsdigita.london.subsite.Subsite; import java.io.File; import java.io.IOException; +import java.util.Arrays; import java.util.Date; - +import java.util.Iterator; +import java.util.Set; +import java.util.TreeSet; import org.apache.log4j.Logger; /** * This approves the theme and pushes it to the production file location * This action means that the user wants to approve the themes and - * push them live. This is done by copying the files from + * push them live. This is done by copying the files from * * @author Randy Graebner <ra...@re...> */ public class ApproveThemeActionListener implements ThemeConstants, ActionListener { - - private static final Logger s_log = + + private static final Logger s_log = Logger.getLogger(ApproveThemeActionListener.class); private ThemeSelectionModel m_model; @@ -54,54 +60,72 @@ public ApproveThemeActionListener(ThemeSelectionModel model) { m_model = model; } - + public void actionPerformed(ActionEvent e) { // First, we rename the current production directory // so that if there is an exception, we can try to move it // back in to place Theme theme = m_model.getSelectedTheme(e.getPageState()); File currentRoot = new File(Web.getServletContext().getRealPath("/")); - File oldProd = new File(currentRoot, PROD_THEMES_BASE_DIR + + File oldProd = new File(currentRoot, PROD_THEMES_BASE_DIR + theme.getURL()); File backupFile = new File(oldProd.getAbsolutePath() + ".bak"); if (oldProd.exists()) { oldProd.renameTo(backupFile); - } else { - // let's make sure the correct directories are there - oldProd.mkdirs(); } - + oldProd.mkdirs(); // now, we copy the "dev" directory to the "prd" directory File newProd = new File(currentRoot, PROD_THEMES_BASE_DIR); - File devDir = new File(currentRoot, DEV_THEMES_BASE_DIR + + File devDir = new File(currentRoot, DEV_THEMES_BASE_DIR + theme.getURL()); try { - Files.copy(devDir, newProd); - + // sort filepaths to be copied alphabetically, so that the + // directory is always created before the files contained therein + Set filesToCopy = new TreeSet(Arrays.asList(Files.listFilesInTree(devDir, + new WhiteListFilenameFilter()))); + for (Iterator it=filesToCopy.iterator(); it.hasNext(); ) { + String path = (String) it.next(); + File src = new File(devDir, path); + if (src.isDirectory()) { + s_log.debug("creating directory " + path); + new File(newProd, theme.getURL() + File.separator + path).mkdirs(); + } else { + s_log.debug("Copying file " + path); + Files.copy(src, new File(newProd, theme.getURL() + File.separator + path)); + } + } + // assuming that went well, we need to move the devDir in to - // the database as the latest "live" files - ThemeFileUtil.updateDatabaseFiles(devDir, theme, + // the database as the latest "live" files + // but before we do that, we copy is_deleted flag from + // development to published files + DataOperation op = SessionManager.getSession().retrieveDataOperation( + "com.arsdigita.london.theme.bulkFileUpdate"); + op.setParameter("themeID", theme.getID()); + op.setParameter("timestamp", new Date()); + op.execute(); + ThemeFileUtil.updateDatabaseFiles(devDir, theme, devDir.getAbsolutePath(), true, ThemeFile.LIVE); // since we are publishing, we also want to share the DEV files - ThemeFileUtil.updateDatabaseFiles(devDir, theme, + ThemeFileUtil.updateDatabaseFiles(devDir, theme, devDir.getAbsolutePath(), true, ThemeFile.DRAFT); // add the observer to make sure that it syncs with other // servers in the cluster theme.addObserver(new ThemeObserver()); } catch (IOException ex) { - String errorMsg = "There was an error moving files from " + - devDir.getAbsolutePath() + " to " + + String errorMsg = "There was an error moving files from " + + devDir.getAbsolutePath() + " to " + newProd.getAbsolutePath(); s_log.error(errorMsg, ex); // delete the directory and move the oldProd back Files.delete(new File(newProd + theme.getURL())); if (oldProd.exists()) { - oldProd.renameTo(new File(currentRoot, PROD_THEMES_BASE_DIR + + oldProd.renameTo(new File(currentRoot, PROD_THEMES_BASE_DIR + theme.getURL())); } throw new UncheckedWrapperException(errorMsg, ex); Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeDevelopmentFileManager.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeDevelopmentFileManager.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeDevelopmentFileManager.java 2005-11-10 18:22:03 UTC (rev 991) @@ -51,7 +51,7 @@ protected ThemeDevelopmentFileManager(int startupDelay, int pollDelay, String baseDirectory) { - super(startupDelay, pollDelay, baseDirectory); + super(s_log, startupDelay, pollDelay, baseDirectory); } Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-10 18:22:03 UTC (rev 991) @@ -56,13 +56,11 @@ */ public abstract class ThemeFileManager extends Thread implements ThemeConstants { - private static Logger s_log = - Logger.getLogger(ThemeFileManager.class); + private Logger m_log; // The code in this class borrows heavily from // com.arsdigita.cms.publishToFile.FileManager - // Following true if should keep watching file private boolean m_keepWatchingFiles = true; @@ -78,8 +76,9 @@ private Date m_lastRunDate; - protected ThemeFileManager(int startupDelay, int pollDelay, + protected ThemeFileManager(Logger log, int startupDelay, int pollDelay, String baseDirectory) { + m_log = log; m_startupDelay = startupDelay; m_pollDelay = pollDelay; m_lastRunDate = null; @@ -111,12 +110,12 @@ * file processing. ***/ public void run() { - s_log.info("Start polling file in " + m_startupDelay + "s."); + m_log.info("Start polling file in " + m_startupDelay + "s."); if (m_lastRunDate == null) { // only do the startup delay the first time this is run. sleepSeconds(m_startupDelay); } - s_log.info("Polling file every " + m_pollDelay + "s."); + m_log.info("Polling file every " + m_pollDelay + "s."); while ( (sleepSeconds(m_pollDelay) || m_ignoreInterrupt) && m_keepWatchingFiles ) { // Get the last run date before we do anything, @@ -145,11 +144,11 @@ m_lastRunDate = lastRunDate; } catch (Exception e) { - s_log.warn("Ignoring uncaught exception", e); + m_log.warn("Ignoring uncaught exception", e); } finally { if ( txn.inTxn() ) { txn.abortTxn(); - s_log.info("Aborting transaction"); + m_log.info("Aborting transaction"); } } // we only ignore one interrupt at most @@ -254,7 +253,7 @@ protected void updateTheme(Theme theme) { String stub = getManagerSpecificDirectory(); // sync the files that have the correct dates - s_log.debug("Looking at theme " + theme.getURL()); + m_log.debug("Looking at theme " + theme.getURL()); ThemeFileCollection files = getThemeFilesCollection(theme); if (files == null) { @@ -271,9 +270,9 @@ if (temp.exists()) { boolean success = temp.delete(); if (success) { - s_log.info("Deletion of " + temp + " succeeded"); + m_log.info("Deletion of " + temp + " succeeded"); } else { - s_log.error("Deletion of " + temp + " failed"); + m_log.error("Deletion of " + temp + " failed"); } } continue; @@ -284,14 +283,14 @@ try { // make sure all of the directories exist temp.getParentFile().mkdirs(); - s_log.debug("Writing file " + temp.getAbsolutePath()); + m_log.debug("Writing file " + temp.getAbsolutePath()); byte[] content = files.getThemeFile().getContent(); out = new FileOutputStream(temp); out.write(content); temp.setLastModified(files.getLastModifiedDate().getTime()); } catch (IOException e) { - s_log.error("Error writing file " + + m_log.error("Error writing file " + temp.getAbsolutePath(), e); } finally { try { @@ -299,7 +298,7 @@ out.close(); } } catch (IOException e) { - s_log.error("Could not close output stream", e); + m_log.error("Could not close output stream", e); } } } @@ -315,7 +314,7 @@ sleep(n * 1000); return true; } catch ( InterruptedException e ) { - s_log.info( "Waiting was interrupted."); + m_log.info( "Waiting was interrupted."); return false; } } Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java 2005-11-10 18:22:03 UTC (rev 991) @@ -16,14 +16,12 @@ package com.arsdigita.london.theme.util; import com.arsdigita.london.theme.Theme; -import com.arsdigita.london.theme.ThemeApplication; import com.arsdigita.london.theme.ThemeFile; import com.arsdigita.london.theme.ThemeFileCollection; import com.arsdigita.util.Assert; import org.apache.log4j.Logger; import java.util.Date; import java.util.Map; -import java.util.Collection; import java.util.HashMap; import java.io.File; import java.io.IOException; @@ -45,15 +43,6 @@ private static Logger s_log = Logger.getLogger(ThemeFileUtil.class); - public static boolean inWhiteList(File file) { - Collection extensions = ThemeApplication.getConfig().getDownloadFileExtensions(); - String filename = file.getName(); - int extIndex = filename.lastIndexOf(".") + 1; - return extIndex > 0 - && filename.length() > extIndex - && extensions.contains(filename.substring(extIndex).toLowerCase()); - } - /** * this copies the files from the file system to the database. * @@ -129,7 +118,7 @@ boolean overwriteNewerFiles, String fileType) { if (currentFile.isDirectory()) { - File[] files = currentFile.listFiles(); + File[] files = currentFile.listFiles(new WhiteListFilenameFilter()); for (int i = 0; i < files.length; i++) { updateDatabaseFiles(files[i], currentTheme, serverSpecificPath, themeFiles, @@ -137,11 +126,6 @@ } } else { if (currentFile.exists()) { - // Skip the file if its extension is not in white list - if (!inWhiteList(currentFile)) { - s_log.warn("Not updating db: " + currentFile); - return; - } String fullFilePath = currentFile.getAbsolutePath(); String filePath = null; int beginIndex = fullFilePath.indexOf(serverSpecificPath); @@ -170,7 +154,7 @@ && themeFile.getLastModifiedDate() .before(new Date(currentFile.lastModified()))) { themeFile.setDeleted(false); - s_log.warn("Undeleting the file: " + currentFile); + s_log.info("Undeleting the file: " + currentFile); } try { FileInputStream in = new FileInputStream(currentFile); Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java 2005-11-10 18:22:03 UTC (rev 991) @@ -48,7 +48,7 @@ protected ThemePublishedFileManager(int startupDelay, int pollDelay, String baseDirectory) { - super(startupDelay, pollDelay, baseDirectory); + super(s_log, startupDelay, pollDelay, baseDirectory); } // is there a way to move this code up in to the parent class? Added: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/WhiteListFilenameFilter.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/WhiteListFilenameFilter.java 2005-11-10 10:36:28 UTC (rev 990) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/WhiteListFilenameFilter.java 2005-11-10 18:22:03 UTC (rev 991) @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2001-2004 Red Hat Inc. 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 + */ +package com.arsdigita.london.theme.util; + +import com.arsdigita.london.theme.ThemeApplication; +import java.io.File; +import java.io.FilenameFilter; +import java.util.Collection; + +/** + * Filter that accepts files with extensions in whitelist. + */ +public class WhiteListFilenameFilter implements FilenameFilter { + + private static Collection s_extensions; + + public boolean accept(File dir, String name) { + if (inWhiteList(name)) { + return true; + } + File temp = new File(dir, name); + return temp.exists() && temp.isDirectory(); + } + + public synchronized static boolean inWhiteList(String filename) { + if (s_extensions == null) { + s_extensions = ThemeApplication.getConfig().getDownloadFileExtensions(); + } + int extIndex = filename.lastIndexOf(".") + 1; + return extIndex > 0 + && filename.length() > extIndex + && s_extensions.contains(filename.substring(extIndex).toLowerCase()); + } +} + Property changes on: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/WhiteListFilenameFilter.java ___________________________________________________________________ Name: svn:keywords + Id Author URL |
From: <cl...@vh...> - 2005-11-10 10:37:39
|
Author: clasohm Date: 2005-11-10 11:36:28 +0100 (Thu, 10 Nov 2005) New Revision: 990 Modified: trunk/tools/tools/lib/CCM/Runtime.pm Log: added support for PostgreSQL 8.1 Modified: trunk/tools/tools/lib/CCM/Runtime.pm =================================================================== --- trunk/tools/tools/lib/CCM/Runtime.pm 2005-11-10 08:30:48 UTC (rev 989) +++ trunk/tools/tools/lib/CCM/Runtime.pm 2005-11-10 10:36:28 UTC (rev 990) @@ -161,6 +161,9 @@ # try universal symlink first (pg8.0-FC4 rpm) my @pg_jdbc_locs = ( "/usr/share/java/postgresql.jar", "/usr/share/java/postgresql-jdbc3.jar" ); + # then 8.1 (PGDG rpm) + my @pg81jars = glob("/usr/share/java/postgresql-8.1*jdbc3.jar"); + push @pg_jdbc_locs, (pop @pg81jars) if @pg81jars; # then 8.0 (PGDG rpm) my @pg80jars = glob("/usr/share/java/postgresql-8.0*jdbc3.jar"); push @pg_jdbc_locs, (pop @pg80jars) if @pg80jars; |
From: <ssk...@vh...> - 2005-11-10 08:32:00
|
Author: sskracic Date: 2005-11-10 09:30:48 +0100 (Thu, 10 Nov 2005) New Revision: 989 Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java Log: "deleted" is required property. Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java 2005-11-09 17:10:48 UTC (rev 988) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java 2005-11-10 08:30:48 UTC (rev 989) @@ -97,6 +97,7 @@ if (get(ID) == null) { set(ID, generateID()); } + setDeleted(false); } } |
Author: sskracic Date: 2005-11-09 18:10:48 +0100 (Wed, 09 Nov 2005) New Revision: 988 Added: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/upgrade/ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/upgrade/6.3.0-6.3.1/ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/upgrade/6.3.0-6.3.1/add-is_deleted.sql trunk/ccm-ldn-theme/sql/ccm-ldn-theme/postgres/upgrade/6.3.0-6.3.1/ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/postgres/upgrade/6.3.0-6.3.1/add-is_deleted.sql trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/oracle-se-6.3.0-6.3.1.sql trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/postgres-6.3.0-6.3.1.sql trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/FileRemovalRequestListener.java Modified: trunk/ccm-ldn-theme/application.xml trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl trunk/ccm-ldn-theme/src/ccm-ldn-theme.upgrade trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFileCollection.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java trunk/ccm-ldn-theme/web/__ccm__/apps/theme/xsl/index.xsl Log: First pass at theme enhancements. It is now possible to schedule theme files for removal (through theme admin UI). Further, all files with extensions not on the whitelist (configuration parameter) are ignored and exempt from being mirrorred to the database and, ultimately, to other cluster peers. Still work in progress, though. Modified: trunk/ccm-ldn-theme/application.xml =================================================================== --- trunk/ccm-ldn-theme/application.xml 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/application.xml 2005-11-09 17:10:48 UTC (rev 988) @@ -2,8 +2,8 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-ldn-theme" prettyName="Theme" - version="6.3.0" - release="3"> + version="6.3.1" + release="1"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-ldn-subsite" version="6.2.0" relation="ge"/> Modified: trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl =================================================================== --- trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/pdl/com/arsdigita/london/themes/ThemeFile.pdl 2005-11-09 17:10:48 UTC (rev 988) @@ -17,9 +17,6 @@ model com.arsdigita.london.theme; -import com.arsdigita.web.Application; -import com.arsdigita.kernel.ACSObject; -import com.arsdigita.kernel.Party; object type ThemeFile { BigDecimal[1..1] id = theme_files.file_id INTEGER; @@ -33,6 +30,8 @@ Date[1..1] lastModifiedDate = theme_files.last_modified_date TIMESTAMP; + Boolean[1..1] deleted = theme_files.is_deleted; + // each theme should only have one file per filePath // we cannot add this here becuase persistence does not know how to // map the association column back to the column in this table and Added: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/upgrade/6.3.0-6.3.1/add-is_deleted.sql =================================================================== --- trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/upgrade/6.3.0-6.3.1/add-is_deleted.sql 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/upgrade/6.3.0-6.3.1/add-is_deleted.sql 2005-11-09 17:10:48 UTC (rev 988) @@ -0,0 +1,7 @@ + +alter table theme_files add is_deleted char(1); +update theme_files set is_deleted = '0'; +alter table theme_files add constraint theme_files_is_deleted_c_gadn2 + check(is_deleted in ('0', '1')); +alter table theme_files modify is_deleted not null; + Property changes on: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/oracle-se/upgrade/6.3.0-6.3.1/add-is_deleted.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/postgres/upgrade/6.3.0-6.3.1/add-is_deleted.sql =================================================================== --- trunk/ccm-ldn-theme/sql/ccm-ldn-theme/postgres/upgrade/6.3.0-6.3.1/add-is_deleted.sql 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/postgres/upgrade/6.3.0-6.3.1/add-is_deleted.sql 2005-11-09 17:10:48 UTC (rev 988) @@ -0,0 +1,5 @@ + +alter table theme_files add is_deleted boolean; +update theme_files set is_deleted = 'f'; +alter table theme_files alter is_deleted set not null; + Property changes on: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/postgres/upgrade/6.3.0-6.3.1/add-is_deleted.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/oracle-se-6.3.0-6.3.1.sql =================================================================== --- trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/oracle-se-6.3.0-6.3.1.sql 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/oracle-se-6.3.0-6.3.1.sql 2005-11-09 17:10:48 UTC (rev 988) @@ -0,0 +1 @@ +@@ ../oracle-se/upgrade/6.3.0-6.3.1/add-is_deleted.sql Property changes on: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/oracle-se-6.3.0-6.3.1.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/postgres-6.3.0-6.3.1.sql =================================================================== --- trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/postgres-6.3.0-6.3.1.sql 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/postgres-6.3.0-6.3.1.sql 2005-11-09 17:10:48 UTC (rev 988) @@ -0,0 +1,5 @@ +begin; + +\i ../postgres/upgrade/6.3.0-6.3.1/add-is_deleted.sql + +commit; Property changes on: trunk/ccm-ldn-theme/sql/ccm-ldn-theme/upgrade/postgres-6.3.0-6.3.1.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Modified: trunk/ccm-ldn-theme/src/ccm-ldn-theme.upgrade =================================================================== --- trunk/ccm-ldn-theme/src/ccm-ldn-theme.upgrade 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/src/ccm-ldn-theme.upgrade 2005-11-09 17:10:48 UTC (rev 988) @@ -5,4 +5,7 @@ <version from="1.0.1" to="1.0.2"> <script sql="ccm-ldn-theme/upgrade/::database::-1.0.1-1.0.2.sql"/> </version> + <version from="6.3.0" to="6.3.1"> + <script sql="ccm-ldn-theme/upgrade/::database::-6.3.0-6.3.1.sql"/> + </version> </upgrade> Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFile.java 2005-11-09 17:10:48 UTC (rev 988) @@ -19,7 +19,6 @@ package com.arsdigita.london.theme; import com.arsdigita.util.Assert; -import com.arsdigita.kernel.ACSObject; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import com.arsdigita.domain.DataObjectNotFoundException; @@ -42,7 +41,7 @@ public class ThemeFile extends DomainObject { private static final Logger s_log = - Logger.getLogger(ACSObject.class); + Logger.getLogger(ThemeFile.class); public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.theme.ThemeFile"; @@ -53,6 +52,7 @@ public static final String LAST_MODIFIED_DATE = "lastModifiedDate"; public static final String CONTENT = "content"; public static final String THEME = "theme"; + public static final String DELETED = "deleted"; /** @@ -167,4 +167,12 @@ return null; } } + + public void setDeleted(boolean deleted) { + set(DELETED, new Boolean(deleted)); + } + + public boolean isDeleted() { + return Boolean.TRUE.equals(get(DELETED)); + } } Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFileCollection.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFileCollection.java 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ThemeFileCollection.java 2005-11-09 17:10:48 UTC (rev 988) @@ -63,4 +63,8 @@ public Date getLastModifiedDate() { return(Date)m_dataCollection.get(ThemeFile.LAST_MODIFIED_DATE); } + + public boolean isDeleted() { + return Boolean.TRUE.equals(m_dataCollection.get(ThemeFile.DELETED)); + } } Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/ThemeFilesList.java 2005-11-09 17:10:48 UTC (rev 988) @@ -5,12 +5,12 @@ * 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 @@ -18,19 +18,26 @@ package com.arsdigita.london.theme.ui; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; -import com.arsdigita.london.theme.util.GlobalizationUtil; import com.arsdigita.bebop.SimpleContainer; -import com.arsdigita.bebop.Label; -import com.arsdigita.bebop.PageState; +import com.arsdigita.london.theme.Theme; import com.arsdigita.london.theme.ThemeConstants; -import com.arsdigita.london.theme.Theme; -import com.arsdigita.xml.Element; +import com.arsdigita.london.theme.ThemeFile; +import com.arsdigita.london.theme.ThemeFileCollection; +import com.arsdigita.london.theme.ui.listeners.FileRemovalRequestListener; +import com.arsdigita.london.theme.util.GlobalizationUtil; +import com.arsdigita.london.theme.util.ThemeFileUtil; +import com.arsdigita.toolbox.ui.FormatStandards; import com.arsdigita.util.Files; -import com.arsdigita.toolbox.ui.FormatStandards; import com.arsdigita.web.Web; +import com.arsdigita.xml.Element; import java.io.File; import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import org.apache.log4j.Logger; /** @@ -39,7 +46,10 @@ * @author Randy Graebner <ra...@re...> */ class ThemeFilesList extends SimpleContainer implements ThemeConstants { - + + private static final Logger s_log = + Logger.getLogger(ThemeFilesList.class); + private final static String XML_FOLDER = THEME_XML_PREFIX + "folder"; private final static String XML_FILE = THEME_XML_PREFIX + "file"; @@ -53,22 +63,38 @@ add(heading); } + public void register(Page page) { + page.addRequestListener(new FileRemovalRequestListener()); + } + public void generateChildrenXML(PageState state, Element root) { super.generateChildrenXML(state, root); File currentRoot = new File(Web.getServletContext().getRealPath("/")); Theme theme = m_model.getSelectedTheme(state); - File themes = new File(currentRoot, DEV_THEMES_BASE_DIR + + File themes = new File(currentRoot, DEV_THEMES_BASE_DIR + theme.getURL()); - + Element folder = root.newChildElement(XML_FOLDER, XML_NS); folder.addAttribute("name", theme.getURL()); folder.addAttribute("depth", ""); - generateFolderXML(themes, folder, "-"); + HashMap themeFiles = new HashMap(); + ThemeFileCollection collection = theme.getDraftThemeFiles(); + if (collection != null) { + while (collection.next()) { + ThemeFile tfile = collection.getThemeFile(); + String tfilePath = themes.getAbsolutePath() + File.separator + tfile.getFilePath(); + themeFiles.put(tfilePath, tfile); + } + } + + generateFolderXML(state, themes, folder, themeFiles, "-"); } - - private void generateFolderXML(File baseDirectory, + + private void generateFolderXML(PageState state, + File baseDirectory, Element folderElement, + Map themeFiles, String depth) { File tempFile = null; String[] list = baseDirectory.list(); @@ -78,12 +104,25 @@ tempFile = new File(baseDirectory, list[i]); if (tempFile.isDirectory()) { childElement = folderElement.newChildElement(XML_FOLDER, XML_NS); - generateFolderXML(tempFile, childElement, depth+"-"); + generateFolderXML(state, tempFile, childElement, themeFiles, depth+"-"); } else { childElement = folderElement.newChildElement(XML_FILE, XML_NS); + childElement.addAttribute("inWhiteList", + String.valueOf(ThemeFileUtil.inWhiteList(tempFile))); + ThemeFile dbtFile = (ThemeFile) themeFiles.get(tempFile.getAbsolutePath()); + childElement.addAttribute("inDatabase", String.valueOf(dbtFile != null)); + if (dbtFile != null) { + childElement.addAttribute("fileID", dbtFile.getID().toString()); + boolean scheduledForRemoval = dbtFile.isDeleted() + && dbtFile.getLastModifiedDate().after(new Date(tempFile.lastModified())); + childElement.addAttribute("isDeleted", String.valueOf(scheduledForRemoval)); + if (!scheduledForRemoval) { + childElement.addAttribute("removeURL", state.toURL() + "&fileID=" + dbtFile.getID()); + } + } } childElement.addAttribute - ("lastModified", + ("lastModified", FormatStandards.formatDateTime(new Date(tempFile.lastModified()))); childElement.addAttribute("size", Files.getPrettySize(tempFile)); childElement.addAttribute("name", tempFile.getName()); Added: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/FileRemovalRequestListener.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/FileRemovalRequestListener.java 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/FileRemovalRequestListener.java 2005-11-09 17:10:48 UTC (rev 988) @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2001-2004 Red Hat Inc. 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 + */ + +package com.arsdigita.london.theme.ui.listeners; + +import com.arsdigita.bebop.event.RequestEvent; +import com.arsdigita.bebop.event.RequestListener; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.london.theme.ThemeConstants; +import com.arsdigita.london.theme.ThemeFile; +import com.arsdigita.persistence.OID; +import java.math.BigDecimal; +import java.util.Date; +import org.apache.log4j.Logger; + +/** + * This listener schedules selected theme file for removal. + * On the next run of development file theme manager, it will be erased + * from the disk. + * + * @author Sebastian Skracic ssk...@re... + */ +public class FileRemovalRequestListener implements ThemeConstants, RequestListener { + + private static final Logger s_log = + Logger.getLogger(FileRemovalRequestListener.class); + + public void pageRequested(RequestEvent e) { + String fileID = e.getPageState().getRequest().getParameter("fileID"); + if (fileID != null) { + ThemeFile tf = (ThemeFile) DomainObjectFactory.newInstance( + new OID(ThemeFile.BASE_DATA_OBJECT_TYPE, new BigDecimal(fileID))); + tf.setDeleted(true); + tf.setLastModifiedDate(new Date()); + tf.save(); + } + } +} + Property changes on: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/ui/listeners/FileRemovalRequestListener.java ___________________________________________________________________ Name: svn:keywords + Id Author URL Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-09 17:10:48 UTC (rev 988) @@ -35,9 +35,9 @@ /** - * Class for polling the database to look for new/updated files in - * the ThemeFile table. - * + * Class for polling the database to look for new/updated files in + * the ThemeFile table. + * * For "published" files, It goes through each Theme and looks at the * last time it was published. If the last time published > last * time thread was run then it examines those files. When the thread @@ -59,7 +59,7 @@ private static Logger s_log = Logger.getLogger(ThemeFileManager.class); - // The code in this class borrows heavily from + // The code in this class borrows heavily from // com.arsdigita.cms.publishToFile.FileManager @@ -78,7 +78,7 @@ private Date m_lastRunDate; - protected ThemeFileManager(int startupDelay, int pollDelay, + protected ThemeFileManager(int startupDelay, int pollDelay, String baseDirectory) { m_startupDelay = startupDelay; m_pollDelay = pollDelay; @@ -120,13 +120,13 @@ while ( (sleepSeconds(m_pollDelay) || m_ignoreInterrupt) && m_keepWatchingFiles ) { // Get the last run date before we do anything, - // so we can be sure that we do not miss any themes - // published while we run. But only store it after - // we have processed all themes, because it will be + // so we can be sure that we do not miss any themes + // published while we run. But only store it after + // we have processed all themes, because it will be // used in ThemePublishedFileManager.updateTheme(). Date lastRunDate = new Date(); - TransactionContext txn = + TransactionContext txn = SessionManager.getSession().getTransactionContext(); try { @@ -134,7 +134,7 @@ if (!txn.inTxn()) { txn.beginTxn(); startedTransaction = true; - } + } ThemeCollection collection = ThemeCollection.getAllThemes(); while (collection.next()) { updateTheme(collection.getTheme()); @@ -142,7 +142,7 @@ if (startedTransaction) { txn.commitTxn(); } - + m_lastRunDate = lastRunDate; } catch (Exception e) { s_log.warn("Ignoring uncaught exception", e); @@ -163,7 +163,7 @@ * instead of making it wait for the thread to wake up. */ public void updateAllThemesNow() { - // this call to interrupt should kill the current "run" that is + // this call to interrupt should kill the current "run" that is // occurring and break out of the sleep m_ignoreInterrupt = true; interrupt(); @@ -187,7 +187,7 @@ * hack is removed. * THIS IS A HACK BECAUSE IT REQUIRES A SERVER TO BE RUNNING */ - public String getBaseDirectory() { + public String getBaseDirectory() { if (m_baseDirectory == null) { ApplicationCollection collection = Application.retrieveAllApplications(); collection.filterToApplicationType(ThemeApplication.BASE_DATA_OBJECT_TYPE); @@ -205,7 +205,7 @@ ServletContext themeCtx = rootCtx.getContext(webapp); m_baseDirectory = themeCtx.getRealPath("/"); } - + return m_baseDirectory; } @@ -223,7 +223,7 @@ /* TODO: 1. provide a link to allow the user to force a sync of draft files - When the user syncs the draft files, do we tell all servers to + When the user syncs the draft files, do we tell all servers to insert in to the db and then tell all servers to sync with the db? Maybe outline this in the "known problems" which can be solved by only developing on one machine. @@ -243,7 +243,7 @@ In order for files to correctly propagate, all of the servers need to have clocks that are close to synchronized (at the very least, they must be set for the same time zone). - + */ /** @@ -255,32 +255,43 @@ String stub = getManagerSpecificDirectory(); // sync the files that have the correct dates s_log.debug("Looking at theme " + theme.getURL()); - + ThemeFileCollection files = getThemeFilesCollection(theme); if (files == null) { return; } while (files.next()) { - File temp = new File(stub + theme.getURL() + "/" + + File temp = new File(stub + theme.getURL() + "/" + files.getFilePath()); - // if the file in the db is newer than the file - // on the FS then write it out. + // if the file timestamp in the db is newer than the file + // on the FS then write it out (or delete). if (new Date(temp.lastModified()).before(files.getLastModifiedDate())) { - // now, we need to write out the file and + if (files.isDeleted()) { + if (temp.exists()) { + boolean success = temp.delete(); + if (success) { + s_log.info("Deletion of " + temp + " succeeded"); + } else { + s_log.error("Deletion of " + temp + " failed"); + } + } + continue; + } + // now, we need to write out the file and // log any errors we encounter FileOutputStream out = null; try { // make sure all of the directories exist temp.getParentFile().mkdirs(); s_log.debug("Writing file " + temp.getAbsolutePath()); - + byte[] content = files.getThemeFile().getContent(); out = new FileOutputStream(temp); out.write(content); temp.setLastModified(files.getLastModifiedDate().getTime()); } catch (IOException e) { - s_log.error("Error writing file " + + s_log.error("Error writing file " + temp.getAbsolutePath(), e); } finally { try { Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileUtil.java 2005-11-09 17:10:48 UTC (rev 988) @@ -16,12 +16,14 @@ package com.arsdigita.london.theme.util; import com.arsdigita.london.theme.Theme; +import com.arsdigita.london.theme.ThemeApplication; import com.arsdigita.london.theme.ThemeFile; import com.arsdigita.london.theme.ThemeFileCollection; import com.arsdigita.util.Assert; import org.apache.log4j.Logger; import java.util.Date; import java.util.Map; +import java.util.Collection; import java.util.HashMap; import java.io.File; import java.io.IOException; @@ -43,9 +45,17 @@ private static Logger s_log = Logger.getLogger(ThemeFileUtil.class); + public static boolean inWhiteList(File file) { + Collection extensions = ThemeApplication.getConfig().getDownloadFileExtensions(); + String filename = file.getName(); + int extIndex = filename.lastIndexOf(".") + 1; + return extIndex > 0 + && filename.length() > extIndex + && extensions.contains(filename.substring(extIndex).toLowerCase()); + } /** - * this copies the files from the file system to the database. + * this copies the files from the file system to the database. * * @param currentFile The directory to search recursively for files * to put in the database or the single file to add to the db. @@ -63,7 +73,7 @@ * the database. * @param fileType The type of file this is. * ThemeFile.LIVE and ThemeFile.DRAFT are the two allowed values. - * + * */ public static void updateDatabaseFiles(File currentFile, Theme currentTheme, @@ -110,27 +120,32 @@ * the database. * @param fileType The type of file this is. * ThemeFile.LIVE and ThemeFile.DRAFT are the two allowed values. - * + * */ - private static void updateDatabaseFiles(File currentFile, - Theme currentTheme, - String serverSpecificPath, + private static void updateDatabaseFiles(File currentFile, + Theme currentTheme, + String serverSpecificPath, Map themeFiles, boolean overwriteNewerFiles, String fileType) { if (currentFile.isDirectory()) { File[] files = currentFile.listFiles(); for (int i = 0; i < files.length; i++) { - updateDatabaseFiles(files[i], currentTheme, + updateDatabaseFiles(files[i], currentTheme, serverSpecificPath, themeFiles, overwriteNewerFiles, fileType); - } + } } else { if (currentFile.exists()) { + // Skip the file if its extension is not in white list + if (!inWhiteList(currentFile)) { + s_log.warn("Not updating db: " + currentFile); + return; + } String fullFilePath = currentFile.getAbsolutePath(); String filePath = null; int beginIndex = fullFilePath.indexOf(serverSpecificPath); - if (beginIndex > -1 && + if (beginIndex > -1 && fullFilePath.length() > serverSpecificPath.length()) { filePath = fullFilePath.substring (beginIndex + serverSpecificPath.length() + 1); @@ -149,10 +164,18 @@ return; } } + // Undelete the file if it reappeared + if (themeFile != null + && themeFile.isDeleted() + && themeFile.getLastModifiedDate() + .before(new Date(currentFile.lastModified()))) { + themeFile.setDeleted(false); + s_log.warn("Undeleting the file: " + currentFile); + } try { FileInputStream in = new FileInputStream(currentFile); ByteArrayOutputStream os = new ByteArrayOutputStream(); - + byte[] buffer = new byte[8]; int length = -1; while ((length = in.read(buffer)) != -1) { @@ -160,7 +183,7 @@ } byte[] content = os.toByteArray(); - + if (themeFile == null) { themeFile = new ThemeFile(currentTheme, filePath); themeFiles.put(filePath, themeFile); @@ -180,7 +203,7 @@ currentFile.getAbsolutePath(), fnfe); } catch (IOException ex) { s_log.error("Error working with either the input or " + - " output stream for " + + " output stream for " + currentFile.getAbsolutePath(), ex); } } Modified: trunk/ccm-ldn-theme/web/__ccm__/apps/theme/xsl/index.xsl =================================================================== --- trunk/ccm-ldn-theme/web/__ccm__/apps/theme/xsl/index.xsl 2005-11-09 12:49:31 UTC (rev 987) +++ trunk/ccm-ldn-theme/web/__ccm__/apps/theme/xsl/index.xsl 2005-11-09 17:10:48 UTC (rev 988) @@ -24,16 +24,46 @@ </td> <xsl:if test="name()='theme:folder'"> - <td colspan="3"> + <td colspan="4"> <i><xsl:value-of select="@name"/></i> </td> </xsl:if> <xsl:if test="name()='theme:file'"> - <td><xsl:value-of select="@name"/></td> - <td><xsl:value-of select="@size"/></td> - <td><xsl:value-of select="@lastModified"/></td> + <xsl:choose> + <xsl:when test="@isDeleted='true' or @inWhiteList!='true'"> + <td><strike><xsl:value-of select="@name"/></strike></td> + <td><strike><xsl:value-of select="@size"/></strike></td> + <td><strike><xsl:value-of select="@lastModified"/></strike></td> + <td> + <xsl:choose> + <xsl:when test="@isDeleted='true'"> + <font color="red">(scheduled for removal)</font> + </xsl:when> + <xsl:otherwise> + (ignored) + </xsl:otherwise> + </xsl:choose> + </td> + </xsl:when> + <xsl:otherwise> + <td><xsl:value-of select="@name"/></td> + <td><xsl:value-of select="@size"/></td> + <td><xsl:value-of select="@lastModified"/></td> + <td> + <xsl:if test="@removeURL"> + <a> + <xsl:attribute name="href"> + <xsl:value-of select="@removeURL"/> + </xsl:attribute> + Remove + </a> + </xsl:if> + </td> + </xsl:otherwise> + </xsl:choose> </xsl:if> + </tr> <xsl:apply-templates select="theme:file"> <xsl:sort select="./@name" data-type="text" order="ascending"/> |
From: <ssk...@vh...> - 2005-11-09 12:50:41
|
Author: sskracic Date: 2005-11-09 13:49:31 +0100 (Wed, 09 Nov 2005) New Revision: 987 Modified: releases/1.0.3/ccm-cms/application.xml releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java Log: Integrated r986 from trunk (excess permission records on live folders). Modified: releases/1.0.3/ccm-cms/application.xml =================================================================== --- releases/1.0.3/ccm-cms/application.xml 2005-11-09 12:47:09 UTC (rev 986) +++ releases/1.0.3/ccm-cms/application.xml 2005-11-09 12:49:31 UTC (rev 987) @@ -3,7 +3,7 @@ name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.2.0" - release="5" + release="6" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> Modified: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java =================================================================== --- releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2005-11-09 12:47:09 UTC (rev 986) +++ releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2005-11-09 12:49:31 UTC (rev 987) @@ -157,19 +157,6 @@ acsObj, uos.getParty()); PermissionService.grantPermission(pmd); - - if (acsObj instanceof ContentItem) { - ContentItem item = (ContentItem) acsObj; - ContentItem liveVersion = item.getLiveVersion(); - if (liveVersion != null) { - pmd = new - PermissionDescriptor(PrivilegeDescriptor. - get(privs[k]), - liveVersion, - uos.getParty()); - PermissionService.grantPermission(pmd); - } - } } } } |
From: <ssk...@vh...> - 2005-11-09 12:48:38
|
Author: sskracic Date: 2005-11-09 13:47:09 +0100 (Wed, 09 Nov 2005) New Revision: 986 Modified: trunk/ccm-cms/application.xml trunk/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java Log: Fix for the long-standing bug in CMS permissions, where a permission must be granted on draft object only, since live objects inherits those perms via security context. Modified: trunk/ccm-cms/application.xml =================================================================== --- trunk/ccm-cms/application.xml 2005-11-08 20:54:45 UTC (rev 985) +++ trunk/ccm-cms/application.xml 2005-11-09 12:47:09 UTC (rev 986) @@ -3,7 +3,7 @@ name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.3.0" - release="4" + release="5" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2005-11-08 20:54:45 UTC (rev 985) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2005-11-09 12:47:09 UTC (rev 986) @@ -157,19 +157,6 @@ acsObj, uos.getParty()); PermissionService.grantPermission(pmd); - - if (acsObj instanceof ContentItem) { - ContentItem item = (ContentItem) acsObj; - ContentItem liveVersion = item.getLiveVersion(); - if (liveVersion != null) { - pmd = new - PermissionDescriptor(PrivilegeDescriptor. - get(privs[k]), - liveVersion, - uos.getParty()); - PermissionService.grantPermission(pmd); - } - } } } } |
From: shenanigans <mai...@ro...> - 2005-11-08 21:41:13
|
I was interested in getting feedback from current mail group users. We have mirrored your mail list in a new application that provides a more aggregated and safe environment which utilizes the power of broadband. Roomity.com v 1.5 is a web 2.01 community webapp. Our newest version adds broadcast video and social networking such as favorite authors and an html editor. It?s free to join and any feedback would be appreciated. S. -------------------------------------------------------------------------------------------------------------------------------- Broadband interface (RIA) + mail box saftey = <a href="http://Aplaws_Commit_List.roomity.com">Aplaws_Commit_List.roomity.com</a> *Your* clubs, no sign up to read, ad supported; try broadband internet. ~~1131486127253~~ -------------------------------------------------------------------------------------------------------------------------------- |
From: <ap...@vh...> - 2005-11-08 16:48:03
|
Author: apevec Date: 2005-11-08 17:47:00 +0100 (Tue, 08 Nov 2005) New Revision: 984 Modified: trunk/tools/tools/lib/CCM/Util.pm Log: set effective/real group to where unprivileged user (usually: servlet) belongs to Modified: trunk/tools/tools/lib/CCM/Util.pm =================================================================== --- trunk/tools/tools/lib/CCM/Util.pm 2005-11-08 16:18:54 UTC (rev 983) +++ trunk/tools/tools/lib/CCM/Util.pm 2005-11-08 16:47:00 UTC (rev 984) @@ -152,7 +152,9 @@ $ccm_user = $user; } if (defined $ccm_user) { - my $ccm_user_id = getpwnam($ccm_user); + my ($name,$passwd,$ccm_user_id,$ccm_gid, + $quota,$comment,$gcos,$dir,$shell,$expire) + = getpwnam($ccm_user); if (! defined $ccm_user_id) { print STDERR "user: '$ccm_user' could not be found\n"; exit 10; @@ -169,6 +171,8 @@ print STDERR "You cannot run WAF as a user other than yourself unless you are root\n"; exit 12; } + $( = $ccm_gid + 0; + $) = "$ccm_gid $ccm_gid"; $< = $ccm_user_id; $> = $ccm_user_id; } |
From: <cl...@vh...> - 2005-11-08 16:19:54
|
Author: clasohm Date: 2005-11-08 17:18:54 +0100 (Tue, 08 Nov 2005) New Revision: 983 Modified: releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java Log: merged fix for update of m_lastRunDate from trunk Modified: releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java =================================================================== --- releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-08 16:18:30 UTC (rev 982) +++ releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-08 16:18:54 UTC (rev 983) @@ -119,6 +119,13 @@ s_log.info("Polling file every " + m_pollDelay + "s."); while ( (sleepSeconds(m_pollDelay) || m_ignoreInterrupt) && m_keepWatchingFiles ) { + // Get the last run date before we do anything, + // so we can be sure that we do not miss any themes + // published while we run. But only store it after + // we have processed all themes, because it will be + // used in ThemePublishedFileManager.updateTheme(). + Date lastRunDate = new Date(); + TransactionContext txn = SessionManager.getSession().getTransactionContext(); @@ -135,6 +142,8 @@ if (startedTransaction) { txn.commitTxn(); } + + m_lastRunDate = lastRunDate; } catch (Exception e) { s_log.warn("Ignoring uncaught exception", e); } finally { @@ -284,7 +293,6 @@ } } } - m_lastRunDate = new Date(); } |
From: <cl...@vh...> - 2005-11-08 16:19:31
|
Author: clasohm Date: 2005-11-08 17:18:30 +0100 (Tue, 08 Nov 2005) New Revision: 982 Modified: releases/1.0.2/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java Log: merged fix for update of m_lastRunDate from trunk Modified: releases/1.0.2/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java =================================================================== --- releases/1.0.2/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-08 15:59:26 UTC (rev 981) +++ releases/1.0.2/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-08 16:18:30 UTC (rev 982) @@ -122,6 +122,13 @@ s_log.info("Polling file every " + m_pollDelay + "s."); while ( (sleepSeconds(m_pollDelay) || m_ignoreInterrupt) && m_keepWatchingFiles ) { + // Get the last run date before we do anything, + // so we can be sure that we do not miss any themes + // published while we run. But only store it after + // we have processed all themes, because it will be + // used in ThemePublishedFileManager.updateTheme(). + Date lastRunDate = new Date(); + TransactionContext txn = SessionManager.getSession().getTransactionContext(); @@ -138,6 +145,8 @@ if (startedTransaction) { txn.commitTxn(); } + + m_lastRunDate = lastRunDate; } catch (Exception e) { s_log.warn("Ignoring uncaught exception", e); } finally { @@ -287,7 +296,6 @@ } } } - m_lastRunDate = new Date(); } |
From: <cl...@vh...> - 2005-11-08 16:00:38
|
Author: clasohm Date: 2005-11-08 16:59:26 +0100 (Tue, 08 Nov 2005) New Revision: 981 Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java Log: fixed update of m_lastRunDate, to prevent ThemePublishedFileManager.updateTheme() from skipping themes Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-08 14:38:05 UTC (rev 980) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemeFileManager.java 2005-11-08 15:59:26 UTC (rev 981) @@ -119,6 +119,13 @@ s_log.info("Polling file every " + m_pollDelay + "s."); while ( (sleepSeconds(m_pollDelay) || m_ignoreInterrupt) && m_keepWatchingFiles ) { + // Get the last run date before we do anything, + // so we can be sure that we do not miss any themes + // published while we run. But only store it after + // we have processed all themes, because it will be + // used in ThemePublishedFileManager.updateTheme(). + Date lastRunDate = new Date(); + TransactionContext txn = SessionManager.getSession().getTransactionContext(); @@ -135,6 +142,8 @@ if (startedTransaction) { txn.commitTxn(); } + + m_lastRunDate = lastRunDate; } catch (Exception e) { s_log.warn("Ignoring uncaught exception", e); } finally { @@ -284,7 +293,6 @@ } } } - m_lastRunDate = new Date(); } |
From: <cl...@vh...> - 2005-11-08 14:39:19
|
Author: clasohm Date: 2005-11-08 15:38:05 +0100 (Tue, 08 Nov 2005) New Revision: 980 Removed: trunk/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java Log: removed new class which depends on changes in c.a.xml.XML which were not submitted to the repository Deleted: trunk/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java |
From: <ap...@vh...> - 2005-11-08 14:28:10
|
Author: apevec Date: 2005-11-08 15:26:50 +0100 (Tue, 08 Nov 2005) New Revision: 979 Modified: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/BaseAsset.java trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamAsset.java Log: give a filename even when streaming an asset MSIE needs that - it basically ignores content-type and relies on filename extension Modified: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/BaseAsset.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/BaseAsset.java 2005-11-08 11:27:50 UTC (rev 978) +++ trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/BaseAsset.java 2005-11-08 14:26:50 UTC (rev 979) @@ -57,9 +57,15 @@ } private final boolean m_download; + private String m_disposition; protected BaseAsset(boolean download) { m_download = download; + if (m_download) { + m_disposition = "attachment; filename="; + } else { + m_disposition = "inline; filename="; + } } /** @@ -75,11 +81,10 @@ // quote the file name to deal with any special // characters in the name of the file - StringBuffer quotedString = new StringBuffer("\""); - quotedString.append(filename).append("\""); + StringBuffer disposition = new StringBuffer(m_disposition); + disposition.append('"').append(filename).append('"'); - response.setHeader("Content-Disposition", - "attachment; filename=" + quotedString.toString()); + response.setHeader("Content-Disposition", disposition.toString()); } private void setHeaders(HttpServletResponse response, Modified: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamAsset.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamAsset.java 2005-11-08 11:27:50 UTC (rev 978) +++ trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamAsset.java 2005-11-08 14:26:50 UTC (rev 979) @@ -43,8 +43,4 @@ super(false); } - // do not set Content-Disposition for asset streaming - protected void setFilenameHeader(HttpServletResponse response, - BinaryAsset asset) { - } } |
From: <cl...@vh...> - 2005-11-08 11:29:10
|
Author: clasohm Date: 2005-11-08 12:27:50 +0100 (Tue, 08 Nov 2005) New Revision: 978 Modified: releases/1.0.3/ccm-core/src/com/arsdigita/bebop/PageState.java Log: merged revision 973 from trunk to improve performance of CMS Authoring tab Modified: releases/1.0.3/ccm-core/src/com/arsdigita/bebop/PageState.java =================================================================== --- releases/1.0.3/ccm-core/src/com/arsdigita/bebop/PageState.java 2005-11-08 11:11:52 UTC (rev 977) +++ releases/1.0.3/ccm-core/src/com/arsdigita/bebop/PageState.java 2005-11-08 11:27:50 UTC (rev 978) @@ -509,12 +509,16 @@ int i = indexOf(c); if (v) { + if (!m_invisible.get(i)) + return; m_invisible.clear(i); } else { + if (m_invisible.get(i)) + return; m_invisible.set(i); } if (s_log.isInfoEnabled()) { - s_log.info("Marking visibility parameter as dirty " + m_request); + s_log.info("Marking visibility parameter as dirty " + m_request + " because of component " + c); } // Do this only in toURL since the RLE is expensive //m_pageState.put(Page.INVISIBLE, encodeVisibility(m_invisible)); |
From: <cl...@vh...> - 2005-11-08 11:12:58
|
Author: clasohm Date: 2005-11-08 12:11:52 +0100 (Tue, 08 Nov 2005) New Revision: 977 Modified: releases/1.0.2/ccm-core/src/com/arsdigita/bebop/PageState.java Log: merged revision 973 from trunk to improve performance of CMS Authoring tab Modified: releases/1.0.2/ccm-core/src/com/arsdigita/bebop/PageState.java =================================================================== --- releases/1.0.2/ccm-core/src/com/arsdigita/bebop/PageState.java 2005-11-08 08:48:33 UTC (rev 976) +++ releases/1.0.2/ccm-core/src/com/arsdigita/bebop/PageState.java 2005-11-08 11:11:52 UTC (rev 977) @@ -509,12 +509,16 @@ int i = indexOf(c); if (v) { + if (!m_invisible.get(i)) + return; m_invisible.clear(i); } else { + if (m_invisible.get(i)) + return; m_invisible.set(i); } if (s_log.isInfoEnabled()) { - s_log.info("Marking visibility parameter as dirty " + m_request); + s_log.info("Marking visibility parameter as dirty " + m_request + " because of component " + c); } // Do this only in toURL since the RLE is expensive //m_pageState.put(Page.INVISIBLE, encodeVisibility(m_invisible)); |
From: <fa...@vh...> - 2005-11-08 08:49:35
|
Author: fabrice Date: 2005-11-08 09:48:33 +0100 (Tue, 08 Nov 2005) New Revision: 976 Added: trunk/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java Log: Formatter to output semantic data for dates. Added: trunk/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java 2005-11-07 15:11:12 UTC (rev 975) +++ trunk/ccm-core/src/com/arsdigita/xml/formatters/FullDateFormatter.java 2005-11-08 08:48:33 UTC (rev 976) @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2002-2005 Runtime Collective Ltd. 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 + */ + +package com.arsdigita.xml.formatters; + +import com.arsdigita.kernel.Kernel; +import com.arsdigita.xml.Formatter; +import com.arsdigita.xml.XML; + +import java.text.DateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; + +/** + * A DateFormatter which displays dates as: + * <br> + * <yearNo> | <monthNo> | <dayOfMonthNo> | <dayOfWeekNo> + * | <hour> | <minute> | <second> | <apm> | <localised date> + * <br> + * the numbers are padded with 0s, so the positions of the fields are always + * 0, 7, 12, 17, 21, 26, 31, 36, 41 (in Java), and 1, 8, 13, 18, 22, 27, 32, 37, 42 (in XSL). + */ +public class FullDateFormatter extends DateFormatter { + + public static String SEPARATOR = " | "; + public static String AM = "am"; + public static String PM = "pm"; + public static char ZERO = '0'; + + public String format(Object value) { + + String parentResult = super.format(value); + + if (!XML.getConfig().getActivateFullTimeFormatter()) { + return parentResult; + } + + Date date = (Date) value; + Calendar cal = Calendar.getInstance(); + StringBuffer result = new StringBuffer(60); + + cal.setTime(date); + + append(result, cal.get(Calendar.YEAR)); + appendMaybeSmall(result, cal.get(Calendar.MONTH)); + appendMaybeSmall(result, cal.get(Calendar.DAY_OF_MONTH)); + append(result, cal.get(Calendar.DAY_OF_WEEK)); + appendMaybeSmall(result, cal.get(Calendar.HOUR)); + appendMaybeSmall(result, cal.get(Calendar.MINUTE)); + appendMaybeSmall(result, cal.get(Calendar.SECOND)); + + switch (cal.get(Calendar.AM_PM)) { + case Calendar.AM: result.append(AM); break; + case Calendar.PM: result.append(PM); break; + } + + result.append(SEPARATOR) + .append(parentResult); + + return result.toString(); + } + + public void appendMaybeSmall(StringBuffer sb, int value) { + if (value < 10) { + sb.append(ZERO); + } + append(sb, value); + } + + public void append(StringBuffer sb, int value) { + sb.append(value) + .append(SEPARATOR); + } +} |
From: <ap...@vh...> - 2005-11-07 15:12:14
|
Author: apevec Date: 2005-11-07 16:11:12 +0100 (Mon, 07 Nov 2005) New Revision: 975 Added: trunk/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java Modified: trunk/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java trunk/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java Log: a hook to add custom ResourceBundle on the top of the chain of bundles this makes possible to override resource keys in bundles which are part of core or cms for example, notification email text in CMSResources.properties Added: trunk/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java 2005-11-07 14:20:51 UTC (rev 974) +++ trunk/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java 2005-11-07 15:11:12 UTC (rev 975) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2004 Red Hat Inc. 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 + * + */ +package com.arsdigita.cms.util; + +import java.util.PropertyResourceBundle; +import com.arsdigita.globalization.ChainedResourceBundle; +import com.arsdigita.cms.CMSGlobalized; + +/** + * Main ResourceBundle for CMS UI. + * Can be extended using: + * - addBundle - to add new keys + * - putBundle - to override keys already in CMSResources e.g. to customize notification email text + **/ +public class CMSResourceBundle extends ChainedResourceBundle implements CMSGlobalized { + + public CMSResourceBundle() { + super(); + addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME)); + } +} Modified: trunk/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java 2005-11-07 14:20:51 UTC (rev 974) +++ trunk/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java 2005-11-07 15:11:12 UTC (rev 975) @@ -18,7 +18,6 @@ */ package com.arsdigita.cms.util; -import com.arsdigita.cms.CMSGlobalized; import com.arsdigita.globalization.GlobalizedMessage; /** @@ -31,13 +30,16 @@ * @version $Revision: #7 $ $Date: 2004/08/17 $ */ -public class GlobalizationUtil implements CMSGlobalized { - - public static GlobalizedMessage globalize(String key) { - return new GlobalizedMessage(key, BUNDLE_NAME); - } - public static GlobalizedMessage globalize(String key, Object[] args) { - return new GlobalizedMessage(key, BUNDLE_NAME, args); - } +public class GlobalizationUtil { + public static final String BUNDLE_NAME = "com.arsdigita.cms.util.CMSResourceBundle"; + + public static GlobalizedMessage globalize(String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + public static GlobalizedMessage globalize(String key, Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } + } Modified: trunk/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java 2005-11-07 14:20:51 UTC (rev 974) +++ trunk/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java 2005-11-07 15:11:12 UTC (rev 975) @@ -18,6 +18,8 @@ */ package com.arsdigita.globalization; +import java.util.LinkedList; +import java.util.List; import java.util.ResourceBundle; import java.util.PropertyResourceBundle; import java.util.ListResourceBundle; @@ -44,13 +46,13 @@ **/ public class ChainedResourceBundle extends ResourceBundle { - private ArrayList m_bundles; - private ArrayList m_keys; + private List m_bundles; + private List m_keys; public ChainedResourceBundle() { super(); - m_bundles = new ArrayList(); - m_keys = new ArrayList(); + m_bundles = new LinkedList(); + m_keys = new LinkedList(); } /** @@ -73,14 +75,32 @@ * This adds bundles to this chained resource. The bundles * are examined for the key in the order that they are added. */ - public void addBundle(ChainableResourceBundle bundle) { + private void addBundle(ChainableResourceBundle bundle) { m_bundles.add(bundle); Enumeration enu = bundle.getKeys(); while (enu.hasMoreElements()) { m_keys.add(enu.nextElement()); } } + + public void putBundle(PropertyResourceBundle bundle) { + putBundle(new ChainablePropertyResourceBundle(bundle)); + } + + public void pubBundle(ListResourceBundle bundle) { + putBundle(new ChainableListResourceBundle(bundle)); + } + private void putBundle(ChainableResourceBundle bundle) { + m_bundles.add(0,bundle); + Enumeration enu = bundle.getKeys(); + List bundleKeys = new LinkedList(); + while (enu.hasMoreElements()) { + bundleKeys.add(enu.nextElement()); + } + m_keys.addAll(0, bundleKeys); + } + /** * Because this particular bundle is just a wrapper around other bundles, * this method will return null so that the ResourceBundle can then |
From: <ssk...@vh...> - 2005-11-07 14:22:03
|
Author: sskracic Date: 2005-11-07 15:20:51 +0100 (Mon, 07 Nov 2005) New Revision: 974 Modified: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.1.1-6.2.0/fix-live-folder-security-context.sql Log: The upgrade (actually the bug-fix script) should also delete all permission records that were result of the 'use custom permissions' bug that had been fixed at r954. Modified: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.1.1-6.2.0/fix-live-folder-security-context.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.1.1-6.2.0/fix-live-folder-security-context.sql 2005-11-07 09:27:08 UTC (rev 973) +++ trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.1.1-6.2.0/fix-live-folder-security-context.sql 2005-11-07 14:20:51 UTC (rev 974) @@ -5,3 +5,10 @@ select f.folder_id from cms_folders f, cms_items ci where f.folder_id = ci.item_id and ci.version = 'live' ) ; + +delete from acs_permissions + where object_id in ( + select f.folder_id from cms_folders f, cms_items ci + where f.folder_id = ci.item_id and ci.version = 'live' + ) ; + |
From: <cl...@vh...> - 2005-11-07 09:28:31
|
Author: clasohm Date: 2005-11-07 10:27:08 +0100 (Mon, 07 Nov 2005) New Revision: 973 Modified: trunk/ccm-core/src/com/arsdigita/bebop/PageState.java Log: changed PageState.setVisible() to only invalidate the visibility cache when visibility of a component has actually changed, to improve performance of the CMS Authoring tab Modified: trunk/ccm-core/src/com/arsdigita/bebop/PageState.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/bebop/PageState.java 2005-11-05 23:44:53 UTC (rev 972) +++ trunk/ccm-core/src/com/arsdigita/bebop/PageState.java 2005-11-07 09:27:08 UTC (rev 973) @@ -509,12 +509,16 @@ int i = indexOf(c); if (v) { + if (!m_invisible.get(i)) + return; m_invisible.clear(i); } else { + if (m_invisible.get(i)) + return; m_invisible.set(i); } if (s_log.isInfoEnabled()) { - s_log.info("Marking visibility parameter as dirty " + m_request); + s_log.info("Marking visibility parameter as dirty " + m_request + " because of component " + c); } // Do this only in toURL since the RLE is expensive //m_pageState.put(Page.INVISIBLE, encodeVisibility(m_invisible)); |
From: <ap...@vh...> - 2005-11-05 23:45:49
|
Author: apevec Date: 2005-11-06 00:44:53 +0100 (Sun, 06 Nov 2005) New Revision: 972 Modified: trunk/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java Log: Add optional suffix to the operation name, to define task alert recipients. e.g. com.arsdigita.cms.default_task_alerts=Approval:enable_ALL:disable_LASTAUTHOR,Deploy:finish_LASTAUTHOR Sufix _LASTAUTHOR to send the alert only to auditing.lastModifiedUser default is _ALL - send alert to all task assignees Modified: trunk/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java 2005-11-05 23:04:11 UTC (rev 971) +++ trunk/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java 2005-11-05 23:44:53 UTC (rev 972) @@ -85,8 +85,15 @@ // a Map containing a list of the list of operations that // alerts should be sent out for private static final Map s_alerts = new HashMap(5); + private static final String ALERT_OPERATIONS = "operations"; + private static final String ALERT_RECIPIENTS = "recipients"; + private static final String ALERT_RECIPIENT_ALL = "_ALL"; + private static final String ALERT_RECIPIENT_LASTAUTHOR = "_LASTAUTHOR"; private static final Logger s_log = Logger.getLogger(CMSTask.class); + + private boolean m_authorOnly = false; + public CMSTask() { this(BASE_DATA_OBJECT_TYPE); } @@ -332,6 +339,7 @@ // UnfinishedTaskNotifier TimerTask, and that task will never // be scheduled unless we're supposed to send these messages Message msg = generateMessage(UNFINISHED_OP, sender); + m_authorOnly = false; sendMessageToAssignees(msg); } } @@ -352,20 +360,53 @@ typeMap = new HashMap(5); s_alerts.put(section.getID(), typeMap); } - Set operationSet = (Set) typeMap.get(typeLabel); + Map operations = (Map) typeMap.get(typeLabel); + if (operations == null) { + operations = new HashMap(2); + typeMap.put(typeLabel,operations); + } + Set operationSet = (Set) operations.get(ALERT_OPERATIONS); if (operationSet == null) { operationSet = new HashSet(5); - typeMap.put(typeLabel, operationSet); + operations.put(ALERT_OPERATIONS, operationSet); } + Set authorOnlySet = (Set) operations.get(ALERT_RECIPIENTS); + if (authorOnlySet == null) { + authorOnlySet = new HashSet(5); + operations.put(ALERT_RECIPIENTS, authorOnlySet); + } + // sufix _LASTAUTHOR to send the alert only to auditing.lastModifiedUser + // default if _ALL - send alert to all task assignees + String recipients = ALERT_RECIPIENT_ALL; + if (operation.endsWith(ALERT_RECIPIENT_LASTAUTHOR)) { + operation = operation.substring(0,operation.length() - ALERT_RECIPIENT_LASTAUTHOR.length()); + authorOnlySet.add(operation); + recipients = ALERT_RECIPIENT_LASTAUTHOR; + } else if (operation.endsWith(ALERT_RECIPIENT_ALL)) { + operation = operation.substring(0,operation.length() - ALERT_RECIPIENT_ALL.length()); + } operationSet.add(operation); s_log.info("Added alert for \"" + operation + "\" of " + typeLabel + - " task in section \"" + section.getName() + "\""); + " task in section \"" + section.getName() + "\" recipients flag: "+recipients); } protected static boolean shouldSendAlert(ContentSection section, + String typeLabel, + String operation) { + return checkAlertsConfig(section, typeLabel, operation, ALERT_OPERATIONS); + } + + protected static boolean shouldSendToAuthorOnly(ContentSection section, + String typeLabel, + String operation) { + return checkAlertsConfig(section, typeLabel, operation, ALERT_RECIPIENTS); + } + + private static boolean checkAlertsConfig(ContentSection section, String typeLabel, - String operation) { + String operation, + String field) { if (section == null || typeLabel == null || operation == null) { @@ -381,20 +422,24 @@ Map typeMap = (Map) s_alerts.get(section.getID()); Set operationSet = null; if (typeMap != null) { - operationSet = (Set) typeMap.get(typeLabel); + Map operations = (Map) typeMap.get(typeLabel); + if (operations != null) { + operationSet = (Set) operations.get(field); + } } if (operationSet != null) { send = operationSet.contains(operation); } - s_log.debug("Send email for operation " + operation + " of task " + typeLabel + "?: " + send); + s_log.debug("operation " + operation + " field " + field + " of task " + typeLabel + "?: " + send); return send; } protected boolean sendAlerts(String operation) { + ContentSection section = getContentSection(); + String label = getLabel(); + m_authorOnly = shouldSendToAuthorOnly(section, label, operation); return (super.sendAlerts(operation) && - shouldSendAlert(getContentSection(), - getLabel(), - operation)); + shouldSendAlert(section, label, operation)); } /** @@ -412,6 +457,20 @@ * @see #filterUsersAndSendMessage */ protected void sendMessageToAssignees(Message msg) { + if (m_authorOnly) { + ContentItem item = getItem(); + User author = item.getLastModifiedUser(); + if (author == null) { + // fallback: creator is always available in audit trail + author = item.getCreationUser(); + } + if (s_log.isDebugEnabled()) { + s_log.debug("spamming ONLY author " + author); + } + Notification notification = new Notification(author, msg); + notification.save(); + return; + } /* NOTE: * it would be cleaner to simply change getAssignedUsers() * to do what we want; however that is used by cms.ui.workflow.UserTaskComponent |
From: <ap...@vh...> - 2005-11-05 23:05:19
|
Author: apevec Date: 2005-11-06 00:04:11 +0100 (Sun, 06 Nov 2005) New Revision: 971 Modified: trunk/ccm-core/src/com/arsdigita/search/Search.java Log: Fix for double-close issue with Lucene 1.4.3 see https://sourceforge.net/forum/message.php?msg_id=3411434 Remove part of SF patch [ 1242260 ] Fixed file descriptors leak, worked fine with Lucene 1.2 but 1.4.3 doesn't allow double-closing. Modified: trunk/ccm-core/src/com/arsdigita/search/Search.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/Search.java 2005-11-04 13:12:16 UTC (rev 970) +++ trunk/ccm-core/src/com/arsdigita/search/Search.java 2005-11-05 23:04:11 UTC (rev 971) @@ -191,8 +191,6 @@ results = (ResultSet) cache.get(spec); if (results == null) { results = rawResults; - } else if(rawResults != null) { - rawResults.close(); } } catch(Exception e) { if(rawResults != null) { |
From: <ssk...@vh...> - 2005-11-04 13:13:26
|
Author: sskracic Date: 2005-11-04 14:12:16 +0100 (Fri, 04 Nov 2005) New Revision: 970 Modified: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql Log: Because of bug SF #1338725, deleting the original article would also delete a row from object_context table belonging to the copy. This fix re-creates missing rows in object_context. Modified: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql 2005-10-31 15:27:52 UTC (rev 969) +++ trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql 2005-11-04 13:12:16 UTC (rev 970) @@ -8,3 +8,8 @@ and context_id <> (select i3.parent_id from cms_items i3 where i3.item_id = object_context.object_id) ; +insert into object_context (object_id, context_id) + select ci.item_id, ci.parent_id from cms_items ci + where ci.parent_id in (select bundle_id from cms_bundles) + and ci.item_id not in (select object_id from object_context) ; + |
From: <cl...@vh...> - 2005-10-31 15:28:44
|
Author: clasohm Date: 2005-10-31 16:27:52 +0100 (Mon, 31 Oct 2005) New Revision: 969 Modified: trunk/ccm-cms/ Log: added .project and .classpath to svn:ignore Property changes on: trunk/ccm-cms ___________________________________________________________________ Name: svn:ignore - build + build .project .classpath |
From: <ssk...@vh...> - 2005-10-28 19:21:14
|
Author: sskracic Date: 2005-10-28 21:20:29 +0200 (Fri, 28 Oct 2005) New Revision: 968 Added: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/ trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.2.0-6.2.1.sql trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.2.0-6.2.1.sql Log: The SQL script that fixes all inconsistencies in security context of items originating from the copy operation. Added: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql 2005-10-28 18:13:43 UTC (rev 967) +++ trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql 2005-10-28 19:20:29 UTC (rev 968) @@ -0,0 +1,10 @@ + +update object_context set + context_id = (select ci.parent_id from cms_items ci + where ci.item_id = object_context.object_id) + where + object_id in (select i2.item_id from cms_items i2 + where i2.parent_id in (select bundle_id from cms_bundles)) + and context_id <> (select i3.parent_id from cms_items i3 + where i3.item_id = object_context.object_id) ; + Property changes on: trunk/ccm-cms/sql/ccm-cms/default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.2.0-6.2.1.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.2.0-6.2.1.sql 2005-10-28 18:13:43 UTC (rev 967) +++ trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.2.0-6.2.1.sql 2005-10-28 19:20:29 UTC (rev 968) @@ -0,0 +1,3 @@ + +@@ ../default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql + Property changes on: trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.2.0-6.2.1.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.2.0-6.2.1.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.2.0-6.2.1.sql 2005-10-28 18:13:43 UTC (rev 967) +++ trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.2.0-6.2.1.sql 2005-10-28 19:20:29 UTC (rev 968) @@ -0,0 +1,5 @@ +begin; + +\i ../default/upgrade/6.2.0-6.2.1/fix-article-security-context.sql + +commit; Property changes on: trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.2.0-6.2.1.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL |
From: <ssk...@vh...> - 2005-10-28 18:14:29
|
Author: sskracic Date: 2005-10-28 20:13:43 +0200 (Fri, 28 Oct 2005) New Revision: 967 Modified: releases/1.0.2/ccm-cms/application.xml releases/1.0.2/ccm-cms/src/com/arsdigita/cms/ContentBundle.java Log: Integrated r965 to the 1.0.2 release branch: fix for the security context broken when copying items. Modified: releases/1.0.2/ccm-cms/application.xml =================================================================== --- releases/1.0.2/ccm-cms/application.xml 2005-10-28 18:11:50 UTC (rev 966) +++ releases/1.0.2/ccm-cms/application.xml 2005-10-28 18:13:43 UTC (rev 967) @@ -3,7 +3,7 @@ name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.1.1" - release="11" + release="12" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> Modified: releases/1.0.2/ccm-cms/src/com/arsdigita/cms/ContentBundle.java =================================================================== --- releases/1.0.2/ccm-cms/src/com/arsdigita/cms/ContentBundle.java 2005-10-28 18:11:50 UTC (rev 966) +++ releases/1.0.2/ccm-cms/src/com/arsdigita/cms/ContentBundle.java 2005-10-28 18:13:43 UTC (rev 967) @@ -22,8 +22,12 @@ import com.arsdigita.categorization.CategoryCollection; import com.arsdigita.cms.lifecycle.Lifecycle; import com.arsdigita.cms.lifecycle.LifecycleDefinition; +import com.arsdigita.domain.AbstractDomainObjectObserver; import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.domain.DomainObjectObserver; +import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataObject; @@ -33,7 +37,6 @@ import com.arsdigita.web.Web; import com.arsdigita.workflow.simple.Workflow; import com.arsdigita.workflow.simple.WorkflowTemplate; - import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; @@ -41,7 +44,6 @@ import java.util.Enumeration; import java.util.List; import java.util.Locale; - import org.apache.log4j.Logger; /** @@ -61,6 +63,18 @@ private static final Logger s_log = Logger.getLogger(ContentBundle.class); + private static DomainObjectObserver s_instancesObserver = + new AbstractDomainObjectObserver() { + public void add(DomainObject dom, String name, + DataObject dobj) { + if (INSTANCES.equals(name)) { + if (dobj != null) { + PermissionService.setContext(dobj.getOID(), dom.getOID()); + } + } + } + }; + /** * The base data object type of a bundle */ @@ -587,6 +601,7 @@ protected void initialize() { super.initialize(); + addObserver(s_instancesObserver); m_wasNew = isNew(); } |