mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:07 +01:00
Patched in the changes of Revision 1.10 of the version in phpgwapi.
Changed from class projects to boprojects + some checks if class is availible.
This commit is contained in:
parent
c8f67dacf9
commit
bc406008c4
@ -39,6 +39,7 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
* $id_name id of previosly selected entry
|
* $id_name id of previosly selected entry
|
||||||
* $content from id (eg. 'company: lastname, givenname' for address $id) if $id != 0, or
|
* $content from id (eg. 'company: lastname, givenname' for address $id) if $id != 0, or
|
||||||
* array with searchresult (id's as key), if array is empty if search was unsucsessful
|
* array with searchresult (id's as key), if array is empty if search was unsucsessful
|
||||||
|
* $multipe present a multiple selectable box instead of one selector-button
|
||||||
* Returns: array with vars to set in temaplate, the vars are:
|
* Returns: array with vars to set in temaplate, the vars are:
|
||||||
* {doSearchFkt} Javascript Funktion, place somewhere in Template (before rest of the vars)
|
* {doSearchFkt} Javascript Funktion, place somewhere in Template (before rest of the vars)
|
||||||
* {$name.'_title} button with titel $lang_name (if JS) or just $lang_name
|
* {$name.'_title} button with titel $lang_name (if JS) or just $lang_name
|
||||||
@ -46,14 +47,14 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
* {$name.'_nojs} searchfield + button if we have no JavaScript, else empty
|
* {$name.'_nojs} searchfield + button if we have no JavaScript, else empty
|
||||||
*
|
*
|
||||||
* To use call $template->set_var(getIdSearch( ... ));
|
* To use call $template->set_var(getIdSearch( ... ));
|
||||||
* the template should look like {doSeachFkt} <tr><td>{XXX_title}</td><td>{XXX}</td><td>{XXX_nojs}</td></tr> (XXX is content of $name)
|
* the template should look like {doSearchFkt} <tr><td>{XXX_title}</td><td>{XXX}</td><td>{XXX_nojs}</td></tr> (XXX is content of $name)
|
||||||
* In the submitted page the vars $query_XXX and $id_XXX are set according to what is selected, see getAddress as Example
|
* In the submitted page the vars $query_XXX and $id_XXX are set according to what is selected, see getAddress as Example
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getId($name,$lang_name,$prompt,$id_name,$content='',$note='')
|
function getId($name,$lang_name,$prompt,$id_name,$content='',$note='',$multiple=False)
|
||||||
{
|
{
|
||||||
// echo "<p>getId('$name','$lang_name','$prompt',$id_name,'$content') =";
|
// echo "<p>getId('$name','$lang_name','$prompt',$id_name,'$content') =";
|
||||||
$ret['doSearchFkt'] =
|
$ret['doSearchFkt'] =
|
||||||
'<script language="JavaScript">'."\n".
|
'<script language="JavaScript">'."\n".
|
||||||
" function doSearch(field,ask) {\n".
|
" function doSearch(field,ask) {\n".
|
||||||
" field.value = prompt(ask,'');\n".
|
" field.value = prompt(ask,'');\n".
|
||||||
@ -66,7 +67,7 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
" }\n".
|
" }\n".
|
||||||
'</script>';
|
'</script>';
|
||||||
|
|
||||||
$ret[$name.'_title'] = is_array($content) && count($content) ? $lang_name :
|
$ret[$name.'_title'] = is_array($content) && count($content) ? $lang_name :
|
||||||
'<script language="JavaScript">'."\n".
|
'<script language="JavaScript">'."\n".
|
||||||
" document.writeln('<input type=\"hidden\" name=\"query_$name\" value=\"\">');\n".
|
" document.writeln('<input type=\"hidden\" name=\"query_$name\" value=\"\">');\n".
|
||||||
" document.writeln('<input type=\"button\" onClick=\"doSearch(this.form.query_$name,\'$prompt\')\" value=\"$lang_name\">');\n".
|
" document.writeln('<input type=\"button\" onClick=\"doSearch(this.form.query_$name,\'$prompt\')\" value=\"$lang_name\">');\n".
|
||||||
@ -84,7 +85,14 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret[$name.'_OK'] = ''; // flag we have something so select
|
$ret[$name.'_OK'] = ''; // flag we have something so select
|
||||||
$ret[$name] = "<select name=\"id_$name\">\n";
|
if ($multiple)
|
||||||
|
{
|
||||||
|
$ret[$name] = '<select name="id_'.$name.'[]" size=10 multiple>'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ret[$name] = '<select name="id_'.$name.'">'."\n";
|
||||||
|
}
|
||||||
while (list( $id,$text ) = each( $content ))
|
while (list( $id,$text ) = each( $content ))
|
||||||
{
|
{
|
||||||
$ret[$name] .= "<option value=\"$id\">" . $GLOBALS['phpgw']->strip_html($text) . "\n";
|
$ret[$name] .= "<option value=\"$id\">" . $GLOBALS['phpgw']->strip_html($text) . "\n";
|
||||||
@ -140,14 +148,15 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
|
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
|
||||||
* $id_name id of the address for edit or 0 if none selected so far
|
* $id_name id of the address for edit or 0 if none selected so far
|
||||||
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
|
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
|
||||||
|
* $multipe present a multiple selectable box instead of one selector-button
|
||||||
* On Submit $id_XXX contains the selected address (if != 0)
|
* On Submit $id_XXX contains the selected address (if != 0)
|
||||||
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
|
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
|
||||||
* Returns array with vars to set for the template, set with: $template->set_var( getAddress( ... )); (see getId( ))
|
* Returns array with vars to set for the template, set with: $template->set_var( getAddress( ... )); (see getId( ))
|
||||||
*
|
*
|
||||||
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
|
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getAddress( $name,$id_name,$query_name,$title='')
|
function getAddress( $name,$id_name,$query_name,$title='',$multiple=False)
|
||||||
{
|
{
|
||||||
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
|
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
|
||||||
if ($id_name || $query_name)
|
if ($id_name || $query_name)
|
||||||
@ -176,8 +185,7 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
{
|
{
|
||||||
$title = lang('Addressbook');
|
$title = lang('Addressbook');
|
||||||
}
|
}
|
||||||
|
return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content,lang('use Button to search for Address'),$multiple);
|
||||||
return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content,lang('use Button to search for Address'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addr2email( $addr,$home='' )
|
function addr2email( $addr,$home='' )
|
||||||
@ -266,10 +274,14 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
// echo "<p>getProject('$name',$id_name,'$query_name','$title')</p>";
|
// echo "<p>getProject('$name',$id_name,'$query_name','$title')</p>";
|
||||||
if ($id_name || $query_name)
|
if ($id_name || $query_name)
|
||||||
{
|
{
|
||||||
$projects = createobject('projects.projects');
|
$projects = createobject('projects.boprojects');
|
||||||
|
if (!is_object($projects))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
if ($query_name)
|
if ($query_name)
|
||||||
{
|
{
|
||||||
$projs = $projects->read_projects( 0,0,$query_name,'','','','',0 );
|
$projs = $projects->list_projects( 0,0,$query_name,'','','','',0,'mains','' );
|
||||||
$content = array();
|
$content = array();
|
||||||
while ($projs && list( $key,$proj ) = each( $projs ))
|
while ($projs && list( $key,$proj ) = each( $projs ))
|
||||||
{
|
{
|
||||||
@ -314,16 +326,23 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
{
|
{
|
||||||
$options .= ' MULTIPLE SIZE='.(0+$multiple);
|
$options .= ' MULTIPLE SIZE='.(0+$multiple);
|
||||||
if (substr($name,-2) != '[]')
|
if (substr($name,-2) != '[]')
|
||||||
|
{
|
||||||
$name .= '[]';
|
$name .= '[]';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$out = "<select name=\"$name\" $options>\n";
|
$out = "<select name=\"$name\" $options>\n";
|
||||||
|
|
||||||
if (is_array($key)) $key = implode(',',$key);
|
if (is_array($key))
|
||||||
|
{
|
||||||
|
$key = implode(',',$key);
|
||||||
|
}
|
||||||
while (list($k,$text) = each($arr))
|
while (list($k,$text) = each($arr))
|
||||||
{
|
{
|
||||||
$out .= '<option value="'.$k.'"';
|
$out .= '<option value="'.$k.'"';
|
||||||
if($k == $key || strstr(",$key,",",$k,")) $out .= " SELECTED";
|
if($k == $key || strstr(",$key,",",$k,"))
|
||||||
|
{
|
||||||
|
$out .= " SELECTED";
|
||||||
|
}
|
||||||
$out .= ">" . ($no_lang || $text == '' ? $text : lang($text)) . "</option>\n";
|
$out .= ">" . ($no_lang || $text == '' ? $text : lang($text)) . "</option>\n";
|
||||||
}
|
}
|
||||||
$out .= "</select>\n";
|
$out .= "</select>\n";
|
||||||
@ -334,8 +353,9 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
function getPercentage($name, $selected=0,$options='')
|
function getPercentage($name, $selected=0,$options='')
|
||||||
{ // reimplemented using getArrayItem
|
{ // reimplemented using getArrayItem
|
||||||
for ($i=0; $i <= 100; $i+=10)
|
for ($i=0; $i <= 100; $i+=10)
|
||||||
|
{
|
||||||
$arr[$i] = "$i%";
|
$arr[$i] = "$i%";
|
||||||
|
}
|
||||||
return $this->getArrayItem($name,$selected,$arr,1,$options);
|
return $this->getArrayItem($name,$selected,$arr,1,$options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,9 +369,9 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
function getAccessList($name,$selected='private',$options='')
|
function getAccessList($name,$selected='private',$options='')
|
||||||
{ // reimplemented using getArrayItem
|
{ // reimplemented using getArrayItem
|
||||||
$arr = array(
|
$arr = array(
|
||||||
"private" => "Private",
|
'private' => 'Private',
|
||||||
"public" => "Global public",
|
'public' => 'Global public',
|
||||||
"group" => "Group public"
|
'group' => 'Group public'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (strstr($selected,','))
|
if (strstr($selected,','))
|
||||||
@ -411,8 +431,9 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
$accs = $accounts->get_list($type);
|
$accs = $accounts->get_list($type);
|
||||||
|
|
||||||
if ($multiple < 0)
|
if ($multiple < 0)
|
||||||
|
{
|
||||||
$aarr[] = lang('not assigned');
|
$aarr[] = lang('not assigned');
|
||||||
|
}
|
||||||
while ($a = current($accs))
|
while ($a = current($accs))
|
||||||
{
|
{
|
||||||
$aarr[$a['account_id']] = $this->accountInfo($a['account_id'],$a,$longnames,$type=='both');
|
$aarr[$a['account_id']] = $this->accountInfo($a['account_id'],$a,$longnames,$type=='both');
|
||||||
@ -424,9 +445,13 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
function getDate($n_year,$n_month,$n_day,$date,$options='')
|
function getDate($n_year,$n_month,$n_day,$date,$options='')
|
||||||
{
|
{
|
||||||
if (is_array($date))
|
if (is_array($date))
|
||||||
|
{
|
||||||
list($year,$month,$day) = $date;
|
list($year,$month,$day) = $date;
|
||||||
|
}
|
||||||
elseif (!$date)
|
elseif (!$date)
|
||||||
|
{
|
||||||
$day = $month = $year = 0;
|
$day = $month = $year = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$day = date('d',$date);
|
$day = date('d',$date);
|
||||||
@ -443,8 +468,9 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
function getCategory($name,$cat_id='',$notall=False,$jscript=True,$multiple=0,$options='')
|
function getCategory($name,$cat_id='',$notall=False,$jscript=True,$multiple=0,$options='')
|
||||||
{
|
{
|
||||||
if (!is_object($this->cat))
|
if (!is_object($this->cat))
|
||||||
|
{
|
||||||
$this->cat = CreateObject('phpgwapi.categories');
|
$this->cat = CreateObject('phpgwapi.categories');
|
||||||
|
}
|
||||||
if ($jscript)
|
if ($jscript)
|
||||||
{
|
{
|
||||||
$options .= ' onChange="this.form.submit();"';
|
$options .= ' onChange="this.form.submit();"';
|
||||||
@ -453,7 +479,9 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
{
|
{
|
||||||
$options .= ' MULTIPLE SIZE='.(0+$multiple);
|
$options .= ' MULTIPLE SIZE='.(0+$multiple);
|
||||||
if (substr($name,-2) != '[]')
|
if (substr($name,-2) != '[]')
|
||||||
|
{
|
||||||
$name .= '[]';
|
$name .= '[]';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Setup all and none first */
|
/* Setup all and none first */
|
||||||
$cats_link = "\n<SELECT NAME=\"$name\" $options>\n";
|
$cats_link = "\n<SELECT NAME=\"$name\" $options>\n";
|
||||||
@ -471,6 +499,7 @@ if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
|
|||||||
/* Get global and app-specific category listings */
|
/* Get global and app-specific category listings */
|
||||||
$cats_link .= $this->cat->formated_list('select','all',$cat_id,True);
|
$cats_link .= $this->cat->formated_list('select','all',$cat_id,True);
|
||||||
$cats_link .= '</select>'."\n";
|
$cats_link .= '</select>'."\n";
|
||||||
|
|
||||||
return $cats_link;
|
return $cats_link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user