]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticeform.php
Reusable notice form fixes for geolocation
[quix0rs-gnu-social.git] / lib / noticeform.php
index ae8023275a0f7a0b2d39605b3ee4af1e0c1c1d58..0f13147d003c4bea8f2760b9804d0fe07c17ae30 100644 (file)
@@ -94,6 +94,8 @@ class NoticeForm extends Form
 
     function __construct($out=null, $action=null, $content=null, $user=null, $inreplyto=null, $lat=null, $lon=null, $location_id=null, $location_ns=null)
     {
+        $this->id_suffix = time();
+
         parent::__construct($out);
 
         $this->action  = $action;
@@ -125,7 +127,7 @@ class NoticeForm extends Form
 
     function id()
     {
-        return 'form_notice';
+        return 'form_notice_' . $this->id_suffix;
     }
 
    /**
@@ -208,7 +210,21 @@ class NoticeForm extends Form
 
                 $this->out->elementStart('div', array('class' => 'notice_data-geo_wrap',
                                                       'title' => common_local_url('geocode')));
-                $this->out->checkbox('notice_data-geo', _('Share my location'), true);
+
+                // @fixme checkbox method allows no way to change the id without changing the name
+                //$this->out->checkbox('notice_data-geo', _('Share my location'), true);
+                $this->out->element('input', array(
+                    'name' => 'notice_data-geo',
+                    'type' => 'checkbox',
+                    'class' => 'checkbox',
+                    'id' => $this->id() . '-notice_data-geo',
+                    'checked' => true, // ?
+                ));
+                $this->out->text(' ');
+                $this->out->element('label', array('class' => 'notice_data-geo',
+                                              'for' => $this->id() . '-notice_data-geo'),
+                               _('Share my location'));
+
                 $this->out->elementEnd('div');
                 $this->out->inlineScript(' var NoticeDataGeo_text = {'.
                     'ShareDisable: ' .json_encode(_('Do not share my location')).','.