Changeset 50

Show
Ignore:
Timestamp:
10/06/07 18:05:49 (6 years ago)
Author:
d0nut
Message:

runnable tagging version with userprofile integration and page integration.

Location:
taggingreloaded
Files:
4 added
13 modified
1 moved

Legend:

Unmodified
Added
Removed
  • taggingreloaded/de.xml

    r49 r50  
    55                <item name="wcf.taggingreloaded.tagging"><![CDATA[Tagging]]></item> 
    66                <item name="wcf.taggingreloaded.description"><![CDATA[Hier finden Sie unsere Tags. Das Ergebnis gemeinschaftlicher Indexierung.]]></item> 
     7                <item name="wcf.taggingreloaded.notags"><![CDATA[Es sind noch keine Tags verfÃŒgbar.]]></item> 
     8                <item name="wcf.taggingreloaded.copyright"><![CDATA[Powered by WCF::TaggingReloaded]]></item> 
     9                <item name="wcf.taggingreloaded.weight"><![CDATA[Gewichtung]]></item> 
    710                <item name="wcf.taggingreloaded.add"><![CDATA[HinzufÃŒgen]]></item> 
    811                <item name="wcf.taggingreloaded.fetch"><![CDATA[Auto]]></item> 
     12        </category> 
     13         
     14        <category name="wcf.user.option"> 
     15                <item name="wcf.user.option.category.tagging"><![CDATA[Tagging]]></item> 
     16                <item name="wcf.user.option.tagging"><![CDATA[Tagging]]></item> 
    917        </category> 
    1018         
  • taggingreloaded/en.xml

    r49 r50  
    55                <item name="wcf.taggingreloaded.tagging"><![CDATA[Tagging]]></item> 
    66                <item name="wcf.taggingreloaded.description"><![CDATA[Here you can find our tags. The results of collaborative indexing.]]></item> 
     7                <item name="wcf.taggingreloaded.notags"><![CDATA[There aren't any tags at the moment.]]></item> 
     8                <item name="wcf.taggingreloaded.copyright"><![CDATA[Powered by WCF::TaggingReloaded]]></item> 
     9                <item name="wcf.taggingreloaded.weight"><![CDATA[Weight]]></item> 
    710                <item name="wcf.taggingreloaded.add"><![CDATA[Add]]></item> 
    811                <item name="wcf.taggingreloaded.fetch"><![CDATA[Auto]]></item> 
     12        </category> 
     13         
     14        <category name="wcf.user.option"> 
     15                <item name="wcf.user.option.category.tagging"><![CDATA[Tagging]]></item> 
     16                <item name="wcf.user.option.tagging"><![CDATA[Tagging]]></item> 
    917        </category> 
    1018 
  • taggingreloaded/files/lib/page/TaggingPage.class.php

    r49 r50  
    5050                                                'size'=> 0 
    5151                                        ); 
     52                                $i++; 
    5253                        } 
    5354                         
     
    6162        public function assignVariables() { 
    6263                parent::assignVariables(); 
     64                 
     65                if(empty($this->tag)) { 
     66                        $title = WCF::getLanguage()->get('wcf.header.menu.tagging'); 
     67                        $headline = WCF::getLanguage()->get('wcf.taggingreloaded.tagging'); 
     68                        $desc = WCF::getLanguage()->get('wcf.taggingreloaded.description'); 
     69                } else { 
     70                        $title = $this->tag . ' - ' . WCF::getLanguage()->get('wcf.header.menu.tagging'); 
     71                        $headline = $this->tag; 
     72                        $desc = WCF::getLanguage()->get('wcf.taggingreloaded.tagging'); 
     73                } 
    6374 
    64                 WCF::getTPL()->assign('tags', $this->tags); 
    65                 WCF::getTPL()->append('additionalTaggingContents', WCF::getTPL()->fetch('taggingCloud'));                
    66                 WCF::getTPL()->assign('specialStyles', '<link rel="stylesheet" type="text/css" href="'.RELATIVE_WCF_DIR.'style/taggingreloaded.css" />'); 
     75                WCF::getTPL()->assign(array( 
     76                        'title' => $title, 
     77                        'headline' => $headline, 
     78                        'desc' => $desc, 
     79                        'tags' => $this->tags, 
     80                        'specialStyles' => '<link rel="stylesheet" type="text/css" href="'.RELATIVE_WCF_DIR.'style/taggingreloaded.css" />', 
     81                        'allowSpidersToIndexThisPage' => true 
     82                        )); 
     83                 
     84                WCF::getTPL()->append('additionalTaggingContents', WCF::getTPL()->fetch('taggingCloud')); 
    6785        } 
    6886         
  • taggingreloaded/files/style/taggingreloaded.css

    r49 r50  
    1 .taggingCloud ul { 
     1ul.taggingCloud { 
    22 margin:0px; 
    33 padding:0px; 
    44} 
    55 
    6 .taggingCloud li { 
     6ul.taggingCloud li { 
    77  display:inline; 
    88  list-style-type:none; 
     
    1010} 
    1111 
    12 .taggingCloud li a { 
     12ul.taggingCloud li a { 
    1313  text-decoration:none; 
    1414} 
    1515 
    16 .taggingCloud li a:hover { 
     16ul.taggingCloud li a:hover { 
    1717  text-decoration:underline; 
    1818} 
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/eventlistener.xml

    r46 r50  
    33<data>   
    44        <import> 
     5                <eventlistener><!-- wcf: tagging page //--> 
     6                        <eventclassname>TaggingPage</eventclassname> 
     7                        <eventname>assignVariables</eventname> 
     8                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
     9                </eventlistener> 
     10                <eventlistener> 
     11                        <eventclassname>TaggingPage</eventclassname> 
     12                        <eventname>readData</eventname> 
     13                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
     14                </eventlistener> 
     15                <eventlistener> 
     16                        <eventclassname>TaggingPage</eventclassname> 
     17                        <eventname>readParameters</eventname> 
     18                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
     19                </eventlistener> 
    520                <eventlistener><!-- wbb: board page //--> 
    621                        <eventclassname>BoardPage</eventclassname> 
    722                        <eventname>assignVariables</eventname> 
    8                         <listenerclassfile>lib/system/event/listener/TaggingReloadedPageListener.class.php</listenerclassfile> 
     23                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
    924                </eventlistener> 
    1025                <eventlistener> 
    1126                        <eventclassname>BoardPage</eventclassname> 
    1227                        <eventname>readData</eventname> 
    13                         <listenerclassfile>lib/system/event/listener/TaggingReloadedPageListener.class.php</listenerclassfile> 
     28                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
    1429                </eventlistener> 
    1530                <eventlistener> 
    1631                        <eventclassname>BoardPage</eventclassname> 
    1732                        <eventname>readParameters</eventname> 
    18                         <listenerclassfile>lib/system/event/listener/TaggingReloadedPageListener.class.php</listenerclassfile> 
     33                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
    1934                </eventlistener> 
    2035                <eventlistener><!-- wbb: thread page //--> 
    2136                        <eventclassname>ThreadPage</eventclassname> 
    2237                        <eventname>assignVariables</eventname> 
    23                         <listenerclassfile>lib/system/event/listener/TaggingReloadedPageListener.class.php</listenerclassfile> 
     38                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
    2439                </eventlistener> 
    2540                <eventlistener> 
    2641                        <eventclassname>ThreadPage</eventclassname> 
    2742                        <eventname>readData</eventname> 
    28                         <listenerclassfile>lib/system/event/listener/TaggingReloadedPageListener.class.php</listenerclassfile> 
     43                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
    2944                </eventlistener> 
    3045                <eventlistener> 
    3146                        <eventclassname>ThreadPage</eventclassname> 
    3247                        <eventname>readParameters</eventname> 
    33                         <listenerclassfile>lib/system/event/listener/TaggingReloadedPageListener.class.php</listenerclassfile> 
     48                        <listenerclassfile>lib/system/event/listener/TaggingReloadedWBBPageListener.class.php</listenerclassfile> 
    3449                </eventlistener> 
    3550                 
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/files/lib/system/event/listener/TaggingReloadedWBBMessageFormListener.class.php

    r49 r50  
    9898                 
    9999                // CLEANUP 
    100                 $sql = "DELETE FROM     wbb".WBB_N."_taggingreloaded  
     100                $sql = "DELETE FROM     wbb".WBB_N."_taggingreloaded,  
     101                                        wcf".WCF_N."_taggingreloaded 
     102                        USING           wbb".WBB_N."_taggingreloaded 
     103                        NATURAL JOIN    wcf".WCF_N."_taggingreloaded 
    101104                        WHERE           userID = ".WCF::getUser()->userID."  
    102105                        AND             postID = {$postID};"; 
    103  
    104                 // TODO: cleanup WCF_taggingreloaded!!! 
    105106 
    106107                WBBCore::getDB()->sendQuery($sql); 
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/files/lib/system/event/listener/TaggingReloadedWBBPageListener.class.php

    r49 r50  
    22// wcf imports 
    33require_once(WCF_DIR.'lib/system/event/EventListener.class.php'); 
     4 
     5// wbb imports 
     6require_once(WBB_DIR.'lib/data/thread/ViewableThreadTagging.class.php'); 
     7require_once(WBB_DIR.'lib/data/board/Board.class.php'); 
    48 
    59// tagging imports 
     
    1418 * @license     GNU General Public License <http://opensource.org/licenses/gpl-license.php> 
    1519 */ 
    16 class TaggingReloadedPageListener implements EventListener { 
    17         protected $threadID=0, $boards=array(); 
     20class TaggingReloadedWBBPageListener implements EventListener { 
     21        protected $threadID=0, $boards=array(), $tag; // params 
     22         
     23        // data 
    1824        protected $tags = array(); 
     25        protected $threadList = array(); 
    1926 
    2027        protected $eventObj; 
     
    4249         
    4350        /** 
     51         * reads similar tags 
     52         */ 
     53        protected function queryTagsByTag() { 
     54                // order by weight and cut 
     55                $sql = "SELECT          wcf2.tag, 
     56                                        SUM(wcf2.weight) AS weight 
     57                        FROM            wcf".WCF_N."_taggingreloaded wcf 
     58                        NATURAL JOIN    wbb".WBB_N."_taggingreloaded wbb 
     59                        NATURAL JOIN    wbb".WBB_N."_post p 
     60                        JOIN            wbb".WBB_N."_taggingreloaded wbb2 
     61                        ON              p.postID = wbb2.postID 
     62                        JOIN            wcf".WCF_N."_taggingreloaded wcf2 
     63                        ON              wbb2.taggingID = wcf2.taggingID 
     64                        WHERE           wcf.tag = '".escapeString($this->tag)."' 
     65                        GROUP BY        wcf2.tag 
     66                        ORDER BY        weight DESC 
     67                        LIMIT           50"; 
     68 
     69                return $sql; 
     70        } 
     71         
     72        /** 
     73         * reads by board 
     74         */ 
     75        protected function queryTagsByBoard() { 
     76                // order by weight and cut 
     77                $sql = "SELECT          tag, 
     78                                        SUM(weight) AS weight 
     79                        FROM            wcf".WCF_N."_taggingreloaded wcf 
     80                        NATURAL JOIN    wbb".WBB_N."_taggingreloaded wbb 
     81                        NATURAL JOIN    wbb".WBB_N."_thread t 
     82                        NATURAL JOIN    wbb".WBB_N."_post p 
     83                        WHERE           t.boardID IN (".implode(',', $this->boards).") 
     84                        GROUP BY        tag 
     85                        ORDER BY        weight DESC 
     86                        LIMIT           50"; 
     87 
     88                return $sql; 
     89        } 
     90         
     91        /** 
     92         * reads by thread 
     93         */ 
     94        protected function queryTagsByThread() { 
     95                // order by weight and cut 
     96                $sql = "SELECT          tag, 
     97                                        SUM(weight) AS weight 
     98                        FROM            wcf".WCF_N."_taggingreloaded wcf 
     99                        NATURAL JOIN    wbb".WBB_N."_taggingreloaded wbb 
     100                        NATURAL JOIN    wbb".WBB_N."_post p 
     101                        WHERE           p.threadID = {$this->threadID} 
     102                        GROUP BY        tag 
     103                        ORDER BY        weight DESC 
     104                        LIMIT           50"; 
     105                //      SUM( weight ) * IF(COUNT(tag), 1.2, 1 ) 
     106 
     107                return $sql; 
     108        } 
     109         
     110        /** 
     111         * reads threads by tag 
     112         */ 
     113        protected function readThreadsByTag() { 
     114                $sql = "SELECT          t.*, 
     115                                        tag, 
     116                                        SUM(weight) AS weight 
     117                        FROM            wcf".WCF_N."_taggingreloaded wcf 
     118                        NATURAL JOIN    wbb".WBB_N."_taggingreloaded wbb 
     119                        NATURAL JOIN    wbb".WBB_N."_post p 
     120                        NATURAL JOIN    wbb".WBB_N."_thread t 
     121                        WHERE           tag = '".escapeString($this->tag)."' 
     122                        GROUP BY        p.threadID 
     123                        ORDER BY        weight DESC 
     124                        LIMIT           15"; 
     125 
     126                $result = WCF::getDB()->sendQuery($sql); 
     127                while ($row = WCF::getDB()->fetchArray($result)) { 
     128                        $row['permission'] = Board::getBoard($row['boardID'])->getPermission('canReadThread'); 
     129                        $this->threadList[] = new ViewableThreadTagging(null, $row); 
     130                } 
     131        } 
     132         
     133        /** 
    44134         * @see Page::readData() 
    45135         */ 
    46136        protected function readData () { 
    47                 $joins = ""; 
    48                 $conditions = ""; 
    49  
    50137                if($this->threadID) { 
    51                         $conditions = "p.threadID = {$this->threadID}"; 
     138                        $sql = $this->queryTagsByThread(); 
    52139                } else if(count($this->boards)>0) { 
    53                         $joins = "NATURAL JOIN wbb".WBB_N."_thread t"; 
    54                         $conditions = "t.boardID IN (".implode(',', $this->boards).")"; 
    55                 } else { 
    56                         return; 
    57                 } 
    58  
    59                 // order by weight and cut 
    60                 $sql = "SELECT          tag, 
    61                                         SUM(weight) AS weight 
    62                         FROM            wcf".WCF_N."_taggingreloaded wcf 
    63                         NATURAL JOIN    wbb".WBB_N."_taggingreloaded wbb 
    64                         ".$joins." 
    65                         NATURAL JOIN    wbb".WBB_N."_post p 
    66                         WHERE           ".$conditions." 
    67                         GROUP BY        tag 
    68                         ORDER BY        weight DESC 
    69                         LIMIT           50"; 
    70                 //      SUM( weight ) * IF(COUNT(tag), 1.2, 1 ) 
     140                        $sql = $this->queryTagsByBoard(); 
     141                } else if($this->tag) { 
     142                        $check = true; 
     143                        $this->readThreadsByTag(); 
     144                        $sql = $this->queryTagsByTag(); 
     145                } 
     146                 
     147                // break 
     148                if(!isset($sql)) return; 
    71149 
    72150                // order by tag 
     
    84162                 
    85163                $this->tags = TaggingReloadedUtil::beautify($this->tags); 
     164                 
     165                if(isset($check) && count($this->tags) == 0) { 
     166                        require_once(WCF_DIR.'lib/system/exception/IllegalLinkException.class.php'); 
     167                        throw new IllegalLinkException(); 
     168                } 
    86169        } 
    87170 
     
    90173         */ 
    91174        protected function readParameters () { 
    92                 if (isset($_GET['threadID'])) $this->threadID = intval($_GET['threadID']); 
    93                 if (isset($_GET['boardID'])) { 
     175                if (isset($_GET['threadID'])) { 
     176                        $this->threadID = intval($_GET['threadID']); 
     177                } 
     178                else if (isset($_GET['boardID'])) { 
    94179                        $boardID = intval($_GET['boardID']); 
    95180                        $boardList = new BoardListTaggingReloaded($boardID); 
     
    98183                        $this->boards[] = $boardID; 
    99184                } 
     185                else if(isset($_GET['tag'])) { 
     186                        $this->tag = $_GET['tag']; 
     187                } 
    100188        } 
    101189         
     
    117205                WCF::getTPL()->assign('tags', $this->tags); 
    118206                WCF::getTPL()->assign('specialStyles', '<link rel="stylesheet" type="text/css" href="'.RELATIVE_WCF_DIR.'style/taggingreloaded.css" />'); 
    119                 WCF::getTPL()->append('additionalBoxes', WCF::getTPL()->fetch('taggingCloudContainer')); 
     207                 
     208                if($this->threadID || count($this->boards)>0) { 
     209                        WCF::getTPL()->append('additionalBoxes', WCF::getTPL()->fetch('taggingCloudContainer')); 
     210                } else if($this->tag) { 
     211                        WCF::getTPL()->assign('threads', $this->threadList); 
     212                        WCF::getTPL()->append('additionalTaggingContents', WCF::getTPL()->fetch('taggingCloud')); 
     213                        WCF::getTPL()->append('additionalTaggingContents', WCF::getTPL()->fetch('threadListTagging')); 
     214                } 
    120215        } 
    121216} 
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/install.sql

    r43 r50  
    11-- WBB 
    22CREATE TABLE wbb1_1_taggingreloaded ( 
    3   taggingID int(10) unsigned NOT NULL, 
     3  taggingID int(10) unsigned NOT NULL auto_increment, 
    44  postID int(10) unsigned NOT NULL, 
    55  PRIMARY KEY (taggingID) 
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/package.xml

    r46 r50  
    55                <packagename>Tagging Reloaded for WBB</packagename> 
    66                <packagedescription>Tagging Reloaded does not mean just tagging. It's much more!</packagedescription> 
    7                 <version>0.2.0</version> 
     7                <version>0.3.0</version> 
    88                <date>DATE</date> 
    99                <plugin>com.woltlab.wbb</plugin> 
     
    2222        <instructions type="install"> 
    2323                <files>files.tar</files> 
     24                <templates>templates.tar</templates> 
    2425                <sql>install.sql</sql> 
    2526                <eventlistener>eventlistener.xml</eventlistener> 
  • taggingreloaded/package.xml

    r46 r50  
    55                <packagename>Tagging Reloaded</packagename> 
    66                <packagedescription>Tagging Reloaded does not mean just tagging. It's much more!</packagedescription> 
    7                 <version>0.2.0</version> 
     7                <version>0.3.0</version> 
    88                <date>DATE</date> 
    99                <plugin>com.woltlab.wcf</plugin> 
     
    2727        <instructions type="install"> 
    2828                <files>files.tar</files> 
     29                <eventlistener>eventlistener.xml</eventlistener> 
    2930                <templates>templates.tar</templates> 
    3031                <sql>install.sql</sql> 
  • taggingreloaded/templates/messageFormTaggingReloaded.tpl

    r46 r50  
    2020        </script> 
    2121 
    22         <input type="button" value="fetch" onclick="tagging.formfetch(this.form.text.value);" /> 
     22        <!--<input type="button" value="fetch" onclick="tagging.formfetch(this.form.text.value);" />//--> 
    2323        <input type="button" value="add" onclick="tagging.formadd(this.form.inputTagging);" /> 
    2424</div> 
  • taggingreloaded/templates/taggingCloud.tpl

    r49 r50  
    1 <ul> 
     1<ul class="taggingCloud" name="taggingCloud"> 
    22{foreach from=$tags key=tag item=i} 
    3         <li style="font-size:{$i.size}%;color:rgb({$i.color},{$i.color},{$i.color})"><!--<a href="index.php?page=Tagging&amp;tag={$tag|urlencode}">//-->{@$tag}</li> 
     3        <li style="font-size:{$i.size}%;color:rgb({$i.color},{$i.color},{$i.color})"><a href="index.php?page=Tagging&amp;tag={$tag|urlencode}">{@$tag}</a></li> 
    44{/foreach} 
    55</ul> 
  • taggingreloaded/templates/taggingCloudContainer.tpl

    r49 r50  
    11{if $tags|count} 
    2 <div class="container-1 taggingCloud"> 
     2<div class="container-1"> 
    33        <div class="containerIcon"><img src="{@RELATIVE_WCF_DIR}icon/tagging24.png" alt="" /></div> 
    44        <div class="containerContent"> 
  • taggingreloaded/templates/taggingReloaded.tpl

    r49 r50  
    11{include file="documentHeader"} 
    22<head> 
    3         <title>{lang}wcf.header.menu.map{/lang} - {PAGE_TITLE}</title> 
     3        <title>{$title} - {PAGE_TITLE}</title> 
    44 
    55        {include file='headInclude' sandbox=false} 
     
    1515                <img src="{@RELATIVE_WCF_DIR}icon/tagging48.png" alt="" /> 
    1616                <div class="headlineContainer"> 
    17                         <h2> {lang}wcf.taggingreloaded.tagging{/lang}</h2> 
    18                         <p>{lang}wcf.taggingreloaded.description{/lang}</p> 
     17                        <h2> {$headline}</h2> 
     18                        <p>{$desc}</p> 
    1919                </div> 
    2020        </div> 
    2121        <div class="border"> 
    22                 <div class="container-1"> 
    23                         {if $additionalTaggingContents|isset}{@$additionalTaggingContents}{/if} 
    24                         {if $additionalTaggingBoxes|isset}{@$additionalTaggingBoxes}{/if} 
     22                <div class="container-1" style="padding:10px"> 
     23                        {if $additionalTaggingContents|isset || $additionalTaggingBoxes|isset} 
     24                                {if $additionalTaggingContents|isset}{@$additionalTaggingContents}{/if} 
     25                                {if $additionalTaggingBoxes|isset}{@$additionalTaggingBoxes}{/if} 
     26                        {else} 
     27                                 {lang}wcf.taggingreloaded.notags{/lang} 
     28                        {/if} 
     29 
     30                        <div style="text-align:right"><a href="http://www.easy-coding.de/trac/wcf/wiki/taggingreloaded" class="externalURL">{lang}wcf.taggingreloaded.copyright{/lang}</a></div> 
    2531                </div> 
    2632        </div>