Author: lombardot
Date: 2010-05-25 12:18:16 +0200 (Tue, 25 May 2010)
New Revision: 29614

Added:
   plugins/sfEmailMeAFireShotPlugin/i18n/
   plugins/sfEmailMeAFireShotPlugin/i18n/email_me_fireshot.fr.xml
   plugins/sfEmailMeAFireShotPlugin/modules/
   plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/
   plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/actions/
   
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/actions/actions.class.php
   plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/
   
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/emailOkSuccess.php
   
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/indexSuccess.php
   plugins/sfEmailMeAFireShotPlugin/web/css/
   plugins/sfEmailMeAFireShotPlugin/web/css/jquery.superbox.css
   plugins/sfEmailMeAFireShotPlugin/web/images/
   plugins/sfEmailMeAFireShotPlugin/web/images/loader.gif
   plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox-min.js
   plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox.js
Modified:
   plugins/sfEmailMeAFireShotPlugin/README
   plugins/sfEmailMeAFireShotPlugin/config/app.yml
   plugins/sfEmailMeAFireShotPlugin/lib/form/sfEmailMeAFireShotEmailForm.php
   plugins/sfEmailMeAFireShotPlugin/lib/helper/sfEmailMeAFireShotHelper.php
   plugins/sfEmailMeAFireShotPlugin/web/js/fsapi.js
Log:
Add form mode

Modified: plugins/sfEmailMeAFireShotPlugin/README
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/README     2010-05-24 20:41:09 UTC (rev 
29613)
+++ plugins/sfEmailMeAFireShotPlugin/README     2010-05-25 10:18:16 UTC (rev 
29614)
@@ -17,6 +17,8 @@
       sfEmailMeAFireShot:
         apiKey: #http://screenshot-program.com/fireshot/api_key.php
           DOMAINE: KEY_GENERATED
+        email_to: AN_email # Il you want to use form mode
+        email_from: #See form mode
     
 
 Create the link :
@@ -24,7 +26,7 @@
     
     use_helper('sfEmailMeAFireShot');
        include_sfEmailMeAFireShot_js();
