merge
authorcavaliet
Fri, 24 Feb 2012 10:55:01 +0100
changeset 77 021131fbe2c5
parent 76 bb7808e180c3 (diff)
parent 75 ca2a145e67f3 (current diff)
child 78 130e95ca5049
merge
Controller/WikiTagController.php
DependencyInjection/Configuration.php
DependencyInjection/WikiTagExtension.php
Resources/public/css/wikiTag.css
Utils/WikiTagUtils.php
--- a/Controller/WikiTagController.php	Thu Feb 23 23:02:07 2012 +0100
+++ b/Controller/WikiTagController.php	Fri Feb 24 10:55:01 2012 +0100
@@ -107,6 +107,7 @@
         }
         
         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
+        //$ordered_tags = null;
         return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array));
     }
 
--- a/DependencyInjection/Configuration.php	Thu Feb 23 23:02:07 2012 +0100
+++ b/DependencyInjection/Configuration.php	Fri Feb 24 10:55:01 2012 +0100
@@ -73,6 +73,12 @@
                     ->prototype('variable')
                     ->end()
                 ->end()
+                ->arrayNode('curl_options')
+                    ->treatNullLike(array())
+                    ->useAttributeAsKey('name')
+                    ->prototype('variable')
+                    ->end()
+                ->end()
             ->end();
         
         return $treeBuilder;
--- a/DependencyInjection/WikiTagExtension.php	Thu Feb 23 23:02:07 2012 +0100
+++ b/DependencyInjection/WikiTagExtension.php	Fri Feb 24 10:55:01 2012 +0100
@@ -61,5 +61,6 @@
         $container->setParameter("wiki_tag.route_for_documents_by_tag", $config['route_for_documents_by_tag']);
         $container->setParameter("wiki_tag.reactive_selectors", $config['reactive_selectors']);
         $container->setParameter("wiki_tag.document_list_profile", $config['document_list_profile']);
+        $container->setParameter("wiki_tag.curl_options", $config['curl_options']);
     }
 }
--- a/Resources/public/css/wikiTag.css	Thu Feb 23 23:02:07 2012 +0100
+++ b/Resources/public/css/wikiTag.css	Fri Feb 24 10:55:01 2012 +0100
@@ -19,6 +19,7 @@
     float: left;
     overflow: auto;
     width: 100%;
+    min-height: 300px;
 }
 #wikitag_table {
     width: 100%;
--- a/Utils/WikiTagUtils.php	Thu Feb 23 23:02:07 2012 +0100
+++ b/Utils/WikiTagUtils.php	Fri Feb 24 10:55:01 2012 +0100
@@ -208,9 +208,25 @@
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-        //TODO: change
-        curl_setopt($ch, CURLOPT_USERAGENT, 'http://www.iri.centrepompidou.fr');
+        // default values
+        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.1) Gecko/20100101 Firefox/10.0.1');
         curl_setopt($ch, CURLOPT_TIMEOUT_MS, 5000);
+        // Set options if they are set in the config.yml file, typically for proxy configuration.
+        // Thanks to the configuration file, it will execute commands like "curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);" or "curl_setopt($ch, CURLOPT_PROXY, "xxx.yyy.zzz:PORT");"
+        $curl_options = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.curl_options");
+        foreach ($curl_options as $key => $value) {
+            if(strtoupper($value)=='TRUE'){
+                $value = TRUE;
+            }
+            else if (strtoupper($value)=='FALSE'){
+                $value = FALSE;
+            }
+            else if (defined($value)){
+                $value = constant($value);
+            }
+            curl_setopt($ch, constant($key), $value);
+        }
+        // end of treatment
         $res = curl_exec($ch);
         $curl_errno = curl_errno($ch);
         $curl_error = curl_error($ch);