]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/designsettings.php
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
[quix0rs-gnu-social.git] / lib / designsettings.php
index 5ce9ddedadf5529c516e94f372d06024f242b67c..4955e9219954c2bf000124ae8f0f8911c512bca7 100644 (file)
@@ -107,7 +107,7 @@ class DesignSettingsAction extends AccountSettingsAction
                                       'type' => 'file',
                                       'id' => 'design_background-image_file'));
         $this->element('p', 'form_guide', _('You can upload your personal ' .
-            'background image. The maximum file size is 2Mb.'));
+            'background image. The maximum file size is 2MB.'));
         $this->element('input', array('name' => 'MAX_FILE_SIZE',
                                       'type' => 'hidden',
                                       'id' => 'MAX_FILE_SIZE',
@@ -314,7 +314,7 @@ class DesignSettingsAction extends AccountSettingsAction
     function showStylesheets()
     {
         parent::showStylesheets();
-        $this->cssLink('css/farbtastic.css','base','screen, projection, tv');
+        $this->cssLink('js/farbtastic/farbtastic.css',null,'screen, projection, tv');
     }
 
     /**
@@ -327,55 +327,12 @@ class DesignSettingsAction extends AccountSettingsAction
     {
         parent::showScripts();
 
-        $this->script('js/farbtastic/farbtastic.js');
-        $this->script('js/userdesign.go.js');
+        $this->script('farbtastic/farbtastic.js');
+        $this->script('userdesign.go.js');
 
         $this->autofocus('design_background-image_file');
     }
 
-    /**
-     * Get a default design
-     *
-     * @return Design design
-     */
-
-    function defaultDesign()
-    {
-        $defaults = common_config('site', 'design');
-
-        $design = new Design();
-
-        try {
-
-            $color = new WebColor();
-
-            $color->parseColor($defaults['backgroundcolor']);
-            $design->backgroundcolor = $color->intValue();
-
-            $color->parseColor($defaults['contentcolor']);
-            $design->contentcolor = $color->intValue();
-
-            $color->parseColor($defaults['sidebarcolor']);
-            $design->sidebarcolor = $color->intValue();
-
-            $color->parseColor($defaults['textcolor']);
-            $design->textcolor = $color->intValue();
-
-            $color->parseColor($defaults['linkcolor']);
-            $design->linkcolor = $color->intValue();
-
-            $design->backgroundimage = $defaults['backgroundimage'];
-
-            $design->disposition = $defaults['disposition'];
-
-        } catch (WebColorException $e) {
-            common_log(LOG_ERR, _('Bad default color settings: ' .
-                $e->getMessage()));
-        }
-
-        return $design;
-    }
-
     /**
      * Save the background image, if any, and set its disposition
      *
@@ -445,24 +402,17 @@ class DesignSettingsAction extends AccountSettingsAction
 
     function restoreDefaults()
     {
-        $design   = $this->getWorkingDesign();
-        $default  = $this->defaultDesign();
-        $original = clone($design);
-
-        $design->backgroundcolor = $default->backgroundcolor;
-        $design->contentcolor    = $default->contentcolor;
-        $design->sidebarcolor    = $default->sidebarcolor;
-        $design->textcolor       = $default->textcolor;
-        $design->linkcolor       = $default->linkcolor;
+        $design = $this->getWorkingDesign();
 
-        $design->setDisposition(false, true, false);
+        if (!empty($design)) {
 
-        $result = $design->update($original);
+            $result = $design->delete();
 
-        if ($result === false) {
-            common_log_db_error($design, 'UPDATE', __FILE__);
-            $this->showForm(_('Couldn\'t update your design.'));
-            return;
+            if ($result === false) {
+                common_log_db_error($design, 'DELETE', __FILE__);
+                $this->showForm(_('Couldn\'t update your design.'));
+                return;
+            }
         }
 
         $this->showForm(_('Design defaults restored.'), true);