SkyDrive support - Posted (1218 Views)
Retired Support Moderator
MarcelG
Posts: 2625
2625
I've created a mod for SkyDrive support (http://oxle.com/topic.asp?tid=5177) and I am willing to make it into a documented mod if someone thinks it's a useful mod.
Please let me know what you think.<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Junior Member
balexandre
Posts: 418
418
and why not...?
count me on if you need any help... here is the icon and the javascript for using [ skydrive ] [ /skydrive ] tags smile

inc_iconfiles.asp ADD
Code:
Const strIconSkyDrive = "icon_SKYDRIVE.gif|23|22"

inc_code.js ADD
Code:
// Microsoft Sky Drive
function skydrive() {
var text = getText();
if (helpstat){
alert("Microsoft Sky Drive.\n\nUSE: [skydrive]Microsoft Sky Drive URL[/skydrive]");
} else if (basic) {
AddTxt=" [skydrive]" + text + "[/skydrive]";
AddText(AddTxt);
} else {
if (text) {
txt=prompt("Microsoft Sky Drive URL",text);
} else {
txt=prompt("Microsoft Sky Drive URL","Text");
}
if(txt!=null) {
AddTxt=" [skydrive] "+txt+" [/skydrive]";
AddText(AddTxt);
}
}
}

inc_post_buttons.asp ADD

Code:
Response.Write "<a href=""Javascript:skydrive();"" tabindex=""-1"">" & getCurrentIcon(strIconSkyDrive,"Insert SkyDrive File","align=""top""") & "</a>"


Now, all I missed was the right line numbers, and of course inc_func_common.asp...
All we need is you magic in that file wink<
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
Okay, in short. To the function FormatStr, add this line: fString = ReplaceSkyDriveTags(fString)

Old code
Code:
if strAllowForumCode = "1" then
fString = extratags(fString)
end if
New code
Code:
if strAllowForumCode = "1" then
fString = extratags(fString)
fString = ReplaceSkyDriveTags(fString)
end if
The function itself, also to be added to inc_func_common.asp:
Code:
Function ReplaceSkyDriveTags(fString)
Dim oTag, cTag
Dim roTag, rcTag
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2
Dim strCodeText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 2
Dim CodeTags(2,2,2)
Dim strArray, strArray2

CodeTags(1,1,1) = "[skydrive]"
CodeTags(1,2,1) = "[/skydrive]"

'function EmbedFLV(URL, width, height, menu, quality, bg, bg2, nav, fcolor, bcolor, lcolor, autostart)
'only url is entered in the post, the rest is up to us
CodeTags(1,1,2) = "<div><iframe scrolling=""no"" marginheight=""0"" marginwidth=""0"" frameborder=""0"" style=""width:240px;height:66px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;"" src="""
CodeTags(1,2,2) = """></iframe></div>"

CodeTags(2,1,1) = "[SKYDRIVE]"
CodeTags(2,2,1) = "[/SKYDRIVE]"
CodeTags(2,1,2) = CodeTags(1,1,2)
CodeTags(2,2,2) = CodeTags(1,2,2)

strResultString = ""
strTempString = fString

for counter1 = 1 to TagCount

oTag = CodeTags(counter1,1,1)
roTag = CodeTags(counter1,1,2)
cTag = CodeTags(counter1,2,1)
rcTag = CodeTags(counter1,2,2)
oTagPos = InStr(1, strTempString, oTag, 1)
cTagPos = InStr(1, strTempString, cTag, 1)

if (oTagpos > 0) and (cTagPos > 0) then
strArray = Split(strTempString, oTag, -1)
for counter2 = 0 to Ubound(strArray)
if (Instr(1, strArray(counter2), cTag) > 0) then
strArray2 = split(strArray(counter2), cTag, -1)
strCodeText = trim(strArray2(0))
if lcase(left(strCodeText,7)) <> "http://" then 'embed code used
strCodeText= mid(strCodeText, instr(strCodeText,"http://"), (instr(strCodeText,"""></iframe")-instr(strCodeText,"http://")))
end if
strCodeText = replace(strCodeText, "/self.aspx/","/embedrowdetail.aspx/")
strCodeText = replace(strCodeText, "/embedgrid.aspx/","/embedrowdetail.aspx/")
if instr(strCodeText,"/embedrow.aspx/") > 0 then
roTag = Replace(roTag, "height:66px;","height:26px;")
end if
if instr(strCodeText,",") > 0 or _
instr(strCodeText,")") >0 or _
instr(strCodeText,"(") >0 or _
instr(strCodeText,";") >0 or _
instr(strCodeText,"""") >0 or _
instr(strCodeText,"<") >0 or _
instr(strCodeText,">") >0 or _
instr(strCodeText,"[") >0 or _
instr(strCodeText,"]") >0 or _
instr(strCodeText,",") >0 then
strCodeText = "illegal"
end if
strResultString = strResultString & roTag & strCodeText & rcTag & strArray2(1)
else
strResultString = strResultString & strArray(counter2)
end if
next

strTempString = strResultString
strResultString = ""
end if
next

ReplaceSkyDriveTags = strTempString
end function
The modification to the function ChkURLs in inc_func_common.asp, to prevent the urls between the tags from being handled:
old code:
Code:
				(UCase(Right(strArray(Counter-1), 5)) <> "[IMG]") and _
(UCase(Right(strArray(Counter-1), 5)) <> "[URL]") and _
New code:
Code:
				(UCase(Right(strArray(Counter-1), 5)) <> "[IMG]") and _
(UCase(Right(strArray(Counter-1), 10)) <> "[SKYDRIVE]") and _
(UCase(Right(strArray(Counter-1), 5)) <> "[URL]") and _
That should be it.
The function itself needs to have some checks in it to make sure only a valid Skydrive.live.com URL is entered. I'll work on that this weekend.
<
Posted
Member Locked
philsbbs
Posts: 397
397
keep me posted<
Phil
 
You Must enter a message