123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
-
- Namespace.register("U.MD.D.Txt");
- U.MD.D.Txt.textCreate = function (obj) {
- var text_div = $$("div", { "className": "U_MD_F_T_Text_div",
- style: {
- width: "100%",
- height: "100%"
- }
- });
- var text_center = $$("div", { "className": "U_MD_F_T_Text_center",
- style: {
- width: "100%",
- height: "39px",
- color: "white",
- background: "#fafafa",
- U_MD_O_E_borderBottom: "1px solid #a5a3a3"
- }
- }, text_div);
- var New = $$("div", { "className": "U_MD_F_T_New",
- style: {
- backgroundColor: "white",
- float: " left",
- lineHeight: "25px",
- cursor: " pointer",
- marginLeft: " 10px",
- height: "25px",
- marginTop: "6px",
- border: " 1px solid #CDCDCD",
- color: " #000"
- }
- }, text_center);
- var img = $$("div", { "className": "U_MD_F_T_New_img",
- style: {
- float: "left",
- marginLeft: "8px",
- width: "20px",
- height: "25px",
- background: "url(/img/Editor_img1.png) no-repeat",
- backgroundPosition: "0px -25px"
- }
- }, New);
- var span = $$("div", { "className": "U_MD_F_T_New_span",
- style: {
- width: "40px",
- height: "25px",
- float: "left",
- marginLeft: "5px",
- fontFamily: "微软雅黑",
- fontSize: "12.5px"
- }
- , innerHTML: "新建"
- }, New);
- var save = $$("div", { "className": "U_MD_F_T_Save",
- style: {
- backgroundColor: "white",
- float: " left",
- lineHeight: "25px",
- cursor: " pointer",
- marginLeft: " 10px",
- height: "25px",
- marginTop: "6px",
- border: " 1px solid #CDCDCD",
- color: " #000"
- }
- }, text_center);
- img = $$("div", { "className": "U_MD_F_T_Save_img",
- style: {
- float: "left",
- marginLeft: "4px",
- width: "25px",
- height: "25px",
- background: "url(/img/Editor_img1.png) no-repeat",
- backgroundPosition: "-25px -25px"
- }
- }, save);
- span = $$("div", { "className": "U_MD_F_T_Save_span",
- style: {
- width: "40px",
- height: "25px",
- float: "left",
- marginLeft: "5px",
- fontFamily: "微软雅黑",
- fontSize: "12.5px"
- }, innerHTML: "保存"
- }, save);
- var font = U.MD.UI.Font();
- text_center.appendChild(font);
- font.className = "UD_font";
- font.style.height = "27px";
- font.style.marginLeft = "10px";
- font.style.marginTop = "6px";
- font.style.fontSize = "14px";
- font.style.fontFamily = "微软雅黑";
- var fontsize = U.MD.UI.WordSize();
- fontsize.className = "UD_fontsize";
- text_center.appendChild(fontsize);
- fontsize.style.height = "27px";
- fontsize.style.marginLeft = "10px";
- fontsize.style.marginTop = "6px";
- fontsize.style.fontSize = "14px";
- fontsize.style.fontFamily = "微软雅黑";
- var text = $$("textarea", {
- "className": "U_MD_F_T_Text",
- placeholder: "点击编辑内容...."
- }, text_div);
- font.onchange = function () {
- U.MD.D.Txt.fontOnchange(text, this);
- }
- fontsize.onchange = function () {
- U.MD.D.Txt.fontSizeOnchange(text, this);
- }
- var form = new U.UF.UI.form("", text_div, { "style": { "width": "50%", "height": "50%"} });
- if (obj) {
- U.MD.D.Txt.objFun(obj, text, form);
- } else {
- form.form.childNodes[1].innerHTML = "新建文本文件";
- }
- form.form.childNodes[1].style.textIndent = "15px";
- New.onclick = function () {
- U.MD.D.Txt.NewFun();
- }
- save.onclick = function () {
- U.MD.D.Txt.SaveFun(text, form);
- }
- return form.form;
- }
- U.MD.D.Txt.fontOnchange = function (text, thisobj) {
- text.style.fontFamily = thisobj.value;
- }
- U.MD.D.Txt.fontSizeOnchange = function (text, thisobj) {
- text.style.fontSize = thisobj.value;
- }
- U.MD.D.Txt.objFun = function (obj, text, form) {
- U.A.Request(US.AUTH, ["GetFileContent", obj.UserDirectoryID], function (r) {
- text.value = r.value.UsOffice;
- }, []);
- form.form.childNodes[1].innerHTML = obj.UserallDirectoryName;
- text.userid = obj.UserId;
- text.id = obj.UserDirectoryID;
- }
- U.MD.D.Txt.NewFun = function () {
- U.MD.D.Txt.textCreate();
- }
- U.MD.D.Txt.SaveFun = function (text, form) {
- if (text.id) {
- U.A.Request(US.AUTH, ["SaveFileContent", text.userid, text.id, text.value, form.form.childNodes[1].innerHTML], function (r) {
- U.alert("保存成功", 2000);
- }, []);
- } else {
- if (US.disk.UserDisk == null) {
- U.MD.DK.RE.newText({});
- } else {
- U.MD.DK.RE.newText(US.disk.UserDisk, function (fileinfo) {
- text.userid = fileinfo.UserId;
- text.id = fileinfo.UserDirectoryID;
- form.form.childNodes[1].innerHTML = fileinfo.UserDirectoryName;
- U.A.Request(US.AUTH, ["SaveFileContent", text.userid, text.id, text.value, _name], function (r) {
- U.alert("创建成功", 2000);
- }, []);
- });
- }
- }
- }
|