Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Great Tip

  Asked By: Rocco Hendricks         Date: Jun 18, 2005      Category: Sharepoint      Views: 507
 

Just found a great tip on MSD2D.com that forces an office document to be checked out when edited from a document library. www.msd2d.com/.../Tip_viewitem_03NoAuth.aspx

No matter how often you explain checkin-checkout to some folks they just don't get it.

Tagged:    

 

9 Answers Found

 
Answer #1       Answered By: Marty Mcdowell          Answered On: Jun 18, 2005       

True however couldn’t this lead to all your documents being checked  out just because someone launched them to look at them. SharePoint doesn’t make any difference between launching a document  for viewing vs editing when you click on it.

 
Answer #2       Answered By: Dakota Shaffer          Answered On: Jun 18, 2005       

It only marks the document  as 'Checked Out' if I use the Menu Item 'Edit with ....'
If I double click on the document, it opens in the apprpropriate Office product but does not mark the document as checked  out.

 
Answer #3       Answered By: Ted Gilmore          Answered On: Jun 18, 2005       

Now lets hope users understand the importance of checking a file back
in!

 
Answer #4       Answered By: Monte Cooley          Answered On: Jun 18, 2005       

I'm an intern attempting to set this up, so I don't have a lot of experience
but I can't seem to get the tip  to work. Sounds like a great  idea but when I
make the changes I get a url error and in the code where strHttpRoot is on
the IE address bar it states not found. Then after this error I receive a
SharePoint must use IE greater then 5.0 even though I'm using 6 with all
patches. Sorry for being slow in picking this up.

 
Answer #5       Answered By: Guadalupe Bullock          Answered On: Jun 18, 2005       

Open ows.js, and replace the following functions:

function AddDocLibMenuItems(m, ctx)
{
if (typeof(Custom_AddDocLibMenuItems) != "undefined")
{
if (Custom_AddDocLibMenuItems(m, ctx))
return;
}
var RootFolder = GetRootFolder(ctx);
setupMenuContext(ctx);
if (currentItemFileUrl == null)
currentItemFileUrl = itemTable.ServerUrl;
if (currentItemFSObjType == null)
currentItemFSObjType = itemTable.FSObjType;
var currentItemEscapedFileUrl = escapeProperly(
unescapeProperly(currentItemFileUrl));
if (currentItemFSObjType != 1)
{
strDisplayText = L_ViewProperties_Text;
strAction = "STSNavigate('" + ctx.displayFormUrl+"?ID="+
currentItemID +
"&Source=" + GetSource() + RootFolder + "')";
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
strDisplayText = L_EditProperties_Text;
strAction = "STSNavigate('" + ctx.editFormUrl+"?ID="+
currentItemID +
"&Source=" + GetSource() + RootFolder + "')";
strImagePath = ctx.imagesPath + "edititem.gif";
CAMOpt(m, strDisplayText, strAction, strImagePath);
if (currentItemFSObjType != 1)
{
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 + "')";

strAction = "editDocumentWithProgID2('" +
currentItemFileUrl + "', '" + currentItemProgId + "', '" +
currentItemOpenControl + "', '" + ctx.HttpRoot + "')";

strImagePath = ctx.imagesPath + currentItemIcon;
CAMOpt(m, strDisplayText, strAction,
strImagePath);
}
}
}
}
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);
if (ctx.isModerated == true)
{
strDisplayText = L_ModerateItem_Text;
strAction = "STSNavigate('" + ctx.editFormUrl+"?ID="+
currentItemID + "&ChangeApproval=TRUE&Source=" +
GetSource() + RootFolder + "')";
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
if (currentItemFSObjType != 1 && ctx.listTemplate ==
LISTTEMPLATE_IMAGE_LIBRARY)
{
strAction = "DownloadOriginalImage(" + currentItemID + ")";
strImagePath = ctx.imagesPath + "download.gif";
strDisplayText = L_DownloadOriginal_Text;
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
if (currentItemFSObjType != 1)
{
CAMSep(m);
AddCheckinCheckoutMenuItem(m, ctx, currentItemEscapedFileUrl);
AddVersionsMenuItem(m, ctx, currentItemEscapedFileUrl);
CAMSep(m);
if (ctx.PortalUrl != null)
{
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);
}
}
strDisplayText = L_Subscribe_Text;
strAction = "NavigateToSubNewAspx('" + ctx.HttpRoot + "', 'List="
+ ctx.listName + "&ID=" + currentItemID + "')";
strImagePath = "";
CAMOpt(m, strDisplayText, strAction, strImagePath);
if (currentItemFSObjType != 1)
{
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);
}
}

function editDocumentWithProgID2(strDocument, varProgID, varEditor,
strHttpRoot)
{

if (currentItemCheckedOutUserId ==
null)
currentItemCheckedOutUserId =
itemTable.COUId;
if (currentItemCheckedOutUserId == "")

{

SubmitFormPost(strHttpRoot
+ "/_layouts/" + L_Language_Text + "/Checkin.aspx?FileName=" +
strDocument + "&Checkout=true&Source=" + GetSource());

}

var objEditor;
if (strDocument.charAt(0) == "/" || strDocument.substr
(0,3).toLowerCase() == "%2f")
strDocument = document.location.protocol + "//" +
document.location.host + strDocument;
try
{
objEditor = new ActiveXObject(varEditor + ".2");
if (!objEditor.EditDocument2(window, strDocument, varProgID))
alert(L_EditDocumentRuntimeError_Text);
window.onfocus = RefreshOnNextFocus;
return;
}
catch (e)
{
}
try
{
objEditor = new ActiveXObject(varEditor + ".1");
window.onfocus = null;
if (SzExtension(strDocument) == "ppt" && varProgID == "")
varProgID = "PowerPoint.Slide";
if (!objEditor.EditDocument(strDocument, varProgID))
alert(L_EditDocumentRuntimeError_Text);
SetWindowRefreshOnFocus();
return;
}
catch (e)
{
alert(L_EditDocumentProgIDError_Text);
}
}

 
Answer #6       Answered By: Nathanial Mcclure          Answered On: Jun 18, 2005       

One thing at a time. At least Office 2003 has reminders abbout Check In if
you close the document  and there is a Shared Workspace panel when yu have a
document checked  out.

 
Answer #7       Answered By: Matt Prince          Answered On: Jun 18, 2005       

Unfortunately you’re now out of support by modifiying this if the javascript is found  to be a problem as this is a core SharePoint file.

 
Answer #8       Answered By: Brooks Bond          Answered On: Jun 18, 2005       

I suggest put this override code into a custom ows.js in
layouts\1033\Custom\[SiteDefName]\ows.js for your Site Definition using the
CustomJSUrl element of the Project tag in your ONET.XML.

Watch for an article in SharePoint Advisor Magazine...

 
Answer #9       Answered By: Gregg Wilkinson          Answered On: Jun 18, 2005       

I did mean to say custom ows file. Thanks for pointing that out.

 
Didn't find what you were looking for? Find more on Great Tip Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].