Example #1
0
 function modifyForm()
 {
     global $lll, $gorumroll, $category_typ;
     $this->id = $gorumroll->rollid;
     load($this);
     if ($this->picture) {
         $picture = CAT_PIC_DIR . "/{$this->id}.{$this->picture}";
         shrinkPicture($width, $height, 70, 70, $picture);
         $ctrl =& new AppController("cat/delete_picture/{$this->id}");
         $deleteLink = $ctrl->generAnchor($lll["deletePicture"]);
         $lll["category_picture_embedfield"] = "\n        <table id='deletePicture'>\n          <tr>\n            <td>%s</td>\n            <td rowspan='2' class='deleteAfterSuccess'>\n              <img src='{$picture}', width='{$width}' height='{$height}'>\n            </td>\n          </tr>\n          <tr class='deleteAfterSuccess'>\n            <td>{$deleteLink}</td>\n          </tr>\n        </table>";
         JavaScript::addOnload("\n            \$('#deletePicture a').click(function (){\n                \$.get(this.href, function(){\n                    \$('#deletePicture .deleteAfterSuccess').remove();\n                });\n                return false;\n            });    \n        ");
     }
     // Propagation:
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/jquery.center.js");
     // to center the loading animation image
     JavaScript::addInclude(GORUM_JS_DIR . "/jquery/field.js");
     // to retrieve the form field values
     JavaScript::addInclude(JS_DIR . "/propagate.js");
     // Propagate into all other categories:
     $propagatePostfix = OverlayController::addPropagateOverlay($this->id, "_cat");
     // Propagate into the subcategories only:
     getDbCount($count, array("SELECT COUNT(*) FROM @category WHERE up=#id#", $this->id));
     if ($count) {
         $propagatePostfix .= " " . OverlayController::addPropagateOverlay($this->id, "_cat", "_subcat");
     }
     foreach (array_keys($category_typ["attributes"]) as $attr) {
         if (!in_array($attr, array("name", "notificationLinksProperties", "expirationAndModerationProperties", "seoProperties", "otherProperties")) && $this->getVisibility($category_typ["attributes"][$attr], $attr) == Form_visible) {
             if (isset($lll["category_{$attr}"])) {
                 $lll["category_{$attr}"] .= $propagatePostfix;
             } elseif (isset($lll["appcategory_{$attr}"])) {
                 $lll["appcategory_{$attr}"] .= $propagatePostfix;
             } elseif (isset($lll[$attr])) {
                 $lll[$attr] .= $propagatePostfix;
             }
         }
     }
     parent::modifyForm();
 }