2011-12-07 2 views

답변

2

원본을 수정하지 않을 경우, 여기 주입 ApplicationBase를 사용하여 일부 jQuery를 사용하지 않도록 설정하는 다운 & 더러운 방법 다음 doctypealias에

public class RemoveToolbarButtons : ApplicationBase 
{ 
    public RemoveToolbarButtons() 
    { 
     umbracoPage.Load += new umbraco.presentation.masterpages.MasterPageLoadHandler(umbracoPage_Load); 
    } 

    void umbracoPage_Load(object sender, EventArgs e) 
    { 
     var page = (umbracoPage)sender; 

     if (page.Page.Request.Path.ToLower().Replace((GlobalSettings.Path + "/").ToLower(), "").Contains("editcontent.aspx")) 
     { 
      var currentDocId = Convert.ToInt32(HttpContext.Current.Request.QueryString["id"]); 
      Document d = new Document(currentDocId); 
      if (d.ContentType.Alias == "YourDocTypeAlias") 
      { 
       string s = @"<script type='text/javascript'> 
       $(document).ready(function() { 
        $('.editorIcon').each(function() { if(String($(this).attr('alt')) == 'Save and publish') {$(this).hide(); return false;} }); 
       }); 
       </script>"; 
       page.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "jshidetoolbar", s); 
      } 

     } 

    } 
} 

변경 YourDocTypeAlias가 어디 그것을 해제하고 싶습니다. jQuery를 사용하여 버튼을 숨길 수 있음을 유의하십시오. 사용자는 컨텍스트 메뉴 또는 다른 방법을 통해 [게시]에 계속 액세스 할 수 있습니다.

0

Umbraco의 전체 소스 코드는 오픈 소스 프로젝트로 제공되므로 저장 및 게시를 비활성화하고 원하는 작업을 수행 할 수 있습니다.

Link

1

톰의 접근 방식에 마이너 팅겨 -

string s = @"<script type='text/javascript'> 
       $(document).ready(function() { 
        $('.editorIcon').each(function() { if(String($(this).attr('alt')) == 'Save and publish') {$(this).hide(); } }); 
       }); 
       </script>"; 
(그렇지 않으면 첫 번째는 '저장하고 게시'여러 탭이 버튼을 숨 깁니다) false를 반환하지 않도록 jQuery를 조정