пятница, 2 октября 2009 г.

Create context menu item in SharePoint List


1. Wrote Custom Action such as



<CustomAction Id="EditContentTypeColumns"
RegistrationType="ContentType"
RegistrationId="0x010100B652F1B8BDCE44e8AB6560178C412708"
Location="EditControlBlock"
ImageUrl="/_layouts/images/edititem.gif"
Sequence="303"
Title="$Resources:SPPublicDemoTemplates,editContentType">
<UrlAction Url="~site/_layouts/TemplateManagement/EditContentType.aspx?ListId={ListId}&amp;ItemId={ItemId}&amp;Source={SourceUrl}&amp;SiteUrl={SiteUrl}"/>
</CustomAction>

2. Type ContentTypeId that's item has this custom action.


3. EditContentType.aspx - my page in sharepoint


4. Code of Edit ContentType



using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace Voodoo.SPPublicDemo.Templates
{
public class EditContentType : LayoutsPageBase
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
using(SPSite site = new SPSite(Request.Params["SiteUrl"]))
{
SPWeb web = site.OpenWeb();
SPList list = web.Lists[new Guid(Request.Params["ListId"])];
SPListItem item = list.GetItemById(Convert.ToInt32(Request.Params["ItemId"]));
SPContentType type = site.RootWeb.ContentTypes[item.ContentType.Name];
Response.Redirect(String.Format("{0}/_layouts/ManageContentType.aspx?ctype={1}",
site.RootWeb.Url, type.Id.ToString()));
}
}
}
}

Remove new action in SharePoint Toolbar List.


Hi, everybody.

Not for a long time I wrote very simple demo for customers thats interesing in sharepoint port customization.

I encountered with problem: "How to remove new button in sharepoint toolbar in the certain list".

And I found decision.

1. Create in the 12/template/controltemplates file TemplateManagementToolbar.ascx












2. In schema.xml of your list definitions find




ToolbarTemplate is Id of our custom template toobar.

3. iisreset.

And it works!

Thanks.

вторник, 15 сентября 2009 г.

Hi. Metro. Its the best place dns thinking. If We have just needed some time to write post we always do it. All people have very busy and drug faces after the work and me too. I want to sleep. I think about dream sleep and anywhere i want to sleep.
Hi. Everyone. Now i am sitting in the very boring lecture about cryptosystems. Please take my head because my brain has just blow up itself:)

суббота, 29 августа 2009 г.

Rails Code Snippets



Hi,

In my rails application I usually copy some usefull scripts from my previous project.
May be it's very interesting for you.

def stylesheet(*args)
content_for(:header) { stylesheet_link_tag(*args.map(&:to_s)) }
end

def javascript(*args)
args = args.map { |arg| arg == :defaults ? arg : arg.to_s }
content_for(:header) { javascript_include_tag(*args) }
end

def script(&block)
content = capture(&block)
concat("", block.binding)
end

def content_for_script(place = :header, &block)
content = capture(&block)
content_for place do
script(&block)
end
end

def google_analytics(code)
%(
script type='text/javascript'
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
var pageTracker = _gat._getTracker("#{code}");
pageTracker._trackPageview();
} catch(err){}
/script

)
end


class String
def self.random_alphanumeric(size=64)
s = ""
size.times { s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
s
end
end



See you.

пятница, 28 августа 2009 г.

sudo with default path

Not for a long time I have some troubles with running commands by sudo in Ubuntu.
I found decision and it's very simple:

# you have to add this line to ~/.bashrc

alias sudo='sudo env PATH=$PATH'

# And now it's gonna be alright.

See you.

четверг, 27 августа 2009 г.

Nginx https configuration

Now I am working in one project that was written by another developer. And in production server my website weas only working via https. It was very strange because I was searching in nginx configuration any lines such as:


location ~* ^/(orders|offers)/ {
rewrite ^/(.*)$ https://testname.com/$1 redirect;
}


but nothing to find. As you can see this sources it's only simple rewrite rule for nginx configuration. After 3 hours in my rails application I didn't find anything codes connecting with https. I read nginx docs and found one funny line that was previous developer used in nginx.conf:

proxy_set_header X-FORWARDED_PROTO https;

That's all.

вторник, 25 августа 2009 г.

Freelance Life

Not far a long time I have just started to work via internet in my free time. But It's very difficult and reading my one post doesn't make sense for understanding me.
My first work was started about 0.75 year and it's great but I didn't give money.
(http://aksent.heroku.com/). Still I was trying to sell this website for one company.