Changeset 2354:d388f7fdcb4e
- Timestamp:
- 10/13/13 21:55:41 (12 years ago)
- Branch:
- 2.6
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_plugins.js
r2353 r2354 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)).length53 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 content72 $.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 bloc = document.createElement('ul');81 bloc.className = "mod-more";82 83 if (author) {84 $(bloc).append($('<li class="module-author">'+dotclear.msg.module_author+' '+author+'</li>'));85 }86 if (details) {87 var dd = '';88 dd += '<a class="module-details" href="'+details+'">'+dotclear.msg.module_details+'</a>';89 if (support) {90 dd += ' - ';91 dd += '<a class="module-support" href="'+support+'">'+dotclear.msg.module_support+'</a>';92 }93 $(bloc).append($('<li>'+dd+'</li>'));94 }95 96 $(td).append($(box).append(bloc));97 98 var section = $(rsp).find('section').text();99 var tags = $(rsp).find('tags').text();100 101 var boxb = document.createElement('div');102 var blocb = document.createElement('ul');103 blocb.className = "mod-more";104 105 if (section) {106 $(blocb).append($('<li class="module-section">'+dotclear.msg.module_section+' '+section+'</li>'));107 }108 if (tags) {109 $(blocb).append($('<li class="module-tags">'+dotclear.msg.module_tags+' '+tags+'</li>'));110 }111 $(td).append($(boxb).append(blocb));112 } else {113 alert($(rsp).find('message').text());114 }115 });116 117 $(line).addClass('expand');118 line.parentNode.insertBefore(tr,line.nextSibling);119 }120 else if (tr && tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) )121 {122 $(tr).css('display', 'table-row');123 $(line).addClass('expand');124 img.src = dotclear.img_minus_src;125 img.alt = dotclear.img_minus_alt;126 }127 else if (tr && tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) )128 {129 $(tr).css('display', 'none');130 $(line).removeClass('expand');131 img.src = dotclear.img_plus_src;132 img.alt = dotclear.img_plus_alt;133 }134 135 parentTable = $(line).parents('table');136 if( parentTable.find('tr.expand').length == parentTable.find('tr.line').length ) {137 img = parentTable.find('tr:not(.line) th:first img');138 img.attr('src',dotclear.img_minus_src);139 img.attr('alt',dotclear.img_minus_alt);140 }141 142 if( parentTable.find('tr.expand').length == 0 ) {143 img = parentTable.find('tr:not(.line) th:first img');144 img.attr('src',dotclear.img_plus_src);145 img.attr('alt',dotclear.img_plus_alt);146 }147 148 };149 150 151 1 $(function() { 152 /*153 // expand all modules lines154 $('table.modules.expandable tr:not(.line)').each(function() {155 dotclear.modulesExpander(this,$('table.modules.expandable tr.line'));156 });157 */158 2 // expand a module line 159 $('table.modules.expandable tr.line').each(function() { 160 dotclear.moduleExpander(this); 3 $('table.modules.expandable tr.line').each(function(){ 4 $('td.module-name',this).toggleWithLegend($(this).next('.module-more'),{ 5 img_on_src: dotclear.img_plus_src, 6 img_on_alt: dotclear.img_plus_alt, 7 img_off_src: dotclear.img_minus_src, 8 img_off_alt: dotclear.img_minus_alt, 9 legend_click: true 10 }); 161 11 }); 162 12 -
admin/plugins.php
r2337 r2354 162 162 ->setModules($modules) 163 163 ->displayModules( 164 /* cols */ array('expander', 'icon', 'name', ' config', 'version', 'desc', 'distrib'),164 /* cols */ array('expander', 'icon', 'name', 'version', 'desc', 'distrib'), 165 165 /* actions */ array('deactivate', 'delete', 'behavior') 166 166 ); -
admin/style/default.css
r2352 r2354 2036 2036 padding: 4px 4px 0 20px; 2037 2037 } 2038 .modules a.module-config { 2039 /* todo: add icon here */ 2040 padding: 4px 4px 0 20px; 2041 } 2038 2042 #m_search { 2039 2043 background: transparent url(search.png) no-repeat 4px center; -
inc/admin/lib.moduleslist.php
r2351 r2354 552 552 553 553 if (in_array('distrib', $cols)) { 554 echo '<th'.(in_array('desc', $cols) ? '' : ' class="maximal"').'></th>'; 554 echo 555 '<th'.(in_array('desc', $cols) ? '' : ' class="maximal"').'></th>'; 555 556 } 556 557 … … 586 587 echo 587 588 '<tr class="line" id="'.html::escapeHTML($this->list_id).'_m_'.html::escapeHTML($id).'">'; 589 590 $tds = 0; 588 591 589 592 if (in_array('icon', $cols)) { 593 $tds++; 590 594 echo 591 595 '<td class="module-icon nowrap">'.sprintf( … … 595 599 } 596 600 597 # Link to config file 598 $config = in_array('config', $cols) && !empty($module['root']) && file_exists(path::real($module['root'].'/_config.php')); 599 601 $tds++; 600 602 echo 601 '<td class="module-name nowrap" scope="row">'.($config ? 602 '<a href="'.$this->getURL('module='.$id.'&conf=1').'" title"'.sprintf(__('Configure module "%s"'), html::escapeHTML($module['name'])).'">'.html::escapeHTML($module['name']).'</a>' : 603 html::escapeHTML($module['name']) 604 ).'</td>'; 603 '<td class="module-name nowrap" scope="row">'.html::escapeHTML($module['name']).'</td>'; 605 604 606 605 # Display score only for debug purpose 607 606 if (in_array('score', $cols) && $this->getSearch() !== null && defined('DC_DEBUG') && DC_DEBUG) { 607 $tds++; 608 608 echo 609 609 '<td class="module-version nowrap count"><span class="debug">'.$module['score'].'</span></td>'; … … 611 611 612 612 if (in_array('version', $cols)) { 613 $tds++; 613 614 echo 614 615 '<td class="module-version nowrap count">'.html::escapeHTML($module['version']).'</td>'; … … 616 617 617 618 if (in_array('current_version', $cols)) { 619 $tds++; 618 620 echo 619 621 '<td class="module-current-version nowrap count">'.html::escapeHTML($module['current_version']).'</td>'; … … 621 623 622 624 if (in_array('desc', $cols)) { 625 $tds++; 623 626 echo 624 627 '<td class="module-desc maximal">'.html::escapeHTML($module['desc']).'</td>'; … … 626 629 627 630 if (in_array('distrib', $cols)) { 631 $tds++; 628 632 echo 629 633 '<td class="module-distrib">'.(self::isDistributedModule($id) ? … … 637 641 $buttons = $this->getActions($id, $module, $actions); 638 642 643 $tds++; 639 644 echo 640 645 '<td class="module-actions nowrap">'. … … 655 660 echo 656 661 '</tr>'; 662 663 # Other informations 664 if (in_array('expander', $cols)) { 665 echo 666 '<tr class="module-more"><td colspan="'.$tds.'" class="expand">'; 667 668 if (!empty($module['author']) || !empty($module['details']) || !empty($module['support'])) { 669 echo 670 '<div><ul class="mod-more">'; 671 672 if (!empty($module['author'])) { 673 echo 674 '<li class="module-author">'.__('Author:').' '.html::escapeHTML($module['author']).'</li>'; 675 } 676 677 $more = array(); 678 if (!empty($module['details'])) { 679 $more[] = '<a class="module-details" href="'.$module['details'].'">'.__('Details').'</a>'; 680 } 681 682 if (!empty($module['support'])) { 683 $more[] = '<a class="module-support" href="'.$module['support'].'">'.__('Support').'</a>'; 684 } 685 686 if (!empty($more)) { 687 echo 688 '<li>'.implode(' - ', $more).'</li>'; 689 } 690 691 echo 692 '</ul></div>'; 693 } 694 695 $config = !empty($module['root']) && file_exists(path::real($module['root'].'/_config.php')); 696 697 if ($config || !empty($module['section']) || !empty($module['section'])) { 698 echo 699 '<div><ul class="mod-more">'; 700 701 if ($config) { 702 echo 703 '<li><a class="module-config" href="'.$this->getURL('module='.$id.'&conf=1').'">'.__('Configure plugin').'</a></li>'; 704 } 705 706 if (!empty($module['section'])) { 707 echo 708 '<li class="module-section">'.__('Section:').' '.html::escapeHTML($module['section']).'</li>'; 709 } 710 711 if (!empty($module['section'])) { 712 echo 713 '<li class="module-tags">'.__('Tags:').' '.html::escapeHTML($module['tags']).'</li>'; 714 } 715 716 echo 717 '</ul></div>'; 718 } 719 720 echo 721 '</td></tr>'; 722 } 657 723 658 724 $count++;
Note: See TracChangeset
for help on using the changeset viewer.