-       echo link_sfEmailMeAFireShot('<span class="ui-icon 
ui-icon-image"></span>Report a bug','edit',array('class'=>'btn ui-state-default 
ui-corner-all '));
+       echo link_sfEmailMeAFireShot('<span class="ui-icon 
ui-icon-image"></span>Report a bug','form',array('class'=>'btn ui-state-default 
ui-corner-all '));
        
 
 ## Documentation for  link_sfEmailMeAFireShot
@@ -32,11 +34,27 @@
 *link_sfEmailMeAFireShot($name_for_link,$mode="edit",$options=array());*
 
   * name_for_link : The title of the link
-  * mode : **edit** to open fireshot editor or **email** to send an email  
+  * mode : **edit** to open fireshot editor or **email** to send an email  or  
**form** see after
   * options : array for the link tag
 
+## Form mode
+
+The form mode will go to open an Jquery Superbox to help you to send and email 
with the capture attached in the mail
+
+You could define email_to for the mail recipient (eg : the api that will 
insert your bug into Redmine or mantis)
+
+The email from is set to :
+
+  * myUser::getMail() if defined
+  * email_to if defined
+  * or email_from
+
+
 ## How it works
 
   1. If fireshot is not installed, the link will be replaced by a download 
link to install the extensions
   2. If you're not on Win or Firefox the link will be hidden
-  3. Else the action will be done
\ No newline at end of file
+  3. Else the action will be done
+  
+  
+  
\ No newline at end of file

Modified: plugins/sfEmailMeAFireShotPlugin/config/app.yml
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/config/app.yml     2010-05-24 20:41:09 UTC 
(rev 29613)
+++ plugins/sfEmailMeAFireShotPlugin/config/app.yml     2010-05-25 10:18:16 UTC 
(rev 29614)
@@ -2,5 +2,6 @@
   sfEmailMeAFireShot:
     apiKey: #http://screenshot-program.com/fireshot/api_key.php
       localhost: GO361F03J00G071A6ICIJVC629E0IG86JBO0NKTU
-      
+    email_to: "[email protected]"
+    #email_from: 
         
\ No newline at end of file

Added: plugins/sfEmailMeAFireShotPlugin/i18n/email_me_fireshot.fr.xml
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/i18n/email_me_fireshot.fr.xml              
                (rev 0)
+++ plugins/sfEmailMeAFireShotPlugin/i18n/email_me_fireshot.fr.xml      
2010-05-25 10:18:16 UTC (rev 29614)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+  <file original="global" source-language="en" datatype="plaintext">
+    <body>
+      <trans-unit>
+        <source>Subject</source>
+        <target>Sujet</target>
+      </trans-unit>
+      <trans-unit>
+        <source>Content</source>
+        <target>Contenu</target>
+      </trans-unit>
+      <trans-unit>
+        <source>You're email was successfully sent</source>
+        <target>Votre e-mail à bien été envoyé</target>
+      </trans-unit>
+      <trans-unit>
+        <source>Report a bug</source>
+        <target>Rapporter un bug</target>
+      </trans-unit>
+    </body>
+  </file>
+</xliff>
\ No newline at end of file

Modified: 
plugins/sfEmailMeAFireShotPlugin/lib/form/sfEmailMeAFireShotEmailForm.php
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/lib/form/sfEmailMeAFireShotEmailForm.php   
2010-05-24 20:41:09 UTC (rev 29613)
+++ plugins/sfEmailMeAFireShotPlugin/lib/form/sfEmailMeAFireShotEmailForm.php   
2010-05-25 10:18:16 UTC (rev 29614)
@@ -4,18 +4,20 @@
 
        public function configure(){
                $this->setWidgets(array(
-                       'subject'=>new sfWidgetFormInput(),
-                       'content'=>new sfWidgetFormTextarea(),
-                       'capture'=>new sfWidgetFormTextarea(),
+                       'subject'=>new 
sfWidgetFormInput(array(),array('size'=>53)),
+                       'content'=>new 
sfWidgetFormTextarea(array(),array('rows'=>10,'cols'=>40)),
+                       'capture'=>new sfWidgetFormInputHidden(),
                ));
                
                $this->setValidators(array(
-                       'subject'=>new 
sfValidatorString(array('required'=>true)),
-                       'content'=>new 
sfValidatorString(array('required'=>true)),
+                       'subject'=>new 
sfValidatorString(array('required'=>true),array('required'=>'You must set a 
subject')),
+                       'content'=>new 
sfValidatorString(array('required'=>true),array('required'=>'You must set a 
content')),
                        'capture'=>new 
sfValidatorString(array('required'=>true)),
                ));
                
                $this->widgetSchema->setNameFormat('email_me_fireshot[%s]');
+               
$this->widgetSchema->getFormFormatter()->setTranslationCatalogue('email_me_fireshot');
+               
        }
        
        

Modified: 
plugins/sfEmailMeAFireShotPlugin/lib/helper/sfEmailMeAFireShotHelper.php
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/lib/helper/sfEmailMeAFireShotHelper.php    
2010-05-24 20:41:09 UTC (rev 29613)
+++ plugins/sfEmailMeAFireShotPlugin/lib/helper/sfEmailMeAFireShotHelper.php    
2010-05-25 10:18:16 UTC (rev 29614)
@@ -2,6 +2,10 @@
 
 function link_sfEmailMeAFireShot($content,$action="edit",$options=array()){
        $options=array_merge($options,array('onclick'=>'shotAnd("'.$action.'"); 
return false;','href'=>'#'));
+       if($action=='form'){
+               $options['rel']='superbox[iframe]';
+               $options['href']=url_for('sfEmailMeAFireShot/index');
+       }
        return content_tag('span',
                content_tag('a',$content,$options),
        array('id'=>'sfEmailMeAFireShot'));
@@ -15,10 +19,13 @@
 function include_sfEmailMeAFireShot_js(){
        $apiKey=get_sfEmailMeAFireShot_apiKey();
        echo javascript_include_tag('/sfEmailMeAFireShotPlugin/js/fsapi.js');
+       echo 
javascript_include_tag('/sfEmailMeAFireShotPlugin/js/jquery.superbox-min.js');
+       echo 
stylesheet_tag('/sfEmailMeAFireShotPlugin/css/jquery.superbox.css');
        echo javascript_tag('$(document).ready(function(){ 
                FireShotAPI.Key ="'.$apiKey.'";
                if(!FireShotAPI.isWindows()){ $("#sfEmailMeAFireShot").hide(); }
                if(!FireShotAPI.isFirefox()){ $("#sfEmailMeAFireShot").hide(); }
+               $.superbox();
         });'); 
        echo javascript_tag('
        function shotAnd(action){
@@ -28,7 +35,10 @@
                                FireShotAPI.emailPage(true);
                        if(action=="edit")
                                FireShotAPI.editPage(true);                     
-                       
+                       if(action="form"){
+                               base64=FireShotAPI.base64EncodePage(true);
+                               $.ajax({ url: 
"'.url_for('sfEmailMeAFireShot/getBase64').'", type: "POST", data: { base64: 
base64 }});
+                       }
                }else{
                        $("#sfEmailMeAFireShot").html( "<b>Not installed</b>, " 
+ 
                        "<a 
href=\'javascript:FireShotAPI.installPlugin()\'>Install plugin now</a>");

Added: 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/actions/actions.class.php
===================================================================
--- 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/actions/actions.class.php
                               (rev 0)
+++ 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/actions/actions.class.php
       2010-05-25 10:18:16 UTC (rev 29614)
@@ -0,0 +1,43 @@
+<?php
+
+class sfEmailMeAFireShotActions extends sfActions{
+       public function executeIndex(sfWebRequest $request){
+               $this->form=new sfEmailMeAFireShotEmailForm();
+               
$this->form->setDefault('capture',$this->getUser()->getAttribute('sfEmailMeAFireShot_base64'));
+               $this->setLayout(false);
+               sfConfig::set('sf_web_debug', false);
+               if ($request->isMethod('post'))
+           {
+             $this->form->bind($request->getParameter($this->form->getName()));
+            
+                       if($this->form->isValid()){
+                               $mailer=$this->getMailer();
+                               $attach=new 
Swift_Attachment(base64_decode($this->form->getValue('capture')),'sfEmailMeAFireShot
 '.date('Y-m-d h:i:s').'.png','image/png');
+                               if(method_exists($this->getUser(),'getMail')){
+                                       $from=$this->getUser()->getMail();
+                                       if($from=='')
+                                               
$from=sfConfig::get('app_sfEmailMeAFireShot_email_from',sfConfig::get('app_sfEmailMeAFireShot_email_to'));
+                               }else{
+                                       
$from=sfConfig::get('app_sfEmailMeAFireShot_email_from',sfConfig::get('app_sfEmailMeAFireShot_email_to'));
+                               }
+                               $msg=$mailer->compose(
+                                               $from,
+                                               
sfConfig::get('app_sfEmailMeAFireShot_email_to'),
+                                               
$this->form->getValue('subject'),
+                                               
$this->form->getValue('content'))
+                                       ->attach($attach);
+                               
$isSend=$mailer->sendNextImmediately()->send($msg);
+                               
$this->getUser()->setAttribute('sfEmailMeAFireShot_base64',null);
+                               $this->setTemplate('emailOk');
+                               
+                       }
+           }
+       }
+       
+       public function executeGetBase64(sfWebRequest $request){
+               
$this->getUser()->setAttribute('sfEmailMeAFireShot_base64',$request->getParameter('base64'));
+               $this->setLayout(false);
+               return sfView::NONE;
+       }
+}
+?>
\ No newline at end of file

Added: 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/emailOkSuccess.php
===================================================================
--- 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/emailOkSuccess.php
                            (rev 0)
+++ 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/emailOkSuccess.php
    2010-05-25 10:18:16 UTC (rev 29614)
@@ -0,0 +1 @@
+<?php echo __("You're email was successfully 
sent",array(),'email_me_fireshot') ?>
\ No newline at end of file

Added: 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/indexSuccess.php
===================================================================
--- 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/indexSuccess.php
                              (rev 0)
+++ 
plugins/sfEmailMeAFireShotPlugin/modules/sfEmailMeAFireShot/templates/indexSuccess.php
      2010-05-25 10:18:16 UTC (rev 29614)
@@ -0,0 +1,17 @@
+<h3><?php echo __('Report a bug',array(),'email_me_fireshot') ?></h3>
+<form action="<?php echo url_for('sfEmailMeAFireShot/index') ?>" method="post">
+  <table>
+    <?php echo $form ?>
+    <tr>
+      <th></th>
+      <td><img src="data:image/png;base64,<?php echo 
$sf_user->getAttribute('sfEmailMeAFireShot_base64') ?>" height="100" 
alt="capture" /></td>
+    </tr>
+    <tr>
+      <th></th>
+      <td><input type="submit" value="Send" /></td>
+    </tr>
+  </table>
+  
+  
+  
+</form>

Added: plugins/sfEmailMeAFireShotPlugin/web/css/jquery.superbox.css
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/web/css/jquery.superbox.css                
                (rev 0)
+++ plugins/sfEmailMeAFireShotPlugin/web/css/jquery.superbox.css        
2010-05-25 10:18:16 UTC (rev 29614)
@@ -0,0 +1,58 @@
+/* Base Superbox Styles */
+#superbox-overlay{position:fixed;top:0;left:0;z-index:9998;width:100%;height:100%;}
+#superbox-wrapper{position:fixed;z-index:9999;top:0;display:table;width:100%;height:100%;}
+#superbox-container{position:relative;display:table-cell;width:100%;height:100%;margin:0;padding:0;vertical-align:middle;}
+#superbox{margin:0 auto;padding:0;}
+#superbox-container .loading{margin:0;text-align:center;}
+
+/* IE7 */
+*:first-child+html 
#superbox-container{position:absolute;top:50%;display:block;height:auto;}
+*:first-child+html #superbox{position:relative;top:-50%;display:block;}
+/* IE6 - Thanks to Thickbox for IE expressions */
+* html 
#superbox-container{position:absolute;top:50%;display:block;height:auto;}
+* html #superbox{position:relative;top:-50%;display:block;}
+* html 
#superbox-overlay{position:absolute;height:expression(document.body.scrollHeight
 > document.body.offsetHeight ? document.body.scrollHeight + 'px' : 
document.body.offsetHeight + 'px');}
+* html #superbox-wrapper{position:absolute;margin-top:expression(0 - 
parseInt(this.offsetHeight / 2) + (document.documentElement && 
document.documentElement.scrollTop || document.body.scrollTop) + 'px');}
+
+/* Default Theme */
+#superbox-overlay{background:#000;}
+#superbox-container .loading{text-align:center;font-size:40px;color:#fff;}
+#superbox{padding:10px;background:#fff;}
+#superbox-innerbox{padding:10px 0;}
+#superbox.image{text-align:center;}
+#superbox .close,
+#superbox .nextprev{overflow:hidden;margin:0;}
+
+#superbox-overlay  {
+background:none repeat scroll 0 0 #E0E4CC;
+}
+#superbox-container .loading {
+background:url("../images/loader.gif") no-repeat scroll 0 0 transparent;
+height:32px;
+margin:0 auto;
+text-indent:-9999px;
+width:32px;
+}
+#superbox .close a {
+background:none repeat scroll 0 0 #333333;
+cursor:pointer;
+float:right;
+line-height:20px;
+padding:0 5px;
+}
+#superbox .close a span {
+color:#FFFFFF;
+}
+#superbox .nextprev a {
+background:none repeat scroll 0 0 #333333;
+color:#FFFFFF;
+cursor:pointer;
+float:left;
+line-height:20px;
+margin-right:5px;
+padding:0 5px;
+}
+#superbox .nextprev .disabled {
+background:none repeat scroll 0 0 #CCCCCC;
+cursor:default;
+}

Added: plugins/sfEmailMeAFireShotPlugin/web/images/loader.gif
===================================================================
(Binary files differ)


Property changes on: plugins/sfEmailMeAFireShotPlugin/web/images/loader.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: plugins/sfEmailMeAFireShotPlugin/web/js/fsapi.js
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/web/js/fsapi.js    2010-05-24 20:41:09 UTC 
(rev 29613)
+++ plugins/sfEmailMeAFireShotPlugin/web/js/fsapi.js    2010-05-25 10:18:16 UTC 
(rev 29614)
@@ -14,17 +14,18 @@
 var cFSExternal = 4;
 var cFSUpload = 5;
 var cFSPrint = 7;
+var cBASE64Encode = 8;
 
 var FireShotAPI =
 {
        Key : "",                               // This key should be set up 
before using the API
        AutoInstall: true,      // Set this variable to false to switch off 
addon auto-installation
-       
+
        // Check silently whether the addon is available at the client's PC, 
returns *true* if everything is OK. Otherwise returns *false*.
        isAvailable : function()
        {
                if (!this.isWindows() || !this.isFirefox()) return false;
-               
+
                var element = document.createElement("FireShotDataElement");
                element.setAttribute("FSAvailable", false);
                document.documentElement.appendChild(element);
@@ -36,23 +37,23 @@
 
                return element.getAttribute("FSAvailable") == "true";
        },
-       
+
        // Installs plugin
        installPlugin : function()
        {
                if (!this.isWindows() || !this.isFirefox())
                {
                        this.errorOnlyFirefoxAtWindows();
-                       return; 
+                       return;
                }
                else
                {
                        var xpi = new Object();
                        xpi['FireShot'] = 
"http://screenshot-program.com/fireshot.xpi";;
-                       InstallTrigger.install(xpi, 
FireShotAPI.installationDone);      
+                       InstallTrigger.install(xpi, 
FireShotAPI.installationDone);
                }
        },
-       
+
        // Callback function seems to be not working properly
        installationDone : function(name, result)
        {
@@ -71,17 +72,21 @@
                        this.installPlugin();
                        return;
                }
-               
+
                var element = document.createElement("FireShotDataElement");
                element.setAttribute("Entire", EntirePage);
                element.setAttribute("Action", Action);
                element.setAttribute("Key", Key);
+               element.setAttribute("BASE64Content", "");
+
                document.documentElement.appendChild(element);
 
                var evt = document.createEvent("Events");
                evt.initEvent("capturePageEvt", true, false);
 
                element.dispatchEvent(evt);
+
+               return element;
        },
 
        // Capture web page (Entire = true for capturing the web page entirely) 
and *edit*
@@ -95,7 +100,7 @@
        {
                this.capturePage(Entire, cFSSave, this.Key);
        },
-       
+
        // Capture web page and *copy to clipboard*
        copyPage : function(Entire)
        {
@@ -126,6 +131,12 @@
                this.capturePage(Entire, cFSPrint, this.Key);
        },
 
+   // Capture web page and *print*
+       base64EncodePage : function(Entire)
+       {
+               return this.capturePage(Entire, cBASE64Encode, 
this.Key).getAttribute("BASE64Content");
+       },
+
        // Check whether the addon is available and display the message if 
required
        checkAvailability : function()
        {
@@ -135,29 +146,29 @@
                        this.errorOnlyFirefoxAtWindows();
                        return;
                }
-               
+
                if (!this.isAvailable() && confirm("FireShot plugin for Firefox 
not found. Would you like to install it?"))
                        this.installPlugin();
        },
-       
+
        // Check whether current OS is Windows
        isWindows : function()
        {
-               return navigator.appVersion.indexOf("Win") != -1;       
+               return navigator.appVersion.indexOf("Win") != -1;
        },
-       
+
        // Check whether current browser is Firefox
        isFirefox : function()
        {
                return navigator.userAgent.indexOf("Firefox") != -1;
        },
-       
+
        // Displays error message
        errorOnlyFirefoxAtWindows : function()
        {
-               alert("Sorry, this plugin works only in Firefox under Windows 
OS.");    
+               alert("Sorry, this plugin works only in Firefox under Windows 
OS.");
        }
-       
-       
-       
+
+
+
 }
\ No newline at end of file

Added: plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox-min.js
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox-min.js              
                (rev 0)
+++ plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox-min.js      
2010-05-25 10:18:16 UTC (rev 29614)
@@ -0,0 +1,49 @@
+/*
+* jQuery SuperBox! 0.9.1
+* Copyright (c) 2009 Pierre Bertet (pierrebertet.net)
+* Licensed under the MIT (MIT-LICENSE.txt)
+*
+*/
+(function(i){var 
l,t,r,q,a,p,h,o,j,w,b={boxId:"superbox",boxClasses:"",overlayOpacity:0.8,boxWidth:"600",boxHeight:"400",loadTxt:"Loading...",closeTxt:"Close",prevTxt:"Previous",nextTxt:"Next",beforeShow:function(){}},x={},m=false,s=i([]);
+i.superbox=function(){w=i.extend({},b,i.superbox.settings);if(i.browser.msie&&i.browser.version<7){s=s.add("select")
+}n();z()};function 
z(){i("a[rel^=superbox],area[rel^=superbox]").each(function(){var 
D=i(this),F=D.attr("rel"),B=F.match(/^superbox\[([^#\.\]]+)/)[1],E=F.replace("superbox","").match(/([#\.][^#\.\]]+)/g)||[],C=w.boxId,A=w.boxClasses;
+this._relSettings=F.replace("superbox["+B+E.join("")+"]","");i.each(E,function(G,H){if(H.substr(0,1)=="#"){C=H.substr(1)
+}else{if(H.substr(0,1)=="."){A+=" 
"+H.substr(1)}}});if(B.search(/^image|gallery|iframe|content|ajax$/)!=-1){D.superbox(B,{boxId:C,boxClasses:A})
+}})}i.fn.superbox=function(B,A){A=i.extend({},w,A);i.superbox[B](this,A)};i.extend(i.superbox,{image:function(C,A,B){var
 E=f(C.get(0)),D=false;
+if(E&&B=="gallery"){D=E[1]}else{if(E){D=E[0]}}C.click(function(F){F.preventDefault();
+k();if(B=="gallery"){c(C,E[0])}y(function(){var 
H=false,G;if(D){H=D.split("x")}G=i('<img src="'+C.attr("href")+'" 
title="'+(C.attr("title")||C.text())+'" />');
+G.load(function(){g(G,H);e({boxClasses:"image 
"+A.boxClasses,boxId:A.boxId});u()}).appendTo($innerbox)
+})})},gallery:function(B,A){var 
C=f(B.get(0));if(!x[C[0]]){x[C[0]]=[]}x[C[0]].push(B);
+B.get(0)._superboxGroupKey=(x[C[0]].length-1);i.superbox.image(B,A,"gallery")},iframe:function(B,A){var
 C=f(B.get(0));
+B.click(function(D){D.preventDefault();k();y(function(){var 
F=false,E;if(C){F=C[0].split("x")
+}A=i.extend({},A,{boxWidth:F[0]||A.boxWidth,boxHeight:F[1]||A.boxHeight});E=i('<iframe
 src="'+B.attr("href")+'" name="'+B.attr("href")+'" frameborder="0" 
scrolling="auto" hspace="0" width="'+A.boxWidth+'" 
height="'+A.boxHeight+'"></iframe>');
+E.load(function(){q.width(A.boxWidth+"px");$innerbox.height(A.boxHeight+"px");e({boxClasses:"iframe
 "+A.boxClasses,boxId:A.boxId});
+u()}).appendTo($innerbox)})})},content:function(B,A){var 
C=f(B.get(0));B.click(function(D){D.preventDefault();
+k();y(function(){var 
E=false;if(C){E=C[0].split("x")}A=i.extend({},A,{boxWidth:E[0]||A.boxWidth,boxHeight:E[1]||A.boxHeight});
+q.width(A.boxWidth+"px");$innerbox.height(A.boxHeight+"px");i(B.attr("href")).clone().appendTo($innerbox).show();
+e({boxClasses:"content 
"+A.boxClasses,boxId:A.boxId});u()})})},ajax:function(B,A){var C=f(B.get(0));
+B.click(function(D){D.preventDefault();k();y(function(){var 
E=false;if(C&&C[3]){E=C[3].split("x")
+}A=i.extend({},A,{boxWidth:E[0]||A.boxWidth,boxHeight:E[1]||A.boxHeight});q.width(A.boxWidth+"px");
+$innerbox.height(A.boxHeight+"px");i.get(C[2],function(F){i(F).appendTo($innerbox)
+});e({boxClasses:"ajax "+A.boxClasses,boxId:A.boxId});u()})})}});function 
f(A){return A._relSettings.match(/([^\[\]]+)/g)
+}function 
g(A,B){q.width(A.width()+($innerbox.css("paddingLeft").slice(0,-2)-0)+($innerbox.css("paddingRight").slice(0,-2)-0));
+$innerbox.height(A.height());if(B&&B[0]!=""){q.width(B[0]+"px")}if(B&&B[1]!=""&&B[1]>A.height()){$innerbox.height(B[1]+"px")
+}}function c(C,D){h.show();m=true;var 
A=C.get(0)._superboxGroupKey+1,B=A-2;if(x[D][A]){o.removeClass("disabled").unbind("click").bind("click",function(){x[D][A].click()
+})}else{o.addClass("disabled").unbind("click")}if(x[D][B]){j.removeClass("disabled").unbind("click").bind("click",function(){x[D][B].click()
+})}else{j.addClass("disabled").unbind("click")}}function 
e(A){q.attr("id",A.boxId).attr("class",A.boxClasses)
+}function 
d(){i(document).unbind("keydown");p.hide();h.hide();t.hide().css({position:"fixed",top:0});
+$innerbox.empty()}function 
v(A){d();l.fadeOut(300,function(){s.show()});m=false}function y(B){var 
A=function(){if(i.browser.msie&&i.browser.version<7){t.css({position:"absolute",top:"50%"})
+}s.hide();p.show();B()};if(m){l.css("opacity",w.overlayOpacity).show();A()}else{l.css("opacity",0).show().fadeTo(300,w.overlayOpacity,A)
+}}function 
k(){t.show();$innerbox.empty();q.css({position:"absolute",top:"-99999px"})
+}function 
u(A,B){p.hide();i(document).unbind("keydown").bind("keydown",function(C){if(C.keyCode==27){v()
+}if(C.keyCode==39&&o.is(":visible")){o.click()}if(C.keyCode==37&&j.is(":visible")){j.click()
+}});q.css({position:"static",top:0,opacity:0});if(i.browser.msie&&i.browser.version<8){q.css({position:"relative",top:"-50%"});
+if(i.browser.msie&&i.browser.version<7){t.css({position:"absolute",top:"50%"})}}if(i(window).height()<t.height()){t.css({position:"absolute",top:(t.offset().top+10)+"px"})
+}w.beforeShow();q.fadeTo(300,1)}function 
n(){if(!i.superbox.elementsReady){l=i('<div 
id="superbox-overlay"></div>').appendTo("body").hide();
+t=i('<div id="superbox-wrapper"></div>').appendTo("body").hide();r=i('<div 
id="superbox-container"></div>').appendTo(t);
+q=i('<div id="superbox"></div>').appendTo(r);$innerbox=i('<div 
id="superbox-innerbox"></div>').appendTo(q);
+h=i('<p class="nextprev"></p>').appendTo(q).hide();j=i('<a 
class="prev"><strong><span>'+w.prevTxt+"</span></strong></a>").appendTo(h);
+o=i('<a 
class="next"><strong><span>'+w.nextTxt+"</span></strong></a>").appendTo(h);
+a=i('<p 
class="close"><a><strong><span>'+w.closeTxt+"</span></strong></a></p>").prependTo(q).find("a");
+p=i('<p 
class="loading">'+w.loadTxt+"</p>").appendTo(r).hide();l.add(t).add(a).click(function(){v()
+});q.click(function(A){A.stopPropagation()});i.superbox.elementsReady=true}}})(jQuery);

Added: plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox.js
===================================================================
--- plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox.js                  
        (rev 0)
+++ plugins/sfEmailMeAFireShotPlugin/web/js/jquery.superbox.js  2010-05-25 
10:18:16 UTC (rev 29614)
@@ -0,0 +1,506 @@
+/*
+ * jQuery SuperBox! 0.9.1
+ * Copyright (c) 2009 Pierre Bertet (pierrebertet.net)
+ * Licensed under the MIT (MIT-LICENSE.txt)
+ *
+ * TODO :
+ * - Document.load if init is before </body> against IE crash.
+ * - Animations
+ * - Image / Gallery mode : display a legend
+*/
+;(function($){
+       
+       // Local variables
+       var $overlay, $wrapper, $container, $superbox, $closeBtn, $loading, 
$nextprev, $nextBtn, $prevBtn, settings,
+       
+       // Default settings
+       defaultSettings = {
+               boxId: "superbox",
+               boxClasses: "",
+               overlayOpacity: .8,
+               boxWidth: "600",
+               boxHeight: "400",
+               loadTxt: "Loading...",
+               closeTxt: "Close",
+               prevTxt: "Previous",
+               nextTxt: "Next",
+               beforeShow: function(){}
+       },
+       
+       galleryGroups = {},
+       galleryMode = false,
+       hideElts = $([]);
+       
+       // Init dispatcher
+       $.superbox = function(){
+               
+               // Settings
+               settings = $.extend({}, defaultSettings, $.superbox.settings);
+               
+               // If IE6, select elements to hide
+               if ($.browser.msie && $.browser.version < 7){
+                       hideElts = hideElts.add("select");
+               }
+               
+               // Create base elements
+               createElements();
+               
+               // Dispatch types
+               dispatch();
+       };
+       
+       // Dispatch types
+       function dispatch(){
+               
+               // Match all superbox links
+               $("a[rel^=superbox],area[rel^=superbox]").each(function(){
+                       
+                       // Optimisation
+                       var $this = $(this),
+                       relAttr = $this.attr("rel"),
+                       
+                       // Match type (ex : 
superbox[gallery#my_id.my_class][my_gallery] > gallery
+                       type = relAttr.match(/^superbox\[([^#\.\]]+)/)[1],
+                       
+                       // Match additionnal classes or IDs (#xxx.yyy.zzz)
+                       boxCurrentAttrs = relAttr.replace("superbox", 
"").match(/([#\.][^#\.\]]+)/g) || [],
+                       
+                       // Box ID and classes
+                       newBoxId = settings.boxId,
+                       newBoxClasses = settings.boxClasses;
+                       
+                       // Additionnal rel settings
+                       this._relSettings = relAttr.replace("superbox["+ type + 
boxCurrentAttrs.join("") +"]", "");
+            
+                       // Redefine settings
+                       $.each(boxCurrentAttrs, function(i, val){ // each class 
or id
+                               if (val.substr(0,1) == "#"){
+                                       newBoxId = val.substr(1);
+                               }
+                               else if (val.substr(0,1) == "."){
+                                       newBoxClasses += " " + val.substr(1);
+                               }
+                       });
+                       
+                       // Call type method
+                       if (type.search(/^image|gallery|iframe|content|ajax$/) 
!= -1) {
+                               $this.superbox(type, {boxId: newBoxId, 
boxClasses: newBoxClasses});
+                       }
+               });
+       };
+       
+       /*-- Superbox Method --*/
+       $.fn.superbox = function(type, curSettings){
+               curSettings = $.extend({}, settings, curSettings);
+               $.superbox[type](this, curSettings);
+       };
+       
+       /*-- Types --*/
+       $.extend($.superbox, {
+               
+               // Image
+               image: function($elt, curSettings, type){
+                       
+                       var relSettings = getRelSettings($elt.get(0)),
+                       dimensions = false;
+                       
+                       // Extra settings
+                       if (relSettings && type == "gallery")
+                               dimensions = relSettings[1];
+                       else if (relSettings)
+                               dimensions = relSettings[0];
+                       
+                       // On click event
+                       $elt.click(function(e){
+                               e.preventDefault();
+                               
+                               prepareBox();
+                               
+                               // "Prev / Next" buttons
+                               if (type == "gallery")
+                                       nextPrev($elt, relSettings[0]);
+                               
+                               // Loading anim
+                               initLoading(function(){
+                                       
+                                       // Dimensions
+                                       var dims = false,
+                                       
+                                       // Image
+                                       $curImg;
+                                       
+                                       if (dimensions) {
+                                               dims = dimensions.split("x");
+                                       }
+                                       
+                                       // Image
+                                       $curImg = $('<img src="'+ 
$elt.attr("href") +'" title="'+ ($elt.attr("title") || $elt.text()) +'" />');
+                                       
+                                       // On image load
+                                       $curImg.load(function(){
+                                               
+                                               // Resize
+                                               resizeImageBox($curImg, dims);
+                                               
+                                               // Id and Classes
+                                               setBoxAttrs({boxClasses: "image 
" + curSettings.boxClasses, boxId: curSettings.boxId});
+                                               
+                                               // Show box
+                                               showBox();
+                                               
+                                       }).appendTo($innerbox);
+                                       
+                               });
+                               
+                       });
+               },
+               
+               // Gallery
+               gallery: function($elt, curSettings){
+                       
+                       // Extra settings
+                       var extraSettings = getRelSettings($elt.get(0));
+                       
+                       // Create group
+                       if(!galleryGroups[extraSettings[0]]) {
+                           galleryGroups[extraSettings[0]] = [];
+                       }
+                       
+                       // Add element to current group
+                       galleryGroups[extraSettings[0]].push($elt);
+                       
+                       $elt.get(0)._superboxGroupKey = 
(galleryGroups[extraSettings[0]].length - 1);
+                       
+                       // Image Box
+                       $.superbox["image"]($elt, curSettings, "gallery");
+               },
+               
+               // iframe
+               iframe: function($elt, curSettings){
+                       
+                       // Extra settings
+                       var extraSettings = getRelSettings($elt.get(0));
+                       
+                       // On click event
+                       $elt.click(function(e){
+                               e.preventDefault();
+                               
+                               prepareBox();
+                               
+                               // Loading anim
+                               initLoading(function(){
+                                       
+                                       // Dimensions
+                                       var dims = false,
+                                       
+                                       // iframe
+                                       $iframe;
+                                       
+                                       if (extraSettings) {
+                                               dims = 
extraSettings[0].split("x");
+                                       }
+                                       
+                                       curSettings = $.extend({}, curSettings, 
{
+                                               boxWidth: dims[0] || 
curSettings.boxWidth,
+                                               boxHeight: dims[1] || 
curSettings.boxHeight
+                                       });
+                                       
+                                       // iframe
+                                       $iframe = $('<iframe src="'+ 
$elt.attr("href") +'" name="'+ $elt.attr("href") +'" frameborder="0" 
scrolling="auto" hspace="0" width="'+ curSettings.boxWidth +'" height="'+ 
curSettings.boxHeight +'"></iframe>');
+                                       
+                                       // On iframe load
+                                       $iframe.load(function(){
+                                               
+                                               // Specified dimensions
+                                               $superbox.width( 
curSettings.boxWidth+"px" );
+                                               $innerbox.height( 
curSettings.boxHeight+"px" );
+                                               
+                                               // Id and Classes
+                                               setBoxAttrs({boxClasses: 
"iframe " + curSettings.boxClasses, boxId: curSettings.boxId});
+                                               
+                                               // Show box
+                                               showBox();
+                                               
+                                       }).appendTo($innerbox);
+                               });
+                               
+                       });
+               },
+               
+               // Content
+               content: function($elt, curSettings){
+                       // Extra settings
+                       var extraSettings = getRelSettings($elt.get(0));
+                       
+                       // On click event
+                       $elt.click(function(e){
+                               e.preventDefault();
+                               
+                               prepareBox();
+                               
+                               // Loading anim
+                               initLoading(function(){
+                                       
+                                       // Dimensions
+                                       var dims = false;
+                                       if (extraSettings)
+                                               dims = 
extraSettings[0].split("x");
+                                       
+                                       curSettings = $.extend({}, curSettings, 
{
+                                               boxWidth: dims[0] || 
curSettings.boxWidth,
+                                               boxHeight: dims[1] || 
curSettings.boxHeight
+                                       });
+                                       
+                                       // Specified dimensions
+                                       $superbox.width( 
curSettings.boxWidth+"px" );
+                                       $innerbox.height( 
curSettings.boxHeight+"px" );
+                                       
+                                       
$($elt.attr('href')).clone().appendTo($innerbox).show();
+                                       
+                                       // Id and Classes
+                                       setBoxAttrs({boxClasses: "content " + 
curSettings.boxClasses, boxId: curSettings.boxId});
+                                       
+                                       // Show box
+                                       showBox();
+                               });
+                               
+                       });
+               },
+               
+               // Ajax
+               ajax: function($elt, curSettings){
+                       
+                       // Extra settings
+                       var extraSettings = getRelSettings($elt.get(0));
+                       
+                       // On click event
+                       $elt.click(function(e){
+                               e.preventDefault();
+                               
+                               prepareBox();
+                               
+                               // Loading anim
+                               initLoading(function(){
+                                       
+                                       // Dimensions
+                                       var dims = false;
+                                       if (extraSettings && extraSettings[3]) {
+                                               dims = 
extraSettings[3].split("x");
+                                       }
+                                       
+                                       // Extend default dimension settings
+                                       curSettings = $.extend({}, curSettings, 
{
+                                               boxWidth: dims[0] || 
curSettings.boxWidth,
+                                               boxHeight: dims[1] || 
curSettings.boxHeight
+                                       });
+                                       
+                                       // Specified dimensions
+                                       $superbox.width( 
curSettings.boxWidth+"px" );
+                                       $innerbox.height( 
curSettings.boxHeight+"px" );
+                                       
+                                       $.get( extraSettings[2], function(data){
+                                               $(data).appendTo($innerbox);
+                                       });
+                                       
+                                       // Id and Classes
+                                       setBoxAttrs({boxClasses: "ajax " + 
curSettings.boxClasses, boxId: curSettings.boxId});
+                                       
+                                       // Show box
+                                       showBox();
+                               });
+                       });
+               }
+       });
+       
+       
+       // Get extra settings in rel attribute
+       function getRelSettings(elt){
+               return elt._relSettings.match(/([^\[\]]+)/g);
+       };
+       
+       // Set image box dimensions
+       function resizeImageBox($curImg, dims){
+               
+               // Auto
+               $superbox.width($curImg.width() + 
($innerbox.css("paddingLeft").slice(0,-2)-0) + 
($innerbox.css("paddingRight").slice(0,-2)-0)); // Padding ajouté, pour 
corriger le problème de définition padding sur $innerbox
+               $innerbox.height($curImg.height());
+               
+               // Specified
+               if (dims && dims[0] != "") {
+                       $superbox.width(dims[0] + "px");
+               }
+               if (dims && dims[1] != "" && dims[1] > $curImg.height()) {
+                       $innerbox.height(dims[1] + "px");
+               }
+       };
+       
+       // Next / Previous
+       function nextPrev($elt, group){
+               $nextprev.show();
+               
+               galleryMode = true;
+               
+               var nextKey = $elt.get(0)._superboxGroupKey + 1,
+                   prevKey = nextKey - 2;
+               
+               // Next
+               if (galleryGroups[group][nextKey]){
+                       
$nextBtn.removeClass("disabled").unbind("click").bind("click", function(){
+                               galleryGroups[group][nextKey].click();
+                       });
+               }
+               else
+                       $nextBtn.addClass("disabled").unbind("click");
+               
+               // Prev
+               if (galleryGroups[group][prevKey]){
+                       
$prevBtn.removeClass("disabled").unbind("click").bind("click", function(){
+                               galleryGroups[group][prevKey].click();
+                       });
+               }
+               else
+                       $prevBtn.addClass("disabled").unbind("click");
+       };
+       
+       // Set ID and Class
+       function setBoxAttrs(attrs){
+               $superbox.attr("id", attrs.boxId).attr("class", 
attrs.boxClasses);
+       };
+       
+       // Hide Box
+       function hideBox(){
+               $(document).unbind("keydown");
+               $loading.hide();
+               $nextprev.hide();
+               $wrapper.hide().css({position: "fixed", top: 0});
+               $innerbox.empty();
+       };
+       
+       // Hide Box + Overlay
+       function hideAll(callback){
+               hideBox();
+               $overlay.fadeOut(300, function(){
+                       // Show hidden elements for IE6
+                       hideElts.show();
+               });
+               galleryMode = false;
+       };
+       
+       // "Loading..."
+       function initLoading(callback){
+               
+               var loading = function(){
+                       
+                       // IE6
+                       if($.browser.msie && $.browser.version < 7){
+                               $wrapper.css({position: "absolute", top:"50%"});
+                       }
+                       
+                       // Hide elements for IE6
+                       hideElts.hide();
+                       
+                       $loading.show();
+                       callback();
+               };
+               
+               if (galleryMode){
+                       $overlay.css("opacity", settings.overlayOpacity).show();
+                       loading();
+               }
+               else {
+                       $overlay.css("opacity", 0).show().fadeTo(300, 
settings.overlayOpacity, loading);
+               }
+       };
+       
+       // "Prepare" box : Show $superbox with top:-99999px;
+       function prepareBox(){
+               $wrapper.show();
+               $innerbox.empty();
+               $superbox.css({position: "absolute", top: "-99999px"});
+       };
+       
+       // Display box
+       function showBox(curSettings, $elt){
+               // Stop "Loading..."
+               $loading.hide();
+               
+               // Keys shortcuts
+               $(document).unbind("keydown").bind("keydown",function(e){
+                       // Escape
+                       if (e.keyCode == 27)
+                               hideAll();
+                       // Left/right arrows
+                       if (e.keyCode == 39 && $nextBtn.is(":visible"))
+                               $nextBtn.click();
+                       if (e.keyCode == 37 && $prevBtn.is(":visible"))
+                               $prevBtn.click();
+               });
+               
+               // Show $superbox
+               $superbox.css({position: "static", top: 0, opacity: 0});
+               
+               // IE6 and IE7
+               if ($.browser.msie && $.browser.version < 8){
+                       $superbox.css({position: "relative", top:"-50%"});
+               // IE6
+               if ($.browser.msie && $.browser.version < 7)
+                       $wrapper.css({position: "absolute", top:"50%"});
+               }
+               
+               // Position absolute if image height > window height
+               if ( $(window).height() < $wrapper.height() ){
+                       $wrapper.css({position: "absolute", top: 
($wrapper.offset().top + 10) + "px"});
+               }
+               
+               settings.beforeShow();
+               
+               $superbox.fadeTo(300,1);
+               
+       };
+       
+       // Create base elements (overlay, wrapper, box, loading)
+       function createElements(){
+               if (!$.superbox.elementsReady){
+                   
+                       // Overlay (background)
+                       $overlay = $('<div 
id="superbox-overlay"></div>').appendTo("body").hide();
+                       
+                       // Wrapper
+                       $wrapper = $('<div 
id="superbox-wrapper"></div>').appendTo("body").hide();
+                       
+                       // Box container
+                       $container = $('<div 
id="superbox-container"></div>').appendTo($wrapper);
+                       
+                       // Box
+                       $superbox = $('<div 
id="superbox"></div>').appendTo($container);
+                       
+                       // Inner box
+                       $innerbox = $('<div 
id="superbox-innerbox"></div>').appendTo($superbox);
+                       
+                       // "Next / Previous"
+                       $nextprev = $('<p 
class="nextprev"></p>').appendTo($superbox).hide();
+                       $prevBtn = $('<a class="prev"><strong><span>'+ 
settings.prevTxt +'</span></strong></a>').appendTo($nextprev);
+                       $nextBtn = $('<a class="next"><strong><span>'+ 
settings.nextTxt +'</span></strong></a>').appendTo($nextprev);
+                       
+                       // Add close button
+                       $closeBtn = $('<p class="close"><a><strong><span>'+ 
settings.closeTxt +'</span></strong></a></p>').prependTo($superbox).find("a");
+                       
+                       // "Loading..."
+                       $loading = $('<p class="loading">'+ settings.loadTxt 
+'</p>').appendTo($container).hide();
+                       
+                       // Hide on click
+                       $overlay.add($wrapper).add($closeBtn).click(function(){
+                               hideAll();
+                       });
+                       
+                       // Remove "hide on click" on superbox
+                       $superbox.click(function(e){
+                               e.stopPropagation();
+                       });
+                       
+                       // Dont call this function twice
+                       $.superbox.elementsReady = true;
+               }
+       };
+       
+})(jQuery);
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to