<script language="JavaScript">
// Javascript zum Ein- und Ausblenden einiger
// standard Sharepoint-Doklib-Kontenxtmenüeinträge
// und zum Hinzufügen von eigenen Einträgen
// (w) 2005 Stephan Elsner
// Dieses Script benutzt Code aus der ows.js (c) Microsoft
var Item_Properties_View = false; // Eigenschaften ansehen
var Item_Properties_Edit = false; // Eigenschaften bearbeiten
var Item_Edit_External = true; // In Programm bearbeiten
var Item_Delete = false; // Dokument löschen
var Item_Subscribe = false; // Benachrichtigung
var Item_Checkin_Checkout = true; // Ein- /Auschecken
var Item_Moderate = true; // Moderieren
var Item_DownloadImage = true; // Original Bild herunterladen
var Item_Discuss = true; // Diskutieren
function Custom_AddDocLibMenuItems(m, ctx)
{
var RootFolder = GetRootFolder(ctx);
setupMenuContext(ctx);
if (currentItemFileUrl == null)
currentItemFileUrl = itemTable.ServerUrl;
if (currentItemFSObjType == null)
currentItemFSObjType = itemTable.FSObjType;
var currentItemEscapedFileUrl = escapeProperly(
unescapeProperly(currentItemFileUrl));
// ------- Eigenschaften Anzeigen ----------------
if (currentItemFSObjType != 1) {
if (Item_Properties_View ) {
strDisplayText = L_ViewProperties_Text;
strAction = "STSNavigate('" + ctx.displayFormUrl+"?ID="+
currentItemID + "&Source=" +
GetSource() + RootFolder + "')";
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
}
// ------- Eigenschaften Bearbeiten ----------------
if (Item_Properties_Edit ) {
strDisplayText = L_EditProperties_Text;
strAction = "STSNavigate('" + ctx.editFormUrl+"?ID="+
currentItemID + "&Source=" +
GetSource() + RootFolder + "')";
strImagePath = ctx.imagesPath + "edititem.gif";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
// ------- In Programm Bearbeiten ----------------
if ((currentItemFSObjType != 1) && Item_Edit_External)
{
if (ctx.isWebEditorPreview == 0)
{
if (ctx.listTemplate == LISTTEMPLATE_IMAGE_LIBRARY && itemTable.IsImage == "1")
{
strDisplayText = L_EditInOIS_Text;
strAction = "EditSingleImage('" + currentItemID + "')";
strImagePath = ctx.imagesPath + "oisweb.gif";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
else
{
setDocType();
if (currentItemAppName != "" && currentItemOpenControl != "")
{
strDisplayText = StBuildParam(L_EditIn_Text, currentItemAppName);
strAction = "editDocumentWithProgID2('" + currentItemFileUrl + "', '" +
currentItemProgId + "', '" + currentItemOpenControl + "')";
strImagePath = ctx.imagesPath + currentItemIcon;
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
}
}
}
// --------- Dokument löschen ----------------
if (Item_Delete) {
strDisplayText = L_DeleteDocItem_Text;
strAction = "DeleteDocLibItem('" +
ctx.HttpPath + "&Cmd=Delete&List=" + ctx.listName +
"&ID=" + currentItemID + "&owsfileref=" +
currentItemEscapedFileUrl + "&NextUsing=" + GetSource() + "')";
strImagePath = ctx.imagesPath + "delitem.gif";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
// ------------- Moderieren ------------------------
if (ctx.isModerated == true && Item_Moderate )
{
strDisplayText = L_ModerateItem_Text;
strAction = "STSNavigate('" + ctx.editFormUrl+"?ID="+ currentItemID +
"&ChangeApproval=TRUE&Source=" +
GetSource() + RootFolder + "')";
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
// ----- Original-Bild herunterladen (für Bildbibliothek) -------------
if (currentItemFSObjType != 1 && ctx.listTemplate == LISTTEMPLATE_IMAGE_LIBRARY
&& Item_DownloadImage)
{
strAction = "DownloadOriginalImage(" + currentItemID + ")";
strImagePath = ctx.imagesPath + "download.gif";
strDisplayText = L_DownloadOriginal_Text;
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
// ------ Checkin / checkout --------------------
if (currentItemFSObjType != 1 && Item_Checkin_Checkout)
{
CAMSep(m);
AddCheckinCheckoutMenuItem(m, ctx, currentItemEscapedFileUrl);
AddVersionsMenuItem(m, ctx, currentItemEscapedFileUrl);
CAMSep(m);
if (ctx.PortalUrl != null && false)
{
strDisplayText = L_AddToMyLinks_Text;
strAction = "Portal_Tasks('PinToMyPage')"; ;
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
strDisplayText = L_AddToCategory_Text;
strAction = "Portal_Tasks('Categorize')"; ;
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
CAMSep(m);
}
}
// ----------- Benachrichtigen ------------
if (Item_Subscribe) {
strDisplayText = L_Subscribe_Text;
strAction = "NavigateToSubNewAspx('" + ctx.HttpRoot + "',
'List=" + ctx.listName + "&ID=" + currentItemID + "')";
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
// ----------- Diskutieren ----------------
if (currentItemFSObjType != 1 && Item_Discuss)
{
strDisplayText = L_Discuss_Text;
strAction = "STSNavigate('" + ctx.HttpPath + "&Cmd=COMMFRMS&URL=";
if (ctx.isWebEditorPreview == 0)
strAction += currentItemEscapedFileUrl;
strAction += "')";
strImagePath = ctx.imagesPath + "icdisc.gif";
CAMOpt(m, strDisplayText, strAction, strImagePath);
if (ctx.listTemplate != LISTTEMPLATE_IMAGE_LIBRARY)
AddWorkspaceMenuItem(m, ctx);
}
// Beispiel für einen eignen Eintrag im Kontextmenü
AddCustomUrlEntry("Dokumentupload",
"<Dokumentbibliothekname>/Forms/Upload.aspx?RootFolder=","");
// Rückgabewert true bedeutet, dass die Standardmenüeinträge der ows.js nicht
// zusätzlich hinzugefügt werden. Es wird also _ausschließlich_ unsere Routine
// durchlaufen, nicht nur _zusätzlich_
return true;
}
// ---------------------------------------------------------------------
// Fügt einen eigenen Eintrag dem kontextmenü hinzu,
// der eine spezialle Seite aufruft
// Parameter:
// text: Text des Menüpunktes
// url: URL die beim Klick aufgerufen wird
// imagefile: Dateiname des Bildes (nicht pfad) -
// Es genügt der name eines standardbildes
// z.B. delitem.gif
function AddCustomUrlEntry(text, url, imagefile) {
strAction = "STSNavigate('" + url + "')";
if (imagefile == "" || imagefile == null) {
imagefile = "icdisc.gif";
}
strImagePath = ctx.imagesPath + imagefile;
CAMOpt(m, text, strAction, strImagePath);
}
</script>