# HG changeset patch # User Zoe Hong # Date 1424858385 -3600 # Node ID a879f6b9d166ff936a35c642edb3e94e59dd80c4 # Parent a8ae5cbc336485b32fd5dcd1a09ba50c15a633e3 modification for select-move-taglist: tags don't appear to be duplicated in other topics. diff -r a8ae5cbc3364 -r a879f6b9d166 develop/index.php --- a/develop/index.php Tue Feb 24 17:29:56 2015 +0100 +++ b/develop/index.php Wed Feb 25 10:59:45 2015 +0100 @@ -19,17 +19,6 @@ require("controllers/home.php"); require("controllers/extractapp.php"); -/* -$output = '{"file":{"id":5,"creationDate":"11/02/2015-15:52","text":"Jorge 青城續修縣志第五册 藝文志 上 山左文人遞興一盛於邊廷實再盛於李滄 HHHH","creatorId":12,"fileName":"66666_3_5_2015.02.11_03.52.42.747.txt","info":"id=5, creation date=Wed Feb 11 15:52:42 CET 2015, last change=Wed Feb 11 15:52:42 CET 2015"},"branch":{"id":3,"creationDate":"11/02/2015-15:42","currentLastFileId":5,"sectionId":66666,"creatorId":12,"label":"qwe","info":"id=3, creation date=Wed Feb 11 15:42:36 CET 2015, last change=Wed Feb 11 15:52:42 CET 2015"}}'; -echo $output; - -$json = json_decode($output, true); - -echo "id="; -echo $json['file']['id']; -echo "
"; -*/ - // create the controller and execute the action diff -r a8ae5cbc3364 -r a879f6b9d166 develop/models/extractapp.php --- a/develop/models/extractapp.php Tue Feb 24 17:29:56 2015 +0100 +++ b/develop/models/extractapp.php Wed Feb 25 10:59:45 2015 +0100 @@ -633,12 +633,32 @@ $tag_tmp_others = array(); while ($row = mysql_fetch_assoc($result)) { if ($row['topic_id'] == $topic) { - array_push($tag_intopic, array('id=>'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id'])); + array_push($tag_intopic, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id'])); } else { - array_push($tag_tmp_others, array('id=>'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id'])); + array_push($tag_tmp_others, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id'])); } } + // check if there's any duplicated tags in tag_tmp_others. remove the duplicated tags + $num_others = count($tag_tmp_others); + for ($i=0; $i < $num_others; $i++) { + $cnt = 0; + for ($j=$i+1; $j < $num_others; $j++) { + if ($tag_tmp_others[$i]['tag'] == $tag_tmp_others[$j]['tag']) { + break; + } else { + $cnt++; + } + } + if ($cnt == ($num_others-$i-1) ) { + $row = $tag_tmp_others[$i]; + array_push($tag_others, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id']) ); + } + } + + // remove duplicated tags in tag_others that is duplicated with tags in tag_intopic + $tag_tmp_others = $tag_others; + $tag_others = array(); foreach ($tag_tmp_others as $tmp) { $cnt = 0; @@ -650,6 +670,7 @@ } } if ($cnt == count($tag_intopic)) { + // not appear in $tag_intopic array_push($tag_others, $tmp); } } @@ -723,7 +744,7 @@ /* -§ $query = "SELECT * FROM topic_tag_relation"; + $query = "SELECT * FROM topic_tag_relation"; $result = mysql_query($query); if (!$result) { echo json_encode("error when select from topic_tag_relation"); diff -r a8ae5cbc3364 -r a879f6b9d166 develop/views/Extractapp/configtagsintopic.php --- a/develop/views/Extractapp/configtagsintopic.php Tue Feb 24 17:29:56 2015 +0100 +++ b/develop/views/Extractapp/configtagsintopic.php Wed Feb 25 10:59:45 2015 +0100 @@ -85,10 +85,8 @@ -
-
-
- +
+

Topic:

@@ -105,7 +103,7 @@ ".$taglistValue['name']." (".$taglistValue['tag'].") ".""; } @@ -137,49 +135,9 @@ -
-
-
- - - diff -r a8ae5cbc3364 -r a879f6b9d166 develop/views/Extractapp/taggingtext.php --- a/develop/views/Extractapp/taggingtext.php Tue Feb 24 17:29:56 2015 +0100 +++ b/develop/views/Extractapp/taggingtext.php Wed Feb 25 10:59:45 2015 +0100 @@ -666,14 +666,14 @@
-
+
Config Topic:
current topic is
-
+
diff -r a8ae5cbc3364 -r a879f6b9d166 develop/views/maintemplate_local.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/develop/views/maintemplate_local.php Wed Feb 25 10:59:45 2015 +0100 @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file