AlBundy33 Posted November 26, 2006 Posted November 26, 2006 It is just a small mod but with this the user is able to user only-image-names (if they are stored in ./Graphics) or use fully qualified paths like %ROOT%\apps\app\wpi_image.pngfunction WriteBackPrograms(programs){ position="program.js"; whatfunc="WriteBackPrograms()"; for (var i=0; i<programs.length; i++) { if (IndentText) textindent =' '; else textindent =''; if (programs[i].picf != null) { if (programs[i].textl != "Top") { if (programs[i].textl != "Bottom") { pwidth=programs[i].picw; pheight=programs[i].pich; textloc=programs[i].textl; desc[i+1]=imagelocationlr + programs[i].picf + imagepart2lr + pwidth + imagepart3lr + pheight + imagepart4lr + textloc + imagepart5lr + textindent + programs[i].desc; } } if (programs[i].textl != "Left") { if (programs[i].textl != "Right") { if (programs[i].textl != "Bottom") { pwidth=programs[i].picw; pheight=programs[i].pich; textloc=programs[i].textl; desc[i+1]=textindent + programs[i].desc + imagepart1t + imagelocationtb + programs[i].picf + imagepart2tb + pwidth + imagepart3tb + pheight + imagepart4tb; } else { pwidth=programs[i].picw; pheight=programs[i].pich; textloc=programs[i].textl; desc[i+1]=imagelocationtb + programs[i].picf + imagepart2tb + pwidth + imagepart3tb + pheight + imagepart4tb + imagepart1b + imageparteb + textindent + programs[i].desc; } } } //check if a fully qualified path was set if (desc[i+1].match(/img src=".*\\.*"/g) != null) { //remove ./Graphics/ desc[i+1]=desc[i+1].replace(/src=".\/Graphics\//gi, 'src="'); //replace variables (e.g. %ROOT%) desc[i+1]=ReplacePath(desc[i+1].replace(/src="([^"]*)"/gi, 'src="$1"')); //get path to image path_to_image = desc[i+1].replace(/.*src="([^"]*)".*/i, "$1"); //replace every "\" with "/" path_to_image = path_to_image.replace(/\\/g, '/'); //build new description desc[i+1]=desc[i+1].replace(/src="[^"]*"/gi, 'src="file://' + path_to_image + '"'); } } else desc[i+1]=textindent + programs[i].desc; prog[i+1]=programs[i].prog; ordr[i+1]=programs[i].ordr; uid[i+1]=programs[i].uid; dflt[i+1]=programs[i].dflt; cat[i+1]=programs[i].cat; forc[i+1]=programs[i].forc; configs[i+1]=programs[i].configs; deps[i+1]=programs[i].deps; excl[i+1]=programs[i].excl; cond[i+1]=programs[i].cond; gcond[i+1]=programs[i].gcond; regb[i+1]=programs[i].regb; cmd1[i+1]=programs[i].cmd1; cmd2[i+1]=programs[i].cmd2; cmd3[i+1]=programs[i].cmd3; cmd4[i+1]=programs[i].cmd4; cmd5[i+1]=programs[i].cmd5; cmd6[i+1]=programs[i].cmd6; rega[i+1]=programs[i].rega; picf[i+1]=programs[i].picf; picw[i+1]=programs[i].picw; pich[i+1]=programs[i].pich; textl[i+1]=programs[i].text1; } prog[programs.length+1]=null;}I think you see where the mod happens. :-)Al
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now