summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7431fa5)
raw | patch | inline | side by side (parent: 7431fa5)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 21 Jun 2005 17:51:11 +0000 (17:51 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 21 Jun 2005 17:51:11 +0000 (17:51 +0000) |
plugins/gofon/macro/class_gofonMacro.inc | patch | blob | history | |
plugins/gofon/macro/class_gofonMacroParameters.inc | patch | blob | history | |
plugins/gofon/macro/parameter.tpl | patch | blob | history |
index 30bfc156db9a476ca6e112d81f6b4ec5a34169d3..373a4838e9df79a1103f0f8d5ae97f5de78a5c3f 100755 (executable)
/* Do we represent a valid group? */
if (!$this->is_account && $this->parent == NULL){
$display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
- _("This 'dn' is no application.")."</b>";
+ _("This 'dn' is no phone macro.")."</b>";
return ($display);
}
diff --git a/plugins/gofon/macro/class_gofonMacroParameters.inc b/plugins/gofon/macro/class_gofonMacroParameters.inc
index def581f1b5d20820128077f80b5e46eb78353f81..f8f93a19ab9de8848c48de1d609dea0334b2b65b 100755 (executable)
/* application attributes */
var $base= "";
var $goFonMacroParameter =array();
+ var $type_shortcut= array("string" => array("selected", "", ""),
+ "combo" => array("", "selected", ""),
+ "bool" => array("", "", "selected"));
/* attribute list for save action */
var $attributes= array("base","goFonMacroParameter");
var $objectclasses= array("top", "goFonMacro");
+
function macroParameter ($config, $dn= NULL)
{
plugin::plugin ($config, $dn);
$this->goFonMacroParameter[] = $tmp3;
}
}
-
- foreach($this->goFonMacroParameter as $para){
+ foreach($this->goFonMacroParameter as $para){
$tmp = split("!",$para);
$num = preg_replace("/[^0-9]/","",$tmp[1]);
$tmp2[$num]['name'] = $tmp[1];
$tmp2[$num]['type'] = $tmp[2];
$tmp2[$num]['default'] = $tmp[3];
}
-
+
/* Assign this array */
$this->goFonMacroParameter = $tmp2;
}
-function check_paras($content,$goFonMacroParameter)
+ function check_paras($content,$goFonMacroParameter)
{
- preg_match_all("/[$]\{ARG[0-9]*\}/",$content,$res,PREG_OFFSET_CAPTURE);
+ preg_match_all("/[$]\{ARG[0-9]*\}/",$content,$res,PREG_OFFSET_CAPTURE);
- $anz = count($res[0]);
- $new = array();
+ $anz = count($res[0]);
+ $new = array();
- foreach($res[0] as $val){
- $num = preg_replace("/[^0-9]/","",$val[0]);
- $new[$num]['val'] = $val[0];
- $new[$num]['num'] = $num;
+ foreach($res[0] as $val){
+ $num = preg_replace("/[^0-9]/","",$val[0]);
+ $new[$num]['val'] = $val[0];
+ $new[$num]['num'] = $num;
}
-
- foreach($goFonMacroParameter as $gokey => $goval){
- foreach($new as $nkey => $nval){
- if($gokey == $nval['num']){
- $goFonMacroParameter[$gokey]['check']= true;
+
+ foreach($goFonMacroParameter as $gokey => $goval){
+ foreach($new as $nkey => $nval){
+ if($gokey == $nval['num']){
+ $goFonMacroParameter[$gokey]['check']= true;
}
}
}
- foreach($new as $key => $val){
- $goFonMacroParameter[$key]['check']= true;
- if((!isset($goFonMacroParameter[$key]['name']))||(empty($goFonMacroParameter[$key]['name']))){
- $goFonMacroParameter[$key]['name']="\${ARG".$key."}";
- }
- }
+ foreach($new as $key => $val){
+ $goFonMacroParameter[$key]['check']= true;
+ if((!isset($goFonMacroParameter[$key]['name']))||(empty($goFonMacroParameter[$key]['name']))){
+ $goFonMacroParameter[$key]['name']="\${ARG".$key."}";
+ }
+ }
- foreach($goFonMacroParameter as $key => $val){
- if(!isset($goFonMacroParameter[$key]['check'])){
- $goFonMacroParameter[$key]['check']= false;
+ foreach($goFonMacroParameter as $key => $val){
+ if(!isset($goFonMacroParameter[$key]['check'])){
+ $goFonMacroParameter[$key]['check']= false;
}
- if(!isset($goFonMacroParameter[$key]['default'])){
- $goFonMacroParameter[$key]['default'] = "";
+ if(!isset($goFonMacroParameter[$key]['default'])){
+ $goFonMacroParameter[$key]['default'] = "";
}
}
- asort($goFonMacroParameter);
- return($goFonMacroParameter);
+ asort($goFonMacroParameter);
+ return($goFonMacroParameter);
}
-
-
-
-
-
-
function execute()
{
/* Variables */
$content = $_SESSION['macroManagment']->macrotabs->by_object['macro']->goFonMacroContent;
if(strstr($content,"ARG")){
- $vorpos = strpos($content,"ARG");
- $rest = substr($content,$vorpos, strlen($content));
+ $vorpos = strpos($content,"ARG");
+ $rest = substr($content,$vorpos, strlen($content));
}
/* Do we represent a valid group? */
if (!$this->is_account && $this->parent == NULL){
$display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
- _("This 'dn' is no application.")."</b>";
+ _("This 'dn' is no phone macro.")."</b>";
return ($display);
}
$this->goFonMacroParameter[]=array("name"=>"new","type"=>"string","default"=>"test");
}
+
+ #FIXME: Der Transfer der momentanen Variablen muss nach save_object(),
+ # damit kann in save() auf den execute() Aufruf verzichtet werden!
+
/* read out post data, and assign it to the parameters */
/* And or delete */
foreach($_POST as $name=>$value){
unset($this->goFonMacroParameter[$nr]);
}elseif(preg_match("/number/",$name)){
+
/* Set Post vars */
$key = $_POST[$name];
- $this->goFonMacroParameter[$key]['name'] =$_POST["varname".$key];
- $this->goFonMacroParameter[$key]['type'] =$_POST["vartype".$key];
- $this->goFonMacroParameter[$key]['default'] =$_POST["default".$key];
+ $this->goFonMacroParameter[$key]['name'] = $_POST["varname".$key];
+ $this->goFonMacroParameter[$key]['type'] = $_POST["vartype".$key];
+ $this->goFonMacroParameter[$key]['default']= $_POST["default".$key];
}
}
/*generate Table which shows als parameters */
-
- $FonParas = $this->check_paras($content,$this->goFonMacroParameter);
-
+
+ $FonParas = $this->check_paras($content,$this->goFonMacroParameter);
+
foreach($FonParas as $key=>$para) {
- if(isset($para['type'])){
- if($para['type']=="string") {
- $sel1 = "selected";
- $sel2 = "";
- $sel3 = "";
- }elseif($para['type']=="combo"){
- $sel1 = "";
- $sel2 = "selected";
- $sel3 = "" ;
+ /* Select correct item of combobox */
+ if(isset($para['type'])){
+ list($sel1, $sel2, $sel3)= $this->type_shortcut[$para['type']];
}else{
- $sel1 = "";
- $sel3 = "selected";
- $sel2 = "" ;
+ list($sel1, $sel2, $sel3)= array("", "", "");
}
- }else{
- $sel1 = "";
- $sel3 = "";
- $sel2 = "" ;
- }
+ #FIXME: Der Name des Parameters ist nicht gesetzt
+ # -> Argument (ARG#) Name [....] Typ [...^] Default [....]
+
+ /* Assemble output table */
$vars .="<tr>
<td><input name=\"number".$key."\" value='".$key."' type='hidden'> </td>
<td><input name='varname".$key."' type='hidden' value='".$para['name']."'>".$para['name']."</td>
<td>
<select name='vartype".$key."'>
- <option name='vartype".$key."' value='string' ".$sel1.">string</option>
- <option name='vartype".$key."' value='combo' ".$sel2.">combo</option>
- <option name='vartype".$key."' value='bool' ".$sel3.">bool</option>
+ <option name='vartype".$key."' value='string' ".$sel1.">"._("String")."</option>
+ <option name='vartype".$key."' value='combo' ".$sel2.">"._("Combobox")."</option>
+ <option name='vartype".$key."' value='bool' ".$sel3.">"._("Bool")."</option>
</select>
</td>
<td><input name='default".$key."' value='".$para['default']."'></td>
$vars.="<b>"._("Unused")."</b>";
$vars.=" <td><input name='del".$key."' value='delete' type='submit'></td>";
}
-
- $vars.=" </tr>";
-
+ $vars.=" </tr>";
}
/* Checkboxes */
$smarty->assign("base_select", $this->base);
$smarty->assign("vars", $vars);
-
/* Show main page */
return($smarty->fetch (get_template_path('parameter.tpl', TRUE)));
}
+
function remove_from_parent()
{
- /*
- $ldap= $this->config->get_ldap_link();
- $ldap->rmDir($this->dn);
-
- /* Optionally execute a command after we're done * /
- $this->handle_post_events("remove");
-
- /* Delete references to object groups * /
- $ldap->cd ($this->config->current['BASE']);
- $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
- while ($ldap->fetch()){
- $og= new ogroup($this->config, $ldap->getDN());
- unset($og->member[$this->dn]);
- $og->save ();
- }
- */
}
/* Save data to object */
function save_object()
{
- if (isset($_POST['cn'])){
+ if (isset($_POST['phoneparameters'])){
plugin::save_object();
}
}
function check()
{
$message = array();
-
+
foreach($this->attributes as $attr){
if(chkacl($this->acl,$attr)){
- $str = sprintf( _("Insufficient permissions, can't change attribute '%s' in goFonMacro"),$attr) ;
+ $str = sprintf( _("Insufficient permissions, can't change attribute '%s' in goFonMacro."),$attr) ;
return(array($str));
- }
}
+ }
return $message;
}
function save()
{
/* Post checks */
+
+ # FIXME: das hat hier nix zu suchen...
$this->execute();
plugin::save();
$this->attrs['goFonMacroParameter']=array();
-
+
foreach($this->goFonMacroParameter as $key=>$fonpara){
$this->attrs['goFonMacroParameter'][]=$key."!".$fonpara['name']."!".$fonpara['type']."!".$fonpara['default'];
}
index 4db0d31f69b6b9ffc3edc3277a87592c4a121f88..7d71e3d98497c1565f155f54d6407920321af23d 100755 (executable)
<td>
<table>
<tr>
- <td width="10%">{t}Number{/t}
+ <td width="10%">{t}Argument{/t}
</td>
<td width="25%">{t}Name{/t}
</td>
</td>
</tr>
</table>
-<p class="plugbottom" style="height:4px; margin-bottom:0px;"> </p>
+
+<input type="hidden" name="phoneparemeters">
<!-- Place cursor -->
<script language="JavaScript" type="text/javascript">