readonly possibility for tag table in document page
authorcavaliet
Mon, 16 Jul 2012 12:12:56 +0200
changeset 98 b307fcd1435a
parent 96 be6e1ae3965c
child 99 f938477c3376
readonly possibility for tag table in document page
Controller/WikiTagController.php
Resources/public/js/wikiTag.js
Resources/views/WikiTag/javascript.html.twig
--- a/Controller/WikiTagController.php	Wed May 16 18:17:19 2012 +0200
+++ b/Controller/WikiTagController.php	Mon Jul 16 12:12:56 2012 +0200
@@ -50,7 +50,7 @@
      * @param unknown_type $tags_list
      * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
      */
-    public function addJavascriptAction($tags_list=false, $profile_name=null)
+    public function addJavascriptAction($tags_list=false, $profile_name=null, $read_only="false")
     {
         $cats = $this->getDoctrine()->getRepository('WikiTagBundle:Category')->findOrderedCategories();
         // $cats is {"Label":"Créateur"},{"Label":"Datation"},...
@@ -68,7 +68,14 @@
         if($profile_array!=null && $profile_name!=null && $profile_name!=""){
             $columns_array = $profile_array[$profile_name];
         }
-        return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list, 'columns' => $columns_array));
+        // Set read_only if asked
+        if(strtolower($read_only)=="true"){
+            $read_only = true;
+        }
+        else{
+            $read_only = false;
+        }
+        return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list, 'columns' => $columns_array, 'read_only' => $read_only));
     }
 
     /**
--- a/Resources/public/js/wikiTag.js	Wed May 16 18:17:19 2012 +0200
+++ b/Resources/public/js/wikiTag.js	Mon Jul 16 12:12:56 2012 +0200
@@ -270,6 +270,7 @@
       }
     };
     $(document).ready(function(){
+        $("#wikitag_context_div").offset({left:0,top:0});
         for(c in reactive_selectors){
             $(reactive_selectors[c]).bind("mouseup", Kolich.Selector.mouseup);
         }
--- a/Resources/views/WikiTag/javascript.html.twig	Wed May 16 18:17:19 2012 +0200
+++ b/Resources/views/WikiTag/javascript.html.twig	Mon Jul 16 12:12:56 2012 +0200
@@ -98,7 +98,14 @@
     notInList.push(14);
     
     $(document).ready(function(){
-        wikitag_init_tags_events();
+      {% if read_only==true %}
+		// Hide/show column management.
+		$('#wikitag_table').columnManager({listTargetID:'wikitag_ul_target', onClass: 'wikitag_advon', offClass: 'wikitag_advoff', hideInList: notInList, saveState: true, colsHidden:columsToHide });
+		//create the clickmenu from the target
+		$('#wikitag_ulSelectColumn').clickMenu({onClick: function(){}});
+	  {% else %}
+	    wikitag_init_tags_events();
         wikitag_init_datasheet_events();
+	  {% endif %}
     });
 </script>
\ No newline at end of file