Index: trunk/extensions/CategoryTree/CategoryTree.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $wgCategoryTreeHijackPageCategories = false; # EXPERIMENTAL! NOT YET FOR PRODUCTION USE! Main problem is general HTML/CSS layout cruftiness. |
67 | 67 | |
68 | 68 | $wgCategoryTreeExtPath = '/extensions/CategoryTree'; |
69 | | -$wgCategoryTreeVersion = '5'; # NOTE: bump this when you change the CSS or JS files! |
| 69 | +$wgCategoryTreeVersion = '6'; # NOTE: bump this when you change the CSS or JS files! |
70 | 70 | $wgCategoryTreeUseCategoryTable = version_compare( $wgVersion, "1.13", '>=' ); |
71 | 71 | |
72 | 72 | $wgCategoryTreeOmitNamespace = CT_HIDEPREFIX_CATEGORIES; |
Index: trunk/extensions/CategoryTree/CategoryTree.css |
— | — | @@ -21,6 +21,9 @@ |
22 | 22 | cursor: pointer; |
23 | 23 | cursor: hand; /* hack for MSIE 5.0 and 5.5 */ |
24 | 24 | } |
| 25 | +.CategoryTreeEmptyBullet { |
| 26 | + cursor: default; |
| 27 | +} |
25 | 28 | |
26 | 29 | .CategoryTreeBullet a, |
27 | 30 | .CategoryTreeBullet a:link, |
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php |
— | — | @@ -674,7 +674,6 @@ |
675 | 675 | $s .= Xml::openElement( 'div', array( 'class' => 'CategoryTreeItem' ) ); |
676 | 676 | |
677 | 677 | $attr = array( 'class' => 'CategoryTreeBullet' ); |
678 | | - $s .= Xml::openElement( 'span', $attr ); |
679 | 678 | |
680 | 679 | if ( $ns == NS_CATEGORY ) { |
681 | 680 | if ( $cat ) { |
— | — | @@ -685,44 +684,45 @@ |
686 | 685 | } else { |
687 | 686 | $count = $cat->getPageCount(); |
688 | 687 | } |
| 688 | + # Fix conversion to string for === |
| 689 | + $count = intval( $count ); |
689 | 690 | } |
| 691 | + if ( $count === 0 ) { |
| 692 | + $bullet = wfMsgNoTrans( 'categorytree-empty-bullet' ) . ' '; |
| 693 | + $attr['class'] = 'CategoryTreeEmptyBullet'; |
| 694 | + } else { |
| 695 | + $linkattr = array( ); |
| 696 | + if ( $load ) { |
| 697 | + $linkattr[ 'id' ] = $load; |
| 698 | + } |
690 | 699 | |
691 | | - $linkattr = array( ); |
692 | | - if ( $load ) { |
693 | | - $linkattr[ 'id' ] = $load; |
694 | | - } |
| 700 | + $linkattr[ 'class' ] = "CategoryTreeToggle"; |
| 701 | + $linkattr['style'] = 'display: none;'; // Unhidden by JS |
695 | 702 | |
696 | | - $linkattr[ 'class' ] = "CategoryTreeToggle"; |
697 | | - $linkattr['style'] = 'display: none;'; // Unhidden by JS |
698 | | - |
699 | | - if ( $children == 0 || $loadchildren ) { |
700 | | - $tag = 'span'; |
701 | | - if ( $count === 0 ) { |
702 | | - $txt = wfMsgNoTrans( 'categorytree-empty-bullet' ); |
| 703 | + if ( $children == 0 || $loadchildren ) { |
| 704 | + $tag = 'span'; |
| 705 | + $txt = wfMsgNoTrans( 'categorytree-expand-bullet' ); |
| 706 | + $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeExpandNode('" . Xml::escapeJsString( $key ) . "'," . $this->getOptionsAsJsStructure() . ",this);"; |
| 707 | + # Don't load this message for ajax requests, so that we don't have to initialise $wgLang |
| 708 | + $linkattr[ 'title' ] = $this->mIsAjaxRequest ? '##LOAD##' : wfMsgNoTrans( 'categorytree-expand' ); |
703 | 709 | } else { |
704 | | - $txt = wfMsgNoTrans( 'categorytree-expand-bullet' ); |
| 710 | + $tag = 'span'; |
| 711 | + $txt = wfMsgNoTrans( 'categorytree-collapse-bullet' ); |
| 712 | + $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeCollapseNode('" . Xml::escapeJsString( $key ) . "'," . $this->getOptionsAsJsStructure() . ",this);"; |
| 713 | + $linkattr[ 'title' ] = wfMsgNoTrans( 'categorytree-collapse' ); |
| 714 | + $linkattr[ 'class' ] .= ' CategoryTreeLoaded'; |
705 | 715 | } |
706 | | - $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeExpandNode('" . Xml::escapeJsString( $key ) . "'," . $this->getOptionsAsJsStructure() . ",this);"; |
707 | | - # Don't load this message for ajax requests, so that we don't have to initialise $wgLang |
708 | | - $linkattr[ 'title' ] = $this->mIsAjaxRequest ? '##LOAD##' : wfMsgNoTrans( 'categorytree-expand' ); |
709 | | - } else { |
710 | | - $tag = 'span'; |
711 | | - $txt = wfMsgNoTrans( 'categorytree-collapse-bullet' ); |
712 | | - $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeCollapseNode('" . Xml::escapeJsString( $key ) . "'," . $this->getOptionsAsJsStructure() . ",this);"; |
713 | | - $linkattr[ 'title' ] = wfMsgNoTrans( 'categorytree-collapse' ); |
714 | | - $linkattr[ 'class' ] .= ' CategoryTreeLoaded'; |
715 | | - } |
716 | 716 | |
717 | | - if ( $tag == 'a' ) { |
718 | | - $linkattr[ 'href' ] = $wikiLink; |
| 717 | + if ( $tag == 'a' ) { |
| 718 | + $linkattr[ 'href' ] = $wikiLink; |
| 719 | + } |
| 720 | + $bullet = Xml::openElement( $tag, $linkattr ) . $txt . Xml::closeElement( $tag ) . ' '; |
719 | 721 | } |
720 | | - $s .= Xml::openElement( $tag, $linkattr ) . $txt . Xml::closeElement( $tag ) . ' '; |
721 | 722 | } else { |
722 | | - $s .= wfMsgNoTrans( 'categorytree-page-bullet' ); |
| 723 | + $bullet = wfMsgNoTrans( 'categorytree-page-bullet' ); |
723 | 724 | } |
| 725 | + $s .= Xml::tags( 'span', $attr, $bullet ); |
724 | 726 | |
725 | | - $s .= Xml::closeElement( 'span' ); |
726 | | - |
727 | 727 | $s .= Xml::openElement( 'a', array( 'class' => $labelClass, 'href' => $wikiLink ) ) . $label . Xml::closeElement( 'a' ); |
728 | 728 | |
729 | 729 | if ( $count !== false && $this->getOption( 'showcount' ) ) { |