Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would like to add in the web part catalog for the whole farm a specialized version of the content editor web part.

Actually, I want to allow all site managers to drop a content editor that contains a custom script.

I know I could create a custom web part, but it requires a lot of stuff that the oob content editor web part could handle.

share|improve this question

2 Answers 2

How about this:

  • Create your CEWP (saved as .dwp)
  • Edit it as you like
  • Export the web part
  • Create a SharePoint Project in VS
  • Create a Module
  • Add the dwp file

Module (CustomCEWP):

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="CustomCEWP" List="113" Url="_catalogs/wp">
        <File Path="CustomCEWP\CustomCEWP.dwp" Url="CustomCEWP.dwp" Type="GhostableInLibrary">
            <Property Name="Group" Value="My Web Parts" />
        </File>
    </Module>
</Elements>

CustomCEWP.dwp:

<?xml version="1.0" encoding="utf-8"?>
  <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
  <Title>Custom Content Editor</Title>
  <FrameType>Default</FrameType>
  <IsIncluded>true</IsIncluded>  
  <FrameState>Normal</FrameState>
  <AllowRemove>true</AllowRemove>
  <AllowZoneChange>true</AllowZoneChange>
  <AllowMinimize>true</AllowMinimize>
  <AllowConnect>true</AllowConnect>
  <AllowEdit>true</AllowEdit>
  <AllowHide>true</AllowHide>
  <IsVisible>true</IsVisible>
  <HelpMode>Modeless</HelpMode>
  <Dir>Default</Dir>
  <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
  <PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge>
  <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,  PublicKeyToken=71e9bce111e9429c</Assembly>
  <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
  <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
  <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[​​  <script>console.log('oh, hai');</script>​]]></Content>
  <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
</WebPart>
share|improve this answer
    
Sorry, this will not work for whole farm. But you can create a solution with it a Feature and a Module. Let me update... –  eirikb Sep 18 '12 at 14:54
    
I've created a VS project that deploy my dwp. But I hoped there were a simpler solution. –  Steve B Sep 18 '12 at 14:57
    
I updated the answer at least, maybe someone else can benefit from it. –  eirikb Sep 18 '12 at 15:05
    
You could of course be very sneaky and copy/paste a feature directory directly into the <Hive>\TEMPLATE\FEATURES folder. That way you could at least edit your dwp file without having to build it all the time (or compress into wsp manually). If SPSite is close enough you could also upload directly to Web Part Gallery ( /_catalogs/wp/Forms/AllItems.aspx ) –  eirikb Sep 18 '12 at 15:09
    
I ended up by creating a custom wsp file with this simple module. This is working, but a bit disappointing . –  Steve B Sep 18 '12 at 15:22

Was just looking into this. While it's not farm-wide and will only work at the site collection level (which is all I needed it for), it still may be useful for others that come across this thread.

http://sharepointknowledgebase.blogspot.com.au/2010/09/sp2010-exporting-and-importing-web.html

share|improve this answer
1  
Sadly doesn't work cross language –  fr34kyn01535 Nov 6 '12 at 9:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.