Commit 230e65df authored by Akikonata's avatar Akikonata

added func

parent 772be409
......@@ -59,7 +59,7 @@ $dependency = Array(
,'src/adapter/combobox.js'
,'src/adapter/saveto.js'
,'src/adapter/hand.js'
,'src/adapter/icon.js'
,'src/adapter/dialog.js'
,'src/protocal/plain.js'
,'src/protocal/json.js'
);
......
......@@ -9,23 +9,24 @@ KityMinder.LANG[ 'zh-cn' ] = {
'fontsize': '字号',
'layoutstyle': '主题',
'saveto': '导出',
'hand': '允许拖拽'
'hand': '允许拖拽',
'markers': '添加标签'
},
'popupcolor': {
'clearColor': '清空颜色',
'standardColor': '标准颜色',
'themeColor': '主题颜色'
},
'dialogs':{
'markers':{
'static':{
'lang_input_text':'文本内容:',
'lang_input_url':'链接地址:',
'lang_input_title':'标题:',
'lang_input_target':'是否在新窗口打开:'
'dialogs': {
'markers': {
'static': {
'lang_input_text': '文本内容:',
'lang_input_url': '链接地址:',
'lang_input_title': '标题:',
'lang_input_target': '是否在新窗口打开:'
},
'validLink':'只支持选中一个链接时生效',
'httpPrompt':'您输入的超链接中不包含http等协议名称,默认将为您添加http://前缀'
'validLink': '只支持选中一个链接时生效',
'httpPrompt': '您输入的超链接中不包含http等协议名称,默认将为您添加http://前缀'
}
}
......
KM.registerUI('markers',function(name){
KM.registerUI( 'markers', function ( name ) {
var me = this, currentRange, $dialog,
var me = this,
currentRange, $dialog,
opt = {
title: this.getLang('tooltips')[name] || '',
url: me.getOptions('KITYMINDER_HOME_URL') + 'dialogs/' + name + '/' + name + '.js'
title: this.getLang( 'tooltips' )[ name ] || '',
url: me.getOptions( 'KITYMINDER_HOME_URL' ) + 'dialogs/' + name + '/' + name + '.js',
};
var $btn = $.kmuibutton({
var $btn = $.kmuibutton( {
icon: name,
title: this.getLang('tooltips')[name] || ''
});
title: this.getLang( 'tooltips' )[ name ] || ''
} );
//加载模版数据
utils.loadFile(document,{
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);
}, function () {
$dialog = $.kmuimodal(opt);
$dialog = $.kmuimodal( opt );
$dialog.attr('id', 'kmui-dialog-' + name).addClass('kmui-dialog-' + name)
.find('.kmui-modal-body').addClass('kmui-dialog-' + name + '-body');
$dialog.attr( 'id', 'kmui-dialog-' + name ).addClass( 'kmui-dialog-' + name )
.find( '.kmui-modal-body' ).addClass( 'kmui-dialog-' + name + '-body' );
$dialog.kmui().on('beforeshow', function () {
$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);
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)
});
KM.setWidgetBody( name, $dialog, me );
$dialog.on( "click", "#icon-priority li", function () {
var $this = $( this );
var val = $this.val();
me.execCommand( "changeicon", "PriorityIcon", val );
} ).on( "click", "#icon-progress li", function () {
var $this = $( this );
var val = $this.val();
me.execCommand( "changeicon", "ProgressIcon", val );
} );
} ).attachTo( $btn )
} );
me.on('interactchange', function () {
var state = this.queryCommandState(name);
$btn.kmui().disabled(state == -1).active(state == 1)
});
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
} );
\ No newline at end of file
......@@ -5,16 +5,13 @@ KM.ui.define( 'modal', {
'<div class="kmui-close" data-hide="modal"></div>' +
'<h3 class="kmui-title"><%=title%></h3>' +
'</div>' +
'<div class="kmui-modal-body" style="<%if(width){%>width:<%=width%>px;<%}%>' +
'<%if(height){%>height:<%=height%>px;<%}%>">' +
' </div>' +
'<% if(cancellabel || oklabel) {%>' +
'<div class="kmui-modal-footer">' +
'<div class="kmui-modal-tip"></div>' +
'<%if(oklabel){%><div class="kmui-btn kmui-btn-primary" data-ok="modal"><%=oklabel%></div><%}%>' +
'<%if(cancellabel){%><div class="kmui-btn" data-hide="modal"><%=cancellabel%></div><%}%>' +
'<div>' +
'<h3>优先级</h3>' +
'<ul class="icon-list" id="icon-priority"><li value="1">1</li><li value="2">2</li><li value="3">3</li><li value="4">4</li><li value="5">5</li></ul>' +
'<h3>进程</h3>' +
'<ul class="icon-list" id="icon-progress"><li value="1">1</li><li value="2">2</li><li value="3">3</li><li value="4">4</li><li value="5">5</li></ul>' +
'</div>' +
'<%}%></div>',
'</div>',
defaultOpt: {
title: "",
cancellabel: "",
......
......@@ -17,9 +17,6 @@
.kmui-btn-toolbar .kmui-btn .kmui-icon-hand {
background: url(../images/hand.png) no-repeat 2px 2px;
}
.kmui-btn-toolbar .kmui-btn .kmui-icon-flag {
.kmui-btn-toolbar .kmui-btn .kmui-icon-markers {
background: url(../images/flag.png) no-repeat 2px 2px;
}
\ No newline at end of file
.kmui-btn-toolbar .kmui-btn .kmui-icon-clock {
background: url(../images/clock.png) no-repeat 2px 2px;
}
\ No newline at end of file
.kmui-modal {
position: fixed;
_position: absolute;
top: 10%;
left: 50%;
border: 1px solid #acacac;
box-shadow: 2px 2px 5px #d3d6da;
top: 10px;
right:10px;
background-color: #ffffff;
outline: 0;
border-radius: 5px;
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
}
.kmui-modal-header {
padding: 5px 10px;
......@@ -80,3 +79,16 @@
line-height: 30px;
display: none;
}
.icon-list{
margin: 0;
padding: 0
}
.icon-list li{
padding: 10px 20px;
margin: 0;
list-style: none;
cursor: pointer;
}
.icon-list li:hover{
background: #cfe0f7
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment