Change the Category for Web Part to be displayed - sharepoint-2010

In Sharepoint 2010, is there any way to change the category where custom web parts created in VS2010 to be placed.
VS2010 is putting the custom web part in "Custom" category by default. I'm curious that, is there any way for us to change it, for example "MyCustomWebParts" category.
incase I couldn't made myself clear:

You can change file Elements.xml. Into File tag add line:
<Property Name="Group" Value="MyCustomWebPart" />
or
Select “Site Actions” >> “Site Settings” >> “Modify All Site Settings”.
Click the “Web Parts” link in the Galleries group.
Open your webpart for edit.
In the Group section, check the “Specify your own value” option and type in a group name (e.g. MyCustomWebParts)

There is! In the .webpart file, under the Module/File path, add a tag like this:
<Property Name="Group" Value="My Custom Group"/>
That's all there is to it!

Related

Odoo11 - Restrict user assignment to project team members

I downloaded the .exe file of the community edition of odoo 11, installed it on a windows server and configured rules, that projects can only be seen by users who are assigned to the project as team members.
That works fine!
Now, in a task I want to restrict the options in the "assigned to" dropdown of a task: In the dropdown I want to see only users, who are actually assigned to that project. At the moment I can see all existing users and can assign the task to any of them.
In the form view I tried to restrict the list as follows by adding the domain attribute:
<field name="user_id" class="o_task_user_field" domain="('user_id','in', [project.members])" />
This gives an error on save.
Field 'project' used in attributes must be present in view but is missing
Update: 2. approach:
I tried to update the field user_id in model project.task and set the domain as follows:
('project_id.members','in', [user.id])
But I got the error (translated from german): you cannot make changes in a basic field!
How can I limit the options in the dropdown (without making code changes as I don´t have the code forked from github)?
Any help appreciated!
Thanks
For this you just need to update one onchange and in that add domain. No need to add it from xml. There is by default onchange_projectmethod is there. In that you just inherit it and add one line..
result.update({'domain':{'user_id':[('project_ids','in',project_id)]}})

DNN - What control to use for images in custom module settings?

I am creating modules using the template created by Chris Hammond (TYVM Chris).
My modules have a few things that can be edited by the user in the settings area, one of them being an image.
I can use a TextBox and have the user type the root relative path to the image, but it is a little clunky because the user has to upload the image in the file management area of the website, get the path, then add it to the module settings. It would be a lot smoother if I could have a Image selector that would tie into the DNN files and allow the user to select an image that has been previously uploaded to DNN or add their own.
How would one accomplish this?
I suggest you to use the FilePickerUploader control of DNN.
You could see what it looks like in the Portal Settings (in Admin menu). It's used for the selection of the logo file, background image and favicon.
For example, it could be use like this:
<%# Register TagPrefix="dnn" TagName="FilePickerUploader" Src="~/controls/filepickeruploader.ascx" %>
<dnn:FilePickerUploader ID="ctlFavIcon" runat="server" Required="True" FileFilter="ico" />
Required and FileFilter attributes are optionnal and I think it provides other options.
Just use a DNNEditor webcontrol
<%# Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>
<dnn:DnnEditor ToolsFile="xmfile.xml"/>
Via this control you can use the default image selector. In first place you will see a lot of selectors in the toolbar, but you can change this via a xml file and add that xml file to the property ToolsFile
Just let me know if you need more help.

SharePoint 2010 Site Customization: Removed breadcrumb and now receiving errors

I removed the following fields from the "s4-titletext" cell using the Manage Content Regions in SPD:
PlaceHolderSiteName
PlaceHolderPageTitleInTitleArea
PlaceHolderPageDescription
And I added "SharePoint:SPLinkButton... Visible="False"
I have published this template and have set it as the Default Master. It displays fine but when I add a web part (not in SPD), I get the error "You must specify a value for this required field" and it will not let me add/remove the web part or change any list. What did I do wrong in my customization? I followed the instructions on this post. I used Option 2 to hide the words. The reason I removed the fields is because I want to stretch our banner across the whole page and I didn't want to leave the space where the bread crumb would have been. My "s4-titletext" area looks like the pictures on the top of the page, only banner is stretched all across the top of page. I can not add a link to my page due to it being on a private server. I have asked other SharePoint experts and they are stumped as well. Thank you for your help on this.
Instead of setting visible="false", getting hiding the control using a CSS class. Set the control's class to something like 'hiddenClass' and then define your class style.
.hiddenClass{display: none;}
Customizing SharePoint masterpages is a pain since they're so sensitive. You have to use this method when hiding a lot of the out of the box controls.
Some placeholders need to be on the master page, if you remove it it will cause errors in some of the scrips.
What I recommend to you is create a hidden div and inside of it put all the placeholder you want to hide, like the example bellow.
<div style="display:none">
<asp:ContentPlaceHolder ID="TitleZone" runat="server"></asp:ContentPlaceHolder>
<div>

Using Visibility (Default) attribute in MVCSitemap to show nodes only in breadcrumbs

Anyone who has achieved a single xml file but different menu and breadcrumbs with MVCSiteMapProvider package.
I have MVC.Sitemap all working well with my menu and breadcrumbs. I have added a new node for Home - Products
This is Index Action on Products Controller
I dont want this to appear in my menu but I do want it to appear in my Breadcrumbs when someone lands on /myapp/Products/Index or Products/Index
At the moment I am using visibility="SiteMapPathHelper,!*" picked up from the example and I am assuming the latest nuget package and my web.config is setup with
attributesToIgnore="visibility"
which is confusing as i dont understand that does this mean to ignore the parameters or does it tell that nodes that need to be ignored are filled with this parameter and value should be taken as condition.
By default, any attribute MvcSiteMapProvider sees in your menu XML declaration is added to the url parameter.
So, if you have this:
<mvcSiteMapNode area="Admin" controller="User" action="Index" title="Users" someRandomAttribute=3/>
the sitemap will use
/admin/user/index?someRandomAttribute=3 for the url.
If you put attributesToIgnore="someRandomAttribute" in the config, the url it will generate will become:
/admin/user/index
The visibility provider is a plug-in system - and the default one uses a 'visibility' attribute so it can decide if the node is visible or not.

Create Folders in Library when submitting a list form in SharePoint 2010

I would like to know if it's possible to create folders when submitting a form in SharePoint. I created a custom SharePoint list form in Infopath and I want to add an action to the submit button to create four folders, one for each of the four doc libraries, that contains the title of the submitted item.
I see however that the custom code button is not enabled for a SharePoint list in Infopath so I cannot add any code in the background. The workflows that come out of the box also does not allow me to do it, unless I'm missing something...What other way is there to do it?
Thanks in advance for any help!!
Yes you can do this, however, it's quite tricky.
In theory, you could call the "UpdateListItems" method of the Lists.asmx web service and pass a batch statement but due the implementation of the Lists web service you cannot use it in InfoPath. That's why you need to write your own web service that wraps the UpdateListItems method so you can use it with IP.
If you do not know how to write a web service (and host it within SharePoint) please use the search function of StackOverflow or consider google - many great tutorials out there ;-)
Once you got the web service running, you need to add a service reference to the http://myserver/_vti_bin/Lists.asmx web service and then create the following method:
[WebMethod]
public void UpdateListItems(string listGuid, string xmlBatch)
{
var batch = new XmlDocument();
batch.LoadXml(xmlBatch);
//create an instance of the lists proxy client
var listSvc = listService = new ListsWebService.Lists();
//set the url of the client
listService.Url = "http://myserver/_vti_bin/Lists.asmx";
listSvc.UpdateListItems(listGuid, batch);
}
Note that if you configure the listSvc's Url hardcoded (like in this example), you need to make sure that the List, you want to add the folders to, is within the same site as the Url. If you want to make it this method more generic (which i'd suggest you do), you could simply pass the SiteCollection Url as a parameter and set listSvc.Url to SiteCollectionUrl + "_vti_bin/Lists.asmx".
Once this is set up, you can create the data connection to your newly created web service in InfoPath and configure it like this:
The field "listName" is actually the GUID of the List - you can get it via the UI by clicking "Library Settings" - "Information management policy settings" and then copy it from the address bar in your browser. Example:
{39d01277-4ba1-4589-90f8-c957b4b2dd09}
The field "XML" contains the batch script to create the folder. You can declare it staticly, or in your case, you can build it dynamically using the concat() function. This example creates a folder named "MyFolder" in the root of the Library.
<Batch>
<Method ID='1' Cmd='New'>
<Field Name='ID'>New</Field>
<Field Name='FSObjType'>1</Field>
<Field Name='BaseName'>MyFolder</Field>
</Method>
</Batch>
If you need to have sub-folders, this is possible too. This following example will create a folder named "MySubFolder" within the folder "MyFolder".
<Batch>
<Method ID='1' Cmd='New'>
<Field Name='ID'>New</Field>
<Field Name='FSObjType'>1</Field>
<Field Name='BaseName'>MyFolder/MySubFolder</Field>
</Method>
</Batch>
Then you simply add a submit button action and you're done :-)
Also note that the code above is just an example (which works though). If you use it in production be sure to add proper exception logging because you'll be needing it :-)
hope this helps!