Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
219afeb1
Commit
219afeb1
authored
Feb 17, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
1c977eb9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
144 additions
and
0 deletions
+144
-0
markers.js
dialogs/markers/markers.js
+70
-0
dialog.js
src/adapter/dialog.js
+74
-0
No files found.
dialogs/markers/markers.js
0 → 100644
View file @
219afeb1
(
function
(){
var
utils
=
KM
.
utils
;
function
hrefStartWith
(
href
,
arr
)
{
href
=
href
.
replace
(
/^
\s
+|
\s
+$/g
,
''
);
for
(
var
i
=
0
,
ai
;
ai
=
arr
[
i
++
];)
{
if
(
href
.
indexOf
(
ai
)
==
0
)
{
return
true
;
}
}
return
false
;
}
KM
.
registerWidget
(
'markers'
,
{
tpl
:
"<style type=
\"
text/css
\"
>"
+
".kmui-dialog-link .kmui-link-table{font-size: 12px;margin: 10px;line-height: 30px}"
+
".kmui-dialog-link .kmui-link-txt{width:300px;height:21px;line-height:21px;border:1px solid #d7d7d7;}"
+
"</style>"
+
"<table class=
\"
kmui-link-table
\"
>"
+
"<tr>"
+
"<td><label for=
\"
href
\"
><%=lang_input_url%></label></td>"
+
"<td><input class=
\"
kmui-link-txt
\"
id=
\"
kmui-link-Jhref
\"
type=
\"
text
\"
/></td>"
+
"</tr>"
+
"<tr>"
+
"<td><label for=
\"
title
\"
><%=lang_input_title%></label></td>"
+
"<td><input class=
\"
kmui-link-txt
\"
id=
\"
kmui-link-Jtitle
\"
type=
\"
text
\"
/></td>"
+
"</tr>"
+
"<tr>"
+
"<td colspan=
\"
2
\"
>"
+
"<label for=
\"
target
\"
><%=lang_input_target%></label>"
+
"<input id=
\"
kmui-link-Jtarget
\"
type=
\"
checkbox
\"
/>"
+
"</td>"
+
"</tr>"
+
"</table>"
,
initContent
:
function
(
km
)
{
var
lang
=
km
.
getLang
(
'dialogs.markers'
);
if
(
lang
)
{
var
html
=
$
.
parseTmpl
(
this
.
tpl
,
lang
.
static
);
}
this
.
root
().
html
(
html
);
},
initEvent
:
function
(
km
,
$w
)
{
var
link
=
km
.
queryCommandValue
(
'link'
);
if
(
link
){
$
(
'#kmui-link-Jhref'
,
$w
).
val
(
utils
.
html
(
$
(
link
).
attr
(
'href'
)));
$
(
'#kmui-link-Jtitle'
,
$w
).
val
(
$
(
link
).
attr
(
'title'
));
$
(
link
).
attr
(
'target'
)
==
'_blank'
&&
$
(
'#kmui-link-Jtarget'
).
attr
(
'checked'
,
true
)
}
},
buttons
:
{
'ok'
:
{
exec
:
function
(
km
,
$w
)
{
var
href
=
$
(
'#kmui-link-Jhref'
).
val
().
replace
(
/^
\s
+|
\s
+$/g
,
''
);
if
(
href
)
{
km
.
execCommand
(
'link'
,
{
'href'
:
href
,
'target'
:
$
(
"#kmui-link-Jtarget:checked"
).
length
?
"_blank"
:
'_self'
,
'title'
:
$
(
"#kmui-link-Jtitle"
).
val
().
replace
(
/^
\s
+|
\s
+$/g
,
''
),
'_href'
:
href
});
}
}
},
'cancel'
:{}
},
width
:
400
})
})();
src/adapter/dialog.js
0 → 100644
View file @
219afeb1
KM
.
registerUI
(
'markers'
,
function
(
name
){
var
me
=
this
,
currentRange
,
$dialog
,
opt
=
{
title
:
this
.
getLang
(
'tooltips'
)[
name
]
||
''
,
url
:
me
.
getOptions
(
'KITYMINDER_HOME_URL'
)
+
'dialogs/'
+
name
+
'/'
+
name
+
'.js'
};
var
$btn
=
$
.
kmuibutton
({
icon
:
name
,
title
:
this
.
getLang
(
'tooltips'
)[
name
]
||
''
});
//加载模版数据
utils
.
loadFile
(
document
,{
src
:
opt
.
url
,
tag
:
"script"
,
type
:
"text/javascript"
,
defer
:
"defer"
},
function
(){
//调整数据
var
data
=
KM
.
getWidgetData
(
name
);
if
(
data
.
buttons
){
var
ok
=
data
.
buttons
.
ok
;
if
(
ok
){
opt
.
oklabel
=
ok
.
label
||
me
.
getLang
(
'ok'
);
if
(
ok
.
exec
){
opt
.
okFn
=
function
(){
return
$
.
proxy
(
ok
.
exec
,
null
,
me
,
$dialog
)()
}
}
}
var
cancel
=
data
.
buttons
.
cancel
;
if
(
cancel
){
opt
.
cancellabel
=
cancel
.
label
||
me
.
getLang
(
'cancel'
);
if
(
cancel
.
exec
){
opt
.
cancelFn
=
function
(){
return
$
.
proxy
(
cancel
.
exec
,
null
,
me
,
$dialog
)()
}
}
}
}
data
.
width
&&
(
opt
.
width
=
data
.
width
);
data
.
height
&&
(
opt
.
height
=
data
.
height
);
$dialog
=
$
.
kmuimodal
(
opt
);
$dialog
.
attr
(
'id'
,
'kmui-dialog-'
+
name
).
addClass
(
'kmui-dialog-'
+
name
)
.
find
(
'.kmui-modal-body'
).
addClass
(
'kmui-dialog-'
+
name
+
'-body'
);
$dialog
.
kmui
().
on
(
'beforeshow'
,
function
()
{
var
$root
=
this
.
root
(),
win
=
null
,
offset
=
null
;
if
(
!
$root
.
parent
()[
0
])
{
me
.
$container
.
find
(
'.kmui-dialog-container'
).
append
(
$root
);
}
KM
.
setWidgetBody
(
name
,
$dialog
,
me
);
}).
on
(
'afterbackdrop'
,
function
(){
this
.
$backdrop
.
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
).
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
))
$dialog
.
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
2
)
}).
attachTo
(
$btn
)
});
me
.
on
(
'interactchange'
,
function
()
{
var
state
=
this
.
queryCommandState
(
name
);
$btn
.
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
)
});
return
$btn
;
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment