Jump to content

Add javascript to recordActions: Difference between revisions

From NusaATK
New page: Actually I just got this working by digging into the code of class.atkrecordlist.inc. If the keyword "javascript:" is preappended to the url, a javascript function is automatically creat...
 
No edit summary
 
Line 1: Line 1:
{{howto|easy|Jorge Garifuna}}
Actually I just got this working by digging into the code of class.atkrecordlist.inc.  
Actually I just got this working by digging into the code of class.atkrecordlist.inc.  


Line 5: Line 7:
Below is my working code to create popup from recordActions():  
Below is my working code to create popup from recordActions():  


<syntaxhighlight lang="php">
  public function recordActions($record, &$actions, &$mra)
  {
      $url = session_url(dispatch_url("somemodule.somenode", "helloworld"), SESSION_NESTED);


function recordActions($record, &$actions, &$mra)
      $actions["hello"] = 'javascript:window.open ("'.$url.'","split","location=0,status=0,scrollbars=1,width=600,height=600")';
        {
  }
                // if($this->user["name"]=="administrator" || $this->mySecurity->allowed($this->module.".".$this->node,"duplicate")){
</syntaxhighlight>
            $url = session_url("dispatch.php?major_step_id=".$record[$this->primary_field][$this->primary_field]."&atknodetype=".$this->module.".steps&atkaction=duplicate&atkfilter=".$this->primary_field.".".$this->primary_field.urlencode("=").$record[$this->primary_field][$this->primary_field], SESSION_NESTED);
                    $actions["duplicate"] = 'javascript:window.open ("'.$url.'","split","location=0,status=0,scrollbars=1,width=600,height=600")';
              // }
        }// end  function recordActions

Latest revision as of 07:38, 10 February 2010

ATK Howto: Add javascript to recordActions

Complexity: easy
Author: Jorge Garifuna

List of other Howto's

Actually I just got this working by digging into the code of class.atkrecordlist.inc.

If the keyword "javascript:" is preappended to the url, a javascript function is automatically created.

Below is my working code to create popup from recordActions():

  public function recordActions($record, &$actions, &$mra)
  {
      $url = session_url(dispatch_url("somemodule.somenode", "helloworld"), SESSION_NESTED);

      $actions["hello"] = 'javascript:window.open ("'.$url.'","split","location=0,status=0,scrollbars=1,width=600,height=600")';
  }