コード例 #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
ファイル: pygallery.py プロジェクト: jedie/PyLucid-Plugins
    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
ファイル: pygallery.py プロジェクト: jedie/PyLucid-Plugins
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])