I have a sharepoint solution package with a Custom UserControl inside. When I deploy the .wsp the user control is placed in the CONTROLTEMPLATES directory. Is there any way to "delay" this step until feature is activated?
In other words what I would like my custom user control to be available only after the feature is activated.
As far as I know this is not possible. On deploy all the needed files are copied to the correct location. It is actually feature independant, because you don't even need a feature to deploy files. You will see that a feature is automatically created when you for ex. add a webpart to your solution. Not when you add a mapped folder.
What are you trying to achieve with delaying the usercontrol? What you can do is check in your usercontrol if a certain feature is active and adapt the rendering of your usercontrol accordingly. Ex. Show message that the feature should be activated before using the control.
Related
I want to make an workflow that has other statuses than the Single Approver workflow, other than "Update", "Approved" etc. Is it possible?
What I have found on Internet is how to create custom portlets and I am not sure I have to go so far. I understand that these statuses are constants from the WorkflowConstants.java file and that it is possible to extend that file in order to add my own constants. But where should I place that file? What other changes do I have to make to make it work?
Thank you.
Liferay has offered different approaches to extend and customize liferay portal depending on the nature and complexity of changes required.
Following are the possible ways:
1. via Extension (ext) environment
2. via Plugins
i. Portlet
ii. Hook
Using extension environment, you can simply move that file from portal source to the relevant package of ext and introduce changes.
Lets say, WorkflowConstants.java resides at location
\portal-service\src\com\liferay\portal\kernel\workflow\WorkflowConstants.java in portal, so you can copy that file to \ext-service\src\com\liferay\portal\kernel\workflow\WorkflowConstants.java.
Make required changes in ext-service file and deploy ext. One restarting container changes will reflect.
I am trying to get a solution for my issue. I have a set of HTML CSS and Images, which I want to apply to my sharepoint portal as a part of branding.
My concern is I want to make my design as WSP or any other kind of solution so that it can be installed in any sharepoint 2010 portal so that the user can switch back between actual sharepoint design and this custom design.
In short I have a custom HTML design which I need to implement to any sharepoint website, this design can be turned On or Off by the administrator just using the portal/Site screens.
Thanks in advance
SharePoint branding is always a tricky job. The safest way to achieve your goal is to create a separate masterpage with your new branding. So the user can choose to apply the default branding with the default masterpage and when he wants another branding your customized masterpage can be used.
Create a new SharePoint project and add the needed css inside a mapped layouts folder. Then you can reference your own css file in the new masterpage. Watch out with changing the masterpage, because it contains a lot of placeholders which will render different parts of the page. Try to work around these placeholders and make sure the masterpage works in different scenario's (ex. that the layout isn't broken when page is in edit mode, ...)
Once you are finished with the design, the user can use it by applying it in the settings. Another option to make it easier for the enduser, is to create a control that is a switch to apply your masterpage (ex. with custom action).
I'm working on a SharePoint 2010 project. We have a usercontrol to include all of our custom javascript. I popped an alert in there whilst debugging something else, and lo and behold the alert was called twice. I checked and the file in question is included by only one Elements.xml file in one feature. So how can this be? I've tried searching the whole solution, and I only get one hit, so I must be missing something.
EDIT:
This is the code calling the User Control:
<Control Id="AdditionalPageHead" Sequence="10" ControlSrc="/_controltemplates/company/UCLoadJS.ascx" />
This code is found in the Elements.xml of the MasterPages folder, which deploys our custom master page.
Having searched the whole project for UCLoadJS, I cannot find another instance.
I think you have hidden WPs loading these Controls.
Try creating a new page and add the Visual WP once and try again
I know that this question is 9 years old but I just had the same problem, so in case someone stumble across this thread, maybe this will help you:
try to list all your delegate controls. you can slightly modify the script provided by Waldek Mastykarz : Checking which Delegate Controls are activated on your site
if you find duplicated controls (and that was the situation in my case) then its probably because you deployed your control using one feature scope (Site for example) and then redeployed with another one (Web). Follow the steps below to solve the problem:
1). switch to another feature scope (the one you no longer want to use)
2). deploy the feature
3). deactivate it
4). switch feature scope to the required one and redeploy it
Source: SharePoint delegate control is rendered twice
I need to transfer a reusable Workflow from the stage env. to the prod.
The workflow is associate to a list, so the list id is stored in the workflow.
Is it possible to transfer the workflow and change the list id to the list name with Visual Studio? (We have no SharePoint Designer access to the prod. env.)
Short answer: No
I tried several hours to fix a reusable workflow, which same as yours was associated with a specific list - I switched systems and the GUID changed --> Workflow was broken.
You can give it a try and rename the MyWorkflow.wsp to MyWorkflow.cab and extract that somewhere. The workflow files are XML based hence you can edit the associated list GUID with your favorite editor. Now you need to package your edited file back into a cab file, rename it to wsp and you can give it a shot. I tried exactly that and resented to just "re-clicking" (as it's SPD) my workflow (two screens come in handy here).
That's what I call "reusable" workflow... Next time do not associate your reusable workflow with anything to keep it reusable.
I would recommend creating an Content Type in a Feature and then base your list and your Reusable Workflow association on that Content Type. We had a project in December where we successfully used this method. I saved a Reusable Workflow as a template. I then deployed the Content Type solution package and the Workflow solution package to another environment. Worked like a charm.
There are tow alternatives for deploying workflow regardless the assigned content types
It is very simple just do the following:
Alternative One
Save the workflow as template
Go to the following path in your site
http://your_server_Address/SiteAssets/Forms/AllItems.aspx
Download the file as WSP
Go to the following URL
http://your_Target_server_Address/_catalogs/solutions/Forms/AllItems.aspx
Upload the WSP, and activate the solution
Go to the site settings, then Site Actions, then Manage site features
Activate the feature that is related to the workflow
If you click workflows under site administration you would be able to see your custom reusable workflow
Alternative Two
Save the workflow as template
Go to the following path in your site
http://your_server_Address/SiteAssets/Forms/AllItems.aspx
Download the file as WSP
Open your visual studio
Click add new project
Under SharePoint choose 2010
Choose Import reusable work flow
Follow the wizard
Project will be created and can be deployed
Note : Make sure your workflow is reusable and that it has no errors
I want to create a custom new item page for sharepoint but there are two approached that I
can use and I want to share your experience in determining which is better.
The first: is to create a page in a library then create a C# library project to handle
the events of the controls on the page.
The second: is to define a feature of the content type of my list and specify the new
item form to be my custom form, then create a website containing the custom form and put
this site at the layouts folder.
for me the first approach is fine but the problem is that a user may access the default
sharepoint new item form which I don't want to happen.
but I don't like the idea of placing the form in a library on the site.
so which is better in your opinion ?
thanks
i suggest you to go with your second approach ...
Create a completely new feature that allows you add your functionalty of page creation and any customization realted to that and deploy this one to the 12 hive features folder as a new feature and every time you want have such a page created you can you this template and create the page...
Well, frankly, I'm confused by both of your suggestions.
I don't see how the first one would ever work.
And the second one; you don't "put sites in the layouts folder".
Here's what I would suggest you to do:
Download and install the WSS Extensions for Visual Studio.
Create a List Definition using these new templates.
Copy the NewForm.aspx from the 12 hive and Customize it.
Download and install the WSP Builder from Codeplex.com
Add your custom list definitions and files to a new Feature project in WSP Builder.
Package the Feature up to a .wsp using WSP Builder and you are good to go.
Your custom page(s) should be placed in your custom folders in my opinion.
Hope this helps.
Your concern in the first approach is that people will still be able to access the default form. If you are not opposed to using a custom control template for a content type definition, I recommend creating a very simple redirect control template and assigning it to the content type's "New Form". Such a control template need only contain one custom control, which has an OnInit or OnLoad method that contains little more than a Page.Response.Redirect call. Make that redirect point to the page you create in your first approach, and now whenever anyone tries to access the default new form for that content type, they will instead be directed to your custom page with all of your custom code. It is perhaps a bit of a hack, but it's definitely functional.