how to hide overwrite existing file in rteUploadDialog.aspx in sharepoitn 2010 - sharepoint-2010

I want to uncheck and hide the overwriteexisting file in sharepoint 2010 iam opening the addnew item of a list in a popup as shown below .
where to add the jquery to hide this elements.

Without customzing Upload.aspx page, we can uncheck the checkbox and modify the contents of "Overwrite existing file" for a specific library using below steps:
1) Create a js file and refer it in master page.
2) Note down the GUID of library.
3) Add the below code.
$(document).ready(function () {
if (location.href.indexOf('2C63AAA5-BC95-41E4-A199-B7658F44736B') >= 0)
{
$('#ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle').prop('checked', false);
$("label[for='ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_OverwriteSingle']").text("My Custom");
}
});

Related

VSCode - Open multiple files from tree view and quick open

How to select and open multiple files from tree view (File Explorer) and Quick open in Visual Studio Code? I'm looking for something by which I can shift-up/down or shift-mouseclick to select multiple files and open them on clicking enter.
Is there a setting or extension to enable this?
v1.20 (Feb., 2018) adds some of this functionality. You can now multi-select files https://code.visualstudio.com/updates/v1_20#_multi-select-in-the-explorer and open them in a new editor group to the side and other group functions in the context menu.
In v1.47 you can open file after file from the explorer without losing focus on the explorer with a new command:
{
"key": "alt+u", // whatever keybinding you wish
"command": "list.selectAndPreserveFocus",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
// "when": "inFilesPicker && inQuickOpen" // doesn't work in quickOpen
// but rightArrow does work in the quickOpen panel
},

TinyMCE remove item from context menu

Can any one please let me know how we can remove items from a TinyMCE ContextMenu. I.e., normal Cut, Copy, Paste items?
I've seen several references to add items to the context menu shown inside the editor, but not for removing the same.
Please help :)-
When you initiate TinyMCE, you can explicitly state which buttons to include:
tinyMCE.init({
...
theme_advanced_buttons1 : "bold,italic,underline",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : ""
});
(example taken from the docs)
Edit
Sorry, the question is about the Context Menu (a.k.a the right-click menu).
Have you tried this plugin which lets you do this?:
tinymce.init({
plugins: "contextmenu",
contextmenu: "link image inserttable | cell row column deletetable"
});

How to open dialog or popup when clicking on a cell in Dojo Dgrid

I want to open a dialog box when clicking on a cell.I am using dgrid/editor.
editor({field: "column1",label: "col1",editor: "text",editOn: "click"})
I am getting text box when using the above code.I want a dialog box.Please tell me how to get a dialog box.I am using OndemandGrid with JSONReststore to display the grid.
You don't need use editor to trigger a dialog, use click event on a cell is ok:
var grid = new declare([OnDemandGrid,Keyboard, Selection])({
store: Observable(new Memory({data: []}))
}, yourGridConatiner);
grid.on(".dgrid-content .dgrid-cell:click", function (evt) {
var cell = grid.cell(evt);
var data = cell.row.data;
/* your dialog creation at here, for example like below */
var dlg = new Dialog({
title: "Dialog",
className:"dialogclass",
content: dlgDiv //you need create this div using dojo.create or put-selector
});
dlg.show();
});
If you want show a pointer while mouse over that cell, you can style it at renderCell method with "cursor:pointer"
From the wiki:
editor - The type of component to use for editors in this column; either a string specifying a type of standard HTML input to create, or a Dijit widget constructor to instantiate.
You could provide (to editor) a button that pops up a dialog when clicked, but that would probably mean two clicks to edit a cell: one to focus or enter edit mode or otherwise get the button to appear and one to actually click the button.
You could also not bother with the editor plugin and attach a click event handler to the cell and pop up a dialog from there. You would have to manually save the changes back to your store if you went that route.
If I understand you right - you could try something like this:
function cellFormatter1(value) {
//output html-code to open your popup - ie. using value (of cell)
}
......
{field: "column1",label: "col1", formatter: cellFormatter1 }

Dynamic menu button items in TinyMCE

I have a custom menubutton in my tinyMCE editor that uses specific HTML elements elsewhere on the page as the menu items. I use a jQuery selector to get the list of elements and then add one each as a menu item:
c.onRenderMenu.add(function(c,m) {
m.add({ title: 'Pick One:', 'class': 'mceMenuItemTitle' }).setDisabled(1);
$('span[data-menuitem]').each(function() {
var val = $(this).html();
m.add({
title: $(this).attr("data-menuitem"),
onclick: function () { tinyMCE.activeEditor.execCommand('mceInsertContent', false, val) }
});
});
});
My problem is that this only happens once when the button is first clicked and the menu is first rendered. The HTML elements on the current page will change occasionally based on user clicks and some AJAX, so I need this selector code to run each time the menu is rendered to make sure the menu is fully up-to-date. Is that possible?
Failing that, is it possible to dynamically update the control from the end of my AJAX call elsewhere in the page? I'm not sure how to access the menu item and to update it. Something using tinyMCE.activeEditor.controlManager...?
Thanks!
I found a solution to this problem, though I'm not sure it's the best path.
It doesn't look like I can make tinyMCE re-render the menu, so instead I've added some code at the end of my AJAX call: after it has updated the DOM then it manually updates the tinymce drop menu.
The menu object is accessible using:
tinyMCE.activeEditor.controlManager.get('editor_mybutton_menu')
where mybutton is the name of my custom control. My quick-and-dirty solution is to call removeAll() on this menu object (to remove all the current menu items) and then to re-execute my selector code to find the matching elements in the (new) DOM and to add the menu items back based on the new state.
It seems to work just fine, though tweaks & ideas are always welcome!

Create SharePoint 2010 ribbon button programmatically w/o feature XML

I have to create a SharePoint 2010 ribbon element (tabs, buttons, groups, etc.). Is there a way to create such elements via the SharePoint API without using custom actions?
Edit:
I've just found the possibilty to add elements like this (link):
SPRibbon r = SPRibbon.GetCurrent(Page);
r.RegisterDataExtension(/* XmlNode containing ribbon element code */);
Another workaround would be to append a custom web control and append dynamic controls to this "placeholder".
Is there a way to create elements without using xml nodes?
For layouts pages and webparts, you can create Ribbon without any XML, using Ribbon Utils for SharePoint 2010.
For example, for layouts page, you will need to inherit from RibbonUtils.RibbonLayoutsPage and provide your definition of a ribbon.
Code for the most simple page with custom ribbon tab & one button on it will look like this:
public partial class MyRibbonPage : RibbonLayoutsPage
{
public override TabDefinition GetTabDefinition()
{
return new TabDefinition()
{
Id = "TestRibbon",
Title = "Test",
Groups = new GroupDefinition[]
{
new GroupDefinition()
{
Id = "TestGroup",
Title = "Test group",
Template = GroupTemplateLibrary.SimpleTemplate,
Controls = new ControlDefinition[]
{
new ButtonDefinition()
{
Id = "TestButton",
Title = "Test button",
CommandJavaScript = "alert('test!');",
Image32Url = "/_layouts/images/lg_ICHLP.gif",
}
}
}
}
};
}
}
You will find more examples and very good documentation on the project page on CodePlex.
AFAIK, it is for now most simple and quick way to create ribbon programmatically for application pages & webparts.