Jump to content

Editing files with the atkFileEditor: Difference between revisions

From NusaATK
Saitta (talk | contribs)
No edit summary
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:ATK]]
{{Howto|basic|[[Fabio Saitta]] <webmaster@saitta.it>}}


{{Examples|basic|[[Fabio Saitta]] <webmaster@saitta.it>}}
This Howto demonstrates the use of the atkFileEditor. The example used, is editing the help-files of an ATK application.


'''Let your users edit ATK help file with 14 lines of code !!!'''
'''Let your users edit ATK help file with 14 lines of code !!!'''


ATK Rocks !!!
<syntaxhighlight lang="php">
 
  atkimport("atk.atkfileeditor");  
<pre>
  useattrib("atkfckattribute");
<?php
 
atkimport("atk.atkfileeditor");  
  class help extends atkFileEditor  
useattrib("atkfckattribute");
 
  class help extends atkFileEditor  
   {  
   {  
     function help()  
     function help()  
     {  
     {  
       $this->atkFileEditor("help","C:\Programmi\Apache Group\Apache2\htdocs\atk_56\help\it",".inc");
       $this->atkFileEditor("help","C:\\Programmi\\Apache Group\\Apache2\\htdocs\\atk_56\\help\\it",".inc");
       $this->add(new AtkFckAttribute("filecontent",30,AF_HIDE_LIST));    
       $this->add(new AtkFckAttribute("filecontent",30,AF_HIDE_LIST));    
       $this->setSecurityAlias("module.class");
       $this->setSecurityAlias("module.class");
     }  
     }  
   }  
   }  
?>
</syntaxhighlight>
</pre>


notes:
== notes ==


<pre>
<syntaxhighlight lang="php">
$this->atkFileEditor("help","C:\Programmi\Apache Group\Apache2\htdocs\atk_56\help\it",".inc");
  $this->atkFileEditor("help","C:\\Programmi\\Apache Group\\Apache2\\htdocs\\atk_56\\help\\it",".inc");
</pre>
</syntaxhighlight>


this is working with windows, if you are using unix/linux you have to code something like this:
this is working with windows, if you are using unix/linux you have to code something like this:


<pre>
<syntaxhighlight lang="php">
$this->atkFileEditor("help","/usr/http/atk_56/help/it",".inc");
  $this->atkFileEditor("help","/usr/http/atk_56/help/it",".inc");
</pre>
</syntaxhighlight>


you have also to change language directory, in the sample I selected Italian language /it
you have also to change language directory, in the sample I selected Italian language /it
Line 40: Line 36:
For authorization, use Security alias:  
For authorization, use Security alias:  


<pre>
<syntaxhighlight lang="php">
$this->setSecurityAlias("module.class");
  $this->setSecurityAlias("module.class");
</pre>
</syntaxhighlight>


or define is your module.inc
or define is your module.inc


<pre>
<syntaxhighlight lang="php">
registerNode("module.help",array("admin","add","edit","delete"));
  registerNode("module.help",array("admin","add","edit","delete"));
</pre>
</syntaxhighlight>


where module is the name of your module, and class is the name of security equivalence
where module is the name of your module, and class is the name of security equivalence


--[[User:Saitta|Saitta]] 19:55, 25 August 2006 (CEST)
--[[User:Saitta|Saitta]] 19:55, 25 August 2006 (CEST)

Latest revision as of 16:27, 14 January 2007

ATK Howto: Editing files with the atkFileEditor

Complexity: basic
Author: Fabio Saitta <webmaster@saitta.it>

List of other Howto's

This Howto demonstrates the use of the atkFileEditor. The example used, is editing the help-files of an ATK application.

Let your users edit ATK help file with 14 lines of code !!!

  atkimport("atk.atkfileeditor"); 
  useattrib("atkfckattribute");
  
  class help extends atkFileEditor 
  { 
    function help() 
    { 
      $this->atkFileEditor("help","C:\\Programmi\\Apache Group\\Apache2\\htdocs\\atk_56\\help\\it",".inc");
      $this->add(new AtkFckAttribute("filecontent",30,AF_HIDE_LIST));	   
      $this->setSecurityAlias("module.class");
    } 
  }

notes

  $this->atkFileEditor("help","C:\\Programmi\\Apache Group\\Apache2\\htdocs\\atk_56\\help\\it",".inc");

this is working with windows, if you are using unix/linux you have to code something like this:

  $this->atkFileEditor("help","/usr/http/atk_56/help/it",".inc");

you have also to change language directory, in the sample I selected Italian language /it

For authorization, use Security alias:

  $this->setSecurityAlias("module.class");

or define is your module.inc

  registerNode("module.help",array("admin","add","edit","delete"));

where module is the name of your module, and class is the name of security equivalence

--Saitta 19:55, 25 August 2006 (CEST)