예제 #1
0
    def __init__(self, *args, **kwargs):
        super(pygallery, self).__init__(*args, **kwargs)

        self.plugin_cfg = PluginConfig(self.request, self.response)

        self.absolute_base_path = self._get_absolute_path()
        if debug:
            self.page_msg("absolute_path:", self.absolute_base_path)
예제 #2
0
    def __init__(self, *args, **kwargs):
        super(pygallery, self).__init__(*args, **kwargs)

        self.plugin_cfg = PluginConfig(self.request, self.response)

        self.absolute_base_path = self._get_absolute_path()
        if debug:
            self.page_msg("absolute_path:", self.absolute_base_path)
예제 #3
0
    def __init__(self, *args, **kwargs):
        super(SelfDocu, self).__init__(*args, **kwargs)

        self.plugin_cfg = PluginConfig(self.request, self.response)
예제 #4
0
class pygallery(PyLucidBaseModule):
    def __init__(self, *args, **kwargs):
        super(pygallery, self).__init__(*args, **kwargs)

        self.plugin_cfg = PluginConfig(self.request, self.response)

        self.absolute_base_path = self._get_absolute_path()
        if debug:
            self.page_msg("absolute_path:", self.absolute_base_path)

    def lucidFunction(self, function_info):
        """
        Aufruf um eine Gallerie in die CMS Seite aufzubauen
        """
        self.gallery(function_info)

    #_________________________________________________________________________

    def lucidTag(self):
        """
        Dummy, mit Infos
        """
        self.setup()

    def setup(self):
        """
        Alle existierende Gallerien verwalten
        """
        if debug:
            self.page_msg(self.request.form)
            self.plugin_cfg.debug()

        if "create" in self.request.form:
            # Es soll eine neue Gallerie eingerichtet werden
            self.create_new_gallerie()
            return

        galleries = []
        for gallerie, data in self.plugin_cfg["galleries"].iteritems():
            tag = "<lucidFunction:pygallery>%s</lucidFunction>" % gallerie
            tag = cgi.escape(tag)
            galleries.append({
                "name":
                gallerie,
                "lucidFunction":
                tag,
                "path":
                data["path"],
                "edit_link":
                self.URLs.actionLink("gallery_config", gallerie)
            })

        context = {
            "galleries": galleries,
            "url": self.URLs.currentAction(),
            "base_path": self._get_absolute_path(),
        }
        self.page_msg(context)
        self.templates.write("setup", context)

    #_________________________________________________________________________

    def create_new_gallerie(self):
        """
        Erstellt eine neue Gallerie
        """
        try:
            gallery_name = self.request.form["name"]
        except KeyError, e:
            self.page_msg.red("Form error. Key '%s' not found." % e)
            return

        if gallery_name in self.plugin_cfg["galleries"]:
            self.page_msg.red("A gallery named '%s' already exists!" %
                              gallery_name)
            return

        self.plugin_cfg["galleries"][gallery_name] = {
            "path": None,
            "cfg": self.plugin_cfg["default_cfg"],
        }
        self.page_msg.green("Gallerie created. Please setup.")

        # Direkt die Config Seite aufrufen
        self.gallery_config([gallery_name])
예제 #5
0
    def __init__(self, *args, **kwargs):
        super(PluginCfgExample, self).__init__(*args, **kwargs)

        self.plugin_cfg = PluginConfig(self.request, self.response)
예제 #6
0
class pygallery(PyLucidBaseModule):
    def __init__(self, *args, **kwargs):
        super(pygallery, self).__init__(*args, **kwargs)

        self.plugin_cfg = PluginConfig(self.request, self.response)

        self.absolute_base_path = self._get_absolute_path()
        if debug:
            self.page_msg("absolute_path:", self.absolute_base_path)

    def lucidFunction(self, function_info):
        """
        Aufruf um eine Gallerie in die CMS Seite aufzubauen
        """
        self.gallery(function_info)

    # _________________________________________________________________________

    def lucidTag(self):
        """
        Dummy, mit Infos
        """
        self.setup()

    def setup(self):
        """
        Alle existierende Gallerien verwalten
        """
        if debug:
            self.page_msg(self.request.form)
            self.plugin_cfg.debug()

        if "create" in self.request.form:
            # Es soll eine neue Gallerie eingerichtet werden
            self.create_new_gallerie()
            return

        galleries = []
        for gallerie, data in self.plugin_cfg["galleries"].iteritems():
            tag = "<lucidFunction:pygallery>%s</lucidFunction>" % gallerie
            tag = cgi.escape(tag)
            galleries.append(
                {
                    "name": gallerie,
                    "lucidFunction": tag,
                    "path": data["path"],
                    "edit_link": self.URLs.actionLink("gallery_config", gallerie),
                }
            )

        context = {"galleries": galleries, "url": self.URLs.currentAction(), "base_path": self._get_absolute_path()}
        self.page_msg(context)
        self.templates.write("setup", context)

    # _________________________________________________________________________

    def create_new_gallerie(self):
        """
        Erstellt eine neue Gallerie
        """
        try:
            gallery_name = self.request.form["name"]
        except KeyError, e:
            self.page_msg.red("Form error. Key '%s' not found." % e)
            return

        if gallery_name in self.plugin_cfg["galleries"]:
            self.page_msg.red("A gallery named '%s' already exists!" % gallery_name)
            return

        self.plugin_cfg["galleries"][gallery_name] = {"path": None, "cfg": self.plugin_cfg["default_cfg"]}
        self.page_msg.green("Gallerie created. Please setup.")

        # Direkt die Config Seite aufrufen
        self.gallery_config([gallery_name])