Changeset 2156:5cdb254a24d2 for admin
- Timestamp:
- 09/29/13 23:10:54 (12 years ago)
- Branch:
- dcRepo
- Location:
- admin
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_plugins.js
r0 r2156 1 dotclear.moduleExpander = function(line) { 2 var td = line.firstChild; 3 4 var img = document.createElement('img'); 5 img.src = dotclear.img_plus_src; 6 img.alt = dotclear.img_plus_alt; 7 img.className = 'expand'; 8 $(img).css('cursor','pointer'); 9 img.line = line; 10 img.onclick = function() { dotclear.viewModuleContent(this,this.line); }; 11 12 td.insertBefore(img,td.firstChild); 13 }; 14 15 dotclear.modulesExpander = function(line,lines) { 16 var td = line.firstChild; 17 18 var img = document.createElement('img'); 19 img.src = dotclear.img_plus_src; 20 img.alt = dotclear.img_plus_alt; 21 img.className = 'expand'; 22 $(img).css('cursor','pointer'); 23 img.lines = lines; 24 img.onclick = function() { dotclear.viewModulesContent(this,this.lines); }; 25 26 td.insertBefore(img,td.firstChild); 27 }; 28 29 dotclear.viewModulesContent = function(img,lines) { 30 31 action = 'toggle'; 32 33 if (img.alt == dotclear.img_plus_alt) { 34 img.src = dotclear.img_minus_src; 35 img.alt = dotclear.img_minus_alt; 36 action = 'open'; 37 } else { 38 img.src = dotclear.img_plus_src; 39 img.alt = dotclear.img_plus_alt; 40 action = 'close'; 41 } 42 43 lines.each(function() { 44 var td = this.firstChild; 45 dotclear.viewModuleContent(td.firstChild,td.firstChild.line,action); 46 }); 47 }; 48 49 dotclear.viewModuleContent = function(img,line,action) { 50 51 var action = action || 'toggle'; 52 var cols = $('td',$(line)).length 53 var sp = line.id.split('_m_'); 54 var listId=sp[0]; 55 var moduleId= sp[1]; 56 57 var tr = document.getElementById('pe'+moduleId); 58 59 if ( !tr && ( action == 'toggle' || action == 'open' ) ) { 60 tr = document.createElement('tr'); 61 tr.id = 'pe'+moduleId; 62 63 var td = document.createElement('td'); 64 td.colSpan = cols; 65 td.className = 'expand'; 66 tr.appendChild(td); 67 68 img.src = dotclear.img_minus_src; 69 img.alt = dotclear.img_minus_alt; 70 71 // Get post content 72 $.get('services.php',{f:'getModuleById', id: moduleId, list: listId},function(data) { 73 var rsp = $(data).children('rsp')[0]; 74 75 if (rsp.attributes[0].value == 'ok') { 76 var author = $(rsp).find('author').text(); 77 var details = $(rsp).find('details').text(); 78 var support = $(rsp).find('support').text(); 79 var box = document.createElement('div'); 80 var dl = document.createElement('dl'); 81 82 if (author) { 83 $(dl).append($('<dt>'+dotclear.msg.module_author+'</dt><dd>'+author+'</dd>')); 84 } 85 if (details) { 86 var dd = ''; 87 dd += '<a class="details" href="'+details+'">'+dotclear.msg.module_details+'</a>'; 88 if (support) { 89 dd += ' - '; 90 dd += '<a class="support" href="'+support+'">'+dotclear.msg.module_support+'</a>'; 91 } 92 $(dl).append($('<dt>'+dotclear.msg.module_help+'</dt><dd>'+dd+'</dd>')); 93 } 94 95 $(td).append($(box).addClass('box').append(dl)); 96 97 var section = $(rsp).find('section').text(); 98 var tags = $(rsp).find('tags').text(); 99 100 var boxb = document.createElement('div'); 101 var dlb = document.createElement('dl'); 102 103 if (section) { 104 $(dlb).append($('<dt>'+dotclear.msg.module_section+'</dt><dd>'+section+'</dd>')); 105 } 106 if (tags) { 107 $(dlb).append($('<dt>'+dotclear.msg.module_tags+'</dt><dd>'+tags+'</dd>')); 108 } 109 $(td).append($(boxb).addClass('box').append(dlb)); 110 } else { 111 alert($(rsp).find('message').text()); 112 } 113 }); 114 115 $(line).addClass('expand'); 116 line.parentNode.insertBefore(tr,line.nextSibling); 117 } 118 else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) 119 { 120 $(tr).css('display', 'table-row'); 121 $(line).addClass('expand'); 122 img.src = dotclear.img_minus_src; 123 img.alt = dotclear.img_minus_alt; 124 } 125 else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) 126 { 127 $(tr).css('display', 'none'); 128 $(line).removeClass('expand'); 129 img.src = dotclear.img_plus_src; 130 img.alt = dotclear.img_plus_alt; 131 } 132 133 parentTable = $(line).parents('table'); 134 if( parentTable.find('tr.expand').length == parentTable.find('tr.line').length ) { 135 img = parentTable.find('tr:not(.line) th:first img'); 136 img.attr('src',dotclear.img_minus_src); 137 img.attr('alt',dotclear.img_minus_alt); 138 } 139 140 if( parentTable.find('tr.expand').length == 0 ) { 141 img = parentTable.find('tr:not(.line) th:first img'); 142 img.attr('src',dotclear.img_plus_src); 143 img.attr('alt',dotclear.img_plus_alt); 144 } 145 146 }; 147 148 1 149 $(function() { 2 $('table.plugins form input[type=submit][name=delete]').click(function() { 3 var p_name = $('input[name=plugin_id]',$(this).parent()).val(); 4 return window.confirm(dotclear.msg.confirm_delete_plugin.replace('%s',p_name)); 5 }); 150 $('table.modules.expandable tr:not(.line)').each(function() { 151 dotclear.modulesExpander(this,$('table.modules tr.line')); 152 }); 153 $('table.modules.expandable tr.line').each(function() { 154 dotclear.moduleExpander(this); 155 }); 6 156 }); -
admin/plugins.php
r2150 r2156 104 104 dcPage::jsLoad('js/_plugins.js'). 105 105 dcPage::jsPageTabs(). 106 107 # --BEHAVIOR-- pluginsToolsHeaders 106 108 $core->callBehavior('pluginsToolsHeaders', $core), 109 107 110 dcPage::breadcrumb( 108 111 array( … … 155 158 156 159 $list 160 ->newList('plugin-update') 157 161 ->setModules($modules) 158 162 ->setPageTab('update') 159 163 ->displayModulesList( 160 /*cols */ array('icon', 'name', 'version', 'current_version', 'desc'),164 /*cols */ array('icon', 'name', 'version', 'current_version', 'desc'), 161 165 /* actions */ array('update') 162 166 ); … … 179 183 180 184 $list 185 ->newList('plugin-activate') 181 186 ->setModules($modules) 182 187 ->setPageTab('plugins') 183 188 ->displayModulesList( 184 /* cols */ array(' icon', 'name', 'config', 'version', 'desc', 'distrib'),189 /* cols */ array('expander', 'icon', 'name', 'config', 'version', 'desc', 'distrib'), 185 190 /* actions */ array('deactivate', 'delete') 186 191 ); … … 196 201 197 202 $list 203 ->newList('plugin-deactivate') 198 204 ->setModules($modules) 199 205 ->setPageTab('plugins') … … 222 228 223 229 $list 230 ->newList('plugin-new') 224 231 ->setModules($modules) 225 232 ->setPageTab('new') … … 227 234 ->displayNavMenu() 228 235 ->displayModulesList( 229 /* cols */ array(' name', 'version', 'desc'),236 /* cols */ array('expander', 'name', 'version', 'desc'), 230 237 /* actions */ array('install'), 231 238 /* nav limit */ true -
admin/services.php
r1699 r2156 27 27 $core->rest->addFunction('searchMeta',array('dcRestMethods','searchMeta')); 28 28 $core->rest->addFunction('setSectionFold',array('dcRestMethods','setSectionFold')); 29 $core->rest->addFunction('getModuleById',array('dcRestMethods','getModuleById')); 29 30 30 31 $core->rest->serve(); … … 442 443 return true; 443 444 } 444 445 445 446 public static function getModuleById($core, $get, $post) 447 { 448 if (empty($get['id'])) { 449 throw new Exception('No module ID'); 450 } 451 if (empty($get['list'])) { 452 throw new Exception('No list ID'); 453 } 454 455 $id = $get['id']; 456 $list = $get['list']; 457 $module = array(); 458 459 if ($list == 'plugin-activate') { 460 $modules = $core->plugins->getModules(); 461 if (empty($modules) || !isset($modules[$id])) { 462 throw new Exception('Unknow module ID'); 463 } 464 $module = $modules[$id]; 465 } 466 elseif ($list == 'plugin-new') { 467 $repository = new dcRepository( 468 $core->plugins, 469 $core->blog->settings->system->repository_plugin_url 470 ); 471 $repository->check(); 472 473 $modules = $repository->get(); 474 if (empty($modules) || !isset($modules[$id])) { 475 throw new Exception('Unknow module ID'); 476 } 477 $module = $modules[$id]; 478 } 479 else { 480 // behavior not implemented yet 481 } 482 483 if (empty($module)) { 484 throw new Exception('Unknow module ID'); 485 } 486 487 $module = adminModulesList::setModuleInfo($id, $module); 488 489 $rsp = new xmlTag('module'); 490 $rsp->id = $id; 491 492 foreach($module as $k => $v) { 493 $rsp->{$k}((string) $v); 494 } 495 496 return $rsp; 497 } 446 498 } 447 499 ?> -
admin/style/default.css
r2151 r2156 1966 1966 } 1967 1967 /* -------------------------------------------------------------------- plugins.php */ 1968 #plugins td.action {1968 .modules td.action, .modules td.icon { 1969 1969 vertical-align: middle; 1970 1970 } 1971 . icon img{1971 .modules td.icon img:last-child { 1972 1972 width: 16px; 1973 1973 height: 16px; 1974 1974 } 1975 . distrib img {1975 .modules td.distrib img { 1976 1976 display: block; 1977 1977 float: right; 1978 } 1979 .modules dt { 1980 font-weight: bold; 1981 } 1982 .modules a.details { 1983 background: transparent url(search.png) no-repeat 2px 2px; 1984 padding: 4px 4px 0 20px; 1985 } 1986 .modules a.support { 1987 background: transparent url(../images/page_help.png) no-repeat 2px 2px; 1988 padding: 4px 4px 0 20px; 1978 1989 } 1979 1990 /* ---------------------------------------------------------- post.php, page.php */
Note: See TracChangeset
for help on using the changeset viewer.