incorporate several APLAWS patches for ccm-ldn-portal:
r1718: Adds a NavigationDirectoryPortlet (update provided) r1739: Adds a portlet for playing a Flash movie using SWFObject 1.5 (update provided) r1745: Fixed compilation error (StringReader cannot be converted to InputStream) r1746: Fixed invalid characters in comments git-svn-id: https://svn.libreccm.org/ccm/trunk@62 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
830a4cc875
commit
74e5c975a0
|
|
@ -2,7 +2,7 @@
|
||||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
name="ccm-ldn-portal"
|
name="ccm-ldn-portal"
|
||||||
prettyName="Portal"
|
prettyName="Portal"
|
||||||
version="6.5.1"
|
version="6.5.3"
|
||||||
release="2"
|
release="2"
|
||||||
webapp="ROOT">
|
webapp="ROOT">
|
||||||
<ccm:dependencies>
|
<ccm:dependencies>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (C) 2008 Permeance Technologies Ptd 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
|
||||||
|
|
||||||
|
model com.arsdigita.london.portal.portlet;
|
||||||
|
|
||||||
|
import com.arsdigita.portal.Portlet;
|
||||||
|
|
||||||
|
object type FlashPortlet extends Portlet {
|
||||||
|
|
||||||
|
String[0..1] backgroundColour = portlet_flash.background_colour VARCHAR(7); // #nnnnnn
|
||||||
|
String[0..1] detectKey = portlet_flash.detect_key VARCHAR(32);
|
||||||
|
String[1..1] swfFile = portlet_flash.swf_file VARCHAR(2048);
|
||||||
|
String[1..1] height = portlet_flash.height VARCHAR(8); // 100(px), 25%
|
||||||
|
String[0..1] parameters = portlet_flash.parameters VARCHAR(1024);
|
||||||
|
String[0..1] quality = portlet_flash.quality VARCHAR(8);
|
||||||
|
String[0..1] redirectUrl = portlet_flash.redirect_url VARCHAR(2048);
|
||||||
|
String[0..1] variables = portlet_flash.variables VARCHAR(1024);
|
||||||
|
String[1..1] version = portlet_flash.version VARCHAR(8); // nn.nn.nn
|
||||||
|
String[1..1] width = portlet_flash.width VARCHAR(8); // 100(px), 25%
|
||||||
|
String[0..1] xiRedirectUrl = portlet_flash.xi_redirect_url VARCHAR(2048);
|
||||||
|
|
||||||
|
reference key (portlet_flash.portlet_id);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
|
||||||
|
model com.arsdigita.london.portal.portlet;
|
||||||
|
|
||||||
|
import com.arsdigita.london.navigation.Navigation;
|
||||||
|
import com.arsdigita.portal.Portlet;
|
||||||
|
|
||||||
|
object type NavigationDirectoryPortlet extends Portlet {
|
||||||
|
Navigation[1..1] navigation = join portlet_navigation_directory.navigation_id to nav_app.application_id;
|
||||||
|
Integer[1..1] depth = portlet_navigation_directory.depth INTEGER;
|
||||||
|
reference key (portlet_navigation_directory.portlet_id);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
-- Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
|
||||||
|
create table portlet_flash (
|
||||||
|
portlet_id INTEGER not null
|
||||||
|
constraint portle_flas_portlet_id_p_d00yp
|
||||||
|
primary key,
|
||||||
|
-- referential constraint for portlet_id deferred due to circular dependencies
|
||||||
|
background_colour VARCHAR(7),
|
||||||
|
detect_key VARCHAR(32),
|
||||||
|
swf_file VARCHAR(2048) not null,
|
||||||
|
height VARCHAR(8) not null,
|
||||||
|
parameters VARCHAR(1024),
|
||||||
|
quality VARCHAR(8),
|
||||||
|
redirect_url VARCHAR(2048),
|
||||||
|
variables VARCHAR(1024),
|
||||||
|
version VARCHAR(8) not null,
|
||||||
|
width VARCHAR(8) not null,
|
||||||
|
xi_redirect_url VARCHAR(2048)
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table portlet_flash add
|
||||||
|
constraint portle_flas_portlet_id_f_bhmp4 foreign key (portlet_id)
|
||||||
|
references portlets(portlet_id);
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
-- Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
|
||||||
|
create table portlet_navigation_directory (
|
||||||
|
portlet_id INTEGER not null
|
||||||
|
constraint port_navig_dire_por_id_p_n4lfs
|
||||||
|
primary key,
|
||||||
|
navigation_id INTEGER not null,
|
||||||
|
depth INTEGER not null
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table portlet_navigation_directory add
|
||||||
|
constraint port_navi_dir_navig_id_f_rq14k foreign key (navigation_id)
|
||||||
|
references nav_app(application_id);
|
||||||
|
|
||||||
|
alter table portlet_navigation_directory add
|
||||||
|
constraint port_navig_dire_por_id_f_vsyyc foreign key (portlet_id)
|
||||||
|
references portlets(portlet_id);
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
-- Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
|
||||||
|
@@ ../default/upgrade/add-navigation-directory-portlet.sql
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
-- Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
|
||||||
|
@@ ../default/upgrade/add-flash-portlet.sql
|
||||||
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
-- Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
|
||||||
|
begin;
|
||||||
|
\i ../default/upgrade/add-navigation-directory-portlet.sql
|
||||||
|
commit;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
-- Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
|
||||||
|
begin;
|
||||||
|
\i ../default/upgrade/add-flash-portlet.sql
|
||||||
|
commit;
|
||||||
|
|
||||||
|
|
@ -11,4 +11,12 @@
|
||||||
<version from="6.5.0" to="6.5.1">
|
<version from="6.5.0" to="6.5.1">
|
||||||
<script class="com.arsdigita.london.portal.upgrade.CreateContainerGroups"/>
|
<script class="com.arsdigita.london.portal.upgrade.CreateContainerGroups"/>
|
||||||
</version>
|
</version>
|
||||||
|
<version from="6.5.1" to="6.5.2">
|
||||||
|
<script sql="ccm-ldn-portal/upgrade/::database::-6.5.1-6.5.2.sql"/>
|
||||||
|
<script class="com.arsdigita.london.portal.upgrade.CreateNavigationDirectoryPortlet"/>
|
||||||
|
</version>
|
||||||
|
<version from="6.5.2" to="6.5.3">
|
||||||
|
<script sql="ccm-ldn-portal/upgrade/::database::-6.5.2-6.5.3.sql"/>
|
||||||
|
<script class="com.arsdigita.london.portal.upgrade.CreateFlashPortlet"/>
|
||||||
|
</version>
|
||||||
</upgrade>
|
</upgrade>
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,10 @@ import com.arsdigita.london.navigation.ApplicationNavigationModel;
|
||||||
import com.arsdigita.london.navigation.DefaultNavigationModel;
|
import com.arsdigita.london.navigation.DefaultNavigationModel;
|
||||||
import com.arsdigita.london.portal.portlet.ApplicationDirectoryPortlet;
|
import com.arsdigita.london.portal.portlet.ApplicationDirectoryPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
|
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
|
||||||
|
import com.arsdigita.london.portal.portlet.FlashPortletInitializer;
|
||||||
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
|
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.LoginPortlet;
|
import com.arsdigita.london.portal.portlet.LoginPortlet;
|
||||||
|
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.RSSFeedPortlet;
|
import com.arsdigita.london.portal.portlet.RSSFeedPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
|
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
|
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
|
||||||
|
|
@ -59,11 +61,11 @@ import com.arsdigita.xml.XML;
|
||||||
/**
|
/**
|
||||||
* Initializes the Portal system
|
* Initializes the Portal system
|
||||||
*
|
*
|
||||||
* @version $Id: Initializer.java 1174 2006-06-14 14:14:15Z fabrice $
|
* @version $Id: Initializer.java 1739 2008-08-15 01:15:21Z terry $
|
||||||
*/
|
*/
|
||||||
public class Initializer extends CompoundInitializer {
|
public class Initializer extends CompoundInitializer {
|
||||||
public final static String versionId = "$Id: Initializer.java 1174 2006-06-14 14:14:15Z fabrice $"
|
public final static String versionId = "$Id: Initializer.java 1739 2008-08-15 01:15:21Z terry $"
|
||||||
+ "$Author: fabrice $" + "$DateTime: 2004/03/02 06:33:42 $";
|
+ "$Author: terry $" + "$DateTime: 2004/03/02 06:33:42 $";
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(Initializer.class);
|
private static final Logger s_log = Logger.getLogger(Initializer.class);
|
||||||
|
|
||||||
|
|
@ -217,6 +219,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new ResourceTypeConfig(RSSFeedPortlet.BASE_DATA_OBJECT_TYPE) {
|
new ResourceTypeConfig(RSSFeedPortlet.BASE_DATA_OBJECT_TYPE) {
|
||||||
public ResourceConfigFormSection getCreateFormSection(
|
public ResourceConfigFormSection getCreateFormSection(
|
||||||
final ResourceType resType, final RequestLocal parentAppRL) {
|
final ResourceType resType, final RequestLocal parentAppRL) {
|
||||||
|
|
@ -268,6 +271,11 @@ public class Initializer extends CompoundInitializer {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NavigationDirectoryPortlet.registerInstantiator();
|
||||||
|
NavigationDirectoryPortlet.registerResourceTypeConfig();
|
||||||
|
|
||||||
|
FlashPortletInitializer.initialize();
|
||||||
|
|
||||||
ApplicationNavigationModel.register(Workspace.class.getName(),
|
ApplicationNavigationModel.register(Workspace.class.getName(),
|
||||||
new DefaultNavigationModel());
|
new DefaultNavigationModel());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import com.arsdigita.london.portal.portlet.ApplicationDirectoryPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
|
import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
|
import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.LoginPortlet;
|
import com.arsdigita.london.portal.portlet.LoginPortlet;
|
||||||
|
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.RSSFeedPortlet;
|
import com.arsdigita.london.portal.portlet.RSSFeedPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
|
import com.arsdigita.london.portal.portlet.TimeOfDayPortlet;
|
||||||
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
|
import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet;
|
||||||
|
|
@ -44,11 +45,11 @@ import com.arsdigita.web.ApplicationType;
|
||||||
* Loader.
|
* Loader.
|
||||||
*
|
*
|
||||||
* @author Justin Ross <jross@redhat.com>
|
* @author Justin Ross <jross@redhat.com>
|
||||||
* @version $Id: Loader.java 1174 2006-06-14 14:14:15Z fabrice $
|
* @version $Id: Loader.java 1718 2008-07-16 14:08:38Z terry $
|
||||||
*/
|
*/
|
||||||
public class Loader extends PackageLoader {
|
public class Loader extends PackageLoader {
|
||||||
public final static String versionId = "$Id: Loader.java 1174 2006-06-14 14:14:15Z fabrice $"
|
public final static String versionId = "$Id: Loader.java 1718 2008-07-16 14:08:38Z terry $"
|
||||||
+ "$Author: fabrice $" + "$DateTime: 2004/03/02 06:33:42 $";
|
+ "$Author: terry $" + "$DateTime: 2004/03/02 06:33:42 $";
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(Loader.class);
|
private static final Logger s_log = Logger.getLogger(Loader.class);
|
||||||
|
|
||||||
|
|
@ -85,6 +86,7 @@ public class Loader extends PackageLoader {
|
||||||
loadLoginPortlet();
|
loadLoginPortlet();
|
||||||
loadApplicationDirectoryPortlet();
|
loadApplicationDirectoryPortlet();
|
||||||
loadWorkspaceDirectoryPortlet();
|
loadWorkspaceDirectoryPortlet();
|
||||||
|
NavigationDirectoryPortlet.loadPortletType();
|
||||||
}
|
}
|
||||||
}.run();
|
}.run();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,350 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Ptd 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.london.portal.portlet;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringBufferInputStream;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||||
|
import com.arsdigita.london.portal.ui.portlet.FlashPortletRenderer;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.portal.Portlet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This portlet displays a Flash movie using <a href="http://blog.deconcept.com/swfobject/">SWFObject 1.5</a>.
|
||||||
|
*
|
||||||
|
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||||
|
*/
|
||||||
|
public class FlashPortlet extends Portlet
|
||||||
|
{
|
||||||
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.portal.portlet.FlashPortlet";
|
||||||
|
|
||||||
|
public static final String BACKGROUND_COLOUR = "backgroundColour";
|
||||||
|
|
||||||
|
public static final String DETECT_KEY = "detectKey";
|
||||||
|
|
||||||
|
public static final String SWF_FILE = "swfFile";
|
||||||
|
|
||||||
|
public static final String HEIGHT = "height";
|
||||||
|
|
||||||
|
public static final String PARAMETERS = "parameters";
|
||||||
|
|
||||||
|
public static final String QUALITY = "quality";
|
||||||
|
|
||||||
|
public static final String REDIRECT_URL = "redirectUrl";
|
||||||
|
|
||||||
|
public static final String VARIABLES = "variables";
|
||||||
|
|
||||||
|
public static final String VERSION = "version";
|
||||||
|
|
||||||
|
public static final String WIDTH = "width";
|
||||||
|
|
||||||
|
public static final String XI_REDIRECT_URL = "xiRedirectUrl";
|
||||||
|
|
||||||
|
protected FlashPortlet(DataObject dataObject)
|
||||||
|
{
|
||||||
|
super(dataObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getBaseDataObjectType()
|
||||||
|
{
|
||||||
|
return BASE_DATA_OBJECT_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AbstractPortletRenderer doGetPortletRenderer()
|
||||||
|
{
|
||||||
|
return new FlashPortletRenderer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the background colour.
|
||||||
|
*
|
||||||
|
* @return the background colour..
|
||||||
|
*/
|
||||||
|
public String getBackgroundColour()
|
||||||
|
{
|
||||||
|
return (String) get(BACKGROUND_COLOUR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the background colour as a hex string, <i>e.g.</i> <code>#336699</code>.
|
||||||
|
*
|
||||||
|
* @param backgroundColour
|
||||||
|
* the background colour to set
|
||||||
|
*/
|
||||||
|
public void setBackgroundColour(String backgroundColour)
|
||||||
|
{
|
||||||
|
set(BACKGROUND_COLOUR, backgroundColour);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the URL parameter name that the SWFObject script will look for when bypassing the detection (optional).
|
||||||
|
* Default is "detectflash".
|
||||||
|
*
|
||||||
|
* @return the detect key
|
||||||
|
*/
|
||||||
|
public String getDetectKey()
|
||||||
|
{
|
||||||
|
return (String) get(DETECT_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the URL parameter name that the SWFObject script will look for when bypassing the detection (optional).
|
||||||
|
* Default is "detectflash".
|
||||||
|
*
|
||||||
|
* @param detectKey
|
||||||
|
* the detect key to set
|
||||||
|
*/
|
||||||
|
public void setDetectKey(String detectKey)
|
||||||
|
{
|
||||||
|
set(DETECT_KEY, detectKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SWF file.
|
||||||
|
*
|
||||||
|
* @return the file.
|
||||||
|
*/
|
||||||
|
public String getFile()
|
||||||
|
{
|
||||||
|
return (String) get(SWF_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the SWF file
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* the height to set
|
||||||
|
*/
|
||||||
|
public void setFile(String file)
|
||||||
|
{
|
||||||
|
set(SWF_FILE, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the height.
|
||||||
|
*
|
||||||
|
* @return the height as pixels or percentage.
|
||||||
|
*/
|
||||||
|
public String getHeight()
|
||||||
|
{
|
||||||
|
return (String) get(HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param height
|
||||||
|
* the height to set as pixels or percentage
|
||||||
|
*/
|
||||||
|
public void setHeight(String height)
|
||||||
|
{
|
||||||
|
set(HEIGHT, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parameters.
|
||||||
|
*
|
||||||
|
* @return the parameters in {@link Properties} file format.
|
||||||
|
*/
|
||||||
|
public String getParameters()
|
||||||
|
{
|
||||||
|
return (String) get(PARAMETERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parameters.
|
||||||
|
*
|
||||||
|
* @return a map the the parameters, possibly empty but not null.
|
||||||
|
*/
|
||||||
|
public Map getParametersMap()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Properties parameters = new Properties();
|
||||||
|
if (this.getParameters() != null && this.getParameters().trim().length() > 1)
|
||||||
|
{
|
||||||
|
parameters.load(new StringBufferInputStream(this.getParameters()));
|
||||||
|
}
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param parameters
|
||||||
|
* the parameters to set
|
||||||
|
*/
|
||||||
|
public void setParameters(String parameters)
|
||||||
|
{
|
||||||
|
set(PARAMETERS, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the quality for the Flash movie to play at (optional).
|
||||||
|
*
|
||||||
|
* @return the quality
|
||||||
|
*/
|
||||||
|
public String getQuality()
|
||||||
|
{
|
||||||
|
return (String) get(QUALITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the quality for the Flash movie to play at. If no quality is specified, the default is "high". (optional)
|
||||||
|
*
|
||||||
|
* @param quality
|
||||||
|
* the quality to set
|
||||||
|
*
|
||||||
|
* @see <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701&sliceId=2">Flash OBJECT and
|
||||||
|
* EMBED tag attributes< /a> documents the legal values for quality
|
||||||
|
*/
|
||||||
|
public void setQuality(String quality)
|
||||||
|
{
|
||||||
|
set(QUALITY, quality);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the redirect URL for users who don't have the correct plug-in version (optional).
|
||||||
|
*
|
||||||
|
* @return the redirect URL
|
||||||
|
*/
|
||||||
|
public String getRedirectUrl()
|
||||||
|
{
|
||||||
|
return (String) get(REDIRECT_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the redirect URL for users who don't have the correct plug-in version. (optional).
|
||||||
|
*
|
||||||
|
* @param redirectUrl
|
||||||
|
* redirect URL to set
|
||||||
|
*/
|
||||||
|
public void setRedirectUrl(String redirectUrl)
|
||||||
|
{
|
||||||
|
set(REDIRECT_URL, redirectUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the variables.
|
||||||
|
*
|
||||||
|
* @param variables
|
||||||
|
* variables to set
|
||||||
|
*/
|
||||||
|
public void setVariables(String variables)
|
||||||
|
{
|
||||||
|
set(VARIABLES, variables);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the variables.
|
||||||
|
*
|
||||||
|
* @return the variables in {@link Properties} file format.
|
||||||
|
*/
|
||||||
|
public String getVariables()
|
||||||
|
{
|
||||||
|
return (String) get(VARIABLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the variables.
|
||||||
|
*
|
||||||
|
* @return a map the the variables, possibly empty but not null.
|
||||||
|
*/
|
||||||
|
public Map getVariablesMap()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Properties variables = new Properties();
|
||||||
|
if (this.getVariables() != null && this.getVariables().trim().length() > 1)
|
||||||
|
{
|
||||||
|
variables.load(new StringBufferInputStream(this.getVariables()));
|
||||||
|
}
|
||||||
|
return variables;
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the minimum version of Flash required, e.g. "6.0.65".
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
* the version to set
|
||||||
|
*/
|
||||||
|
public void setVersion(String version)
|
||||||
|
{
|
||||||
|
set(VERSION, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the minimum version of Flash required.
|
||||||
|
*
|
||||||
|
* @return the version.
|
||||||
|
*/
|
||||||
|
public String getVersion()
|
||||||
|
{
|
||||||
|
return (String) get(VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the width.
|
||||||
|
*
|
||||||
|
* @return the width as pixels or percentage.
|
||||||
|
*/
|
||||||
|
public String getWidth()
|
||||||
|
{
|
||||||
|
return (String) get(WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param width
|
||||||
|
* the width to set as pixels or percentage
|
||||||
|
*/
|
||||||
|
public void setWidth(String width)
|
||||||
|
{
|
||||||
|
set(WIDTH, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the URL to redirect users who complete the ExpressInstall upgrade (optional).
|
||||||
|
*
|
||||||
|
* @return the express install redirect URL
|
||||||
|
*/
|
||||||
|
public String getXiRedirectUrl()
|
||||||
|
{
|
||||||
|
return (String) get(XI_REDIRECT_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the URL to redirect users who complete the ExpressInstall upgrade (optional).
|
||||||
|
*
|
||||||
|
* @param xiRedirectUrl
|
||||||
|
* express install redirect URL to set
|
||||||
|
*/
|
||||||
|
public void setXiRedirectUrl(String xiRedirectUrl)
|
||||||
|
{
|
||||||
|
set(XI_REDIRECT_URL, xiRedirectUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Ptd 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.london.portal.portlet;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||||
|
import com.arsdigita.kernel.ResourceType;
|
||||||
|
import com.arsdigita.kernel.ResourceTypeConfig;
|
||||||
|
import com.arsdigita.kernel.ui.ResourceConfigFormSection;
|
||||||
|
import com.arsdigita.london.portal.ui.portlet.FlashPortletEditor;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.portal.PortletType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads and initializes the {@link FlashPortlet}.
|
||||||
|
*
|
||||||
|
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||||
|
*/
|
||||||
|
public final class FlashPortletInitializer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Load the {@link PortletType}.
|
||||||
|
*/
|
||||||
|
public static void loadPortletType()
|
||||||
|
{
|
||||||
|
PortletType type = PortletType.createPortletType("Flash movie", PortletType.WIDE_PROFILE,
|
||||||
|
FlashPortlet.BASE_DATA_OBJECT_TYPE);
|
||||||
|
type.setDescription("Displays a Flash movie");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the {@link FlashPortlet} by registering the instantiator and portlet editor.
|
||||||
|
*/
|
||||||
|
public static void initialize()
|
||||||
|
{
|
||||||
|
DomainObjectFactory.registerInstantiator(FlashPortlet.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator()
|
||||||
|
{
|
||||||
|
public DomainObject doNewInstance(DataObject dataObject)
|
||||||
|
{
|
||||||
|
return new FlashPortlet(dataObject);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
new ResourceTypeConfig(FlashPortlet.BASE_DATA_OBJECT_TYPE)
|
||||||
|
{
|
||||||
|
public ResourceConfigFormSection getCreateFormSection(final ResourceType resType,
|
||||||
|
final RequestLocal parentAppRL)
|
||||||
|
{
|
||||||
|
return new FlashPortletEditor(resType, parentAppRL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceConfigFormSection getModifyFormSection(final RequestLocal application)
|
||||||
|
{
|
||||||
|
return new FlashPortletEditor(application);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
private FlashPortletInitializer()
|
||||||
|
{
|
||||||
|
// This class cannot be instantiated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Pty 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.london.portal.portlet;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||||
|
import com.arsdigita.kernel.ResourceType;
|
||||||
|
import com.arsdigita.kernel.ResourceTypeConfig;
|
||||||
|
import com.arsdigita.kernel.ui.ResourceConfigFormSection;
|
||||||
|
import com.arsdigita.london.navigation.Navigation;
|
||||||
|
import com.arsdigita.london.portal.ui.portlet.NavigationDirectoryPortletEditor;
|
||||||
|
import com.arsdigita.london.portal.ui.portlet.NavigationDirectoryPortletRenderer;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.portal.Portlet;
|
||||||
|
import com.arsdigita.portal.PortletType;
|
||||||
|
|
||||||
|
public class NavigationDirectoryPortlet extends Portlet
|
||||||
|
{
|
||||||
|
private static final Logger s_log = Logger.getLogger(NavigationDirectoryPortlet.class);
|
||||||
|
|
||||||
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet";
|
||||||
|
|
||||||
|
public static final String DEPTH = "depth";
|
||||||
|
|
||||||
|
public static final String NAVIGATION = "navigation";
|
||||||
|
|
||||||
|
public static void loadPortletType()
|
||||||
|
{
|
||||||
|
PortletType type = PortletType.createPortletType("Navigation Directory", PortletType.WIDE_PROFILE,
|
||||||
|
NavigationDirectoryPortlet.BASE_DATA_OBJECT_TYPE);
|
||||||
|
type.setDescription("Displays a directory of navigation categories");
|
||||||
|
s_log.info("Loading portlet type " + type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerInstantiator()
|
||||||
|
{
|
||||||
|
DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator()
|
||||||
|
{
|
||||||
|
public DomainObject doNewInstance(DataObject dataObject)
|
||||||
|
{
|
||||||
|
return new NavigationDirectoryPortlet(dataObject);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerResourceTypeConfig()
|
||||||
|
{
|
||||||
|
new ResourceTypeConfig(BASE_DATA_OBJECT_TYPE)
|
||||||
|
{
|
||||||
|
public ResourceConfigFormSection getCreateFormSection(final ResourceType resType,
|
||||||
|
final RequestLocal parentAppRL)
|
||||||
|
{
|
||||||
|
return new NavigationDirectoryPortletEditor(resType, parentAppRL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceConfigFormSection getModifyFormSection(final RequestLocal application)
|
||||||
|
{
|
||||||
|
return new NavigationDirectoryPortletEditor(application);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public NavigationDirectoryPortlet(DataObject dataObject)
|
||||||
|
{
|
||||||
|
super(dataObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepth(int depth)
|
||||||
|
{
|
||||||
|
set(DEPTH, new Integer(depth));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDepth()
|
||||||
|
{
|
||||||
|
return ((Integer) get(DEPTH)).intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Navigation getNavigation()
|
||||||
|
{
|
||||||
|
return new Navigation((DataObject) get(NAVIGATION));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNavigation(Navigation navigation)
|
||||||
|
{
|
||||||
|
set(NAVIGATION, navigation);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AbstractPortletRenderer doGetPortletRenderer()
|
||||||
|
{
|
||||||
|
return new NavigationDirectoryPortletRenderer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getBaseDataObjectType()
|
||||||
|
{
|
||||||
|
return BASE_DATA_OBJECT_TYPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,249 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Ptd 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.london.portal.ui.portlet;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Link;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.HTMLColourCodeValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.bebop.portal.PortletConfigFormSection;
|
||||||
|
import com.arsdigita.kernel.ResourceType;
|
||||||
|
import com.arsdigita.london.portal.portlet.FlashPortlet;
|
||||||
|
import com.arsdigita.portal.Portlet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||||
|
*/
|
||||||
|
public class FlashPortletEditor extends PortletConfigFormSection
|
||||||
|
{
|
||||||
|
private TextField m_backgroundColour;
|
||||||
|
|
||||||
|
private TextField m_detectKey;
|
||||||
|
|
||||||
|
private TextField m_file;
|
||||||
|
|
||||||
|
private TextField m_height;
|
||||||
|
|
||||||
|
private TextArea m_parameters;
|
||||||
|
|
||||||
|
private SingleSelect m_quality;
|
||||||
|
|
||||||
|
private TextField m_redirectUrl;
|
||||||
|
|
||||||
|
private TextArea m_variables;
|
||||||
|
|
||||||
|
private TextField m_version;
|
||||||
|
|
||||||
|
private TextField m_width;
|
||||||
|
|
||||||
|
private TextField m_xiRedirectUrl;
|
||||||
|
|
||||||
|
public FlashPortletEditor(ResourceType resType, RequestLocal parentAppRL)
|
||||||
|
{
|
||||||
|
super(resType, parentAppRL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlashPortletEditor(RequestLocal application)
|
||||||
|
{
|
||||||
|
super(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addWidgets()
|
||||||
|
{
|
||||||
|
super.addWidgets();
|
||||||
|
|
||||||
|
m_file = this.addTextField(FlashPortlet.SWF_FILE, "SWF file", 64, 2048, true);
|
||||||
|
m_width = this.addTextField(FlashPortlet.WIDTH, "Width", 8, 8, true);
|
||||||
|
m_height = this.addTextField(FlashPortlet.HEIGHT, "Height", 8, 8, true);
|
||||||
|
m_version = this.addTextField(FlashPortlet.VERSION, "Minimum Flash version", 8, 8, true);
|
||||||
|
m_backgroundColour = this.addTextField(FlashPortlet.BACKGROUND_COLOUR, "Background colour", 7, 7, true);
|
||||||
|
m_backgroundColour.addValidationListener(new HTMLColourCodeValidationListener());
|
||||||
|
|
||||||
|
m_quality = this.addSingleSelect(FlashPortlet.QUALITY, "Quality", false);
|
||||||
|
m_quality.addOption(new Option("low"));
|
||||||
|
m_quality.addOption(new Option("autolow"));
|
||||||
|
m_quality.addOption(new Option("autohigh"));
|
||||||
|
m_quality.addOption(new Option("medium"));
|
||||||
|
m_quality.addOption(new Option("high"));
|
||||||
|
m_quality.addOption(new Option("best"));
|
||||||
|
|
||||||
|
m_parameters = this.addTextArea(FlashPortlet.PARAMETERS, "Parameters", 4, 64, false);
|
||||||
|
m_variables = this.addTextArea(FlashPortlet.VARIABLES, "Variables", 4, 64, false);
|
||||||
|
|
||||||
|
m_detectKey = this.addTextField(FlashPortlet.DETECT_KEY, "Detect key", 32, 32, false);
|
||||||
|
m_redirectUrl = this.addTextField(FlashPortlet.REDIRECT_URL, "Redirect URL", 64, 2048, false);
|
||||||
|
m_xiRedirectUrl = this.addTextField(FlashPortlet.XI_REDIRECT_URL, "XI Redirect URL", 64, 2048, false);
|
||||||
|
|
||||||
|
add(new Link("What do these fields mean?", "http://blog.deconcept.com/swfobject/"), ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initWidgets(PageState state, Portlet portlet) throws FormProcessException
|
||||||
|
{
|
||||||
|
super.initWidgets(state, portlet);
|
||||||
|
|
||||||
|
if (portlet != null)
|
||||||
|
{
|
||||||
|
FlashPortlet flashPortlet = (FlashPortlet) portlet;
|
||||||
|
|
||||||
|
// Load the form from the portlet
|
||||||
|
m_backgroundColour.setValue(state, flashPortlet.getBackgroundColour());
|
||||||
|
m_detectKey.setValue(state, flashPortlet.getDetectKey());
|
||||||
|
m_file.setValue(state, flashPortlet.getFile());
|
||||||
|
m_height.setValue(state, flashPortlet.getHeight());
|
||||||
|
m_parameters.setValue(state, flashPortlet.getParameters());
|
||||||
|
|
||||||
|
m_redirectUrl.setValue(state, flashPortlet.getRedirectUrl());
|
||||||
|
m_variables.setValue(state, flashPortlet.getVariables());
|
||||||
|
m_version.setValue(state, flashPortlet.getVersion());
|
||||||
|
m_width.setValue(state, flashPortlet.getWidth());
|
||||||
|
m_xiRedirectUrl.setValue(state, flashPortlet.getXiRedirectUrl());
|
||||||
|
m_quality.setValue(state, flashPortlet.getQuality());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set defaults
|
||||||
|
m_backgroundColour.setValue(state, "#ffffff");
|
||||||
|
m_file.setValue(state, "http://www.adobe.com/support/flashplayer/ts/documents/tn_15507/flashplayerversion.swf");
|
||||||
|
m_width.setValue(state, "100%");
|
||||||
|
m_height.setValue(state, "100%");
|
||||||
|
m_version.setValue(state, "8.0");
|
||||||
|
m_quality.setValue(state, "high");
|
||||||
|
m_parameters.setValue(state, "mode=transparent\nplay=false\nloop=false\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void processWidgets(PageState state, Portlet portlet) throws FormProcessException
|
||||||
|
{
|
||||||
|
super.processWidgets(state, portlet);
|
||||||
|
|
||||||
|
FlashPortlet flashPortlet = (FlashPortlet) portlet;
|
||||||
|
|
||||||
|
flashPortlet.setBackgroundColour((String) m_backgroundColour.getValue(state));
|
||||||
|
flashPortlet.setDetectKey((String) m_detectKey.getValue(state));
|
||||||
|
flashPortlet.setFile((String) m_file.getValue(state));
|
||||||
|
flashPortlet.setHeight((String) m_height.getValue(state));
|
||||||
|
flashPortlet.setParameters((String) m_parameters.getValue(state));
|
||||||
|
flashPortlet.setQuality((String) m_quality.getValue(state));
|
||||||
|
flashPortlet.setRedirectUrl((String) m_redirectUrl.getValue(state));
|
||||||
|
flashPortlet.setVariables((String) m_variables.getValue(state));
|
||||||
|
flashPortlet.setVersion((String) m_version.getValue(state));
|
||||||
|
flashPortlet.setWidth((String) m_width.getValue(state));
|
||||||
|
flashPortlet.setXiRedirectUrl((String) m_xiRedirectUrl.getValue(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new text field.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* the name of the parameter
|
||||||
|
* @param label
|
||||||
|
* the label to be displayed
|
||||||
|
* @param size
|
||||||
|
* the visible size of the text field
|
||||||
|
* @param maxLength
|
||||||
|
* the maximum length of text that can be entered
|
||||||
|
* @param mandatory
|
||||||
|
* denotes whether this text field requires a value
|
||||||
|
* @return the text field
|
||||||
|
*/
|
||||||
|
private TextField addTextField(String name, String label, int size, int maxLength, boolean mandatory)
|
||||||
|
{
|
||||||
|
TextField field = new TextField(new StringParameter(name));
|
||||||
|
field.setSize(size);
|
||||||
|
field.setMaxLength(maxLength);
|
||||||
|
|
||||||
|
// Add validation
|
||||||
|
if (mandatory)
|
||||||
|
{
|
||||||
|
field.addValidationListener(new NotEmptyValidationListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the form
|
||||||
|
add(mandatory ? new Label(label + ":", Label.BOLD) : new Label(label + ":"), ColumnPanel.RIGHT);
|
||||||
|
add(field);
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new text area.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* the name of the parameter
|
||||||
|
* @param label
|
||||||
|
* the label to be displayed
|
||||||
|
* @param rows
|
||||||
|
* the visible rows
|
||||||
|
* @param cols
|
||||||
|
* the visible cols
|
||||||
|
* @param mandatory
|
||||||
|
* denotes whether this text field requires a value
|
||||||
|
* @return the text area
|
||||||
|
*/
|
||||||
|
private TextArea addTextArea(String name, String label, int rows, int cols, boolean mandatory)
|
||||||
|
{
|
||||||
|
TextArea field = new TextArea(new StringParameter(name), rows, cols, TextArea.SOFT);
|
||||||
|
|
||||||
|
// Add validation
|
||||||
|
if (mandatory)
|
||||||
|
{
|
||||||
|
field.addValidationListener(new NotEmptyValidationListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the form
|
||||||
|
add(mandatory ? new Label(label + ":", Label.BOLD) : new Label(label + ":"), ColumnPanel.RIGHT);
|
||||||
|
add(field);
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new single select.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* the name of the parameter
|
||||||
|
* @param label
|
||||||
|
* the label to be displayed
|
||||||
|
* @param mandatory
|
||||||
|
* denotes whether this text field requires a value
|
||||||
|
* @return the text area
|
||||||
|
*/
|
||||||
|
private SingleSelect addSingleSelect(String name, String label, boolean mandatory)
|
||||||
|
{
|
||||||
|
SingleSelect field = new SingleSelect(new StringParameter(name));
|
||||||
|
|
||||||
|
// Add validation
|
||||||
|
if (mandatory)
|
||||||
|
{
|
||||||
|
field.addValidationListener(new NotEmptyValidationListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the form
|
||||||
|
add(mandatory ? new Label(label + ":", Label.BOLD) : new Label(label + ":"), ColumnPanel.RIGHT);
|
||||||
|
add(field);
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Ptd 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.london.portal.ui.portlet;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||||
|
import com.arsdigita.london.portal.portlet.FlashPortlet;
|
||||||
|
import com.arsdigita.london.portal.ui.PortalConstants;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||||
|
*/
|
||||||
|
public class FlashPortletRenderer extends AbstractPortletRenderer
|
||||||
|
{
|
||||||
|
private final FlashPortlet m_portlet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a renderer for the {@link FlashPortlet}.
|
||||||
|
*
|
||||||
|
* @param portlet
|
||||||
|
* the portlet
|
||||||
|
*/
|
||||||
|
public FlashPortletRenderer(FlashPortlet portlet)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
m_portlet = portlet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AbstractPortletRenderer#generateBodyXML
|
||||||
|
*/
|
||||||
|
public void generateBodyXML(PageState state, Element parentElement)
|
||||||
|
{
|
||||||
|
Element portletElement = parentElement.newChildElement("portlet:flash", PortalConstants.PORTLET_XML_NS);
|
||||||
|
|
||||||
|
portletElement.addAttribute(FlashPortlet.BACKGROUND_COLOUR, m_portlet.getBackgroundColour());
|
||||||
|
portletElement.addAttribute(FlashPortlet.DETECT_KEY, m_portlet.getDetectKey());
|
||||||
|
portletElement.addAttribute(FlashPortlet.SWF_FILE, m_portlet.getFile());
|
||||||
|
portletElement.addAttribute(FlashPortlet.HEIGHT, m_portlet.getHeight());
|
||||||
|
portletElement.addAttribute(FlashPortlet.QUALITY, m_portlet.getQuality());
|
||||||
|
portletElement.addAttribute(FlashPortlet.REDIRECT_URL, m_portlet.getRedirectUrl());
|
||||||
|
portletElement.addAttribute(FlashPortlet.VERSION, m_portlet.getVersion());
|
||||||
|
portletElement.addAttribute(FlashPortlet.WIDTH, m_portlet.getWidth());
|
||||||
|
portletElement.addAttribute(FlashPortlet.XI_REDIRECT_URL, m_portlet.getXiRedirectUrl());
|
||||||
|
|
||||||
|
Map parameters = m_portlet.getParametersMap();
|
||||||
|
if (!parameters.isEmpty())
|
||||||
|
{
|
||||||
|
Element parametersElement = portletElement.newChildElement("portlet:parameters",
|
||||||
|
PortalConstants.PORTLET_XML_NS);
|
||||||
|
for (Iterator i = parameters.keySet().iterator(); i.hasNext();)
|
||||||
|
{
|
||||||
|
String key = (String) i.next();
|
||||||
|
String value = (String) parameters.get(key);
|
||||||
|
Element parameterElement = parametersElement.newChildElement("portlet:parameter",
|
||||||
|
PortalConstants.PORTLET_XML_NS);
|
||||||
|
parameterElement.addAttribute("name", key);
|
||||||
|
parameterElement.addAttribute("value", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map variables = m_portlet.getVariablesMap();
|
||||||
|
if (!variables.isEmpty())
|
||||||
|
{
|
||||||
|
Element variablesElement = portletElement.newChildElement("portlet:variables",
|
||||||
|
PortalConstants.PORTLET_XML_NS);
|
||||||
|
for (Iterator i = variables.keySet().iterator(); i.hasNext();)
|
||||||
|
{
|
||||||
|
String key = (String) i.next();
|
||||||
|
String value = (String) variables.get(key);
|
||||||
|
Element variableElement = variablesElement.newChildElement("portlet:variable",
|
||||||
|
PortalConstants.PORTLET_XML_NS);
|
||||||
|
variableElement.addAttribute("name", key);
|
||||||
|
variableElement.addAttribute("value", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,160 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Pty 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.london.portal.ui.portlet;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.TooManyListenersException;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||||
|
import com.arsdigita.cms.TemplateContext;
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.kernel.ResourceType;
|
||||||
|
import com.arsdigita.london.navigation.Navigation;
|
||||||
|
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
|
||||||
|
import com.arsdigita.london.portal.ui.PortletConfigFormSection;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.portal.Portlet;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Editor for a {@link NavigationDirectoryPortlet}.
|
||||||
|
*
|
||||||
|
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||||
|
*/
|
||||||
|
public class NavigationDirectoryPortletEditor extends PortletConfigFormSection
|
||||||
|
{
|
||||||
|
private static final Logger s_log = Logger.getLogger(NavigationDirectoryPortletEditor.class);
|
||||||
|
|
||||||
|
private SingleSelect m_root;
|
||||||
|
|
||||||
|
private SingleSelect m_depth;
|
||||||
|
|
||||||
|
public NavigationDirectoryPortletEditor(ResourceType resType, RequestLocal parentAppRL)
|
||||||
|
{
|
||||||
|
super(resType, parentAppRL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NavigationDirectoryPortletEditor(RequestLocal application)
|
||||||
|
{
|
||||||
|
super(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addWidgets()
|
||||||
|
{
|
||||||
|
super.addWidgets();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_root = new SingleSelect(new BigDecimalParameter("navigation"));
|
||||||
|
m_root.addPrintListener(new CategoryPrintListener());
|
||||||
|
}
|
||||||
|
catch (TooManyListenersException ex)
|
||||||
|
{
|
||||||
|
throw new UncheckedWrapperException("this cannot happen", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_depth = new SingleSelect(new IntegerParameter("depth"));
|
||||||
|
m_depth.addOption(new Option("1", "1 Level"));
|
||||||
|
m_depth.addOption(new Option("2", "2 Levels"));
|
||||||
|
|
||||||
|
add(new Label("Navigation:", Label.BOLD), ColumnPanel.RIGHT);
|
||||||
|
add(m_root);
|
||||||
|
|
||||||
|
add(new Label("Depth:", Label.BOLD), ColumnPanel.RIGHT);
|
||||||
|
add(m_depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initWidgets(PageState state, Portlet portlet) throws FormProcessException
|
||||||
|
{
|
||||||
|
super.initWidgets(state, portlet);
|
||||||
|
|
||||||
|
if (portlet != null)
|
||||||
|
{
|
||||||
|
NavigationDirectoryPortlet myportlet = (NavigationDirectoryPortlet) portlet;
|
||||||
|
|
||||||
|
m_root.setValue(state, myportlet.getNavigation().getID());
|
||||||
|
m_depth.setValue(state, new Integer(myportlet.getDepth()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processWidgets(PageState state, Portlet portlet) throws FormProcessException
|
||||||
|
{
|
||||||
|
super.processWidgets(state, portlet);
|
||||||
|
|
||||||
|
NavigationDirectoryPortlet myportlet = (NavigationDirectoryPortlet) portlet;
|
||||||
|
myportlet.setDepth(((Integer) m_depth.getValue(state)).intValue());
|
||||||
|
|
||||||
|
BigDecimal id = (BigDecimal) m_root.getValue(state);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Navigation root = (Navigation) DomainObjectFactory.newInstance(new OID(Navigation.BASE_DATA_OBJECT_TYPE, id));
|
||||||
|
myportlet.setNavigation(root);
|
||||||
|
}
|
||||||
|
catch (DataObjectNotFoundException ex)
|
||||||
|
{
|
||||||
|
throw new UncheckedWrapperException("cannot find category", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getUseContext()
|
||||||
|
{
|
||||||
|
TemplateContext ctx = Navigation.getContext().getTemplateContext();
|
||||||
|
String context = (ctx == null ? null : ctx.getContext());
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CategoryPrintListener implements PrintListener
|
||||||
|
{
|
||||||
|
public void prepare(PrintEvent e)
|
||||||
|
{
|
||||||
|
SingleSelect target = (SingleSelect) e.getTarget();
|
||||||
|
|
||||||
|
DomainCollection navigations = new DomainCollection(SessionManager.getSession().retrieve(
|
||||||
|
Navigation.BASE_DATA_OBJECT_TYPE));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while (navigations.next())
|
||||||
|
{
|
||||||
|
Navigation navigation = (Navigation) navigations.getDomainObject();
|
||||||
|
target.addOption(new Option(navigation.getID().toString(), navigation.getPath()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
navigations.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,175 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Pty 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.london.portal.ui.portlet;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||||
|
import com.arsdigita.categorization.Category;
|
||||||
|
import com.arsdigita.categorization.CategoryCollection;
|
||||||
|
import com.arsdigita.cms.TemplateContext;
|
||||||
|
import com.arsdigita.london.navigation.Navigation;
|
||||||
|
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
|
||||||
|
import com.arsdigita.london.portal.ui.PortalConstants;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.web.ParameterMap;
|
||||||
|
import com.arsdigita.web.URL;
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a {@link NavigationDirectoryPortlet}.
|
||||||
|
*
|
||||||
|
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||||
|
*/
|
||||||
|
public class NavigationDirectoryPortletRenderer extends AbstractPortletRenderer
|
||||||
|
{
|
||||||
|
private final NavigationDirectoryPortlet m_portlet;
|
||||||
|
|
||||||
|
public NavigationDirectoryPortletRenderer(NavigationDirectoryPortlet portlet)
|
||||||
|
{
|
||||||
|
m_portlet = portlet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateBodyXML(PageState state, Element parent)
|
||||||
|
{
|
||||||
|
Element element = parent.newChildElement("portlet:contentDirectory", PortalConstants.PORTLET_XML_NS);
|
||||||
|
element.addAttribute("id", getIdAttr());
|
||||||
|
|
||||||
|
TemplateContext ctx = Navigation.getContext().getTemplateContext();
|
||||||
|
String context = (ctx == null ? null : ctx.getContext());
|
||||||
|
Category root = Category.getRootForObject(m_portlet.getNavigation(), context);
|
||||||
|
if (root == null)
|
||||||
|
{
|
||||||
|
root = Category.getRootForObject(m_portlet.getNavigation());
|
||||||
|
}
|
||||||
|
if (!root.isEnabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CategoryCollection cats = root.getDescendants();
|
||||||
|
cats.addEqualsFilter("parents.link.relationType", "child");
|
||||||
|
cats.addPath("parents.link.sortKey");
|
||||||
|
cats.addPath("parents.id");
|
||||||
|
cats.addOrder("parents.link.sortKey");
|
||||||
|
|
||||||
|
Map children = new HashMap();
|
||||||
|
while (cats.next())
|
||||||
|
{
|
||||||
|
Category cat = cats.getCategory();
|
||||||
|
BigDecimal parentID = (BigDecimal) cats.get("parents.id");
|
||||||
|
|
||||||
|
TreeSet childList = (TreeSet) children.get(parentID);
|
||||||
|
if (childList == null)
|
||||||
|
{
|
||||||
|
childList = new TreeSet();
|
||||||
|
children.put(parentID, childList);
|
||||||
|
}
|
||||||
|
|
||||||
|
childList.add(new CategorySortKeyPair(cat, (BigDecimal) cats.get("parents.link.sortKey")));
|
||||||
|
}
|
||||||
|
|
||||||
|
processChildren(element, root, children, 1, m_portlet.getDepth());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processChildren(Element parent, Category cat, Map children, int depth, int maxDepth)
|
||||||
|
{
|
||||||
|
if (depth <= maxDepth)
|
||||||
|
{
|
||||||
|
TreeSet c = (TreeSet) children.get(cat.getID());
|
||||||
|
if (c != null)
|
||||||
|
{
|
||||||
|
Iterator i = c.iterator();
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
CategorySortKeyPair pair = (CategorySortKeyPair) i.next();
|
||||||
|
Category child = pair.getCategory();
|
||||||
|
BigDecimal childSortKey = pair.getSortKey();
|
||||||
|
if (child.isEnabled())
|
||||||
|
{
|
||||||
|
Element el = generateCategory(child, depth, childSortKey);
|
||||||
|
parent.addContent(el);
|
||||||
|
|
||||||
|
processChildren(el, child, children, depth + 1, maxDepth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Element generateCategory(Category cat, int depth, BigDecimal childSortKey)
|
||||||
|
{
|
||||||
|
Element el = new Element(depth == 1 ? "portlet:contentDirectoryEntry" : "portlet:contentDirectorySubentry",
|
||||||
|
PortalConstants.PORTLET_XML_NS);
|
||||||
|
|
||||||
|
el.addAttribute("id", XML.format(cat.getID()));
|
||||||
|
el.addAttribute("name", cat.getName());
|
||||||
|
el.addAttribute("description", cat.getDescription());
|
||||||
|
el.addAttribute("isAbstract", cat.isAbstract() ? "1" : "0");
|
||||||
|
el.addAttribute("url", redirectURL(cat.getOID()));
|
||||||
|
el.addAttribute("sortKey", XML.format(childSortKey));
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String redirectURL(OID oid)
|
||||||
|
{
|
||||||
|
ParameterMap map = new ParameterMap();
|
||||||
|
map.setParameter("oid", oid.toString());
|
||||||
|
|
||||||
|
URL here = Web.getContext().getRequestURL();
|
||||||
|
|
||||||
|
return (new URL(here.getScheme(), here.getServerName(), here.getServerPort(), "", "", "/redirect/", map)).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CategorySortKeyPair implements Comparable
|
||||||
|
{
|
||||||
|
private Category m_category;
|
||||||
|
|
||||||
|
private BigDecimal m_sortKey;
|
||||||
|
|
||||||
|
public CategorySortKeyPair(Category category, BigDecimal sortKey)
|
||||||
|
{
|
||||||
|
m_category = category;
|
||||||
|
m_sortKey = sortKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Category getCategory()
|
||||||
|
{
|
||||||
|
return m_category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSortKey()
|
||||||
|
{
|
||||||
|
return m_sortKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int compareTo(Object o)
|
||||||
|
{
|
||||||
|
return m_sortKey.compareTo(((CategorySortKeyPair) o).m_sortKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Permeance Technologies Ptd 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.london.portal.upgrade;
|
||||||
|
|
||||||
|
import org.apache.commons.cli.CommandLine;
|
||||||
|
|
||||||
|
import com.arsdigita.london.portal.portlet.FlashPortlet;
|
||||||
|
import com.arsdigita.london.portal.portlet.FlashPortletInitializer;
|
||||||
|
import com.arsdigita.london.util.Transaction;
|
||||||
|
import com.arsdigita.packaging.Program;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the {@link FlashPortlet}.
|
||||||
|
*
|
||||||
|
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||||
|
* @see FlashPortletInitializer#loadPortletType()
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final class CreateFlashPortlet extends Program
|
||||||
|
{
|
||||||
|
private static final String PROGRAM_NAME = CreateFlashPortlet.class.getName().substring(
|
||||||
|
CreateFlashPortlet.class.getName().lastIndexOf('.') + 1);
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
new CreateFlashPortlet().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doRun(CommandLine cmdLine)
|
||||||
|
{
|
||||||
|
new Transaction()
|
||||||
|
{
|
||||||
|
protected void doRun()
|
||||||
|
{
|
||||||
|
FlashPortletInitializer.loadPortletType();
|
||||||
|
}
|
||||||
|
}.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
private CreateFlashPortlet()
|
||||||
|
{
|
||||||
|
super(PROGRAM_NAME, "1.0.0", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.arsdigita.london.portal.upgrade;
|
||||||
|
|
||||||
|
import org.apache.commons.cli.CommandLine;
|
||||||
|
|
||||||
|
import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet;
|
||||||
|
import com.arsdigita.london.util.Transaction;
|
||||||
|
import com.arsdigita.packaging.Program;
|
||||||
|
|
||||||
|
public class CreateNavigationDirectoryPortlet extends Program
|
||||||
|
{
|
||||||
|
private static final String PROGRAM_NAME = CreateNavigationDirectoryPortlet.class.getName().substring(
|
||||||
|
CreateNavigationDirectoryPortlet.class.getName().lastIndexOf('.') + 1);
|
||||||
|
|
||||||
|
public CreateNavigationDirectoryPortlet()
|
||||||
|
{
|
||||||
|
super(PROGRAM_NAME, "1.0.0", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
new CreateNavigationDirectoryPortlet().run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doRun(CommandLine cmdLine)
|
||||||
|
{
|
||||||
|
new Transaction()
|
||||||
|
{
|
||||||
|
protected void doRun()
|
||||||
|
{
|
||||||
|
NavigationDirectoryPortlet.loadPortletType();
|
||||||
|
}
|
||||||
|
}.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<!-- saved from url=(0014)about:internet -->
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>SWFObject embed by Geoff Stearns (express install) @ deconcept</title>
|
||||||
|
<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->
|
||||||
|
<script type="text/javascript" src="swfobject.js"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
font: .8em/1.3em verdana,arial,helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#info {
|
||||||
|
width: 300px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#flashcontent {
|
||||||
|
border: solid 1px #000;
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
float: left;
|
||||||
|
margin: 15px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="flashcontent">
|
||||||
|
<strong>You need to upgrade your Flash Player</strong>
|
||||||
|
This is replaced by the Flash content.
|
||||||
|
Place your alternate content here and users without the Flash plugin or with
|
||||||
|
Javascript turned off will see this. Content here allows you to leave out <code>noscript</code>
|
||||||
|
tags. Include a link to <a href="expressinstall.html?detectflash=false">bypass the detection</a> if you wish.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// <![CDATA[
|
||||||
|
|
||||||
|
var so = new SWFObject("so_tester.swf", "sotester", "300", "300", "9", "#FF6600");
|
||||||
|
so.addVariable("flashVarText", "this is passed in via FlashVars"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
|
||||||
|
so.useExpressInstall('expressinstall.swf');
|
||||||
|
so.write("flashcontent");
|
||||||
|
|
||||||
|
// ]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="info">
|
||||||
|
<p>
|
||||||
|
This Flash movie was embedded using the <a href="http://blog.deconcept.com/swfobject/">SWFObject</a> embed method by <a href="http://blog.deconcept.com/">Geoff Stearns</a>.
|
||||||
|
</p>
|
||||||
|
<p>Other sample embeds:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="swfobject.html">Basic Flash Embed with alternate content</a></li>
|
||||||
|
<li><a href="fullpage.html">Full page Flash embed</a></li>
|
||||||
|
<li>Basic Flash Embed with Express Install allowed</li>
|
||||||
|
</ul>
|
||||||
|
<p>You can also <a href="flashversion.html">view your installed Flash version</a>.</p>
|
||||||
|
<p>
|
||||||
|
<a href="view-source:http://blog.deconcept.com/swfobject/expressinstall.html">View source</a> (in mozilla, firefox) | <a href="swfobject_source.js">View Javascript</a>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="http://blog.deconcept.com/swfobject/swfobject1-4.zip">Download Source</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p style="clear: both;margin-left: 20px"><a href="http://validator.w3.org/check?uri=referer">Validate XHTML</a> and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,46 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<!-- saved from url=(0014)about:internet -->
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>SWFObject embed by Geoff Stearns (show player version) @ deconcept</title>
|
||||||
|
<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->
|
||||||
|
<script type="text/javascript" src="swfobject.js"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
font: .8em/1em verdana,arial,helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#info {
|
||||||
|
width: 600px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="flashversion">
|
||||||
|
You do not have the Flash plugin installed, or your browser does not support Javascript (you should enable it, perhaps?)
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
// <![CDATA[
|
||||||
|
|
||||||
|
var version = deconcept.SWFObjectUtil.getPlayerVersion();
|
||||||
|
if (document.getElementById && version["major"] > 0) {
|
||||||
|
document.getElementById('flashversion').innerHTML = "You have Flash player "+ version['major'] +"."+ version['minor'] +"."+ version['rev'] +" installed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="info">
|
||||||
|
<p>
|
||||||
|
This page displays your current Flash player version using Javascript.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<!-- saved from url=(0014)about:internet -->
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>SWFObject embed by Geoff Stearns (full page) @ deconcept</title>
|
||||||
|
<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/ -->
|
||||||
|
<script type="text/javascript" src="swfobject.js"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
/* hide from ie on mac \*/
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#flashcontent {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
/* end hide */
|
||||||
|
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #f60;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="flashcontent">
|
||||||
|
<strong>You need to upgrade your Flash Player</strong>
|
||||||
|
This is replaced by the Flash content.
|
||||||
|
Place your alternate content here and users without the Flash plugin or with
|
||||||
|
Javascript turned off will see this. Content here allows you to leave out <code>noscript</code>
|
||||||
|
tags. Include a link to <a href="fullpage.html?detectflash=false">bypass the detection</a> if you wish.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// <![CDATA[
|
||||||
|
|
||||||
|
var so = new SWFObject("so_tester.swf", "sotester", "100%", "100%", "8", "#FF6600");
|
||||||
|
so.addVariable("flashVarText", "this is passed in via FlashVars for example only");
|
||||||
|
so.addParam("scale", "noscale");
|
||||||
|
so.write("flashcontent");
|
||||||
|
|
||||||
|
// ]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
SWFObject Readme
|
||||||
|
http://blog.deconcept.com/swfobject/
|
||||||
|
|
||||||
|
v1.5
|
||||||
|
|
||||||
|
SWFObject is a small Javascript file used for embedding Macromedia Flash content. The script can detect the Flash plug-in in all major web browsers (on Mac and PC) and is designed to make embedding Flash movies as easy as possible. It is also very search engine friendly, degrades gracefully, can be used in valid HTML and XHTML 1.0 documents, and is forward compatible, so it should work for years to come.
|
||||||
|
|
||||||
|
* SWFObject is the Flash embed script formerly known as FlashObject. The name was changed after a request from Adobe
|
||||||
|
for legal / trademark reasons.
|
||||||
|
|
||||||
|
Created: 10-14-2004
|
||||||
|
Last Updated: 02-28-2007
|
||||||
|
|
||||||
|
By: Geoff Stearns
|
||||||
|
geoff@deconcept.com
|
||||||
|
http://blog.deconcept.com/
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2007 Geoff Stearns
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Files:
|
||||||
|
|
||||||
|
readme.txt - this file
|
||||||
|
|
||||||
|
swfobject.js - SWFObject javascript file - this will need to be included in any html
|
||||||
|
file that uses the SWFObject embed. This file is compressed with dojo
|
||||||
|
shrinksafe (http://alex.dojotoolkit.org/shrinksafe/) to save bandwidth. To view the uncompressed version, look at
|
||||||
|
source/swfobject_source.js
|
||||||
|
|
||||||
|
swfobject.html - sample html file showing how to use the SWFObject embed
|
||||||
|
|
||||||
|
expressinstall.html - sample html file showing how to use SWFObject with the ExpressInstall feature
|
||||||
|
|
||||||
|
fullpage.html - sample html file showing a full page (100% by 100% flash embed)
|
||||||
|
|
||||||
|
flashversion.html - sample page showing how to use SWFObject to determine the installed player version
|
||||||
|
|
||||||
|
so_tester.swf - sample swf used to test basic SWFObject functionality
|
||||||
|
|
||||||
|
expressinstall.swf - swf used to invoke the Express Install feature for users that have Flash Player 6.0.65 or higher already installed
|
||||||
|
|
||||||
|
source/so_tester.fla - sample fla for SWFObject testing. Open this to see how to use the ExpressInstall
|
||||||
|
features
|
||||||
|
|
||||||
|
source/swfobject_source.as - uncompressed swfobject.js file - only provided for viewing, you should use
|
||||||
|
the production version (swfobject.js) on your website
|
||||||
|
|
||||||
|
|
||||||
|
These files are provided 'as is,' with no technical support provided, but if you
|
||||||
|
find a problem, please e-mail me at geoff@deconcept.com or send an e-mail to the SWFObject mailing list
|
||||||
|
(http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com) so I can update/correct the problem and
|
||||||
|
provide an updated version.
|
||||||
|
|
||||||
|
|
||||||
|
----------
|
||||||
|
Changelog:
|
||||||
|
|
||||||
|
03-05-2007 (v1.5)
|
||||||
|
[fixed] updated expressinstall.swf to fix a scaling issue after the update was finished.
|
||||||
|
|
||||||
|
02-28-2007 (v1.5)
|
||||||
|
[changed] Express Install functionality was updated to support projects that use AS3 (or Flex 2 projects). This means new syntax when using Express Install (see expressinstall.html for an example)
|
||||||
|
[fixed/changed] adjusted cleanup code to only call cleanUpSWFs() if the user is using IE and has Flash Player 8 or higher (because the streaming audio + out of memory error only affects these systems)
|
||||||
|
[fixed/changed] adjusted cleanup code to only be called once - this fixes issues people had when accidentally including the js file more than once
|
||||||
|
[changed] added support for IE Mobile devices with Flash Player installed
|
||||||
|
[changed] added support for style attributes on the object/embed tags - mainly for compatibility with swfIR (http://www.swfir.com)
|
||||||
|
|
||||||
|
8-2-206 (v1.4.4)
|
||||||
|
[fixed] The v1.4.3 introduced a new issue: When clicking links with href="javascript:..." it would cause all the swf files on the page to disappear (it was triggering the cleanUpSWFs function prematurely). This is now fixed, and all users should upgrade immediately to v1.4.4.
|
||||||
|
|
||||||
|
7-25-2006 (v1.4.3)
|
||||||
|
[updated] added in a fix for a bug introduced in Flash Player 9 that would cause an error in IE "Line 56: Out of memory". This was caused by new code inserted by Flash Player 9, and SWFObject 'fixes' this by removing the 'bad' code that fp9 inserts and replacing it with code that does not cause the 'Out of memory' error.
|
||||||
|
|
||||||
|
6-2-2006 (v1.4.2)
|
||||||
|
[updated] added one more fix for a related issue to the audio streaming bug listed below, thanks to Ben Longoria for the fix
|
||||||
|
[updated] updated the detection code for IE/ActiveX browsers to fix a crash that could occur when the user had Flash Player 6.0.21 or 6.0.23 installed (Thanks to Michael Williams at Adobe for the code to fix this (and the Adobe detection kit))
|
||||||
|
[fixed] updated the getQueryParamValue method to fix a bug that would return the wrong value if you had two variables that ended with the same string (Thanks to Aran Rhee for discovering the issue and providing a fix)
|
||||||
|
[fixed] fixed a couple of strict js warnings that crept back in sometime after the 1.4 update
|
||||||
|
|
||||||
|
5-17-2006 (v1.4.1)
|
||||||
|
[updated] added code to 'clean up' Flash Player instances on window unload because of a bug when using innerHTML and streaming media.
|
||||||
|
|
||||||
|
4-21-2006 (v1.4)
|
||||||
|
[changed] FlashObject is now known as SWFObject because of legal reasons. For more info, read:
|
||||||
|
http://blog.deconcept.com/2006/04/21/flashobject-to-become-swfobject/
|
||||||
|
Note that using the code 'new FlashObject()' will still work because I've added a link from FlashObject to deconcept.SWFObject, but you should update your code to reflect the new name as soon as possible to avoid future complications
|
||||||
|
[updated] SWFObject.write() now returns true or false depending on whether the SWF content was written to the page or not (true if it is, false if it is not)
|
||||||
|
[changed] the 'com' namespace has been removed, now everything lives in the 'deconcept' namespace only, instead of 'com.deconcept' namespace.
|
||||||
|
[updated] made a couple very small changes to get rid of warnings in the mozilla script debugger when the debugger was in strict mode
|
||||||
|
[updated] added 'the mark of the web' to the examples pages to (hopefully) prevent the ActiveX bar from appearing at the top of the page when viewing these files locally in IE on Windows.
|
||||||
|
|
||||||
|
3-26-06
|
||||||
|
[fixed] bug found in the location.hash handling in the getQueryParamValue() call. Changed document.location.href.hash to document.location.hash.
|
||||||
|
|
||||||
|
2-14-06
|
||||||
|
[fixed] bug found in the custom ExpressInstall message. When publishing the fla as a Flash 8 swf, the upgrade message would not show up. This is due to the way the Flash 7 player displays text and outlines (among other things). To avoid issues with custom upgrade messages, you should use device fonts, and either remove outlines from objects, or set them to 'hairline'. There may be other issues to avoid, so if you have issues with items not showing up in older Flash player versions, try simplifying the objects.
|
||||||
|
|
||||||
|
2-09-2006
|
||||||
|
[fixed] bug in the getHTML method - the closing <object> tag wasn't being appended unless you passed in at least 1 flashvar, and fixed some closing slashes on the param tags.
|
||||||
|
|
||||||
|
1-25-2006
|
||||||
|
[fixed] Found a small bug in this latest version that caused the Flash movie to not load on IE 5.01 on PC. The bug has been fixed and the zip/source has been updated. Please update to the latest version if you are using 1.3 and have a lot of users using IE 5.01 (does anyone have a high number of those anymore?). The new version number is 1.3b.
|
||||||
|
|
||||||
|
1-18-2006
|
||||||
|
[fixed] Bug that would keep users with Flash Player 6 installed from using ExpressInstall
|
||||||
|
|
||||||
|
1-12-2006
|
||||||
|
[Changed] When calling FlashObject.write() you can now pass an HTMLElement reference. Previously you needed to pass a string (the Id of the element to write the Flash content to)
|
||||||
|
[Changed] Made changes to the plugin detection routine that would cause a crash in browsers running certain versions of the Flash plugin. Read a comprehensive description of the issue and the fix.
|
||||||
|
[New] You may now specify a specific URL to redirect the user to after they complete an ExpressInstall process. Previously the script would always redirect them to the page the Flash movie was embedded in, but when using a popup window this is not always the best solution. See the ExpressInstall section of the FlashObject page for more information.
|
||||||
|
[New] FlashObject now integrates seamlessly with the Javascript Integration Kit. More information on this is forthcoming in a new blog post.
|
||||||
|
[New] I’ve used Dojo Shrinksafe to strip out the extra space in the swfobject.js file. FlashObject now weighs in at just a hair over 6kb. Super tiny! The FlashObject ’source code’ (un-shunken Javascript) is included in the FlashObject zip file in the ’source’ folder. I also made a number of small syntax changes to reduce the size even more.
|
||||||
|
|
||||||
|
8-1-2005
|
||||||
|
-fixed bug in detection that caused redirection to fail and threw an error if no flash player was installed
|
||||||
|
-updated IE detection code - no more VBscript at all, and no more loop to check the version installed.
|
||||||
|
|
||||||
|
7-22-2005
|
||||||
|
-added minor version and revision detection
|
||||||
|
-fixed a few small bugs (one would have caused SWFObject to fail once a user tries to detect a flash player version larger than 9)
|
||||||
|
-rewrote so it's all in it's own namespace (Thanks to Toby Boudreaux for the excellent code tips http://www.tobyjoe.com/)
|
||||||
|
- *** note that FlashObject.write() now requires an element ID - it will no longer work with no id specified
|
||||||
|
- *** please note that there is no more bypass text or altTxt variables, you should place your alternate content in a div, and then have FlashObject write to that div, thereby replacing the alternate content.
|
||||||
|
|
||||||
|
5-17-2005
|
||||||
|
[changed] the 'id' attribute on the embed tag to 'name' instead. This
|
||||||
|
change enables the use of features that require liveconnect or other javascript
|
||||||
|
communication in browsers that use the embed tag. (later changed so the embed tag has both id and name)
|
||||||
|
|
||||||
|
3-31-2005
|
||||||
|
v1.1 update, multiple changes, mostly some code optimization and some
|
||||||
|
changes in how the script displays alt content. see:
|
||||||
|
http://blog.deconcept.com/2005/03/31/proper-flash-embedding-flashobject-best-practices/
|
||||||
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
* expressinstall.as v2.0 - http://blog.deconcept.com/swfobject/
|
||||||
|
*
|
||||||
|
* SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
|
||||||
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
|
*
|
||||||
|
* NOTE: Your Flash movie must be at least 214px by 137px in order to use ExpressInstall.
|
||||||
|
* Please see http://blog.deconcept.com/swfobject/ for other notes.
|
||||||
|
*
|
||||||
|
* This swf needs to be AS2 because it needs to run in Flash Player 6.0.65
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class com.deconcept.expressinstall.ExpressInstall {
|
||||||
|
|
||||||
|
private static var instance:ExpressInstall;
|
||||||
|
private var updater:MovieClip;
|
||||||
|
private var hold:MovieClip;
|
||||||
|
|
||||||
|
function ExpressInstall() {}
|
||||||
|
|
||||||
|
public static function getInstance():ExpressInstall {
|
||||||
|
if (instance == undefined) {
|
||||||
|
instance = new ExpressInstall();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadUpdater():Void {
|
||||||
|
System.security.allowDomain("fpdownload.macromedia.com");
|
||||||
|
|
||||||
|
var _self = this;
|
||||||
|
|
||||||
|
// hope that nothing is at a depth of 10000007, you can change this depth if needed, but you want
|
||||||
|
// it to be on top of your content if you have any stuff on the first frame
|
||||||
|
updater = _root.createEmptyMovieClip("deconcept_expressInstallHolder", 10000007);
|
||||||
|
|
||||||
|
// register the callback so we know if they cancel or there is an error
|
||||||
|
updater.installStatus = _self.onInstallStatus;
|
||||||
|
hold = updater.createEmptyMovieClip("hold", 1);
|
||||||
|
|
||||||
|
// can't use movieClipLoader because it has to work in 6.0.65
|
||||||
|
updater.onEnterFrame = function():Void {
|
||||||
|
if (typeof hold.startUpdate == 'function') {
|
||||||
|
_self.initUpdater();
|
||||||
|
this.onEnterFrame = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var cacheBuster:Number = Math.random();
|
||||||
|
hold.loadMovie("http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?"+ cacheBuster);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function initUpdater():Void {
|
||||||
|
hold.redirectURL = _root.MMredirectURL;
|
||||||
|
hold.MMplayerType = _root.MMplayerType;
|
||||||
|
hold.MMdoctitle = _root.MMdoctitle;
|
||||||
|
hold.startUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function onInstallStatus(msg):Void {
|
||||||
|
if (msg == "Download.Complete") {
|
||||||
|
// Installation is complete. In most cases the browser window that this SWF
|
||||||
|
// is hosted in will be closed by the installer or manually by the end user
|
||||||
|
|
||||||
|
} else if (msg == "Download.Cancelled") {
|
||||||
|
// The end user chose "NO" when prompted to install the new player
|
||||||
|
// by default no User Interface is presented in this case. It is left up to
|
||||||
|
// the developer to provide an alternate experience in this case
|
||||||
|
|
||||||
|
// feel free to change this to whatever you want, js errors are sufficient for this example
|
||||||
|
getURL("javascript:alert('This content requires a more recent version of the Adobe Flash Player.')");
|
||||||
|
} else if (msg == "Download.Failed") {
|
||||||
|
// The end user failed to download the installer due to a network failure
|
||||||
|
// by default no User Interface is presented in this case. It is left up to
|
||||||
|
// the developer to provide an alternate experience in this case
|
||||||
|
|
||||||
|
// feel free to change this to whatever you want, js errors are sufficient for this example
|
||||||
|
getURL("javascript:alert('There was an error downloading the Flash Player update. Please try again later, or visit adobe.com/go/getflashplayer/ to download the latest version of the Flash plugin.')");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,233 @@
|
||||||
|
/**
|
||||||
|
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
|
||||||
|
*
|
||||||
|
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
|
||||||
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if(typeof deconcept == "undefined") var deconcept = new Object();
|
||||||
|
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
|
||||||
|
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
|
||||||
|
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
|
||||||
|
if (!document.getElementById) { return; }
|
||||||
|
this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
|
||||||
|
this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
|
||||||
|
this.params = new Object();
|
||||||
|
this.variables = new Object();
|
||||||
|
this.attributes = new Array();
|
||||||
|
if(swf) { this.setAttribute('swf', swf); }
|
||||||
|
if(id) { this.setAttribute('id', id); }
|
||||||
|
if(w) { this.setAttribute('width', w); }
|
||||||
|
if(h) { this.setAttribute('height', h); }
|
||||||
|
if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
|
||||||
|
this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
|
||||||
|
if (!window.opera && document.all && this.installedVer.major > 7) {
|
||||||
|
// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
|
||||||
|
deconcept.SWFObject.doPrepUnload = true;
|
||||||
|
}
|
||||||
|
if(c) { this.addParam('bgcolor', c); }
|
||||||
|
var q = quality ? quality : 'high';
|
||||||
|
this.addParam('quality', q);
|
||||||
|
this.setAttribute('useExpressInstall', false);
|
||||||
|
this.setAttribute('doExpressInstall', false);
|
||||||
|
var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
|
||||||
|
this.setAttribute('xiRedirectUrl', xir);
|
||||||
|
this.setAttribute('redirectUrl', '');
|
||||||
|
if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
|
||||||
|
}
|
||||||
|
deconcept.SWFObject.prototype = {
|
||||||
|
useExpressInstall: function(path) {
|
||||||
|
this.xiSWFPath = !path ? "expressinstall.swf" : path;
|
||||||
|
this.setAttribute('useExpressInstall', true);
|
||||||
|
},
|
||||||
|
setAttribute: function(name, value){
|
||||||
|
this.attributes[name] = value;
|
||||||
|
},
|
||||||
|
getAttribute: function(name){
|
||||||
|
return this.attributes[name];
|
||||||
|
},
|
||||||
|
addParam: function(name, value){
|
||||||
|
this.params[name] = value;
|
||||||
|
},
|
||||||
|
getParams: function(){
|
||||||
|
return this.params;
|
||||||
|
},
|
||||||
|
addVariable: function(name, value){
|
||||||
|
this.variables[name] = value;
|
||||||
|
},
|
||||||
|
getVariable: function(name){
|
||||||
|
return this.variables[name];
|
||||||
|
},
|
||||||
|
getVariables: function(){
|
||||||
|
return this.variables;
|
||||||
|
},
|
||||||
|
getVariablePairs: function(){
|
||||||
|
var variablePairs = new Array();
|
||||||
|
var key;
|
||||||
|
var variables = this.getVariables();
|
||||||
|
for(key in variables){
|
||||||
|
variablePairs[variablePairs.length] = key +"="+ variables[key];
|
||||||
|
}
|
||||||
|
return variablePairs;
|
||||||
|
},
|
||||||
|
getSWFHTML: function() {
|
||||||
|
var swfNode = "";
|
||||||
|
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
|
||||||
|
if (this.getAttribute("doExpressInstall")) {
|
||||||
|
this.addVariable("MMplayerType", "PlugIn");
|
||||||
|
this.setAttribute('swf', this.xiSWFPath);
|
||||||
|
}
|
||||||
|
swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
|
||||||
|
swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
|
||||||
|
var params = this.getParams();
|
||||||
|
for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
|
||||||
|
var pairs = this.getVariablePairs().join("&");
|
||||||
|
if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
|
||||||
|
swfNode += '/>';
|
||||||
|
} else { // PC IE
|
||||||
|
if (this.getAttribute("doExpressInstall")) {
|
||||||
|
this.addVariable("MMplayerType", "ActiveX");
|
||||||
|
this.setAttribute('swf', this.xiSWFPath);
|
||||||
|
}
|
||||||
|
swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
|
||||||
|
swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
|
||||||
|
var params = this.getParams();
|
||||||
|
for(var key in params) {
|
||||||
|
swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
|
||||||
|
}
|
||||||
|
var pairs = this.getVariablePairs().join("&");
|
||||||
|
if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
|
||||||
|
swfNode += "</object>";
|
||||||
|
}
|
||||||
|
return swfNode;
|
||||||
|
},
|
||||||
|
write: function(elementId){
|
||||||
|
if(this.getAttribute('useExpressInstall')) {
|
||||||
|
// check to see if we need to do an express install
|
||||||
|
var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
|
||||||
|
if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
|
||||||
|
this.setAttribute('doExpressInstall', true);
|
||||||
|
this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
|
||||||
|
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
|
||||||
|
this.addVariable("MMdoctitle", document.title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
|
||||||
|
var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
|
||||||
|
n.innerHTML = this.getSWFHTML();
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
if(this.getAttribute('redirectUrl') != "") {
|
||||||
|
document.location.replace(this.getAttribute('redirectUrl'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- detection functions ---- */
|
||||||
|
deconcept.SWFObjectUtil.getPlayerVersion = function(){
|
||||||
|
var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
|
||||||
|
if(navigator.plugins && navigator.mimeTypes.length){
|
||||||
|
var x = navigator.plugins["Shockwave Flash"];
|
||||||
|
if(x && x.description) {
|
||||||
|
PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
|
||||||
|
}
|
||||||
|
}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
|
||||||
|
var axo = 1;
|
||||||
|
var counter = 3;
|
||||||
|
while(axo) {
|
||||||
|
try {
|
||||||
|
counter++;
|
||||||
|
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
|
||||||
|
// document.write("player v: "+ counter);
|
||||||
|
PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
|
||||||
|
} catch (e) {
|
||||||
|
axo = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // Win IE (non mobile)
|
||||||
|
// do minor version lookup in IE, but avoid fp6 crashing issues
|
||||||
|
// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
|
||||||
|
try{
|
||||||
|
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
|
||||||
|
}catch(e){
|
||||||
|
try {
|
||||||
|
var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
||||||
|
PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
|
||||||
|
axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
|
||||||
|
} catch(e) {
|
||||||
|
if (PlayerVersion.major == 6) {
|
||||||
|
return PlayerVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
if (axo != null) {
|
||||||
|
PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PlayerVersion;
|
||||||
|
}
|
||||||
|
deconcept.PlayerVersion = function(arrVersion){
|
||||||
|
this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
|
||||||
|
this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
|
||||||
|
this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
|
||||||
|
}
|
||||||
|
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
|
||||||
|
if(this.major < fv.major) return false;
|
||||||
|
if(this.major > fv.major) return true;
|
||||||
|
if(this.minor < fv.minor) return false;
|
||||||
|
if(this.minor > fv.minor) return true;
|
||||||
|
if(this.rev < fv.rev) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/* ---- get value of query string param ---- */
|
||||||
|
deconcept.util = {
|
||||||
|
getRequestParameter: function(param) {
|
||||||
|
var q = document.location.search || document.location.hash;
|
||||||
|
if (param == null) { return q; }
|
||||||
|
if(q) {
|
||||||
|
var pairs = q.substring(1).split("&");
|
||||||
|
for (var i=0; i < pairs.length; i++) {
|
||||||
|
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
|
||||||
|
return pairs[i].substring((pairs[i].indexOf("=")+1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* fix for video streaming bug */
|
||||||
|
deconcept.SWFObjectUtil.cleanupSWFs = function() {
|
||||||
|
var objects = document.getElementsByTagName("OBJECT");
|
||||||
|
for (var i = objects.length - 1; i >= 0; i--) {
|
||||||
|
objects[i].style.display = 'none';
|
||||||
|
for (var x in objects[i]) {
|
||||||
|
if (typeof objects[i][x] == 'function') {
|
||||||
|
objects[i][x] = function(){};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
|
||||||
|
if (deconcept.SWFObject.doPrepUnload) {
|
||||||
|
if (!deconcept.unloadSet) {
|
||||||
|
deconcept.SWFObjectUtil.prepUnload = function() {
|
||||||
|
__flash_unloadHandler = function(){};
|
||||||
|
__flash_savedUnloadHandler = function(){};
|
||||||
|
window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
|
||||||
|
}
|
||||||
|
window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
|
||||||
|
deconcept.unloadSet = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* add document.getElementById if needed (mobile IE < 5) */
|
||||||
|
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
|
||||||
|
|
||||||
|
/* add some aliases for ease of use/backwards compatibility */
|
||||||
|
var getQueryParamValue = deconcept.util.getRequestParameter;
|
||||||
|
var FlashObject = deconcept.SWFObject; // for legacy support
|
||||||
|
var SWFObject = deconcept.SWFObject;
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<!-- saved from url=(0014)about:internet -->
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>SWFObject embed by Geoff Stearns (basic) @ deconcept</title>
|
||||||
|
<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->
|
||||||
|
<script type="text/javascript" src="swfobject.js"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
font: .8em/1.3em verdana,arial,helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#info {
|
||||||
|
width: 300px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#flashcontent {
|
||||||
|
border: solid 1px #000;
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
float: left;
|
||||||
|
margin: 15px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="flashcontent">
|
||||||
|
<strong>You need to upgrade your Flash Player</strong>
|
||||||
|
This is replaced by the Flash content.
|
||||||
|
Place your alternate content here and users without the Flash plugin or with
|
||||||
|
Javascript turned off will see this. Content here allows you to leave out <code>noscript</code>
|
||||||
|
tags. Include a link to <a href="swfobject.html?detectflash=false">bypass the detection</a> if you wish.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// <![CDATA[
|
||||||
|
|
||||||
|
var so = new SWFObject("so_tester.swf", "sotester", "300", "300", "9", "#FF6600");
|
||||||
|
so.addVariable("flashVarText", "this is passed in via FlashVars for example only"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
|
||||||
|
so.write("flashcontent");
|
||||||
|
|
||||||
|
// ]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="info">
|
||||||
|
<p>
|
||||||
|
This Flash movie was embedded using the <a href="http://blog.deconcept.com/swfobject/">SWFObject</a> embed method by <a href="http://blog.deconcept.com/">Geoff Stearns</a>.
|
||||||
|
</p>
|
||||||
|
<p>Other sample embeds:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Basic Flash Embed with alternate content</li>
|
||||||
|
<li><a href="fullpage.html">Full page Flash embed</a></li>
|
||||||
|
<li><a href="expressinstall.html">Basic Flash Embed with Express Install allowed</a></li>
|
||||||
|
</ul>
|
||||||
|
<p>You can also <a href="flashversion.html">view your installed Flash version</a>.</p>
|
||||||
|
<p>
|
||||||
|
<a href="view-source:http://blog.deconcept.com/swfobject/swfobject.html">View source</a> (in mozilla, firefox) | <a href="swfobject_source.js">View Javascript</a>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="http://blog.deconcept.com/swfobject/swfobject1-4.zip">Download Source</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p style="clear: both;margin-left: 20px"><a href="http://validator.w3.org/check?uri=referer">Validate XHTML</a> and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2008 Permeance Technologies Pty 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
|
||||||
|
-->
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:portlet="http://www.uk.arsdigita.com/portlet/1.0" version="1.0" exclude-result-prefixes="portlet">
|
||||||
|
|
||||||
|
<xsl:template match="portlet:flash">
|
||||||
|
<xsl:variable name="playerId">player_<xsl:value-of select="generate-id(.)"/></xsl:variable>
|
||||||
|
<div>
|
||||||
|
<xsl:attribute name="id"><xsl:value-of select="$playerId"/></xsl:attribute>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var var_<xsl:value-of select="$playerId"/> = new SWFObject("<xsl:value-of select="@swfFile"/>", "<xsl:value-of select="$playerId"/>", "<xsl:value-of select="@width"/>", "<xsl:value-of select="@height"/>", "<xsl:value-of select="@version"/>", "<xsl:value-of select="@backgroundColour"/>", "<xsl:value-of select="@quality"/>", "<xsl:value-of select="@xiRedirectUrl"/>", "<xsl:value-of select="@redirectUrl"/>", "<xsl:value-of select="@detectKey"/>");
|
||||||
|
<xsl:for-each select="portlet:parameters/portlet:parameter">
|
||||||
|
var_<xsl:value-of select="$playerId"/>.addParam("<xsl:value-of select="@name"/>","<xsl:value-of select="@value"/>");
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:for-each select="portlet:variables/portlet:variable">
|
||||||
|
var_<xsl:value-of select="$playerId"/>.addVariable("<xsl:value-of select="@name"/>","<xsl:value-of select="@value"/>");
|
||||||
|
</xsl:for-each>
|
||||||
|
var_<xsl:value-of select="$playerId"/>.write('<xsl:value-of select="$playerId"/>');
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
<xsl:import href="application-directory-portlet.xsl"/>
|
<xsl:import href="application-directory-portlet.xsl"/>
|
||||||
<xsl:import href="workspace-directory-portlet.xsl"/>
|
<xsl:import href="workspace-directory-portlet.xsl"/>
|
||||||
<xsl:import href="content-directory-portlet.xsl"/>
|
<xsl:import href="content-directory-portlet.xsl"/>
|
||||||
|
<xsl:import href="flash-portlet.xsl"/>
|
||||||
<xsl:import href="../../../../ccm-forum/packages/forum/xsl/recent-postings-portlet.xsl"/>
|
<xsl:import href="../../../../ccm-forum/packages/forum/xsl/recent-postings-portlet.xsl"/>
|
||||||
<xsl:import href="/__ccm__/servlet/portlet-type/index.xsl"/>
|
<xsl:import href="/__ccm__/servlet/portlet-type/index.xsl"/>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue