]> git.mxchange.org Git - friendica-addons.git/blobdiff - jappixmini/jappixmini.php
IT update to the addon translations
[friendica-addons.git] / jappixmini / jappixmini.php
index aac5c5486eb00d31a1646b38aa9327ebcae9c40c..5821453194a3b4129a5559816178dc369168845a 100644 (file)
@@ -294,10 +294,14 @@ function jappixmini_settings(&$a, &$s) {
         $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/lib.js"></script>'."\r\n";
     }
 
-    $s .= '<div class="settings-block">';
+    $s .= '<span id="settings_jappixmini_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_jappixmini_expanded\'); openClose(\'settings_jappixmini_inflated\');">';
+    $s .= '<h3>'.t('Jappix Mini').'</h3>';
+    $s .= '</span>';
+    $s .= '<div id="settings_jappixmini_expanded" class="settings-block" style="display: none;">';
+    $s .= '<span class="fakelink" onclick="openClose(\'settings_jappixmini_expanded\'); openClose(\'settings_jappixmini_inflated\');">';
+    $s .= '<h3>'.t('Jappix Mini').'</h3>';
+    $s .= '</span>';
 
-    $s .= '<h3>'.t('Jappix Mini addon settings').'</h3>';
-    $s .= '<div>';
     $s .= '<label for="jappixmini-activate">'.t('Activate addon').'</label>';
     $s .= ' <input id="jappixmini-activate" type="checkbox" name="jappixmini-activate" value="1"'.$activate.' />';
     $s .= '<br />';
@@ -311,7 +315,7 @@ function jappixmini_settings(&$a, &$s) {
     $s .= ' <input id="jappixmini-server" type="text" name="jappixmini-server" value="'.$server.'" />';
     $s .= '<br />';
 
-    if (defaultbosh == "") {
+    if ($defaultbosh == "") {
        $s .= '<label for="jappixmini-bosh">'.t('Jabber BOSH host').'</label>';
        $s .= ' <input id="jappixmini-bosh" type="text" name="jappixmini-bosh" value="'.$bosh.'" />';
        $s .= '<br />';
@@ -340,9 +344,8 @@ function jappixmini_settings(&$a, &$s) {
     $s .= '<br />';
     if ($info_text) $s .= '<br />Configuration help:<p style="margin-left:2em;">'.$info_text.'</p>';
     $s .= '<br />Status:<p style="margin-left:2em;">Addon knows '.$address_cnt.' Jabber addresses of '.$contact_cnt.' Friendica contacts (takes some time, usually 10 minutes, to update).</p>';
-    $s .= '<input type="submit" name="jappixmini-submit" value="' . t('Submit') . '" />';
+    $s .= '<input type="submit" name="jappixmini-submit" value="' . t('Save Settings') . '" />';
     $s .= ' <input type="button" value="'.t('Add contact').'" onclick="jappixmini_addon_subscribe();" />';
-    $s .= '</div>';
 
     $s .= '</div>';
 
@@ -482,7 +485,8 @@ function jappixmini_script(&$a,&$s) {
                dbesc($dfrn_id),
                dbesc($dfrn_id)
        );
-       $name = $r[0]["name"];
+       if (count($r))
+               $name = $r[0]["name"];
 
         $value = $row['v'];
         $pos = strpos($value, ":");
@@ -498,11 +502,16 @@ function jappixmini_script(&$a,&$s) {
     // get nickname
     $r = q("SELECT `username` FROM `user` WHERE `uid`=$uid");
     $nickname = json_encode($r[0]["username"]);
+    $groupchats = get_config('jappixmini','groupchats');
+    //if $groupchats has no value jappix_addon_start will produce a syntax error
+    if(empty($groupchats)){
+       $groupchats = "{}";
+    }
 
     // add javascript to start Jappix Mini
     $a->page['htmlhead'] .= "<script type=\"text/javascript\">
         jQuery(document).ready(function() {
-           jappixmini_addon_start('$server', '$username', '$proxy', '$bosh', $encrypt, '$password', $nickname, $contacts_json, '$contacts_hash', $autoapprove, $autosubscribe);
+           jappixmini_addon_start('$server', '$username', '$proxy', '$bosh', $encrypt, '$password', $nickname, $contacts_json, '$contacts_hash', $autoapprove, $autosubscribe, $groupchats);
         });
     </script>";