Changeset 46

Show
Ignore:
Timestamp:
10/04/07 17:25:00 (6 years ago)
Author:
d0nut
Message:

Patched tagging up to version 0.2 - It's the first runnable version, which allows saving and editing tags.
The javascript library had the problem that it only could run with present data. This is fixed.

Location:
taggingreloaded
Files:
21 added
4 modified

Legend:

Unmodified
Added
Removed
  • taggingreloaded/files/js/TaggingReloaded.class.js

    r43 r46  
    4040         
    4141        /** 
    42          * onsubmit handler for adding a new string 
     42         * handler for reading text and generating tags 
     43         * @param text 
     44         * @return -> always returns false to stop form processing 
     45         */ 
     46        this.formfetch = function(ob) { 
     47         
     48         
     49                return false; 
     50        } 
     51         
     52        /** 
     53         * handler for adding a new string 
    4354         * @param ob -> HTML element of the type input 
    4455         * @return -> always returns false to stop form processing 
     
    4960                 
    5061                var elems = root.getElementsByTagName('div'); 
    51                  
    52                 for(var i=0; i<elems.length; i++) { 
    53                         for(var j=0; j<val.length; j++) { 
    54                                 if(elems[i].firstChild.data == val[j]) { 
    55                                         elems[i].firstChild.nextSibling.nextSibling.value = arith(elems[i].firstChild.nextSibling.nextSibling.value,+5); 
    56                                         elems[i].style.fontSize = elems[i].firstChild.nextSibling.nextSibling.value+'%'; 
    57                                         highlight(elems[i], timer.length); 
    58                                         val[j] = null; 
    59                                 } else if(i == elems.length - 1 && val[j] != null) { 
    60                                         highlight(this.add(val[j], 100), timer.length); 
    61                                         break; 
     62 
     63                for(var i=0; i<val.length; i++) { 
     64                        for(var j=0; j<elems.length; j++) { 
     65                                if(elems[j] && elems[j].firstChild.data == val[i]) { 
     66                                        elems[j].firstChild.nextSibling.nextSibling.value = arith(elems[j].firstChild.nextSibling.nextSibling.value,+5); 
     67                                        elems[j].style.fontSize = elems[j].firstChild.nextSibling.nextSibling.value+'%'; 
     68                                        highlight(elems[j], timer.length); 
     69                                        val[i] = null; 
    6270                                } 
     71                        } 
     72                        if(val[i] != null) { 
     73                                highlight(this.add(val[i], 100), timer.length); 
    6374                        } 
    6475                } 
     
    7889                div.onmousedown = function (event) { dragstart(this) }; 
    7990                div.style.position = 'absolute'; 
    80                 div.style.left = Math.round(Math.random(10,100)*350)+'px' 
    81                 div.style.top = Math.round(Math.random(10,100)*250)+'px'; 
     91                div.style.left = Math.round(Math.random()*arith(root.offsetWidth)*0.9)+'px' 
     92                div.style.top = Math.round(Math.random()*arith(root.offsetHeight)*0.9)+'px'; 
    8293                div.style.cursor = 'pointer'; 
    8394                div.style.fontSize = size+'%'; 
     
    101112                return div; 
    102113        } 
     114         
     115        /** 
     116         * trims string 
     117         * @param str -> input string 
     118         * @return trimmed string 
     119         */ 
     120        var trim = function(str) { 
     121                str = str.replace(/^\s+/, ''); 
     122                str = str.replace(/\s+$/, ''); 
     123                 
     124                return str; 
     125        } 
    103126 
    104127        /** 
     
    165188                var bottom = top + dragobject.offsetHeight; 
    166189 
    167                 if(left+10 < 0 || right-10 > pxtoint(root.style.width) || top+10 < 0 || bottom-10 > pxtoint(root.style.height)) { 
     190                if(left+10 < 0 || right-10 > root.offsetWidth || top+10 < 0 || bottom-10 > root.offsetHeight) { 
    168191                        remove(dragobject); 
    169192                } 
  • taggingreloaded/files/lib/page/TaggingReloadedQueryPage.class.php

    r43 r46  
    11<?php 
    22require_once(WCF_DIR.'lib/acp/page/UserSuggestPage.class.php'); 
     3 
     4// Tagging util 
     5require_once(WCF_DIR.'lib/util/TaggingReloadedUtil.class.php'); 
    36 
    47/** 
     
    3235                $lang = $lang[0]; 
    3336 
    34                 $query = explode(' ', $this->query); 
     37                $query = TaggingUtil::text2tags($this->query); 
    3538                $stopwords = array(); 
    3639 
     
    4346                } 
    4447                 
    45                 $clean = array_diff($query, $stopwords); 
    46                  
    47                 //TODO: calculate weights 
    48                 ksort($clean); 
    49                 $this->results = $clean; 
     48                $this->results = array_diff($query, $stopwords); 
    5049        } 
    5150         
  • taggingreloaded/optionals/de.easy-coding.wbb.taggingreloaded/package.xml

    r43 r46  
    33<package name="de.easy-coding.wbb.taggingreloaded"> 
    44        <packageinformation> 
    5                 <packagename>Tagging Reloaded</packagename> 
     5                <packagename>Tagging Reloaded for WBB</packagename> 
    66                <packagedescription>Tagging Reloaded does not mean just tagging. It's much more!</packagedescription> 
    7                 <version>0.0.1</version> 
     7                <version>0.2.0</version> 
    88                <date>DATE</date> 
    99                <plugin>com.woltlab.wbb</plugin> 
     
    2323                <files>files.tar</files> 
    2424                <sql>install.sql</sql> 
    25                 <templatepatch>templates.diff</templatepatch> 
     25                <eventlistener>eventlistener.xml</eventlistener> 
    2626        </instructions> 
    2727</package> 
  • taggingreloaded/package.xml

    r43 r46  
    55                <packagename>Tagging Reloaded</packagename> 
    66                <packagedescription>Tagging Reloaded does not mean just tagging. It's much more!</packagedescription> 
    7                 <version>0.0.1</version> 
     7                <version>0.2.0</version> 
    88                <date>DATE</date> 
    99                <plugin>com.woltlab.wcf</plugin> 
     
    2727        <instructions type="install"> 
    2828                <files>files.tar</files> 
     29                <templates>templates.tar</templates> 
    2930                <sql>install.sql</sql> 
     31                <languages languagecode="de">de.xml</languages> 
     32                <languages languagecode="en">en.xml</languages> 
     33                <headermenu>headermenu.xml</headermenu> 
    3034        </instructions> 
    3135</package>